SolverBase

class SolverBase

Base class for all solvers.

Subclassed by MNSolver, PNSolver, SNSolver

Public Functions

SolverBase(Config *settings)

Solver constructor.

Parameters:

settings – config class that stores all needed config information

virtual void Solve()

Solve functions runs main iteration loop. Components of the solve loop are pure virtual and subclassed by the child solvers.

void PrintVolumeOutput() const

Save Output solution to VTK file.

Public Static Functions

static SolverBase *Create(Config *settings)

Create constructor.

Parameters:

settings – config class that stores all needed config information

Returns:

pointer to SolverBase

Protected Functions

virtual void SolverPreprocessing()

Performs preprocessing steps before the pseudo time iteration is started.

virtual void IterPreprocessing(unsigned idx_iter) = 0

Performs preprocessing for the current solver iteration.

Parameters:

idx_iter – current (peudo) time iteration

virtual void IterPostprocessing(unsigned idx_iter)

Performs postprocessing for the current solver iteration.

virtual void FluxUpdate() = 0

Constructs the flux update for the current iteration and stores it in psiNew.

virtual void FVMUpdate(unsigned idx_iter) = 0

Computes the finite Volume update step for the current iteration.

Parameters:

idx_iter – current (peudo) time iteration

virtual void RKUpdate(VectorVector &sol0, VectorVector &sol_rk)

Computes the finite Volume update step for the current iteration.

Parameters:

idx_iter – current (peudo) time iteration

double ComputeTimeStep(double cfl) const

ComputeTimeStep calculates the maximal stable time step using the cfl number.

Parameters:

cfl – Courant-Friedrichs-Levy condition number

virtual void ComputeScalarFlux() = 0

Computes the flux of the solution to check conservation properties.

virtual void PrepareVolumeOutput() = 0

Initializes the output groups and fields of this solver and names the fields.

virtual void WriteVolumeOutput(unsigned idx_iter) = 0

Function that prepares VTK export and csv export of the current solver iteration.

Parameters:

idx_iter – current (pseudo) time iteration

void PrintVolumeOutput(int idx_iter) const

Save Output solution at given energy (pseudo time) to VTK file. Write frequency is given by option VOLUME_OUTPUT_FREQUENCY. Always prints last iteration without iteration affix.

Parameters:

idx_iter – current (pseudo) time iteration

void PrepareScreenOutput()

Initialized the output fields and their Names for the screenoutput.

void WriteScalarOutput(unsigned idx_iter)

Function that writes screen and history output fields.

Parameters:

idx_iter – current (pseudo) time iteration

void PrintScreenOutput(unsigned idx_iter)

Prints ScreenOutputFields to Screen and to logger. Write frequency is given by option SCREEN_OUTPUT_FREQUENCY. Always prints last iteration.

Parameters:

idx_iter – current (pseudo) time iteration

void PrepareHistoryOutput()

Initialized the historyOutputFields and their Names for history output. Write frequency is given by option HISTORY_OUTPUT_FREQUENCY. Always prints last iteration.

void PrintHistoryOutput(unsigned idx_iter)

Prints HistoryOutputFields to logger.

Parameters:

idx_iter – current (pseudo) time iteration

void DrawPreSolverOutput()

Pre Solver Screen and Logger Output.

void DrawPostSolverOutput()

Post Solver Screen and Logger Output.

Protected Attributes

double _currTime

wall-time after current iteration

NumericalFluxBase *_g

class for numerical flux

Config *_settings

config class for global information

ProblemBase *_problem

problem class for initial conditions

unsigned _nIter

number of time steps, for non CSD, this equals _nEnergies, for _csd, _maxIter =_nEnergies-1

unsigned _nEnergies

number of energysteps, number of nodal energy values for CSD

double _dT

energy/time step size

Vector _energies

energy groups used in the simulation [keV]

Mesh *_mesh

mesh object for writing out information

unsigned _nCells

number of spatial cells

std::vector<BOUNDARY_TYPE> _boundaryCells

boundary type for all cells, dim(_boundary) = (_NCells)

std::vector<double> _areas

surface area of all spatial cells, dim(_areas) = _NCells

std::vector<std::vector<Vector>> _normals

edge normals multiplied by edge length, dim(_normals) = (_NCells,nEdgesPerCell,spatialDim)

std::vector<std::vector<unsigned>> _neighbors

edge neighbor cell ids, dim(_neighbors) = (_NCells,nEdgesPerCell)

Reconstructor *_reconstructor

reconstructor object for high-order scheme

unsigned _reconsOrder

reconstruction order (current: 1 & 2)

VectorVector _cellMidPoints

middle point locations of elements

std::vector<std::vector<Vector>> _interfaceMidPoints

middle point locations of edges

std::vector<double> _density

patient density, dim(_density) = _nCells (only for csdsolver)

Vector _s

stopping power, dim(_s) = _maxIter (only for csdsolver)

Vector _sMid

stopping power at intermediate time steps, dim(_s) = _maxIter (only for csdsolver)

VectorVector _sigmaS

scattering cross section for all energies. len: _nEnergies x _nCells or 1 x _nCells (if not time dependent)

VectorVector _sigmaT

total cross section for all energies. len:_nEnergies x _nCells or 1 x _nCells (if not time dependent)

std::vector<VectorVector> _Q

external source term. Dim(_Q) = _maxIter x (_nCells x _nSystem) or 1 x _nCells (if not time dependent)

QuadratureBase *_quadrature

pointer to quadrature class

unsigned _nq

number of quadrature points

VectorVector _sol

solution of the PDE, e.g. angular flux or moments

VectorVector _solNew

VectorVector to store the new flux and later the new solution per iteration.

Vector _scalarFluxNew

Vector to store the new Flux. Dim _nCells.

Vector _scalarFlux

Vector to store the old Flux. Dim _nCells.

VectorVector _solDx

solution gradient in x direction

VectorVector _solDy

solution gradient in y direction

VectorVector _limiter

slope limiter at cell and system pt

std::vector<std::vector<std::vector<double>>> _outputFields

Solver Output: dimensions (GroupID,FieldID,CellID).

std::vector<std::vector<std::string>> _outputFieldNames

Names of the outputFields: dimensions (GroupID,FieldID)

std::vector<double> _screenOutputFields

Solver Output: dimensions (FieldID).

std::vector<std::string> _screenOutputFieldNames

Names of the outputFields: dimensions (FieldID)

std::vector<double> _historyOutputFields

Solver Output: dimensions (FieldID).

std::vector<std::string> _historyOutputFieldNames

Names of the outputFields: dimensions (FieldID)