Skip to content

Commit

Permalink
dx should be always positive definie
Browse files Browse the repository at this point in the history
  • Loading branch information
HarukiST committed Oct 8, 2024
1 parent 36fb632 commit b5331ed
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hypnotoad/core/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,9 +839,6 @@ def geometry1(self):
"""
self.psixy = self.meshParent.equilibrium.psi(self.Rxy, self.Zxy)

self.dx = MultiLocationArray(self.nx, self.ny)
self.dx.centre = (self.psi_vals[2::2] - self.psi_vals[:-2:2])[:, numpy.newaxis]
self.dx.ylow = (self.psi_vals[2::2] - self.psi_vals[:-2:2])[:, numpy.newaxis]

if self.psi_vals[0] > self.psi_vals[-1]:
# x-coordinate is -psixy so x always increases radially across grid
Expand All @@ -851,6 +848,11 @@ def geometry1(self):
self.bpsign = 1.0
self.xcoord = self.psixy

# dx must be positive definite
self.dx = MultiLocationArray(self.nx, self.ny)
self.dx.centre = self.bpsign*(self.psi_vals[2::2] - self.psi_vals[:-2:2])[:, numpy.newaxis]
self.dx.ylow = self.bpsign*(self.psi_vals[2::2] - self.psi_vals[:-2:2])[:, numpy.newaxis]

self.dy = MultiLocationArray(self.nx, self.ny)
self.dy.centre = self.meshParent.dy_scalar
self.dy.ylow = self.meshParent.dy_scalar
Expand Down

0 comments on commit b5331ed

Please sign in to comment.