diff --git a/src/MINT/MINT_call_BSE_stellar_structure.c b/src/MINT/MINT_call_BSE_stellar_structure.c index becfe72ac4d8c92f9873de4b21f1760a2c9c5c86..dde9bb74b644d90f0a5beeb64d747d10c83a5f89 100644 --- a/src/MINT/MINT_call_BSE_stellar_structure.c +++ b/src/MINT/MINT_call_BSE_stellar_structure.c @@ -11,6 +11,7 @@ int MINT_call_BSE_stellar_structure(struct stardata_t * const stardata, /* * Call BSE stellar structure routine from MINT */ + printf("call bse\n"); int ret = newstar->stellar_type; if(oldstar != NULL) { @@ -32,6 +33,22 @@ int MINT_call_BSE_stellar_structure(struct stardata_t * const stardata, newstar->derivative[DERIVATIVE_STELLAR_CENTRAL_CARBON] = 0.0; } + /* + * Testing: allocate arrays + */ + if(newstar->luminosities == NULL) + { + newstar->luminosities = Malloc(sizeof(double)*LUMS_ARRAY_SIZE); + } + if(newstar->timescales == NULL) + { + newstar->timescales = Malloc(sizeof(double)*TSCLS_ARRAY_SIZE); + } + if(newstar->GB == NULL) + { + newstar->GB = Malloc(sizeof(double)*GB_ARRAY_SIZE); + } + printf("MINT call BSE stellar structure %p \n", (void*)newstar->luminosities); diff --git a/src/MINT/MINT_stellar_structure.c b/src/MINT/MINT_stellar_structure.c index e237ef41fe4ac006d805f44cfb99ac706684ac7d..c99c794fd2db476ffe33d2292a96e1b0c52ee4bd 100644 --- a/src/MINT/MINT_stellar_structure.c +++ b/src/MINT/MINT_stellar_structure.c @@ -38,7 +38,7 @@ int MINT_stellar_structure(struct stardata_t * const stardata, newstar); } - if(vb) +// if(vb) printf("MINT model %d (%d %d)\n", stardata->model.model_number, oldstar->stellar_type, @@ -70,12 +70,13 @@ int MINT_stellar_structure(struct stardata_t * const stardata, #ifdef NUCSYN newstar->TAMS_core_mass = MINT_has_shells(newstar) ? - MINT_core(newstar,XHe4,0.9) : 0.0; + MINT_core(newstar,XHe4,0.99) : + 0.0; #else newstar->TAMS_core_mass = 0.0; #endif// NUCSYN newstar->tm = newstar->age; - Dprint("MS ended : L=%g R=%g Mc=%g tm=%g\n", + printf("MS ended : L=%g R=%g Mc=%g tm=%g\n", newstar->TAMS_luminosity, newstar->TAMS_radius, newstar->TAMS_core_mass, @@ -95,6 +96,7 @@ int MINT_stellar_structure(struct stardata_t * const stardata, } } + int ret = newstar->stellar_type; #undef X #define X(STELLAR_TYPE,FUNCTION,CALL_BSE) FUNCTION, @@ -117,11 +119,20 @@ int MINT_stellar_structure(struct stardata_t * const stardata, * Call BSE before MINT? */ const unsigned int action = call_bse_action[newstar->stellar_type]; - if(vb)printf("MINT t=%g st = %d action = %u %s\n", + vb=1; + if(vb)printf("MINT star %d : t=%30.20e st = %d action = %u %s X=%g Y=%g\n", + newstar->starnum, stardata->model.time, newstar->stellar_type, call_bse_action[newstar->stellar_type], - call_bse_action_strings[action]); + call_bse_action_strings[action], + newstar->mint->XHc, + newstar->mint->XHec + ); + if(stellar_type_exceeded(stardata,newstar) == TRUE) + { + return ret; + } if(action == MINT_CALL_BSE_BEFORE || action == MINT_CALL_BSE_BOTH) @@ -130,6 +141,10 @@ int MINT_stellar_structure(struct stardata_t * const stardata, oldstar, newstar, caller_id); + if(stellar_type_exceeded(stardata,newstar) == TRUE) + { + return ret; + } } /* @@ -141,11 +156,10 @@ int MINT_stellar_structure(struct stardata_t * const stardata, oldstar, newstar, caller_id); - } - - if(newstar->stellar_type > stardata->preferences->max_stellar_type[newstar->starnum]) - { - return ret; + if(stellar_type_exceeded(stardata,newstar) == TRUE) + { + return ret; + } } /* @@ -158,9 +172,14 @@ int MINT_stellar_structure(struct stardata_t * const stardata, oldstar, newstar, caller_id); + if(stellar_type_exceeded(stardata,newstar) == TRUE) + { + return ret; + } } - if(vb)printf("MINT_stellar_structure return %d (stellar types %d %d)\n", +// if(vb) + printf("MINT_stellar_structure return %d (stellar types %d %d)\n", ret, oldstar->stellar_type, newstar->stellar_type); diff --git a/src/evolution/check_for_evolution_stop.c b/src/evolution/check_for_evolution_stop.c index 82723064946af946fd3fc17b0842c2a3b156c882..c949a49a80f072229168cdc3986146bb32cd58af 100644 --- a/src/evolution/check_for_evolution_stop.c +++ b/src/evolution/check_for_evolution_stop.c @@ -14,13 +14,7 @@ Boolean Pure_function check_for_evolution_stop(struct stardata_t * const stardat * Check stellar type does not exceed the max stellar type * but skip if MASSLESS_REMNANT and the max_stellar_type is negative */ - const Stellar_type max = - stardata->preferences->max_stellar_type[star->starnum]; - - if((star->stellar_type != MASSLESS_REMNANT || - max > 0) - && - star->stellar_type > abs(max)) + if(stellar_type_exceeded(stardata,star) == TRUE) { return TRUE; } diff --git a/src/evolution/evolution_prototypes.h b/src/evolution/evolution_prototypes.h index 8c495c3cfa5ecca56036212bd9e021419ddf8ed4..46c7dd1c5aea95fe614cc2e761a3abd345872088 100644 --- a/src/evolution/evolution_prototypes.h +++ b/src/evolution/evolution_prototypes.h @@ -106,5 +106,6 @@ int update_system_by_dt(struct stardata_t * RESTRICT const stardata, const Boolean update_time); void evolution_detect_stellar_type_change(struct stardata_t * const stardata); - +Boolean stellar_type_exceeded(struct stardata_t * const stardata, + struct star_t * const star); #endif /* EVOLUTION_PROTOTYPES_H */ diff --git a/src/evolution/stellar_type_exceeded.c b/src/evolution/stellar_type_exceeded.c new file mode 100644 index 0000000000000000000000000000000000000000..2d9144587bc96f43f04760b50a942e69a5e828aa --- /dev/null +++ b/src/evolution/stellar_type_exceeded.c @@ -0,0 +1,24 @@ +#include "../binary_c.h" +No_empty_translation_unit_warning; + +Boolean stellar_type_exceeded(struct stardata_t * const stardata, + struct star_t * const star) +{ + /* + * return TRUE if the stellar type exceeds the + * max_stellar_type (set as an argument) + */ + const Stellar_type max = + stardata->preferences->max_stellar_type[star->starnum]; + if((star->stellar_type != MASSLESS_REMNANT || + max > 0) + && + star->stellar_type > abs(max)) + { + return TRUE; + } + else + { + return FALSE; + } +} diff --git a/src/stellar_structure/stellar_structure_BSE.c b/src/stellar_structure/stellar_structure_BSE.c index 3ce03ba4ebb54db13c97ae71438957f5d963c709..c8ba372062db9bc2df2c5fb74d74ea778416e424 100644 --- a/src/stellar_structure/stellar_structure_BSE.c +++ b/src/stellar_structure/stellar_structure_BSE.c @@ -21,7 +21,7 @@ int stellar_structure_BSE(struct stardata_t * const stardata, double * const luminosities, double * const GB) { - Dprint("stellar structure called from %s with age %g (star %d, type %d, timescales %p, luminosities %p, GB %p)\n", + printf("stellar structure called from %s with age %g (star %d, type %d, timescales %p, luminosities %p, GB %p)\n", Stellar_structure_caller_string(caller_id), star->age, star->starnum, diff --git a/src/stellar_structure/stellar_structure_HG.c b/src/stellar_structure/stellar_structure_HG.c index 03cb1e110c309ec00143c1e80e23477680579597..0c68d683ac2c5f15dca71919e37b9a099b593dce 100644 --- a/src/stellar_structure/stellar_structure_HG.c +++ b/src/stellar_structure/stellar_structure_HG.c @@ -20,7 +20,7 @@ Stellar_type stellar_structure_HG(struct star_t * RESTRICT const newstar, double rho,tau; const double thg = newstar->timescales[T_BGB] - newstar->tm; double mcbgbf; - + printf("SHG\n"); #ifdef MINT if(stardata->preferences->stellar_structure_algorithm == STELLAR_STRUCTURE_ALGORITHM_MINT)