Extension: Geometries
#include "dg/geometries/geometries.h"
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
dg::geo::aRealGenerator2d< real_type > Struct Template Referenceabstract

The abstract generator base class. More...

Inheritance diagram for dg::geo::aRealGenerator2d< real_type >:
[legend]

Public Member Functions

real_type width () const
 length in ζ of the computational space
 
real_type height () const
 length in η of the computational space
 
bool isOrthogonal () const
 sparsity pattern for metric
 
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.
 
virtual aRealGenerator2dclone () const =0
 Abstract clone method that returns a copy on the heap.
 
virtual ~aRealGenerator2d ()
 

Protected Member Functions

 aRealGenerator2d ()
 empty
 
 aRealGenerator2d (const aRealGenerator2d &)
 empty
 
aRealGenerator2doperator= (const aRealGenerator2d &)
 return *this
 

Detailed Description

template<class real_type>
struct dg::geo::aRealGenerator2d< real_type >

The abstract generator base class.

A generator is there to construct coordinate transformations from physical coordinates x,y to the computational domain ζ,η, which is a product space. It can be used to construct curvilinear grids like the following code snippet demonstrates:

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);
Note
the origin of the computational space is assumed to be (0,0)

Constructor & Destructor Documentation

◆ ~aRealGenerator2d()

template<class real_type >
virtual dg::geo::aRealGenerator2d< real_type >::~aRealGenerator2d ( )
inlinevirtual

◆ aRealGenerator2d() [1/2]

template<class real_type >
dg::geo::aRealGenerator2d< real_type >::aRealGenerator2d ( )
inlineprotected

empty

◆ aRealGenerator2d() [2/2]

template<class real_type >
dg::geo::aRealGenerator2d< real_type >::aRealGenerator2d ( const aRealGenerator2d< real_type > & )
inlineprotected

empty

Member Function Documentation

◆ clone()

template<class real_type >
virtual aRealGenerator2d * dg::geo::aRealGenerator2d< real_type >::clone ( ) const
pure virtual

◆ generate()

template<class real_type >
void dg::geo::aRealGenerator2d< real_type >::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
inline

Generate grid points and elements of the Jacobian.

Parameters
zeta1d(input) a list of Nζ points 0<ζi<width()
eta1d(input) a list of Nη points 0<ηj<height()
x(output) the list of NηNζ coordinates x(ζi,ηj)
y(output) the list of NηNζ coordinates y(ζi,ηj)
zetaX(output) the list of NηNζ elements ζ/x(ζi,ηj)
zetaY(output) the list of NηNζ elements ζ/y(ζi,ηj)
etaX(output) the list of NηNζ elements η/x(ζi,ηj)
etaY(output) the list of NηNζ elements η/y(ζi,ηj)
Note
the first ( ζ) coordinate shall be constructed contiguously in memory, i.e. the resuling lists are x0=x(ζ0,η0), x1=x(ζ1,η0) x2=x(ζ2,η0)xNM1=x(ζN1ηM1)
All the resulting vectors are write-only and get properly resized

◆ height()

template<class real_type >
real_type dg::geo::aRealGenerator2d< real_type >::height ( ) const
inline

length in η of the computational space

◆ isOrthogonal()

template<class real_type >
bool dg::geo::aRealGenerator2d< real_type >::isOrthogonal ( ) const
inline

sparsity pattern for metric

◆ operator=()

template<class real_type >
aRealGenerator2d & dg::geo::aRealGenerator2d< real_type >::operator= ( const aRealGenerator2d< real_type > & )
inlineprotected

return *this

◆ width()

template<class real_type >
real_type dg::geo::aRealGenerator2d< real_type >::width ( ) const
inline

length in ζ of the computational space


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