122 Real residentSetSize=0.0;
130 std::string base_name =
"pout";
131 base_name = runtime.
output_dir+string(
"/")+base_name;
132 setPoutBaseName(base_name);
136 pout() << endl <<
"> Generating grid..." << endl << endl;
138 for (
int idim = 0; idim <
DIMENSIONS; idim++) {
139 grid[idim].
nghost = nghost;
142 grid[idim].
beg = grid[idim].
gbeg = grid[idim].
lbeg = nghost;
144 = (grid[idim].
lbeg - 1) + grid[idim].np_int;
154 CH_assert(verbosity >= 0);
160 Real domainLength = 0.0, xbeg[3], xend[3];
167 domainLength =
MAX(domainLength, xend[dir] - xbeg[dir]);
169 domainLength = xend[
IDIR] - xbeg[
IDIR];
171 #if (CHOMBO_LOGR == YES)
172 domainLength = log(xend[
IDIR]/xbeg[
IDIR]);
182 #if GEOMETRY == CARTESIAN
183 g_stretch_fact = g_x2stretch*g_x3stretch;
187 vector<int> numCells(SpaceDim);
193 CH_assert(D_TERM( (numCells[0] > 0),
194 && (numCells[1] > 0),
195 && (numCells[2] > 0)));
196 CH_assert(D_TERM( (numCells[0] % 2 == 0),
197 && (numCells[1] % 2 == 0),
198 && (numCells[2] % 2 == 0)));
206 int numReadLevels =
MAX(maxLevel, 1);
211 std::vector<
int> refRatios(numReadLevels + 1);
213 for (
int nlev = 0; nlev <= numReadLevels; nlev++){
214 refRatios[nlev] = atoi(
ParamFileGet(
"Ref_ratio",nlev+1));
215 if (nlev < maxLevel) totLevels *= refRatios[nlev];
220 MPI_Comm_size(Chombo_MPI::comm, &nprocs);
223 pout() << endl << endl;
224 pout() <<
"> AMR: " << endl << endl;
225 pout() <<
" Number of levels: " << maxLevel << endl;
226 pout() <<
" Equivalent Resolution: " << grid[
IDIR].
np_int*totLevels;
228 pout() <<
" x " << grid[
JDIR].np_int*totLevels; ,
229 pout() <<
" x " << grid[
KDIR].
np_int*totLevels;)
231 pout() <<
" Number of procs: " << nprocs << endl << endl;
234 std::vector<int> regridIntervals(numReadLevels);
235 for (
int nlev = 0; nlev < numReadLevels; nlev++)
236 regridIntervals[nlev] = atoi(
ParamFileGet(
"Regrid_interval",nlev+1));
239 Real refineThresh = atof(
ParamFileGet(
"Refine_thresh",1));
242 int tagBufferSize = atoi (
ParamFileGet(
"Tag_buffer_size",1));
248 int maxGridSize = atoi(
ParamFileGet(
"Max_grid_size",1));
261 Real dtToleranceFactor = 1.1;
276 vector<int> isPeriodica(SpaceDim,0);
280 isPeriodica[dir] = 1;
282 isPeriodica[dir] = 0;
286 bool isPeriodic[SpaceDim];
288 for (
int dim = 0; dim < SpaceDim; dim++)
290 isPeriodic[dim] = (isPeriodica[dim] == 1);
291 if (isPeriodic[dim] && verbosity >= 2 && procID() == 0)
292 pout() <<
"Using Periodic BCs in direction: " << dim << endl;
301 Real checkpointPeriod = output.
dt;
302 Real checkpointClock = output.
dclock;
303 int checkpointInterval = output.
dn;
308 Real plotPeriod = output.
dt;
309 Real plotClock = output.
dclock;
310 int plotInterval = output.
dn;
313 plotPeriod = checkpointPeriod = -1.0;
314 plotClock = checkpointClock = -1.0;
315 plotInterval = checkpointInterval = -1;
342 if ( verbosity >= 2 ) {
343 pout() <<
"maximum step = " << nstop << endl;
344 pout() <<
"maximum time = " << runtime.
tstop << endl;
346 pout() <<
"number of cells = " << D_TERM(numCells[0] <<
" " <<,
347 numCells[1] <<
" " <<,
348 numCells[2] << ) endl;
350 pout() << "maximum level = " << maxLevel << endl;
352 pout() << "refinement ratio = ";
353 for (
int i = 0; i < refRatios.size(); ++i) pout() << refRatios[i] << " ";
356 pout() << "regrid interval = ";
357 for (
int i = 0; i < regridIntervals.size(); ++i) pout() << regridIntervals[i] << " ";
360 pout() << "refinement threshold = " << refineThresh << endl;
362 pout() << "blocking factor = " << blockFactor << endl;
363 pout() << "
max grid size = " << maxGridSize << endl;
364 pout() << "fill ratio = " << fillRatio << endl;
366 pout() << "checkpoint interval = " << checkpointInterval << endl;
367 pout() << "plot interval = " << plotInterval << endl;
368 pout() << "CFL = " << runtime.cfl << endl;
369 pout() << "initial dt = " << initialDT << endl;
370 if (fixedDt > 0) pout() << "fixed dt = " << fixedDt << endl;
371 pout() << "maximum dt growth = " << runtime.cfl_max_var << endl;
372 pout() << "dt tolerance factor = " << dtToleranceFactor << endl;
377 ProblemDomain probDomain (IntVect::Zero,
378 IntVect(D_DECL(numCells[0]-1,
383 initialDT = initialDT*(probDomain.domainBox().bigEnd(0)-probDomain.domainBox().smallEnd(0)+1);
385 PatchPluto* patchPluto = static_cast<PatchPluto*>(new PatchPluto());
388 patchPluto->setBoundary(runtime.left_bound, runtime.right_bound);
389 patchPluto->setRiemann(Solver);
392 AMRLevelPlutoFactory amrGodFact;
394 amrGodFact.define(runtime.cfl,
405 amr.define(maxLevel,refRatios,probDomain,&amrGodFact);
407 if (fixedDt > 0) amr.fixedDt(fixedDt);
410 amr.maxGridSize(maxGridSize);
411 amr.blockFactor(blockFactor);
412 amr.fillRatio(fillRatio);
415 amr.gridBufferSize(1);
418 amr.checkpointPeriod(checkpointPeriod);
419 amr.checkpointClock (checkpointClock);
420 amr.checkpointInterval(checkpointInterval);
421 amr.plotPeriod (plotPeriod);
422 amr.plotClock (plotClock);
423 amr.plotInterval(plotInterval);
424 amr.regridIntervals(regridIntervals);
425 amr.maxDtGrow(runtime.cfl_max_var);
426 amr.dtToleranceFactor(dtToleranceFactor);
429 std::
string prefix = "data.";
430 prefix = runtime.output_dir+
string("/")+prefix;
431 amr.plotPrefix(prefix);
435 prefix = runtime.output_dir+
string("/")+prefix;
436 amr.checkpointPrefix(prefix);
438 amr.verbosity(verbosity);
441 if (cmd_line->restart ==
NO && cmd_line->h5restart ==
NO){
446 amr.setupForNewAMRRun();
448 MayDay::Error(
"Fixed_hierarchy option still disabled");
451 char restartNumber[32];
452 sprintf (restartNumber,
"%04d.hdf5", cmd_line->
nrestart);
453 prefix += restartNumber;
455 pout() << endl <<
"> Restarting from file " << prefix << endl;
458 HDF5Handle handle(prefix,HDF5Handle::OPEN_RDONLY);
460 amr.setupForRestart(handle);
474 MayDay::Error(
"amrPluto restart only defined with hdf5");
482 pout() <<
"> Starting Computation" << endl;
485 amr.run(runtime.
tstop,nstop);
488 exec_time = difftime (tend, tbeg);
489 pout() <<
"> Elapsed time: " << exec_time <<
" s" << endl;
490 pout() <<
"> Done\n";
int lbound
When different from zero, it specifies the boundary condition to be applied at leftmost grid side whe...
void GetOutputFrequency(Output *, const char *)
int end
Global end index for the local array.
void ShowConfig(int, char *a[], char *)
#define USER_DEF_PARAMETERS
int ParamExist(const char *label)
Riemann_Solver * SetSolver(const char *solver)
int npoint[3]
Global number of zones in the interior domain.
void Riemann_Solver(const State_1D *, int, int, double *, Grid *)
char output_dir[256]
The name of the output directory (output_dir for static PLUTO, Output_dir for PLUTO-Chombo) ...
int np_int_glob
Total number of points in the global domain (boundaries excluded).
int left_bound[3]
Array of left boundary types.
int rbound
Same as lbound, but for the right edge of the grid.
int lend
Local end index for the local array.
int lbeg
Local start index for the local array.
int gend
Global end index for the global array.
int np_tot_glob
Total number of points in the global domain (boundaries included).
int right_bound[3]
Array of right boundary types.
double dt
time increment between outputs - one per output
double patch_left_node[5][16]
int beg
Global start index for the local array.
double g_inputParam[32]
Array containing the user-defined parameters.
int gbeg
Global start index for the global array.
int nghost
Number of ghost zones.
int RuntimeSetup(Runtime *, Cmd_Line *, char *)
char solv_type[64]
The Riemann solver (Solver)
double g_domBeg[3]
Lower limits of the computational domain.
void MakeEV_TemperatureTable()
int ParamFileRead(char *fname)
double tstop
The final integration time (tstop)
void Init(double *, double, double, double)
D_EXPAND(tot/[n]=(double) grid[IDIR].np_int_glob;, tot/[n]=(double) grid[JDIR].np_int_glob;, tot/[n]=(double) grid[KDIR].np_int_glob;)
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
void MakeInternalEnergyTable()
void MakePV_TemperatureTable()
double first_dt
The initial time step (first_dt)
int np_tot
Total number of points in the local domain (boundaries included).
char * ParamFileGet(const char *label, int pos)
void SetGrid(Runtime *, Grid *)
void RuntimeSet(Runtime *runtime)
double dclock
time increment in clock hours - one per output
int dn
step increment between outputs - one per output
int np_int
Total number of points in the local domain (boundaries excluded).