diff --git a/examples/parameter_example.yml b/examples/parameter_example.yml index 7c816844327e017a61dcfa6b805faa2cfd76658f..ef5b44a0f4dd822445a49b0d8ea41e85ae05b719 100644 --- a/examples/parameter_example.yml +++ b/examples/parameter_example.yml @@ -189,6 +189,9 @@ GrackleCooling: ProvideSpecificHeatingRates: 0 # User provide specific heating rates SelfShieldingMethod: 0 # Grackle (<= 3) or Gear self shielding method 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 ----------------------------------------------- diff --git a/src/cooling/grackle/cooling.h b/src/cooling/grackle/cooling.h index 7104b9c9f4ddc0211b7ef35f136996e009b3d64d..0493b0a2b4443afb263d5040483dd6a1fcca7c7d 100644 --- a/src/cooling/grackle/cooling.h +++ b/src/cooling/grackle/cooling.h @@ -202,7 +202,6 @@ __attribute__((always_inline)) INLINE static void cooling_compute_equilibrium_fr /* a few constants */ const float limit = tmp_cooling.convergence_limit; const double dt = 0.01 * fabs(cooling_time(&tmp_cooling, p, xp)); - const float omega = 0.8; /* disable energy updates */ tmp_cooling.chemistry.with_radiative_cooling = 0; @@ -216,7 +215,7 @@ __attribute__((always_inline)) INLINE static void cooling_compute_equilibrium_fr /* compute cooling rate */ 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) && step < tmp_cooling.max_step); diff --git a/src/cooling/grackle/cooling_io.h b/src/cooling/grackle/cooling_io.h index a6cbc6554955fee6a0934aa39755506fd305df39..8457ee7d958c97da199439a33c145cb413201649 100644 --- a/src/cooling/grackle/cooling_io.h +++ b/src/cooling/grackle/cooling_io.h @@ -154,6 +154,9 @@ __attribute__((always_inline)) INLINE static void cooling_parse_arguments( cooling->convergence_limit = 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); } diff --git a/src/cooling/grackle/cooling_struct.h b/src/cooling/grackle/cooling_struct.h index f247b09a4bab64884b3b0c2b3a62d8c595c87dcd..b714690ce4688268723748b29506e458cccc4be9 100644 --- a/src/cooling/grackle/cooling_struct.h +++ b/src/cooling/grackle/cooling_struct.h @@ -69,6 +69,9 @@ struct cooling_function_data { /* number of step max for first init */ int max_step; + + /* over relaxation parameter */ + float omega; }; /**