diff --git a/src/hydro/Default/hydro.h b/src/hydro/Default/hydro.h index 03953b07ad4e172d96b6e3382814e036a538e2bd..7fd3d1f6ad16b385c7a08718e6fd8c01f17407b5 100644 --- a/src/hydro/Default/hydro.h +++ b/src/hydro/Default/hydro.h @@ -27,10 +27,14 @@ * */ __attribute__((always_inline)) INLINE static float hydro_compute_timestep( - struct part* p, struct xpart* xp) { + struct part* p, struct xpart* xp, + const struct hydro_props* hydro_properties) { + + const float CFL_condition = hydro_properties->CFL_condition; /* CFL condition */ - const float dt_cfl = 2.f * const_cfl * kernel_gamma * p->h / p->force.v_sig; + const float dt_cfl = + 2.f * kernel_gamma * CFL_condition * p->h / p->force.v_sig; /* Limit change in u */ const float dt_u_change = diff --git a/src/hydro/Default/hydro_io.h b/src/hydro/Default/hydro_io.h index 0e9ad46ddc1d4e8c8d3ffdbf3e81262ec49a7092..09a7f4c7caa6a2a9fcf77c8d83b0ffcab2ef8b54 100644 --- a/src/hydro/Default/hydro_io.h +++ b/src/hydro/Default/hydro_io.h @@ -104,10 +104,10 @@ void writeSPHflavour(hid_t h_grpsph) { /* Kernel function description */ writeAttribute_s(h_grpsph, "Kernel", kernel_name); - writeAttribute_f(h_grpsph, "Kernel eta", const_eta_kernel); - writeAttribute_f(h_grpsph, "Weighted N_ngb", kernel_nwneigh); - writeAttribute_f(h_grpsph, "Delta N_ngb", const_delta_nwneigh); - writeAttribute_f(h_grpsph, "Hydro gamma", const_hydro_gamma); + // writeAttribute_f(h_grpsph, "Kernel eta", const_eta_kernel); + // writeAttribute_f(h_grpsph, "Weighted N_ngb", kernel_nwneigh); + // writeAttribute_f(h_grpsph, "Delta N_ngb", const_delta_nwneigh); + // writeAttribute_f(h_grpsph, "Hydro gamma", const_hydro_gamma); /* Viscosity and thermal conduction */ writeAttribute_s(h_grpsph, "Thermal Conductivity Model", @@ -123,11 +123,11 @@ void writeSPHflavour(hid_t h_grpsph) { writeAttribute_f(h_grpsph, "Viscosity decay length", const_viscosity_length); /* Time integration properties */ - writeAttribute_f(h_grpsph, "CFL parameter", const_cfl); - writeAttribute_f(h_grpsph, "Maximal ln(Delta h) change over dt", - const_ln_max_h_change); - writeAttribute_f(h_grpsph, "Maximal Delta h change over dt", - exp(const_ln_max_h_change)); + // writeAttribute_f(h_grpsph, "CFL parameter", const_cfl); + // writeAttribute_f(h_grpsph, "Maximal ln(Delta h) change over dt", + // const_ln_max_h_change); + // writeAttribute_f(h_grpsph, "Maximal Delta h change over dt", + // exp(const_ln_max_h_change)); writeAttribute_f(h_grpsph, "Maximal Delta u change over dt", const_max_u_change); } diff --git a/src/hydro/Gadget2/hydro_debug.h b/src/hydro/Gadget2/hydro_debug.h index a4d1f7dd4397ebfc850b582e1ca81fc0d4edb76a..4f00d8e020f9eaac30fe7f272ca1248d7e4eec58 100644 --- a/src/hydro/Gadget2/hydro_debug.h +++ b/src/hydro/Gadget2/hydro_debug.h @@ -23,14 +23,15 @@ __attribute__((always_inline)) "x=[%.3e,%.3e,%.3e], " "v=[%.3e,%.3e,%.3e],v_full=[%.3e,%.3e,%.3e] \n a=[%.3e,%.3e,%.3e],\n " "h=%.3e, " - "wcount=%d, wcount_dh=%.3e, m=%.3e, dh_drho=%.3e, rho=%.3e, P=%.3e, S=%.3e, " + "wcount=%d, wcount_dh=%.3e, m=%.3e, dh_drho=%.3e, rho=%.3e, P=%.3e, " + "S=%.3e, " "dS/dt=%.3e, c=%.3e\n" "divV=%.3e, curlV=%.3e, rotV=[%.3e,%.3e,%.3e] \n " "v_sig=%e dh/dt=%.3e t_begin=%d, t_end=%d\n", p->x[0], p->x[1], p->x[2], p->v[0], p->v[1], p->v[2], xp->v_full[0], xp->v_full[1], xp->v_full[2], p->a_hydro[0], p->a_hydro[1], p->a_hydro[2], - p->h, (int)p->density.wcount, p->density.wcount_dh, p->mass, p->rho_dh, p->rho, - p->force.pressure, p->entropy, p->entropy_dt, p->force.soundspeed, + p->h, (int)p->density.wcount, p->density.wcount_dh, p->mass, p->rho_dh, + p->rho, p->force.pressure, p->entropy, p->entropy_dt, p->force.soundspeed, p->div_v, p->force.curl_v, p->density.rot_v[0], p->density.rot_v[1], p->density.rot_v[2], p->force.v_sig, p->h_dt, p->ti_begin, p->ti_end); } diff --git a/src/hydro/Gadget2/hydro_io.h b/src/hydro/Gadget2/hydro_io.h index b1db6a8938eca085090df690a1f1aa6e3fef2dc8..6ddfdc861b36d01f5737f3312c766516d5d967f5 100644 --- a/src/hydro/Gadget2/hydro_io.h +++ b/src/hydro/Gadget2/hydro_io.h @@ -104,10 +104,10 @@ void writeSPHflavour(hid_t h_grpsph) { /* Kernel function description */ writeAttribute_s(h_grpsph, "Kernel", kernel_name); - //writeAttribute_f(h_grpsph, "Kernel eta", const_eta_kernel); - //writeAttribute_f(h_grpsph, "Weighted N_ngb", kernel_nwneigh); - //writeAttribute_f(h_grpsph, "Delta N_ngb", const_delta_nwneigh); - //writeAttribute_f(h_grpsph, "Hydro gamma", const_hydro_gamma); + // writeAttribute_f(h_grpsph, "Kernel eta", const_eta_kernel); + // writeAttribute_f(h_grpsph, "Weighted N_ngb", kernel_nwneigh); + // writeAttribute_f(h_grpsph, "Delta N_ngb", const_delta_nwneigh); + // writeAttribute_f(h_grpsph, "Hydro gamma", const_hydro_gamma); /* Viscosity and thermal conduction */ writeAttribute_s(h_grpsph, "Thermal Conductivity Model", @@ -118,9 +118,9 @@ void writeSPHflavour(hid_t h_grpsph) { writeAttribute_f(h_grpsph, "Viscosity beta", 3.f); /* Time integration properties */ - //writeAttribute_f(h_grpsph, "CFL parameter", const_cfl); - //writeAttribute_f(h_grpsph, "Maximal ln(Delta h) change over dt", + // writeAttribute_f(h_grpsph, "CFL parameter", const_cfl); + // writeAttribute_f(h_grpsph, "Maximal ln(Delta h) change over dt", // const_ln_max_h_change); - //writeAttribute_f(h_grpsph, "Maximal Delta h change over dt", + // writeAttribute_f(h_grpsph, "Maximal Delta h change over dt", // exp(const_ln_max_h_change)); } diff --git a/src/hydro/Minimal/hydro.h b/src/hydro/Minimal/hydro.h index 7db3c275ce7e3389610e8297c287cbd5301c6c64..d377c9f5c1a08e5c43ddb9941b450b2576d7ba34 100644 --- a/src/hydro/Minimal/hydro.h +++ b/src/hydro/Minimal/hydro.h @@ -27,13 +27,18 @@ * * @param p Pointer to the particle data * @param xp Pointer to the extended particle data + * @param hydro_properties The SPH parameters * */ __attribute__((always_inline)) INLINE static float hydro_compute_timestep( - struct part* p, struct xpart* xp) { + struct part* p, struct xpart* xp, + const struct hydro_props* hydro_properties) { + + const float CFL_condition = hydro_properties->CFL_condition; /* CFL condition */ - const float dt_cfl = 2.f * const_cfl * kernel_gamma * p->h / p->force.v_sig; + const float dt_cfl = + 2.f * kernel_gamma * CFL_condition * p->h / p->force.v_sig; return dt_cfl; } diff --git a/src/hydro/Minimal/hydro_io.h b/src/hydro/Minimal/hydro_io.h index afe5de83f423e43b4d2480cca1ac3e84d6c549de..43926d526b47fa8f1b92bb862edabefb7417de3c 100644 --- a/src/hydro/Minimal/hydro_io.h +++ b/src/hydro/Minimal/hydro_io.h @@ -104,9 +104,9 @@ void writeSPHflavour(hid_t h_grpsph) { /* Kernel function description */ writeAttribute_s(h_grpsph, "Kernel", kernel_name); - writeAttribute_f(h_grpsph, "Kernel eta", const_eta_kernel); - writeAttribute_f(h_grpsph, "Weighted N_ngb", kernel_nwneigh); - writeAttribute_f(h_grpsph, "Delta N_ngb", const_delta_nwneigh); + // writeAttribute_f(h_grpsph, "Kernel eta", const_eta_kernel); + // writeAttribute_f(h_grpsph, "Weighted N_ngb", kernel_nwneigh); + // writeAttribute_f(h_grpsph, "Delta N_ngb", const_delta_nwneigh); writeAttribute_f(h_grpsph, "Hydro gamma", const_hydro_gamma); /* Viscosity and thermal conduction */ @@ -115,11 +115,11 @@ void writeSPHflavour(hid_t h_grpsph) { writeAttribute_s(h_grpsph, "Viscosity Model", "No model"); /* Time integration properties */ - writeAttribute_f(h_grpsph, "CFL parameter", const_cfl); - writeAttribute_f(h_grpsph, "Maximal ln(Delta h) change over dt", - const_ln_max_h_change); - writeAttribute_f(h_grpsph, "Maximal Delta h change over dt", - exp(const_ln_max_h_change)); + // writeAttribute_f(h_grpsph, "CFL parameter", const_cfl); + // writeAttribute_f(h_grpsph, "Maximal ln(Delta h) change over dt", + // const_ln_max_h_change); + // writeAttribute_f(h_grpsph, "Maximal Delta h change over dt", + // exp(const_ln_max_h_change)); writeAttribute_f(h_grpsph, "Maximal Delta u change over dt", const_max_u_change); } diff --git a/src/hydro_properties.c b/src/hydro_properties.c index 92f9f5f5ce77944c5ab9ab329b088b5815f4ce20..3c270b2702edb503c60cdb3cf1029a014d437124 100644 --- a/src/hydro_properties.c +++ b/src/hydro_properties.c @@ -21,6 +21,7 @@ #include "hydro_properties.h" /* Standard headers */ +#include <float.h> #include <math.h> /* Local headers. */