Extension: Geometries
#include "dg/geometries/geometries.h"
dg::geo::SimpleOrthogonal Struct Reference

Generate a simple orthogonal grid. More...

Inheritance diagram for dg::geo::SimpleOrthogonal:
[legend]

Public Member Functions

 SimpleOrthogonal (const CylindricalFunctorsLvl2 &psi, double psi_0, double psi_1, double x0, double y0, double psi_firstline, int mode=0)
 Construct a simple orthogonal grid. More...
 
 SimpleOrthogonal (const CylindricalFunctorsLvl2 &psi, const CylindricalSymmTensorLvl1 &chi, double psi_0, double psi_1, double x0, double y0, double psi_firstline, int mode=0)
 Construct a simple orthogonal grid. More...
 
double f0 () const
 The grid constant. More...
 
virtual SimpleOrthogonalclone () const override final
 Abstract clone method that returns a copy on the heap. More...
 
- Public Member Functions inherited from dg::geo::aRealGenerator2d< real_type >
real_type width () const
 length in \( \zeta\) of the computational space More...
 
real_type height () const
 length in \( \eta\) of the computational space More...
 
bool isOrthogonal () const
 sparsity pattern for metric More...
 
void generate (const thrust::host_vector< real_type > &zeta1d, const thrust::host_vector< real_type > &eta1d, thrust::host_vector< real_type > &x, thrust::host_vector< real_type > &y, thrust::host_vector< real_type > &zetaX, thrust::host_vector< real_type > &zetaY, thrust::host_vector< real_type > &etaX, thrust::host_vector< real_type > &etaY) const
 Generate grid points and elements of the Jacobian. More...
 
virtual aRealGenerator2dclone () const =0
 Abstract clone method that returns a copy on the heap. More...
 
virtual ~aRealGenerator2d ()
 

Additional Inherited Members

- Protected Member Functions inherited from dg::geo::aRealGenerator2d< real_type >
 aRealGenerator2d ()
 empty More...
 
 aRealGenerator2d (const aRealGenerator2d &)
 empty More...
 
aRealGenerator2doperator= (const aRealGenerator2d &)
 return *this More...
 

Detailed Description

Generate a simple orthogonal grid.

First discretize a closed flux surface. Then each point is followed along the gradient of Psi to obtain the points on other flux surfaces.

Note
find more details in M. Wiesenberger, M. Held, L. Einkemmer Streamline integration as a method for two-dimensional elliptic grid generation Journal of Computational Physics 340, 435-450 (2017)

Psi is the radial coordinate and you can choose various discretizations of the first line

