Skip to content

Commit

Permalink
Turb Inflow Regtest (#1855)
Browse files Browse the repository at this point in the history
* Modify case so we can do regtesting on it.

* Remove text files. No need to track these.

* update docs.

* Fix typo and add incomp case.
  • Loading branch information
AMLattanzi authored Oct 7, 2024
1 parent 6a9f417 commit ca1b483
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 17 deletions.
6 changes: 6 additions & 0 deletions Docs/sphinx_doc/RegressionTests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ while the following tests are run nightly:
| TaylorGreenAdvDiffDoubleDen | 64 64 64 | Periodic | Periodic | SlipWall | None | Density = 2 |
| | | | | SlipWall | | |
+-------------------------------+-------------+----------+----------+------------+-------+------------------+
| TurbulentInflow | 64 16 32 | Inflow | Periodic | MOST | None | LES |
| | | Outflow | | SlipWall | | |
+-------------------------------+-------------+----------+----------+------------+-------+------------------+
| TurbulentInflow_anelastic | 64 16 32 | Inflow | Periodic | MOST | None | LES |
| | | Outflow | | SlipWall | | |
+-------------------------------+-------------+----------+----------+------------+-------+------------------+
| WPS_Test | 200 200 176 | wrfbdy | wrfbdy | NoSlipWall | None | init from |
| | | wrfbdy | wrfbdy | SlipWall | | wrfinput |
+-------------------------------+-------------+----------+----------+------------+-------+------------------+
Expand Down
13 changes: 7 additions & 6 deletions Exec/RegTests/TurbulentInflow/compressible_source_inputs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ fabarray.mfiter_tile_size = 1024 1024 1024

# PROBLEM SIZE & GEOMETRY
#Larger problem
geometry.prob_extent = 80 2.5 10
amr.n_cell = 512 16 64
#geometry.prob_extent = 80 2.5 10
#amr.n_cell = 512 16 64

# Quick debug problem
#geometry.prob_extent = 20 5 10
#amr.n_cell = 64 16 32
geometry.prob_extent = 20 5 10
amr.n_cell = 64 16 32

geometry.is_periodic = 0 1 0

Expand All @@ -36,6 +36,7 @@ xlo.dirichlet_file = "input_ReTau395Ana_inflow.txt"
erf.fixed_dt = 0.0002
erf.fixed_mri_dt_ratio = 4
erf.dynamicViscosity = 0.001
erf.fix_random_seed = 1

# DIAGNOSTICS & VERBOSITY
erf.sum_interval = 100 # timesteps between computing mass
Expand All @@ -52,8 +53,8 @@ erf.plot_per_1 = 0.1
erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta

# CHECKPOINT FILES
#erf.check_file = chk # root name of checkpoint file
#erf.check_per = 1.0
erf.check_file = chk # root name of checkpoint file
erf.check_per = 1.0

# SOLVER CHOICE
erf.alpha_T = 0.0
Expand Down
9 changes: 5 additions & 4 deletions Exec/RegTests/TurbulentInflow/incompressible_source_inputs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ fabarray.mfiter_tile_size = 1024 1024 1024

# PROBLEM SIZE & GEOMETRY
#Larger problem
geometry.prob_extent = 80 2.5 10
amr.n_cell = 512 16 64
#geometry.prob_extent = 80 2.5 10
#amr.n_cell = 512 16 64

# Quick debug problem
#geometry.prob_extent = 20 5 10
#amr.n_cell = 64 16 32
geometry.prob_extent = 20 5 10
amr.n_cell = 64 16 32

geometry.is_periodic = 0 1 0

Expand All @@ -38,6 +38,7 @@ xlo.theta = 300.0
# TIME STEP CONTROL
erf.cfl = 0.5
erf.dynamicViscosity = 0.001
erf.fix_random_seed = 1

# DIAGNOSTICS & VERBOSITY
erf.sum_interval = 0 # timesteps between computing mass
Expand Down
25 changes: 18 additions & 7 deletions Source/DataStructs/ERF_TurbPertStruct.H
Original file line number Diff line number Diff line change
Expand Up @@ -73,31 +73,31 @@ struct TurbulentPerturbation {
amrex::IntVect boxSize(tpi_boxDim[0],tpi_boxDim[1],tpi_boxDim[2]);

// Starting logic to set the size of the perturbation region(s)
amrex::PrintToFile("BoxPerturbationOutput") << "Setting perturbation region in:";
//amrex::PrintToFile("BoxPerturbationOutput") << "Setting perturbation region in:";
// ***** X-direction perturbation *****
if (tpi_direction[0]) { // West
lo_x_bx.setSmall(amrex::IntVect(tpi_offset, tpi_direction[1]*tpi_offset, 0));
lo_x_bx.setBig(amrex::IntVect((tpi_layers*tpi_boxDim[0]-1)+tpi_offset, nx[1]-(tpi_direction[4]*tpi_offset), nx[2]));
amrex::PrintToFile("BoxPerturbationOutput") << " West face";
//amrex::PrintToFile("BoxPerturbationOutput") << " West face";
}

if (tpi_direction[3]) { // East
hi_x_bx.setSmall(amrex::IntVect(nx[0]-((tpi_layers*tpi_boxDim[0]-1)+tpi_offset), tpi_direction[1]*tpi_offset, 0));
hi_x_bx.setBig(amrex::IntVect(nx[0]-tpi_offset, nx[1]-(tpi_direction[4]*tpi_offset), nx[2]));
amrex::PrintToFile("BoxPerturbationOutput") << " East face";
//amrex::PrintToFile("BoxPerturbationOutput") << " East face";
}

// ***** Y-direction Perturbation *****
if (tpi_direction[1]) { // North
lo_y_bx.setSmall(amrex::IntVect(tpi_direction[0]*tpi_offset, tpi_offset, 0));
lo_y_bx.setBig(amrex::IntVect(nx[0]-tpi_direction[3]*tpi_offset, ((tpi_layers*tpi_boxDim[1])-1)+tpi_offset, nx[2]));
amrex::PrintToFile("BoxPerturbationOutput") << " North face";
//amrex::PrintToFile("BoxPerturbationOutput") << " North face";
}

if (tpi_direction[4]) { // South
hi_y_bx.setSmall(amrex::IntVect(tpi_direction[0]*tpi_offset, nx[1]-((tpi_layers*tpi_boxDim[1]-1)+tpi_offset), 0));
hi_y_bx.setBig(amrex::IntVect(nx[0]-tpi_direction[3]*tpi_offset, nx[1]-tpi_offset, nx[2]));
amrex::PrintToFile("BoxPerturbationOutput") << " South face";
//amrex::PrintToFile("BoxPerturbationOutput") << " South face";
}

if (tpi_direction[2] || tpi_direction[5]) { amrex::Abort("Currently not supporting z-direction flow perturbation"); }
Expand Down Expand Up @@ -128,7 +128,7 @@ struct TurbulentPerturbation {
if (tpi_direction[1]) { tmp_bl.push_back(lo_y_bx); }
if (tpi_direction[3]) { tmp_bl.push_back(hi_x_bx); }
if (tpi_direction[4]) { tmp_bl.push_back(hi_y_bx); }
amrex::PrintToFile("BoxPerturbationOutput") << "\nBoxList: " << tmp_bl << "\n";
//amrex::PrintToFile("BoxPerturbationOutput") << "\nBoxList: " << tmp_bl << "\n";
amrex::BoxArray tmp_ba(tmp_bl);
tmp_ba.maxSize(boxSize);
pb_ba.push_back(tmp_ba);
Expand All @@ -155,6 +155,7 @@ struct TurbulentPerturbation {
tpi_pert_adjust = 0.;
tpi_net_buoyant = 0.;

/*
// Function check point message
amrex::PrintToFile("BoxPerturbationOutput") << "perturbation_box_dims: "
<< tpi_boxDim[0] << " "
Expand All @@ -171,6 +172,7 @@ struct TurbulentPerturbation {
amrex::PrintToFile("BoxPerturbationOutput") << "perturbation_T_intensity: " << tpi_Ti << "\n";
amrex::PrintToFile("BoxPerturbationOutput") << "Reference length per box = " << tpi_lref << "\n\n";
amrex::PrintToFile("BoxPerturbationOutput") << "Turbulent perturbation BoxArray:\n" << pb_ba[lev] << "\n";
*/
}


Expand Down Expand Up @@ -294,6 +296,13 @@ struct TurbulentPerturbation {
const int& lev,
const amrex::IndexType& m_ixtype)
{
// Seed the random generator at 1024UL for regression testing
int fix_random_seed = 0;
amrex::ParmParse pp("erf"); pp.query("fix_random_seed", fix_random_seed);
if (fix_random_seed) {
amrex::InitRandom(1024UL);
}

for (amrex::MFIter mfi(pb_cell,TileNoZ()); mfi.isValid(); ++mfi) {
amrex::Box vbx = mfi.validbox();
amrex::Box pbx = amrex::convert(pb_ba[lev][boxIdx], m_ixtype);
Expand Down Expand Up @@ -496,8 +505,9 @@ struct TurbulentPerturbation {
amrex::Real* get_pb_netZero() { return pb_netZero.data(); }

// Output debug message into a file
void debug (amrex::Real time)
void debug (amrex::Real /*time*/)
{
/*
amrex::PrintToFile("BoxPerturbationOutput") << "#################### PB output at time = "
<< time << " ####################\n";
amrex::PrintToFile("BoxPerturbationOutput") << " Using type: " << pt_type << "\n";
Expand All @@ -510,6 +520,7 @@ struct TurbulentPerturbation {
<< ") | pb_amp=" << pb_amp[i] << "\n";
}
amrex::PrintToFile("BoxPerturbationOutput") << "\n";
*/
}

std::string pp_prefix {"erf"};
Expand Down

0 comments on commit ca1b483

Please sign in to comment.