Skip to content

Commit

Permalink
interpolate pressure
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed May 9, 2024
1 parent 12e203a commit 6b2c287
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Exec/science/xrb_layered/inputs_2d
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ problem.model_name = "toy_atm_hot_3cm.hse"

problem.apply_perturbation = 1

problem.H_min = 1.e-5
problem.He_min = 1.e-5

problem.model_shift = 750.0

# MICROPHYSICS
Expand Down
12 changes: 9 additions & 3 deletions Exec/science/xrb_layered/problem_initialize_state_data.H
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,34 @@ void problem_initialize_state_data (int i, int j, int k,
height += problem::model_shift;

state(i,j,k,URHO) = interpolate(height, model::idens);
state(i,j,k,UTEMP) = interpolate(height, model::itemp);
state(i,j,k,UTEMP) = interpolate(height, model::itemp); // this will be an initial guess
Real p_zone = interpolate(height, model::ipres);

// interpolate species as mass fractions and make sure they sum to
// 1. Later we will convert to densities.

Real sumX{0.0};
for (int n = 0; n < NumSpec; ++n) {
state(i,j,k,UFS+n) = interpolate(height, model::ispec+n);
sumX += state(i,j,k,UFS+n);
}

// make sure the species sum to 1
for (int n = 0; n < NumSpec; ++n) {
state(i,j,k,UFS+n) /= sumX;
}

eos_t eos_state;
eos_state.rho = state(i,j,k,URHO);
eos_state.T = state(i,j,k,UTEMP);
eos_state.p = p_zone;

for (int n = 0; n < NumSpec; n++) {
eos_state.xn[n] = state(i,j,k,UFS+n);
}

eos(eos_input_rt, eos_state);
eos(eos_input_rp, eos_state);

state(i,j,k,UTEMP) = eos_state.T;
state(i,j,k,UEINT) = state(i,j,k,URHO) * eos_state.e;
state(i,j,k,UEDEN) = state(i,j,k,UEINT);

Expand Down

0 comments on commit 6b2c287

Please sign in to comment.