diff --git a/src/boundary_conditions/incflo_set_bcs.cpp b/src/boundary_conditions/incflo_set_bcs.cpp index b201ae80..b533df02 100644 --- a/src/boundary_conditions/incflo_set_bcs.cpp +++ b/src/boundary_conditions/incflo_set_bcs.cpp @@ -69,10 +69,10 @@ incflo::make_nodalBC_mask(int lev) Box bhi = mfi.validbox() & dhi; Array4 const& mask_arr = new_mask.array(mfi); if (blo.ok()) { - prob_set_BC_MF(olo, blo, mask_arr, lev, outflow); + prob_set_BC_MF(olo, blo, mask_arr, lev, outflow, "velocity"); } if (bhi.ok()) { - prob_set_BC_MF(ohi, bhi, mask_arr, lev, outflow); + prob_set_BC_MF(ohi, bhi, mask_arr, lev, outflow, "velocity"); } } } @@ -82,7 +82,8 @@ incflo::make_nodalBC_mask(int lev) } std::unique_ptr -incflo::make_BC_MF(int lev, amrex::Gpu::DeviceVector bcs) //, int scomp, int ncomp) +incflo::make_BC_MF(int lev, amrex::Gpu::DeviceVector bcs, + std::string field) { int ncomp = bcs.size(); // BC info stored in ghost cells to avoid any ambiguity @@ -107,7 +108,7 @@ incflo::make_BC_MF(int lev, amrex::Gpu::DeviceVector bcs) //, int Box bhi = mfi.growntilebox() & dhi; Array4 const& mask_arr = BC_MF->array(mfi); if (m_bc_type[olo] == BC::mixed) { - prob_set_BC_MF(olo, blo, mask_arr, lev, outflow); + prob_set_BC_MF(olo, blo, mask_arr, lev, outflow, field); } else { amrex::ParallelFor(blo, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { @@ -117,7 +118,7 @@ incflo::make_BC_MF(int lev, amrex::Gpu::DeviceVector bcs) //, int }); } if (m_bc_type[ohi] == BC::mixed) { - prob_set_BC_MF(ohi, bhi, mask_arr, lev, outflow); + prob_set_BC_MF(ohi, bhi, mask_arr, lev, outflow, field); } else { amrex::ParallelFor(bhi, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { diff --git a/src/convection/incflo_compute_MAC_projected_velocities.cpp b/src/convection/incflo_compute_MAC_projected_velocities.cpp index a9aad73c..1efe3a38 100644 --- a/src/convection/incflo_compute_MAC_projected_velocities.cpp +++ b/src/convection/incflo_compute_MAC_projected_velocities.cpp @@ -235,8 +235,12 @@ incflo::compute_MAC_projected_velocities ( // std::unique_ptr BC_MF; if (m_has_mixedBC) { - BC_MF = make_BC_MF(lev, m_bcrec_velocity_d); + BC_MF = make_BC_MF(lev, m_bcrec_velocity_d, "velocity"); } +//fixme + VisMF::Write(*vel[0],"vin"); + amrex::Write(*BC_MF,"bcmf"); +// // Predict normal velocity to faces -- note that the {u_mac, v_mac, w_mac} // returned from this call are on face CENTROIDS @@ -252,7 +256,7 @@ incflo::compute_MAC_projected_velocities ( l_advection_type, PPM::default_limiter, BC_MF.get()); } -//fixmeamrex:: +//fixme VisMF::Write(*u_mac[0],"umac"); VisMF::Write(*v_mac[0],"vmac"); // diff --git a/src/convection/incflo_compute_advection_term.cpp b/src/convection/incflo_compute_advection_term.cpp index f3920cab..0ad68361 100644 --- a/src/convection/incflo_compute_advection_term.cpp +++ b/src/convection/incflo_compute_advection_term.cpp @@ -276,16 +276,16 @@ incflo::compute_convective_term (Vector const& conv_u, // FIXME -- would it be worth it to save this from vel extrap??? std::unique_ptr velBC_MF; if (m_has_mixedBC) { - velBC_MF = make_BC_MF(lev, m_bcrec_velocity_d); + velBC_MF = make_BC_MF(lev, m_bcrec_velocity_d, "velocity"); } std::unique_ptr densBC_MF; if (m_has_mixedBC) { - densBC_MF = make_BC_MF(lev, m_bcrec_density_d); + densBC_MF = make_BC_MF(lev, m_bcrec_density_d, "density"); } std::unique_ptr tracBC_MF; if (m_advect_tracer && (m_ntrac>0)) { if (m_has_mixedBC) { - tracBC_MF = make_BC_MF(lev, m_bcrec_tracer_d); + tracBC_MF = make_BC_MF(lev, m_bcrec_tracer_d, "tracer"); } } diff --git a/src/incflo.H b/src/incflo.H index 4f3dd271..7e8eaf5f 100644 --- a/src/incflo.H +++ b/src/incflo.H @@ -110,7 +110,9 @@ public: // /////////////////////////////////////////////////////////////////////////// - std::unique_ptr make_BC_MF (int lev, amrex::Gpu::DeviceVector bcs); + std::unique_ptr make_BC_MF (int lev, + amrex::Gpu::DeviceVector bcs, + std::string field); amrex::iMultiFab make_nodalBC_mask (int lev); // void make_ccBC_mask (int lev, const amrex::BoxArray& ba, // const amrex::DistributionMapping& dm); @@ -219,7 +221,7 @@ public: void prob_init_fluid (int lev); void prob_set_BC_MF (amrex::Orientation ori, amrex::Box const& bx, amrex::Array4 const& mask, int lev, - int outflow_val); + int outflow_val, std::string field); void prob_set_MAC_robinBCs (amrex::Orientation ori, amrex::Box const& bx, amrex::Array4 const& robin_a, amrex::Array4 const& robin_b, diff --git a/src/prob/prob_bc.cpp b/src/prob/prob_bc.cpp index 8d975c01..73edfb6b 100644 --- a/src/prob/prob_bc.cpp +++ b/src/prob/prob_bc.cpp @@ -3,11 +3,11 @@ using namespace amrex; // This function is used to prepare both the nodal projection and advection for -// mixed BCs (i.e. position dependent BCs). The necessarily value to indicate an +// mixed BCs (i.e. position dependent BCs). The necessary value to indicate an // outflow BC differs between advection and the NodalProj, so we pass it in void incflo::prob_set_BC_MF (Orientation ori, Box const& bx, Array4 const& mask, int lev, - int outflow_val) + int outflow_val, std::string field) { if (1100 == m_probtype || 1101 == m_probtype || 1102 == m_probtype) { @@ -21,6 +21,9 @@ void incflo::prob_set_BC_MF (Orientation ori, Box const& bx, Box const& domain = geom[lev].Domain(); int half_num_cells = domain.length(direction) / 2; + // for this problem, bcs are same for all fields, only ncomp varies + int ncomp = field == "velocity" ? AMREX_SPACEDIM : 1; + Orientation::Side side = ori.faceDir(); if (side == Orientation::low) { amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept diff --git a/test_3d/inputs.split b/test_3d/inputs.split new file mode 100644 index 00000000..c6ee1a33 --- /dev/null +++ b/test_3d/inputs.split @@ -0,0 +1,99 @@ +amrex.fpe_trap_invalid = 1 + +#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨# +# SIMULATION STOP # +#.......................................# +max_step = 1 # Max number of time steps +steady_state = 0 # Steady-state solver? + +#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨# +# TIME STEP COMPUTATION # +#.......................................# +incflo.fixed_dt = -1.e-5 # Use this constant dt if > 0 +incflo.cfl = 0.45 + +incflo.do_initial_proj = 1 +incflo.initial_iterations = 0 + +#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨# +# INPUT AND OUTPUT # +#.......................................# +amr.plot_int = 1 # Steps between plot files +amr.plt_regtest = 1 + +#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨# +# PHYSICS # +#.......................................# +incflo.gravity = 0. 0. 0. # Gravitational force (3D) +incflo.ro_0 = 1. # Reference density + +incflo.fluid_model = "newtonian" # Fluid model (rheology) +incflo.mu = 0.00 # Dynamic viscosity coefficient +incflo.constant_density = true # + +incflo.advection_type = "Godunov" +incflo.diffusion_type = 0 +incflo.redistribution_type = "StateRedist" + + +#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨# +# ADAPTIVE MESH REFINEMENT # +#.......................................# +amr.n_cell = 64 32 32 # Grid cells at coarsest AMRlevel +amr.max_level = 0 # Max AMR level in hierarchy +amr.max_grid_size_x = 1024 +amr.max_grid_size_y = 1024 +amr.max_grid_size_z = 1024 +#amr.blocking_factor = 8 + +#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨# +# GEOMETRY # +#.......................................# +geometry.prob_lo = -2. -1. -1. # Lo corner coordinates +geometry.prob_hi = 2. 1. 1. # Hi corner coordinates +geometry.is_periodic = 0 0 0 # Periodicity x y z (0/1) + +# Boundary conditionse39e4f5 +xlo.type = "mixed" +xlo.velocity = 1.0 0.0 0.0 +xlo.pressure = 0.0 + +xhi.type = "mixed" +xhi.velocity = 1.0 0.0 0.0 +xhi.pressure = 0.0 + +ylo.type = "nsw" +yhi.type = "nsw" + +zlo.type = "nsw" +zhi.type = "nsw" + +# Add box +incflo.geometry = "box" +box.internal_flow = false + +box.Lo = -2.1 -0.10 -1.1 +box.Hi = 2.10 0.10 1.1 + +#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨# +# INITIAL CONDITIONS # +#.......................................# +incflo.probtype = 1101 + +incflo.ic_u = 1.0 # +incflo.ic_v = 0.0 # +incflo.ic_w = 0.0 # +incflo.ic_p = 0.0 # + +#¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨¨# +# VERBOSITY # +#.......................................# +incflo.verbose = 1 # incflo itself +mac_proj.verbose = 1 # MAC Projector +nodal_proj.verbose = 1 # Nodal Projector + + +#.......................................# +# EB FLOW # +#.......................................# +eb_flow.vel_mag = 0.0