Extension: Geometries
#include "dg/geometries/geometries.h"
Loading...
Searching...
No Matches
Collaboration diagram for Wall and Sheath:

Classes

struct  dg::geo::mod::ClosedFieldlineRegion
 Predicate identifying closed fieldline region. More...
 
struct  dg::geo::mod::SOLRegion
 The default predicate for sheath integration. More...
 
struct  dg::geo::WallFieldlineDistance
 Distance to wall along fieldline in phi or s coordinate More...
 
struct  dg::geo::WallFieldlineCoordinate
 Normalized coordinate relative to wall along fieldline in phi or s coordinate. More...
 

Functions

TokamakMagneticField dg::geo::createModifiedField (dg::file::WrappedJsonValue gs, dg::file::WrappedJsonValue jsmod, CylindricalFunctor &wall, CylindricalFunctor &transition)
 Modify Magnetic Field and create wall above or below certain Psi values according to given parameters.
 
CylindricalFunctor dg::geo::createWallRegion (dg::geo::TokamakMagneticField mag, dg::file::WrappedJsonValue jsmod)
 A convenience function call for dg::geo::createModifiedField that ignores the transition parameter and returns the wall functor.
 
CylindricalFunctor dg::geo::createWallRegion (dg::file::WrappedJsonValue gs, dg::file::WrappedJsonValue jsmod)
 DEPRECATED Same as createWallRegion( createMagneticField(gs), jsmod);
 
void dg::geo::createSheathRegion (dg::file::WrappedJsonValue jsmod, TokamakMagneticField mag, CylindricalFunctor wall, dg::Grid2d &sheath_walls, CylindricalFunctor &sheath)
 Create the sheath region where fieldlines intersect the boundary.
 

Detailed Description

Function Documentation

◆ createModifiedField()

TokamakMagneticField dg::geo::createModifiedField ( dg::file::WrappedJsonValue gs,
dg::file::WrappedJsonValue jsmod,
CylindricalFunctor & wall,
CylindricalFunctor & transition )
inline

Modify Magnetic Field and create wall above or below certain Psi values according to given parameters.

In simple terms the wall/modification region is given as a flux aligned region "heaviside"

\[ \chi_w(R,Z) = \begin{cases} 1 \text{ if} &\rho_p(R,Z) > \rho_w \\ 0 \text{ else}& \end{cases} \]

or with additional modification in the private flux region "sol_pfr"

\[ \chi_w(R,Z) = \begin{cases} 1 \text{ if} &\rho_p(R,Z) > \rho_w \vee \\ &( \rho_p(R,Z) < \rho_{F} \wedge Z < Z_X ) \\ 0 \text{ else}& \end{cases} \]

where we normalize \( \psi_p\) according to

\[ \rho_p = \sqrt{\frac{\psi_{p,O} - \psi_p}{\psi_{p,O}}}. \]

where \( \psi_{p,O}\) is the O-point value. The sharp Heaviside jumps are replaced by the dg::PolynomialHeaviside function (an approximation to the Heaviside function with width alpha).

For 2 X-points we can have 2 "sol_prf" regions, one for the lower X-point and one for the upper one.

The \( \psi_p\) is computed from the given parameters using dg::geo::createMagneticField and is modified using the dg::IPolynomialHeaviside function (s.a. dg::geo::mod::Psip) to a constant value with the boundary and alpha values given by the same parameters as define the wall region above. A modified TokamakMagneticField is then returned. This subsequently modifies all derivatives of psi and the poloidal current in this region.

Note
The main reason we need to modify the flux function to a constant is the FCI scheme, which does not play well with field-lines that intersect the boundary of our simulation domain. In such a case it is advantageous to smoothly bend the magnetic field-lines to a purely toroidal field.
Parameters
gsforwarded to dg::geo::createMagneticField
jsmodcontains the fields described below to steer the creation of the modification and wall region
{
// no wall region
"type": "none"
}
{
// Simple flux aligned wall above a threshold value
"type": "heaviside",
"boundary": 1.1,
"alpha": 0.20
}
{
// Double flux aligned wall above and below a threshold value
"type": "sol_pfr",
"boundary": [1.1,0.998],
// First value indicates SOL, second the PFR
"alpha": [0.10,0.10]
}
{
// sol_pfr for two X-points
// first value is for outboard midplane, second is lower pfr, next is
// inboard midplane, last is upper pfr
"type": "sol_pfr_2X",
"boundary": [1.1,0.998, 1.02,0.97],
"alpha": [0.10,0.10, 0.05,0.05]
}
wall(out) On output contains the region where the wall is applied, the functor returns 1 where the wall is, 0 where there it is not and 0<f<1 in the transition region
transition(out) On output contains the region where the transition of Psip to a constant value occurs, the functor returns 0<f<=1 for when there is a transition and 0 else
Returns
The modified magnetic field object

