|
Vlasiator ebf0dd394 on dev (v5.4.0 + 1054 commits)
|
#include <cstdint>#include <numeric>#include <cstdlib>#include <iostream>#include <iomanip>#include <cmath>#include <stdexcept>#include <vector>#include <sstream>#include <ctime>#include <array>#include <sys/types.h>#include <sys/stat.h>#include <span>#include <unordered_map>#include <unordered_set>#include "definitions.h"#include "mpi.h"#include "spatial_cells/spatial_cell_wrapper.hpp"#include "vdf_compression/compression.h"#include "common.h"#include "ioread.h"#include "phiprof.hpp"#include "parameters.h"#include "logger.h"#include "vdf_compression/compression_tools.h"#include "vlsv_reader_parallel.h"#include "vlasovsolver/vlasovmover.h"#include "object_wrapper.h"#include "velocity_mesh_parameters.h"#include "grid.h"
Go to the source code of this file.
Functions | |
| void | checkExternalCommands () |
| Checks for command files written to the local directory. If a file STOP was written and is readable, then a bailout with restart writing is initiated. If a file KILL was written and is readable, then a bailout without a restart is initiated. If a file SAVE was written and is readable, then restart writing without a bailout is initiated. If a file DOLB was written and is readable, then a new load balancing is initiated. To avoid bailing out upfront on a new run the files are renamed with the date to keep a trace. The function should only be called by MASTER_RANK. This ensures that resetting P::bailout_write_restart works. | |
| bool | exitOnError (bool success, const string &message, MPI_Comm comm) |
| Collective exit on error functions. | |
| bool | readCellIds (vlsv::ParallelReader &file, vector< CellID > &fileCells, const int masterRank, MPI_Comm comm) |
| Read cell ID's Read in cell ID's from file. Note: Uses the newer version of vlsv parallel reader. | |
| bool | readNBlocks (vlsv::ParallelReader &file, const std::string &meshName, std::vector< size_t > &nBlocks, int masterRank, MPI_Comm comm) |
| template<typename T> | |
| bool | readScalarParameter (vlsv::ParallelReader &file, string name, T &value, int masterRank, MPI_Comm comm) |
| template<typename T> | |
| bool | checkScalarParameter (vlsv::ParallelReader &file, const string &name, T correctValue, int masterRank, MPI_Comm comm) |
| template<typename fileReal> | |
| bool | _readBlockDataCompressionNone (vlsv::ParallelReader &file, const std::string &spatMeshName, const std::vector< uint64_t > &fileCells, const uint64_t localCellStartOffset, const uint64_t localCells, const vmesh::LocalID *blocksPerCell, const std::vector< uint64_t > &blockSumOffsets, const uint64_t localBlockStartOffset, const uint64_t localBlocks, dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, std::function< vmesh::GlobalID(vmesh::GlobalID)> blockIDremapper, const uint popID) |
| template<typename fileReal> | |
| bool | _readBlockData (vlsv::ParallelReader &file, const std::string &spatMeshName, const std::vector< uint64_t > &fileCells, const uint64_t localCellStartOffset, const uint64_t localCells, const vmesh::LocalID *blocksPerCell, const std::vector< uint64_t > &blockSumOffsets, const uint64_t localBlockStartOffset, const uint64_t localBlocks, dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, std::function< vmesh::GlobalID(vmesh::GlobalID)> blockIDremapper, const uint popID) |
| bool | readBlockData (vlsv::ParallelReader &file, const string &meshName, const vector< CellID > &fileCells, const uint64_t localCellStartOffset, const uint64_t localCells, dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid) |
| template<typename fileReal> | |
| static bool | _readCellParamsVariable (vlsv::ParallelReader &file, const vector< uint64_t > &fileCells, const uint64_t localCellStartOffset, const uint64_t localCells, const string &variableName, const size_t cellParamsIndex, const size_t expectedVectorSize, dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid) |
| bool | readCellParamsVariable (vlsv::ParallelReader &file, const vector< CellID > &fileCells, const uint64_t localCellStartOffset, const uint64_t localCells, const string &variableName, const size_t cellParamsIndex, const size_t expectedVectorSize, dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid) |
| template<unsigned long int N> | |
| bool | readFsGridVariable (vlsv::ParallelReader &file, const string &variableName, int numWritingRanks, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, std::span< std::array< Real, N > > targetData) |
| bool | readIonosphereNodeVariable (vlsv::ParallelReader &file, const string &variableName, SBC::SphericalTriGrid &grid, ionosphereParameters index) |
| bool | exec_readGrid (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::perbspan perb, fsgrids::efieldspan e, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, const std::string &name) |
| Read in state from a vlsv file in order to restart simulations. | |
| bool | readGrid (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, fsgrids::perbspan perb, fsgrids::efieldspan e, fsgrids::technicalspan technical, FieldSolverGrid &fsgrid, const std::string &name) |
| Read in state from a vlsv file in order to restart simulations. | |
| bool | readFileCells (dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > &mpiGrid, const std::string &name) |
| Refine the grid to be identical to the file's. | |
| bool | readFsgridDecomposition (vlsv::ParallelReader &file, std::array< fsgrid::Task_t, 3 > &decomposition) |
Variables | |
| Logger | logFile |
| Logger | diagnostic |
| bool _readBlockData | ( | vlsv::ParallelReader & | file, |
| const std::string & | spatMeshName, | ||
| const std::vector< uint64_t > & | fileCells, | ||
| const uint64_t | localCellStartOffset, | ||
| const uint64_t | localCells, | ||
| const vmesh::LocalID * | blocksPerCell, | ||
| const std::vector< uint64_t > & | blockSumOffsets, | ||
| const uint64_t | localBlockStartOffset, | ||
| const uint64_t | localBlocks, | ||
| dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & | mpiGrid, | ||
| std::function< vmesh::GlobalID(vmesh::GlobalID)> | blockIDremapper, | ||
| const uint | popID ) |
Read velocity block mesh data and distribution function data belonging to this process for the given particle species. This function must be called simultaneously by all processes.
| file | VLSV reader with input file open. |
| spatMeshName | Name of the spatial mesh. |
| fileCells | List of all spatial cell IDs. |
| localCellStartOffset | The offset from which to start reading cells. |
| localCells | How many spatial cells after the offset to read. |
| blocksPerCell | Number of velocity blocks for this particle species in each spatial cell belonging to this process. |
| localBlockStartOffset | Offset into velocity block data arrays from which to start reading data. |
| localBlocks | Number of velocity blocks for this species assigned to this process. |
| mpiGrid | Parallel grid library. |
| popID | ID of the particle species who's data is to be read. |
Definition at line 954 of file ioread.cpp.


| bool _readBlockDataCompressionNone | ( | vlsv::ParallelReader & | file, |
| const std::string & | spatMeshName, | ||
| const std::vector< uint64_t > & | fileCells, | ||
| const uint64_t | localCellStartOffset, | ||
| const uint64_t | localCells, | ||
| const vmesh::LocalID * | blocksPerCell, | ||
| const std::vector< uint64_t > & | blockSumOffsets, | ||
| const uint64_t | localBlockStartOffset, | ||
| const uint64_t | localBlocks, | ||
| dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & | mpiGrid, | ||
| std::function< vmesh::GlobalID(vmesh::GlobalID)> | blockIDremapper, | ||
| const uint | popID ) |
Definition at line 371 of file ioread.cpp.


|
static |
Reads cell parameters from the file and saves them in the right place in mpiGrid
| file | Some parallel vlsv reader with a file open |
| fileCells | List of all cell ids |
| localCellStartOffset | Offset in the fileCells list for this process ( calculated so that the amount of blocks is distributed somewhat evenly between processes) |
| localCells | The amount of cells to read in this process after localCellStartOffset |
| cellParamsIndex | The parameter of the cell index e.g. CellParams::RHOM |
| expectedVectorSize | The amount of elements in the parameter (parameter can be a scalar or a vector of size N) |
| mpiGrid | Vlasiator's grid (the parameters are saved here) |
Definition at line 1239 of file ioread.cpp.


