Skip to content

Commit

Permalink
Removed potential div-by-zero calculations in atmesc.c
Browse files Browse the repository at this point in the history
  • Loading branch information
RoryBarnes committed Apr 23, 2024
1 parent 5fb6590 commit 4423e7a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/atmesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1846,10 +1846,11 @@ void fnPropsAuxAtmEsc(BODY *body, EVOLVE *evolve, IO *io, UPDATE *update,
(KBOLTZ * body[iBody].dFlowTemp * body[iBody].dFHRef) /
(BDIFF * g);
FH = body[iBody].dFHRef;
/* Is this necessary? XXX
rat = ((body[iBody].dCrossoverMass / ATOMMASS) - QOH) /
((body[iBody].dCrossoverMass / ATOMMASS) - 1.);
body[iBody].dOxygenEta = 0;

*/
} else {

// mcross >= mo
Expand All @@ -1859,10 +1860,14 @@ void fnPropsAuxAtmEsc(BODY *body, EVOLVE *evolve, IO *io, UPDATE *update,
ATOMMASS * num / den +
(KBOLTZ * body[iBody].dFlowTemp * body[iBody].dFHRef) /
((1 + XO * (QOH - 1)) * BDIFF * g);
rat = (body[iBody].dCrossoverMass / ATOMMASS - QOH) /
if (body[iBody].dCrossoverMass != ATOMMASS) {
rat = (body[iBody].dCrossoverMass / ATOMMASS - QOH) /
(body[iBody].dCrossoverMass / ATOMMASS - 1.);
FH = body[iBody].dFHRef * pow(1. + (XO / (1. - XO)) * QOH * rat, -1);
body[iBody].dOxygenEta = 2 * XO / (1. - XO) * rat;
FH = body[iBody].dFHRef * pow(1. + (XO / (1. - XO)) * QOH * rat, -1);
body[iBody].dOxygenEta = 2 * XO / (1. - XO) * rat;
} else {
body[iBody].dOxygenEta = 0;
}
}
} else if (body[iBody].iWaterLossModel == ATMESC_LS2016) {

Expand Down

0 comments on commit 4423e7a

Please sign in to comment.