Commit 0b4ee25b authored by Matthieu Schaller's avatar Matthieu Schaller

Updated the unit tests to use the new definitions of time variables in the engine.

parent ce252df4
......@@ -76,13 +76,24 @@ __attribute__((always_inline)) INLINE static float hydro_get_pressure(
return gas_pressure_from_entropy(p->rho, p->entropy);
}
/**
* @brief Returns the comoving entropy of a particle
*
* @param p The particle of interest.
*/
__attribute__((always_inline)) INLINE static float hydro_get_comoving_entropy(
const struct part *restrict p) {
return p->entropy;
}
/**
* @brief Returns the entropy of a particle
*
* @param p The particle of interest.
* @param cosmo The cosmological model.
*/
__attribute__((always_inline)) INLINE static float hydro_get_entropy(
__attribute__((always_inline)) INLINE static float hydro_get_physical_entropy(
const struct part *restrict p, const struct cosmology *cosmo) {
return p->entropy;
......
......@@ -164,7 +164,7 @@ void stats_collect_part_mapper(void *map_data, int nr_parts, void *extra_data) {
hydro_get_drifted_velocities(p, xp, dt_kick_hydro, dt_kick_grav, v);
const double x[3] = {p->x[0], p->x[1], p->x[2]};
const float m = hydro_get_mass(p);
const float entropy = hydro_get_entropy(p, cosmo);
const float entropy = hydro_get_physical_entropy(p, cosmo);
const float u_int = hydro_get_physical_internal_energy(p, cosmo);
/* Collect mass */
......
......@@ -403,14 +403,14 @@ void dump_particle_fields(char *fileName, struct cell *main_cell,
main_cell->parts[pid].x[1], main_cell->parts[pid].x[2],
main_cell->parts[pid].v[0], main_cell->parts[pid].v[1],
main_cell->parts[pid].v[2], main_cell->parts[pid].h,
hydro_get_density(&main_cell->parts[pid]),
hydro_get_comoving_density(&main_cell->parts[pid]),
#if defined(MINIMAL_SPH) || defined(SHADOWFAX_SPH)
0.f,
#else
main_cell->parts[pid].density.div_v,
#endif
hydro_get_entropy(&main_cell->parts[pid]),
hydro_get_internal_energy(&main_cell->parts[pid]),
hydro_get_comoving_entropy(&main_cell->parts[pid]),
hydro_get_comoving_internal_energy(&main_cell->parts[pid]),
hydro_get_pressure(&main_cell->parts[pid]),
hydro_get_soundspeed(&main_cell->parts[pid]),
main_cell->parts[pid].a_hydro[0], main_cell->parts[pid].a_hydro[1],
......
......@@ -260,7 +260,7 @@ void dump_particle_fields(char *fileName, struct cell *main_cell,
main_cell->parts[pid].x[1], main_cell->parts[pid].x[2],
main_cell->parts[pid].v[0], main_cell->parts[pid].v[1],
main_cell->parts[pid].v[2],
hydro_get_density(&main_cell->parts[pid]),
hydro_get_comoving_density(&main_cell->parts[pid]),
#if defined(GIZMO_SPH) || defined(SHADOWFAX_SPH)
0.f,
#else
......@@ -297,7 +297,7 @@ void dump_particle_fields(char *fileName, struct cell *main_cell,
"%13e %13e %13e\n",
cj->parts[pjd].id, cj->parts[pjd].x[0], cj->parts[pjd].x[1],
cj->parts[pjd].x[2], cj->parts[pjd].v[0], cj->parts[pjd].v[1],
cj->parts[pjd].v[2], hydro_get_density(&cj->parts[pjd]),
cj->parts[pjd].v[2], hydro_get_comoving_density(&cj->parts[pjd]),
#if defined(GIZMO_SPH) || defined(SHADOWFAX_SPH)
0.f,
#else
......
......@@ -130,13 +130,13 @@ void dump_indv_particle_fields(char *fileName, struct part *p) {
"%8.5f "
"%8.5f %8.5f %13e %13e %13e %13e %13e %8.5f %8.5f\n",
p->id, p->x[0], p->x[1], p->x[2], p->v[0], p->v[1], p->v[2], p->h,
hydro_get_density(p),
hydro_get_comoving_density(p),
#if defined(MINIMAL_SPH) || defined(SHADOWFAX_SPH)
0.f,
#else
p->density.div_v,
#endif
hydro_get_entropy(p), hydro_get_internal_energy(p),
hydro_get_comoving_entropy(p), hydro_get_comoving_internal_energy(p),
hydro_get_pressure(p), hydro_get_soundspeed(p), p->a_hydro[0],
p->a_hydro[1], p->a_hydro[2], p->force.h_dt,
#if defined(GADGET2_SPH)
......
......@@ -236,7 +236,7 @@ void dump_particle_fields(char *fileName, struct cell *main_cell, int i, int j,
main_cell->parts[pid].x[1], main_cell->parts[pid].x[2],
main_cell->parts[pid].v[0], main_cell->parts[pid].v[1],
main_cell->parts[pid].v[2],
hydro_get_density(&main_cell->parts[pid]),
hydro_get_comoving_density(&main_cell->parts[pid]),
#if defined(GIZMO_SPH) || defined(SHADOWFAX_SPH)
0.f,
#else
......
......@@ -95,8 +95,8 @@ int main() {
run.e = ŋ
eng.time = 0.;
eng.timeBegin = 0.;
eng.timeEnd = N_orbits * T;
eng.time_begin = 0.;
eng.time_end = N_orbits * T;
eng.dt_min = dt; /* This forces the time-step to be dt */
eng.dt_max = dt; /* irrespective of the state of the particle */
......@@ -104,7 +104,7 @@ int main() {
for (i = 0; i < N; i++) {
/* Move forward in time */
eng.timeOld = eng.time;
eng.time_old = eng.time;
eng.time += dt;
/* Compute gravitational acceleration */
......
Markdown is supported
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