Skip to content

Commit

Permalink
Fix initial state when Z=0 not in middle of domain
Browse files Browse the repository at this point in the history
Using yymid rather than 0.5 produces poor starting conditions
when the Z domain is not centred on zero.
  • Loading branch information
bendudson committed Sep 8, 2019
1 parent dab60d4 commit 2c5bd3c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions freegs/equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,11 @@ def __init__(self, tokamak=machine.EmptyTokamak(),
self.R_1D = linspace(Rmin, Rmax, nx)
self.Z_1D = linspace(Zmin, Zmax, ny)
self.R, self.Z = meshgrid(self.R_1D, self.Z_1D, indexing='ij')

yymid = 1 - Zmax/(Zmax - Zmin)


if psi is None:
# Starting guess for psi
xx, yy = meshgrid(linspace(0, 1, nx), linspace(0, 1, ny), indexing='ij')
psi = exp(-((xx - 0.5)**2 + (yy - yymid)**2) / 0.4**2)
psi = exp(-((xx - 0.5)**2 + (yy - 0.5)**2) / 0.4**2)

psi[0, :] = 0.0
psi[:, 0] = 0.0
Expand Down

0 comments on commit 2c5bd3c

Please sign in to comment.