Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
SBC::Inflow Class Referenceabstract

Base class for boundary conditions with settings and parameters read from file. More...

#include <inflow.h>

Inheritance diagram for SBC::Inflow:
Collaboration diagram for SBC::Inflow:

Public Member Functions

 Inflow ()
virtual ~Inflow ()
virtual void initSysBoundary (creal &t, Project &project) override
virtual void applyInitialState (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, fsgrids::perbspan perb, fsgrids::bgbspan bgb, Project &project) override
virtual void updateState (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, fsgrids::perbspan perb, fsgrids::bgbspan bgb, creal t) override
virtual Real fieldSolverBoundaryCondMagneticField (fsgrids::perbspan b, fsgrids::constbgbspan bgb, fsgrids::consttechnicalspan technical, const std::array< Real, 3 > &gridSpacing, const std::array< fsgrid::FsSize_t, 3 > &globalCoordinates, const fsgrid::FsStencil &stencil, cuint component) override
virtual void fieldSolverBoundaryCondElectricField (fsgrids::efieldspan e, const fsgrid::FsStencil &stencil, cuint component) override
virtual void fieldSolverBoundaryCondHallElectricField (fsgrids::ehallspan ehall, const fsgrid::FsStencil &stencil, cuint component) override
virtual void fieldSolverBoundaryCondGradPeElectricField (fsgrids::egradpespan EGradPe, const fsgrid::FsStencil &stencil, cuint component) override
virtual void fieldSolverBoundaryCondDerivatives (fsgrids::dperbspan dperb, fsgrids::dmomentsspan dmoments, const fsgrid::FsStencil &stencil, cuint RKCase, cuint component) override
virtual void fieldSolverBoundaryCondBVOLDerivatives (fsgrids::volspan vols, const fsgrid::FsStencil &stencil, cuint component) override
virtual void vlasovBoundaryCondition (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const uint popID, const bool doCalcMomentsV) override
virtual void getFaces (bool *faces) override
virtual std::string getName () const override
virtual uint getIndex () const =0
Public Member Functions inherited from SBC::OuterBoundaryCondition
virtual void assignSysBoundary (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid)
Public Member Functions inherited from SBC::SysBoundaryCondition
 SysBoundaryCondition ()
virtual ~SysBoundaryCondition ()
virtual void getParameters ()
virtual void generateTemplateCell ()
virtual void mapCellPotentialAndGetEXBDrift (std::array< Real, CellParams::N_SPATIAL_CELL_PARAMS > &cellParams)
virtual void setupL2OutflowAtRestart (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid)
uint getPrecedence () const
bool isDynamic () const
bool updateSysBoundaryConditionsAfterLoadBalance (const dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const std::vector< CellID > &local_cells_on_boundary)
bool doApplyUponRestart () const
void setPeriodicity (std::array< bool, 3 > isFacePeriodic)

Protected Member Functions

std::vector< std::vector< Real > > loadFile (const char *file, unsigned int nParams)
void loadInputData (const uint popID)
void interpolate (const int inputDataIndex, const uint popID, creal t, Real *outputData)
void generateTemplateCells (creal t)
virtual void generateTemplateCell (spatial_cell::SpatialCell &templateCell, Real(&B)[3], int inputDataIndex, creal t)
void setCellsFromTemplate (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const uint popID)
void setBFromTemplate (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::perbspan perb, fsgrids::bgbspan bgb, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, const bool resetSolved)
Protected Member Functions inherited from SBC::SysBoundaryCondition
void determineFace (bool *isThisCellOnAFace, const creal x, const creal y, const creal z, const creal dx, const creal dy, const creal dz, const bool excludeSlicesAndPeriodicDimensions=false) const
 Function used to determine on which face(s) if any the cell at given coordinates is.
void determineFace (std::array< bool, 6 > &isThisCellOnAFace, const dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, CellID id, const bool excludeSlicesAndPeriodicDimensions=false)
 Function used to determine on which face(s) if any the cell with the given MPI id is on.
