An open source method of characteristics neutron transport code.
ExpEvaluator Class Reference

This is a class for evaluating exponentials. More...

#include "src/ExpEvaluator.h"

Public Member Functions

 ExpEvaluator ()
 Constructor initializes array pointers to NULL. More...
 
virtual ~ExpEvaluator ()
 Destructor deletes table for linear interpolation of exponentials.
 
void setQuadrature (Quadrature *quadrature)
 Set the Quadrature to use when computing exponentials. More...
 
void setMaxOpticalLength (FP_PRECISION max_optical_length)
 Sets the maximum optical length covered in the exponential interpolation table. More...
 
void setExpPrecision (FP_PRECISION exp_precision)
 Sets the maximum acceptable approximation error for exponentials. More...
 
void useInterpolation ()
 Use linear interpolation to compute exponentials.
 
void useIntrinsic ()
 Use the exponential intrinsic exp(...) to compute exponentials.
 
void useLinearSource ()
 Use linear source exponentials.
 
FP_PRECISION getMaxOpticalLength ()
 Gets the maximum optical length covered with the exponential interpolation table. More...
 
FP_PRECISION getExpPrecision ()
 Gets the maximum acceptable approximation error for exponentials. More...
 
bool isUsingInterpolation ()
 Returns true if using linear interpolation to compute exponentials. More...
 
FP_PRECISION getTableSpacing ()
 Returns the exponential table spacing. More...
 
int getTableSize ()
 Get the number of entries in the exponential interpolation table. More...
 
FP_PRECISION * getExpTable ()
 Returns a pointer to the exponential interpolation table. More...
 
int getExponentialIndex (FP_PRECISION tau)
 Get the index on the exponential interpolation grid of the value right beneath tau. More...
 
FP_PRECISION getDifference (int index, FP_PRECISION tau)
 Compute the difference between an optical path and an indexed value in the exponential interpolation grid. More...
 
FP_PRECISION convertDistance3Dto2D (FP_PRECISION length)
 Convert a 3D distance to a 2D based on the evaluator's polar angle. More...
 
FP_PRECISION getInverseSinTheta ()
 Get the inverse of sin theta from the ExpEvaluator. More...
 
void initialize (int azim_index, int polar_index, bool solve_3D)
 If using linear interpolation, builds the table for each polar angle. More...
 
FP_PRECISION computeExponential (FP_PRECISION tau, int polar_offset)
 Computes the F1 exponential term. More...
 
FP_PRECISION computeExponentialF1 (int index, int polar_offset, FP_PRECISION dt, FP_PRECISION dt2)
 Computes the F1 exponential term. More...
 
FP_PRECISION computeExponentialF2 (int index, int polar_offset, FP_PRECISION dt, FP_PRECISION dt2)
 Computes the F2 exponential term. More...
 
FP_PRECISION computeExponentialH (int index, int polar_offset, FP_PRECISION dt, FP_PRECISION dt2)
 Computes the H exponential term. More...
 
void retrieveExponentialComponents (FP_PRECISION tau, int polar_offset, FP_PRECISION *exp_F1, FP_PRECISION *exp_F2, FP_PRECISION *exp_H)
 Computes the F1, F2, H exponential term. More...
 
FP_PRECISION computeExponentialG2 (FP_PRECISION tau)
 Computes the G2 exponential term for a optical length and polar angle. More...
 
ExpEvaluatordeepCopy ()
 Deep copies an ExpEvaluator, for developing purposes. More...
 

Detailed Description

This is a class for evaluating exponentials.

The ExpEvaluator includes different algorithms to evaluate exponentials with varying degrees of accuracy and speed. This is a helper class for the Solver and its subclasses and it is not intended to be initialized as a standalone object.

Constructor & Destructor Documentation

◆ ExpEvaluator()

ExpEvaluator::ExpEvaluator ( )

Constructor initializes array pointers to NULL.

The constructor sets the interpolation scheme as the default for computing exponentials.

Member Function Documentation

◆ computeExponential()

FP_PRECISION ExpEvaluator::computeExponential ( FP_PRECISION  tau,
int  polar_offset 
)
inline

