diff --git a/doc/nonorthogonal-grid.rst b/doc/nonorthogonal-grid.rst index e5a23387..530b8ccc 100644 --- a/doc/nonorthogonal-grid.rst +++ b/doc/nonorthogonal-grid.rst @@ -20,6 +20,19 @@ way that varies smoothly with :math:`\psi`. see `feature request #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 @@ -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 ` and combining them with certain weights @@ -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. diff --git a/doc/whats-new.md b/doc/whats-new.md index 4c24b3cb..ad5843a1 100644 --- a/doc/whats-new.md +++ b/doc/whats-new.md @@ -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) ------------------------- diff --git a/hypnotoad/core/equilibrium.py b/hypnotoad/core/equilibrium.py index f9885f19..5f2b8203 100644 --- a/hypnotoad/core/equilibrium.py +++ b/hypnotoad/core/equilibrium.py @@ -2444,6 +2444,7 @@ class EquilibriumRegion(PsiContour): "poloidal_orthogonal_combined", "perp_orthogonal_combined", "orthogonal", + "linear", ], ), ) @@ -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,