Start PLUTO, initialize functions, define data structures and handle the main integration loop.
76 char first_step=1, last_step = 0;
91 MPI_Comm_rank (MPI_COMM_WORLD, &
prank);
94 Initialize (argc, argv, &data, &ini, grd, &cmd_line);
96 print1 (
"> Basic data type:\n");
97 print1 (
" sizeof (char) = %d\n",
sizeof(
char));
98 print1 (
" sizeof (uchar) = %d\n",
sizeof(
unsigned char));
99 print1 (
" sizeof (short) = %d\n",
sizeof(
short));
100 print1 (
" sizeof (ushort) = %d\n",
sizeof(
unsigned short));
101 print1 (
" sizeof (int) = %d\n",
sizeof(
int));
102 print1 (
" sizeof (*int) = %d\n",
sizeof(int_pnt));
103 print1 (
" sizeof (float) = %d\n",
sizeof(
float));
104 print1 (
" sizeof (double) = %d\n",
sizeof(
double));
105 print1 (
" sizeof (*double) = %d\n",
sizeof(dbl_pnt));
149 }
else if (cmd_line.
write){
153 Async_EndWriteData (&ini);
157 print1 (
"> Starting computation... \n\n");
186 print1 (
"step:%d ; t = %10.4e ; dt = %10.4e ; %d %% ; [%f, %d",
190 #if (PARABOLIC_FLUX & SUPER_TIME_STEPPING)
193 #if (PARABOLIC_FLUX & RK_CHEBYSHEV)
203 if (!first_step && !last_step && cmd_line.
write) {
214 err =
Integrate (&data, Solver, &Dts, grd);
241 #if SHOW_TIME_STEPS == YES
243 double cg, dta, dtp, dtc;
248 MPI_Allreduce (&dta, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
251 MPI_Allreduce (&dtp, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
254 MPI_Allreduce (&dtc, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
261 print1 (
" dt(adv) = cfl x %10.4e;\n",dta);
262 print1 (
" dt(par) = cfl x %10.4e;\n",dtp);
263 print1 (
" dt(cool) = %10.4e;\n",dtc);
273 #if (COOLING == NO) && ((DIMENSIONS == 1) || (DIMENSIONAL_SPLITTING == NO))
285 MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
288 MPI_Allreduce (&
g_maxRiemannIter, &nv, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
319 if (!first_step && !last_step && cmd_line.
write) {
329 #if SHOW_TIME_STEPS == YES
331 double cg, dta, dtp, dtc;
336 MPI_Allreduce (&dta, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
339 MPI_Allreduce (&dtp, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
342 MPI_Allreduce (&dtc, &cg, 1, MPI_DOUBLE, MPI_MIN, MPI_COMM_WORLD);
345 print1 (
"\t[dt/dta = %10.4e, dt/dtp = %10.4e, dt/dtc = %10.4e \n",
356 MPI_DOUBLE, MPI_MAX, MPI_COMM_WORLD);
359 MPI_Allreduce (&
g_maxRiemannIter, &nv, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD);
368 Async_EndWriteData (&ini);
376 print1 (
"step:%d ; t = %10.4e ; dt = %10.4e ; %d %% ; [%f, %d",
379 #if (PARABOLIC_FLUX & SUPER_TIME_STEPPING)
382 #if (PARABOLIC_FLUX & RK_CHEBYSHEV)
394 err =
Integrate (&data, Solver, &Dts, grd);
433 Async_EndWriteData (&ini);
438 MPI_Barrier (MPI_COMM_WORLD);
439 print1 (
"\n> Total allocated memory %6.2f Mb (proc #%d)\n",
441 MPI_Barrier (MPI_COMM_WORLD);
447 g_dt = difftime(tend, tbeg);
449 print1(
"> Average time/step %10.2e (sec) \n",
451 print1(
"> Local time %s",asctime(localtime(&tend)));
456 MPI_Barrier (MPI_COMM_WORLD);
static char * TotalExecutionTime(double)
Riemann_Solver * SetSolver(const char *solver)
void print1(const char *fmt,...)
void Riemann_Solver(const State_1D *, int, int, double *, Grid *)
static void CheckForOutput(Data *, Runtime *, Grid *)
int AL_Init(int *argc, char ***argv)
double **** Vc
The main four-index data array used for cell-centered primitive variables.
int g_maxRiemannIter
Maximum number of iterations for iterative Riemann Solver.
double g_dt
The current integration time step.
int Nrkc
Maximum number of substeps used in RKC.
double * cmax
Maximum signal velocity for hyperbolic eqns.
int log_freq
The log frequency (log)
double inv_dtp
Inverse of diffusion (parabolic) time step .
double rmax_par
(STS) max ratio between current time step and parabolic time step
double inv_dta
Inverse of advection (hyperbolic) time step, .
double g_maxMach
The maximum Mach number computed during integration.
double dt_cool
Cooling time step.
long int g_stepNumber
Gives the current integration step number.
void UnsetJetDomain(const Data *d, int dir, Grid *grid)
double cfl_par
Courant number for diffusion (STS only).
char solv_type[64]
The Riemann solver (Solver)
double tstop
The final integration time (tstop)
double cfl
Courant number for advection.
#define ARRAY_1D(nx, type)
long int NMAX_POINT
Maximum number of points among the three directions, boundaries excluded.
double g_time
The current integration time.
void SetJetDomain(const Data *d, int dir, int log_freq, Grid *grid)
int Nsts
Maximum number of substeps used in STS.
void Initialize(int argc, char *argv[], Data *data, Runtime *runtime, Grid *grid, Cmd_Line *cmd_line)
void FreeArray4D(void ****m)
static void CheckForAnalysis(Data *, Runtime *, Grid *)
double cfl_par
(STS) parabolic cfl number
void RestartFromFile(Runtime *, int, int, Grid *)
long int g_usedMemory
Amount of used memory in bytes.
static int Integrate(Data *, Riemann_Solver *, Time_Step *, Grid *)
static double NextTimeStep(Time_Step *, Runtime *, Grid *)
double cfl
Hyperbolic cfl number (CFL)