Skip to content
Snippets Groups Projects
Commit b09f4c82 authored by lhausamm's avatar lhausamm
Browse files

Add over relaxation parameter

parent 9bd9a0f5
No related branches found
No related tags found
1 merge request!499Improved grackle
...@@ -189,6 +189,9 @@ GrackleCooling: ...@@ -189,6 +189,9 @@ GrackleCooling:
ProvideSpecificHeatingRates: 0 # User provide specific heating rates ProvideSpecificHeatingRates: 0 # User provide specific heating rates
SelfShieldingMethod: 0 # Grackle (<= 3) or Gear self shielding method SelfShieldingMethod: 0 # Grackle (<= 3) or Gear self shielding method
OutputMode: 0 # Write in output corresponding primordial chemistry mode OutputMode: 0 # Write in output corresponding primordial chemistry mode
MaxSteps: 10000 # (optional) Max number of step when computing the initial composition
ConvergenceLimit: 1e-2 # (optional) Convergence threshold (relative) for initial composition
Omega: 0.8 # (optional) Over relaxation coefficient for initial composition (< 1 avoid oscillation, > 1 speedup convergence)
# Parameters related to chemistry models ----------------------------------------------- # Parameters related to chemistry models -----------------------------------------------
......
...@@ -202,7 +202,6 @@ __attribute__((always_inline)) INLINE static void cooling_compute_equilibrium_fr ...@@ -202,7 +202,6 @@ __attribute__((always_inline)) INLINE static void cooling_compute_equilibrium_fr
/* a few constants */ /* a few constants */
const float limit = tmp_cooling.convergence_limit; const float limit = tmp_cooling.convergence_limit;
const double dt = 0.01 * fabs(cooling_time(&tmp_cooling, p, xp)); const double dt = 0.01 * fabs(cooling_time(&tmp_cooling, p, xp));
const float omega = 0.8;
/* disable energy updates */ /* disable energy updates */
tmp_cooling.chemistry.with_radiative_cooling = 0; tmp_cooling.chemistry.with_radiative_cooling = 0;
...@@ -216,7 +215,7 @@ __attribute__((always_inline)) INLINE static void cooling_compute_equilibrium_fr ...@@ -216,7 +215,7 @@ __attribute__((always_inline)) INLINE static void cooling_compute_equilibrium_fr
/* compute cooling rate */ /* compute cooling rate */
cooling_rate(NULL, NULL, &tmp_cooling, p, xp, dt); cooling_rate(NULL, NULL, &tmp_cooling, p, xp, dt);
cooling_over_relaxation(xp, &xp_1, omega); cooling_over_relaxation(xp, &xp_1, cooling->omega);
} while(!cooling_check_convergence(&xp_1, xp, limit) && } while(!cooling_check_convergence(&xp_1, xp, limit) &&
step < tmp_cooling.max_step); step < tmp_cooling.max_step);
......
...@@ -154,6 +154,9 @@ __attribute__((always_inline)) INLINE static void cooling_parse_arguments( ...@@ -154,6 +154,9 @@ __attribute__((always_inline)) INLINE static void cooling_parse_arguments(
cooling->convergence_limit = cooling->convergence_limit =
parser_get_opt_param_double(parameter_file, "GrackleCooling:ConvergenceLimit", 1e-2); parser_get_opt_param_double(parameter_file, "GrackleCooling:ConvergenceLimit", 1e-2);
cooling->convergence_limit =
parser_get_opt_param_double(parameter_file, "GrackleCooling:Omega", 0.8);
} }
......
...@@ -69,6 +69,9 @@ struct cooling_function_data { ...@@ -69,6 +69,9 @@ struct cooling_function_data {
/* number of step max for first init */ /* number of step max for first init */
int max_step; int max_step;
/* over relaxation parameter */
float omega;
}; };
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment