Open and parse the runtime initialization file. Assign values to the runtime structure.
35 int idim, ip, ipos, itype,
nlines;
36 char *bound_opt[
NOPT], str_var[512], *str;
37 char *glabel[] = {
"X1-grid",
"X2-grid",
"X3-grid"};
38 char *bbeg_label[] = {
"X1-beg",
"X2-beg",
"X3-beg"};
39 char *bend_label[] = {
"X1-end",
"X2-end",
"X3-end"};
44 for (itype = 0; itype <
NOPT; itype++) {
45 bound_opt[itype] =
"0000";
70 for (idim = 0; idim < 3; idim++){
75 for (ip = 1; ip <= runtime->
npatch[idim]; ip++) {
86 if (strcmp(str_var,
"u") == 0 || strcmp(str_var,
"uniform") == 0) {
89 }
else if (strcmp(str_var,
"s") == 0 || strcmp(str_var,
"strecthed") == 0) {
91 }
else if (strcmp(str_var,
"l+") == 0){
93 }
else if (strcmp(str_var,
"l-") == 0){
96 printf (
"\nSetup: You must specify either 'u', 's', 'l+' or 'l-' as grid-type in %s\n",
104 if ( (ipos+1) != (runtime->
npatch[idim]*3 + 3)) {
105 printf (
"! Setup: domain #%d setup is not properly defined \n", idim);
109 printf (
"! Setup: %d point(s) on dim. %d is NOT valid, resetting to 1\n",
110 runtime->
npoint[idim],idim+1);
111 runtime->
npoint[idim] = 1;
112 runtime->
npatch[idim] = 1;
121 if (cmd_line->
xres > 1) {
124 if (runtime->
npatch[idim] > 1){
125 printf (
"! Setup: -xres option works on uniform, single patch grid\n");
131 dbl_var = (double)runtime->
npoint[idim];
132 runtime->
npoint[idim] =
MAX( (
int)(dbl_var*rx), 1);
143 else runtime->
cfl_par = 0.8/(double)DIMENSIONS;
162 for (idim = 0; idim < 3; idim++){
165 COMPARE (str, bound_opt[itype], itype);
167 printf (
"! Setup: don't know how to put left boundary '%s' \n", str);
173 for (idim = 0; idim < 3; idim++){
176 COMPARE (str, bound_opt[itype], itype);
178 printf (
"! Setup: don't know how to put left boundary '%s' \n", str);
190 for (ip = 0; ip < runtime->
user_var; ip++){
194 printf (
"! Setup: missing name after user var name '%s'\n",
210 sprintf (str_var,
"%s/tmp09123.txt",runtime->
output_dir);
211 fp = fopen(str_var,
"w");
213 printf (
"! Setup: cannot access directory '%s'.\n", runtime->
output_dir);
214 printf (
"! Please check that the directory exists\n");
215 printf (
"! and you have write permission.\n");
225 output = runtime->
output + (ipos++);
232 if ( strcmp(output->
mode,
"single_file")
233 && strcmp(output->
mode,
"single_file_async")
234 && strcmp(output->
mode,
"multiple_files")){
235 printf (
"! Setup: expecting 'single_file', 'single_file_async' ");
236 printf (
"or 'multiple_files' in dbl output\n");
240 if ( strcmp(output->
mode,
"single_file")
241 && strcmp(output->
mode,
"multiple_files")){
243 "! Setup: expecting 'single_file' or 'multiple_files' in dbl output\n");
251 output = runtime->
output + (ipos++);
257 if ( strcmp(output->
mode,
"single_file")
258 && strcmp(output->
mode,
"single_file_async")
259 && strcmp(output->
mode,
"multiple_files")){
260 printf (
"! Setup: expecting 'single_file', 'single_file_async' ");
261 printf (
"or 'multiple_files' in flt output\n");
265 if ( strcmp(output->
mode,
"single_file")
266 && strcmp(output->
mode,
"multiple_files")){
268 "! Setup: expecting 'single_file' or 'multiple_files' in flt output\n");
273 else output->
cgs = 0;
279 output = runtime->
output + (ipos++);
285 output = runtime->
output + (ipos++);
294 output = runtime->
output + (ipos++);
299 printf (
"! Setup: extra field missing in vtk output\n");
303 if ( strcmp(output->
mode,
"single_file")
304 && strcmp(output->
mode,
"multiple_files")){
305 printf (
"! Setup: expecting 'single_file' or 'multiple_files' in\n");
306 printf (
" vtk output\n");
310 else output->
cgs = 0;
316 output = runtime->
output + (ipos++);
320 else output->
cgs = 0;
326 output = runtime->
output + (ipos++);
335 output = runtime->
output + (ipos++);
350 output = runtime->
output + ipos;
386 sprintf (str_var,
"%s/tmp09123.txt",runtime->
output_dir);
387 fp = fopen(str_var,
"w");
389 printf (
"! Setup: cannot access directory '%s'.\n", runtime->
output_dir);
390 printf (
"! Please check that the directory exists\n");
391 printf (
"! and you have write permission.\n");
403 fp = fopen(ini_file,
"r");
407 for (ipos = 0; ipos <=
nlines; ipos++){
408 fgets(str_var, 512, fp);
410 if (strlen(str_var) > 0) {
411 str = strtok (str_var,
"]");
412 if (strcmp(str,
"[Parameters") == 0)
break;
416 fgets(str_var, 512, fp);
419 fscanf (fp,
"%s \n", str_var);
421 runtime->
aux[ip] = dbl_var;
422 fgets(str_var,
sizeof(str_var), fp);
int user_var
The number of additional user-variables being held in memory and written to disk. ...
#define USER_DEF_PARAMETERS
int ParamExist(const char *label)
int ParamFileHasBoth(const char *label1, const char *label2)
int npoint[3]
Global number of zones in the interior domain.
Output output[MAX_OUTPUT_TYPES]
char output_dir[256]
The name of the output directory (output_dir for static PLUTO, Output_dir for PLUTO-Chombo) ...
#define LOGARITHMIC_INC_GRID
int left_bound[3]
Array of left boundary types.
char user_var_name[128][128]
static int nlines
The total number of lines (including empty ones) contained in the file.
#define LOGARITHMIC_DEC_GRID
int cgs
when set to 1 saves data in c.g.s units
int right_bound[3]
Array of right boundary types.
int log_freq
The log frequency (log)
void GetOutputFrequency(Output *output, const char *output_format)
double anl_dt
Time step increment for Analysis() ( analysis (double) )
double rmax_par
(STS) max ratio between current time step and parabolic time step
double dt
time increment between outputs - one per output
double patch_left_node[5][16]
#define COMPARE(s1, s2, ii)
char solv_type[64]
The Riemann solver (Solver)
int ParamFileRead(char *fname)
double tstop
The final integration time (tstop)
char mode[32]
single or multiple files - one per output
int npatch[5]
The number of grid patches.
int type
output format (DBL, FLT, ...) - one per output
double first_dt
The initial time step (first_dt)
double cfl_par
(STS) parabolic cfl number
char * ParamFileGet(const char *label, int pos)
double cfl_max_var
Maximum increment between consecutive time steps (CFL_max_var).
#define QUIT_PLUTO(e_code)
double dclock
time increment in clock hours - one per output
int dn
step increment between outputs - one per output
double cfl
Hyperbolic cfl number (CFL)