Stellarator and Tokamak Modeling and Meshing Software (STOMMS)
Loading...
Searching...
No Matches
Public Member Functions | List of all members
EqdskData Class Reference

Public Member Functions

 EqdskData ()
 
 EqdskData (const Inputs &input, const PlaneMetaData &planeData, const PhysicsPoint &oPoint, const double &psiCoreBoundary)
 
void setintraCurveSpacingGradPsi ()
 
double getPsiAtPoint (const Point &pt)
 
std::array< double, 3 > getPsiGradAtPoint (const Point &pt)
 
double getPsiGradAbsoluteAtPoint (const Point &pt)
 
double getPsiDerivativeAtPoint (const Point &pt, int dr, int dz)
 
double getCurrentAtPsi (double psi)
 
double convertNormToPsi (double normPsi)
 
double convertPsiToNorm (double psi)
 
bool snapToPsi (Point &pt, double goalPsi)
 
int magneticField (std::array< double, 3 > ptArray, std::vector< double > &dpsi, int dimension)
 
bool rk4 (Point &point0, Point &point1, double dt, int dimension)
 
bool findNextPsiPointOnBoundary (Point &pt, double psi, int side)
 
int findPsiPt (double targetPsi, Point startPoint, std::array< double, 2 > dir, Point &finalPoint)
 
int findPsiPtOnLine (double targetPsi, const Point &pt1, const Point pt2, Point &finalPoint)
 
Point convertPsiToPoint (double psi)
 
double getInterCurveSpacingLinear (double psiNorm)
 
double getNodeSpacing (const Point &pt, double psiNorm)
 
DomainBox getDomainBox ()
 
bool insideBox (const Point &pt)
 
bool insideBox (const std::array< double, 3 > &pt)
 
void setParameters (const Inputs &in)
 
const int getNumPlanes () const
 
const double getStepRadians () const
 
const double getPsiTolerance () const
 
const double getSpacingToleranceOptimal () const
 
const FluxDatagetFluxInputData () const
 
const bool & randomStart () const
 
const int & getIntraCurveSpacingOption () const
 
const double & getSpacingToleranceAbsolute () const
 
const bool & getIntraCurveSpacingSmallVariation () const
 
const double & getIntraCurveMinLengthLastEdge () const
 
const bool & useWallCurve () const
 

Detailed Description

Class eqdskData contains the magnetic field information from eqdsk file.

Constructor & Destructor Documentation

◆ EqdskData() [1/2]

EqdskData::EqdskData ( )
inline

Eqdsk Constructor.

◆ EqdskData() [2/2]

EqdskData::EqdskData ( const Inputs input,
const PlaneMetaData planeData,
const PhysicsPoint oPoint,
const double &  psiCoreBoundary 
)

Eqdsk Constructor.

Parameters
inputclass holding all the input data.
planeDataplaner meta data
oPointprimary oPoint.
psiCoreBoundarypsi value of last closed flux curve or innermost separatrix (primary)

Member Function Documentation

◆ convertNormToPsi()

double EqdskData::convertNormToPsi ( double  normPsi)

Function to convert normalized psi to psi for given eqdsk.

Parameters
normPsinormalized psi value to be converted to psi.
Returns
: psi value.

◆ convertPsiToNorm()

double EqdskData::convertPsiToNorm ( double  psi)

Function to convert psi to normalized psi for given eqdsk.

Parameters
psipsi value to be converted to normalized psi.
Returns
: normalized psi value.

◆ convertPsiToPoint()

Point EqdskData::convertPsiToPoint ( double  psi)

Given the psi value, this function finds the coordinates of the point on a horizontal line from axis to the box (either inward or outward).

◆ findNextPsiPointOnBoundary()

bool EqdskData::findNextPsiPointOnBoundary ( Point pt,
double  psi,
int  side 
)

To find a next point by going around on edges of box boundary when tracing point hits a box boundary using Newton method.

Parameters
[in,out]pta position to be adjusted.
psia psi value for the adjusted position to have.
sidean indicator of a side of a box boundary where tracing point hits.
Returns
true if the position with psi is found on an edge of the box

◆ findPsiPt()

int EqdskData::findPsiPt ( double  targetPsi,
Point  startPoint,
std::array< double, 2 >  dir,
Point finalPoint 
)

Given a target psi and an initial guess, find a point in direction of dir.

Parameters
targetPsipsi value on which the point is desired.
startPointinitial guess.
dirdirection array.
finalPointthe point with target psi value on the vector dir.
Returns
1 for success, 0 otherwise.

◆ findPsiPtOnLine()

int EqdskData::findPsiPtOnLine ( double  targetPsi,
const Point pt1,
const Point  pt2,
Point finalPoint 
)

◆ getCurrentAtPsi()

double EqdskData::getCurrentAtPsi ( double  psi)

Returns the values of poloidal current at given psi value.

Parameters
psipsi value at which poloidal current is needed.
Returns
the poloidal current value.

◆ getDomainBox()

DomainBox EqdskData::getDomainBox ( )

Function to get domain bounding box.

◆ getFluxInputData()

const FluxData & EqdskData::getFluxInputData ( ) const

Returns struct FluxData containing input data of flux.

◆ getInterCurveSpacingLinear()

