Skip to content
Open
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 unit_test/burn_cell_sdc/_parameters
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ nsteps int 100
# do we recompute the aux quantities? or do we take them as given in the inputs?
recompute_aux bool 0

# are mass fractions (and aux) density weighted? e.g. rho X
mass_fraction_rho_weighted bool 0

density real 1.e7
temperature real 3.e9
rhoe real -1.e0
Expand Down
27 changes: 20 additions & 7 deletions unit_test/burn_cell_sdc/burn_cell.H
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ void burn_cell_c()

massfractions[n-1] = get_xn(n, unit_test_rp::uniform_xn);

if (massfractions[n-1] < 0 || massfractions[n-1] > 1) {
amrex::Error("mass fraction for " + short_spec_names_cxx[n-1] + " not initialized in the interval [0,1]!");
if (! unit_test_rp::mass_fraction_rho_weighted) {
if (massfractions[n-1] < 0 || massfractions[n-1] > 1) {
amrex::Error("mass fraction for " + short_spec_names_cxx[n-1] + " not initialized in the interval [0,1]!");
}
}

}


Expand Down Expand Up @@ -214,8 +215,14 @@ void burn_cell_c()
eos_state.rho = unit_test_rp::density;
eos_state.T = unit_test_rp::temperature;

for (int n = 0; n < NumSpec; n++) {
eos_state.xn[n] = massfractions[n];
if (unit_test_rp::mass_fraction_rho_weighted) {
for (int n = 0; n < NumSpec; n++) {
eos_state.xn[n] = massfractions[n] / unit_test_rp::density;
}
} else {
for (int n = 0; n < NumSpec; n++) {
eos_state.xn[n] = massfractions[n];
}
}
#ifdef AUX_THERMO
if (unit_test_rp::recompute_aux) {
Expand All @@ -235,8 +242,14 @@ void burn_cell_c()
burn_state.rho = eos_state.rho;
burn_state.T = eos_state.T;

for (int n = 0; n < NumSpec; n++) {
burn_state.y[SFS+n] = burn_state.rho * eos_state.xn[n];
if (unit_test_rp::mass_fraction_rho_weighted) {
for (int n = 0; n < NumSpec; n++) {
burn_state.y[SFS+n] = massfractions[n];
}
} else {
for (int n = 0; n < NumSpec; n++) {
burn_state.y[SFS+n] = burn_state.rho * eos_state.xn[n];
}
}

#if NAUX_NET > 0
Expand Down
31 changes: 21 additions & 10 deletions unit_test/burn_cell_sdc/parse_integration_failure.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def doit(string):
A_X_k = None
A_aux_k = None

X_is_rho_weighted = False

for line in string:
if line.startswith("dens start"):
is_vode = True
Expand All @@ -82,10 +84,19 @@ def doit(string):
_tmp = line.split("=")[-1]
xn = [float(q) for q in _tmp.split()]

elif line.startswith("rho xn start"):
_tmp = line.split("=")[-1]
xn = [float(q) for q in _tmp.split()]
if_rho_weights = True

elif line.startswith("aux start"):
_tmp = line.split("=")[-1]
aux = [float(q) for q in _tmp.split()]

elif line.startswith("rho aux start"):
_tmp = line.split("=")[-1]
aux = [float(q) for q in _tmp.split()]

elif line.startswith("A(rho)"):
A_rho = float(line.split("=")[-1])

Expand Down Expand Up @@ -131,40 +142,40 @@ def doit(string):
_tmp = line.split("=")[-1]
A_aux_k = [float(q) for q in _tmp.split()]

print(f"unit_test.density = {density}")
print(f"unit_test.temperature = {temperature}")
print(f"unit_test.density = {density:30.20g}")
print(f"unit_test.temperature = {temperature:30.20g}")
if rhoe:
print(f"unit_test.rhoe = {rhoe}")
print(f"unit_test.rhoe = {rhoe:30.20g}")

if tmax:
print(f"unit_test.tmax = {tmax}")
print(f"unit_test.tmax = {tmax:30.20g}")

print("")

for n, X in enumerate(xn):
print(f"unit_test.X{n+1} = {X}")
print(f"unit_test.X{n+1} = {X:30.20g}")

print("")

if aux:
for n, a in enumerate(aux):
print(f"unit_test.Aux{n+1} = {a}")
print(f"unit_test.Aux{n+1} = {a:30.20g}")

print("")

print(f"unit_test.Adv_rho = {A_rho}")
print(f"unit_test.Adv_rhoe = {A_rhoe}")
print(f"unit_test.Adv_rho = {A_rho:30.20g}")
print(f"unit_test.Adv_rhoe = {A_rhoe:30.20g}")

print("")

for n, A in enumerate(A_X_k):
print(f"unit_test.Adv_X{n+1} = {A}")
print(f"unit_test.Adv_X{n+1} = {A:30.20g}")

if A_aux_k:
print("")

for n, A in enumerate(A_aux_k):
print(f"unit_test.Adv_Aux{n+1} = {A}")
print(f"unit_test.Adv_Aux{n+1} = {A:30.20g}")


if __name__ == "__main__":
Expand Down
Loading