| void checkExternalCommands | ( | ) |
Checks for command files written to the local directory. If a file STOP was written and is readable, then a bailout with restart writing is initiated. If a file KILL was written and is readable, then a bailout without a restart is initiated. If a file SAVE was written and is readable, then restart writing without a bailout is initiated. If a file DOLB was written and is readable, then a new load balancing is initiated. To avoid bailing out upfront on a new run the files are renamed with the date to keep a trace. The function should only be called by MASTER_RANK. This ensures that resetting P::bailout_write_restart works.
Check in local directory for external commands passed to the simulation. Only executed by MASTER_RANK.
Definition at line 72 of file ioread.cpp.


| bool checkScalarParameter | ( | vlsv::ParallelReader & | file, |
| const string & | name, | ||
| T | correctValue, | ||
| int | masterRank, | ||
| MPI_Comm | comm ) |
A function for checking the scalar parameter
| file | Some parallel vlsv reader with a file open |
| name | Name of the parameter |
| correctValue | The correct value of the parameter to compare to |
| masterRank | The master process' id (Vlasiator uses 0 so this should be 0 by default) |
| comm | MPI comm (Default should be MPI_COMM_WORLD) |
Definition at line 350 of file ioread.cpp.


| bool exec_readGrid | ( | dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & | mpiGrid, |
| fsgrids::perbspan | perb, | ||
| fsgrids::efieldspan | e, | ||
| fsgrids::technicalspan | technical, | ||
| FieldSolverGrid & | fsgrid, | ||
| const std::string & | name ) |
Read in state from a vlsv file in order to restart simulations.
| mpiGrid | Vlasiator's grid |
| name | Name of the restart file e.g. "restart.00052.vlsv" |
Definition at line 1628 of file ioread.cpp.


| bool exitOnError | ( | bool | success, |
| const string & | message, | ||
| MPI_Comm | comm ) |
Collective exit on error functions.
If any process(es) have a false success values then the program will abort and write out the message to the logfile
| success | This process' value for successful execution |
| message | Error message to be shown upon failure |
| comm | MPI comm |
Definition at line 152 of file ioread.cpp.


| bool readBlockData | ( | vlsv::ParallelReader & | file, |
| const string & | meshName, | ||
| const vector< CellID > & | fileCells, | ||
| const uint64_t | localCellStartOffset, | ||
| const uint64_t | localCells, | ||
| dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & | mpiGrid ) |
Read velocity block data of all existing particle species.
| file | VLSV reader. |
| meshName | Name of the spatial mesh. |
| fileCells | Vector containing spatial cell IDs. |
| localCellStartOffset | Offset into fileCells, determines where the cells belonging to this process start. |
| localCells | Number of spatial cells assigned to this process. |
| mpiGrid | Parallel grid library. |
Definition at line 1015 of file ioread.cpp.


| bool readCellIds | ( | vlsv::ParallelReader & | file, |
| vector< CellID > & | fileCells, | ||
| const int | masterRank, | ||
| MPI_Comm | comm ) |
Read cell ID's Read in cell ID's from file. Note: Uses the newer version of vlsv parallel reader.
| file | Some vlsv reader with a file open |
| fileCells | Vector in whic to store the cell ids |
| masterRank | The simulation's master rank id (Vlasiator uses 0, which should be the default) |
| comm | MPI comm (MPI_COMM_WORLD should be the default) |
Definition at line 178 of file ioread.cpp.


