Skip to content

Commit

Permalink
add upper ambient BCs
Browse files Browse the repository at this point in the history
  • Loading branch information
zingale committed Jan 8, 2025
1 parent 5f07d80 commit 4544e61
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Exec/hydro_tests/simple_convection/inputs_2d
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ amr.n_cell = 128 384
castro.lo_bc = 2 3
castro.hi_bc = 2 2

castro.fill_ambient_bc = 1
castro.ambient_fill_dir = 1
castro.ambient_outflow_vel = 1


# WHICH PHYSICS
castro.do_hydro = 1
Expand All @@ -25,6 +29,9 @@ castro.add_ext_src = 1
castro.do_grav = 1
castro.do_sponge = 0

castro.ppm_type = 1
castro.grav_source_type = 2
castro.use_pslope = 1
castro.use_pslope = 1

gravity.gravity_type = ConstantGrav
Expand Down
27 changes: 27 additions & 0 deletions Exec/hydro_tests/simple_convection/problem_initialize.H
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <model_parser.H>
#include <initial_model.H>
#include <global.H>
#include <ambient.H>

AMREX_INLINE
void problem_initialize ()
Expand Down Expand Up @@ -49,6 +50,32 @@ void problem_initialize ()
model_params);


// set the ambient state for the upper BC
ambient::ambient_state[URHO] = model::profile(0).state(model::npts-1, model::idens);
ambient::ambient_state[UTEMP] = model::profile(0).state(model::npts-1, model::itemp);
for (int n = 0; n < NumSpec; n++) {
ambient::ambient_state[UFS+n] =
ambient::ambient_state[URHO] * model::profile(0).state(model::npts-1, model::ispec+n);
}

ambient::ambient_state[UMX] = 0.0_rt;
ambient::ambient_state[UMY] = 0.0_rt;
ambient::ambient_state[UMZ] = 0.0_rt;

// make the ambient state thermodynamically consistent

eos_t eos_state;
eos_state.rho = ambient::ambient_state[URHO];
eos_state.T = ambient::ambient_state[UTEMP];
for (int n = 0; n < NumSpec; n++) {
eos_state.xn[n] = ambient::ambient_state[UFS+n] / eos_state.rho;
}

eos(eos_input_rt, eos_state);

ambient::ambient_state[UEINT] = eos_state.rho * eos_state.e;
ambient::ambient_state[UEDEN] = eos_state.rho * eos_state.e;

}

#endif

0 comments on commit 4544e61

Please sign in to comment.