-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
this mirrors the convection problem in pyro
- Loading branch information
Showing
9 changed files
with
94,820 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
PRECISION = DOUBLE | ||
PROFILE = FALSE | ||
DEBUG = FALSE | ||
DIM = 2 | ||
|
||
COMP = gnu | ||
|
||
USE_MPI = TRUE | ||
USE_OMP = FALSE | ||
|
||
USE_GRAV = TRUE | ||
USE_REACT = FALSE | ||
|
||
USE_MODEL_PARSER = TRUE | ||
|
||
CASTRO_HOME ?= ../../.. | ||
|
||
# This sets the EOS directory in $(MICROPHYSICS_HOME)/EOS | ||
EOS_DIR := gamma_law | ||
|
||
# This sets the network directory in $(MICROPHYSICS_HOME)/networks | ||
NETWORK_DIR := general_null | ||
NETWORK_INPUTS = gammalaw.net | ||
|
||
PROBLEM_DIR ?= ./ | ||
|
||
Bpack := $(PROBLEM_DIR)/Make.package | ||
Blocs := $(PROBLEM_DIR) | ||
|
||
include $(CASTRO_HOME)/Exec/Make.Castro |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
CEXE_headers += initial_model.H | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
dens_base real 10.0 y | ||
|
||
scale_height real 4.0 y | ||
|
||
y_height real 2.0 y | ||
|
||
thickness real 0.25 y | ||
|
||
e_rate real 0.1 y | ||
|
||
low_density_cutoff real 0.01 y | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
#ifndef INITIAL_MODEL_H | ||
#define INITIAL_MODEL_H | ||
|
||
#include <prob_parameters.H> | ||
#include <network.H> | ||
#include <eos.H> | ||
|
||
struct model_t { | ||
amrex::Real dens_base = -1; | ||
amrex::Real scale_height = -1; | ||
Real xn[NumSpec] = {0.0}; | ||
}; | ||
|
||
|
||
|
||
/// | ||
/// construct an initial model in HSE. Note: this does not return | ||
/// anything, but rather updates the model_parser globals with the | ||
/// model information. | ||
/// | ||
AMREX_INLINE | ||
void | ||
generate_initial_model(const int npts_model, const Real xmin, const Real xmax, | ||
const model_t model_params) { | ||
|
||
model::npts = npts_model; | ||
model::initialized = true; | ||
|
||
if (npts_model > NPTS_MODEL) { | ||
amrex::Error("Error: model has more than NPTS_MODEL points, Increase MAX_NPTS_MODEL"); | ||
} | ||
|
||
// compute the pressure scale height (for an isothermal, ideal-gas | ||
// atmosphere) | ||
|
||
amrex::Real pres_base = model_params.scale_height * model_params.dens_base * std::abs(gravity::const_grav); | ||
|
||
// create the grid -- cell centers | ||
|
||
Real dx = (xmax - xmin) / npts_model; | ||
|
||
for (int i = 0; i < npts_model; i++) { | ||
model::profile(0).r(i) = xmin + (static_cast<Real>(i) + 0.5_rt) * dx; | ||
} | ||
|
||
for (int i = 0; i < npts_model; i++) { | ||
|
||
amrex::Real density; | ||
amrex::Real pressure; | ||
|
||
amrex::Real profile = 1.0 - (eos_rp::eos_gamma - 1.0) / eos_rp::eos_gamma * model::profile(0).r(i) / model_params.scale_height; | ||
|
||
if (profile > 0.0) { | ||
density = std::max(model_params.dens_base * std::pow(profile, 1.0/(eos_rp::eos_gamma - 1.0)), | ||
problem::low_density_cutoff); | ||
} else { | ||
density = problem::low_density_cutoff; | ||
} | ||
|
||
if (i == 0) { | ||
pressure = pres_base; | ||
} else if (density <= problem::low_density_cutoff + 1.e-30_rt) { | ||
pressure = model::profile(0).state(i-1, model::ipres); | ||
} else { | ||
pressure = pres_base * | ||
std::pow(density / model_params.dens_base, eos_rp::eos_gamma); | ||
} | ||
|
||
// initial guess | ||
|
||
amrex::Real temp = T_guess; | ||
|
||
eos_t eos_state; | ||
eos_state.p = pressure; | ||
eos_state.T = temp; | ||
eos_state.rho = density; | ||
for (int n = 0; n < NumSpec; n++) { | ||
eos_state.xn[n] = model_params.xn[n]; | ||
} | ||
|
||
eos(eos_input_rp, eos_state); | ||
|
||
model::profile(0).state(i, model::idens) = density; | ||
model::profile(0).state(i, model::ipres) = pressure; | ||
model::profile(0).state(i, model::itemp) = eos_state.T; | ||
for (int n = 0; n < NumSpec; n++) { | ||
model::profile(0).state(i, model::ispec+n) = model_params.xn[n]; | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# ------------------ INPUTS TO MAIN PROGRAM ------------------- | ||
max_step = 1000000 | ||
stop_time = 10.0 | ||
|
||
# PROBLEM SIZE & GEOMETRY | ||
geometry.is_periodic = 0 0 | ||
geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical | ||
geometry.prob_lo = 0 0 | ||
geometry.prob_hi = 4.0 12.0 | ||
amr.n_cell = 128 384 | ||
|
||
# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< | ||
# 0 = Interior 3 = Symmetry | ||
# 1 = Inflow 4 = SlipWall | ||
# 2 = Outflow 5 = NoSlipWall | ||
# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< | ||
castro.lo_bc = 2 3 | ||
castro.hi_bc = 2 2 | ||
|
||
|
||
# WHICH PHYSICS | ||
castro.do_hydro = 1 | ||
castro.do_react = 0 | ||
castro.add_ext_src = 1 | ||
castro.do_grav = 1 | ||
castro.do_sponge = 0 | ||
|
||
gravity.gravity_type = ConstantGrav | ||
gravity.const_grav = -2.0 | ||
|
||
# TIME STEP CONTROL | ||
castro.cfl = 0.7 # cfl number for hyperbolic system | ||
castro.init_shrink = 0.1 # scale back initial timestep | ||
castro.change_max = 1.1 # max time step growth | ||
|
||
# SPONGE | ||
#castro.sponge_upper_density = 50.0e0 | ||
#castro.sponge_lower_density = 12.5e0 | ||
#castro.sponge_timescale = 1.e-3 | ||
|
||
# DIAGNOSTICS & VERBOSITY | ||
castro.sum_interval = 1 # timesteps between computing mass | ||
castro.v = 1 # verbosity in Castro.cpp | ||
amr.v = 1 # verbosity in Amr.cpp | ||
|
||
# REFINEMENT / REGRIDDING | ||
amr.max_level = 0 # maximum level number allowed | ||
amr.ref_ratio = 2 2 2 2 # refinement ratio | ||
amr.regrid_int = 2 2 2 2 # how often to regrid | ||
amr.blocking_factor = 8 # block factor in grid generation | ||
amr.max_grid_size = 128 | ||
amr.n_error_buf = 2 2 2 2 # number of buffer cells in error est | ||
|
||
# CHECKPOINT FILES | ||
amr.check_file = chk # root name of checkpoint file | ||
amr.check_int = 1000 # number of timesteps between checkpoints | ||
|
||
# PLOTFILES | ||
amr.plot_file = plt # root name of plotfile | ||
amr.plot_int = 1000 # number of timesteps between plotfiles | ||
amr.derive_plot_vars = ALL | ||
|
||
# PROBLEM PARAMETERS | ||
problem.scale_height = 2.0 | ||
problem.dens_base = 1000.0 | ||
problem.low_density_cutoff = 1.e-3 | ||
|
||
|
||
|
Oops, something went wrong.