Skip to content

Commit

Permalink
Update gfunc.m
Browse files Browse the repository at this point in the history
  • Loading branch information
jghoskins committed Oct 23, 2024
1 parent b9f0590 commit 1d1650b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions chunkie/+chnk/+axissymlap2d/gfunc.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
function [gval,gdz,gdr,gdrp] = gfunc(r,rp,dr,z,zp,dz)
domega3 = 2*pi;
n = 3;

t0 = (r == 0);
s0 = (rp == 0);
st0 = ~((~t0).*(~s0));
dz2 = dz.^2;
gval0 = 2*pi^2*rp./(sqrt(r.^2+rp.^2+dz2));

gdrp0 = -2*pi*(-4*pi^2)*rp.^2./(4*pi*sqrt(rp.^2+dz.^2).^3);
gdz0 = -2*pi*(-4*pi^2)*rp.*dz./(4*pi*sqrt(rp.^2+dz.^2).^3);

t = (dz.^2+dr.^2)./(2.*r.*rp);
[q0,q1,q0d] = chnk.axissymlap2d.qleg_half(t);
Expand All @@ -15,4 +24,9 @@
rfac = -rp*(n-2)/2.*q0+(-(1+t).*rp+r).*q0d;
gdr = -domega3*(rp./r).^((n-2)/2)./(rp.*r) ...
.*rfac;

gval(st0) = gval0(st0);
gdr(st0) = 0;
gdrp(st0) = gdrp0(st0);
gdz(st0) = gdz0(st0);
end

0 comments on commit 1d1650b

Please sign in to comment.