Commit 1da074ae authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added a growth time for the sine-wave external potential test case.

parent 9d92c916
......@@ -107,6 +107,12 @@ DiscPatchPotential:
timestep_mult: 0.03 # Dimensionless pre-factor for the time-step condition
growth_time: 5. # (Optional) Time for the disc to grow to its final size (multiple of the dynamical time)
# Sine Wave potential
SineWavePotential:
amplitude: 10. # Amplitude of the sine wave (internal units)
timestep_limit: 1. # Time-step dimensionless pre-factor.
growth_time: 0. # (Optional) Time for the potential to grow to its final size.
# Parameters related to cooling function ----------------------------------------------
# Constant du/dt cooling function
......
......@@ -43,6 +43,9 @@ struct external_potential {
/*! Amplitude of the sine wave. */
double amplitude;
/*! Growth time of the potential. */
double growth_time;
/*! Time-step limiting factor. */
double timestep_limit;
};
......@@ -76,7 +79,13 @@ __attribute__((always_inline)) INLINE static void external_gravity_acceleration(
double time, const struct external_potential* restrict potential,
const struct phys_const* restrict phys_const, struct gpart* restrict g) {
g->a_grav[0] = potential->amplitude * sin(2. * M_PI * g->x[0]) /
float Acorr = 1.;
if (time < potential->growth_time) {
Acorr = time / potential->growth_time;
}
g->a_grav[0] = potential->amplitude * Acorr * sin(2. * M_PI * g->x[0]) /
phys_const->const_newton_G;
}
......@@ -114,6 +123,8 @@ static INLINE void potential_init_backend(
potential->amplitude =
parser_get_param_double(parameter_file, "SineWavePotential:amplitude");
potential->growth_time = parser_get_opt_param_double(
parameter_file, "SineWavePotential:growth_time", 0.);
potential->timestep_limit = parser_get_param_double(
parameter_file, "SineWavePotential:timestep_limit");
}
......
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