Skip to content
Snippets Groups Projects
Commit e323386e authored by Loic Hausammann's avatar Loic Hausammann
Browse files

Small corrections

parent 934eec11
Branches
Tags
1 merge request!1081GEAR's corrections
......@@ -752,11 +752,6 @@ void cooling_cool_part(const struct phys_const* restrict phys_const,
/* Nothing to do here? */
if (dt == 0.) return;
/* Is the cooling turn off */
if (time - xp->cooling_data.time_last_event < cooling->thermal_time) {
return;
}
/* Current energy */
const float u_old = hydro_get_physical_internal_energy(p, xp, cosmo);
......@@ -773,8 +768,15 @@ void cooling_cool_part(const struct phys_const* restrict phys_const,
}
/* Calculate energy after dt */
gr_float u_new = cooling_new_energy(phys_const, us, cosmo, hydro_props,
cooling, p, xp, dt, dt_therm);
gr_float u_new = 0;
/* Is the cooling turn off */
if (time - xp->cooling_data.time_last_event < cooling->thermal_time) {
u_new = u_ad_before;
} else {
u_new = cooling_new_energy(phys_const, us, cosmo, hydro_props, cooling, p,
xp, dt, dt_therm);
}
/* Get the change in internal energy due to hydro forces */
float hydro_du_dt = hydro_get_physical_internal_energy_dt(p, cosmo);
......
......@@ -74,12 +74,6 @@ pressure_floor_get_comoving_pressure(const struct part* p,
/* Compute the pressure floor */
float floor = kernel_gamma * kernel_gamma * p->h * p->h * rho *
pressure_floor_props.constants * cosmo->a_inv;
/* Add the velocity dispersion */
const float sigma2 = p->pressure_floor_data.sigma2 * cosmo->a2_inv;
if (sigma2 < floor) {
floor -= sigma2;
}
floor *= a_coef * rho * hydro_one_over_gamma;
return fmaxf(pressure_comoving, floor);
......@@ -145,12 +139,7 @@ __attribute__((always_inline)) INLINE static void pressure_floor_print_snapshot(
* @param cosmo The current cosmological model.
*/
__attribute__((always_inline)) INLINE static void pressure_floor_end_density(
struct part* restrict p, const struct cosmology* cosmo) {
/* To finish the turbulence estimation we devide by the density */
p->pressure_floor_data.sigma2 /=
pow_dimension(p->h) * hydro_get_comoving_density(p);
}
struct part* restrict p, const struct cosmology* cosmo) {}
/**
* @brief Sets all the pressure floor fields to sensible values when the #part
......@@ -163,11 +152,7 @@ __attribute__((always_inline)) INLINE static void pressure_floor_end_density(
__attribute__((always_inline)) INLINE static void
pressure_floor_part_has_no_neighbours(struct part* restrict p,
struct xpart* restrict xp,
const struct cosmology* cosmo) {
/* If part has 0 neighbours, the estimation of turbulence is 0 */
p->pressure_floor_data.sigma2 = 0.f;
}
const struct cosmology* cosmo) {}
/**
* @brief Sets the pressure_floor properties of the (x-)particles to a valid
......@@ -177,9 +162,7 @@ pressure_floor_part_has_no_neighbours(struct part* restrict p,
* @param xp Pointer to the extended particle data.
*/
__attribute__((always_inline)) INLINE static void pressure_floor_init_part(
struct part* restrict p, struct xpart* restrict xp) {
p->pressure_floor_data.sigma2 = 0.f;
}
struct part* restrict p, struct xpart* restrict xp) {}
/**
* @brief Sets the pressure_floor properties of the (x-)particles to a valid
......
......@@ -29,8 +29,6 @@
* @brief do pressure_floor computation after the runner_iact_density (symmetric
* version)
*
* Compute the velocity dispersion follow eq. 2 in Revaz & Jablonka 2018.
*
* @param r2 Comoving square distance between the two particles.
* @param dx Comoving vector separating both particles (pi - pj).
* @param hi Comoving smoothing-length of particle i.
......@@ -42,28 +40,7 @@
*/
__attribute__((always_inline)) INLINE static void runner_iact_pressure_floor(
float r2, const float *dx, float hi, float hj, struct part *restrict pi,
struct part *restrict pj, float a, float H) {
float wi;
float wj;
/* Evaluation of the SPH kernel */
kernel_eval(sqrt(r2) / hi, &wi);
kernel_eval(sqrt(r2) / hj, &wj);
/* Delta v */
float dv[3] = {pi->v[0] - pj->v[0], pi->v[1] - pj->v[1], pi->v[2] - pj->v[2]};
/* Compute the velocity dispersion */
const float a2H = a * a * H;
const float sigma[3] = {dv[0] + a2H * dx[0], dv[1] + a2H * dx[1],
dv[2] + a2H * dx[2]};
const float sigma2 =
sigma[0] * sigma[0] + sigma[1] * sigma[1] + sigma[2] * sigma[2];
/* Compute the velocity dispersion */
pi->pressure_floor_data.sigma2 += sigma2 * wi * hydro_get_mass(pj);
pj->pressure_floor_data.sigma2 += sigma2 * wj * hydro_get_mass(pi);
}
struct part *restrict pj, float a, float H) {}
/**
* @brief do pressure_floor computation after the runner_iact_density (non
......@@ -82,23 +59,6 @@ __attribute__((always_inline)) INLINE static void
runner_iact_nonsym_pressure_floor(float r2, const float *dx, float hi, float hj,
struct part *restrict pi,
const struct part *restrict pj, float a,
float H) {
float wi;
/* Evaluation of the SPH kernel */
kernel_eval(sqrt(r2) / hi, &wi);
/* Delta v */
float dv[3] = {pi->v[0] - pj->v[0], pi->v[1] - pj->v[1], pi->v[2] - pj->v[2]};
/* Compute the velocity dispersion */
const float a2H = a * a * H;
const float sigma[3] = {dv[0] + a2H * dx[0], dv[1] + a2H * dx[1],
dv[2] + a2H * dx[2]};
const float sigma2 =
sigma[0] * sigma[0] + sigma[1] * sigma[1] + sigma[2] * sigma[2];
/* Compute the velocity dispersion */
pi->pressure_floor_data.sigma2 += sigma2 * wi * hydro_get_mass(pj);
}
float H) {}
#endif /* SWIFT_GEAR_PRESSURE_FLOOR_IACT_H */
......@@ -23,10 +23,6 @@
* Structure containing the required variables for the pressure
* floor in the density loop.
*/
struct pressure_floor_part_data {
/*! Estimation of local turbulence (squared)
* Units: length^2 / time^2 (comoving) */
float sigma2;
};
struct pressure_floor_part_data {};
#endif // SWIFT_PRESSURE_FLOOR_PART_GEAR_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment