This is the main driver of the simulation program. In this function the simulation is initiated, initial conditions are read in or calculated and the main simulation loop is set up. The hydrodynamic simulation is realized with 1D sweeps in all direction and forward/ backward. In addition diffusion and obstacle physics routines are called, when stated in the parameter file.
Definition at line 67 of file TYCHO.c.
References advection, boundary::back, bound, C1_visc, callocate_arrays_global(), cell_volume, counter, counter_restart, dB_Map_ready, diffusion(), dimension, boundary::down, dt, dt_calc(), dt_calc_first(), dt_integrated, endtime_sim, filetype, boundary::front, Gamma, Gamma1, grav_acc, gravity_on_off, hydro_sweeps(), initiate_domain(), initiate_domain_dom(), initiate_domain_marker(), initiate_grid(), intial_soundspeed, boundary::left, make_ic(), make_ics, make_kh_instabilities(), make_sod_ic(), max_array(), max_array_length, minute_in_sec, nmaxx, nmaxy, nmaxz, nminx, nminy, nminz, noise_generator(), number_of_threads, obstacle_heat_conductivity, obstalce_absorption_coefficient, olddt, output_frequency, pre_old_copy(), prepare_the_dB_map(), pressure_on_solid_calc(), pressure_on_solid_reset(), read_dom(), read_ic(), read_marker_file(), read_restart(), read_soundemitter(), read_wind_file(), reset_pressure_integrated(), restart, restart_frequency, boundary::right, S_visc, shock_or_not, small, smallp, smallr, sound_frequency, sound_pressure_level, sound_reflexion, specific_heat_capacity_gas, specific_heat_capacity_obstacle, start_file_reader(), time_sim, boundary::up, velocity_field_analyser(), viscosity_on_off, wind_on_off, with_obstacles, with_one_pulse, with_sound_emitter, write_amira(), write_ic_amira(), write_ic_ifrit(), write_ic_tyc(), write_ic_vtk(), write_ifrit(), write_restart_tyc(), write_tyc(), write_vtk(), x, xmax, xmin, y, ymax, ymin, z, zmax, and zmin.
{
int tmp1;
int i, j, k;
#ifndef _OPENMP
clock_t cputime_sim1, cputime_sim2;
clock_t cputime_sim1_eta, cputime_sim2_eta;
#endif
#ifdef _OPENMP
double cputime_sim1, cputime_sim2;
double cputime_sim1_eta, cputime_sim2_eta;
#endif
double seconds, seconds_eta;
char filename[200];
if (argc > 1) {
sprintf(filename, "%s", argv[1]);
}
if (argc == 1) {
printf("-TYCHO SIMULATION--\n");
printf("-Linux Version --\n");
printf("-V1.3.0 Oct. 2013--\n");
printf("-------------------\n");
printf("Please specify a\n");
printf("parameter File\n");
printf("-------------------\n");
exit(11);
}
if (argc == 3) {
printf("---------------This is a TYCHO Simulation--------------\n");
printf("---------------------Linux Version --------------------\n");
printf("---------------Version 1.3.0 released Oct. 2013--------\n");
printf("The code will restart from last checkpoint\n");
}
printf("---------------This is a TYCHO Simulation--------------\n");
printf("---------------------Linux ----------------------------\n");
printf("---------------Version 1.3.0 released Oct. 2013--------\n");
printf(
"The resolution of the simulation is\n%i %i %i\n",
x,
y,
z);
printf(
"The domain extend in meter in x,y and z is\n%g %g %g\n",
xmax,
printf("Attention the extend of your computational domain is a singularity!\n");
printf("We better stop.\n");
exit(0);
}
printf("Your boundary conditions are\n%i %i %i %i %i %i\n",
if (
wind_on_off == 1) printf(
"A wind marker file will be processed\n");
if (
with_obstacles == 0) printf(
"No Obstacles within computational domain\n");
if (
with_one_pulse == 1) printf(
"With a single sound-shock emitted\n");
if (
advection == 1) printf(
"A marker field will be advected with the HYDRO solution\n");
#ifdef _OPENMP
#endif
printf("-------------------------------------------------------\n");
fflush(stdout);
#ifdef _OPENMP
#endif
} else {
}
fflush(stdout);
fflush(stdout);
}
}
}
}
printf("Restart files are read.\n");
fflush(stdout);
}
double x_max_new, y_max_new, z_max_new;
double wavelength_divisor = 100.0;
if ((x_max_new <
xmax) || (y_max_new <
ymax) || (z_max_new <
zmax)) {
printf(
"New extend due to harmonic soundsource\nextend in x-direction: %g\nextend in y-direction: %g\nextend in z-direction: %g\n",
xmax,
ymax,
zmax);
printf("-------------------------------------------------------\n");
}
}
printf(
"The beginning time-step: %g [s]\n",
dt);
printf("-------------------------------------------------------\n");
fflush(stdout);
cputime_sim1 = clock();
#ifdef _OPENMP
cputime_sim1 = omp_get_wtime();
#endif
do {
cputime_sim1_eta = clock();
#ifdef _OPENMP
cputime_sim1_eta = omp_get_wtime();
#endif
cputime_sim2_eta = clock();
#ifdef _OPENMP
cputime_sim2_eta = omp_get_wtime();
#endif
seconds_eta = (cputime_sim2_eta - cputime_sim1_eta) / (double) CLOCKS_PER_SEC;
seconds_eta /= 2.0;
#ifdef _OPENMP
seconds_eta = (cputime_sim2_eta - cputime_sim1_eta);
seconds_eta /= 2.0;
#endif
}
}
cputime_sim2 = clock();
#ifdef _OPENMP
cputime_sim2 = omp_get_wtime();
#endif
seconds = (cputime_sim2 - cputime_sim1) / (double) CLOCKS_PER_SEC;
#ifdef _OPENMP
seconds = (cputime_sim2 - cputime_sim1);
#endif
if (counter > 0) {
printf(
"Estimated time to simulation end: %4.2f seconds\n", ((
endtime_sim -
time_sim) / dt) * seconds_eta);
}
printf(
"Estimated time to simulation end: %4.2f minutes\n", ((
endtime_sim -
time_sim) / dt) * seconds_eta / 60.0);
}
printf(
"Estimated time to simulation end: %5.2f hours\n", ((
endtime_sim -
time_sim) / dt) * seconds_eta / 3600.0);
}
printf(
"Estimated time to simulation end: %5.2f days\n", ((
endtime_sim -
time_sim) / dt) * seconds_eta / (3600.0 * 24.0));
}
if (seconds < 60.0) printf("Time since last output: %4.2g [s]\n", seconds);
if ((seconds > 60.0) && (seconds < 3600)) printf("Time since last output: %4.2g [min]\n", seconds / 60.0);
if (seconds > 3600.0) printf("Time since last output: %4.2g [h]\n", seconds / 3600.0);
}
printf("-------------------------------------------------------\n");
printf("Restart files are written.\n");
counter_restart++;
}
}
counter++;
fflush(stdout);
cputime_sim1 = clock();
#ifdef _OPENMP
cputime_sim1 = omp_get_wtime();
#endif
}
printf("\n--------------------------");
printf("\n--------------------------\n");
printf("Program aborted normally\n");
printf("End-time of simulation reached\n");
printf("\n--------------------------");
printf("\n--------------------------\n");
return 0;
}