From ea617530ad32c5c7d2ff4f5c4c1b97e45b31e4e2 Mon Sep 17 00:00:00 2001 From: RoryBarnes Date: Mon, 15 Apr 2024 15:55:11 -0700 Subject: [PATCH 1/2] Changed Lehmer & Catling 2017 model to require at least two bodies. --- src/atmesc.c | 77 +++++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 34 deletions(-) diff --git a/src/atmesc.c b/src/atmesc.c index b62abdce4..6933a4d27 100644 --- a/src/atmesc.c +++ b/src/atmesc.c @@ -2108,43 +2108,52 @@ void VerifyAtmEsc(BODY *body, CONTROL *control, FILES *files, OPTIONS *options, } if (body[iBody].iPlanetRadiusModel == ATMESC_LEHMER17) { - if (body[iBody].dEnvelopeMass >= 0.5 * body[iBody].dMass) { - fprintf(stderr, - "ERROR: %s's Envelope mass is greater than 50%% of its total " - "mass, which ", + if (body[0].bStellar) { + if (body[iBody].dEnvelopeMass >= 0.5 * body[iBody].dMass) { + fprintf(stderr, + "ERROR: %s's Envelope mass is greater than 50%% of its total " + "mass, which ", + body[iBody].cName); + fprintf(stderr, + "is not allowed for the Lehmer-Catling (2017) envelope " + "model.\n"); + DoubleLineExit(files->Infile[iBody + 1].cIn, + files->Infile[iBody + 1].cIn, + options[OPT_ENVELOPEMASS].iLine[iBody + 1], + options[OPT_ENVELOPEMASS].iLine[iBody + 1]); + } + if (body[iBody].dEnvelopeMass >= 0.1 * body[iBody].dMass) { + fprintf( + stderr, + "WARNING: Envelope masses more than 10%% of the total mass are " + "not " + "recommended for the Lehmer-Catling (2017) envelope model. %s's " + "envelope ", body[iBody].cName); - fprintf( - stderr, - "is not allowed for the Lehmer-Catling (2017) envelope model.\n"); - DoubleLineExit(files->Infile[iBody + 1].cIn, files->Infile[iBody + 1].cIn, - options[OPT_ENVELOPEMASS].iLine[iBody + 1], - options[OPT_ENVELOPEMASS].iLine[iBody + 1]); - } - if (body[iBody].dEnvelopeMass >= 0.1 * body[iBody].dMass) { - fprintf( - stderr, - "WARNING: Envelope masses more than 10%% of the total mass are not " - "recommended for the Lehmer-Catling (2017) envelope model. %s's " - "envelope ", - body[iBody].cName); - fprintf(stderr, "mass exceeds this threshold.\n"); - } + fprintf(stderr, "mass exceeds this threshold.\n"); + } - // Get thermal temperature - if (body[iBody].bAutoThermTemp) { - body[iBody].dThermTemp = fdThermalTemp(body, iBody); + // Get thermal temperature + if (body[iBody].bAutoThermTemp) { + body[iBody].dThermTemp = fdThermalTemp(body, iBody); + } + body[iBody].dRadSolid = fdMassToRad_LehmerCatling17( + body[iBody].dMass - body[iBody].dEnvelopeMass); + body[iBody].dGravAccel = BIGG * + (body[iBody].dMass - body[iBody].dEnvelopeMass) / + (body[iBody].dRadSolid * body[iBody].dRadSolid); + body[iBody].dScaleHeight = body[iBody].dAtmGasConst * + body[iBody].dThermTemp / + body[iBody].dGravAccel; + body[iBody].dPresSurf = + fdLehmerPres(body[iBody].dEnvelopeMass, body[iBody].dGravAccel, + body[iBody].dRadSolid); + body[iBody].dRadXUV = fdLehmerRadius(body, iBody); + } else { + fprintf(stderr, + "ERROR: The Lehmer & Catling (2017) model requires a star.\n"); + exit(EXIT_INPUT); } - body[iBody].dRadSolid = fdMassToRad_LehmerCatling17( - body[iBody].dMass - body[iBody].dEnvelopeMass); - body[iBody].dGravAccel = BIGG * - (body[iBody].dMass - body[iBody].dEnvelopeMass) / - (body[iBody].dRadSolid * body[iBody].dRadSolid); - body[iBody].dScaleHeight = body[iBody].dAtmGasConst * - body[iBody].dThermTemp / body[iBody].dGravAccel; - body[iBody].dPresSurf = - fdLehmerPres(body[iBody].dEnvelopeMass, body[iBody].dGravAccel, - body[iBody].dRadSolid); - body[iBody].dRadXUV = fdLehmerRadius(body, iBody); } else { int iCol, bError = 0; for (iCol = 0; iCol < files->Outfile[iBody].iNumCols; iCol++) { From 9526f31cd3364cab366b005b63b75763d7c0edb8 Mon Sep 17 00:00:00 2001 From: RoryBarnes Date: Mon, 15 Apr 2024 16:15:08 -0700 Subject: [PATCH 2/2] Added stdout from failed floating point checks. --- tests/floatingpoint.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/floatingpoint.py b/tests/floatingpoint.py index b5720915f..6aa38bf73 100644 --- a/tests/floatingpoint.py +++ b/tests/floatingpoint.py @@ -39,6 +39,11 @@ def Main(): if last_line != "Simulation completed.\n": tot_fail += 1 print("Fail", flush=True) + print("\n------------\n") + with open(outfile, "r") as f: + print(f.read()) + print("\n------------\n") + else: print("Pass", flush=True) os.chdir("../../")