std::unique_ptr<dg::geo::aGenerator2d> generator;
//create the magnetic field
js["magnetic_field"]["params"]);
//create a grid generator
std::string type = js["grid"]["generator"]["type"].asString();
int mode = 0;
if( type != "dsp")
mode = js["grid"]["generator"]["mode"].asInt();
std::cout << "Constructing "<<type<<" grid ... \n";
if( type == "flux")
generator = std::make_unique<dg::geo::FluxGenerator>( mag.get_psip(),
mag.get_ipol(), psi_0, psi_1, mag.R0(), 0., mode, false);
else if( type == "orthogonal")
{
double psi_init = js["grid"]["generator"]["firstline"].asDouble();
if( mode == 0 || mode == 1)
generator = std::make_unique<dg::geo::SimpleOrthogonal>(
mag.get_psip(), psi_0, psi_1, mag.R0(), 0., psi_init, mode);
if( mode > 1)
{
generator = std::make_unique<dg::geo::SimpleOrthogonal>(
mag.get_psip(), lc, psi_0, psi_1, mag.R0(), 0., psi_init,
mode%2);
}
}
else if( type == "separatrix-orthogonal")
{
double RX = mag.R0()-1.1*mag.params().triangularity()*mag.params().a();
double ZX = -1.1*mag.params().elongation()*mag.params().a();
dg::geo::findXpoint( mag.get_psip(), RX, ZX);
//dg::geo::CylindricalSymmTensorLvl1 monitor_chi;
double fx = js["grid"]["generator"]["fx"].asDouble();
generator = std::make_unique<dg::geo::SeparatrixOrthogonalAdaptor>(
mag.get_psip(), monitor_chi, psi_0, RX, ZX, mag.R0(), 0., mode, false, fx);
//psi_1 = -fx/(1.-fx)*psi_0;
}
else if ( type == "dsp")
{
double boxscaleRm = js["grid"][ "scaleR"].get( 0u, 1.05).asDouble();
double boxscaleRp = js["grid"][ "scaleR"].get( 1u, 1.05).asDouble();
double boxscaleZm = js["grid"][ "scaleZ"].get( 0u, 1.05).asDouble();
double boxscaleZp = js["grid"][ "scaleZ"].get( 1u, 1.05).asDouble();
const double Rmin=mag.R0()-boxscaleRm*mag.params().a();
const double Zmin=-boxscaleZm*mag.params().a();
const double Rmax=mag.R0()+boxscaleRp*mag.params().a();
const double Zmax=boxscaleZp*mag.params().a();
generator = std::make_unique<dg::geo::DSPGenerator>( mag,
Rmin, Rmax, Zmin, Zmax, 2.*M_PI/(double)Nz);
}
else if( type == "ribeiro-flux")
generator = std::make_unique<dg::geo::RibeiroFluxGenerator>( mag.get_psip(),
psi_0, psi_1, mag.R0(), 0., mode, false);
else if( type == "ribeiro")
generator = std::make_unique<dg::geo::Ribeiro>( mag.get_psip(),
psi_0, psi_1, mag.R0(), 0., mode, false);
static TokamakMagneticField createMagneticField(dg::file::WrappedJsonValue gs)
Create a Magnetic field based on the given parameters.
Definition: make_field.h:75
static void findXpoint(const CylindricalFunctorsLvl2 &psi, double &RC, double &ZC)
This function finds X-points of psi.
Definition: fluxfunctions.h:350
static CylindricalSymmTensorLvl1 make_LiseikinCollective(const CylindricalFunctorsLvl2 &psi, double k, double eps)
Definition: adaption.h:254
static CylindricalSymmTensorLvl1 make_Xconst_monitor(const CylindricalFunctorsLvl2 &psi, double &R_X, double &Z_X)
construct a monitor metric in which the Laplacian vanishes at the X-point
Definition: utilitiesX.h:92
Definition: fluxfunctions.h:361
double a() const
The minor radius.
Definition: magnetic_field.h:122
double elongation() const
Definition: magnetic_field.h:128
double triangularity() const
Definition: magnetic_field.h:134
A tokamak field as given by R0, Psi and Ipol plus Meta-data like shape and equilibrium.
Definition: magnetic_field.h:162
const CylindricalFunctorsLvl2 & get_psip() const
Definition: magnetic_field.h:197
const CylindricalFunctorsLvl1 & get_ipol() const
Definition: magnetic_field.h:198
const MagneticFieldParameters & params() const
Access Meta-data of the field.
Definition: magnetic_field.h:204
double R0() const
Definition: magnetic_field.h:177

Constructor & Destructor Documentation

◆ SimpleOrthogonal() [1/2]

dg::geo::SimpleOrthogonal::SimpleOrthogonal ( const CylindricalFunctorsLvl2 psi,
double  psi_0,
double  psi_1,
double  x0,
double  y0,
double  psi_firstline,
int  mode = 0 
)
inline

Construct a simple orthogonal grid.

Parameters
psi\(\psi(x,y)\) is the flux function and its derivatives in Cartesian coordinates (x,y)
psi_0first boundary (can be open)
psi_1second boundary (can be open)
x0a point on or close to the contour line given by psi_firstline
y0a point on or close to the contour line given by psi_firstline
psi_firstlinepsi value for first line discretization (must be a closed flux surface)
modeIndicate mode used to create the first line discretization: 0 is conformal, 1 is an equalarc adaption

◆ SimpleOrthogonal() [2/2]

dg::geo::SimpleOrthogonal::SimpleOrthogonal ( const CylindricalFunctorsLvl2 psi,
const CylindricalSymmTensorLvl1 chi,
double  psi_0,
double  psi_1,
double  x0,
double  y0,
double  psi_firstline,
int  mode = 0 
)
inline

Construct a simple orthogonal grid.

Parameters
psi\(\psi(x,y)\) is the flux function and its derivatives in Cartesian coordinates (x,y)
chiis the monitor tensor and its divergenc in Cartesian coordinates (x,y)
psi_0first boundary (can be open)
psi_1second boundary (can be open)
x0a point on or close to the contour line given by psi_firstline
y0a point on or close to the contour line given by psi_firstline
psi_firstlinepsi value for first line discretization (must be a closed flux surface)
modeIndicate mode used to create the first line discretization: 0 is conformal, 1 is an equalarc adaption

Member Function Documentation

◆ clone()

virtual SimpleOrthogonal * dg::geo::SimpleOrthogonal::clone ( ) const
inlinefinaloverridevirtual

Abstract clone method that returns a copy on the heap.

Returns
a copy of *this on the heap

Implements dg::geo::aRealGenerator2d< real_type >.

◆ f0()

double dg::geo::SimpleOrthogonal::f0 ( ) const
inline

The grid constant.

Returns
f_0 is the grid constant s.a. width() )

The documentation for this struct was generated from the following file: