XGC1
checkpoint_files.hpp
Go to the documentation of this file.
1 #ifndef CHECKPOINT_FILES_HPP
2 #define CHECKPOINT_FILES_HPP
3 
4 #include "sml.hpp"
5 #include "plasma.hpp"
6 #include "electric_field.hpp"
7 #include "grid.hpp"
9 #include "DM_wrapper.hpp"
10 #include "diagnostics.hpp"
11 #include "sheath.hpp"
12 #include "charge.hpp"
13 #include "perturbed_B_field.hpp"
14 #include "increase_ptl_tor.hpp"
15 #include "sources.hpp"
16 
17 enum class RestartOption{
18  Final,
19  NotFinal
20 };
21 
22 // These are initialized in xgc.cpp but accessed via ADIOS2 lookup.
25 
28 
31 
32  public:
33 
35  int run_count;
36 
38  run_count = 1;
39  nlr.use_namelist("sml_param");
40  restart_write_period = nlr.get<int>("sml_restart_write_period",10000000); // Number of time steps between each simulation checkpoint. A checkpoint file is also written after the final time step of the simulation.
41 
42  increase_ptl_tor_on = nlr.get<bool>("sml_increase_ptl_tor", false);
44 
45  nlr.use_namelist("adios_param");
46  adios_stage_restart = nlr.get<bool>("adios_stage_restart",false); // Enable/disable Adios stage mode for checkpoint file
47  adios_stage_restart_f0 = nlr.get<bool>("adios_stage_restartf0",false); // Enable/disable Adios stage mode for f0 checkpoint file
48 
49 
50  // Initialize and open streams
51  stream.Init("restart");
52  }
53 
55 
56  bool write_restart_now(int gstep);
57 
58  void write(const Simulation<DeviceType>& sml,
59  const Grid<DeviceType>& grid,
61  ElectricField<DeviceType>& electric_field,
62  Plasma& plasma,
63  const Sheath<DeviceType>& sheath,
64  const Charges& charges,
65  const PerturbedBField<DeviceType>& perturbed_B_field,
66  const VelocityGrid& vgrid,
67  const Neutrals<DeviceType>& neutrals,
68  const Sources& sources,
70  DMWrapper& pseudo_inv_dm,
71  Diagnostics& diagnostics,
72  RestartOption restart_option=RestartOption::NotFinal);
73 
74  void read(Simulation<DeviceType>& sml,
75  Plasma& plasma,
76  ElectricField<DeviceType>& electric_field,
77  Sheath<DeviceType>& sheath,
78  Charges& charges,
79  PerturbedBField<DeviceType>& perturbed_B_field,
81  const Grid<DeviceType>& grid,
83  const VelocityGrid& vgrid,
84  Neutrals<DeviceType>& neutrals,
85  const Sources& sources);
86 
87 };
88 
89 #endif
RestartOption
Definition: checkpoint_files.hpp:17
Definition: checkpoint_files.hpp:23
CheckpointFiles(NLReader::NamelistReader &nlr)
Definition: checkpoint_files.hpp:37
IncreasePtlTorSettings increase_ptl_tor_settings
Definition: checkpoint_files.hpp:30
XGC_IO_Stream stream
Definition: checkpoint_files.hpp:24
bool adios_stage_restart
Enable/disable Adios stage mode for xgc.restart.
Definition: checkpoint_files.hpp:26
int run_count
How many times the simulation has been restarted.
Definition: checkpoint_files.hpp:35
bool increase_ptl_tor_on
Definition: checkpoint_files.hpp:29
int restart_write_period
How many steps between restart writes.
Definition: checkpoint_files.hpp:34
bool write_restart_now(int gstep)
Definition: checkpoint_files.cpp:598
void read(Simulation< DeviceType > &sml, Plasma &plasma, ElectricField< DeviceType > &electric_field, Sheath< DeviceType > &sheath, Charges &charges, PerturbedBField< DeviceType > &perturbed_B_field, DomainDecomposition< DeviceType > &pol_decomp, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, const VelocityGrid &vgrid, Neutrals< DeviceType > &neutrals, const Sources &sources)
Definition: checkpoint_files.cpp:417
bool adios_stage_restart_f0
Enable/disable Adios stage mode for xgc.restartf0.
Definition: checkpoint_files.hpp:27
bool do_restart(NLReader::NamelistReader &nlr)
Definition: checkpoint_files.cpp:580
void write(const Simulation< DeviceType > &sml, const Grid< DeviceType > &grid, const MagneticField< DeviceType > &magnetic_field, ElectricField< DeviceType > &electric_field, Plasma &plasma, const Sheath< DeviceType > &sheath, const Charges &charges, const PerturbedBField< DeviceType > &perturbed_B_field, const VelocityGrid &vgrid, const Neutrals< DeviceType > &neutrals, const Sources &sources, DomainDecomposition< DeviceType > &pol_decomp, DMWrapper &pseudo_inv_dm, Diagnostics &diagnostics, RestartOption restart_option=RestartOption::NotFinal)
Definition: checkpoint_files.cpp:309
Definition: magnetic_field.hpp:12
Definition: NamelistReader.hpp:193
T get(const string &param, const T default_val, int val_ind=0)
Definition: NamelistReader.hpp:386
void use_namelist(const string &namelist, Options required=Required)
Definition: NamelistReader.hpp:360
Definition: neutrals.hpp:15
Definition: perturbed_B_field.hpp:12
Definition: plasma.hpp:13
Definition: sheath.hpp:49
Definition: sml.hpp:9
Definition: xgc_io.hpp:24
void Init(const std::string &IOName)
Definition: xgc_io.hpp:29
Definition: magnetic_field.F90:1
subroutine plasma(grid, itr, p, dene_out, deni_out, Te_out, Ti_out, Vparai_out, ignore_vacuum)
Calculate the plasma density, temperature, and parallel velocity for a point in triangle itr using pl...
Definition: neutral_totalf.F90:1548
Definition: charge.hpp:66
Definition: DM_wrapper.hpp:34
Definition: diagnostics.hpp:20
Definition: electric_field.hpp:76
Definition: increase_ptl_tor.hpp:7
Definition: sources.hpp:21
Definition: velocity_grid.hpp:8