double EqdskData::getInterCurveSpacingLinear ( double  psiNorm)

Function to get spacing between the two psi values bounding the psiNorm.

Parameters
psiNormnormalized psi value.
Returns
spacing between two psi values bounding psiNorm.

◆ getIntraCurveMinLengthLastEdge()

const double & EqdskData::getIntraCurveMinLengthLastEdge ( ) const

◆ getIntraCurveSpacingOption()

const int & EqdskData::getIntraCurveSpacingOption ( ) const

Returns the type of desired intra curve spacing option.

◆ getIntraCurveSpacingSmallVariation()

const bool & EqdskData::getIntraCurveSpacingSmallVariation ( ) const

◆ getNodeSpacing()

double EqdskData::getNodeSpacing ( const Point pt,
double  psiNorm 
)

Function to get intra curve spacing for the given psi and a starting point. @pt: A starting point (needed in non-field following case). TO-DO: Make it optional in future.

Parameters
psiNormnormalized psi value.
Returns
returns desired node spacing.

◆ getNumPlanes()

const int EqdskData::getNumPlanes ( ) const

Returns the number of poloidal planes (user input).

◆ getPsiAtPoint()

double EqdskData::getPsiAtPoint ( const Point pt)

Returns the values of psi at a physical location defined by pt.

Parameters
ptphysical location on the domain defined by struct Point.
Returns
the psi value at the point.

◆ getPsiDerivativeAtPoint()

double EqdskData::getPsiDerivativeAtPoint ( const Point pt,
int  dr,
int  dz 
)

Returns the psi partial derivative at a physical location defined by pt.

Parameters
ptphysical location on the domain defined by struct Point.
drorder of derivative along R-direction.
dzorder of derivative along Z-direction.
Returns
partial derivatives at the given point.

◆ getPsiGradAbsoluteAtPoint()

double EqdskData::getPsiGradAbsoluteAtPoint ( const Point pt)

Returns the absolute value of psi gradients at a physical location defined by pt.

Parameters
ptphysical location on the domain defined by struct Point.
Returns
absolute value of psi gradients.

◆ getPsiGradAtPoint()

std::array< double, 3 > EqdskData::getPsiGradAtPoint ( const Point pt)

Returns the values of psi gradients at a physical location defined by pt.

Parameters
ptphysical location on the domain defined by struct Point.
Returns
an array of psi gradients in each direction(dpsi/dr, dpsi/dz, dpsi/dphi)

◆ getPsiTolerance()

const double EqdskData::getPsiTolerance ( ) const

Returns psi tolerance for calcuations (user input).

◆ getSpacingToleranceAbsolute()

const double & EqdskData::getSpacingToleranceAbsolute ( ) const

Returns the absolute spacing tolerance

◆ getSpacingToleranceOptimal()

const double EqdskData::getSpacingToleranceOptimal ( ) const

Returns spacing tolerance (user input).

◆ getStepRadians()

const double EqdskData::getStepRadians ( ) const

Returns step size in radian (user input).

◆ insideBox() [1/2]

bool EqdskData::insideBox ( const Point pt)

Checks if a point pt is inside or outside of the bounding box.

Parameters
ptpoint to check.
Returns
true if point is inside, false for outside.

◆ insideBox() [2/2]

bool EqdskData::insideBox ( const std::array< double, 3 > &  pt)

Checks if a point pt is inside or outside of the bounding box.

Parameters
ptpoint to check.
Returns
true if point is inside, false for outside.

◆ magneticField()

int EqdskData::magneticField ( std::array< double, 3 >  ptArray,
std::vector< double > &  dpsi,
int  dimension 
)

Function to return magnetic field components at a physical location.

Parameters
ptArrayarray defining three coordinates of a physical point.
dpsia vector to contain components of magnetic field (B). Size 2 for 2D, and 3 for 3D.
dimension2 for 2D, 3 for 3D. Any other dimensions will throw an error. returns 0 for success.

◆ randomStart()

const bool & EqdskData::randomStart ( ) const

Function to check if start of the flux curve is random or not.

◆ rk4()

bool EqdskData::rk4 ( Point point0,
Point point1,
double  dt,
int  dimension 
)

Runge-Kutta method for numerical integration.

Parameters
point0physical coordinates of the given point.
point1physical coordinates of the output point.
dttime step-size.
dimension2 for 2D, 3 for 3D. Any other dimensions will throw an error. returns true = outside of the domain, false = inside of the domain (success).

◆ setintraCurveSpacingGradPsi()

void EqdskData::setintraCurveSpacingGradPsi ( )

Set the intra curve gradient spacing.

◆ setParameters()

void EqdskData::setParameters ( const Inputs in)

Function to set eqdsk parameters from inputs.

◆ snapToPsi()

bool EqdskData::snapToPsi ( Point pt,
double  goalPsi 
)

Function to update point pt, to the nearest point with goalPsi.

Parameters
ptpoint to readjust on goalPsi.
goalPsithe desired psi value.
Returns
true if found a point with goalPsi and readjusted pt to it.

◆ useWallCurve()

const bool & EqdskData::useWallCurve ( ) const

Function to check if model needs to be bounded by wall curve or last closed flux curve. Default is to use the wall curve. Only valid for zero Xpt cases.