void copyCellData (const SpatialCell *from, SpatialCell *to, const bool copyMomentsOnly, const uint popID, const bool copy_V_moments)
std::array< SpatialCell *, 27 > & getFlowtoCells (const CellID &cellID)
std::array< Realf *, 27 > getFlowtoCellsBlock (const std::array< SpatialCell *, 27 > flowtoCells, const vmesh::GlobalID blockGID, const uint popID)
int nbrID (const int i, const int j, const int k)
void vlasovBoundaryCopyFromTheClosestNbr (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const bool &copyMomentsOnly, const uint popID, const bool calculate_V_moments)
void vlasovBoundaryCopyFromTheClosestL1OutflowNbr (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const bool &copyMomentsOnly, const uint popID, const bool calculate_V_moments)
void vlasovBoundaryCopyFromAllClosestNbrs (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const uint popID, const bool calculate_V_moments)
void vlasovBoundaryFluffyCopyFromAllCloseNbrs (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const uint popID, const bool calculate_V_moments, creal fluffiness)
std::array< int, 3 > getTheClosestNonsysboundaryCell (fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, cint i, cint j, cint k)
std::vector< std::array< int, 3 > > getAllClosestNonsysboundaryCells (fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, cint i, cint j, cint k)
CellIDgetTheClosestNonsysboundaryCell (const CellID &cellID)
std::vector< CellID > & getAllClosestNonsysboundaryCells (const CellID &cellID)
std::vector< CellID > & getAllCloseNonsysboundaryCells (const CellID &cellID)
Real fieldBoundaryCopyFromSolvingNbrMagneticField (fsgrids::perbspan b, fsgrids::consttechnicalspan technical, const fsgrid::FsStencil &stencil, cuint component, cuint mask)
CellIDgetTheClosestL1OutflowCell (const CellID &cellID)
std::vector< CellID > & getAllClosestL1OutflowCells (const CellID &cellID)

Protected Attributes

spatial_cell::SpatialCell templateCells [6]
Real templateB [6][3]
Real tInterval
Real tLastApply
std::vector< std::string > faceList
std::vector< InflowSpeciesParametersspeciesParams
Protected Attributes inherited from SBC::OuterBoundaryCondition
std::array< bool, 6 > facesToProcess
Protected Attributes inherited from SBC::SysBoundaryCondition
uint precedence
bool dynamic
std::array< bool, 3 > periodic
std::unordered_map< CellID, std::vector< CellID > > allClosestNonsysboundaryCells
std::unordered_map< CellID, std::vector< CellID > > allCloseNonsysboundaryCells
std::unordered_map< CellID, std::vector< CellID > > allClosestL1OutflowCells
std::unordered_map< CellID, std::vector< CellID > > allCloseL1OutflowCells
bool applyUponRestart

Additional Inherited Members

Static Public Member Functions inherited from SBC::SysBoundaryCondition
static void addParameters ()
static void setCellDerivativesToZero (fsgrids::dperbspan dperb, fsgrids::dmomentsspan dmoments, const fsgrid::FsStencil &stencil, cuint component)
static void setCellBVOLDerivativesToZero (fsgrids::volspan vols, const fsgrid::FsStencil &stencil, cuint component)

Detailed Description

Base class for boundary conditions with settings and parameters read from file.

Inflow is a base class for e.g. SysBoundaryConditon::Maxwellian. It defines methods to set boundary conditions on the faces of the simulation domain.

This class handles the import and interpolation in time of the input parameters read from file as well as the assignment of the state from the template cells.

The daughter classes have then to handle parameters and generate the template cells as wished from the data returned.

Definition at line 55 of file inflow.h.

Constructor & Destructor Documentation

◆ Inflow()

SBC::Inflow::Inflow ( )

Definition at line 46 of file inflow.cpp.

Here is the caller graph for this function:

◆ ~Inflow()

SBC::Inflow::~Inflow ( )
virtual

Definition at line 47 of file inflow.cpp.

Member Function Documentation

◆ applyInitialState()

void SBC::Inflow::applyInitialState ( dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & mpiGrid,
fsgrids::technicalspan technical,
FieldSolverGrid & fsgrid,
fsgrids::perbspan perb,
fsgrids::bgbspan bgb,
Project & project )
overridevirtual

Implements SBC::SysBoundaryCondition.

Definition at line 82 of file inflow.cpp.

Here is the call graph for this function:

◆ fieldSolverBoundaryCondBVOLDerivatives()

void SBC::Inflow::fieldSolverBoundaryCondBVOLDerivatives ( fsgrids::volspan vols,
const fsgrid::FsStencil & stencil,
cuint component )
overridevirtual

Implements SBC::SysBoundaryCondition.

Definition at line 198 of file inflow.cpp.

Here is the call graph for this function:

◆ fieldSolverBoundaryCondDerivatives()

void SBC::Inflow::fieldSolverBoundaryCondDerivatives ( fsgrids::dperbspan dperb,
fsgrids::dmomentsspan dmoments,
const fsgrid::FsStencil & stencil,
cuint RKCase,
cuint component )
overridevirtual

Implements SBC::SysBoundaryCondition.

Definition at line 192 of file inflow.cpp.

Here is the call graph for this function:

◆ fieldSolverBoundaryCondElectricField()

void SBC::Inflow::fieldSolverBoundaryCondElectricField ( fsgrids::efieldspan e,
const fsgrid::FsStencil & stencil,
cuint component )
overridevirtual

Implements SBC::SysBoundaryCondition.

Definition at line 154 of file inflow.cpp.

◆ fieldSolverBoundaryCondGradPeElectricField()

void SBC::Inflow::fieldSolverBoundaryCondGradPeElectricField ( fsgrids::egradpespan EGradPe,
const fsgrid::FsStencil & stencil,
cuint component )
overridevirtual

Implements SBC::SysBoundaryCondition.

Definition at line 186 of file inflow.cpp.

◆ fieldSolverBoundaryCondHallElectricField()

void SBC::Inflow::fieldSolverBoundaryCondHallElectricField ( fsgrids::ehallspan ehall,
const fsgrid::FsStencil & stencil,
cuint component )
overridevirtual

Implements SBC::SysBoundaryCondition.

Definition at line 159 of file inflow.cpp.

Here is the call graph for this function:

◆ fieldSolverBoundaryCondMagneticField()

Real SBC::Inflow::fieldSolverBoundaryCondMagneticField ( fsgrids::perbspan b,
fsgrids::constbgbspan bgb,
fsgrids::consttechnicalspan technical,
const std::array< Real, 3 > & gridSpacing,
const std::array< fsgrid::FsSize_t, 3 > & globalCoordinates,
const fsgrid::FsStencil & stencil,
cuint component )
overridevirtual

Implements SBC::SysBoundaryCondition.

Definition at line 123 of file inflow.cpp.

Here is the call graph for this function:

◆ generateTemplateCell()

virtual void SBC::Inflow::generateTemplateCell ( spatial_cell::SpatialCell & templateCell,
Real(&) B[3],
int inputDataIndex,
creal t )
inlineprotectedvirtual

Reimplemented in SBC::Maxwellian.

Definition at line 120 of file inflow.h.

◆ generateTemplateCells()

void SBC::Inflow::generateTemplateCells ( creal t)
protected

Loops through the array of template cells and generates the ones needed. The function generateTemplateCell is defined in the child class to have the specific condition needed.

Parameters
tSimulation time
See also
generateTemplateCell

Definition at line 375 of file inflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getFaces()

void SBC::Inflow::getFaces ( bool * faces)
overridevirtual

Function used to know which faces the boundary condition is applied to.

Parameters
facesPointer to array of 6 bool in which the values are returned whether the corresponding face is of that type. Order: 0 x+; 1 x-; 2 y+; 3 y-; 4 z+; 5 z-

Function used in some cases to know which faces the system boundary condition is being applied to.

Parameters
facesPointer to array of 6 bool in which the values are returned whether the corresponding face is of that type. Order: 0 x+; 1 x-; 2 y+; 3 y-; 4 z+; 5 z-

Implements SBC::SysBoundaryCondition.

Definition at line 286 of file inflow.cpp.

◆ getIndex()

virtual uint SBC::Inflow::getIndex ( ) const
pure virtual

