diff --git a/chunkie/+chnk/+axissymhelm2d/asymint.m b/chunkie/+chnk/+axissymhelm2d/asymint.m deleted file mode 100644 index db60153..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymint.m +++ /dev/null @@ -1,4 +0,0 @@ -function [val] = asymint(x,a,k) - val = exp(1i*k*sqrt(1-(1-a).*cos(x)))./sqrt(1-(1-a).*cos(x)); -end - diff --git a/chunkie/+chnk/+axissymhelm2d/asymint_v.m b/chunkie/+chnk/+axissymhelm2d/asymint_v.m deleted file mode 100644 index b49400a..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymint_v.m +++ /dev/null @@ -1,4 +0,0 @@ -function [val] = asymint_v(r,k,efac) - val = efac; -end - diff --git a/chunkie/+chnk/+axissymhelm2d/asymintda.m b/chunkie/+chnk/+axissymhelm2d/asymintda.m deleted file mode 100644 index c027d3e..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymintda.m +++ /dev/null @@ -1,6 +0,0 @@ -function [val] = asymintda(x,a,k) - zz = sqrt(1-(1-a)*cos(x)); - val = cos(x).*exp(1i*k*zz)./(zz.^3).*(1i*k*zz-1)/2; - %val = exp(1i*k*sqrt(1-(1-a)*cos(x)))./sqrt(1-(1-a)*cos(x)); -end - diff --git a/chunkie/+chnk/+axissymhelm2d/asymintda_v.m b/chunkie/+chnk/+axissymhelm2d/asymintda_v.m deleted file mode 100644 index df3c223..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymintda_v.m +++ /dev/null @@ -1,5 +0,0 @@ -function [val] = asymintda_v(x,r,k,efac) - val = x.*efac./(r.^2).*(1i*k.*r-1)/2; - %val = exp(1i*k*sqrt(1-(1-a)*cos(x)))./sqrt(1-(1-a)*cos(x)); -end - diff --git a/chunkie/+chnk/+axissymhelm2d/asymintdaa.m b/chunkie/+chnk/+axissymhelm2d/asymintdaa.m deleted file mode 100644 index bb0133c..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymintdaa.m +++ /dev/null @@ -1,8 +0,0 @@ -function [val] = asymintdaa(x,a,k) - zz = sqrt(1-(1-a)*cos(x)); - prefac = 0.25*(cos(x).^2).*exp(1i*k*zz)./(zz.^5); - fac = -k^2*zz.^2-3*1i*k*zz+3; - val = fac.*prefac; - %val = -exp(1i*k*sqrt(1-(1-a)*cos(x))).*sqrt(1-(1-a)*cos(x)); -end - diff --git a/chunkie/+chnk/+axissymhelm2d/asymintdaa_v.m b/chunkie/+chnk/+axissymhelm2d/asymintdaa_v.m deleted file mode 100644 index 9b693a3..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymintdaa_v.m +++ /dev/null @@ -1,8 +0,0 @@ -function [val] = asymintdaa_v(x,r,k,efac,k2,r2) - rdiv = r2.^2; - prefac = 0.25*(x.^2).*efac./rdiv; - fac = k2.^2-3*k2+3; - val = fac.*prefac; - %val = -exp(1i*k*sqrt(1-(1-a)*cos(x))).*sqrt(1-(1-a)*cos(x)); -end - diff --git a/chunkie/+chnk/+axissymhelm2d/asymintdak.m b/chunkie/+chnk/+axissymhelm2d/asymintdak.m deleted file mode 100644 index f1d2fe2..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymintdak.m +++ /dev/null @@ -1,4 +0,0 @@ -function [val] = asymintdak(x,a,k) - val = -k/2*cos(x).*exp(1i*k*sqrt(1-(1-a)*cos(x)))./sqrt(1-(1-a)*cos(x)); -end - diff --git a/chunkie/+chnk/+axissymhelm2d/asymintdak_v.m b/chunkie/+chnk/+axissymhelm2d/asymintdak_v.m deleted file mode 100644 index 6936092..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymintdak_v.m +++ /dev/null @@ -1,4 +0,0 @@ -function [val] = asymintdak_v(x,r,k,efac) - val = -(k/2).*x.*efac; -end - diff --git a/chunkie/+chnk/+axissymhelm2d/asymintdk.m b/chunkie/+chnk/+axissymhelm2d/asymintdk.m deleted file mode 100644 index 9545dae..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymintdk.m +++ /dev/null @@ -1,4 +0,0 @@ -function [val] = asymintdk(x,a,k) - val = 1i*exp(1i*k*sqrt(1-(1-a)*cos(x))); -end - diff --git a/chunkie/+chnk/+axissymhelm2d/asymintdk_v.m b/chunkie/+chnk/+axissymhelm2d/asymintdk_v.m deleted file mode 100644 index 360b2f4..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymintdk_v.m +++ /dev/null @@ -1,4 +0,0 @@ -function [val] = asymintdk_v(r,k,efac) - val = 1i*efac.*r; -end - diff --git a/chunkie/+chnk/+axissymhelm2d/asymintdkk.m b/chunkie/+chnk/+axissymhelm2d/asymintdkk.m deleted file mode 100644 index 75e545f..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymintdkk.m +++ /dev/null @@ -1,4 +0,0 @@ -function [val] = asymintdkk(x,a,k) - val = -exp(1i*k*sqrt(1-(1-a)*cos(x))).*sqrt(1-(1-a)*cos(x)); -end - diff --git a/chunkie/+chnk/+axissymhelm2d/asymintdkk_v.m b/chunkie/+chnk/+axissymhelm2d/asymintdkk_v.m deleted file mode 100644 index 4bbc173..0000000 --- a/chunkie/+chnk/+axissymhelm2d/asymintdkk_v.m +++ /dev/null @@ -1,4 +0,0 @@ -function [val] = asymintdkk_v(x,r,k,efac) - val = -efac.*(r.^2); -end - diff --git a/chunkie/+chnk/+axissymhelm2d/der_ak_2_grad.m b/chunkie/+chnk/+axissymhelm2d/der_ak_to_grad.m similarity index 95% rename from chunkie/+chnk/+axissymhelm2d/der_ak_2_grad.m rename to chunkie/+chnk/+axissymhelm2d/der_ak_to_grad.m index c1375e6..15eb3f1 100644 --- a/chunkie/+chnk/+axissymhelm2d/der_ak_2_grad.m +++ b/chunkie/+chnk/+axissymhelm2d/der_ak_to_grad.m @@ -1,4 +1,4 @@ -function [dout] = der_ak_2_grad(r,q,z,i,ida,idk,... +function [dout] = der_ak_to_grad(r,q,z,i,ida,idk,... idaa,idak,idkk) dout = {}; diff --git a/chunkie/+chnk/+axissymhelm2d/div_by_kap.m b/chunkie/+chnk/+axissymhelm2d/div_by_kap.m index 037d839..05f48b3 100644 --- a/chunkie/+chnk/+axissymhelm2d/div_by_kap.m +++ b/chunkie/+chnk/+axissymhelm2d/div_by_kap.m @@ -7,7 +7,7 @@ i0daa= 0; i0dak= 0; i0dkk= 2./r0.^3; - [dout] = chnk.axissymhelm2d.der_ak_2_grad(r,q,z,i0,i0da,i0dk,... + [dout] = chnk.axissymhelm2d.der_ak_to_grad(r,q,z,i0,i0da,i0dk,... i0daa,i0dak,i0dkk); i = dfunc.int.*i0; diff --git a/chunkie/+chnk/+axissymhelm2d/helm_axi.m b/chunkie/+chnk/+axissymhelm2d/helm_axi.m index 681eec7..ff65406 100644 --- a/chunkie/+chnk/+axissymhelm2d/helm_axi.m +++ b/chunkie/+chnk/+axissymhelm2d/helm_axi.m @@ -1,4 +1,4 @@ -function [ds] = helm_axi(rs,drs,dzs,ifun,htables) +function [ds,varargout] = helm_axi(rs,drs,dzs,ifun,htables) r0s = sqrt(rs.^2+(rs+drs).^2+dzs.^2); alphs = (drs.^2+dzs.^2)./r0s.^2; @@ -88,7 +88,7 @@ kernsdak(ifar)= kfdak; kernsdkk(ifar)= kfdkk; - [dout] = chnk.axissymhelm2d.der_ak_2_grad(rs,drs,dzs,kerns,kernsda,kernsdk,... + [dout] = chnk.axissymhelm2d.der_ak_to_grad(rs,drs,dzs,kerns,kernsda,kernsdk,... kernsdaa,kernsdak,kernsdkk); [ds] = chnk.axissymhelm2d.div_by_kap(rs,drs,dzs,dout); ds.intdrz = -ds.intdrz; diff --git a/chunkie/+chnk/+axissymhelm2d/helm_axi_all.m b/chunkie/+chnk/+axissymhelm2d/helm_axi_all.m index dd5073d..0ea8f0e 100644 --- a/chunkie/+chnk/+axissymhelm2d/helm_axi_all.m +++ b/chunkie/+chnk/+axissymhelm2d/helm_axi_all.m @@ -81,11 +81,11 @@ kernsdaa_diff(iclose) = kcdaa; - + ifun = 4; [kf_k,kfda_k,kfdk_k,kfdaa_k,kfdak_k,kfdkk_k, ... kf_ik,kfda_ik,kfdk_ik,kfdaa_ik,kfdak_ik,kfdkk_ik] ... - = chnk.axissymhelm2d.helm_axi_smooth_all(r0s(imidnearnear),alphs(imidnearnear),... - htables.xlege_midnear,htables.wlege_midnear); + = chnk.axissymhelm2d.helm_axi_smooth(r0s(imidnearnear),alphs(imidnearnear),... + ifun,htables.xlege_midnear,htables.wlege_midnear); kerns_k(imidnearnear) = kf_k; kernsda_k(imidnearnear) = kfda_k; @@ -110,11 +110,11 @@ kernsdak_diff(imidnearnear)= kfdak_k - kfdak_ik; kernsdkk_diff(imidnearnear)= kfdkk_k - kfdkk_ik; - + ifun = 4; [kf_k,kfda_k,kfdk_k,kfdaa_k,kfdak_k,kfdkk_k, ... kf_ik,kfda_ik,kfdk_ik,kfdaa_ik,kfdak_ik,kfdkk_ik] ... - = chnk.axissymhelm2d.helm_axi_smooth_all(r0s(imidnear),alphs(imidnear),... - htables.xlege_midnear,htables.wlege_midnear); + = chnk.axissymhelm2d.helm_axi_smooth(r0s(imidnear),alphs(imidnear),... + ifun,htables.xlege_midnear,htables.wlege_midnear); kerns_k(imidnear) = kf_k; kernsda_k(imidnear) = kfda_k; @@ -139,11 +139,11 @@ kernsdak_diff(imidnear)= kfdak_k - kfdak_ik; kernsdkk_diff(imidnear)= kfdkk_k - kfdkk_ik; - + ifun = 4; [kf_k,kfda_k,kfdk_k,kfdaa_k,kfdak_k,kfdkk_k, ... kf_ik,kfda_ik,kfdk_ik,kfdaa_ik,kfdak_ik,kfdkk_ik] ... - = chnk.axissymhelm2d.helm_axi_smooth_all(r0s(imid),alphs(imid),... - htables.xlege_mid,htables.wlege_mid); + = chnk.axissymhelm2d.helm_axi_smooth(r0s(imid),alphs(imid),... + ifun,htables.xlege_mid,htables.wlege_mid); kerns_k(imid) = kf_k; kernsda_k(imid) = kfda_k; @@ -167,11 +167,11 @@ kernsdak_diff(imid)= kfdak_k - kfdak_ik; kernsdkk_diff(imid)= kfdkk_k - kfdkk_ik; - + ifun = 4; [kf_k,kfda_k,kfdk_k,kfdaa_k,kfdak_k,kfdkk_k, ... kf_ik,kfda_ik,kfdk_ik,kfdaa_ik,kfdak_ik,kfdkk_ik] ... - = chnk.axissymhelm2d.helm_axi_smooth_all(r0s(ifar),alphs(ifar),... - htables.xlege,htables.wlege); + = chnk.axissymhelm2d.helm_axi_smooth(r0s(ifar),alphs(ifar),... + ifun,htables.xlege,htables.wlege); kerns_k(ifar) = kf_k; kernsda_k(ifar) = kfda_k; @@ -197,14 +197,14 @@ kernsdkk_diff(ifar)= kfdkk_k - kfdkk_ik; - [doutk] = chnk.axissymhelm2d.der_ak_2_grad(rs,drs,dzs,kerns_k,kernsda_k,kernsdk_k,... + [doutk] = chnk.axissymhelm2d.der_ak_to_grad(rs,drs,dzs,kerns_k,kernsda_k,kernsdk_k,... kernsdaa_k,kernsdak_k,kernsdkk_k); [dsk] = chnk.axissymhelm2d.div_by_kap(rs,drs,dzs,doutk); dsk.intdrz = -dsk.intdrz; dsk.intdzz = -dsk.intdzz; - [doutik] = chnk.axissymhelm2d.der_ak_2_grad(rs,drs,dzs,kerns_ik,kernsda_ik,kernsdk_ik,... + [doutik] = chnk.axissymhelm2d.der_ak_to_grad(rs,drs,dzs,kerns_ik,kernsda_ik,kernsdk_ik,... kernsdaa_ik,kernsdak_ik,kernsdkk_ik); [dsik] = chnk.axissymhelm2d.div_by_kap(rs,drs,dzs,doutik); dsik.intdrz = -dsik.intdrz; @@ -212,7 +212,7 @@ - [doutdiff] = chnk.axissymhelm2d.der_ak_2_grad(rs,drs,dzs,kerns_diff,kernsda_diff,kernsdk_diff,... + [doutdiff] = chnk.axissymhelm2d.der_ak_to_grad(rs,drs,dzs,kerns_diff,kernsda_diff,kernsdk_diff,... kernsdaa_diff,kernsdak_diff,kernsdkk_diff); [dsdiff] = chnk.axissymhelm2d.div_by_kap(rs,drs,dzs,doutdiff); dsdiff.intdrz = -dsdiff.intdrz; diff --git a/chunkie/+chnk/+axissymhelm2d/helm_axi_smooth.m b/chunkie/+chnk/+axissymhelm2d/helm_axi_smooth.m index e3f6fba..e188d23 100644 --- a/chunkie/+chnk/+axissymhelm2d/helm_axi_smooth.m +++ b/chunkie/+chnk/+axissymhelm2d/helm_axi_smooth.m @@ -1,4 +1,5 @@ -function [kerns,kernsda,kernsdk,kernsdaa,kernsdak,kernsdkk] ... +function [kerns,kernsda,kernsdk,kernsdaa,kernsdak,kernsdkk,... + varargout] ... = helm_axi_smooth(r0s,alphs,ifun,xlege,wlege) @@ -15,12 +16,12 @@ r2 = rts.^2; k2 = 1i*r0t.*rts; - kerns = sum(chnk.axissymhelm2d.asymint_v(rts,r0t,efac),1); - kernsdk = sum(chnk.axissymhelm2d.asymintdk_v(rts,r0t,efac),1); - kernsda = sum(chnk.axissymhelm2d.asymintda_v(xle,rts,r0t,efac),1); - kernsdaa = sum(chnk.axissymhelm2d.asymintdaa_v(xle,rts,r0t,efac,k2,r2),1); - kernsdak = sum(chnk.axissymhelm2d.asymintdak_v(xle,rts,r0t,efac),1); - kernsdkk = sum(chnk.axissymhelm2d.asymintdkk_v(xle,rts,r0t,efac),1); + kerns = sum(asymint_v(rts,r0t,efac),1); + kernsdk = sum(asymintdk_v(rts,r0t,efac),1); + kernsda = sum(asymintda_v(xle,rts,r0t,efac),1); + kernsdaa = sum(asymintdaa_v(xle,rts,r0t,efac,k2,r2),1); + kernsdak = sum(asymintdak_v(xle,rts,r0t,efac),1); + kernsdkk = sum(asymintdkk_v(xle,rts,r0t,efac),1); if (ifun == 2) kernsdk = kernsdk*1i; @@ -33,12 +34,12 @@ efac = exp(1i*r0t.*rts)./rts.*wle; r2 = rts.^2; k2 = 1i*r0t.*rts; - kern2_v = sum(chnk.axissymhelm2d.asymint_v(rts,r0t,efac),1); - kern2dk_v = sum(chnk.axissymhelm2d.asymintdk_v(rts,r0t,efac),1); - kern2da_v = sum(chnk.axissymhelm2d.asymintda_v(xle,rts,r0t,efac),1); - kern2daa_v = sum(chnk.axissymhelm2d.asymintdaa_v(xle,rts,r0t,efac,k2,r2),1); - kern2dak_v = sum(chnk.axissymhelm2d.asymintdak_v(xle,rts,r0t,efac),1); - kern2dkk_v = sum(chnk.axissymhelm2d.asymintdkk_v(xle,rts,r0t,efac),1); + kern2_v = sum(asymint_v(rts,r0t,efac),1); + kern2dk_v = sum(asymintdk_v(rts,r0t,efac),1); + kern2da_v = sum(asymintda_v(xle,rts,r0t,efac),1); + kern2daa_v = sum(asymintdaa_v(xle,rts,r0t,efac,k2,r2),1); + kern2dak_v = sum(asymintdak_v(xle,rts,r0t,efac),1); + kern2dkk_v = sum(asymintdkk_v(xle,rts,r0t,efac),1); kerns = kerns - kern2_v; kernsdk = kernsdk - 1i*kern2dk_v; kernsda = kernsda - kern2da_v; @@ -47,5 +48,63 @@ kernsdkk = kernsdkk + kern2dkk_v; end + if (ifun == 4) + r0t = r0t*1i; + efac = exp(1i*r0t.*rts)./rts.*wle; + r2 = rts.^2; + k2 = 1i*r0t.*rts; + kern2_v = sum(asymint_v(rts,r0t,efac),1); + kern2dk_v = sum(asymintdk_v(rts,r0t,efac),1); + kern2da_v = sum(asymintda_v(xle,rts,r0t,efac),1); + kern2daa_v = sum(asymintdaa_v(xle,rts,r0t,efac,k2,r2),1); + kern2dak_v = sum(asymintdak_v(xle,rts,r0t,efac),1); + kern2dkk_v = sum(asymintdkk_v(xle,rts,r0t,efac),1); + + if (nargout == 12) + varargout{1} = kern2_v; + varargout{2} = kern2da_v; + varargout{3} = 1i*kern2dk_v; + varargout{4} = kern2daa_v; + varargout{5} = 1i*kern2dak_v; + varargout{6} = -kern2dkk_v; + end + end + end +function [val] = asymint_v(r,k,efac) + val = efac; +end + +function [val] = asymintda_v(x,r,k,efac) + val = x.*efac./(r.^2).*(1i*k.*r-1)/2; + %val = exp(1i*k*sqrt(1-(1-a)*cos(x)))./sqrt(1-(1-a)*cos(x)); +end + +function [val] = asymintdaa_v(x,r,k,efac,k2,r2) + rdiv = r2.^2; + prefac = 0.25*(x.^2).*efac./rdiv; + fac = k2.^2-3*k2+3; + val = fac.*prefac; + %val = -exp(1i*k*sqrt(1-(1-a)*cos(x))).*sqrt(1-(1-a)*cos(x)); +end + +function [val] = asymintdak_v(x,r,k,efac) + val = -(k/2).*x.*efac; +end + + + +function [val] = asymintdk_v(r,k,efac) + val = 1i*efac.*r; +end + + +function [val] = asymintdkk_v(x,r,k,efac) + val = -efac.*(r.^2); +end + + + + + diff --git a/chunkie/+chnk/+axissymhelm2d/helm_axi_smooth_all.m b/chunkie/+chnk/+axissymhelm2d/helm_axi_smooth_all.m deleted file mode 100644 index 3eb0dbb..0000000 --- a/chunkie/+chnk/+axissymhelm2d/helm_axi_smooth_all.m +++ /dev/null @@ -1,35 +0,0 @@ -function [kerns,kernsda,kernsdk,kernsdaa,kernsdak,kernsdkk, ... - kerns_i,kernsda_i,kernsdk_i,kernsdaa_i,kernsdak_i,kernsdkk_i] ... - = helm_axi_smooth_all(r0s,alphs,xlege,wlege) - - - [alp,xle] = meshgrid(alphs,xlege); - xle = cos(xle); - [r0t,wle] = meshgrid(r0s,wlege); - rts = sqrt(1-(1-alp).*xle); - - efac = exp(1i*r0t.*rts)./rts.*wle; - r2 = rts.^2; - k2 = 1i*r0t.*rts; - - kerns = sum(chnk.axissymhelm2d.asymint_v(rts,r0t,efac),1); - kernsdk = sum(chnk.axissymhelm2d.asymintdk_v(rts,r0t,efac),1); - kernsda = sum(chnk.axissymhelm2d.asymintda_v(xle,rts,r0t,efac),1); - kernsdaa = sum(chnk.axissymhelm2d.asymintdaa_v(xle,rts,r0t,efac,k2,r2),1); - kernsdak = sum(chnk.axissymhelm2d.asymintdak_v(xle,rts,r0t,efac),1); - kernsdkk = sum(chnk.axissymhelm2d.asymintdkk_v(xle,rts,r0t,efac),1); - - efac_i = exp(-r0t.*rts)./rts.*wle; - k2_i = -r0t.*rts; - r0t_i = r0t*1i; - - kerns_i = sum(chnk.axissymhelm2d.asymint_v(rts,r0t_i,efac_i),1); - kernsdk_i = 1i*sum(chnk.axissymhelm2d.asymintdk_v(rts,r0t_i,efac_i),1); - kernsda_i = sum(chnk.axissymhelm2d.asymintda_v(xle,rts,r0t_i,efac_i),1); - kernsdaa_i = sum(chnk.axissymhelm2d.asymintdaa_v(xle,rts,r0t_i,efac_i,k2_i,r2),1); - kernsdak_i = 1i*sum(chnk.axissymhelm2d.asymintdak_v(xle,rts,r0t_i,efac_i),1); - kernsdkk_i = -sum(chnk.axissymhelm2d.asymintdkk_v(xle,rts,r0t_i,efac_i),1); - - -end - diff --git a/chunkie/demo/demo_axissym_neumann.m b/chunkie/demo/demo_axissym_neumann.m index 96d4ceb..db289f4 100644 --- a/chunkie/demo/demo_axissym_neumann.m +++ b/chunkie/demo/demo_axissym_neumann.m @@ -1,6 +1,8 @@ addpaths_loc(); clear(); +rng(pi) + zk = 6*pi; type = 'chnkr-star';