From 06f2da06ec8da27bd9969931dc057a22136a7d34 Mon Sep 17 00:00:00 2001 From: Robert Izzard <r.izzard@surrey.ac.uk> Date: Tue, 5 Nov 2019 14:41:21 +0000 Subject: [PATCH] no longer set J=0 for "single" systems which are very wide : this accidentally sent stars as single when they should just be very wide --- src/binary_c_debug.h | 2 +- .../calculate_orbital_period.c | 3 ++- src/evolution/binary_star_evolution.c | 14 +------------- src/evolution/initialize_parameters.c | 1 + src/orbit/update_orbital_variables.c | 2 +- src/setup/parse_arguments.c | 8 +++++++- tbse | 6 +++--- 7 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/binary_c_debug.h b/src/binary_c_debug.h index 71a1068ed..b145358c2 100644 --- a/src/binary_c_debug.h +++ b/src/binary_c_debug.h @@ -100,7 +100,7 @@ * this is not shown. */ -#define Debug_show_expression " " +#define Debug_show_expression " sep=%g per=%g J=%g ",stardata->common.orbit.separation,stardata->common.orbit.period,stardata->common.orbit.angular_momentum //#undef Debug_show_expression diff --git a/src/binary_star_functions/calculate_orbital_period.c b/src/binary_star_functions/calculate_orbital_period.c index ccaeb0b29..658a89089 100644 --- a/src/binary_star_functions/calculate_orbital_period.c +++ b/src/binary_star_functions/calculate_orbital_period.c @@ -8,7 +8,8 @@ double Pure_function_if_no_debug calculate_orbital_period (struct stardata_t * R (double)AU_IN_SOLAR_RADII)/(Total_mass)) *YEAR_LENGTH_IN_DAYS; - Dprint("Calculating orbital period: %g (M1+M2=%g a=%g)\n",per, + Dprint("Calculating orbital period: %g (M1+M2=%g a=%g)\n", + per, Total_mass,stardata->common.orbit.separation); return per; diff --git a/src/evolution/binary_star_evolution.c b/src/evolution/binary_star_evolution.c index f654e178f..497a52cad 100644 --- a/src/evolution/binary_star_evolution.c +++ b/src/evolution/binary_star_evolution.c @@ -7,8 +7,7 @@ void binary_star_evolution(struct stardata_t * RESTRICT const stardata, * Having calculated stellar evolution, do * binary-specific evolutionary tasks */ - - if(stardata->common.orbit.eccentricity>1.0) + if(stardata->common.orbit.eccentricity > 1.0) { *retval = SYSTEM_IS_BROKEN_APART; } @@ -22,15 +21,4 @@ void binary_star_evolution(struct stardata_t * RESTRICT const stardata, determine_roche_lobe_radii(stardata,&stardata->common.orbit); set_effective_radii(stardata); } - - if(System_is_single) - { - /* - * Single star systems have no orbital angular - * momentum, and orbital frequency is undefined, - * so set both to zero. - */ - stardata->common.orbit.angular_momentum = 0.0; - stardata->common.orbit.angular_frequency = 0.0; - } } diff --git a/src/evolution/initialize_parameters.c b/src/evolution/initialize_parameters.c index 3a69d91d4..a131d9b97 100644 --- a/src/evolution/initialize_parameters.c +++ b/src/evolution/initialize_parameters.c @@ -237,6 +237,7 @@ void initialize_parameters(struct stardata_t * RESTRICT const stardata) #endif//BSE star->q = Q(k); determine_roche_lobe_radius(stardata,&stardata->common.orbit,star); + Dprint("post-roche\n"); star->rol0 = star->roche_radius; Dprint("setting lum to %12.12e\n",lum); diff --git a/src/orbit/update_orbital_variables.c b/src/orbit/update_orbital_variables.c index 8834960da..815a07d39 100644 --- a/src/orbit/update_orbital_variables.c +++ b/src/orbit/update_orbital_variables.c @@ -43,5 +43,5 @@ void update_orbital_variables(struct stardata_t * RESTRICT const stardata, update_orbital_period_and_angular_frequency(orbit,star1,star2); determine_roche_lobe_radii(stardata,orbit); - + Dprint("post-roche\n"); } diff --git a/src/setup/parse_arguments.c b/src/setup/parse_arguments.c index 3fddc7f5e..76f9fd3f2 100644 --- a/src/setup/parse_arguments.c +++ b/src/setup/parse_arguments.c @@ -12,7 +12,6 @@ static Boolean match_scanf(const char * const arg, const struct cmd_line_arg_t * const cmd_line_arg, size_t * const offset_p); - static void derived_arguments(struct stardata_t * const stardata); /**************/ @@ -544,6 +543,9 @@ static void derived_arguments(struct stardata_t * const stardata) if(Is_not_zero(stardata->star[0].mass) && Is_not_zero(stardata->star[1].mass)) { + Dprint("preset : sep = %g per = %g\n", + stardata->common.orbit.separation, + stardata->common.orbit.period); if(Is_zero(stardata->common.orbit.period) && Is_not_zero(stardata->common.orbit.separation)) { @@ -567,6 +569,10 @@ static void derived_arguments(struct stardata_t * const stardata) } } + Dprint("postset: sep = %g per = %g\n", + stardata->common.orbit.separation, + stardata->common.orbit.period); + /* * If we are using log times, choose the next * max_evolution_time that correponds to an diff --git a/tbse b/tbse index a74a7d24e..9d37c7989 100755 --- a/tbse +++ b/tbse @@ -94,14 +94,14 @@ STELLAR_TYPE1=MAIN_SEQUENCE STELLAR_TYPE2=MAIN_SEQUENCE # stellar masses (solar units) -M1=2 -M2=1.5 +M1=1 +M2=0.1 # orbit: # If the period (days) is given, use it. # If the period is zero, use the separation (in Rsun) to calculate the period. # (this requires that the masses are already set) -ORBITAL_PERIOD=300 +ORBITAL_PERIOD=30000000000 ORBITAL_SEPARATION=0.0 # Orbital eccentricity should be in the range 0.0-1.0. -- GitLab