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

Same as the Ribeiro class just but uses psi as a flux label directly. More...

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

Public Member Functions

 RibeiroFluxGenerator (const CylindricalFunctorsLvl2 &psi, double psi_0, double psi_1, double x0, double y0, int mode=0, bool verbose=false)
 Construct a flux aligned grid generator. More...
 
virtual RibeiroFluxGeneratorclone () const
 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

Same as the Ribeiro class just but uses psi as a flux label directly.

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

◆ RibeiroFluxGenerator()

dg::geo::RibeiroFluxGenerator::RibeiroFluxGenerator ( const CylindricalFunctorsLvl2 psi,
double  psi_0,
double  psi_1,
double  x0,
double  y0,
int  mode = 0,
bool  verbose = false 
)
inline

Construct a flux aligned grid generator.

Parameters
psi\( \psi(x,y)\) the flux function and its derivatives in Cartesian coordinates (x,y)
psi_0first boundary
psi_1second boundary
x0a point in the inside of the domain bounded by psi_0 (shouldn't be the O-point)
y0a point in the inside of the domain bounded by psi_0 (shouldn't be the O-point)
modeThis parameter indicates the adaption type used to create the grid: 0 is no adaption, 1 is an equalarc adaption
verboseif true the integrators will write additional information to std::cout

Member Function Documentation

◆ clone()

virtual RibeiroFluxGenerator * dg::geo::RibeiroFluxGenerator::clone ( ) const
inlinevirtual

Abstract clone method that returns a copy on the heap.

Returns
a copy of *this on the heap

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


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