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

Remove hardcoded charge balance in primordial chemistry #1646

Merged
merged 3 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions networks/primordial_chem/actual_network.H
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <fundamental_constants.H>
#include <network_properties.H>
#include <burn_type.H>

using namespace amrex;

Expand All @@ -26,4 +27,6 @@ namespace Rates

}

void balance_charge(burn_t& state);

#endif
9 changes: 9 additions & 0 deletions networks/primordial_chem/actual_network_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,12 @@ void actual_network_init()
{

}

void balance_charge(burn_t& state)
{

// update the number density of electrons due to charge conservation
state.xn[0] = -state.xn[3] - state.xn[7] + state.xn[1] + state.xn[12] +
state.xn[6] + state.xn[4] + state.xn[9] + 2.0 * state.xn[11];

}
4 changes: 2 additions & 2 deletions unit_test/burn_cell_primordial_chem/burn_cell.H
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <eos.H>
#include <extern_parameters.H>
#include <network.H>
#include <actual_network.H>

amrex::Real grav_constant = 6.674e-8;

Expand Down Expand Up @@ -209,8 +210,7 @@ auto burn_cell_c() -> int {
}

// update the number density of electrons due to charge conservation
state.xn[0] = -state.xn[3] - state.xn[7] + state.xn[1] + state.xn[12] +
state.xn[6] + state.xn[4] + state.xn[9] + 2.0 * state.xn[11];
balance_charge(state);

// reconserve mass fractions post charge conservation
insum = 0;
Expand Down
Loading