From 0cd37ffbca91b54cc3581bed1f2a38345982a831 Mon Sep 17 00:00:00 2001 From: Ann Almgren Date: Sat, 18 Nov 2023 16:13:32 -0800 Subject: [PATCH] fix nvar=2 in InteriorGhostCells and add new inputs_ml for Scalar Reg tests --- Exec/RegTests/ScalarAdvDiff/inputs_ml | 75 +++++++++++++++++++ Source/BoundaryConditions/ERF_FillPatcher.cpp | 1 - Source/Utils/InteriorGhostCells.cpp | 7 +- Source/main.cpp | 7 +- 4 files changed, 83 insertions(+), 7 deletions(-) create mode 100644 Exec/RegTests/ScalarAdvDiff/inputs_ml diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_ml b/Exec/RegTests/ScalarAdvDiff/inputs_ml new file mode 100644 index 000000000..2e431a1ed --- /dev/null +++ b/Exec/RegTests/ScalarAdvDiff/inputs_ml @@ -0,0 +1,75 @@ +# ------------------ INPUTS TO MAIN PROGRAM ------------------- +max_step = 10 + +amrex.fpe_trap_invalid = 1 + +erf.no_substepping=0 + +fabarray.mfiter_tile_size = 1024 1024 1024 + +# PROBLEM SIZE & GEOMETRY +geometry.prob_extent = 1 1 1 +amr.n_cell = 32 32 32 + +geometry.is_periodic = 1 1 0 + +zlo.type = "SlipWall" +zhi.type = "SlipWall" + +# TIME STEP CONTROL +erf.fixed_dt = 5e-5 +erf.fixed_fast_dt = 2.5e-5 + +# DIAGNOSTICS & VERBOSITY +erf.sum_interval = 1 # timesteps between computing mass +erf.v = 1 # verbosity in ERF.cpp +amr.v = 1 # verbosity in Amr.cpp + +# CHECKPOINT FILES +erf.check_file = chk # root name of checkpoint file +erf.check_int = -100 # number of timesteps between checkpoints + +# PLOTFILES +erf.plot_file_1 = plt # prefix of plotfile name +erf.plot_int_1 = 1 # number of timesteps between plotfiles +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta + +# SOLVER CHOICE +erf.alpha_T = 0.0 +erf.alpha_C = 1.0 +erf.use_gravity = false + +erf.les_type = "None" +erf.molec_diff_type = "None" +erf.rho0_trans = 1.0 +erf.dynamicViscosity = 0.0 + +erf.dycore_horiz_adv_type = "Centered_2nd" +erf.dycore_vert_adv_type = "Centered_2nd" +erf.dryscal_horiz_adv_type = "Centered_2nd" +erf.dryscal_vert_adv_type = "Centered_2nd" + +erf.init_type = "uniform" +# PROBLEM PARAMETERS +prob.rho_0 = 1.0 +prob.A_0 = 1.0 +prob.u_0 = 100.0 +prob.v_0 = 0.0 + +prob.prob_type = 10 + +# REFINEMENT / REGRIDDING +amr.max_level = 1 # maximum level number allowed + +amr.ref_ratio_vect = 2 2 1 +erf.refinement_indicators = box1 +erf.box1.max_level = 1 +erf.box1.in_box_lo = 0.25 0.0 +erf.box1.in_box_hi = 0.75 1.0 + +erf.coupling_type = "TwoWay" +erf.coupling_type = "Mixed" +erf.coupling_type = "OneWay" + +erf.cf_width = 3 +erf.cf_set_width = 1 diff --git a/Source/BoundaryConditions/ERF_FillPatcher.cpp b/Source/BoundaryConditions/ERF_FillPatcher.cpp index 7721c8368..ad0bb0845 100644 --- a/Source/BoundaryConditions/ERF_FillPatcher.cpp +++ b/Source/BoundaryConditions/ERF_FillPatcher.cpp @@ -224,7 +224,6 @@ void ERFFillPatcher::InterpCell (MultiFab& fine, Vector const& bcr, int mask_val) { - int ncomp = m_ncomp; IntVect ratio = m_ratio; IndexType m_ixt = fine.boxArray().ixType(); diff --git a/Source/Utils/InteriorGhostCells.cpp b/Source/Utils/InteriorGhostCells.cpp index 4d9b5950e..a0d40f422 100644 --- a/Source/Utils/InteriorGhostCells.cpp +++ b/Source/Utils/InteriorGhostCells.cpp @@ -557,8 +557,7 @@ fine_compute_interior_ghost_rhs (const Real& time, // prim to conserved. // Temp MF on box (distribution map differs w/ fine patch) - int num_var = 1; - if (ivar_idx == IntVar::cons) num_var = 2; + int num_var = fmf.nComp(); fmf_p_v.emplace_back(fmf.boxArray(), fmf.DistributionMap(), num_var, fmf.nGrowVect()); MultiFab& fmf_p = fmf_p_v[ivar_idx]; amrex::MultiFab::Copy(fmf_p,fmf, 0, 0, num_var, fmf.nGrowVect()); @@ -708,7 +707,7 @@ fine_compute_interior_ghost_rhs (const Real& time, amrex::Real num = amrex::Real(Spec_z + Relax_z); amrex::Real denom = amrex::Real(Relax_z - 1); amrex::ParallelFor(vbx, num_var, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept - { + { if (mask_arr(i,j,k) == relax_mask_val) { // Indices @@ -802,7 +801,7 @@ fine_compute_interior_ghost_rhs (const Real& time, amrex::Real Laplacian = delta_xp + delta_xm + delta_yp + delta_ym - 4.0*delta; rhs_arr(i,j,k,n) += (F1*delta - F2*Laplacian) * Factor; } - }); + }); } // mfi } // ivar_idx } diff --git a/Source/main.cpp b/Source/main.cpp index ea074ab1a..fd96fcc9c 100644 --- a/Source/main.cpp +++ b/Source/main.cpp @@ -38,8 +38,11 @@ void add_par () { pp.add("max_grid_size",2048); - int bf=1; - pp.queryAdd("blocking_factor",bf); + // This will set the default value of blocking_factor to be 1, but will allow + // the user to override it in the inputs file or on command line + int blocking_factor = 1; + pp.queryAdd("blocking_factor",blocking_factor); + pp.add("n_error_buf",0); }