Commit 38fbdf9c authored by Peter W. Draper's avatar Peter W. Draper
Browse files

Merge remote-tracking branch 'origin/master' into repart-time

parents 93a53e9b bee23d1c
......@@ -24,6 +24,7 @@
#include "approx_math.h"
#include "equation_of_state.h"
#include "hydro_gradients.h"
#include "hydro_properties.h"
#include "hydro_space.h"
#include "hydro_unphysical.h"
#include "hydro_velocities.h"
......@@ -130,8 +131,9 @@ __attribute__((always_inline)) INLINE static void hydro_first_init_part(
/* remember that we store the total thermal energy, not the specific thermal
energy (as in Gadget) */
#if defined(EOS_ISOTHERMAL_GAS)
/* this overwrites the internal energy from the initial condition file */
p->conserved.energy = mass * const_isothermal_internal_energy;
/* this overwrites the internal energy from the initial condition file
* Note that we call the EoS function just to get the constant u here. */
p->conserved.energy = mass * gas_internal_energy_from_entropy(0.f, 0.f);
#else
p->conserved.energy *= mass;
#endif
......@@ -608,7 +610,9 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
p->conserved.momentum[1] += p->conserved.flux.momentum[1];
p->conserved.momentum[2] += p->conserved.flux.momentum[2];
#if defined(EOS_ISOTHERMAL_GAS)
p->conserved.energy = p->conserved.mass * const_isothermal_internal_energy;
/* We use the EoS equation in a sneaky way here just to get the constant u */
p->conserved.energy =
p->conserved.mass * gas_internal_energy_from_entropy(0.f, 0.f);
#else
p->conserved.energy += p->conserved.flux.energy;
#endif
......@@ -707,15 +711,11 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
__attribute__((always_inline)) INLINE static float hydro_get_internal_energy(
const struct part* restrict p) {
if (p->primitives.rho > 0.) {
#ifdef EOS_ISOTHERMAL_GAS
return p->primitives.P / hydro_gamma_minus_one / p->primitives.rho;
#else
return const_isothermal_internal_energy;
#endif
} else {
if (p->primitives.rho > 0.)
return gas_internal_energy_from_pressure(p->primitives.rho,
p->primitives.P);
else
return 0.;
}
}
/**
......@@ -727,7 +727,7 @@ __attribute__((always_inline)) INLINE static float hydro_get_entropy(
const struct part* restrict p) {
if (p->primitives.rho > 0.) {
return p->primitives.P / pow_gamma(p->primitives.rho);
return gas_entropy_from_pressure(p->primitives.rho, p->primitives.P);
} else {
return 0.;
}
......@@ -741,16 +741,10 @@ __attribute__((always_inline)) INLINE static float hydro_get_entropy(
__attribute__((always_inline)) INLINE static float hydro_get_soundspeed(
const struct part* restrict p) {
if (p->primitives.rho > 0.) {
#ifdef EOS_ISOTHERMAL_GAS
return sqrtf(const_isothermal_internal_energy * hydro_gamma *
hydro_gamma_minus_one);
#else
return sqrtf(hydro_gamma * p->primitives.P / p->primitives.rho);
#endif
} else {
if (p->primitives.rho > 0.)
return gas_soundspeed_from_pressure(p->primitives.rho, p->primitives.P);
else
return 0.;
}
}
/**
......
......@@ -18,6 +18,7 @@
******************************************************************************/
#include "adiabatic_index.h"
#include "hydro.h"
#include "hydro_flux_limiters.h"
#include "hydro_gradients.h"
#include "hydro_slope_limiters.h"
......@@ -71,15 +72,7 @@ void hydro_read_particles(struct part* parts, struct io_props* list,
* @return Internal energy of the particle
*/
float convert_u(struct engine* e, struct part* p) {
if (p->primitives.rho > 0.) {
#ifdef EOS_ISOTHERMAL_GAS
return const_isothermal_internal_energy;
#else
return p->primitives.P / hydro_gamma_minus_one / p->primitives.rho;
#endif
} else {
return 0.;
}
return hydro_get_internal_energy(p);
}
/**
......@@ -90,11 +83,7 @@ float convert_u(struct engine* e, struct part* p) {
* @return Entropic function of the particle
*/
float convert_A(struct engine* e, struct part* p) {
if (p->primitives.rho > 0.) {
return p->primitives.P / pow_gamma(p->primitives.rho);
} else {
return 0.;
}
return hydro_get_entropy(p);
}
/**
......
......@@ -146,7 +146,7 @@ void readArray_chunk(hid_t h_data, hid_t h_plist_id,
* @brief Reads a data array from a given HDF5 group.
*
* @param grp The group from which to read.
* @param prop The #io_props of the field to read.
* @param props The #io_props of the field to read.
* @param N The number of particles on that rank.
* @param N_total The total number of particles.
* @param mpi_rank The MPI rank of this node.
......
......@@ -2703,7 +2703,7 @@ void space_init_gparts(struct space *s, int verbose) {
if (s->nr_gparts > 0)
threadpool_map(&s->e->threadpool, space_init_gparts_mapper, s->gparts,
s->nr_gparts, sizeof(struct part), 0, NULL);
s->nr_gparts, sizeof(struct gpart), 0, NULL);
if (verbose)
message("took %.3f %s.", clocks_from_ticks(getticks() - tic),
clocks_getunit());
......
......@@ -78,7 +78,7 @@ int main() {
engine.nr_threads = 1;
engine.nodeID = 0;
engine_rank = 0;
struct runner runner;
runner.e = &engine;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment