Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download artifact #314

Merged
merged 5 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import os
import sys
from distutils.command.clean import clean

# if sys.version_info >= (3, 12):
# # For Python 3.12 and above, use setuptools
# from setuptools.command.clean import clean
# else:
# # For Python versions below 3.12, use distutils
# from distutils.command.clean import clean

from glob import glob

from setuptools import Extension, find_packages, setup
Expand Down Expand Up @@ -35,10 +42,10 @@ class Develop(develop):
"""Custom develop command that clears build cache before install."""

def run(self):
c = clean(self.distribution)
c.all = True
c.finalize_options()
c.run()
# c = clean(self.distribution)
# c.all = True
# c.finalize_options()
# c.run()
develop.run(self)


Expand Down
23 changes: 8 additions & 15 deletions src/atmesc.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,6 @@ Initialize the user options for the atmospheric escape model.
@param fnRead Array of pointers to the functions that read in the options
*/
void InitializeOptionsAtmEsc(OPTIONS *options, fnReadOption fnRead[]) {
int iOpt, iFile;

fvFormattedString(&options[OPT_XFRAC].cName, "dXFrac");
fvFormattedString(&options[OPT_XFRAC].cDescr, "Fraction of planet radius in X-ray/UV");
Expand Down Expand Up @@ -1791,15 +1790,15 @@ void fnPropsAuxAtmEsc(BODY *body, EVOLVE *evolve, IO *io, UPDATE *update,

// Diffusion-limited H escape rate
double BDIFF = 4.8e19 * pow(body[iBody].dFlowTemp, 0.75);
if (XO == 1) {
if (fbFloatComparison(XO,1)) {
body[iBody].dFHDiffLim = 0;
} else {
body[iBody].dFHDiffLim =
BDIFF * g * ATOMMASS * (QOH - 1.) /
(KBOLTZ * body[iBody].dFlowTemp * (1. + XO / (1. - XO)));
}

if (body[iBody].dOxygenMass == 0) {
if (fbFloatComparison(body[iBody].dOxygenMass,0)) {
body[iBody].dOxygenEta = 0;
}

Expand Down Expand Up @@ -1841,7 +1840,6 @@ void fnPropsAuxAtmEsc(BODY *body, EVOLVE *evolve, IO *io, UPDATE *update,

double x = (QOH - 1.) * (1. - XO) * (BDIFF * g * ATOMMASS) /
(KBOLTZ * body[iBody].dFlowTemp);
double FH;
double rat;

// Get the crossover mass
Expand All @@ -1853,7 +1851,6 @@ void fnPropsAuxAtmEsc(BODY *body, EVOLVE *evolve, IO *io, UPDATE *update,
(1. / (1. - XO)) *
(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.);
Expand All @@ -1868,10 +1865,9 @@ 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);
if (body[iBody].dCrossoverMass != ATOMMASS) {
if (!fbFloatComparison(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;
} else {
body[iBody].dOxygenEta = 0;
Expand All @@ -1882,7 +1878,6 @@ void fnPropsAuxAtmEsc(BODY *body, EVOLVE *evolve, IO *io, UPDATE *update,
// Use below for LBEXACT equations with schaeffer diff lim
double x = (QOH - 1.) * (1. - XO) * (BDIFF * g * ATOMMASS) /
(KBOLTZ * body[iBody].dFlowTemp);
double FH;
double rat;

// Get the crossover mass
Expand Down Expand Up @@ -1917,10 +1912,8 @@ void fnPropsAuxAtmEsc(BODY *body, EVOLVE *evolve, IO *io, UPDATE *update,
(body[iBody].dFXUV >= FXUVCritDrag)) {
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;
} else {
FH = body[iBody].dFHRef;
rat = ((body[iBody].dCrossoverMass / ATOMMASS) - QOH) /
((body[iBody].dCrossoverMass / ATOMMASS) - 1.);
body[iBody].dOxygenEta = 0;
Expand Down Expand Up @@ -2839,7 +2832,7 @@ void WriteRGLimit(BODY *body, CONTROL *control, OUTPUT *output, SYSTEM *system,
double flux = fdHZRG14(body, iBody);

// Convert to semi-major axis *at current eccentricity!*
if (body[0].dLuminosity == 0) {
if (fbFloatComparison(body[0].dLuminosity,0)) {
*dTmp = -1;
} else {
*dTmp = pow(4 * PI * flux /
Expand Down Expand Up @@ -3445,12 +3438,12 @@ void WriteHRefODragMod(BODY *body, CONTROL *control, OUTPUT *output,
SYSTEM *system, UNITS *units, UPDATE *update, int iBody,
double *dTmp, char **cUnit) {
// XXX This should probably all just be moved into a function
if (body[iBody].dCrossoverMass / ATOMMASS - 1. != 0) {
if (!fbFloatComparison((body[iBody].dCrossoverMass / ATOMMASS), 1)) {
double rat = (body[iBody].dCrossoverMass / ATOMMASS - QOH) /
(body[iBody].dCrossoverMass / ATOMMASS - 1.);
double XO = fdAtomicOxygenMixingRatio(body[iBody].dSurfaceWaterMass,
body[iBody].dOxygenMass);
if (XO == 1) {
if (fbFloatComparison(XO,1)) {
*dTmp = 0;
} else {
*dTmp = pow(1. + (XO / (1. - XO)) * QOH * rat, -1);
Expand Down Expand Up @@ -4162,7 +4155,7 @@ int fbDoesWaterEscape(BODY *body, EVOLVE *evolve, IO *io, int iBody) {
// approximation for a binary is only valid if the two stars have
// similar spectral types, or if body zero dominates the flux.
double dInstellation = fdInstellation(body, iBody);
if (dInstellation == -1 && body[iBody].bCalcFXUV == 0) {
if (fbFloatComparison(dInstellation,-1) && fbFloatComparison(body[iBody].bCalcFXUV,0)) {
// Constant XUV flux, so set water to escape
return 1;
} else {
Expand Down Expand Up @@ -4368,8 +4361,8 @@ void fvLinearFit(double *x, double *y, int iLen, double *daCoeffs) {
// from http://en.wikipedia.org/wiki/Simple_linear_regression
double num = 0, den = 0;
double xavg = 0, yavg = 0;
double m, b;
int i;

for (i = 0; i < iLen; i++) {
xavg += x[i];
yavg += y[i];
Expand Down
2 changes: 0 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import shutil
import subprocess as subp
import sys

import numpy as np
import pytest

import vplanet
Expand Down
Loading