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

Modified wdmerger_util to print star composition for user in output file #2767

Merged
merged 5 commits into from
Mar 19, 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
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
18 changes: 14 additions & 4 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])
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 @@ -98,6 +98,8 @@ void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec]

core_comp[iHe4] = 1.0_rt;

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 @@ -117,6 +119,10 @@ void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec]

envelope_mass = problem::hybrid_wd_he_shell_mass;

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) {
amrex::Error("Must have He4 in the nuclear network.");
Expand All @@ -128,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 @@ -144,6 +149,9 @@ void set_wd_composition (Real mass, Real& envelope_mass, Real core_comp[NumSpec]

envelope_mass = problem::co_wd_he_shell_mass;

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) {
amrex::Error("Must have He4 in the nuclear network.");
Expand Down Expand Up @@ -173,6 +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;

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 @@ -502,7 +512,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);
set_wd_composition(problem::mass_P, problem::envelope_mass_P, problem::core_comp_P, problem::envelope_comp_P, "primary");



Expand All @@ -516,7 +526,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);
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