| bool readCellParamsVariable | ( | vlsv::ParallelReader & | file, |
| const vector< CellID > & | fileCells, | ||
| const uint64_t | localCellStartOffset, | ||
| const uint64_t | localCells, | ||
| const string & | variableName, | ||
| const size_t | cellParamsIndex, | ||
| const size_t | expectedVectorSize, | ||
| dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & | mpiGrid ) |
Reads cell parameters from the file and saves them in the right place in mpiGrid
| file | Some parallel vlsv reader with a file open |
| fileCells | List of all cell ids |
| localCellStartOffset | Offset in the fileCells list for this process ( calculated so that the amount of blocks is distributed somewhat evenly between processes) |
| localCells | The amount of cells to read in this process after localCellStartOffset |
| cellParamsIndex | The parameter of the cell index e.g. CellParams::RHOM |
| expectedVectorSize | The amount of elements in the parameter (parameter can be a scalar or a vector of size N) |
| mpiGrid | Vlasiator's grid (the parameters are saved here) |
Definition at line 1291 of file ioread.cpp.


| bool readFileCells | ( | dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & | mpiGrid, |
| const std::string & | name ) |
Refine the grid to be identical to the file's.
| mpiGrid | Vlasiator's grid |
| name | Name of the restart file e.g. "restart.00052.vlsv" |
Definition at line 1964 of file ioread.cpp.


| bool readFsgridDecomposition | ( | vlsv::ParallelReader & | file, |
| std::array< fsgrid::Task_t, 3 > & | decomposition ) |
Definition at line 1986 of file ioread.cpp.


| bool readFsGridVariable | ( | vlsv::ParallelReader & | file, |
| const string & | variableName, | ||
| int | numWritingRanks, | ||
| fsgrids::technicalspan | technical, | ||
| FieldSolverGrid & | fsgrid, | ||
| std::span< std::array< Real, N > > | targetData ) |
Read a fsgrid variable (consinting of N real values) from the given vlsv file.
| file | VLSV parallel reader with a file open. |
| variableName | Name of the variable in the file |
| numWritingRanks | Number of mpi ranks that were used to write this file (used for reconstruction of the spatial order) |
| targetGrid | target location where the data will be stored. |
Definition at line 1352 of file ioread.cpp.


| bool readGrid | ( | dccrg::Dccrg< SpatialCell, dccrg::Cartesian_Geometry > & | mpiGrid, |
| fsgrids::perbspan | perb, | ||
| fsgrids::efieldspan | e, | ||
| fsgrids::technicalspan | technical, | ||
| FieldSolverGrid & | fsgrid, | ||
| const std::string & | name ) |
Read in state from a vlsv file in order to restart simulations.
| mpiGrid | Vlasiator's grid |
| name | Name of the restart file e.g. "restart.00052.vlsv" |
Definition at line 1951 of file ioread.cpp.


| bool readIonosphereNodeVariable | ( | vlsv::ParallelReader & | file, |
| const string & | variableName, | ||
| SBC::SphericalTriGrid & | grid, | ||
| ionosphereParameters | index ) |
Read an ionosphere variable from the given vlsv file. Note that only singular floating point values (no vectors) can be read at this time.
| file | VLSV parallel reader with a file open. |
| variableName | Name of the variable in the file |
| grid | the ionosphere grid that data will be deposited into |
| index | index into the nodes' parameters array, where the data will end up. |
Definition at line 1570 of file ioread.cpp.


| bool readNBlocks | ( | vlsv::ParallelReader & | file, |
| const std::string & | meshName, | ||
| std::vector< size_t > & | nBlocks, | ||
| int | masterRank, | ||
| MPI_Comm | comm ) |
Definition at line 252 of file ioread.cpp.


| bool readScalarParameter | ( | vlsv::ParallelReader & | file, |
| string | name, | ||
| T & | value, | ||
| int | masterRank, | ||
| MPI_Comm | comm ) |
A function for reading parameters, e.g., 'timestep'.
| file | VLSV parallel reader with a file open. |
| name | Name of the parameter. |
| value | Variable in which to store the scalar variable (double, float, int .. ). |
| masterRank | The master process' id (Vlasiator uses 0 so this should equal 0 by default). |
| comm | MPI comm (MPI_COMM_WORLD should be the default). |
Definition at line 331 of file ioread.cpp.


| Logger diagnostic |
Definition at line 59 of file ioread.cpp.