This function calculates the hydrodynamical timestep for the simulation. It is based on the signal velocity in the medium and the courant factor, specified in the parameterfile.
{
int i, j, k;
double rdt1, tmpdy, tmpdz, tmp;
double xvel, yvel, zvel, svel;
double max_tmp1, max_tmp2, max_tmp3, min_tmp1, dtx, dt3;
double kin_viscosity;
double s_visc;
double temperature;
rdt1 = 0.0;
svel = 0.0;
kin_viscosity = 0.0;
s_visc = 0.0;
k = 0;
j = 0;
for (i = 0; i <
x; i++) {
xvel = fabs(
vx[i][j][k]) /
zdx[i];
s_visc = kin_viscosity / (tmp * tmp);
}
}
}
}
#ifdef _OPENMP
#pragma omp parallel default(none) \
private(j, i, k, tmpdy, tmp, svel, xvel, \
yvel, max_tmp2, max_tmp3, temperature, \
kin_viscosity,s_visc) \
shared(x, y, z, dom, rho, pre, Gamma1, vx, \
vy, zdx, zdy, dimension, rdt1, \
viscosity_on_off, gasconstant)
{
#endif
k = 0;
for (i = 0; i <
x; i++) {
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (j = 0; j <
y; j++) {
xvel = fabs(
vx[i][j][k]) /
zdx[i];
yvel = fabs(
vy[i][j][k]) / tmpdy;
max_tmp2 =
max_dt(svel, xvel);
max_tmp3 =
max_dt(max_tmp2, yvel);
rdt1 =
max_dt(max_tmp3, rdt1);
s_visc = kin_viscosity / (tmp * tmp);
}
}
}
}
}
#ifdef _OPENMP
}
#endif
#ifdef _OPENMP
#pragma omp parallel default(none) \
private(j, i, k, tmpdy, tmp, tmpdz, svel, xvel, \
yvel, zvel, max_tmp1, max_tmp2, max_tmp3, \
min_tmp1, temperature, \
kin_viscosity,s_visc) \
shared(x, y, z, dom, rho, pre, Gamma1, vx, \
vy, vz, zdx, zdy, zdz,dimension, rdt1, \
viscosity_on_off, gasconstant)
{
#endif
for (i = 0; i <
x; i++) {
#ifdef _OPENMP
#pragma omp for schedule(static)
#endif
for (j = 0; j <
y; j++) {
for (k = 0; k <
z; k++) {
min_tmp1 =
min_dt(tmpdy, tmpdz);
xvel = fabs(
vx[i][j][k]) /
zdx[i];
yvel = fabs(
vy[i][j][k]) / tmpdy;
zvel = fabs(
vz[i][j][k]) / tmpdz;
max_tmp1 =
max_dt(xvel, yvel);
max_tmp2 =
max_dt(zvel, svel);
max_tmp3 =
max_dt(max_tmp1, max_tmp2);
rdt1 =
max_dt(max_tmp3, rdt1);
s_visc = kin_viscosity / (tmp * tmp);
}
}
}
}
}
}
#ifdef _OPENMP
}
#endif
printf("A time_simstep of zero ---> STOP\n");
exit(42);
}
return 0;
}