Skip to content

Commit

Permalink
Final comp changes
Browse files Browse the repository at this point in the history
  • Loading branch information
khanakbhargava committed Mar 8, 2024
1 parent 9feddc7 commit 3e30720
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 30 deletions.
2 changes: 1 addition & 1 deletion Exec/science/wdmerger/wdmerger_util.H
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void kepler_third_law (Real radius_1, Real mass_1, Real radius_2, Real mass_2,
Real& period, Real eccentricity, Real phi, Real& a,
Real& r_1, Real& r_2, Real& v_1r, Real& v_2r, Real& v_1p, Real& v_2p);

void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec], Real envelope_comp[NumSpec]);
void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec], Real envelope_comp[NumSpec], const std::string& star_type);

void ensure_primary_mass_larger ();

Expand Down
42 changes: 13 additions & 29 deletions Exec/science/wdmerger/wdmerger_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void kepler_third_law (Real radius_1, Real mass_1, Real radius_2, Real mass_2,

// Given a WD mass, set its core and envelope composition.

void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec], Real envelope_comp[NumSpec],int count)
void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec], Real envelope_comp[NumSpec], const std::string& star_type)
{
int iHe4 = network_spec_index("helium-4");
int iC12 = network_spec_index("carbon-12");
Expand All @@ -97,11 +97,8 @@ void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec]
}

core_comp[iHe4] = 1.0_rt;
if (count == 1){
amrex::Print()<<"Created a pure He primary."<<std::endl;
}else{
amrex::Print()<<"Creating a pure He secondary."<<std::endl;
}

amrex::Print() << "Created a pure He " << star_type << "." << std::endl;

for (int n = 0; n < NumSpec; ++n) {
envelope_comp[n] = core_comp[n];
Expand All @@ -122,13 +119,9 @@ void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec]

envelope_mass = problem::hybrid_wd_he_shell_mass;

if (count == 1){
amrex::Print()<<"Creating primary with CO core with mass fractions C = "<<problem::hybrid_wd_c_frac<<"and O = "
<<problem::hybrid_wd_o_frac<<" and a He shell of solar mass ="<<problem::hybrid_wd_he_shell_mass<<std::endl;
}else{
amrex::Print()<<"Creating secondary with CO core with mass fractions C = "<<problem::hybrid_wd_c_frac<<"and O = "
<<problem::hybrid_wd_o_frac<<" and a He shell of solar mass ="<<problem::hybrid_wd_he_shell_mass<<std::endl;
}
amrex::Print()<< "Creating " << star_type << "with CO core with mass fractions C = "<< problem::hybrid_wd_c_frac << "and O = "
<< problem::hybrid_wd_o_frac <<" and a He shell of solar mass =" << problem::hybrid_wd_he_shell_mass << "." << std::endl;


if (envelope_mass > 0.0_rt) {
if (iHe4 < 0) {
Expand All @@ -141,7 +134,6 @@ void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec]
envelope_comp[n] = core_comp[n];
}
}

}
else if (mass >= problem::max_hybrid_wd_mass && mass < problem::max_co_wd_mass) {

Expand All @@ -156,14 +148,9 @@ void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec]
core_comp[iO16] = problem::co_wd_o_frac;

envelope_mass = problem::co_wd_he_shell_mass;

if (count == 1){
amrex::Print()<<"Creating primary with CO core with mass fractions C = "<<problem::co_wd_c_frac<<"and O = "
<<problem::co_wd_o_frac<<" and a He shell of solar mass ="<<problem::co_wd_he_shell_mass<<std::endl;
}else{
amrex::Print()<<"Creating secondary with CO core with mass fractions C = "<<problem::co_wd_c_frac<<"and O = "
<<problem::co_wd_o_frac<<" and a He shell of solar mass ="<<problem::co_wd_he_shell_mass<<std::endl;
}

amrex::Print()<<"Creating " << star_type << " with CO core with mass fractions C = "<<problem::co_wd_c_frac<<"and O = "
<<problem::co_wd_o_frac<<" and a He shell of solar mass ="<<problem::co_wd_he_shell_mass<< "." << std::endl;

if (envelope_mass > 0.0_rt) {
if (iHe4 < 0) {
Expand Down Expand Up @@ -194,11 +181,8 @@ void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec]
core_comp[iNe20] = problem::onemg_wd_ne_frac;
core_comp[iMg24] = problem::onemg_wd_mg_frac;

if (count == 1){
amrex::Print()<<"Creating an ONeMg primary."<<std::endl;
}else{
amrex::Print()<<"Creating an ONeMg secondary."<<std::endl;
}

amrex::Print()<<"Creating an ONeMg " << star_type << "." <<std::endl;

for (int n = 0; n < NumSpec; ++n) {
envelope_comp[n] = core_comp[n];
Expand Down Expand Up @@ -529,7 +513,7 @@ void binary_setup ()
amrex::Error("Must specify either a positive primary mass or a positive primary central density.");
}

set_wd_composition(problem::mass_P, problem::envelope_mass_P, problem::core_comp_P, problem::envelope_comp_P, 1);
set_wd_composition(problem::mass_P, problem::envelope_mass_P, problem::core_comp_P, problem::envelope_comp_P, "primary");



Expand All @@ -543,7 +527,7 @@ void binary_setup ()
amrex::Error("If we are doing a binary calculation, we must specify either a positive secondary mass or a positive secondary central density");
}

set_wd_composition(problem::mass_S, problem::envelope_mass_S, problem::core_comp_S, problem::envelope_comp_S, 2);
set_wd_composition(problem::mass_S, problem::envelope_mass_S, problem::core_comp_S, problem::envelope_comp_S, "secondary");

for (int n = 0; n < NumSpec; ++n) {
ambient::ambient_state[UFS+n] = ambient::ambient_state[URHO] * (problem::envelope_comp_P[n] + problem::envelope_comp_S[n]) / 2;
Expand Down

0 comments on commit 3e30720

Please sign in to comment.