-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
703a2bc
commit 593a953
Showing
42 changed files
with
820 additions
and
274 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
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
68 changes: 68 additions & 0 deletions
68
Exec/Production/CounterFlow/PeleLMeX_PatchFlowVariables.cpp
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,68 @@ | ||
|
||
#include "PeleLMeX.H" | ||
using namespace amrex; | ||
|
||
void | ||
patchFlowVariables( | ||
const amrex::Geometry& geom, ProbParm const& lprobparm, amrex::MultiFab& a_mf) | ||
{ | ||
|
||
amrex::Print() << "\nPatching flow variables.."; | ||
|
||
const amrex::Real* prob_lo = geom.ProbLo(); | ||
const amrex::Real* prob_hi = geom.ProbHi(); | ||
const amrex::Real* dx = geom.CellSize(); | ||
|
||
for (amrex::MFIter mfi(a_mf, amrex::TilingIfNotGPU()); mfi.isValid(); ++mfi) { | ||
const amrex::Box& bx = mfi.tilebox(); | ||
|
||
auto const& rho_arr = a_mf.array(mfi, DENSITY); | ||
auto const& rhoY_arr = a_mf.array(mfi, FIRSTSPEC); | ||
auto const& rhoH_arr = a_mf.array(mfi, RHOH); | ||
auto const& temp_arr = a_mf.array(mfi, TEMP); | ||
Real massfrac[NUM_SPECIES] = {0.0}; | ||
|
||
amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { | ||
|
||
auto eos = pele::physics::PhysicsType::eos(); | ||
amrex::Real massfrac[NUM_SPECIES] = {0.0}; | ||
amrex::Real sumYs = 0.0; | ||
|
||
for (int n = 0; n < NUM_SPECIES; n++) { | ||
massfrac[n] = rhoY_arr(i, j, k, n); | ||
#ifdef N2_ID | ||
if (n != N2_ID) { | ||
sumYs += massfrac[n]; | ||
} | ||
#endif | ||
} | ||
#ifdef N2_ID | ||
massfrac[N2_ID] = 1.0 - sumYs; | ||
#endif | ||
|
||
AMREX_D_TERM(const amrex::Real x = prob_lo[0] + (i+0.5)*dx[0];, | ||
const amrex::Real y = prob_lo[1] + (j+0.5)*dx[1];, | ||
const amrex::Real z = prob_lo[2] + (k+0.5)*dx[2];); | ||
|
||
AMREX_D_TERM(const amrex::Real Lx = prob_hi[0] - prob_lo[0];, | ||
const amrex::Real Ly = prob_hi[1] - prob_lo[1];, | ||
const amrex::Real Lz = prob_hi[2] - prob_lo[2]); | ||
|
||
AMREX_D_TERM(const amrex::Real xc = prob_lo[0] + Lx/2.0;, | ||
const amrex::Real yc = prob_lo[1] + Ly/2.0;, | ||
const amrex::Real zc = prob_lo[2] + Lz/2.0); | ||
|
||
amrex::Real radiusSq = AMREX_D_TERM( (x-xc) * (x-xc), | ||
+ (y-yc) * (y-yc), | ||
+ (z-zc) * (z-zc)); | ||
|
||
amrex::Real radius = std::sqrt(radiusSq); | ||
amrex::Real mixingWidth = 0.1*lprobparm.ignitSphereRad; | ||
amrex::Real mixingFunction = 0.5 * ( 1.0 + std::tanh((lprobparm.ignitSphereRad - radius)/mixingWidth)); | ||
temp_arr(i, j, k) = mixingFunction * lprobparm.ignitT + (1.0 - mixingFunction) * lprobparm.T_inert; | ||
|
||
}); | ||
} | ||
|
||
amrex::Print() << "Done\n"; | ||
} |
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
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,105 @@ | ||
#----------------------DOMAIN DEFINITION------------------------ | ||
geometry.is_periodic = 0 0 # For each dir, 0: non-perio, 1: periodic | ||
geometry.coord_sys = 0 # 0 => cart, 1 => RZ | ||
geometry.prob_lo = -0.0075 -0.0075 0.0 # x_lo y_lo (z_lo) | ||
geometry.prob_hi = 0.0075 0.0075 0.0 # x_hi y_hi (z_hi) | ||
|
||
# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< | ||
# Interior, Inflow, Outflow, Symmetry, | ||
# SlipWallAdiab, NoSlipWallAdiab, SlipWallIsotherm, NoSlipWallIsotherm | ||
peleLM.lo_bc = Inflow Outflow | ||
peleLM.hi_bc = Inflow Outflow | ||
|
||
|
||
#-------------------------AMR CONTROL---------------------------- | ||
amr.n_cell = 64 64 32 # Level 0 number of cells in each direction | ||
amr.v = 1 # AMR verbose | ||
amr.max_level = 0 # maximum level number allowed | ||
amr.ref_ratio = 2 2 2 2 # refinement ratio | ||
amr.regrid_int = 5 # how often to regrid | ||
amr.n_error_buf = 2 2 2 2 # number of buffer cells in error est | ||
amr.grid_eff = 0.7 # what constitutes an efficient grid | ||
amr.blocking_factor = 4 | ||
amr.max_grid_size = 64 # max box size | ||
|
||
#--------------------------- Problem ------------------------------- | ||
#prob.P_mean = 101325.0 | ||
prob.P_mean = 792897.5 #7.82529*one_atm | ||
|
||
prob.T_ox = 450.0 | ||
prob.T_fuel = 450.0 | ||
prob.T_inert = 450.0 | ||
prob.Y_O2_ox = 0.233 | ||
prob.Y_N2_ox = 0.767 | ||
prob.Y_N2_fuel = 0.0 | ||
prob.Y_fuel = 1.0 | ||
|
||
prob.massflow_ox = 0.9171 | ||
prob.massflow_fuel = 2.228 | ||
prob.jet_radius = 0.0025 | ||
prob.inert_velocity_ox = 0.1500 | ||
prob.inert_velocity_fuel = 0.0617 | ||
|
||
prob.do_ignition = 0 | ||
prob.ignition_SphT = 1000.0 | ||
prob.ignition_SphRad = 0.0015 | ||
|
||
#-------------------------PeleLM CONTROL---------------------------- | ||
peleLM.v = 3 # [OPT, DEF=0] Verbose | ||
peleLM.incompressible = 0 # [OPT, DEF=0] Enable to run fully incompressible, scalar advance is bypassed | ||
peleLM.rho = 1.17 # [OPT, DEF=-1] If incompressible, density value [MKS] | ||
peleLM.mu = 0.0 # [OPT, DEF=-1] If incompressible, kinematic visc. value [MKS] | ||
peleLM.use_wbar = 1 # Include Wbar term in species diffusion fluxes | ||
peleLM.sdc_iterMax = 2 # Number of SDC iterations | ||
peleLM.floor_species = 1 # [OPT, DEF=0] Crudely enforce mass fraction positivity | ||
peleLM.deltaT_verbose = 0 # [OPT, DEF=0] Verbose of the deltaT iterative solve algorithm | ||
|
||
amr.check_int = 2000 | ||
#amr.plot_int = 200 | ||
|
||
amr.plot_per = 0.050 #Plot every t=50ms | ||
amr.plot_per_exact = 1 # [OPT, DEF=0] Flag to enforce exactly plt_per by shortening dt | ||
|
||
#amr.max_step = 1000 | ||
amr.dt_shrink = 0.01 | ||
amr.init_dt = 1.0e-6 | ||
amr.stop_time = 0.500 | ||
amr.cfl = 0.1 | ||
amr.derive_plot_vars = avg_pressure mag_vort mass_fractions mixture_fraction | ||
|
||
peleLM.fuel_name = NC12H26 | ||
peleLM.mixtureFraction.format = Cantera | ||
peleLM.mixtureFraction.type = mass | ||
peleLM.mixtureFraction.oxidTank = O2:0.233 N2:0.767 | ||
peleLM.mixtureFraction.fuelTank = NC12H26:1.0 | ||
|
||
peleLM.chem_integrator = "ReactorCvode" | ||
peleLM.use_typ_vals_chem = 1 # Use species/temp typical values in CVODE | ||
ode.rtol = 1.0e-6 # Relative tolerance of the chemical solve | ||
ode.atol = 1.0e-5 # Absolute tolerance factor applied on typical values | ||
cvode.solve_type = denseAJ_direct # CVODE Linear solve type (for Newton direction) | ||
cvode.max_order = 4 # CVODE max BDF order. | ||
|
||
nodal_proj.verbose = 0 | ||
mac_proj.verbose = 0 | ||
diffusion.verbose = 0 | ||
mac_proj.rtol = 1.0e-10 | ||
nodal_proj.rtol = 1.0e-10 | ||
|
||
#nodal_proj.rtol = 5e-10 | ||
#mac_proj.rtol = 5e-10 | ||
#diffusion.rtol = 5e-10 | ||
|
||
peleLM.do_temporals = 1 | ||
peleLM.do_mass_balance = 1 | ||
|
||
#--------------------REFINEMENT CONTROL------------------------ | ||
amr.refinement_indicators = gradT | ||
|
||
amr.gradT.max_level = 0 | ||
amr.gradT.adjacent_difference_greater = 100 | ||
amr.gradT.field_name = temp | ||
|
||
#amrex.fpe_trap_invalid = 1 | ||
#amrex.fpe_trap_zero = 1 | ||
#amrex.fpe_trap_overflow = 1 |
Oops, something went wrong.