Commit 3090ec1c authored by Bert Vandenbroucke's avatar Bert Vandenbroucke
Browse files

Gizmo works again. Need to run more tests and make code mergable.

parent 4e917ae0
...@@ -178,10 +178,10 @@ __attribute__((always_inline)) INLINE static void hydro_end_density( ...@@ -178,10 +178,10 @@ __attribute__((always_inline)) INLINE static void hydro_end_density(
* @param timeBase Conversion factor between integer time and physical time. * @param timeBase Conversion factor between integer time and physical time.
*/ */
__attribute__((always_inline)) INLINE static void hydro_prepare_force( __attribute__((always_inline)) INLINE static void hydro_prepare_force(
struct part* restrict p, struct xpart* restrict xp) { struct part* restrict p, struct xpart* restrict xp, double timeBase) {
/* Set the physical time step */ /* Set the physical time step */
p->force.dt = get_timestep(p->time_bin, 0.); // MATTHIEU 0 p->force.dt = get_timestep(p->time_bin, timeBase); // MATTHIEU 0
/* Initialize time step criterion variables */ /* Initialize time step criterion variables */
p->timestepvars.vmax = 0.0f; p->timestepvars.vmax = 0.0f;
...@@ -375,7 +375,7 @@ __attribute__((always_inline)) INLINE static void hydro_end_force( ...@@ -375,7 +375,7 @@ __attribute__((always_inline)) INLINE static void hydro_end_force(
* @param half_dt Half the physical time step. * @param half_dt Half the physical time step.
*/ */
__attribute__((always_inline)) INLINE static void hydro_kick_extra( __attribute__((always_inline)) INLINE static void hydro_kick_extra(
struct part* p, struct xpart* xp, float dt) { struct part* p, struct xpart* xp, float dt, integertime_t ti_current) {
float oldm, oldp[3], anew[3]; float oldm, oldp[3], anew[3];
const float half_dt = 0.5f * dt; // MATTHIEU const float half_dt = 0.5f * dt; // MATTHIEU
...@@ -429,9 +429,9 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra( ...@@ -429,9 +429,9 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
/* Store gravitational acceleration and mass flux for next step */ /* Store gravitational acceleration and mass flux for next step */
p->gravity.old_a[0] = anew[0]; p->gravity.old_a[0] = anew[0];
p->gravity.old_a[1] = anew[1];
p->gravity.old_a[2] = anew[2]; p->gravity.old_a[2] = anew[2];
p->gravity.old_mflux[0] = p->gravity.mflux[0]; p->gravity.old_mflux[0] = p->gravity.mflux[0];
p->gravity.old_a[1] = anew[1];
p->gravity.old_mflux[1] = p->gravity.mflux[1]; p->gravity.old_mflux[1] = p->gravity.mflux[1];
p->gravity.old_mflux[2] = p->gravity.mflux[2]; p->gravity.old_mflux[2] = p->gravity.mflux[2];
} }
...@@ -444,6 +444,8 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra( ...@@ -444,6 +444,8 @@ __attribute__((always_inline)) INLINE static void hydro_kick_extra(
p->conserved.flux.momentum[1] = 0.0f; p->conserved.flux.momentum[1] = 0.0f;
p->conserved.flux.momentum[2] = 0.0f; p->conserved.flux.momentum[2] = 0.0f;
p->conserved.flux.energy = 0.0f; p->conserved.flux.energy = 0.0f;
p->force.ti_end = get_integer_time_end(ti_current, p->time_bin);
} }
/** /**
......
...@@ -413,8 +413,10 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common( ...@@ -413,8 +413,10 @@ __attribute__((always_inline)) INLINE static void runner_iact_fluxes_common(
*/ */
// MATTHIEU // MATTHIEU
const integertime_t pj_ti_end = 0; // get_integer_time_end(pj->time_bin); // const integertime_t pj_ti_end = 0; // get_integer_time_end(pj->time_bin);
const integertime_t pi_ti_end = 0; // get_integer_time_end(pi->time_bin); // const integertime_t pi_ti_end = 0; // get_integer_time_end(pi->time_bin);
integertime_t pi_ti_end = pi->force.ti_end;
integertime_t pj_ti_end = pj->force.ti_end;
if (mode == 1 || pj_ti_end > pi_ti_end) { if (mode == 1 || pj_ti_end > pi_ti_end) {
/* Store mass flux */ /* Store mass flux */
......
...@@ -178,6 +178,9 @@ struct part { ...@@ -178,6 +178,9 @@ struct part {
/* Physical time step of the particle. */ /* Physical time step of the particle. */
float dt; float dt;
/* Integer end time of the particle's time step. */
integertime_t ti_end;
/* Actual velocity of the particle. */ /* Actual velocity of the particle. */
float v_full[3]; float v_full[3];
......
...@@ -107,7 +107,7 @@ __attribute__((always_inline)) INLINE static void kick_part( ...@@ -107,7 +107,7 @@ __attribute__((always_inline)) INLINE static void kick_part(
} }
/* Extra kick work */ /* Extra kick work */
hydro_kick_extra(p, xp, dt); hydro_kick_extra(p, xp, dt, ti_end);
if (p->gpart != NULL) gravity_kick_extra(p->gpart, dt); if (p->gpart != NULL) gravity_kick_extra(p->gpart, dt);
} }
......
...@@ -599,6 +599,8 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { ...@@ -599,6 +599,8 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
target_wcount - e->hydro_properties->delta_neighbours; target_wcount - e->hydro_properties->delta_neighbours;
const int max_smoothing_iter = e->hydro_properties->max_smoothing_iterations; const int max_smoothing_iter = e->hydro_properties->max_smoothing_iterations;
int redo = 0, count = 0; int redo = 0, count = 0;
const double timeBase = e->timeBase;
integertime_t ti_current = e->ti_current;
TIMER_TIC; TIMER_TIC;
...@@ -679,7 +681,7 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) { ...@@ -679,7 +681,7 @@ void runner_do_ghost(struct runner *r, struct cell *c, int timer) {
/* As of here, particle force variables will be set. */ /* As of here, particle force variables will be set. */
/* Compute variables required for the force loop */ /* Compute variables required for the force loop */
hydro_prepare_force(p, xp); hydro_prepare_force(p, xp, ti_current, timeBase);
/* The particle force values are now set. Do _NOT_ /* The particle force values are now set. Do _NOT_
try to read any particle density variables! */ try to read any particle density variables! */
......
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