Implements SBC::SysBoundaryCondition.

Implemented in SBC::Maxwellian.

◆ getName()

virtual std::string SBC::Inflow::getName ( ) const
inlineoverridevirtual

Reimplemented from SBC::SysBoundaryCondition.

Reimplemented in SBC::Maxwellian.

Definition at line 93 of file inflow.h.

◆ initSysBoundary()

void SBC::Inflow::initSysBoundary ( creal & t,
Project & project )
overridevirtual

Implements SBC::SysBoundaryCondition.

Definition at line 49 of file inflow.cpp.

Here is the call graph for this function:

◆ interpolate()

void SBC::Inflow::interpolate ( const int inputDataIndex,
const uint popID,
creal t,
Real * outputData )
protected

Interpolate the input data to the given time. The first entry of each line is assumed to be the time.

Parameters
inputDataIndexIndex used to get the correct face's input data.
tCurrent simulation time.
outputDataPointer to the location where to write the result. Make sure from the calling side that nParams Real values can be written there!

Definition at line 390 of file inflow.cpp.

Here is the caller graph for this function:

◆ loadFile()

vector< std::vector< Real > > SBC::Inflow::loadFile ( const char * fn,
unsigned int nParams )
protected

Load inflow boundary data from given file. The number of entries per line is given by nParams which is defined as a parameter from the configuration file/command line.

Parameters
fnName of the data file.
Return values
datasetVector of Real vectors.

Definition at line 307 of file inflow.cpp.

Here is the caller graph for this function:

◆ loadInputData()

void SBC::Inflow::loadInputData ( const uint popID)
protected

Definition at line 292 of file inflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setBFromTemplate()

void SBC::Inflow::setBFromTemplate ( dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & mpiGrid,
fsgrids::perbspan perb,
fsgrids::bgbspan bgb,
fsgrids::technicalspan technical,
FieldSolverGrid & fsgrid,
const bool resetSolved )
protected

Definition at line 209 of file inflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setCellsFromTemplate()

void SBC::Inflow::setCellsFromTemplate ( dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & mpiGrid,
const uint popID )
protected

Definition at line 250 of file inflow.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateState()

void SBC::Inflow::updateState ( dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & mpiGrid,
fsgrids::technicalspan technical,
FieldSolverGrid & fsgrid,
fsgrids::perbspan perb,
fsgrids::bgbspan bgb,
creal t )
overridevirtual

Implements SBC::SysBoundaryCondition.

Definition at line 97 of file inflow.cpp.

Here is the call graph for this function:

◆ vlasovBoundaryCondition()

void SBC::Inflow::vlasovBoundaryCondition ( dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & mpiGrid,
const CellID & cellID,
const uint popID,
const bool calculate_V_moments )
overridevirtual

This function computes the Vlasov (distribution function) boundary condition for the given particle species only. It is not! allowed to change block structure in cell.

Parameters
mpiGridParallel grid.
cellIDSpatial cell ID.
popIDParticle species ID.

Implements SBC::SysBoundaryCondition.

Definition at line 203 of file inflow.cpp.

Member Data Documentation

◆ faceList

std::vector<std::string> SBC::Inflow::faceList
protected

List of faces on which inflow boundary conditions are to be applied ([xyz][+-]).

Definition at line 113 of file inflow.h.

◆ speciesParams

std::vector<InflowSpeciesParameters> SBC::Inflow::speciesParams
protected

Definition at line 114 of file inflow.h.

◆ templateB

Real SBC::Inflow::templateB[6][3]
protected

Definition at line 107 of file inflow.h.

◆ templateCells

spatial_cell::SpatialCell SBC::Inflow::templateCells[6]
protected

Array of template spatial cells replicated over the corresponding simulation volume face. Only the template for an active face is actually being touched at all by the code.

Definition at line 106 of file inflow.h.

◆ tInterval

Real SBC::Inflow::tInterval
protected

Time interval for applying the dynamic BC.

Definition at line 109 of file inflow.h.

◆ tLastApply

Real SBC::Inflow::tLastApply
protected

Last simulation time the dynamic BC is applied.

Definition at line 111 of file inflow.h.


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