◆ createSheathRegion()

void dg::geo::createSheathRegion ( dg::file::WrappedJsonValue jsmod,
TokamakMagneticField mag,
CylindricalFunctor wall,
dg::Grid2d & sheath_walls,
CylindricalFunctor & sheath )
inline

Create the sheath region where fieldlines intersect the boundary.

In order to define sheath boundary conditions we first define a sheath region and then determine whether the field lines point toward the wall or away from it. We define as sheath any part on the bounding box that is not included in the wall penalization. Then we check for each point in the box the poloidal distance (in terms of angle \(\varphi\)) to the sheath wall and if the poloidal field points toward or away from the wall closest to it. We define an angular distance \(\varphi_w\) of each point \((R,Z)\) to the bounding box via the integration of

\[ \frac{dR}{d\varphi} = \frac{b^R}{b^\varphi}, \qquad \frac{dZ}{d\varphi} = \frac{b^Z}{b^\varphi}, \]

with initial condition \((R,Z)\) until \(R((\varphi_w), Z(\varphi_w))\) intersects the bounding box. The intersection can be found with a bisection algorithm. The sheath is then given by

\[ \chi_s(R,Z) := \begin{cases} 1 \text{ if } \varphi_w(R,Z) < \varphi_s \\ 0 \text{ else} \end{cases}, \]

In order to smoothen the Heaviside function we take \(\theta_{\alpha/2}\left( 2\pi(b_s - \frac{\alpha}{2}) - \varphi_w(R,Z)\right)\) and take the set intersection of that region and the `‘not wall’' region to determine the sheath penalization region:

\[ \chi_s := \left(1-\chi_w(R,Z,\varphi)\right) \theta_{\alpha/2}\left( 2\pi\left(b_s - \frac{\alpha}{2}\right) - \varphi_w(R,Z)\right) \]

with \( \varphi_s = 2\pi b_s\).

The sheath functor that comes out of this does

(i) on each of the four lines defined by the two vertical (R0, R1) and two horizontal (Z0, Z1) boundaries check if the "wall" functor is zero anywhere on the line: if not then move this boundary far away

(ii) Measure the angular distance along the fieldline (both in positive and negative direction) to the remaining walls using dg::geo::WallFieldlineDistance (in "phi" mode) using the dg::geo::SOLRegion predicate

(iii) Modify the angular distances with a dg::PolynomialHeaviside functor with parameters given in jsmod:

{
"boundary" : 0.0625, // value (b_s in above equation) where sheath region begins in units of 2Pi
"alpha" : 0.015625 // diameter of the transition region in units of 2Pi
}

(iv) The sheath region is the SetUnion of positive and negative functor, together with the SetIntersection with the SetNot(wall) region.

Parameters
jsmodmust contain fields as described above
mag(in) the (unmodified) magnetic field, used to integrate the field towards or away from the sheath
wall(in) the penalization region that represents the actual (perpendicular) wall without the divertor (if 0 on the boundary the boundary will be considered to be a sheath, else the boundary will be ignored)
sheath_walls(inout) on input contains the box boundaries, on output the non-sheath boundaries are moved far away
sheath(out) contains the region recognized as sheath (returning +1 within the sheath and 0 outside of it and something in-between in the transition region)

◆ createWallRegion() [1/2]

CylindricalFunctor dg::geo::createWallRegion ( dg::file::WrappedJsonValue gs,
dg::file::WrappedJsonValue jsmod )
inline

DEPRECATED Same as createWallRegion( createMagneticField(gs), jsmod);

◆ createWallRegion() [2/2]

CylindricalFunctor dg::geo::createWallRegion ( dg::geo::TokamakMagneticField mag,
dg::file::WrappedJsonValue jsmod )
inline

A convenience function call for dg::geo::createModifiedField that ignores the transition parameter and returns the wall functor.