Skip to content

Commit d8e6be6

Browse files
authored
Merge pull request #176 from boutproject/gui-views
Add a View menu, improve grid plotting
2 parents dc2f697 + 4cbe73a commit d8e6be6

11 files changed

+915
-236
lines changed

doc/grid-file.rst

+36
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,27 @@ BoutMesh writes three poloidal coordinates to the grid file:
138138
full poloidal turn around a closed flux surface. Not calculated on open
139139
flux surfaces.
140140

141+
Wall location
142+
+++++++++++++
143+
144+
If a wall is defined in the equilibrium then the coordinates of the
145+
closed wall is saved:
146+
147+
.. list-table::
148+
:widths: 30 70
149+
150+
* - ``closed_wall_R``
151+
152+
- Major radius locations [in meters] of points on the wall. This
153+
array forms a closed loop so the last element is the same as
154+
the first.
155+
156+
* - ``closed_wall_Z``
157+
158+
- Height locations [in meters] of points on the wall, the same
159+
number of points as ``closed_wall_R``. This array forms a
160+
closed loop so the last element is the same as the first.
161+
141162
2D arrays
142163
---------
143164

@@ -211,6 +232,21 @@ Magnetic field quantities
211232

212233
- Total magnetic field.
213234

235+
Boundary quantities
236+
+++++++++++++++++++
237+
238+
.. list-table::
239+
:widths: 30 70
240+
241+
* - ``penalty_mask``
242+
243+
- A 2D mask indicating whether a cell is inside or outside the
244+
wall. It's value is 1 for cells entirely outside the wall; 0
245+
for cells entirely inside the wall. Cells that cross the wall
246+
are given a penalty proportional to the fraction of the cell
247+
poloidal length that is inside the wall.
248+
249+
214250
Integral quantities
215251
+++++++++++++++++++
216252

doc/whats-new.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,21 @@
11
Release history
22
===============
33

4+
### Bug fixes
5+
6+
7+
### New features
8+
9+
- Radial grid line construction can recover from failure and generate
10+
a rough grid to help visual inspection when option
11+
`follow_perpendicular_recover` is set to True (#175)
12+
- A `View` menu enables the grid plot to be customised, with cell edges, corners,
13+
grid lines and other components (#176).
14+
- `penalty_mask` is calculated and written to the grid file, based on intersection
15+
of the grid with the wall. This enables immersed boundary conditions.
16+
- Wall coordinates are written to output grid as `closed_wall_R` and `closed_wall_Z`
17+
(#176)
18+
419
0.5.2 (13th March 2023)
520
-------------------------
621

hypnotoad/cases/circular.py

+4-11
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,7 @@ def d2psidr2_r(self, r):
293293
def func(x):
294294
return (
295295
B0 / (np.sqrt(1.0 - x**2 / R0**2) * self.q(x))
296-
+ B0
297-
* x**2
298-
/ (R0**2 * (1.0 - x**2 / R0**2) ** 1.5 * self.q(x))
296+
+ B0 * x**2 / (R0**2 * (1.0 - x**2 / R0**2) ** 1.5 * self.q(x))
299297
- B0
300298
* x
301299
* self.dqdr(x)
@@ -326,10 +324,7 @@ def psi_r(self, r):
326324

327325
def func(x):
328326
return (
329-
B0
330-
* R0**2
331-
/ coef_array[0]
332-
* (1.0 - np.sqrt(1.0 - x**2 / R0**2))
327+
B0 * R0**2 / coef_array[0] * (1.0 - np.sqrt(1.0 - x**2 / R0**2))
333328
)
334329

335330
self._psi_r = func
@@ -346,8 +341,7 @@ def func(x):
346341
* (
347342
-1.0
348343
+ np.sqrt(
349-
(a1 * (-(x**2) + R0**2))
350-
/ (a0 + a1 * R0**2)
344+
(a1 * (-(x**2) + R0**2)) / (a0 + a1 * R0**2)
351345
)
352346
)
353347
)
@@ -356,8 +350,7 @@ def func(x):
356350
* (
357351
1.0
358352
+ np.sqrt(
359-
(a1 * (-(x**2) + R0**2))
360-
/ (a0 + a1 * R0**2)
353+
(a1 * (-(x**2) + R0**2)) / (a0 + a1 * R0**2)
361354
)
362355
)
363356
)

hypnotoad/core/equilibrium.py

+4-16
Original file line numberDiff line numberDiff line change
@@ -4792,10 +4792,7 @@ def psi(i):
47924792
* numpy.pi
47934793
* CosInt_m_j1
47944794
* numpy.sin(b * numpy.pi / n)
4795-
+ b**2
4796-
* numpy.pi
4797-
* numpy.cos(b * numpy.pi / n)
4798-
* SinInt_b_n
4795+
+ b**2 * numpy.pi * numpy.cos(b * numpy.pi / n) * SinInt_b_n
47994796
- b
48004797
* j1(i)
48014798
* numpy.pi
@@ -4812,14 +4809,8 @@ def psi(i):
48124809
* numpy.pi
48134810
* numpy.cos(b * numpy.pi / n)
48144811
* SinInt_b_n
4815-
+ n**2
4816-
* numpy.pi
4817-
* numpy.cos(b * numpy.pi / n)
4818-
* SinInt_b_n
4819-
- b**2
4820-
* numpy.pi
4821-
* numpy.cos(b * numpy.pi / n)
4822-
* SinInt_j1
4812+
+ n**2 * numpy.pi * numpy.cos(b * numpy.pi / n) * SinInt_b_n
4813+
- b**2 * numpy.pi * numpy.cos(b * numpy.pi / n) * SinInt_j1
48234814
+ b
48244815
* j1(i)
48254816
* numpy.pi
@@ -4836,10 +4827,7 @@ def psi(i):
48364827
* numpy.pi
48374828
* numpy.cos(b * numpy.pi / n)
48384829
* SinInt_j1
4839-
- n**2
4840-
* numpy.pi
4841-
* numpy.cos(b * numpy.pi / n)
4842-
* SinInt_j1
4830+
- n**2 * numpy.pi * numpy.cos(b * numpy.pi / n) * SinInt_j1
48434831
)
48444832
+ grad_upper / 2 * j2(i) * (b + n) / (b + j2(i))
48454833
- grad_upper

0 commit comments

Comments
 (0)