diff --git a/src/nucsyn/nucsyn_helium_checkfunction.c b/src/nucsyn/nucsyn_helium_checkfunction.c index e59f3ca0e71682829d4a38e3501638fdaa4c6b8d..59a5b702c34c4f77ca3f0dc82df9396c8d646b8a 100644 --- a/src/nucsyn/nucsyn_helium_checkfunction.c +++ b/src/nucsyn/nucsyn_helium_checkfunction.c @@ -1,6 +1,7 @@ #include "../binary_c.h" No_empty_translation_unit_warning; +#ifdef NUCSYN Boolean nucsyn_helium_checkfunction(struct stardata_t * const stardata MAYBE_UNUSED, double * const N, const double temperature, @@ -13,3 +14,4 @@ Boolean nucsyn_helium_checkfunction(struct stardata_t * const stardata MAYBE_UNU */ return (N[XHe4]>TINY && temperature >= 0.8e8) ? TRUE : FALSE; } +#endif//NUCSYN diff --git a/src/nucsyn/nucsyn_hydrogen_checkfunction.c b/src/nucsyn/nucsyn_hydrogen_checkfunction.c index 95a599caee5bc9e9940b2e443f474e760fbfe1bf..4fc2669ed43efeb3caa8c7d0af301013b8c0d33c 100644 --- a/src/nucsyn/nucsyn_hydrogen_checkfunction.c +++ b/src/nucsyn/nucsyn_hydrogen_checkfunction.c @@ -1,6 +1,8 @@ #include "../binary_c.h" No_empty_translation_unit_warning; +#ifdef NUCSYN + Boolean nucsyn_hydrogen_pp_checkfunction(struct stardata_t * const stardata MAYBE_UNUSED, double * const N, const double temperature, @@ -55,3 +57,5 @@ Boolean nucsyn_hydrogen_NeNaMgAl_checkfunction(struct stardata_t * const stardat N[XAl26]>TINY) && temperature >= 1e6) ? TRUE : FALSE; } + +#endif//NUCSYN diff --git a/src/timestep/nonstellar_timestep.c b/src/timestep/nonstellar_timestep.c index b7a895c97f51a32d4a97440b6e89a4beaebd2d4b..b21d544bb722b4c2e0f44558054521149e55edb4 100644 --- a/src/timestep/nonstellar_timestep.c +++ b/src/timestep/nonstellar_timestep.c @@ -6,25 +6,29 @@ No_empty_translation_unit_warning; void nonstellar_timestep(struct stardata_t * const stardata, double * const dtm) { - Foreach_star(star) - { - timestep_fixed_timesteps(stardata, - star, - dtm); - } + /* + * Timesteps that don't depend on the properties + * of the stars. + */ + + + /* + * Fixed timesteps: associate these with star 0 + * which will always exist + */ + timestep_fixed_timesteps(stardata, + &stardata->star[0], + dtm); + /* * Hard wired minimum : do not apply * if the timestep is limited by a fixed timestep */ - Foreach_star(star) + if(stardata->model.fixed_timestep_triggered == FALSE && + stardata->star[0].dtlimiter != DT_LIMIT_FIXED_TIMESTEP) { - if(stardata->model.fixed_timestep_triggered == FALSE && - star->dtlimiter != DT_LIMIT_FIXED_TIMESTEP) - { - *dtm = Max(*dtm, - MINIMUM_STELLAR_TIMESTEP); - } + *dtm = Max(*dtm, + MINIMUM_STELLAR_TIMESTEP); } - } diff --git a/src/timestep/stellar_timestep.c b/src/timestep/stellar_timestep.c index d7998d83b7c3d9603b69cb072ef7d1e5b13484cf..01b0ea9dc6bdbcaaaa6750fe78cdc240e7a59770 100644 --- a/src/timestep/stellar_timestep.c +++ b/src/timestep/stellar_timestep.c @@ -131,11 +131,11 @@ void stellar_timestep(Timestep_prototype_args) } } + nonstellar_timestep(stardata,dt); timestep_limits(Timestep_call_args); timestep_logging(Timestep_call_args); timestep_modulation(Timestep_call_args); timestep_hard_limits(Timestep_call_args); - //nonstellar_timestep(stardata,dt); star->stellar_timestep = *dt; diff --git a/src/timestep/timestep.h b/src/timestep/timestep.h index 01f0db99763b002a517e7e20d57a3aea22e70b92..7e52d2a3ff83c296f4439a21c247ee4e103d031c 100644 --- a/src/timestep/timestep.h +++ b/src/timestep/timestep.h @@ -117,36 +117,70 @@ enum { FIXED_TIMESTEPS_LIST }; * a new logging variable. */ -#define Set_timestep(DT,TO,IN,WHY) \ - { \ - (DT)=(TO); \ - Dprint("Set timestep to %g why %d\n", \ - (TO), \ - (WHY)); \ - if(WHY!=DT_LIMIT_MAXIMUM_TIMESTEP && \ - WHY!=DT_LIMIT_MINIMUM_TIMESTEP) \ - { \ - (IN)->dtlimiter=(WHY); \ - } \ +#define Set_timestep(DT,TO,IN,WHY) \ + { \ + (DT)=Max(stardata->preferences->minimum_timestep, \ + (TO)); \ + Dprint("Set timestep to %g why %d\n", \ + (TO), \ + (WHY)); \ + if(WHY!=DT_LIMIT_MAXIMUM_TIMESTEP && \ + WHY!=DT_LIMIT_MINIMUM_TIMESTEP) \ + { \ + (IN)->dtlimiter=(WHY); \ + } \ } -#define Limit_timestep(DT,TO,IN,WHY) \ - __extension__ \ - ({ \ - Boolean _limited; \ - if((DT)>(TO)) \ - { \ - Dprint("Limit timestep to %g why %d\n", \ - (TO), \ - (WHY)); \ - Set_timestep((DT),(TO),(IN),(WHY)); \ - _limited = TRUE; \ - } \ - else \ - { \ - _limited = FALSE; \ - } \ - _limited; \ +#define Set_timestep_no_minimum(DT,TO,IN,WHY) \ + { \ + (DT)=(TO); \ + Dprint("Set timestep to %g why %d\n", \ + (TO), \ + (WHY)); \ + if(WHY!=DT_LIMIT_MAXIMUM_TIMESTEP && \ + WHY!=DT_LIMIT_MINIMUM_TIMESTEP) \ + { \ + (IN)->dtlimiter=(WHY); \ + } \ + } + +#define Limit_timestep(DT,TO,IN,WHY) \ + __extension__ \ + ({ \ + Boolean _limited; \ + if((DT)>Max(stardata->preferences->minimum_timestep, \ + (TO))) \ + { \ + Dprint("Limit timestep to %g why %d\n", \ + (TO), \ + (WHY)); \ + Set_timestep((DT),(TO),(IN),(WHY)); \ + _limited = TRUE; \ + } \ + else \ + { \ + _limited = FALSE; \ + } \ + _limited; \ + }) + +#define Limit_timestep_no_minimum(DT,TO,IN,WHY) \ + __extension__ \ + ({ \ + Boolean _limited; \ + if((DT)>(TO)) \ + { \ + Dprint("Limit timestep to %g why %d\n", \ + (TO), \ + (WHY)); \ + Set_timestep_no_minimum((DT),(TO),(IN),(WHY)); \ + _limited = TRUE; \ + } \ + else \ + { \ + _limited = FALSE; \ + } \ + _limited; \ }) #define Floor_timestep(DT,TO,IN,WHY) \ diff --git a/src/timestep/timestep_fixed_timesteps.c b/src/timestep/timestep_fixed_timesteps.c index 4316a23f7be5d65fd3357bb78c0c225f02b5641b..90cfb12912759a7a324cd48c9b3d97364faf9420 100644 --- a/src/timestep/timestep_fixed_timesteps.c +++ b/src/timestep/timestep_fixed_timesteps.c @@ -46,10 +46,14 @@ void timestep_fixed_timesteps(struct stardata_t * const stardata, log10(stardata->model.time + dtlim))) ); - Limit_timestep(*dtm, - dtlim, - star, - DT_LIMIT_FIXED_TIMESTEP); + /* + * Limit the timestep, but do not impose + * the stardata->preferences->minimum_timestep + */ + Limit_timestep_no_minimum(*dtm, + dtlim, + star, + DT_LIMIT_FIXED_TIMESTEP); } } } diff --git a/src/timestep/timestep_hard_limits.c b/src/timestep/timestep_hard_limits.c index cb70d55e09e88b9f9a9d5cfc51dc6392dfecda81..234a398e129ad2c92e8aff3db618c7803cbc9142 100644 --- a/src/timestep/timestep_hard_limits.c +++ b/src/timestep/timestep_hard_limits.c @@ -39,7 +39,7 @@ void timestep_hard_limits(Timestep_prototype_args) /* * If there has been an event, perhaps limit the next timestep? */ - if(0 && stardata->common.n_events > 0) + if(0&&stardata->common.n_events > 0) { Limit_timestep(*dt, stardata->preferences->minimum_timestep,