|
Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
|
SBC::SysBoundaryCondition is the base class for system boundary conditions. More...
#include <sysboundarycondition.h>

Public Member Functions | |
| SysBoundaryCondition () | |
| virtual | ~SysBoundaryCondition () |
| virtual void | getParameters () |
| virtual void | generateTemplateCell () |
| virtual void | initSysBoundary (creal &t, Project &project)=0 |
| virtual void | assignSysBoundary (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid)=0 |
| virtual void | applyInitialState (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, fsgrids::perbspan perb, fsgrids::bgbspan bgb, Project &project)=0 |
| virtual void | updateState (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, fsgrids::perbspan perb, fsgrids::bgbspan bgb, creal t)=0 |
| 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)=0 |
| virtual void | fieldSolverBoundaryCondElectricField (fsgrids::efieldspan e, const fsgrid::FsStencil &stencil, cuint component)=0 |
| virtual void | fieldSolverBoundaryCondHallElectricField (fsgrids::ehallspan ehall, const fsgrid::FsStencil &stencil, cuint component)=0 |
| virtual void | fieldSolverBoundaryCondGradPeElectricField (fsgrids::egradpespan EGradPe, const fsgrid::FsStencil &stencil, cuint component)=0 |
| virtual void | fieldSolverBoundaryCondDerivatives (fsgrids::dperbspan dperb, fsgrids::dmomentsspan dmoments, const fsgrid::FsStencil &stencil, cuint RKCase, cuint component)=0 |
| virtual void | fieldSolverBoundaryCondBVOLDerivatives (fsgrids::volspan vols, const fsgrid::FsStencil &stencil, cuint component)=0 |
| virtual void | mapCellPotentialAndGetEXBDrift (std::array< Real, CellParams::N_SPATIAL_CELL_PARAMS > &cellParams) |
| virtual void | vlasovBoundaryCondition (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const uint popID, const bool calculate_V_moments)=0 |
| virtual void | setupL2OutflowAtRestart (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid) |
| virtual void | getFaces (bool *faces)=0 |
| virtual std::string | getName () const |
| virtual uint | getIndex () const =0 |
| 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) |
Static Public Member Functions | |
| 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) |
Protected Member Functions | |
| 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 ©MomentsOnly, const uint popID, const bool calculate_V_moments) |
| void | vlasovBoundaryCopyFromTheClosestL1OutflowNbr (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const bool ©MomentsOnly, 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) |
| CellID & | getTheClosestNonsysboundaryCell (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) |
| CellID & | getTheClosestL1OutflowCell (const CellID &cellID) |
| std::vector< CellID > & | getAllClosestL1OutflowCells (const CellID &cellID) |
Protected Attributes | |
| 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 |
SBC::SysBoundaryCondition is the base class for system boundary conditions.
SBC::SysBoundaryCondition defines a base class for applying boundary conditions. Specific system boundary conditions inherit from this base class, that's why most functions defined here are not meant to be called and contain a corresponding error message. The functions to be called are the inherited class members.
The initSysBoundary function is used to initialise the internal workings needed by the system boundary condition to run (e.g. importing parameters, initialising class members). assignSysBoundary is used to determine whether a given cell is within the domain of system boundary condition. applyInitialState is called to initialise a system boundary cell's parameters and velocity space.
If needed, a user can write his or her own SBC::SysBoundaryConditions, which are loaded when the simulation initializes.
Definition at line 56 of file sysboundarycondition.h.
| SBC::SysBoundaryCondition::SysBoundaryCondition | ( | ) |
SysBoundaryCondition base class constructor. The constructor is empty.
Definition at line 175 of file sysboundarycondition.cpp.

|
virtual |
SysBoundaryCondition base class virtual destructor. The destructor is empty.
Definition at line 178 of file sysboundarycondition.cpp.
|
static |
SysBoundaryCondition base class instance of the addParameters function. Should not be used, each derived class should have its own.
Definition at line 181 of file sysboundarycondition.cpp.
|
pure virtual |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, and SBC::Outflow.
|
pure virtual |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Ionosphere, and SBC::OuterBoundaryCondition.
|
protected |
Function used to copy the distribution and moments from one cell to another.
| from | Pointer to parent cell to copy from. |
| to | Pointer to destination cell. |
| copyMomentsOnly | skip copying of VDF |
| popID | ID of the particle species. |
| copy_V_moments | which set of moments to copy (_V or _R) |
Definition at line 376 of file sysboundarycondition.cpp.


