Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
inflow.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 INFLOW_H
24#define INFLOW_H
25
26#include <vector>
27#include "../definitions.h"
28#include "../readparameters.h"
31
32namespace SBC {
33
37 std::vector<std::vector<Real>> inputData[6];
39 std::string files[6];
40
42 uint nParams;
43};
44
56public:
57 Inflow();
58 virtual ~Inflow();
59
60 //virtual void getParameters() = 0;
61
62 virtual void initSysBoundary(creal& t, Project& project) override;
63 virtual void applyInitialState(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid,
66 fsgrids::bgbspan bgb, Project& project) override;
67 virtual void updateState(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid,
70 fsgrids::bgbspan bgb, creal t) override;
74 const std::array<Real, 3>& gridSpacing,
75 const std::array<fsgrid::FsSize_t, 3>& globalCoordinates,
76 const fsgrid::FsStencil& stencil, cuint component) override;
78 const fsgrid::FsStencil& stencil, cuint component) override;
80 const fsgrid::FsStencil& stencil, cuint component) override;
81 virtual void
83 const fsgrid::FsStencil& stencil, cuint component) override;
85 fsgrids::dmomentsspan dmoments,
86 const fsgrid::FsStencil& stencil, cuint RKCase,
87 cuint component) override;
89 const fsgrid::FsStencil& stencil, cuint component) override;
90 virtual void vlasovBoundaryCondition(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid,
91 const CellID& cellID, const uint popID, const bool doCalcMomentsV) override;
92 virtual void getFaces(bool* faces) override;
93 virtual std::string getName() const override {
94 std::cerr << "ERROR: base class Inflow::getParameters called!" << std::endl;
95 return "ERROR";
96 }
97 virtual uint getIndex() const = 0; // {
98 // std::cerr << "ERROR: base class Inflow::getIndex called!" << std::endl;
99 // return sysboundarytype::N_SYSBOUNDARY_CONDITIONS;
100// }
101
102protected:
113 std::vector<std::string> faceList;
114 std::vector<InflowSpeciesParameters> speciesParams;
115 std::vector<std::vector<Real>> loadFile(const char* file, unsigned int nParams);
116
117 void loadInputData(const uint popID);
118 void interpolate(const int inputDataIndex, const uint popID, creal t, Real* outputData);
120 virtual void generateTemplateCell(spatial_cell::SpatialCell& templateCell, Real (&B)[3], int inputDataIndex,
121 creal t) {
122 std::cerr << "ERROR: base class Inflow::generateTemplateCell called!" << std::endl;
123 }
124 void setCellsFromTemplate(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid, const uint popID);
125 void setBFromTemplate(dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid,
128 fsgrids::technicalspan technical,
130 const bool resetSolved);
131};
132} // namespace SBC
133
134#endif
Binary file
Definition Dispersion.m:11
virtual std::string getName() const override
Definition inflow.h:93
spatial_cell::SpatialCell templateCells[6]
Definition inflow.h:106
void interpolate(const int inputDataIndex, const uint popID, creal t, Real *outputData)
Definition inflow.cpp:390
virtual void fieldSolverBoundaryCondElectricField(fsgrids::efieldspan e, const fsgrid::FsStencil &stencil, cuint component) override
Definition inflow.cpp:154
virtual void fieldSolverBoundaryCondHallElectricField(fsgrids::ehallspan ehall, const fsgrid::FsStencil &stencil, cuint component) override
Definition inflow.cpp:159
virtual void getFaces(bool *faces) override
Definition inflow.cpp:286
virtual void vlasovBoundaryCondition(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const CellID &cellID, const uint popID, const bool doCalcMomentsV) override
Definition inflow.cpp:203
void generateTemplateCells(creal t)
Definition inflow.cpp:375
virtual void updateState(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, fsgrids::perbspan perb, fsgrids::bgbspan bgb, creal t) override
Definition inflow.cpp:97
virtual uint getIndex() const =0
virtual ~Inflow()
Definition inflow.cpp:47
virtual void initSysBoundary(creal &t, Project &project) override
Definition inflow.cpp:49
Real tLastApply
Definition inflow.h:111
Real templateB[6][3]
Definition inflow.h:107
Real tInterval
Definition inflow.h:109
virtual void fieldSolverBoundaryCondDerivatives(fsgrids::dperbspan dperb, fsgrids::dmomentsspan dmoments, const fsgrid::FsStencil &stencil, cuint RKCase, cuint component) override
Definition inflow.cpp:192
virtual void fieldSolverBoundaryCondBVOLDerivatives(fsgrids::volspan vols, const fsgrid::FsStencil &stencil, cuint component) override
Definition inflow.cpp:198
std::vector< InflowSpeciesParameters > speciesParams
Definition inflow.h:114
void setCellsFromTemplate(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const uint popID)
Definition inflow.cpp:250
void loadInputData(const uint popID)
Definition inflow.cpp:292
std::vector< std::string > faceList
Definition inflow.h:113
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
Definition inflow.cpp:123
virtual void applyInitialState(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, fsgrids::perbspan perb, fsgrids::bgbspan bgb, Project &project) override
Definition inflow.cpp:82
virtual void generateTemplateCell(spatial_cell::SpatialCell &templateCell, Real(&B)[3], int inputDataIndex, creal t)
Definition inflow.h:120
void setBFromTemplate(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::perbspan perb, fsgrids::bgbspan bgb, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, const bool resetSolved)
Definition inflow.cpp:209
std::vector< std::vector< Real > > loadFile(const char *file, unsigned int nParams)
Definition inflow.cpp:307
virtual void fieldSolverBoundaryCondGradPeElectricField(fsgrids::egradpespan EGradPe, const fsgrid::FsStencil &stencil, cuint component) override
Definition inflow.cpp:186
const uint32_t cuint
Definition definitions.h:50
float Real
Definition definitions.h:41
uint64_t CellID
Definition definitions.h:54
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< const std::array< Real, bgbfield::N_BGB > > constbgbspan
Definition common.h:445
std::span< std::array< Real, fsgrids::egradpe::N_EGRADPE > > egradpespan
Definition common.h:440
std::span< std::array< Real, fsgrids::dmoments::N_DMOMENTS > > dmomentsspan
Definition common.h:448
std::span< technical > technicalspan
Definition common.h:452
std::span< std::array< Real, bgbfield::N_BGB > > bgbspan
Definition common.h:444
std::span< std::array< Real, fsgrids::dperb::N_DPERB > > dperbspan
Definition common.h:442
std::span< const technical > consttechnicalspan
Definition common.h:453
std::span< std::array< Real, fsgrids::efield::N_EFIELD > > efieldspan
Definition common.h:436
std::span< std::array< Real, fsgrids::volfields::N_VOL > > volspan
Definition common.h:450
std::span< std::array< Real, fsgrids::ehall::N_EHALL > > ehallspan
Definition common.h:438
std::string files[6]
Definition inflow.h:39
std::vector< std::vector< Real > > inputData[6]
Definition inflow.h:37