@@ -23,8 +23,8 @@ def create_tokamak(geometry="lsn", nx=65, ny=65):
2323 psi2d[nx,ny] 2D array of poloidal flux [Wb]
2424 """
2525
26- r1d = np .linspace (1.2 , 1.8 , nx )
27- z1d = np .linspace (- 0.5 , 0.5 , ny )
26+ r1d = np .linspace (1.0 , 2.0 , nx )
27+ z1d = np .linspace (- 0.7 , 0.7 , ny )
2828 r2d , z2d = np .meshgrid (r1d , z1d , indexing = "ij" )
2929
3030 r0 = 1.5
@@ -115,23 +115,39 @@ def create_tokamak(geometry="lsn", nx=65, ny=65):
115115
116116 from hypnotoad import tokamak
117117
118+ # Put wall inside grid, so that we can have boundary points outside with wall wthout
119+ # hitting extrapolated psi.
120+ wall_extra = 0.2
121+ rmin = min (r1d ) + wall_extra
122+ rmax = max (r1d ) - wall_extra
123+ zmin = min (z1d ) + wall_extra
124+ zmax = max (z1d ) - wall_extra
118125 eq = tokamak .TokamakEquilibrium (
119- r1d , z1d , psi2d , psi1d , [], settings = options # psi1d, fpol
126+ r1d ,
127+ z1d ,
128+ psi2d ,
129+ psi1d ,
130+ fpol1D = [],
131+ settings = options ,
132+ wall = [(rmin , zmin ), (rmin , zmax ), (rmax , zmax ), (rmax , zmin )],
120133 )
121134
122135 from hypnotoad .core .mesh import BoutMesh
123136
124137 mesh = BoutMesh (eq , options )
125138 mesh .geometry ()
139+ mesh .writeGridfile ("bout.grd.nc" )
126140
127141 if not args .no_plot :
128142 import matplotlib .pyplot as plt
129143
130144 eq .plotPotential (ncontours = 40 )
145+ eq .plotWall ()
131146
132147 plt .plot (* eq .x_points [0 ], "rx" )
133148
134149 mesh .plotPoints (xlow = True , ylow = True , corners = True )
150+ eq .plotWall ()
135151
136152 plt .show ()
137153
0 commit comments