Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
Loading...
Searching...
No Matches
grid.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#ifndef GRID_H
23#define GRID_H
24
25#include "definitions.h"
28#include <dccrg.hpp>
29#include <dccrg_cartesian_geometry.hpp>
30#include "fsgrid.hpp"
32#include "projects/project.h"
33#include <string>
34
37
53
54 FieldSolverData(const fsgrid::FsData<std::array<Real, fsgrids::bfield::N_BFIELD>>& perb,
55 const fsgrid::FsData<std::array<Real, fsgrids::bfield::N_BFIELD>>& perbdt2,
56 const fsgrid::FsData<std::array<Real, fsgrids::efield::N_EFIELD>>& e,
57 const fsgrid::FsData<std::array<Real, fsgrids::efield::N_EFIELD>>& edt2,
58 const fsgrid::FsData<std::array<Real, fsgrids::ehall::N_EHALL>>& ehall,
59 const fsgrid::FsData<std::array<Real, fsgrids::egradpe::N_EGRADPE>>& egradpe,
60 const fsgrid::FsData<std::array<Real, fsgrids::egradpe::N_EGRADPE>>& egradpedt2,
61 const fsgrid::FsData<std::array<Real, fsgrids::moments::N_MOMENTS>>& moments,
62 const fsgrid::FsData<std::array<Real, fsgrids::moments::N_MOMENTS>>& momentsdt2,
63 const fsgrid::FsData<std::array<Real, fsgrids::dperb::N_DPERB>>& dperb,
64 const fsgrid::FsData<std::array<Real, fsgrids::dmoments::N_DMOMENTS>>& dmoments,
65 const fsgrid::FsData<std::array<Real, fsgrids::dmoments::N_DMOMENTS>>& dmomentsdt2,
66 const fsgrid::FsData<std::array<Real, fsgrids::bgbfield::N_BGB>>& bgb,
67 const fsgrid::FsData<std::array<Real, fsgrids::volfields::N_VOL>>& vol,
68 const fsgrid::FsData<fsgrids::technical>& technical, FieldSolverGrid& fsgrid)
69 : fsgrid(fsgrid), perB(perb.view()), perBDt2(perbdt2.view()), E(e.view()), EDt2(edt2.view()),
70 EHall(ehall.view()), EGradPe(egradpe.view()), EGradPeDt2(egradpedt2.view()), moments(moments.view()),
71 momentsDt2(momentsdt2.view()), dPerB(dperb.view()), dMoments(dmoments.view()), dMomentsDt2(dmomentsdt2.view()),
72 BgB(bgb.view()), vol(vol.view()), technical(technical.view()) {}
73};
74
78void initializeGrids(int argn, char** argc, dccrg::Dccrg<SpatialCell, dccrg::Cartesian_Geometry>& mpiGrid,
79 fsgrid::FsData<std::array<Real, fsgrids::bfield::N_BFIELD>>& perb,
80 fsgrid::FsData<std::array<Real, fsgrids::bgbfield::N_BGB>>& bgb,
81 fsgrid::FsData<std::array<Real, fsgrids::moments::N_MOMENTS>>& moments,
82 fsgrid::FsData<std::array<Real, fsgrids::moments::N_MOMENTS>>& momentsdt2,
83 fsgrid::FsData<std::array<Real, fsgrids::dmoments::N_DMOMENTS>>& dmoments,
84 fsgrid::FsData<std::array<Real, fsgrids::efield::N_EFIELD>>& e,
85 fsgrid::FsData<std::array<Real, fsgrids::egradpe::N_EGRADPE>>& egradpe,
86 fsgrid::FsData<std::array<Real, fsgrids::volfields::N_VOL>>& vol,
87 fsgrid::FsData<fsgrids::technical>& technical, FieldSolverGrid& fsgrid,
88 SysBoundary& sysBoundaries, Project& project);
89
95void balanceLoad(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid, SysBoundary& sysBoundaries, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid,
96 bool doTranslationLists = true);
97
98/* helper for calculating AMR flags and cell lists and building pencils
99 */
100void prepareAMRLists(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid);
101
102
112 dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
113 const uint popID,
114 const uint neighborhood=Neighborhoods::DIST_FUNC
115);
116
120void deallocateRemoteCellBlocks(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid);
121
135bool adjustVelocityBlocks(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid,
136 const std::vector<CellID>& cellsToAdjust,
137 bool doPrepareToReceiveBlocks,
138 const uint popID);
139
143void shrink_to_fit_grid_data(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid);
144
145void setFaceNeighborRanks( dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid );
146
149void mapRefinement(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid);
150
158bool adaptRefinement(dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, SysBoundary& sysBoundaries, Project& project, int useStatic = -1);
159
160void recalculateLocalCellsCache(const dccrg::Dccrg<SpatialCell,dccrg::Cartesian_Geometry>& mpiGrid);
161
162#endif
SysBoundary contains the SysBoundaryConditions used in the simulation.
Definition sysboundary.h:54
fsgrid::FsGrid< FS_STENCIL_WIDTH > FieldSolverGrid
Definition definitions.h:78
void deallocateRemoteCellBlocks(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid)
Definition grid.cpp:902
void recalculateLocalCellsCache(const dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid)
Definition grid.cpp:1486
void shrink_to_fit_grid_data(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid)
Definition grid.cpp:874
void initializeGrids(int argn, char **argc, dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrid::FsData< std::array< Real, fsgrids::bfield::N_BFIELD > > &perb, fsgrid::FsData< std::array< Real, fsgrids::bgbfield::N_BGB > > &bgb, fsgrid::FsData< std::array< Real, fsgrids::moments::N_MOMENTS > > &moments, fsgrid::FsData< std::array< Real, fsgrids::moments::N_MOMENTS > > &momentsdt2, fsgrid::FsData< std::array< Real, fsgrids::dmoments::N_DMOMENTS > > &dmoments, fsgrid::FsData< std::array< Real, fsgrids::efield::N_EFIELD > > &e, fsgrid::FsData< std::array< Real, fsgrids::egradpe::N_EGRADPE > > &egradpe, fsgrid::FsData< std::array< Real, fsgrids::volfields::N_VOL > > &vol, fsgrid::FsData< fsgrids::technical > &technical, FieldSolverGrid &fsgrid, SysBoundary &sysBoundaries, Project &project)
Initialize DCCRG and fsgrids.
Definition grid.cpp:92
void mapRefinement(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid)
Definition grid.cpp:1322
bool adaptRefinement(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, SysBoundary &sysBoundaries, Project &project, int useStatic=-1)
Definition grid.cpp:1337
void prepareAMRLists(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid)
Definition grid.cpp:797
void balanceLoad(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, SysBoundary &sysBoundaries, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, bool doTranslationLists=true)
Balance load.
Definition grid.cpp:672
void setFaceNeighborRanks(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid)
Definition grid.cpp:433
void updateRemoteVelocityBlockLists(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const uint popID, const uint neighborhood=Neighborhoods::DIST_FUNC)
Definition grid.cpp:919
bool adjustVelocityBlocks(dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const std::vector< CellID > &cellsToAdjust, bool doPrepareToReceiveBlocks, const uint popID)
std::span< const std::array< Real, fsgrids::dmoments::N_DMOMENTS > > constdmomentsspan
Definition common.h:449
std::span< const std::array< Real, bgbfield::N_BGB > > constbgbspan
Definition common.h:445
std::span< const std::array< Real, fsgrids::efield::N_EFIELD > > constefieldspan
Definition common.h:437
std::span< const std::array< Real, fsgrids::moments::N_MOMENTS > > constmomentsspan
Definition common.h:447
std::span< technical > technicalspan
Definition common.h:452
std::span< const std::array< Real, fsgrids::ehall::N_EHALL > > constehallspan
Definition common.h:439
std::span< const technical > consttechnicalspan
Definition common.h:453
std::span< const std::array< Real, fsgrids::volfields::N_VOL > > constvolspan
Definition common.h:451
std::span< const std::array< Real, fsgrids::bfield::N_BFIELD > > constperbspan
Definition common.h:435
std::span< const std::array< Real, fsgrids::egradpe::N_EGRADPE > > constegradpespan
Definition common.h:441
std::span< const std::array< Real, fsgrids::dperb::N_DPERB > > constdperbspan
Definition common.h:443
fsgrids::consttechnicalspan technical
Definition grid.h:52
fsgrids::constegradpespan EGradPeDt2
Definition grid.h:44
fsgrids::constbgbspan BgB
Definition grid.h:50
fsgrids::constefieldspan E
Definition grid.h:40
fsgrids::constehallspan EHall
Definition grid.h:42
fsgrids::constmomentsspan moments
Definition grid.h:45
FieldSolverData(const fsgrid::FsData< std::array< Real, fsgrids::bfield::N_BFIELD > > &perb, const fsgrid::FsData< std::array< Real, fsgrids::bfield::N_BFIELD > > &perbdt2, const fsgrid::FsData< std::array< Real, fsgrids::efield::N_EFIELD > > &e, const fsgrid::FsData< std::array< Real, fsgrids::efield::N_EFIELD > > &edt2, const fsgrid::FsData< std::array< Real, fsgrids::ehall::N_EHALL > > &ehall, const fsgrid::FsData< std::array< Real, fsgrids::egradpe::N_EGRADPE > > &egradpe, const fsgrid::FsData< std::array< Real, fsgrids::egradpe::N_EGRADPE > > &egradpedt2, const fsgrid::FsData< std::array< Real, fsgrids::moments::N_MOMENTS > > &moments, const fsgrid::FsData< std::array< Real, fsgrids::moments::N_MOMENTS > > &momentsdt2, const fsgrid::FsData< std::array< Real, fsgrids::dperb::N_DPERB > > &dperb, const fsgrid::FsData< std::array< Real, fsgrids::dmoments::N_DMOMENTS > > &dmoments, const fsgrid::FsData< std::array< Real, fsgrids::dmoments::N_DMOMENTS > > &dmomentsdt2, const fsgrid::FsData< std::array< Real, fsgrids::bgbfield::N_BGB > > &bgb, const fsgrid::FsData< std::array< Real, fsgrids::volfields::N_VOL > > &vol, const fsgrid::FsData< fsgrids::technical > &technical, FieldSolverGrid &fsgrid)
Definition grid.h:54
fsgrids::constdperbspan dPerB
Definition grid.h:47
fsgrids::constmomentsspan momentsDt2
Definition grid.h:46
fsgrids::constdmomentsspan dMomentsDt2
Definition grid.h:49
fsgrids::constefieldspan EDt2
Definition grid.h:41
fsgrids::constdmomentsspan dMoments
Definition grid.h:48
fsgrids::constegradpespan EGradPe
Definition grid.h:43
fsgrids::constperbspan perB
Definition grid.h:38
fsgrids::constvolspan vol
Definition grid.h:51
fsgrids::constperbspan perBDt2
Definition grid.h:39