From 87a82f597bc71396e2df8c3d371f5d758e89ee7b Mon Sep 17 00:00:00 2001 From: Robert Izzard <rob.izzard@gmail.com> Date: Mon, 5 Feb 2018 17:36:54 +0000 Subject: [PATCH] add disc parameter space outputter: this tests the whole parameter space and optionally outputs to a file for plotting also added line numbers to binary_c's rgrep wrapper --- rgrep | 2 +- src/disc/disc_evolve_disc_structure.c | 17 +++++++++++------ src/disc/disc_prototypes.h | 4 ++++ src/disc/disc_trisector.c | 6 ++++-- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/rgrep b/rgrep index 5a8269f19..5ad846349 100755 --- a/rgrep +++ b/rgrep @@ -1,6 +1,6 @@ #!/bin/bash # search only .c and .h files -grep --include=*.c --include=*.h --color=always "$1" -rI ./src $2 $3 $4 | sed s/\:/\ \:/ +grep --include=*.c --include=*.h --color=always "$1" -rIn ./src $2 $3 $4 | sed s/\:/\ \:/ diff --git a/src/disc/disc_evolve_disc_structure.c b/src/disc/disc_evolve_disc_structure.c index ed37fa727..0d340cad3 100644 --- a/src/disc/disc_evolve_disc_structure.c +++ b/src/disc/disc_evolve_disc_structure.c @@ -69,6 +69,9 @@ double disc_evolve_disc_structure(struct stardata_t * stardata, memcpy(discwas,disc,sizeof(struct disc_t)); } + /* + * Detect first timestep entry + */ Boolean first = Boolean_(IS_ZERO(disc->lifetime) || disc->first); /* @@ -91,8 +94,7 @@ double disc_evolve_disc_structure(struct stardata_t * stardata, Discdebug(1," %s ", first==TRUE ? "first" : disc->append==TRUE ? "append" : - "!conv" - ); + "!conv"); disc->dt = DISC_MIN_TIMESTEP; memset(disc->loss,0,sizeof(struct disc_loss_t)*DISC_LOSS_N); disc_initial_structure(disc, @@ -101,11 +103,16 @@ double disc_evolve_disc_structure(struct stardata_t * stardata, t, first, &can_evolve); + + if(can_evolve) { + Discdebug(1,"Have converged initial disc structure\n"); disc->converged = TRUE; memcpy(discwas,disc,sizeof(struct disc_t)); } + disc_parameter_space(stardata,disc); + Exit_binary_c(2,"Found first structure? %s\n",can_evolve?"y":"n"); } @@ -409,13 +416,13 @@ double disc_evolve_disc_structure(struct stardata_t * stardata, /* - * Check for failure modes + * Check for failure modes: failure_reason + * is NULL if there is no failure. */ char * failure_reason = disc_failure_mode(stardata, disc, binary, status); - if(failure_reason) { Discdebug(1, @@ -796,8 +803,6 @@ static char * disc_failure_mode(struct stardata_t * stardata, disc_is_ring ? " is ring" : "", flux_negative ? " flux negative" : "", too_ringlike ? " too ringlike" : ""); - - } else { diff --git a/src/disc/disc_prototypes.h b/src/disc/disc_prototypes.h index 926349c53..dd8f1d254 100644 --- a/src/disc/disc_prototypes.h +++ b/src/disc/disc_prototypes.h @@ -276,6 +276,10 @@ void disc_evaporate_cbdiscs(struct stardata_t * stardata); void disc_stellar_wind_to_cbdisc(struct stardata_t * stardata); #endif // DISCS_CIRCUMBINARY_FROM_WIND +void disc_parameter_space(struct stardata_t * stardata, + struct disc_t * disc); + + #endif // DISCS #endif // DISC_PROTOTYPES_H diff --git a/src/disc/disc_trisector.c b/src/disc/disc_trisector.c index 289bd6e55..5964e6813 100644 --- a/src/disc/disc_trisector.c +++ b/src/disc/disc_trisector.c @@ -56,7 +56,9 @@ void disc_trisector2(struct disc_t * disc, double *xx) { /* - * + * Function that does the work. This may be + * called from elsewhere for debugging purposes, + * so is not a static function. */ int status = disc_build_disc_zones(disc,binary); @@ -73,7 +75,7 @@ void disc_trisector2(struct disc_t * disc, double M = disc_total_mass(disc); double J = disc_total_angular_momentum(disc,binary); double F = disc_total_angular_momentum_flux(disc,binary); - Discdebug(1, + Discdebug(2, "Trisector : Rin = %g, Rout = %g Rsun, Tvisc0 = %g : M=%30.20e (want %g) J=%30.20e (want %g) F = %30.20e (want %g)\n", disc->Rin/R_SUN, disc->Rout/R_SUN, -- GitLab