Skip to content

Commit f62cc4d

Browse files
authored
Merge branch 'development' into entropy
2 parents fe6f093 + 7d144e3 commit f62cc4d

File tree

2 files changed

+10
-16
lines changed

2 files changed

+10
-16
lines changed

EOS/eos_composition.H

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,22 @@ void composition (T& state)
5858

5959
#ifdef AUX_THERMO
6060

61-
state.mu_e = 1.0 / state.aux[iye];
61+
state.mu_e = 1.0_rt / state.aux[iye];
6262
state.y_e = state.aux[iye];
6363
state.abar = state.aux[iabar];
6464
state.zbar = state.abar * state.y_e;
6565

6666
#else
6767

68-
amrex::Real sum = 0;
68+
state.y_e = 0.0_rt;
69+
state.abar = 0.0_rt;
6970
for (int n = 0; n < NumSpec; n++) {
70-
sum += state.xn[n] * zion[n] * aion_inv[n];
71+
state.y_e += state.xn[n] * zion[n] * aion_inv[n];
72+
state.abar += state.xn[n] * aion_inv[n];
7173
}
74+
state.abar = 1.0_rt / state.abar;
7275

73-
state.mu_e = 1.0 / sum;
74-
state.y_e = sum;
75-
76-
sum = 0;
77-
78-
for (int n = 0; n < NumSpec; n++) {
79-
sum += state.xn[n] * aion_inv[n];
80-
}
81-
82-
state.abar = 1.0 / sum;
76+
state.mu_e = 1.0_rt / state.y_e;
8377
state.zbar = state.abar * state.y_e;
8478
#endif
8579
}

EOS/helmholtz/actual_eos.H

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,6 @@ void apply_electrons (T& state)
157157
// assume complete ionization
158158
[[maybe_unused]] amrex::Real ytot1 = 1.0e0_rt / state.abar;
159159

160-
// define mu -- the total mean molecular weight including both electrons and ions
161-
state.mu = 1.0e0_rt / (1.0e0_rt / state.abar + 1.0e0_rt / state.mu_e);
162-
163160
// enter the table with ye*den
164161
amrex::Real din = state.y_e * state.rho;
165162

@@ -1140,6 +1137,9 @@ void finalize_state (I input, T& state,
11401137
{
11411138
using namespace helmholtz;
11421139

1140+
// define mu -- the total mean molecular weight including both electrons and ions
1141+
state.mu = 1.0e0_rt / (1.0e0_rt / state.abar + 1.0e0_rt / state.mu_e);
1142+
11431143
// Calculate some remaining derivatives
11441144
if constexpr (has_pressure<T>::value) {
11451145
state.dpde = state.dpdT / state.dedT;

0 commit comments

Comments
 (0)