|
protected |
Function used to determine on which face(s) if any the cell at given coordinates is.
This function is used by some of the classes inheriting from this base class.
Depth is hard-coded to be 2 as other parts of the code (field solver especially) rely on that.
| isThisCellOnAFace | Pointer to an array of 6 bool returning of each face whether the cell is on that face. Order: 0 x+; 1 x-; 2 y+; 3 y-; 4 z+; 5 z- |
| x | Cell x coordinate |
| y | Cell y coordinate |
| z | Cell z coordinate |
| dx | Cell dx size |
| dy | Cell dy size |
| dz | Cell dz size |
| excludeSlicesAndPeriodicDimensions | If true, do not consider a cell to be part of the face if that face has a depth of 1 only (single-cell thick slices/columns) or if that direciton is periodic.. |
Definition at line 61 of file sysboundarycondition.cpp.

|
protected |
Function used to determine on which face(s) if any the cell with the given MPI id is on.
This function is used by some of the classes inheriting from this base class.
Depth is hard-coded to be 2 as other parts of the code (field solver especially) rely on that. So if a cell has less than two unique neighbors in some direction, it is considered to be on that face.
| isThisCellOnAFace | Referemce to an std::array of 6 bool returning of each face whether the cell is on that face. Order: 0 x+; 1 x-; 2 y+; 3 y-; 4 z+; 5 z- |
| mpiGrid | Reference to grid |
| id | ID of cell to check |
| excludeSlicesAndPeriodicDimensions | If true, do not consider a cell to be part of the face if that face has a depth of 1 only (single-cell thick slices/columns) or if that direciton is periodic.. |
Definition at line 116 of file sysboundarycondition.cpp.
| bool SBC::SysBoundaryCondition::doApplyUponRestart | ( | ) | const |
Get a bool telling whether to call again applyInitialState upon restarting the simulation.
Definition at line 731 of file sysboundarycondition.cpp.
|
protected |
Definition at line 672 of file sysboundarycondition.cpp.


|
pure virtual |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, and SBC::Outflow.
|
pure virtual |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, and SBC::Outflow.
|
pure virtual |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, and SBC::Outflow.

|
pure virtual |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, and SBC::Outflow.

|
pure virtual |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, and SBC::Outflow.

|
pure virtual |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, and SBC::Outflow.

|
inlinevirtual |
|
protected |
Get the cellIDs of all the close cells of type NOT_SYSBOUNDARY.
| cellID | ID of the cell to start look from. |
Definition at line 665 of file sysboundarycondition.cpp.

|
protected |
|
protected |
Get the cellIDs of all the closest cells of type NOT_SYSBOUNDARY.
| cellID | ID of the cell to start look from. |
Definition at line 654 of file sysboundarycondition.cpp.
|
protected |
Get the cellIDs of all the closest cells of type NOT_SYSBOUNDARY.
Definition at line 579 of file sysboundarycondition.cpp.


|
pure virtual |
Function used to know which faces the boundary condition is applied to.
| faces | Pointer 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.
| faces | Pointer 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- |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, and SBC::Outflow.
Definition at line 707 of file sysboundarycondition.cpp.

|
protected |
|
protected |
|
pure virtual |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, SBC::Maxwellian, and SBC::Outflow.

|
inlinevirtual |
Reimplemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, SBC::Maxwellian, and SBC::Outflow.
Definition at line 143 of file sysboundarycondition.h.

|
inlinevirtual |
Reimplemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Ionosphere, SBC::Maxwellian, and SBC::Outflow.
Definition at line 62 of file sysboundarycondition.h.

| uint SBC::SysBoundaryCondition::getPrecedence | ( | ) | const |
Get the precedence value of the system boundary condition.
Definition at line 717 of file sysboundarycondition.cpp.

Get the cellID of the first closest cell of type OUTFLOW and layer L1 found.
| cellID | ID of the cell to start look from. |
Definition at line 642 of file sysboundarycondition.cpp.

|
protected |
Get the cellID of the first closest cell of type NOT_SYSBOUNDARY found.
| cellID | ID of the cell to start look from. |
Definition at line 630 of file sysboundarycondition.cpp.
|
protected |
Get the cellID of the first closest cell of type NOT_SYSBOUNDARY found.
Definition at line 564 of file sysboundarycondition.cpp.


|
pure virtual |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, and SBC::Outflow.

| bool SBC::SysBoundaryCondition::isDynamic | ( | ) | const |
Returns whether the boundary condition is dynamic in time.
Definition at line 722 of file sysboundarycondition.cpp.

|
virtual |
Reimplemented in SBC::Ionosphere.
Definition at line 733 of file sysboundarycondition.cpp.
|
inlineprotected |
Helper function to get the index of a neighboring cell in the arrays in allFlowtoCells.
| i | Offset in x direction (-1, 0 or 1) |
| j | Offset in y direction (-1, 0 or 1) |
| k | Offset in z direction (-1, 0 or 1) |
| int | Index in the flowto cell array (0 to 26, indexed from - to + x, y, z. |
Definition at line 199 of file sysboundarycondition.h.
|
static |
Function used to set the system boundary condition cell's BVOL derivatives to 0.
| mpiGrid | Grid |
| cellID | The cell's ID. |
| component | 0: x-derivatives, 1: y-derivatives, 2: z-derivatives. |
Definition at line 262 of file sysboundarycondition.cpp.


|
static |
Function used to set the system boundary condition cell's derivatives to 0.
| mpiGrid | Grid |
| cellID | The cell's ID. |
| component | 0: x-derivatives, 1: y-derivatives, 2: z-derivatives, 3: xy-derivatives, 4: xz-derivatives, 5: yz-derivatives. |
Definition at line 191 of file sysboundarycondition.cpp.


| void SBC::SysBoundaryCondition::setPeriodicity | ( | std::array< bool, 3 > | isFacePeriodic | ) |
Definition at line 724 of file sysboundarycondition.cpp.
|
inlinevirtual |
Reimplemented in SBC::Outflow.
Definition at line 130 of file sysboundarycondition.h.
|
pure virtual |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, and SBC::Outflow.
| bool SBC::SysBoundaryCondition::updateSysBoundaryConditionsAfterLoadBalance | ( | const dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & | mpiGrid, |
| const std::vector< CellID > & | local_cells_on_boundary ) |
Updates the system boundary conditions after load balancing. This is called from e.g. the class SysBoundary.
| mpiGrid | Grid |
| local_cells_on_boundary | Cells within this process |
| success | Returns true if the operation is successful |
Definition at line 466 of file sysboundarycondition.cpp.
|
pure virtual |
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.
| mpiGrid | Parallel grid. |
| cellID | Spatial cell ID. |
| popID | Particle species ID. |
Implemented in SBC::Copysphere, SBC::DoNotCompute, SBC::Inflow, SBC::Ionosphere, and SBC::Outflow.

|
protected |
Function used to average and copy the distribution and moments from all the closest sysboundarytype::NOT_SYSBOUNDARY cells.
| mpiGrid | Grid |
| cellID | The cell's ID. |
| popID | ID of the particle species. |
| copy_V_moments | which set of moments to copy (_V or _R) |
Definition at line 338 of file sysboundarycondition.cpp.

|
protected |
Function used to copy the distribution and moments from (one of) the closest sysboundarytype::OUTFLOW L1 cell.
| mpiGrid | Grid |
| cellID | The cell's ID. |
| copyMomentsOnly | If true, do not touch velocity space. |
| popID | ID of the particle species. |
| copy_V_moments | which set of moments to copy (_V or _R) |
Definition at line 315 of file sysboundarycondition.cpp.


|
protected |
Function used to copy the distribution and moments from (one of) the closest sysboundarytype::NOT_SYSBOUNDARY cell.
| mpiGrid | Grid |
| cellID | The cell's ID. |
| copyMomentsOnly | If true, do not touch velocity space. |
| popID | ID of the particle species. |
| copy_V_moments | which set of moments to copy (_V or _R) |
Definition at line 293 of file sysboundarycondition.cpp.


|
protected |
Function used to average and copy the distribution and moments from all the close sysboundarytype::NOT_SYSBOUNDARY cells.
| mpiGrid | Grid |
| cellID | The cell's ID. |
| popID | ID of the particle species. |
| copy_V_moments | which set of moments to copy (_V or _R) \patam fluffiness (parameter from 0 to 1; value 0 maintains original value, 1 replaces it completely with average) |
Definition at line 357 of file sysboundarycondition.cpp.


|
protected |
Map of close Outflow L1 cells. Used in getAllCloseL1OutflowCells.
Definition at line 276 of file sysboundarycondition.h.
|
protected |
Map of close nonsysboundarycells. Used in getAllCloseNonsysboundaryCells.
Definition at line 272 of file sysboundarycondition.h.
|
protected |
Map of closest Outflow L1 cells. Used in getAllClosestL1OutflowCells.
Definition at line 274 of file sysboundarycondition.h.
|
protected |
Map of closest nonsysboundarycells. Used in getAllClosestNonsysboundaryCells.
Definition at line 270 of file sysboundarycondition.h.
|
protected |
bool telling whether to call again applyInitialState upon restarting the simulation.
Definition at line 279 of file sysboundarycondition.h.
|
protected |
Is the boundary condition dynamic in time or not.
Definition at line 266 of file sysboundarycondition.h.
|
protected |
Array of bool telling whether the system is periodic in any direction.
Definition at line 268 of file sysboundarycondition.h.
|
protected |
Precedence value of the system boundary condition.
Definition at line 264 of file sysboundarycondition.h.