23#ifndef SYSBOUNDARYCONDITION_H
24#define SYSBOUNDARYCONDITION_H
27#include <dccrg_cartesian_geometry.hpp>
63 std::cerr <<
"ERROR: base class SysBoundaryCondition::getParameters called!" << std::endl;
66 std::cerr <<
"ERROR: base class SysBoundaryCondition::generateTemplateCells called!" << std::endl;
74 dccrg::Cartesian_Geometry>& mpiGrid,
76 virtual void applyInitialState(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid,
81 virtual void updateState(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid,
89 const std::array<Real, 3>& gridSpacing,
90 const std::array<fsgrid::FsSize_t, 3>& globalCoordinates,
91 const fsgrid::FsStencil& stencil,
cuint component) = 0;
93 const fsgrid::FsStencil& stencil,
cuint component) = 0;
96 const fsgrid::FsStencil& stencil,
cuint component) = 0;
99 const fsgrid::FsStencil& stencil,
cuint component) = 0;
103 const fsgrid::FsStencil& stencil,
cuint RKCase,
cuint component) = 0;
106 const fsgrid::FsStencil& stencil,
cuint component) = 0;
109 const fsgrid::FsStencil& stencil,
cuint component);
111 const fsgrid::FsStencil& stencil,
cuint component);
114 std::array<Real, CellParams::N_SPATIAL_CELL_PARAMS>& cellParams
124 dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
127 const bool calculate_V_moments
131 dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid
133 std::cerr <<
"ERROR: base class SysBoundaryCondition::setupL2OutflowAtRestart called!" << std::endl;
142 virtual void getFaces(
bool *faces) = 0;
144 std::cerr <<
"ERROR: base class SysBoundaryCondition::getName called!" << std::endl;
155 const dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
156 const std::vector<CellID> & local_cells_on_boundary
160 std::array<bool, 3> isFacePeriodic
164 bool* isThisCellOnAFace,
167 const bool excludeSlicesAndPeriodicDimensions =
false
170 std::array<bool, 6> &isThisCellOnAFace,
171 const dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
173 const bool excludeSlicesAndPeriodicDimensions =
false
178 const bool copyMomentsOnly,
180 const bool copy_V_moments
187 const std::array<SpatialCell*,27> flowtoCells,
199 inline int nbrID(
const int i,
const int j,
const int k){
200 return (
k+1)*9 + (
j+1)*3 +
i + 1;
204 dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
206 const bool& copyMomentsOnly,
208 const bool calculate_V_moments
211 dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
213 const bool& copyMomentsOnly,
215 const bool calculate_V_moments
218 dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
221 const bool calculate_V_moments
224 dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
227 const bool calculate_V_moments,
254 const fsgrid::FsStencil& stencil,
cuint component,
cuint mask);
292 const dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
293 std::vector<CellID> cellList,
296 const creal fluffiness = 0
318 bool* isThisCellOnAFace,
321 const std::array<bool, 3> periodicity,
322 const bool excludeSlicesAndPeriodicDimensions=
false
virtual void assignSysBoundary(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid)
std::array< bool, 6 > facesToProcess
virtual void fieldSolverBoundaryCondHallElectricField(fsgrids::ehallspan ehall, const fsgrid::FsStencil &stencil, cuint component)=0
virtual void vlasovBoundaryCondition(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const uint popID, const bool calculate_V_moments)=0
virtual std::string getName() const
std::array< int, 3 > getTheClosestNonsysboundaryCell(fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, cint i, cint j, cint k)
virtual void assignSysBoundary(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid)=0
void vlasovBoundaryCopyFromAllClosestNbrs(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const uint popID, const bool calculate_V_moments)
bool doApplyUponRestart() const
virtual void getParameters()
static void setCellBVOLDerivativesToZero(fsgrids::volspan vols, const fsgrid::FsStencil &stencil, cuint component)
virtual void fieldSolverBoundaryCondElectricField(fsgrids::efieldspan e, const fsgrid::FsStencil &stencil, cuint component)=0
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 vlasovBoundaryCopyFromTheClosestNbr(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const bool ©MomentsOnly, const uint popID, const bool calculate_V_moments)
virtual void generateTemplateCell()
std::vector< std::array< int, 3 > > getAllClosestNonsysboundaryCells(fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, cint i, cint j, cint k)
std::unordered_map< CellID, std::vector< CellID > > allCloseL1OutflowCells
virtual void fieldSolverBoundaryCondBVOLDerivatives(fsgrids::volspan vols, const fsgrid::FsStencil &stencil, cuint component)=0
std::array< SpatialCell *, 27 > & getFlowtoCells(const CellID &cellID)
void vlasovBoundaryCopyFromTheClosestL1OutflowNbr(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const bool ©MomentsOnly, const uint popID, const bool calculate_V_moments)
void setPeriodicity(std::array< bool, 3 > isFacePeriodic)
virtual void fieldSolverBoundaryCondGradPeElectricField(fsgrids::egradpespan EGradPe, const fsgrid::FsStencil &stencil, cuint component)=0
virtual uint getIndex() const =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 ~SysBoundaryCondition()
std::unordered_map< CellID, std::vector< CellID > > allClosestNonsysboundaryCells
std::unordered_map< CellID, std::vector< CellID > > allCloseNonsysboundaryCells
void vlasovBoundaryFluffyCopyFromAllCloseNbrs(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const uint popID, const bool calculate_V_moments, creal fluffiness)
virtual void initSysBoundary(creal &t, Project &project)=0
virtual void setupL2OutflowAtRestart(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid)
std::vector< CellID > & getAllCloseNonsysboundaryCells(const CellID &cellID)
int nbrID(const int i, const int j, const int k)
static void addParameters()
void copyCellData(const SpatialCell *from, SpatialCell *to, const bool copyMomentsOnly, const uint popID, const bool copy_V_moments)
CellID & getTheClosestL1OutflowCell(const CellID &cellID)
virtual void applyInitialState(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, fsgrids::perbspan perb, fsgrids::bgbspan bgb, Project &project)=0
uint getPrecedence() const
virtual void fieldSolverBoundaryCondDerivatives(fsgrids::dperbspan dperb, fsgrids::dmomentsspan dmoments, const fsgrid::FsStencil &stencil, cuint RKCase, cuint component)=0
Real fieldBoundaryCopyFromSolvingNbrMagneticField(fsgrids::perbspan b, fsgrids::consttechnicalspan technical, const fsgrid::FsStencil &stencil, cuint component, cuint mask)
std::array< Realf *, 27 > getFlowtoCellsBlock(const std::array< SpatialCell *, 27 > flowtoCells, const vmesh::GlobalID blockGID, const uint popID)
static void setCellDerivativesToZero(fsgrids::dperbspan dperb, fsgrids::dmomentsspan dmoments, const fsgrid::FsStencil &stencil, cuint component)
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 getFaces(bool *faces)=0
std::vector< CellID > & getAllClosestL1OutflowCells(const CellID &cellID)
virtual void mapCellPotentialAndGetEXBDrift(std::array< Real, CellParams::N_SPATIAL_CELL_PARAMS > &cellParams)
std::array< bool, 3 > periodic
std::unordered_map< CellID, std::vector< CellID > > allClosestL1OutflowCells
bool updateSysBoundaryConditionsAfterLoadBalance(const dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const std::vector< CellID > &local_cells_on_boundary)
fsgrid::FsGrid< FS_STENCIL_WIDTH > FieldSolverGrid
vmesh::LocalID findMaxwellianBlocksToInitialize(const uint popID, spatial_cell::SpatialCell &cell, creal &rho, creal &T, creal &VX0, creal &VY0, creal &VZ0)
SBC::findMaxwellianBlocksToInitialize returns a list of blocks to construct the VDF with.
void determineFaceNoClassMembers(bool *isThisCellOnAFace, creal x, creal y, creal z, creal dx, creal dy, creal dz, const std::array< bool, 3 > periodicity, const bool excludeSlicesAndPeriodicDimensions)
void averageCellData(const dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const vector< CellID > cellList, SpatialCell *to, const uint popID, const creal fluffiness)
std::span< std::array< Real, fsgrids::bfield::N_BFIELD > > perbspan
std::span< const std::array< Real, bgbfield::N_BGB > > constbgbspan
std::span< std::array< Real, fsgrids::egradpe::N_EGRADPE > > egradpespan
std::span< std::array< Real, fsgrids::dmoments::N_DMOMENTS > > dmomentsspan
std::span< technical > technicalspan
std::span< std::array< Real, bgbfield::N_BGB > > bgbspan
std::span< std::array< Real, fsgrids::dperb::N_DPERB > > dperbspan
std::span< const technical > consttechnicalspan
std::span< std::array< Real, fsgrids::efield::N_EFIELD > > efieldspan
std::span< std::array< Real, fsgrids::volfields::N_VOL > > volspan
std::span< std::array< Real, fsgrids::ehall::N_EHALL > > ehallspan