@@ -220,6 +220,13 @@ def __init__(self, nx, ny, *, ng=1,
220220
221221 self .Ay = self .Lx
222222
223+ # Spatial derivative of log(area). It's zero for Cartesian
224+
225+ self .dlogAx = ArrayIndexer (np .zeros_like (self .Ax ),
226+ grid = self )
227+ self .dlogAy = ArrayIndexer (np .zeros_like (self .Ay ),
228+ grid = self )
229+
223230 # Volume of the cell.
224231
225232 self .V = ArrayIndexer (np .full ((self .qx , self .qy ), self .dx * self .dy ),
@@ -235,7 +242,9 @@ def __str__(self):
235242class SphericalPolar (Grid2d ):
236243 """
237244 This class defines a spherical polar grid.
238- This is technically a 2D geometry but assumes azimuthal symmetry.
245+ This is technically a 3D geometry but assumes azimuthal symmetry,
246+ and zero velocity in phi-direction.
247+ Hence 2D.
239248
240249 Define:
241250 r = x
@@ -279,6 +288,12 @@ def __init__(self, nx, ny, *, ng=1,
279288 self .Ay = np .abs (np .pi * np .sin (self .yl2d ) *
280289 (self .xr2d ** 2 - self .xl2d ** 2 ))
281290
291+ # dlogAx = 1 / r^2 d( r^2 ) / dr = 2 / r
292+ self .dlogAx = 2.0 / self .x2d
293+
294+ # dlogAy = 1 / (r sin(theta)) d( sin(theta) )/dtheta = cot(theta) / r
295+ self .dlogAy = 1.0 / (np .tan (self .y2d ) * self .x2d )
296+
282297 # Returns an array of the volume of each cell.
283298 # dV = dL_r * dL_theta * dL_phi
284299 # = (dr) * (r * dtheta) * (r * sin(theta) * dphi)
0 commit comments