Computes the F1 exponential term.

Parameters
tauthe optical distance (2D)
polar_offsetan offset to the index in the look-up table
Returns
the F1 exponential term

◆ computeExponentialF1()

FP_PRECISION ExpEvaluator::computeExponentialF1 ( int  index,
int  polar_offset,
FP_PRECISION  dt,
FP_PRECISION  dt2 
)
inline

Computes the F1 exponential term.

This method computes F1 exponential from Ferrer [1] given an index into the exponential look-up table, the distance (in units of optical length) from the corresponding table value and the requested tau, and that distance squared. This method uses either a linear interpolation table (default) or the exponential intrinsic exp(...) function. //DEPRECATED

[1] R. Ferrer and J. Rhodes III, "A Linear Source Approximation Scheme for the Method of Characteristics", Nuclear Science and Engineering, Volume 182, February 2016.

Parameters
indexthe index into the exponential look-up table
polar_offsetan offset to the index in the look-up table
dtthe distance to the corresponding look-up table bin
dt2the distance to the corresponding look-up table bin squared
Returns
the evaluated F1 exponential term

◆ computeExponentialF2()

FP_PRECISION ExpEvaluator::computeExponentialF2 ( int  index,
int  polar_offset,
FP_PRECISION  dt,
FP_PRECISION  dt2 
)
inline

Computes the F2 exponential term.

This method computes F2 exponential from Ferrer [1] given an index into the exponential look-up table, the distance (in units of optical length) from the corresponding table value and the requested tau, and that distance squared. This method uses either a linear interpolation table (default) or the exponential intrinsic exp(...) function. //DEPRECATED

[1] R. Ferrer and J. Rhodes III, "A Linear Source Approximation Scheme for the Method of Characteristics", Nuclear Science and Engineering, Volume 182, February 2016.

Parameters
indexthe index into the exponential look-up table
polar_offsetan offset to the index in the look-up table
dtthe distance to the corresponding look-up table bin
dt2the distance to the corresponding look-up table bin squared
Returns
the evaluated F2 exponential term

◆ computeExponentialG2()

FP_PRECISION ExpEvaluator::computeExponentialG2 ( FP_PRECISION  tau)
inline

Computes the G2 exponential term for a optical length and polar angle.

This method computes the G2 exponential term from Ferrer [1] for some optical path length and polar angle. This method uses a rational fraction approximation to compute the exponential term.

[1] R. Ferrer and J. Rhodes III, "A Linear Source Approximation Scheme for the Method of Characteristics", Nuclear Science and Engineering, Volume 182, February 2016.

Parameters
tauthe optical path length (e.g., sigma_t times length)
Returns
the evaluated exponential

◆ computeExponentialH()

FP_PRECISION ExpEvaluator::computeExponentialH ( int  index,
int  polar_offset,
FP_PRECISION  dt,
FP_PRECISION  dt2 
)
inline

Computes the H exponential term.

This method computes H exponential from Ferrer [1] given an index into the exponential look-up table, the distance (in units of optical length) from the corresponding table value and the requested tau, and that distance squared. This method uses either a linear interpolation table (default) or the exponential intrinsic exp(...) function. //DEPRECATED

[1] R. Ferrer and J. Rhodes III, "A Linear Source Approximation Scheme for the Method of Characteristics", Nuclear Science and Engineering, Volume 182, February 2016.

Parameters
indexthe index into the exponential look-up table
polar_offsetan offset to the index in the look-up table
dtthe distance to the corresponding look-up table bin
dt2the distance to the corresponding look-up table bin squared
Returns
the evaluated H exponential term

◆ convertDistance3Dto2D()

FP_PRECISION ExpEvaluator::convertDistance3Dto2D ( FP_PRECISION  length)
inline

Convert a 3D distance to a 2D based on the evaluator's polar angle.

Parameters
lengththe 3D distance
Returns
the 2D distance

◆ deepCopy()

ExpEvaluator * ExpEvaluator::deepCopy ( )

Deep copies an ExpEvaluator, for developing purposes.

Returns
the copied ExpEvaluator

