Planetary Atmosphere Simulator
Go to the documentation of this file.
1 #ifndef MESH_MESH_HPP_
2 #define MESH_MESH_HPP_
3 //========================================================================================
4 // Athena++ astrophysical MHD code
5 // Copyright(C) 2014 James M. Stone <> and other code contributors
6 // Licensed under the 3-clause BSD License, see LICENSE file for details
7 //========================================================================================
9 // \brief defines Mesh and MeshBlock classes, and various structs used in them
10 // The Mesh is the overall grid structure, and MeshBlocks are local patches of data
11 // (potentially on different levels) that tile the entire domain.
13 // C headers
15 // C++ headers
16 #include <cstdint> // int64_t
17 #include <functional> // reference_wrapper
18 #include <string>
19 #include <vector>
21 // Athena++ headers
22 #include "../athena.hpp"
23 #include "../athena_arrays.hpp"
24 #include "../bvals/bvals.hpp"
25 #include "../outputs/io_wrapper.hpp"
26 #include "../parameter_input.hpp"
27 #include "../task_list/task_list.hpp"
28 #include "../utils/interp_table.hpp"
29 #include "mesh_refinement.hpp"
30 #include "meshblock_tree.hpp"
32 // Forward declarations
33 class ParameterInput;
34 class Mesh;
35 class MeshRefinement;
36 class MeshBlockTree;
37 class BoundaryValues;
39 class FaceCenteredBoundaryVariable;
40 class TaskList;
41 struct TaskStates;
42 class Coordinates;
43 class Reconstruction;
44 class Hydro;
45 class Field;
46 class PassiveScalars;
47 class Gravity;
48 class MGGravity;
49 class MGGravityDriver;
50 class EquationOfState;
51 class FFTDriver;
52 class FFTGravityDriver;
53 class TurbulenceDriver;
54 class Thermodynamics;
55 class Chemistry;
56 class Radiation;
57 class Physics;
58 class Diagnostics;
59 class Debugger;
61 FluidFormulation GetFluidFormulation(const std::string& input_string);
63 //----------------------------------------------------------------------------------------
65 // \brief data/functions associated with a single block
67 class MeshBlock {
68  friend class RestartOutput;
69  friend class BoundaryValues;
72  friend class Mesh;
73  friend class Hydro;
74  friend class TaskList;
75 #ifdef HDF5OUTPUT
76  friend class ATHDF5Output;
77 #endif
79  public:
80  MeshBlock(int igid, int ilid, LogicalLocation iloc, RegionSize input_size,
81  BoundaryFlag *input_bcs, Mesh *pm, ParameterInput *pin, int igflag,
82  bool ref_flag = false);
83  MeshBlock(int igid, int ilid, Mesh *pm, ParameterInput *pin, LogicalLocation iloc,
84  RegionSize input_block, BoundaryFlag *input_bcs, double icost,
85  char *mbdata, int igflag);
86  ~MeshBlock();
88  // data
89  Mesh *pmy_mesh; // ptr to Mesh containing this MeshBlock
92  // for convenience: "max" # of real+ghost cells along each dir for allocating "standard"
93  // sized MeshBlock arrays, depending on ndim (i.e. ncells2=nx2+2*NGHOST if nx2>1)
95  // on 1x coarser level MeshBlock (i.e. ncc2=nx2/2 + 2*NGHOST, if nx2>1)
96  int ncc1, ncc2, ncc3;
97  int is, ie, js, je, ks, ke;
98  int gid, lid;
99  int cis, cie, cjs, cje, cks, cke, cnghost;
100  int gflag;
101  // At every cycle n, hydro and field registers (u, b) are advanced from t^n -> t^{n+1},
102  // the time-integration scheme may partially substep several storage register pairs
103  // (u,b), (u1,b1), (u2, b2), ..., (um, bm) through the dt interval. Track their time
104  // abscissae at the end of each stage (1<=l<=nstage) as (dt_m^l) relative to t^n
105  Real stage_abscissae[MAX_NSTAGE+1][MAX_NREGISTER];
107  // user output variables for analysis
110  std::string *user_out_var_names_;
112  std::string *user_out_var_units_;
114  // user MeshBlock data that can be stored in restart files
118  // mesh-related objects
122  MeshRefinement *pmr;
124  // physics-related objects (possibly containing their derived bvals classes)
126  Field *pfield;
127  Gravity *pgrav;
128  MGGravity* pmg;
129  PassiveScalars *pscalars;
133  Chemistry *pchem;
134  Radiation *prad;
135  Physics *pphy;
137  Debugger *pdebug;
141  // functions
142  std::size_t GetBlockSizeInBytes();
145  void SearchAndSetNeighbors(MeshBlockTree &tree, int *ranklist, int *nslist);
147  AthenaArray<Real> &u_in2, const Real wght[3]);
148  void WeightedAve(FaceField &b_out, FaceField &b_in1, FaceField &b_in2,
149  const Real wght[3]);
151  NeighborBlock &bblock, NeighborBlock &tblock);
153  // inform MeshBlock which arrays contained in member Hydro, Field, Particles,
154  // ... etc. classes are the "primary" representations of a quantity. when registered,
155  // that data are used for (1) load balancing (2) (future) dumping to restart file
157  void RegisterMeshBlockData(FaceField &pvar_fc);
159  // defined in either the prob file or default_pgen.cpp in ../pgen/
160  void UserWorkBeforeOutput(ParameterInput *pin); // called in Mesh fn (friend class)
161  void UserWorkInLoop(); // called in TimeIntegratorTaskList
163  private:
164  // data
167  // TODO(felker): make global TaskList a member of MeshBlock, store TaskStates in list
168  // shared by main integrator + FFT gravity task lists. Multigrid has separate TaskStates
171  std::vector<std::reference_wrapper<AthenaArray<Real>>> vars_cc_;
172  std::vector<std::reference_wrapper<FaceField>> vars_fc_;
174  // functions
177  void AllocateUserOutputVariables(int n);
178  void SetUserOutputVariableName(int n, const char *name,
179  const char *long_name = "", const char *units = "");
180  void SetCostForLoadBalancing(double cost);
182  // defined in either the prob file or default_pgen.cpp in ../pgen/
186  // functions and variables for automatic load balancing based on timing
187  double cost_, lb_time_;
188  void ResetTimeMeasurement();
189  void StartTimeMeasurement();
190  void StopTimeMeasurement();
191 };
193 //----------------------------------------------------------------------------------------
195 // \brief data/functions associated with the overall mesh
197 class Mesh {
198  friend class RestartOutput;
199  friend class HistoryOutput;
200  friend class MeshBlock;
201  friend class MeshBlockTree;
202  friend class BoundaryBase;
203  friend class BoundaryValues;
206  friend class MGBoundaryValues;
207  friend class Coordinates;
208  friend class MeshRefinement;
209  friend class HydroSourceTerms;
210  friend class Hydro;
211  friend class FFTDriver;
212  friend class FFTGravityDriver;
213  friend class TurbulenceDriver;
214  friend class MultigridDriver;
215  friend class MGGravityDriver;
216  friend class Gravity;
217  friend class HydroDiffusion;
218  friend class FieldDiffusion;
219 #ifdef HDF5OUTPUT
220  friend class ATHDF5Output;
221 #endif
223  public:
224  // 2x function overloads of ctor: normal and restarted simulation
225  explicit Mesh(ParameterInput *pin, int test_flag=0);
226  Mesh(ParameterInput *pin, IOWrapper &resfile, int test_flag=0);
227  ~Mesh();
229  // accessors
230  int GetNumMeshBlocksThisRank(int my_rank) {return nblist[my_rank];}
231  int GetNumMeshThreads() const {return num_mesh_threads_;}
232  std::int64_t GetTotalCells() {return static_cast<std::int64_t> (nbtotal)*
235  // data
237  BoundaryFlag mesh_bcs[6];
238  const bool f2, f3; // flags indicating (at least) 2D or 3D Mesh
239  const int ndim; // number of dimensions
240  const bool adaptive, multilevel;
248  int gflag;
249  int turb_flag; // turbulence flag
250  EosTable *peos_table;
252  // ptr to first MeshBlock (node) in linked list of blocks belonging to this MPI rank:
262  // functions
263  void Initialize(int res_flag, ParameterInput *pin);
265  BoundaryFlag *block_bcs);
266  void NewTimeStep();
267  void OutputCycleDiagnostics();
269  int CreateAMRMPITag(int lid, int ox1, int ox2, int ox3);
270  MeshBlock* FindMeshBlock(int tgid);
273  // function for distributing unique "phys" bitfield IDs to BoundaryVariable objects and
274  // other categories of MPI communication for generating unique MPI_TAGs
275  int ReserveTagPhysIDs(int num_phys);
277  // defined in either the prob file or default_pgen.cpp in ../pgen/
278  void UserWorkAfterLoop(ParameterInput *pin); // called in main loop
279  void UserWorkInLoop(); // called in main after each cycle
281  private:
282  // data
283  int next_phys_id_; // next unused value for encoding final component of MPI tag bitfield
287  double *costlist;
288  // 8x arrays used exclusively for AMR (not SMR):
289  int *nref, *nderef;
290  int *rdisp, *ddisp;
291  int *bnref, *bnderef;
292  int *brdisp, *bddisp;
293  // the last 4x should be std::size_t, but are limited to int by MPI
297  // number of MeshBlocks in the x1, x2, x3 directions of the root grid:
298  // (unlike LogicalLocation.lxi, nrbxi don't grow w/ AMR # of levels, so keep 32-bit int)
300  // TODO(felker) find unnecessary static_cast<> ops. from old std::int64_t type in 2018:
301  //std::int64_t nrbx1, nrbx2, nrbx3;
303  // flags are false if using non-uniform or user meshgen function
311  // global constants
314  // variables for load balancing control
319  // functions
332  void AllocateRealUserMeshDataField(int n);
333  void AllocateIntUserMeshDataField(int n);
334  void OutputMeshStructure(int dim);
335  void CalculateLoadBalance(double *clist, int *rlist, int *slist, int *nlist, int nb);
338  void CorrectMidpointInitialCondition(std::vector<MeshBlock*> &pmb_array, int nmb);
341  // Mesh::LoadBalancingAndAdaptiveMeshRefinement() helper functions:
343  void UpdateMeshBlockTree(int &nnew, int &ndel);
347  // Mesh::RedistributeAndRefineMeshBlocks() helper functions:
348  // step 6: send
349  void PrepareSendSameLevel(MeshBlock* pb, Real *sendbuf);
352  // step 7: create new MeshBlock list (same MPI rank but diff level: create new block)
354  LogicalLocation &loc);
356  LogicalLocation &newloc);
357  // step 8: receive
358  void FinishRecvSameLevel(MeshBlock *pb, Real *recvbuf);
362  // defined in either the prob file or default_pgen.cpp in ../pgen/
365  // often used (not defined) in prob file in ../pgen/
366  void EnrollUserBoundaryFunction(BoundaryFace face, BValFunc my_func);
367  void EnrollUserMGGravityBoundaryFunction(BoundaryFace dir, MGBoundaryFunc my_bc);
368  // DEPRECATED(felker): provide trivial overload for old-style BoundaryFace enum argument
369  void EnrollUserBoundaryFunction(int face, BValFunc my_func);
376  void AllocateUserHistoryOutput(int n);
377  void EnrollUserHistoryOutput(int i, HistoryOutputFunc my_func, const char *name,
379  void EnrollUserMetric(MetricFunc my_func);
384  void SetFourPiG(Real fpg) { four_pi_G_=fpg; }
385  void SetGravityThreshold(Real eps) { grav_eps_=eps; }
387 };
390 //----------------------------------------------------------------------------------------
391 // \!fn Real ComputeMeshGeneratorX(std::int64_t index, std::int64_t nrange,
392 // bool sym_interval)
393 // \brief wrapper fn to compute Real x logical location for either [0., 1.] or [-0.5, 0.5]
394 // real cell ranges for MeshGenerator_[] functions (default/user vs. uniform)
396 inline Real ComputeMeshGeneratorX(std::int64_t index, std::int64_t nrange,
397  bool sym_interval) {
398  // index is typically 0, ... nrange for non-ghost boundaries
399  if (!sym_interval) {
400  // to map to fractional logical position [0.0, 1.0], simply divide by # of faces
401  return static_cast<Real>(index)/static_cast<Real>(nrange);
402  } else {
403  // to map to a [-0.5, 0.5] range, rescale int indices around 0 before FP conversion
404  // if nrange is even, there is an index at center x=0.0; map it to (int) 0
405  // if nrange is odd, the center x=0.0 is between two indices; map them to -1, 1
406  std::int64_t noffset = index - (nrange)/2;
407  std::int64_t noffset_ceil = index - (nrange+1)/2; // = noffset if nrange is even
408  //std::cout << "noffset, noffset_ceil = " << noffset << ", " << noffset_ceil << "\n";
409  // average the (possibly) biased integer indexing
410  return static_cast<Real>(noffset + noffset_ceil)/(2.0*nrange);
411  }
412 }
414 //----------------------------------------------------------------------------------------
415 // \!fn Real DefaultMeshGeneratorX1(Real x, RegionSize rs)
416 // \brief x1 mesh generator function, x is the logical location; x=i/nx1, real in [0., 1.]
419  Real lw, rw;
420  if (rs.x1rat==1.0) {
421  rw=x, lw=1.0-x;
422  } else {
423  Real ratn=std::pow(rs.x1rat,rs.nx1);
424  Real rnx=std::pow(rs.x1rat,x*rs.nx1);
425  lw=(rnx-ratn)/(1.0-ratn);
426  rw=1.0-lw;
427  }
428  // linear interp, equally weighted from left (x(xmin)=0.0) and right (x(xmax)=1.0)
429  return rs.x1min*lw+rs.x1max*rw;
430 }
432 //----------------------------------------------------------------------------------------
433 // \!fn Real DefaultMeshGeneratorX2(Real x, RegionSize rs)
434 // \brief x2 mesh generator function, x is the logical location; x=j/nx2, real in [0., 1.]
437  Real lw, rw;
438  if (rs.x2rat==1.0) {
439  rw=x, lw=1.0-x;
440  } else {
441  Real ratn=std::pow(rs.x2rat,rs.nx2);
442  Real rnx=std::pow(rs.x2rat,x*rs.nx2);
443  lw=(rnx-ratn)/(1.0-ratn);
444  rw=1.0-lw;
445  }
446  return rs.x2min*lw+rs.x2max*rw;
447 }
449 //----------------------------------------------------------------------------------------
450 // \!fn Real DefaultMeshGeneratorX3(Real x, RegionSize rs)
451 // \brief x3 mesh generator function, x is the logical location; x=k/nx3, real in [0., 1.]
454  Real lw, rw;
455  if (rs.x3rat==1.0) {
456  rw=x, lw=1.0-x;
457  } else {
458  Real ratn=std::pow(rs.x3rat,rs.nx3);
459  Real rnx=std::pow(rs.x3rat,x*rs.nx3);
460  lw=(rnx-ratn)/(1.0-ratn);
461  rw=1.0-lw;
462  }
463  return rs.x3min*lw+rs.x3max*rw;
464 }
466 //----------------------------------------------------------------------------------------
467 // \!fn Real UniformMeshGeneratorX1(Real x, RegionSize rs)
468 // \brief x1 mesh generator function, x is the logical location; real cells in [-0.5, 0.5]
471  // linear interp, equally weighted from left (x(xmin)=-0.5) and right (x(xmax)=0.5)
472  return static_cast<Real>(0.5)*(rs.x1min+rs.x1max) + (x*rs.x1max - x*rs.x1min);
473 }
475 //----------------------------------------------------------------------------------------
476 // \!fn Real UniformMeshGeneratorX2(Real x, RegionSize rs)
477 // \brief x2 mesh generator function, x is the logical location; real cells in [-0.5, 0.5]
480  return static_cast<Real>(0.5)*(rs.x2min+rs.x2max) + (x*rs.x2max - x*rs.x2min);
481 }
483 //----------------------------------------------------------------------------------------
484 // \!fn Real UniformMeshGeneratorX3(Real x, RegionSize rs)
485 // \brief x3 mesh generator function, x is the logical location; real cells in [-0.5, 0.5]
488  return static_cast<Real>(0.5)*(rs.x3min+rs.x3max) + (x*rs.x3max - x*rs.x3min);
489 }
491 #endif // MESH_MESH_HPP_
void(*)(FieldDiffusion *pfdif, MeshBlock *pmb, const AthenaArray< Real > &w, const AthenaArray< Real > &bmag, int is, int ie, int js, int je, int ks, int ke) FieldDiffusionCoeffFunc
Definition: athena.hpp:204
Definition: athena.hpp:167
void(*)(AthenaArray< Real > &dst, Real time, int nvar, int is, int ie, int js, int je, int ks, int ke, int ngh, Real x0, Real y0, Real z0, Real dx, Real dy, Real dz) MGBoundaryFunc
Definition: athena.hpp:191
double Real
Definition: athena.hpp:29
Real(*)(Real x, RegionSize rs) MeshGenFunc
Definition: athena.hpp:178
Definition: athena.hpp:155
void(*)(Real x1, Real x2, Real x3, ParameterInput *pin, AthenaArray< Real > &g, AthenaArray< Real > &g_inv, AthenaArray< Real > &dg_dx1, AthenaArray< Real > &dg_dx2, AthenaArray< Real > &dg_dx3) MetricFunc
Definition: athena.hpp:187
void(*)(HydroDiffusion *phdif, MeshBlock *pmb, const AthenaArray< Real > &w, const AthenaArray< Real > &bc, int is, int ie, int js, int je, int ks, int ke) ViscosityCoeffFunc
Definition: athena.hpp:195
Definition: athena.hpp:166
int(*)(MeshBlock *pmb) AMRFlagFunc
Definition: athena.hpp:177
Real(*)(MeshBlock *pmb) TimeStepFunc
Definition: athena.hpp:182
void(*)(MeshBlock *pmb, Coordinates *pco, AthenaArray< Real > &prim, FaceField &b, Real time, Real dt, int is, int ie, int js, int je, int ks, int ke, int ngh) BValFunc
Definition: athena.hpp:176
void(*)(MeshBlock *pmb, const Real time, const Real dt, const AthenaArray< Real > &prim, const AthenaArray< Real > &bcc, AthenaArray< Real > &cons) SrcTermFunc
Definition: athena.hpp:181
Real(*)(MeshBlock *pmb, int iout) HistoryOutputFunc
Definition: athena.hpp:183
void(*)(HydroDiffusion *phdif, MeshBlock *pmb, const AthenaArray< Real > &w, const AthenaArray< Real > &bc, int is, int ie, int js, int je, int ks, int ke) ConductionCoeffFunc
Definition: athena.hpp:199
Definition: hydro.hpp:33
MeshRefinement * pmr
Definition: mesh.hpp:122
void AllocateUserOutputVariables(int n)
Definition: meshblock.cpp:457
std::string * user_out_var_units_
Definition: mesh.hpp:112
Reconstruction * precon
Definition: mesh.hpp:121
double cost_
Definition: mesh.hpp:187
Physics * pphy
Definition: mesh.hpp:135
void StopTimeMeasurement()
Definition: meshblock.cpp:563
BoundaryValues * pbval
Definition: mesh.hpp:120
Debugger * pdebug
Definition: mesh.hpp:137
int nint_user_meshblock_data_
Definition: mesh.hpp:170
Gravity * pgrav
Definition: mesh.hpp:127
int cie
Definition: mesh.hpp:99
int ncc2
Definition: mesh.hpp:96
void UserWorkBeforeOutput(ParameterInput *pin)
friend class BoundaryValues
Definition: mesh.hpp:69
MeshBlock * prev
Definition: mesh.hpp:139
void ProblemGenerator(ParameterInput *pin)
void RegisterMeshBlockData(AthenaArray< Real > &pvar_cc)
Definition: meshblock.cpp:575
Real new_block_dt_
Definition: mesh.hpp:165
RegionSize block_size
Definition: mesh.hpp:91
Hydro * phydro
Definition: mesh.hpp:125
AthenaArray< Real > * ruser_meshblock_data
Definition: mesh.hpp:115
EquationOfState * peos
Definition: mesh.hpp:130
int cjs
Definition: mesh.hpp:99
Real stage_abscissae[MAX_NSTAGE+1][MAX_NREGISTER]
Definition: mesh.hpp:105
Mesh * pmy_mesh
Definition: mesh.hpp:89
void WeightedAve(FaceField &b_out, FaceField &b_in1, FaceField &b_in2, const Real wght[3])
MGGravity * pmg
Definition: mesh.hpp:128
int ie
Definition: mesh.hpp:97
int cnghost
Definition: mesh.hpp:99
int GetNumberOfMeshBlockCells()
Definition: mesh.hpp:143
void AllocateRealUserMeshBlockDataField(int n)
Definition: meshblock.cpp:424
TaskStates tasks
Definition: mesh.hpp:169
AthenaArray< Real > user_out_var
Definition: mesh.hpp:109
void UserWorkInLoop()
int js
Definition: mesh.hpp:97
Real new_block_dt_hyperbolic_
Definition: mesh.hpp:165
std::vector< std::reference_wrapper< AthenaArray< Real > > > vars_cc_
Definition: mesh.hpp:171
int ncells1
Definition: mesh.hpp:94
Diagnostics * pdiag
Definition: mesh.hpp:136
int je
Definition: mesh.hpp:97
Real new_block_dt_parabolic_
Definition: mesh.hpp:165
void AllocateIntUserMeshBlockDataField(int n)
Definition: meshblock.cpp:440
AthenaArray< int > * iuser_meshblock_data
Definition: mesh.hpp:116
std::string * user_out_var_longnames_
Definition: mesh.hpp:111
int ncc3
Definition: mesh.hpp:96
int ke
Definition: mesh.hpp:97
int cis
Definition: mesh.hpp:99
PassiveScalars * pscalars
Definition: mesh.hpp:129
int ncells3
Definition: mesh.hpp:94
void FindNeighbors(CoordinateDirection dir, NeighborBlock &bblock, NeighborBlock &tblock)
void StartTimeMeasurement()
Definition: meshblock.cpp:549
void WeightedAve(AthenaArray< Real > &u_out, AthenaArray< Real > &u_in1, AthenaArray< Real > &u_in2, const Real wght[3])
double lb_time_
Definition: mesh.hpp:187
Radiation * prad
Definition: mesh.hpp:134
LogicalLocation loc
Definition: mesh.hpp:90
Real new_block_dt_user_
Definition: mesh.hpp:166
void SearchAndSetNeighbors(MeshBlockTree &tree, int *ranklist, int *nslist)
int ncc1
Definition: mesh.hpp:96
Chemistry * pchem
Definition: mesh.hpp:133
int is
Definition: mesh.hpp:97
int cks
Definition: mesh.hpp:99
int nuser_out_var
Definition: mesh.hpp:108
void ResetTimeMeasurement()
Definition: meshblock.cpp:541
int ks
Definition: mesh.hpp:97
Coordinates * pcoord
Definition: mesh.hpp:119
int gid
Definition: mesh.hpp:98
int cke
Definition: mesh.hpp:99
int lid
Definition: mesh.hpp:98
int cje
Definition: mesh.hpp:99
int nreal_user_meshblock_data_
Definition: mesh.hpp:170
void InitUserMeshBlockData(ParameterInput *pin)
void SetUserOutputVariableName(int n, const char *name, const char *long_name="", const char *units="")
Definition: meshblock.cpp:479
Thermodynamics * pthermo
Definition: mesh.hpp:132
std::vector< std::reference_wrapper< FaceField > > vars_fc_
Definition: mesh.hpp:172
int ncells2
Definition: mesh.hpp:94
std::size_t GetBlockSizeInBytes()
Definition: meshblock.cpp:498
void SetCostForLoadBalancing(double cost)
Definition: meshblock.cpp:530
MeshBlock(int igid, int ilid, LogicalLocation iloc, RegionSize input_size, BoundaryFlag *input_bcs, Mesh *pm, ParameterInput *pin, int igflag, bool ref_flag=false)
Definition: meshblock.cpp:52
friend class FaceCenteredBoundaryVariable
Definition: mesh.hpp:71
int gflag
Definition: mesh.hpp:100
MeshBlock * next
Definition: mesh.hpp:139
std::string * user_out_var_names_
Definition: mesh.hpp:110
Field * pfield
Definition: mesh.hpp:126
Definition: mesh.hpp:197
int GetNumMeshBlocksThisRank(int my_rank)
Definition: mesh.hpp:230
int * rdisp
Definition: mesh.hpp:290
void EnrollFieldDiffusivity(FieldDiffusionCoeffFunc my_func)
Definition: mesh.cpp:1271
void PrepareSendFineToCoarseAMR(MeshBlock *pb, Real *sendbuf)
void OutputCycleDiagnostics()
Definition: mesh.cpp:1851
Real grav_mean_rho_
Definition: mesh.hpp:312
Real muj
Definition: mesh.hpp:244
Real nuj
Definition: mesh.hpp:244
void SetGravityThreshold(Real eps)
Definition: mesh.hpp:385
friend class FieldDiffusion
Definition: mesh.hpp:218
int * nslist
Definition: mesh.hpp:286
bool lb_flag_
Definition: mesh.hpp:315
int nrbx1
Definition: mesh.hpp:299
int nlim
Definition: mesh.hpp:243
int nint_user_mesh_data_
Definition: mesh.hpp:305
friend class BoundaryValues
Definition: mesh.hpp:203
friend class HydroDiffusion
Definition: mesh.hpp:217
int * nref
Definition: mesh.hpp:289
ConductionCoeffFunc ConductionCoeff_
Definition: mesh.hpp:328
void InitUserMeshData(ParameterInput *pin)
double lb_tolerance_
Definition: mesh.hpp:316
FFTGravityDriver * pfgrd
Definition: mesh.hpp:256
Real dt_parabolic
Definition: mesh.hpp:242
int nreal_user_mesh_data_
Definition: mesh.hpp:305
Real dt
Definition: mesh.hpp:242
int lb_interval_
Definition: mesh.hpp:317
const int ndim
Definition: mesh.hpp:239
Real muj_tilde
Definition: mesh.hpp:244
UserHistoryOperation * user_history_ops_
Definition: mesh.hpp:309
int CreateAMRMPITag(int lid, int ox1, int ox2, int ox3)
BoundaryFlag mesh_bcs[6]
Definition: mesh.hpp:237
void EnrollUserMGGravityBoundaryFunction(BoundaryFace dir, MGBoundaryFunc my_bc)
Definition: mesh.cpp:1125
int num_mesh_threads_
Definition: mesh.hpp:285
void EnrollUserTimeStepFunction(TimeStepFunc my_func)
Definition: mesh.cpp:1204
void CalculateLoadBalance(double *clist, int *rlist, int *slist, int *nlist, int nb)
const bool multilevel
Definition: mesh.hpp:240
int * bnderef
Definition: mesh.hpp:291
Real start_time
Definition: mesh.hpp:242
Real dt_user
Definition: mesh.hpp:242
FieldDiffusionCoeffFunc FieldDiffusivity_
Definition: mesh.hpp:329
void UpdateMeshBlockTree(int &nnew, int &ndel)
void EnrollUserBoundaryFunction(BoundaryFace face, BValFunc my_func)
Definition: mesh.cpp:1103
void PrepareSendCoarseToFineAMR(MeshBlock *pb, Real *sendbuf, LogicalLocation &lloc)
int nrbx2
Definition: mesh.hpp:299
int current_level
Definition: mesh.hpp:284
friend class FFTDriver
Definition: mesh.hpp:211
friend class MeshBlockTree
Definition: mesh.hpp:201
int next_phys_id_
Definition: mesh.hpp:283
int * ranklist
Definition: mesh.hpp:286
int nbdel
Definition: mesh.hpp:245
int ncycle_out
Definition: mesh.hpp:243
const bool adaptive
Definition: mesh.hpp:240
int * ddisp
Definition: mesh.hpp:290
void EnrollUserMetric(MetricFunc my_func)
Definition: mesh.cpp:1244
int nbtotal
Definition: mesh.hpp:245
Definition: mesh.cpp:873
int * nblist
Definition: mesh.hpp:286
Mesh(ParameterInput *pin, int test_flag=0)
Definition: mesh.cpp:62
Real tlim
Definition: mesh.hpp:242
SrcTermFunc UserSourceTerm_
Definition: mesh.hpp:323
bool lb_manual_
Definition: mesh.hpp:315
AMRFlagFunc AMRFlag_
Definition: mesh.hpp:322
int max_level
Definition: mesh.hpp:284
int * nderef
Definition: mesh.hpp:289
void NewTimeStep()
Definition: mesh.cpp:1062
void FillSameRankCoarseToFineAMR(MeshBlock *pob, MeshBlock *pmb, LogicalLocation &newloc)
TurbulenceDriver * ptrbd
Definition: mesh.hpp:255
int ReserveTagPhysIDs(int num_phys)
Definition: mesh.cpp:1795
void ResetLoadBalanceVariables()
Real grav_eps_
Definition: mesh.hpp:312
void FinishRecvCoarseToFineAMR(MeshBlock *pb, Real *recvbuf)
void UserWorkInLoop()
int * brdisp
Definition: mesh.hpp:292
const FluidFormulation fluid_setup
Definition: mesh.hpp:241
void FillSameRankFineToCoarseAMR(MeshBlock *pob, MeshBlock *pmb, LogicalLocation &loc)
void EnrollUserExplicitSourceFunction(SrcTermFunc my_func)
Definition: mesh.cpp:1195
bool lb_automatic_
Definition: mesh.hpp:315
MeshBlockTree tree
Definition: mesh.hpp:296
void Initialize(int res_flag, ParameterInput *pin)
Definition: mesh.cpp:1324
friend class MeshRefinement
Definition: mesh.hpp:208
HistoryOutputFunc * user_history_func_
Definition: mesh.hpp:325
void AllocateIntUserMeshDataField(int n)
Definition: mesh.cpp:1295
int step_since_lb
Definition: mesh.hpp:247
const bool f3
Definition: mesh.hpp:238
friend class Gravity
Definition: mesh.hpp:216
int dt_diagnostics
Definition: mesh.hpp:243
friend class MultigridDriver
Definition: mesh.hpp:214
void FinishRecvFineToCoarseAMR(MeshBlock *pb, Real *recvbuf, LogicalLocation &lloc)
MGGravityDriver * pmgrd
Definition: mesh.hpp:257
void EnrollUserHistoryOutput(int i, HistoryOutputFunc my_func, const char *name, UserHistoryOperation op=UserHistoryOperation::sum)
Definition: mesh.cpp:1226
Real time
Definition: mesh.hpp:242
void EnrollUserRefinementCondition(AMRFlagFunc amrflag)
Definition: mesh.cpp:1151
bool GatherCostListAndCheckBalance()
int * bnref
Definition: mesh.hpp:291
int nrbx3
Definition: mesh.hpp:299
MGBoundaryFunc MGGravityBoundaryFunction_[6]
Definition: mesh.hpp:330
BValFunc BoundaryFunction_[6]
Definition: mesh.hpp:321
Real cfl_number
Definition: mesh.hpp:242
void FinishRecvSameLevel(MeshBlock *pb, Real *recvbuf)
Real four_pi_G_
Definition: mesh.hpp:312
friend class BoundaryBase
Definition: mesh.hpp:202
void UpdateCostList()
int root_level
Definition: mesh.hpp:284
EosTable * peos_table
Definition: mesh.hpp:250
void SetBlockSizeAndBoundaries(LogicalLocation loc, RegionSize &block_size, BoundaryFlag *block_bcs)
Definition: mesh.cpp:1588
void ReserveMeshBlockPhysIDs()
Definition: mesh.cpp:1810
void PrepareSendSameLevel(MeshBlock *pb, Real *sendbuf)
const bool f2
Definition: mesh.hpp:238
double * costlist
Definition: mesh.hpp:287
void LoadBalancingAndAdaptiveMeshRefinement(ParameterInput *pin)
void EnrollUserMeshGenerator(CoordinateDirection dir, MeshGenFunc my_mg)
Definition: mesh.cpp:1161
void OutputMeshStructure(int dim)
Definition: mesh.cpp:912
friend class TurbulenceDriver
Definition: mesh.hpp:213
void SetMeanDensity(Real d0)
Definition: mesh.hpp:386
int nuser_history_output_
Definition: mesh.hpp:307
std::string * user_history_output_names_
Definition: mesh.hpp:308
void EnrollViscosityCoefficient(ViscosityCoeffFunc my_func)
Definition: mesh.cpp:1253
void AllocateUserHistoryOutput(int n)
Definition: mesh.cpp:1213
friend class MGGravityDriver
Definition: mesh.hpp:215
MeshBlock * pblock
Definition: mesh.hpp:253
int nbnew
Definition: mesh.hpp:245
int gflag
Definition: mesh.hpp:248
MetricFunc UserMetric_
Definition: mesh.hpp:326
friend class MGBoundaryValues
Definition: mesh.hpp:206
Real dt_hyperbolic
Definition: mesh.hpp:242
friend class FFTGravityDriver
Definition: mesh.hpp:212
void ApplyUserWorkBeforeOutput(ParameterInput *pin)
Definition: mesh.cpp:1312
MeshBlock * FindMeshBlock(int tgid)
Definition: mesh.cpp:1573
RegionSize mesh_size
Definition: mesh.hpp:236
void SetFourPiG(Real fpg)
Definition: mesh.hpp:384
std::int64_t GetTotalCells()
Definition: mesh.hpp:232
void SetGravitationalConstant(Real g)
Definition: mesh.hpp:383
int ncycle
Definition: mesh.hpp:243
void RedistributeAndRefineMeshBlocks(ParameterInput *pin, int ntot)
AthenaArray< int > * iuser_mesh_data
Definition: mesh.hpp:260
int turb_flag
Definition: mesh.hpp:249
int GetNumMeshThreads() const
Definition: mesh.hpp:231
friend class FaceCenteredBoundaryVariable
Definition: mesh.hpp:205
bool use_uniform_meshgen_fn_[3]
Definition: mesh.hpp:304
void EnrollConductionCoefficient(ConductionCoeffFunc my_func)
Definition: mesh.cpp:1262
void UserWorkAfterLoop(ParameterInput *pin)
AthenaArray< Real > * ruser_mesh_data
Definition: mesh.hpp:259
LogicalLocation * loclist
Definition: mesh.hpp:295
int * bddisp
Definition: mesh.hpp:292
TimeStepFunc UserTimeStep_
Definition: mesh.hpp:324
ViscosityCoeffFunc ViscosityCoeff_
Definition: mesh.hpp:327
MeshGenFunc MeshGenerator_[3]
Definition: mesh.hpp:320
void CorrectMidpointInitialCondition(std::vector< MeshBlock * > &pmb_array, int nmb)
Definition: mesh.cpp:1674
void AllocateRealUserMeshDataField(int n)
Definition: mesh.cpp:1279
Real DefaultMeshGeneratorX3(Real x, RegionSize rs)
Definition: mesh.hpp:453
Real DefaultMeshGeneratorX2(Real x, RegionSize rs)
Definition: mesh.hpp:436
Real UniformMeshGeneratorX1(Real x, RegionSize rs)
Definition: mesh.hpp:470
FluidFormulation GetFluidFormulation(const std::string &input_string)
Definition: mesh.cpp:1835
Real UniformMeshGeneratorX2(Real x, RegionSize rs)
Definition: mesh.hpp:479
Real DefaultMeshGeneratorX1(Real x, RegionSize rs)
Definition: mesh.hpp:418
Real UniformMeshGeneratorX3(Real x, RegionSize rs)
Definition: mesh.hpp:487
Real ComputeMeshGeneratorX(std::int64_t index, std::int64_t nrange, bool sym_interval)
Definition: mesh.hpp:396
double wght[2]
Real x3rat
Definition: athena.hpp:86
int nx3
Definition: athena.hpp:88
Real x1max
Definition: athena.hpp:85
Real x1min
Definition: athena.hpp:84
Real x2rat
Definition: athena.hpp:86
Real x3min
Definition: athena.hpp:84
Real x1rat
Definition: athena.hpp:86
int nx2
Definition: athena.hpp:88
Real x3max
Definition: athena.hpp:85
Real x2min
Definition: athena.hpp:84
int nx1
Definition: athena.hpp:88
Real x2max
Definition: athena.hpp:85