Skip to content

Commit

Permalink
renamed physical constants in thor so not to clash with alf, which ca…
Browse files Browse the repository at this point in the history
…n remain independent if needed
  • Loading branch information
deitrr committed Feb 22, 2022
1 parent 93c9170 commit 7ae6654
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 38 deletions.
8 changes: 4 additions & 4 deletions src/ESP/esp_initial.cu
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ __host__ ESP::ESP(int * point_local_,

MetStar = MetStar_;
Tstar = Tstar_;
radius_star = radius_star_ * R_SUN;
planet_star_dist = planet_star_dist_ * AU;
radius_star = radius_star_ * R_SUN_th;
planet_star_dist = planet_star_dist_ * AU_th;

// Set the physics module execute state for the rest of the lifetime of ESP object
// only execute physics modules when no benchmarks are enabled
Expand Down Expand Up @@ -680,8 +680,8 @@ __host__ bool ESP::initial_values(const std::string &initial_conditions_filename

printf(" Tirr = %e K \n", Tirr);
printf(" Tint = %e K \n", Tint);
printf(" radius_star = %e R_SUN\n", (radius_star / R_SUN));
printf(" planet_star_dist = %e AU\n", (planet_star_dist / AU));
printf(" radius_star = %e R_SUN_th\n", (radius_star / R_SUN_th));
printf(" planet_star_dist = %e AU_th\n", (planet_star_dist / AU_th));
printf(" Tstar = %e K\n", Tstar);
printf(" scale_height = %e m\n", scale_height);
printf(" meanT = %e K\n", meanT);
Expand Down
41 changes: 17 additions & 24 deletions src/headers/physical_constants.h
Original file line number Diff line number Diff line change
@@ -1,29 +1,22 @@
// Constants borrowed from Astropy
// physical constants
const double PI = 3.141592653589793;
const double HCONST = 6.62607015e-34; // J s
const double CSPEED = 299792458.0; // m / s
const double KBOLTZMANN = 1.38064852e-23; // J / K
const double STEFANBOLTZMANN = 5.6703744191844314e-08; // W / (K^4 m^2)


// constants in MKS
const double C = 299792458.0; // speed of light in m / s
const double K_B = 1.38064852e-23; // Boltzmann constant in J / K
const double H = 6.62607015e-34; // Planck constant in J s
const double R_UNIV = 8.31446261815324; // universal gas constant in J / ( K mol )
const double SIGMA_SB = 5.6703744191844314e-08; // Stefan-Boltzmann constant in W / (K^4 m^2)
const double AU = 149597870700.0; // astronomical unit in m
const double AMU = 1.6605390666e-27; // atomic mass unit in kg
const double C_th = 299792458.0; // speed of light in m / s
const double K_B_th = 1.38064852e-23; // Boltzmann constant in J / K
const double H_th = 6.62607015e-34; // Planck constant in J s
const double R_UNIV_th = 8.31446261815324; // universal gas constant in J / ( K mol )
const double SIGMA_SB_th = 5.6703744191844314e-08; // Stefan-Boltzmann constant in W / (K^4 m^2)
const double AU_th = 149597870700.0; // astronomical unit in m
const double AMU_th = 1.6605390666e-27; // atomic mass unit in kg

const double Mass_E = 9.1093837015e-31; // mass of electron in kg
const double Mass_E_th = 9.1093837015e-31; // mass of electron in kg

const double Q_E = 1.602176634e-19; // charge of electron in Coulomb
const double R_SUN = 695700000.0; // solar radius in m
const double M_SUN = 1.988409870698051e+30; // solar mass in kg
const double R_JUP = 71492000.0; // radius Jupiter in m
const double M_JUP = 1.8981245973360505e+27; // mass Jupiter in kg
const double R_EARTH = 6378100.0; // radius Earth in m
const double M_EARTH = 5.972167867791379e+24; // mass Earth in kg
const double G = 6.6743e-11; // gravitational constant m^3 / ( kg s^2)
const double GAMMA = 0.5772156649; // Euler-Mascheroni constant
const double Q_E_th = 1.602176634e-19; // charge of electron in Coulomb
const double R_SUN_th = 695700000.0; // solar radius in m
const double M_SUN_th = 1.988409870698051e+30; // solar mass in kg
const double R_JUP_th = 71492000.0; // radius Jupiter in m
const double M_JUP_th = 1.8981245973360505e+27; // mass Jupiter in kg
const double R_EARTH_th = 6378100.0; // radius Earth in m
const double M_EARTH_th = 5.972167867791379e+24; // mass Earth in kg
const double G_th = 6.6743e-11; // gravitational constant m^3 / ( kg s^2)
const double GAMMA_th = 0.5772156649; // Euler-Mascheroni constant
24 changes: 14 additions & 10 deletions src/physics/modules/src/radiative_transfer.cu
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ void radiative_transfer::print_config() {
// basic star-planet properties
log::printf(" rt_type = %s \n", rt_type_str.c_str());
log::printf(" Tstar = %f K.\n", Tstar);
log::printf(" Orbital distance = %f au.\n", planet_star_dist / AU);
log::printf(" Radius of host star = %f R_sun.\n", radius_star / R_SUN);
log::printf(" Orbital distance = %f au.\n", planet_star_dist / AU_th);
log::printf(" Radius of host star = %f R_sun.\n", radius_star / R_SUN_th);
log::printf(" 1.0/Diffusivity factor = %f.\n", diff_ang_config);
// log::printf(" Internal flux temperature = %f K.\n", Tint_config);
log::printf(" Bond albedo = %f.\n", albedo_config);
Expand Down Expand Up @@ -828,7 +828,7 @@ bool radiative_transfer::phy_loop(ESP & esp,

Tirr = Tstar * pow((radius_star) / (planet_star_dist), 0.5);

F0_h = SIGMA_SB * pow(Tirr, 4.0);
F0_h = SIGMA_SB_th * pow(Tirr, 4.0);

for (int c = 0; c < esp.point_num; c++) {
// Parmentier opacity profile parameters - first get Bond albedo
Expand Down Expand Up @@ -1346,9 +1346,11 @@ bool radiative_transfer::store_init(storage &s) {
if (rt_type == PICKETFENCE) {
s.append_value(Tstar, "/Tstar", "K", "Temperature of host star");
// s.append_value(Tint, "/Tint", "K", "Temperature of interior heat flux");
s.append_value(
planet_star_dist / AU, "/planet_star_dist", "au", "distance b/w host star and planet");
s.append_value(radius_star / R_SUN, "/radius_star", "R_sun", "radius of host star");
s.append_value(planet_star_dist / AU_th,
"/planet_star_dist",
"au",
"distance b/w host star and planet");
s.append_value(radius_star / R_SUN_th, "/radius_star", "R_sun", "radius of host star");

s.append_value(albedo, "/albedo", "-", "bond albedo of planet");
// s.append_value(kappa_sw, "/kappa_sw", "-", "gray opacity of shortwave");
Expand All @@ -1364,9 +1366,11 @@ bool radiative_transfer::store_init(storage &s) {
else {
s.append_value(Tstar, "/Tstar", "K", "Temperature of host star");
// s.append_value(Tint, "/Tint", "K", "Temperature of interior heat flux");
s.append_value(
planet_star_dist / AU, "/planet_star_dist", "au", "distance b/w host star and planet");
s.append_value(radius_star / R_SUN, "/radius_star", "R_sun", "radius of host star");
s.append_value(planet_star_dist / AU_th,
"/planet_star_dist",
"au",
"distance b/w host star and planet");
s.append_value(radius_star / R_SUN_th, "/radius_star", "R_sun", "radius of host star");
s.append_value(diff_ang, "/diff_ang", "-", "diffusivity factor");
s.append_value(albedo, "/albedo", "-", "bond albedo of planet");
// s.append_value(kappa_sw, "/kappa_sw", "-", "gray opacity of shortwave");
Expand Down Expand Up @@ -1424,7 +1428,7 @@ void radiative_transfer::RTSetup(double Tstar_,
// f_lw = f_lw_;

double resc_flx = pow(radius_star / planet_star_dist, 2.0);
incflx = resc_flx * SIGMA_SB * Tstar * Tstar * Tstar * Tstar;
incflx = resc_flx * SIGMA_SB_th * Tstar * Tstar * Tstar * Tstar;

rt1Dmode = rt1Dmode_;

Expand Down

0 comments on commit 7ae6654

Please sign in to comment.