◆ getDifference()

FP_PRECISION ExpEvaluator::getDifference ( int  index,
FP_PRECISION  tau 
)
inline

Compute the difference between an optical path and an indexed value in the exponential interpolation grid.

Parameters
indexindex on the exponential interpolation grid
tauoptical distance
Returns
the difference between tau and the value on the grid

◆ getExponentialIndex()

int ExpEvaluator::getExponentialIndex ( FP_PRECISION  tau)
inline

Get the index on the exponential interpolation grid of the value right beneath tau.

Parameters
tauoptical distance
Returns
the index on the exponential interpolation grid

◆ getExpPrecision()

FP_PRECISION ExpEvaluator::getExpPrecision ( )

Gets the maximum acceptable approximation error for exponentials.

Returns
the maximum exponential approximation error

◆ getExpTable()

FP_PRECISION * ExpEvaluator::getExpTable ( )

Returns a pointer to the exponential interpolation table.

Returns
pointer to the exponential interpolation table

◆ getInverseSinTheta()

FP_PRECISION ExpEvaluator::getInverseSinTheta ( )
inline

Get the inverse of sin theta from the ExpEvaluator.

Returns
inverse sin theta for the first angle

◆ getMaxOpticalLength()

FP_PRECISION ExpEvaluator::getMaxOpticalLength ( )

Gets the maximum optical length covered with the exponential interpolation table.

Returns
max_optical_length the maximum optical length

◆ getTableSize()

int ExpEvaluator::getTableSize ( )

Get the number of entries in the exponential interpolation table.

Returns
entries in the interpolation table

◆ getTableSpacing()

FP_PRECISION ExpEvaluator::getTableSpacing ( )

Returns the exponential table spacing.

Returns
exponential table spacing

◆ initialize()

void ExpEvaluator::initialize ( int  azim_index,
int  polar_index,
bool  solve_3D 
)

If using linear interpolation, builds the table for each polar angle.

Parameters
azim_indexthe azimuthal index to get the adjusted polar angle in 3D
polar_indexthe polar angle index
solve_3Dwhether the geometry is 3D or not

◆ isUsingInterpolation()

bool ExpEvaluator::isUsingInterpolation ( )

Returns true if using linear interpolation to compute exponentials.

Returns
true if so, false otherwise

◆ retrieveExponentialComponents()

void ExpEvaluator::retrieveExponentialComponents ( FP_PRECISION  tau,
int  polar_offset,
FP_PRECISION *  exp_F1,
FP_PRECISION *  exp_F2,
FP_PRECISION *  exp_H 
)
inline

Computes the F1, F2, H exponential term.

This method computes F1, F2, H exponential from Ferrer [1] given the requested tau. This method uses either a linear interpolation table (default) or the exponential intrinsicexp(...) function.

[1] R. Ferrer and J. Rhodes III, "A Linear Source Approximation Scheme for the Method of Characteristics", Nuclear Science and Engineering, Volume 182, February 2016.

Parameters
tauthe requested tau
polar_offsetan offset to the index in the look-up table
exp_F1pointer to the F1 exponential term to be computed
exp_F2pointer to the F2 exponential term to be computed
exp_Hpointer to the H exponential term to be computed

◆ setExpPrecision()

void ExpEvaluator::setExpPrecision ( FP_PRECISION  exp_precision)

Sets the maximum acceptable approximation error for exponentials.

This routine only affects the construction of the linear interpolation table for exponentials, if in use. By default, a value of 1E-5 is used for the table, as recommended by the analysis of Yamamoto in his 2004 paper on the subject.

Parameters
exp_precisionthe maximum exponential approximation error

◆ setMaxOpticalLength()

void ExpEvaluator::setMaxOpticalLength ( FP_PRECISION  max_optical_length)

Sets the maximum optical length covered in the exponential interpolation table.

Parameters
max_optical_lengththe maximum optical length

◆ setQuadrature()

void ExpEvaluator::setQuadrature ( Quadrature quadrature)

Set the Quadrature to use when computing exponentials.

Parameters
quadraturea Quadrature object pointer

The documentation for this class was generated from the following files: