42#ifdef DEBUG_SYSBOUNDARY
53 const string defStr =
"Copy";
54 Readparameters::addComposing(
"outflow.faceNoFields",
"List of faces on which no field outflow boundary conditions are to be applied ([xyz][+-]).");
55 Readparameters::add(
"outflow.precedence",
"Precedence value of the outflow system boundary condition (integer), the higher the stronger.", 4);
56 Readparameters::add(
"outflow.reapplyUponRestart",
"If 0 (default), keep going with the state existing in the restart file. If 1, calls again applyInitialState. Can be used to change boundary condition behaviour during a run.", 0);
62 Readparameters::addComposing(pop +
"_outflow.reapplyFaceUponRestart",
"List of faces on which outflow boundary conditions are to be reapplied upon restart ([xyz][+-]).");
63 Readparameters::addComposing(pop +
"_outflow.face",
"List of faces on which outflow boundary conditions are to be applied ([xyz][+-]).");
64 Readparameters::add(pop +
"_outflow.vlasovScheme_face_x+",
"Scheme to use on the face x+ (Copy, None)", defStr);
65 Readparameters::add(pop +
"_outflow.vlasovScheme_face_x-",
"Scheme to use on the face x- (Copy, None)", defStr);
66 Readparameters::add(pop +
"_outflow.vlasovScheme_face_y+",
"Scheme to use on the face y+ (Copy, None)", defStr);
67 Readparameters::add(pop +
"_outflow.vlasovScheme_face_y-",
"Scheme to use on the face y- (Copy, None)", defStr);
68 Readparameters::add(pop +
"_outflow.vlasovScheme_face_z+",
"Scheme to use on the face z+ (Copy, None)", defStr);
69 Readparameters::add(pop +
"_outflow.vlasovScheme_face_z-",
"Scheme to use on the face z- (Copy, None)", defStr);
71 Readparameters::add(pop +
"_outflow.quench",
"Factor by which to quench the inflowing parts of the velocity distribution function.", 1.0);
77 MPI_Comm_rank(MPI_COMM_WORLD, &
myRank);
93 for (
int j = 0;
j < 6;
j++) {
97 vector<string> thisSpeciesFaceList;
100 for (
auto& face : thisSpeciesFaceList) {
128 array<string, 6> vlasovSysBoundarySchemeName;
129 Readparameters::get(pop +
"_outflow.vlasovScheme_face_x+", vlasovSysBoundarySchemeName[0]);
130 Readparameters::get(pop +
"_outflow.vlasovScheme_face_x-", vlasovSysBoundarySchemeName[1]);
131 Readparameters::get(pop +
"_outflow.vlasovScheme_face_y+", vlasovSysBoundarySchemeName[2]);
133 Readparameters::get(pop +
"_outflow.vlasovScheme_face_y-", vlasovSysBoundarySchemeName[3]);
134 Readparameters::get(pop +
"_outflow.vlasovScheme_face_z+", vlasovSysBoundarySchemeName[4]);
135 Readparameters::get(pop +
"_outflow.vlasovScheme_face_z-", vlasovSysBoundarySchemeName[5]);
136 for (uint
j = 0;
j < 6;
j++) {
137 if (vlasovSysBoundarySchemeName[
j] ==
"None") {
139 }
else if (vlasovSysBoundarySchemeName[
j] ==
"Copy") {
142 abort_mpi(
"ERROR: " + vlasovSysBoundarySchemeName[
j] +
" is an invalid Outflow Vlasov scheme!");
157 for (uint
i = 0;
i < 6;
i++) {
167 vector<string>::const_iterator it;
195 #pragma omp parallel for schedule(static)
196 for (uint
i = 0;
i < cells.size(); ++
i) {
206 std::array<bool, 6> isThisCellOnAFace;
211 for (uint
j = 0;
j < 6;
j++) {
238 const std::array<Real, 3>& gridSpacing,
239 const std::array<fsgrid::FsSize_t, 3>& globalCoordinates,
240 const fsgrid::FsStencil& stencil,
cuint component) {
245 const fsgrid::FsStencil& stencil,
cuint component) {
250 const fsgrid::FsStencil& stencil,
cuint component) {
251 array<Real, fsgrids::ehall::N_EHALL>& cp = ehall[stencil.ooo()];
272 cerr << __FILE__ <<
":" << __LINE__ <<
":"
273 <<
" Invalid component" << endl;
285 const fsgrid::FsStencil& stencil,
cuint RKCase,
cuint component) {
290 const fsgrid::FsStencil& stencil,
cuint component) {
300 const CellID& cellID,
const uint popID,
const bool calculate_V_moments) {
303 if (mpiGrid[cellID]->sysBoundaryFlag != this->
getIndex()) {
307 std::array<bool, 6> isThisCellOnAFace;
310 for(uint
i=0;
i<6;
i++) {
316 if(mpiGrid[cellID]->sysBoundaryLayer == 1) {
323 abort_mpi(
"ERROR: invalid Outflow Vlasov scheme", 1);
345 #pragma omp for schedule(guided,1)
346 for(uint
i=0;
i<cells.size();
i++) {
347 const CellID cellID = cells[
i];
349 if(mpiGrid[cellID]->sysBoundaryFlag != this->
getIndex() || mpiGrid[cellID]->sysBoundaryLayer != 1) {
353 std::array<bool, 6> isThisCellOnAFace;
358 for(uint
i=0;
i<6;
i++) {
370 abort_mpi(
"ERROR: invalid Outflow Vlasov scheme", 1);
386 #pragma omp for schedule(guided,1)
387 for(uint
i=0;
i<cells.size();
i++) {
388 const CellID cellID = cells[
i];
390 if(mpiGrid[cellID]->sysBoundaryFlag != this->
getIndex() || mpiGrid[cellID]->sysBoundaryLayer != 2) {
394 std::array<bool, 6> isThisCellOnAFace;
399 for(uint
i=0;
i<6;
i++) {
411 abort_mpi(
"ERROR: invalid Outflow Vlasov scheme", 1);
421 for (uint
i = 0;
i < 6;
i++) {
static void addComposing(const std::string &name, const std::string &desc)
static void get(const std::string &name, std::string &value)
static void add(const std::string &name, const std::string &desc, const std::string &defValue)
std::array< bool, 6 > facesToProcess
virtual void initSysBoundary(creal &t, Project &project) override
virtual void fieldSolverBoundaryCondDerivatives(fsgrids::dperbspan dperb, fsgrids::dmomentsspan dmoments, const fsgrid::FsStencil &stencil, cuint RKCase, cuint component) override
virtual std::string getName() const override
virtual void getParameters() override
virtual void fieldSolverBoundaryCondGradPeElectricField(fsgrids::egradpespan EGradPe, 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 calculate_V_moments) override
virtual void setupL2OutflowAtRestart(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid) 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 fieldSolverBoundaryCondHallElectricField(fsgrids::ehallspan ehall, const fsgrid::FsStencil &stencil, cuint component) override
static void addParameters()
std::vector< OutflowSpeciesParameters > speciesParams
bool facesToSkipFields[6]
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 void fieldSolverBoundaryCondElectricField(fsgrids::efieldspan e, const fsgrid::FsStencil &stencil, cuint component) override
std::vector< std::string > faceNoFieldsList
virtual uint getIndex() const 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 fieldSolverBoundaryCondBVOLDerivatives(fsgrids::volspan vols, const fsgrid::FsStencil &stencil, cuint component) override
virtual void getFaces(bool *faces) override
static void setCellBVOLDerivativesToZero(fsgrids::volspan vols, const fsgrid::FsStencil &stencil, cuint component)
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)
void vlasovBoundaryCopyFromTheClosestL1OutflowNbr(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const bool ©MomentsOnly, const uint popID, const bool calculate_V_moments)
Real fieldBoundaryCopyFromSolvingNbrMagneticField(fsgrids::perbspan b, fsgrids::consttechnicalspan technical, const fsgrid::FsStencil &stencil, cuint component, cuint mask)
static void setCellDerivativesToZero(fsgrids::dperbspan dperb, fsgrids::dmomentsspan dmoments, const fsgrid::FsStencil &stencil, cuint component)
void setCell(spatial_cell::SpatialCell *cell)
Set the perturbed fields and distribution of a cell according to the default simulation settings....
static bool setCommunicatedSpecies(const uint popID)
static void set_mpi_transfer_type(const uint64_t type, bool atSysBoundaries=false)
std::array< Real, CellParams::N_SPATIAL_CELL_PARAMS > parameters
void abort_mpi(const std::string str, const int err_type)
const std::vector< CellID > & getLocalCells()
fsgrid::FsGrid< FS_STENCIL_WIDTH > FieldSolverGrid
void updateRemoteVelocityBlockLists(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const uint popID, const uint neighborhood)
ObjectWrapper & getObjectWrapper()
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
static const uint64_t CELL_SYSBOUNDARYFLAG
static const uint64_t POP_METADATA
static const uint64_t ALL_SPATIAL_DATA
static const uint64_t VEL_BLOCK_DATA
static const uint64_t CELL_PARAMETERS
std::vector< species::Species > particleSpecies
std::vector< std::string > faceToReapplyUponRestartList
std::array< uint, 6 > faceVlasovScheme
std::array< bool, 6 > facesToSkipVlasov