Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions doc/nonorthogonal-grid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,19 @@ way that varies smoothly with :math:`\psi`.
see `feature request #146
<https://github.com/boutproject/hypnotoad/issues/146>`_.

There are a few options for setting the poloidal spacing, described in
detail in the subsections below:

* Default method: can produce good-quality grids for production simulations.
Has may input parameters and usually requires extensive manual tweaking. Not
very robust.
* Linear spacing: Robust but inflexible, and produces grids with discontinuous
spacing. Not recommended for simulations, but may be useful for
exploration/scoping or to provide inputs to other tools.

Default method
--------------

The default method for nonorthogonal grids combines three properties:

* Close to orthogonal far from X-points and targets
Expand Down Expand Up @@ -147,8 +160,7 @@ file.
moving radially away from the X-point is limited -- far from the X-point the
poloidal spacing is approximately constant with changes in radius.

Technical details
-----------------
### Technical details

The spacing is implemented by defining three separate :ref:`spacing functions
<spacing-functions:Spacing functions>` and combining them with certain weights
Expand Down Expand Up @@ -179,3 +191,12 @@ is created by :meth:`EquilibriumRegion.getSfuncFixedPerpSpacing()
.. note:: Other methods for poloidal spacing than the default described on this
page can be chosen by changing the ``nonorthogonal_spacing_method`` setting,
but the other methods are intended mostly for debugging.

Linear spacing
--------------

To use set `nonorthogonal_spacing_method = "linear"` and
`poloidal_spacing_option = "linear"`.

In each region (target to X-point, or X-point to X-point) distributes the grid
points poloidally with a uniform spacing in poloidal (not parallel!) distance.
2 changes: 2 additions & 0 deletions doc/whats-new.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ Release history
- Extend divertor legs with `leg_extend` options. These specify how far each
leg should extend beyond the wall intersection (#195).
By [Ben Dudson](https://github.com/bendudson)
- Linear poloidal spacing option for nonorthogonal grids (#190).
By [John Omotani](https://github.com/johnomotani)

0.5.2 (13th March 2023)
-------------------------
Expand Down
9 changes: 9 additions & 0 deletions hypnotoad/core/equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -2444,6 +2444,7 @@ class EquilibriumRegion(PsiContour):
"poloidal_orthogonal_combined",
"perp_orthogonal_combined",
"orthogonal",
"linear",
],
),
)
Expand Down Expand Up @@ -2924,6 +2925,14 @@ def getSfuncFixedSpacing(
spacing_lower=spacings["nonorthogonal_orthogonal_d_lower"],
spacing_upper=spacings["nonorthogonal_orthogonal_d_upper"],
)
elif (
self.nonorthogonal_options.nonorthogonal_spacing_method == "orthogonal"
):
sfunc = self.getLinearPoloidalDistanceFunc(
distance,
npoints - 1,
)
self._checkMonotonic([(sfunc, "linear")], total_distance=distance)
else:
sfunc = self.getSfuncFixedSpacing(
npoints,
Expand Down