Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
sysboundary.h
Go to the documentation of this file.
1/*
2 * This file is part of Vlasiator.
3 * Copyright 2010-2016 Finnish Meteorological Institute
4 *
5 * For details of usage, see the COPYING file and read the "Rules of the Road"
6 * at http://www.physics.helsinki.fi/vlasiator/
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#ifndef SYSBOUNDARY_H
24#define SYSBOUNDARY_H
25
26#include <map>
27#include <list>
28#include <vector>
29#include <mpi.h>
30#include <dccrg.hpp>
31#include <dccrg_cartesian_geometry.hpp>
32#include "../definitions.h"
33#include "../parameters.h"
34#include "../readparameters.h"
36
38
55 public:
58
59 void addParameters();
60 void getParameters();
61
62 void addSysBoundary(
64 Project& project,
65 creal& t
66 );
68 Project& project,
69 creal& t
70 );
71 bool existSysBoundary(std::string name);
72 void checkRefinement(dccrg::Dccrg<spatial_cell::SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid);
73 void classifyCells(dccrg::Dccrg<spatial_cell::SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
75 void applyInitialState(dccrg::Dccrg<spatial_cell::SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid,
78 fsgrids::bgbspan bgb, Project& project);
79 void updateState(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid,
82 fsgrids::bgbspan bgb, creal t);
83 void applySysBoundaryVlasovConditions(dccrg::Dccrg<spatial_cell::SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid, creal& t, const bool calculate_V_moments);
84 void setupL2OutflowAtRestart(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid);
85
86 unsigned int size() const;
87 SBC::SysBoundaryCondition* getSysBoundary(cuint sysBoundaryType) const;
88 bool isAnyDynamic() const;
89 bool isPeriodic(uint direction) const;
90 void updateSysBoundariesAfterLoadBalance(dccrg::Dccrg<spatial_cell::SpatialCell, dccrg::Cartesian_Geometry> &mpiGrid);
91 void clear() { // Clears all conts of SBC (destructing template cells for GPU branch)
92 sysBoundaries.clear();
93 }
94 private:
97
98 //std::set<SBC::SysBoundaryCondition*,SBC::Comparator> sysBoundaries;
99
101 std::list<SBC::SysBoundaryCondition*> sysBoundaries;
103 std::map<uint, SBC::SysBoundaryCondition*> indexToSysBoundary;
105 std::vector<std::string> sysBoundaryCondList;
108
110 std::array<bool, 3> periodic;
111};
112
114 const SBC::SysBoundaryCondition* second);
115
116
117
118/*
119 Input a vector of cellIDs (cellList) and compute a new vector with only those cells which are on a sysboundary and are to be computed
120*/
121void getBoundaryCellList(const dccrg::Dccrg<spatial_cell::SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
122 const std::vector<CellID>& cellList,
123 std::vector<CellID>& boundaryCellList);
124
125#endif
SBC::SysBoundaryCondition is the base class for system boundary conditions.
void initSysBoundaries(Project &project, creal &t)
Initialise all system boundary conditions actually used.
SysBoundary()
Definition main.cpp:43
std::array< bool, 3 > periodic
SysBoundary(const SysBoundary &bc)
bool isPeriodic(uint direction) const
SBC::SysBoundaryCondition * getSysBoundary(cuint sysBoundaryType) const
void updateState(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, fsgrids::perbspan perb, fsgrids::bgbspan bgb, creal t)
std::vector< std::string > sysBoundaryCondList
void classifyCells(dccrg::Dccrg< spatial_cell::SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid)
Classify all simulation cells with respect to the system boundary conditions.
void checkRefinement(dccrg::Dccrg< spatial_cell::SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid)
bool existSysBoundary(std::string name)
Boolean check if queried sysboundarycondition exists Note: this queries against the parsed list of na...
void getParameters()
Get this class' parameters.
void addSysBoundary(SBC::SysBoundaryCondition *sbc, Project &project, creal &t)
~SysBoundary()
Destructor for class SysBoundary.
Definition main.cpp:44
void addParameters()
Add its own and all existing SysBoundaryConditions' parameters.
std::list< SBC::SysBoundaryCondition * > sysBoundaries
void applyInitialState(dccrg::Dccrg< spatial_cell::SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, fsgrids::perbspan perb, fsgrids::bgbspan bgb, Project &project)
Apply the initial state to all system boundary cells. Loops through all SysBoundaryConditions and cal...
void clear()
Definition sysboundary.h:91
std::map< uint, SBC::SysBoundaryCondition * > indexToSysBoundary
unsigned int size() const
void setupL2OutflowAtRestart(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid)
bool isAnyDynamic() const
void applySysBoundaryVlasovConditions(dccrg::Dccrg< spatial_cell::SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, creal &t, const bool calculate_V_moments)
Apply the Vlasov system boundary conditions to all system boundary cells at time t.
void updateSysBoundariesAfterLoadBalance(dccrg::Dccrg< spatial_cell::SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid)
const uint32_t cuint
Definition definitions.h:50
fsgrid::FsGrid< FS_STENCIL_WIDTH > FieldSolverGrid
Definition definitions.h:78
const float creal
Definition definitions.h:42
std::span< std::array< Real, fsgrids::bfield::N_BFIELD > > perbspan
Definition common.h:434
std::span< technical > technicalspan
Definition common.h:452
std::span< std::array< Real, bgbfield::N_BGB > > bgbspan
Definition common.h:444
void getBoundaryCellList(const dccrg::Dccrg< spatial_cell::SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const std::vector< CellID > &cellList, std::vector< CellID > &boundaryCellList)
bool precedenceSort(const SBC::SysBoundaryCondition *first, const SBC::SysBoundaryCondition *second)