From e131eed393007e4a86f982b45cfcbf11166c9ba9 Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Wed, 24 Apr 2024 15:08:52 -0700 Subject: [PATCH 01/21] 3d eb aniso test --- Src/EB/AMReX_EB2_2D_C.cpp | 20 ++++- Src/EB/AMReX_EB2_3D_C.cpp | 176 ++++++++++++++++++++++++-------------- Src/EB/AMReX_EB2_C.H | 1 + Src/EB/AMReX_EB2_Level.H | 2 +- 4 files changed, 133 insertions(+), 66 deletions(-) diff --git a/Src/EB/AMReX_EB2_2D_C.cpp b/Src/EB/AMReX_EB2_2D_C.cpp index b2bbde200c5..3385ee98149 100644 --- a/Src/EB/AMReX_EB2_2D_C.cpp +++ b/Src/EB/AMReX_EB2_2D_C.cpp @@ -20,7 +20,15 @@ void set_eb_data (const int i, const int j, constexpr Real small = 1.e-14; constexpr Real tiny = 1.e-15; #endif - + Print()< almostone) { vfrac(i,j,0) = 0.5_rt*(axm+axp)/dx[1]; vcent(i,j,0,0) = 0.0_rt; + Print()<<"\neq almost vfrac "< almostone) { vcent(i,j,0,1) = 0.0_rt; } else { @@ -95,6 +106,7 @@ void set_eb_data (const int i, const int j, } } else if (nyabs < tiny || nxabs > almostone) { vfrac(i,j,0) = 0.5_rt*(aym+ayp)/dx[0]; + Print()<<"\neq almost vfrac y";//< almostone) { vcent(i,j,0,0) = 0.0_rt; } else { @@ -117,6 +129,7 @@ void set_eb_data (const int i, const int j, vcent(i,j,0,1) = -0.125_rt*dayp*dx[1]*dx[1] + aa*(1._rt/6._rt)*dy3; vfrac(i,j,0) = 0.5_rt*(af1+af2)/(dx[0]*dx[1]); + Print()<<"\neq vfrac "< 1.0_rt-small) { vfrac(i,j,0) = 1.0_rt; @@ -133,8 +146,13 @@ void set_eb_data (const int i, const int j, vcent(i,j,0,1) = amrex::min(amrex::max(vcent(i,j,0,1),Real(-0.5)),Real(0.5)); } } + Print()<<"\nvfrac "< const& fcx, Array4 const& fcy, Array4 const& fcz, Array4 const& m2x, Array4 const& m2y, Array4 const& m2z, + GpuArray const& dx, Array4 const& vfrac, Array4 const& vcent, Array4 const& barea, Array4 const& bcent, Array4 const& bnorm, Real small_volfrac, bool& is_small_cell, bool& is_multicut) noexcept { - Real axm = apx(i,j,k); - Real axp = apx(i+1,j,k); - Real aym = apy(i,j,k); - Real ayp = apy(i,j+1,k); - Real azm = apz(i,j,k); - Real azp = apz(i,j,k+1); - + Print()< const& fcx, Array4 const& fcy, Array4 const& fcz, Array4 const& m2x, Array4 const& m2y, Array4 const& m2z, + GpuArray const& dx, Array4 const& vfrac, Array4 const& vcent, Array4 const& barea, Array4 const& bcent, Array4 const& bnorm, Real small_volfrac, @@ -341,7 +388,7 @@ void set_eb_cell (int i, int j, int k, barea(i,j,k) = 0.0_rt; } else { set_eb_data(i, j , k, cell, apx, apy, apz, fcx, fcy, fcz, m2x, m2y, m2z, - vfrac, vcent, barea, bcent, bnorm, small_volfrac, + dx, vfrac, vcent, barea, bcent, bnorm, small_volfrac, is_small_cell, is_multicut); } } @@ -773,6 +820,7 @@ void build_cells (Box const& bx, Array4 const& cell, Array4 const& fcx, Array4 const& fcy, Array4 const& fcz, Array4 const& m2x, Array4 const& m2y, Array4 const& m2z, + GpuArray const& dx, Array4 const& vfrac, Array4 const& vcent, Array4 const& barea, Array4 const& bcent, Array4 const& bnorm, Array4 const& ctmp, @@ -790,7 +838,7 @@ void build_cells (Box const& bx, Array4 const& cell, bool is_small_cell = false; bool is_multicut = false; set_eb_cell(i, j, k, cell, apx, apy, apz, fcx, fcy, fcz, m2x, m2y, m2z, - vfrac, vcent, barea, bcent, bnorm, small_volfrac, + dx, vfrac, vcent, barea, bcent, bnorm, small_volfrac, is_small_cell, is_multicut); if (is_small_cell) { Gpu::Atomic::Add(dp, 1); diff --git a/Src/EB/AMReX_EB2_C.H b/Src/EB/AMReX_EB2_C.H index e176c87b298..49db3a270bd 100644 --- a/Src/EB/AMReX_EB2_C.H +++ b/Src/EB/AMReX_EB2_C.H @@ -64,6 +64,7 @@ void build_cells (Box const& bx, Array4 const& cell, Array4 const& fcx, Array4 const& fcy, Array4 const& fcz, Array4 const& m2x, Array4 const& m2y, Array4 const& m2z, + GpuArray const& dx, Array4 const& vfrac, Array4 const& vcent, Array4 const& barea, Array4 const& bcent, Array4 const& bnorm, Array4 const& ctmp, diff --git a/Src/EB/AMReX_EB2_Level.H b/Src/EB/AMReX_EB2_Level.H index 9243318b99d..7e30e51a6ba 100644 --- a/Src/EB/AMReX_EB2_Level.H +++ b/Src/EB/AMReX_EB2_Level.H @@ -422,7 +422,7 @@ GShopLevel::define_fine (G const& gshop, const Geometry& geom, Array4 const& cfgtmp = cellflagtmp.array(); build_cells(vbx, cfg, ftx, fty, ftz, apx, apy, apz, - fcx, fcy, fcz, xm2, ym2, zm2, vfr, ctr, + fcx, fcy, fcz, xm2, ym2, zm2, dx, vfr, ctr, bar, bct, bnm, cfgtmp, lst, small_volfrac, geom, extend_domain_face, cover_multiple_cuts, nsm, nmc); From 5288c4652a2b1ec96a1d208f441b69625c406704 Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Wed, 24 Apr 2024 15:14:01 -0700 Subject: [PATCH 02/21] test input files --- Tests/EB_CNS/Exec/Sod/inputs_flat | 119 ++++++++++++++++++ Tests/EB_CNS/Exec/Sod/inputs_flat_2d | 81 ++++++++++++ Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y | 81 ++++++++++++ Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z | 81 ++++++++++++ .../EB_CNS/Exec/Sod/inputs_flat_2d_1z_newbox | 81 ++++++++++++ Tests/EB_CNS/Exec/Sod/inputs_flat_2d_all | 81 ++++++++++++ 6 files changed, 524 insertions(+) create mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat create mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d create mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y create mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z create mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z_newbox create mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d_all diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat b/Tests/EB_CNS/Exec/Sod/inputs_flat new file mode 100644 index 00000000000..a6fb2aa11d3 --- /dev/null +++ b/Tests/EB_CNS/Exec/Sod/inputs_flat @@ -0,0 +1,119 @@ +amrex.fpe_trap_invalid=1 + +max_step = 100 +stop_time = 0.2 + +geometry.is_periodic = 0 0 0 +geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical +geometry.prob_lo = 0.0 0.0 0.0 +geometry.prob_hi = 1.0 0.125 0.125 +amr.n_cell = 32 4 4 + +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +# 0 = Interior 3 = Symmetry +# 1 = Inflow 4 = SlipWall +# 2 = Outflow 5 = NoSlipWall +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +cns.lo_bc = 2 4 4 +cns.hi_bc = 2 4 4 + +cns.cfl = 0.3 # cfl number for hyperbolic system + +cns.v = 2 +amr.v = 1 + +# LOAD BALANCE +amr.loadbalance_with_workestimates = 1 +amr.loadbalance_level0_int = 1000 + +# REFINEMENT / REGRIDDING +amr.max_level = 1 # 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 = 4 +amr.max_grid_size = 16 +amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est +amr.grid_eff = 0.99 # what constitutes an efficient grid + +# CHECKPOINT FILES +amr.checkpoint_files_output = 0 +amr.check_file = chk # root name of checkpoint file +amr.check_int = 100 # number of timesteps between checkpoints + +# PLOTFILES +amr.plot_files_output = 1 +amr.plot_file = plt # root name of plotfile +amr.plot_int = 10 # number of timesteps between plotfiles +amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity + +# EB +eb2.sphere_radius = 0.125 +#eb2.sphere_center = 0.45 0.65 0.54 +#eb2.sphere_center = 0.5 0.5 0.5 +eb2.sphere_center = 0.7 0.5 0.5 +eb2.sphere_has_fluid_inside = 0 + +eb2.geom_type = sphere +#eb2.geom_type = all_regular + +cns.refine_cutcells = 0 + +cns.do_visc = true +#cns.use_const_visc = false +#cns.const_visc_mu = 0.001 +#cns.const_visc_ki = 0.0 +#cns.const_lambda = 0.0 + +# case 1: a single box at the top y-boundary +#cns.refine_box_lo_0 = 0.45 0.90 0.45 +#cns.refine_box_hi_0 = 0.55 0.92 0.55 + +# case 2: two boxes, one at the top, the other at the bottom +cns.refine_box_lo_0 = 0.45 0.85 0.45 +cns.refine_box_hi_0 = 0.55 0.99 0.55 + +# case 3: similar to case 2, but the bottom box is wider +#cns.refine_box_lo_0 = 0.45 0.85 0.45 +#cns.refine_box_hi_0 = 0.55 0.99 0.55 +# +#cns.refine_box_lo_1 = 0.45 0.08 0.35 +#cns.refine_box_hi_1 = 0.55 0.10 0.65 + +# case 4: at the corner +#cns.refine_box_lo_0 = 0.85 0.85 0.85 +#cns.refine_box_hi_0 = 0.99 0.99 0.99 + +# case 5 : very wide box +#cns.refine_box_lo_0 = 0.0 0.90 0.0 +#cns.refine_box_hi_0 = 1.0 0.92 1.0 + +# case 6 : a box at the center +cns.refine_box_lo_0 = 0.48 0.048 0.048 +cns.refine_box_hi_0 = 0.52 0.052 0.052 +cns.refine_box_lo_0 = 0.48 0.048 0.0 +cns.refine_box_hi_0 = 0.52 0.052 0.0 +amr.blocking_factor = 4 +amr.max_grid_size = 64 + +# case 7 : refine everywhere +#cns.refine_box_lo_0 = 0. 0. 0. +#cns.refine_box_hi_0 = 1. 1. 1. +#geometry.is_periodic = 0 0 0 +#cns.lo_bc = 2 2 2 +#cns.hi_bc = 2 2 2 + +# +#cns.refine_box_lo_0 = 0.55 0.5 0.3 +#cns.refine_box_hi_0 = 0.85 0.65 0.7 +#amr.blocking_factor = 16 +#amr.max_grid_size = 64 + +# problem specific parameter +prob.p_l = 1.0 +prob.p_r = 0.1 +prob.rho_l = 1.0 +prob.rho_r = 0.125 +prob.u_l = 0.0 +prob.u_r = 0.0 + diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d new file mode 100644 index 00000000000..8ca451de5ed --- /dev/null +++ b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d @@ -0,0 +1,81 @@ +amrex.fpe_trap_invalid=1 + +max_step = 100 +stop_time = 0.2 + +geometry.is_periodic = 0 0 0 +geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical +geometry.prob_lo = 0.0 0.0 0.0 +geometry.prob_hi = 64 4 8 +amr.n_cell = 32 4 4 + +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +# 0 = Interior 3 = Symmetry +# 1 = Inflow 4 = SlipWall +# 2 = Outflow 5 = NoSlipWall +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +cns.lo_bc = 2 4 4 +cns.hi_bc = 2 4 4 + +cns.cfl = 0.3 # cfl number for hyperbolic system + +cns.v = 2 +amr.v = 1 + +# LOAD BALANCE +amr.loadbalance_with_workestimates = 1 +amr.loadbalance_level0_int = 1000 + +# REFINEMENT / REGRIDDING +amr.max_level = 1 # 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 = 4 +amr.max_grid_size = 16 +amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est +amr.grid_eff = 0.99 # what constitutes an efficient grid + +# CHECKPOINT FILES +amr.checkpoint_files_output = 0 +amr.check_file = chk # root name of checkpoint file +amr.check_int = 100 # number of timesteps between checkpoints + +# PLOTFILES +amr.plot_files_output = 1 +amr.plot_file = plt # root name of plotfile +amr.plot_int = 10 # number of timesteps between plotfiles +amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity + +# EB +eb2.sphere_radius = 0.03125 +#eb2.sphere_center = 0.45 0.65 0.54 +#eb2.sphere_center = 0.5 0.5 0.5 +eb2.sphere_center = 0.5 0.0625 0.0625 +eb2.box_has_fluid_inside = 0 + +eb2.geom_type = box +#eb2.geom_type = all_regular +eb2.box_lo = 0.48 0.046875 0.0 +eb2.box_hi = 0.52 0.078125 0.03125 +#eb2.box_hi = 0.52 0.078125 0.0 + +eb2.box_lo = 31 1 0 +eb2.box_hi = 36 3 2 + +cns.refine_cutcells = 0 + +cns.do_visc = true +#cns.use_const_visc = false +#cns.const_visc_mu = 0.001 +#cns.const_visc_ki = 0.0 +#cns.const_lambda = 0.0 + +# problem specific parameter +prob.p_l = 1.0 +prob.p_r = 0.1 +prob.rho_l = 1.0 +prob.rho_r = 0.125 +prob.u_l = 0.0 +prob.u_r = 0.0 + diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y new file mode 100644 index 00000000000..8ca451de5ed --- /dev/null +++ b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y @@ -0,0 +1,81 @@ +amrex.fpe_trap_invalid=1 + +max_step = 100 +stop_time = 0.2 + +geometry.is_periodic = 0 0 0 +geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical +geometry.prob_lo = 0.0 0.0 0.0 +geometry.prob_hi = 64 4 8 +amr.n_cell = 32 4 4 + +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +# 0 = Interior 3 = Symmetry +# 1 = Inflow 4 = SlipWall +# 2 = Outflow 5 = NoSlipWall +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +cns.lo_bc = 2 4 4 +cns.hi_bc = 2 4 4 + +cns.cfl = 0.3 # cfl number for hyperbolic system + +cns.v = 2 +amr.v = 1 + +# LOAD BALANCE +amr.loadbalance_with_workestimates = 1 +amr.loadbalance_level0_int = 1000 + +# REFINEMENT / REGRIDDING +amr.max_level = 1 # 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 = 4 +amr.max_grid_size = 16 +amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est +amr.grid_eff = 0.99 # what constitutes an efficient grid + +# CHECKPOINT FILES +amr.checkpoint_files_output = 0 +amr.check_file = chk # root name of checkpoint file +amr.check_int = 100 # number of timesteps between checkpoints + +# PLOTFILES +amr.plot_files_output = 1 +amr.plot_file = plt # root name of plotfile +amr.plot_int = 10 # number of timesteps between plotfiles +amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity + +# EB +eb2.sphere_radius = 0.03125 +#eb2.sphere_center = 0.45 0.65 0.54 +#eb2.sphere_center = 0.5 0.5 0.5 +eb2.sphere_center = 0.5 0.0625 0.0625 +eb2.box_has_fluid_inside = 0 + +eb2.geom_type = box +#eb2.geom_type = all_regular +eb2.box_lo = 0.48 0.046875 0.0 +eb2.box_hi = 0.52 0.078125 0.03125 +#eb2.box_hi = 0.52 0.078125 0.0 + +eb2.box_lo = 31 1 0 +eb2.box_hi = 36 3 2 + +cns.refine_cutcells = 0 + +cns.do_visc = true +#cns.use_const_visc = false +#cns.const_visc_mu = 0.001 +#cns.const_visc_ki = 0.0 +#cns.const_lambda = 0.0 + +# problem specific parameter +prob.p_l = 1.0 +prob.p_r = 0.1 +prob.rho_l = 1.0 +prob.rho_r = 0.125 +prob.u_l = 0.0 +prob.u_r = 0.0 + diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z new file mode 100644 index 00000000000..b69c32a3a0a --- /dev/null +++ b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z @@ -0,0 +1,81 @@ +amrex.fpe_trap_invalid=1 + +max_step = 100 +stop_time = 0.2 + +geometry.is_periodic = 0 0 0 +geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical +geometry.prob_lo = 0.0 0.0 0.0 +geometry.prob_hi = 64 8 4 +amr.n_cell = 32 4 4 + +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +# 0 = Interior 3 = Symmetry +# 1 = Inflow 4 = SlipWall +# 2 = Outflow 5 = NoSlipWall +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +cns.lo_bc = 2 4 4 +cns.hi_bc = 2 4 4 + +cns.cfl = 0.3 # cfl number for hyperbolic system + +cns.v = 2 +amr.v = 1 + +# LOAD BALANCE +amr.loadbalance_with_workestimates = 1 +amr.loadbalance_level0_int = 1000 + +# REFINEMENT / REGRIDDING +amr.max_level = 1 # 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 = 4 +amr.max_grid_size = 16 +amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est +amr.grid_eff = 0.99 # what constitutes an efficient grid + +# CHECKPOINT FILES +amr.checkpoint_files_output = 0 +amr.check_file = chk # root name of checkpoint file +amr.check_int = 100 # number of timesteps between checkpoints + +# PLOTFILES +amr.plot_files_output = 1 +amr.plot_file = plt # root name of plotfile +amr.plot_int = 10 # number of timesteps between plotfiles +amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity + +# EB +eb2.sphere_radius = 0.03125 +#eb2.sphere_center = 0.45 0.65 0.54 +#eb2.sphere_center = 0.5 0.5 0.5 +eb2.sphere_center = 0.5 0.0625 0.0625 +eb2.box_has_fluid_inside = 0 + +eb2.geom_type = box +#eb2.geom_type = all_regular +eb2.box_lo = 0.48 0.046875 0.0 +eb2.box_hi = 0.52 0.078125 0.03125 +#eb2.box_hi = 0.52 0.078125 0.0 + +eb2.box_lo = 31 1 0 +eb2.box_hi = 36 3 2 + +cns.refine_cutcells = 0 + +cns.do_visc = true +#cns.use_const_visc = false +#cns.const_visc_mu = 0.001 +#cns.const_visc_ki = 0.0 +#cns.const_lambda = 0.0 + +# problem specific parameter +prob.p_l = 1.0 +prob.p_r = 0.1 +prob.rho_l = 1.0 +prob.rho_r = 0.125 +prob.u_l = 0.0 +prob.u_r = 0.0 + diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z_newbox b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z_newbox new file mode 100644 index 00000000000..0aa03da218c --- /dev/null +++ b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z_newbox @@ -0,0 +1,81 @@ +amrex.fpe_trap_invalid=1 + +max_step = 100 +stop_time = 0.2 + +geometry.is_periodic = 0 0 0 +geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical +geometry.prob_lo = 0.0 0.0 0.0 +geometry.prob_hi = 64 8 4 +amr.n_cell = 32 4 4 + +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +# 0 = Interior 3 = Symmetry +# 1 = Inflow 4 = SlipWall +# 2 = Outflow 5 = NoSlipWall +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +cns.lo_bc = 2 4 4 +cns.hi_bc = 2 4 4 + +cns.cfl = 0.3 # cfl number for hyperbolic system + +cns.v = 2 +amr.v = 1 + +# LOAD BALANCE +amr.loadbalance_with_workestimates = 1 +amr.loadbalance_level0_int = 1000 + +# REFINEMENT / REGRIDDING +amr.max_level = 1 # 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 = 4 +amr.max_grid_size = 16 +amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est +amr.grid_eff = 0.99 # what constitutes an efficient grid + +# CHECKPOINT FILES +amr.checkpoint_files_output = 0 +amr.check_file = chk # root name of checkpoint file +amr.check_int = 100 # number of timesteps between checkpoints + +# PLOTFILES +amr.plot_files_output = 1 +amr.plot_file = plt # root name of plotfile +amr.plot_int = 10 # number of timesteps between plotfiles +amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity + +# EB +eb2.sphere_radius = 0.03125 +#eb2.sphere_center = 0.45 0.65 0.54 +#eb2.sphere_center = 0.5 0.5 0.5 +eb2.sphere_center = 0.5 0.0625 0.0625 +eb2.box_has_fluid_inside = 0 + +eb2.geom_type = box +#eb2.geom_type = all_regular +eb2.box_lo = 0.48 0.046875 0.0 +eb2.box_hi = 0.52 0.078125 0.03125 +#eb2.box_hi = 0.52 0.078125 0.0 + +eb2.box_lo = 31 1 0 +eb2.box_hi = 36 3 3 + +cns.refine_cutcells = 0 + +cns.do_visc = true +#cns.use_const_visc = false +#cns.const_visc_mu = 0.001 +#cns.const_visc_ki = 0.0 +#cns.const_lambda = 0.0 + +# problem specific parameter +prob.p_l = 1.0 +prob.p_r = 0.1 +prob.rho_l = 1.0 +prob.rho_r = 0.125 +prob.u_l = 0.0 +prob.u_r = 0.0 + diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_all b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_all new file mode 100644 index 00000000000..2d33a226253 --- /dev/null +++ b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_all @@ -0,0 +1,81 @@ +amrex.fpe_trap_invalid=1 + +max_step = 100 +stop_time = 0.2 + +geometry.is_periodic = 0 0 0 +geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical +geometry.prob_lo = 0.0 0.0 0.0 +geometry.prob_hi = 64 8 8 +amr.n_cell = 32 4 4 + +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +# 0 = Interior 3 = Symmetry +# 1 = Inflow 4 = SlipWall +# 2 = Outflow 5 = NoSlipWall +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +cns.lo_bc = 2 4 4 +cns.hi_bc = 2 4 4 + +cns.cfl = 0.3 # cfl number for hyperbolic system + +cns.v = 2 +amr.v = 1 + +# LOAD BALANCE +amr.loadbalance_with_workestimates = 1 +amr.loadbalance_level0_int = 1000 + +# REFINEMENT / REGRIDDING +amr.max_level = 1 # 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 = 4 +amr.max_grid_size = 16 +amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est +amr.grid_eff = 0.99 # what constitutes an efficient grid + +# CHECKPOINT FILES +amr.checkpoint_files_output = 0 +amr.check_file = chk # root name of checkpoint file +amr.check_int = 100 # number of timesteps between checkpoints + +# PLOTFILES +amr.plot_files_output = 1 +amr.plot_file = plt # root name of plotfile +amr.plot_int = 10 # number of timesteps between plotfiles +amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity + +# EB +eb2.sphere_radius = 0.03125 +#eb2.sphere_center = 0.45 0.65 0.54 +#eb2.sphere_center = 0.5 0.5 0.5 +eb2.sphere_center = 0.5 0.0625 0.0625 +eb2.box_has_fluid_inside = 0 + +eb2.geom_type = box +#eb2.geom_type = all_regular +eb2.box_lo = 0.48 0.046875 0.0 +eb2.box_hi = 0.52 0.078125 0.03125 +#eb2.box_hi = 0.52 0.078125 0.0 + +eb2.box_lo = 31 1 0 +eb2.box_hi = 36 3 3 + +cns.refine_cutcells = 0 + +cns.do_visc = true +#cns.use_const_visc = false +#cns.const_visc_mu = 0.001 +#cns.const_visc_ki = 0.0 +#cns.const_lambda = 0.0 + +# problem specific parameter +prob.p_l = 1.0 +prob.p_r = 0.1 +prob.rho_l = 1.0 +prob.rho_r = 0.125 +prob.u_l = 0.0 +prob.u_r = 0.0 + From 25f109b93062e4afc877c2c1b57bd5fa492290be Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Wed, 24 Apr 2024 20:57:25 -0700 Subject: [PATCH 03/21] fix apy to apz --- Src/EB/AMReX_EB2_3D_C.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index 133f109f7f2..9b173f74f98 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -55,8 +55,8 @@ void set_eb_data (const int i, const int j, const int k, const Real axp = apx(i+1,j ,k )*dx[1]*dx[2]; const Real aym = apy(i ,j ,k )*dx[0]*dx[2]; const Real ayp = apy(i ,j+1,k )*dx[0]*dx[2]; - const Real azm = apy(i ,j ,k )*dx[0]*dx[1]; - const Real azp = apy(i ,j ,k+1)*dx[0]*dx[1]; + const Real azm = apz(i ,j ,k )*dx[0]*dx[1]; + const Real azp = apz(i ,j ,k+1)*dx[0]*dx[1]; Real axmt = apx(i,j,k); Real axpt = apx(i+1,j,k); Real aymt = apy(i,j,k); From 904ce75523b2139c922078726c8f37cb0c69b9eb Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Wed, 24 Apr 2024 21:50:02 -0700 Subject: [PATCH 04/21] Fix dx factors for bcent --- Src/EB/AMReX_EB2_2D_C.cpp | 2 ++ Src/EB/AMReX_EB2_3D_C.cpp | 16 +++++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Src/EB/AMReX_EB2_2D_C.cpp b/Src/EB/AMReX_EB2_2D_C.cpp index 3385ee98149..aa2e55a22a3 100644 --- a/Src/EB/AMReX_EB2_2D_C.cpp +++ b/Src/EB/AMReX_EB2_2D_C.cpp @@ -153,6 +153,8 @@ void set_eb_data (const int i, const int j, bcent(i,j,0,1) /= dx[1]; Print()<<"\nbcent "< Date: Wed, 24 Apr 2024 22:04:15 -0700 Subject: [PATCH 05/21] tweak bcent factor --- Src/EB/AMReX_EB2_2D_C.cpp | 4 ++-- Src/EB/AMReX_EB2_3D_C.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Src/EB/AMReX_EB2_2D_C.cpp b/Src/EB/AMReX_EB2_2D_C.cpp index aa2e55a22a3..bf04e6e557d 100644 --- a/Src/EB/AMReX_EB2_2D_C.cpp +++ b/Src/EB/AMReX_EB2_2D_C.cpp @@ -153,8 +153,8 @@ void set_eb_data (const int i, const int j, bcent(i,j,0,1) /= dx[1]; Print()<<"\nbcent "<0) + Abort("finished k=0"); } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE From 97eeda50197e46526b1ff93b6913bf7eb9859fac Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Wed, 24 Apr 2024 22:37:46 -0700 Subject: [PATCH 06/21] Remove prints --- Src/EB/AMReX_EB2_2D_C.cpp | 2 -- Src/EB/AMReX_EB2_3D_C.cpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/Src/EB/AMReX_EB2_2D_C.cpp b/Src/EB/AMReX_EB2_2D_C.cpp index bf04e6e557d..3385ee98149 100644 --- a/Src/EB/AMReX_EB2_2D_C.cpp +++ b/Src/EB/AMReX_EB2_2D_C.cpp @@ -153,8 +153,6 @@ void set_eb_data (const int i, const int j, bcent(i,j,0,1) /= dx[1]; Print()<<"\nbcent "<0) - Abort("finished k=0"); } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE From 38f7eae9e6b4b07b72e78dad0df42cde3906cbad Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Thu, 25 Apr 2024 11:11:51 -0700 Subject: [PATCH 07/21] Hack out warnings for almostequal --- Src/EB/AMReX_EB2_3D_C.cpp | 1 + Src/EB/AMReX_EB_FluxRedistribute.cpp | 4 +- Src/EB/AMReX_EB_Redistribution.cpp | 4 +- .../EB_CNS/Exec/Sod/inputs_flat_2d_1y_newbox | 81 +++++++++++++++++++ Tests/EB_CNS/Source/CNS.cpp | 3 +- 5 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y_newbox diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index 3e85673089a..93ac9dd3d38 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -39,6 +39,7 @@ void set_eb_data (const int i, const int j, const int k, bool& is_small_cell, bool& is_multicut) noexcept { Print()< cart, 1 => RZ 2=>spherical +geometry.prob_lo = 0.0 0.0 0.0 +geometry.prob_hi = 64 4 8 +amr.n_cell = 32 4 4 + +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +# 0 = Interior 3 = Symmetry +# 1 = Inflow 4 = SlipWall +# 2 = Outflow 5 = NoSlipWall +# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< +cns.lo_bc = 2 2 4 +cns.hi_bc = 2 2 4 + +cns.cfl = 0.3 # cfl number for hyperbolic system + +cns.v = 2 +amr.v = 1 + +# LOAD BALANCE +amr.loadbalance_with_workestimates = 1 +amr.loadbalance_level0_int = 1000 + +# REFINEMENT / REGRIDDING +amr.max_level = 1 # 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 = 4 +amr.max_grid_size = 16 +amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est +amr.grid_eff = 0.99 # what constitutes an efficient grid + +# CHECKPOINT FILES +amr.checkpoint_files_output = 0 +amr.check_file = chk # root name of checkpoint file +amr.check_int = 100 # number of timesteps between checkpoints + +# PLOTFILES +amr.plot_files_output = 1 +amr.plot_file = plt # root name of plotfile +amr.plot_int = 10 # number of timesteps between plotfiles +amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity + +# EB +eb2.sphere_radius = 0.03125 +#eb2.sphere_center = 0.45 0.65 0.54 +#eb2.sphere_center = 0.5 0.5 0.5 +eb2.sphere_center = 0.5 0.0625 0.0625 +eb2.box_has_fluid_inside = 0 + +eb2.geom_type = box +#eb2.geom_type = all_regular +eb2.box_lo = 0.48 0.046875 0.0 +eb2.box_hi = 0.52 0.078125 0.03125 +#eb2.box_hi = 0.52 0.078125 0.0 + +eb2.box_lo = 31 1 0 +eb2.box_hi = 36 3 4 + +cns.refine_cutcells = 0 + +cns.do_visc = true +#cns.use_const_visc = false +#cns.const_visc_mu = 0.001 +#cns.const_visc_ki = 0.0 +#cns.const_lambda = 0.0 + +# problem specific parameter +prob.p_l = 1.0 +prob.p_r = 0.1 +prob.rho_l = 1.0 +prob.rho_r = 0.125 +prob.u_l = 0.0 +prob.u_r = 0.0 + diff --git a/Tests/EB_CNS/Source/CNS.cpp b/Tests/EB_CNS/Source/CNS.cpp index 40882a4edb0..919e715265c 100644 --- a/Tests/EB_CNS/Source/CNS.cpp +++ b/Tests/EB_CNS/Source/CNS.cpp @@ -485,6 +485,7 @@ CNS::buildMetrics () // make sure dx == dy == dz const Real* dx = geom.CellSize(); + /* #if (AMREX_SPACEDIM == 2) if (std::abs(dx[0]-dx[1]) > 1.e-12*dx[0]) amrex::Abort("CNS: must have dx == dy\n"); @@ -492,7 +493,7 @@ CNS::buildMetrics () if (std::abs(dx[0]-dx[1]) > 1.e-12*dx[0] || std::abs(dx[0]-dx[2]) > 1.e-12*dx[0]) amrex::Abort("CNS: must have dx == dy == dz\n"); #endif - + */ const auto& ebfactory = dynamic_cast(Factory()); volfrac = &(ebfactory.getVolFrac()); From ca44087a2abe9f045b0bc6956680d3e410e89638 Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Fri, 26 Apr 2024 15:32:34 -0700 Subject: [PATCH 08/21] Fix bcent --- Src/EB/AMReX_EB2_2D_C.cpp | 17 +++++++++++-- Src/EB/AMReX_EB2_3D_C.cpp | 50 ++++++++++++++++++++++++++++++++++----- 2 files changed, 59 insertions(+), 8 deletions(-) diff --git a/Src/EB/AMReX_EB2_2D_C.cpp b/Src/EB/AMReX_EB2_2D_C.cpp index 3385ee98149..671d17e7326 100644 --- a/Src/EB/AMReX_EB2_2D_C.cpp +++ b/Src/EB/AMReX_EB2_2D_C.cpp @@ -90,8 +90,9 @@ void set_eb_data (const int i, const int j, barea(i,j,0) = (nx*daxp + ny*dayp)/bareascaling; bcent(i,j,0,0) = 0.5_rt*(x_ym+x_yp); bcent(i,j,0,1) = 0.5_rt*(y_xm+y_xp); - Print()<<"\nbcent x"< 0.0_rt) ? 1.0_rt : -1.0_rt; + Real x_ym = (-0.5_rt + aym/dx[0]/dx[2])*signx; + Real x_yp = (-0.5_rt + ayp/dx[0]/dx[2])*signx; + Print()<<"x_ym "< Date: Fri, 26 Apr 2024 16:17:34 -0700 Subject: [PATCH 09/21] Reconcile barea with bainv update --- Src/EB/AMReX_EB2_3D_C.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index 348de64c97b..15df8452a40 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -129,7 +129,7 @@ void set_eb_data (const int i, const int j, const int k, bnorm(i,j,k,0) = nx; bnorm(i,j,k,1) = ny; bnorm(i,j,k,2) = nz; - barea(i,j,k) = (nx*dapx + ny*dapy + nz*dapz)/bareascaling; + barea(i,j,k) = (nx*dapx*dx[0]*dx[0] + ny*dapy*dx[1]*dx[1] + nz*dapz*dx[2]*dx[2])*apnorminv*apnorminv; // barea(i,j,k) = (nx*dapx + ny*dapy + nz*dapz)/bareascaling; Real aaxo = 0.5_rt*(axm+axp); @@ -139,7 +139,6 @@ void set_eb_data (const int i, const int j, const int k, Real aay = 0.5_rt*(aym+ayp)/dx[0]/dx[2]; Real aaz = 0.5_rt*(azm+azp)/dx[0]/dx[1]; - Print()<<"barea"< Date: Fri, 26 Apr 2024 17:12:28 -0700 Subject: [PATCH 10/21] updated barea, remove other tests --- Src/EB/AMReX_EB2_3D_C.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index 15df8452a40..b41e66133e7 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -163,7 +163,7 @@ void set_eb_data (const int i, const int j, const int k, Print()<<"is_small_cell"< Date: Fri, 26 Apr 2024 17:13:41 -0700 Subject: [PATCH 11/21] Remove prints --- Src/EB/AMReX_EB2_2D_C.cpp | 27 -------------------- Src/EB/AMReX_EB2_3D_C.cpp | 52 ++------------------------------------- 2 files changed, 2 insertions(+), 77 deletions(-) diff --git a/Src/EB/AMReX_EB2_2D_C.cpp b/Src/EB/AMReX_EB2_2D_C.cpp index 671d17e7326..368dbbcb504 100644 --- a/Src/EB/AMReX_EB2_2D_C.cpp +++ b/Src/EB/AMReX_EB2_2D_C.cpp @@ -20,15 +20,6 @@ void set_eb_data (const int i, const int j, constexpr Real small = 1.e-14; constexpr Real tiny = 1.e-15; #endif - Print()< almostone) { vcent(i,j,0,1) = 0.0_rt; } else { @@ -107,7 +97,6 @@ void set_eb_data (const int i, const int j, } } else if (nyabs < tiny || nxabs > almostone) { vfrac(i,j,0) = 0.5_rt*(aym+ayp)/dx[0]; - Print()<<"\neq almost vfrac y";//< almostone) { vcent(i,j,0,0) = 0.0_rt; } else { @@ -130,7 +119,6 @@ void set_eb_data (const int i, const int j, vcent(i,j,0,1) = -0.125_rt*dayp*dx[1]*dx[1] + aa*(1._rt/6._rt)*dy3; vfrac(i,j,0) = 0.5_rt*(af1+af2)/(dx[0]*dx[1]); - Print()<<"\neq vfrac "< 1.0_rt-small) { vfrac(i,j,0) = 1.0_rt; @@ -147,23 +135,8 @@ void set_eb_data (const int i, const int j, vcent(i,j,0,1) = amrex::min(amrex::max(vcent(i,j,0,1),Real(-0.5)),Real(0.5)); } } - Print()<<"\nbcent x"< const& bnorm, Real small_volfrac, bool& is_small_cell, bool& is_multicut) noexcept { - Print()< 0.0_rt) ? 1.0_rt : -1.0_rt; Real x_ym = (-0.5_rt + aym/dx[0]/dx[2])*signx; Real x_yp = (-0.5_rt + ayp/dx[0]/dx[2])*signx; - Print()<<"x_ym "< Date: Fri, 26 Apr 2024 17:14:45 -0700 Subject: [PATCH 12/21] Fix style --- Src/EB/AMReX_EB2_2D_C.cpp | 2 +- Src/EB/AMReX_EB2_3D_C.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Src/EB/AMReX_EB2_2D_C.cpp b/Src/EB/AMReX_EB2_2D_C.cpp index 368dbbcb504..c37b1fe0881 100644 --- a/Src/EB/AMReX_EB2_2D_C.cpp +++ b/Src/EB/AMReX_EB2_2D_C.cpp @@ -138,7 +138,7 @@ void set_eb_data (const int i, const int j, bcent(i,j,0,0) /= dx[0]; bcent(i,j,0,1) /= dx[1]; if(i==33&&j==7) - Abort("33 7 0"); + Abort("33 7 0"); } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index 70cc0d4ee33..39f3a0f0122 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -200,12 +200,12 @@ void set_eb_data (const int i, const int j, const int k, 10._rt*b8*nx*(-2._rt + ny2))*nz2 + 2._rt*(-5._rt*b4 + 15._rt*b6 + (b2 + b7*nx)*ny + 2._rt*(b4 + b5 - 4._rt*b6)*ny2)*nz3 + 2._rt*b9*ny*nz4); - + Real deno = 1._rt / (10._rt*(5._rt + 4._rt*nz2 - 4._rt*nz4 + 2._rt*ny4*(-2._rt + nz2) + 2._rt*ny2*(2._rt - 3._rt*nz2 + nz4)) * (vfrac(i,j,k)+1.e-30_rt) ); Real den = 1._rt / (10._rt*(5._rt + 4._rt*nz2 - 4._rt*nz4 + 2._rt*ny4*(-2._rt + nz2) + 2._rt*ny2*(2._rt - 3._rt*nz2 + nz4)) * (vfrac(i,j,k)+1.e-30_rt) ) / (dx[0]*dx[1]*dx[2]); - < Date: Fri, 26 Apr 2024 18:13:12 -0700 Subject: [PATCH 13/21] Remove unneeded scaling factors --- Src/EB/AMReX_EB2_3D_C.cpp | 107 ++++++++++++++++++++++++++++---------- 1 file changed, 80 insertions(+), 27 deletions(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index 39f3a0f0122..ce5abdc17d7 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -38,7 +38,20 @@ void set_eb_data (const int i, const int j, const int k, Array4 const& bnorm, Real small_volfrac, bool& is_small_cell, bool& is_multicut) noexcept { - + Print()< 0.0_rt) ? 1.0_rt : -1.0_rt; Real x_ym = (-0.5_rt + aym/dx[0]/dx[2])*signx; Real x_yp = (-0.5_rt + ayp/dx[0]/dx[2])*signx; + Print()<<"x_ym "< Date: Fri, 26 Apr 2024 18:39:24 -0700 Subject: [PATCH 14/21] Remove prints and fix style --- Src/EB/AMReX_EB2_3D_C.cpp | 64 +++------------------------------------ 1 file changed, 4 insertions(+), 60 deletions(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index ce5abdc17d7..79be288b79f 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -38,20 +38,7 @@ void set_eb_data (const int i, const int j, const int k, Array4 const& bnorm, Real small_volfrac, bool& is_small_cell, bool& is_multicut) noexcept { - Print()< 0.0_rt) ? 1.0_rt : -1.0_rt; Real x_ym = (-0.5_rt + aym/dx[0]/dx[2])*signx; Real x_yp = (-0.5_rt + ayp/dx[0]/dx[2])*signx; - Print()<<"x_ym "< Date: Sun, 28 Apr 2024 08:25:16 -0700 Subject: [PATCH 15/21] Fix barea factors to match orig --- Src/EB/AMReX_EB2_3D_C.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index 79be288b79f..909fb7cf8e5 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -111,7 +111,7 @@ void set_eb_data (const int i, const int j, const int k, bnorm(i,j,k,0) = nx; bnorm(i,j,k,1) = ny; bnorm(i,j,k,2) = nz; - barea(i,j,k) = (nx*dapx*dx[0]*dx[0] + ny*dapy*dx[1]*dx[1] + nz*dapz*dx[2]*dx[2])*apnorminv*apnorminv; + barea(i,j,k) = (nx*dapx/dx[1]/dx[2] + ny*dapy/dx[0]/dx[2] + nz*dapz/dx[0]/dx[1]); // barea(i,j,k) = (nx*dapx*dx[0]*dx[0] + ny*dapy*dx[1]*dx[1] + nz*dapz*dx[2]*dx[2])/bareascaling; Real aaxo = 0.5_rt*(axm+axp); From 76dfadcad54459cf09891ecb6139af8f2678fdf4 Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Sun, 28 Apr 2024 12:37:10 -0700 Subject: [PATCH 16/21] Cleanup --- Src/EB/AMReX_EB2_2D_C.cpp | 6 +- Src/EB/AMReX_EB2_3D_C.cpp | 73 ++++------- Src/EB/AMReX_EB_FluxRedistribute.cpp | 4 +- Src/EB/AMReX_EB_Redistribution.cpp | 4 +- Tests/EB_CNS/Exec/Sod/inputs_flat | 119 ------------------ Tests/EB_CNS/Exec/Sod/inputs_flat_2d | 81 ------------ Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y | 81 ------------ .../EB_CNS/Exec/Sod/inputs_flat_2d_1y_newbox | 81 ------------ Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z | 81 ------------ .../EB_CNS/Exec/Sod/inputs_flat_2d_1z_newbox | 81 ------------ Tests/EB_CNS/Exec/Sod/inputs_flat_2d_all | 81 ------------ Tests/EB_CNS/Source/CNS.cpp | 3 +- 12 files changed, 31 insertions(+), 664 deletions(-) delete mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat delete mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d delete mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y delete mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y_newbox delete mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z delete mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z_newbox delete mode 100644 Tests/EB_CNS/Exec/Sod/inputs_flat_2d_all diff --git a/Src/EB/AMReX_EB2_2D_C.cpp b/Src/EB/AMReX_EB2_2D_C.cpp index c37b1fe0881..b2bbde200c5 100644 --- a/Src/EB/AMReX_EB2_2D_C.cpp +++ b/Src/EB/AMReX_EB2_2D_C.cpp @@ -20,6 +20,7 @@ void set_eb_data (const int i, const int j, constexpr Real small = 1.e-14; constexpr Real tiny = 1.e-15; #endif + const Real axm = apx(i ,j ,0)*dx[1]; const Real axp = apx(i+1,j ,0)*dx[1]; const Real aym = apy(i ,j ,0)*dx[0]; @@ -81,9 +82,6 @@ void set_eb_data (const int i, const int j, barea(i,j,0) = (nx*daxp + ny*dayp)/bareascaling; bcent(i,j,0,0) = 0.5_rt*(x_ym+x_yp); bcent(i,j,0,1) = 0.5_rt*(y_xm+y_xp); - Real aax = 0.5_rt*(axm+axp)/dx[1]; - Real Bx = -nx*aax; - bnorm(i,j,0,0) = nx; bnorm(i,j,0,1) = ny; @@ -137,8 +135,6 @@ void set_eb_data (const int i, const int j, } bcent(i,j,0,0) /= dx[0]; bcent(i,j,0,1) /= dx[1]; - if(i==33&&j==7) - Abort("33 7 0"); } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index 909fb7cf8e5..ecf903fbf9f 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -38,7 +38,6 @@ void set_eb_data (const int i, const int j, const int k, Array4 const& bnorm, Real small_volfrac, bool& is_small_cell, bool& is_multicut) noexcept { - const Real axm = apx(i ,j ,k )*dx[1]*dx[2]; const Real axp = apx(i+1,j ,k )*dx[1]*dx[2]; const Real aym = apy(i ,j ,k )*dx[0]*dx[2]; @@ -86,8 +85,6 @@ void set_eb_data (const int i, const int j, const int k, Real dapx = axm - axp; Real dapy = aym - ayp; Real dapz = azm - azp; - - const Real apnorm = std::hypot(dapx,dapy,dapz) + 1.e-30_rt*std::sqrt(dx[0]*dx[1]*dx[2]); if (apnorm == 0.0_rt) { bool maybe_multi_cuts = (axm == 0.0_rt && axp == 0.0_rt) || @@ -112,30 +109,19 @@ void set_eb_data (const int i, const int j, const int k, bnorm(i,j,k,1) = ny; bnorm(i,j,k,2) = nz; barea(i,j,k) = (nx*dapx/dx[1]/dx[2] + ny*dapy/dx[0]/dx[2] + nz*dapz/dx[0]/dx[1]); - // barea(i,j,k) = (nx*dapx*dx[0]*dx[0] + ny*dapy*dx[1]*dx[1] + nz*dapz*dx[2]*dx[2])/bareascaling; - - Real aaxo = 0.5_rt*(axm+axp); - Real aayo = 0.5_rt*(aym+ayp); - Real aazo = 0.5_rt*(azm+azp); - Real aax = 0.5_rt*(axm+axp)/dx[1]/dx[2]; - Real aay = 0.5_rt*(aym+ayp)/dx[0]/dx[2]; - Real aaz = 0.5_rt*(azm+azp)/dx[0]/dx[1]; + Real aax = 0.5_rt*(axm+axp); + Real aay = 0.5_rt*(aym+ayp); + Real aaz = 0.5_rt*(azm+azp); Real B0 = aax + aay + aaz; - Real Bxo = -nx*aaxo + ny*(aym*fcy(i,j,k,0)-ayp*fcy(i,j+1,k,0)) - + nz*(azm*fcz(i,j,k,0)-azp*fcz(i,j,k+1,0)); - Real Byo = -ny*aayo + nx*(axm*fcx(i,j,k,0)-axp*fcx(i+1,j,k,0)) - + nz*(azm*fcz(i,j,k,1)-azp*fcz(i,j,k+1,1)); - Real Bzo = -nz*aazo + nx*(axm*fcx(i,j,k,1)-axp*fcx(i+1,j,k,1)) - + ny*(aym*fcy(i,j,k,1)-ayp*fcy(i,j+1,k,1)); - Real Bx = -nx*aax + ny*(aym*fcy(i,j,k,0)-ayp*fcy(i,j+1,k,0))/dx[0]/dx[2] - + nz*(azm*fcz(i,j,k,0)-azp*fcz(i,j,k+1,0))/dx[0]/dx[1]; - Real By = -ny*aay + nx*(axm*fcx(i,j,k,0)-axp*fcx(i+1,j,k,0))/dx[1]/dx[2] - + nz*(azm*fcz(i,j,k,1)-azp*fcz(i,j,k+1,1))/dx[0]/dx[1]; - Real Bz = -nz*aaz + nx*(axm*fcx(i,j,k,1)-axp*fcx(i+1,j,k,1))/dx[1]/dx[2] - + ny*(aym*fcy(i,j,k,1)-ayp*fcy(i,j+1,k,1))/dx[0]/dx[2]; - - vfrac(i,j,k) = 0.5_rt*(B0 + nx*Bxo/(dx[1]*dx[2]) + ny*Byo/(dx[0]*dx[2]) + nz*Bzo/(dx[0]*dx[1])); + Real Bx = -nx*aax + ny*(aym*fcy(i,j,k,0)-ayp*fcy(i,j+1,k,0)) + + nz*(azm*fcz(i,j,k,0)-azp*fcz(i,j,k+1,0)); + Real By = -ny*aay + nx*(axm*fcx(i,j,k,0)-axp*fcx(i+1,j,k,0)) + + nz*(azm*fcz(i,j,k,1)-azp*fcz(i,j,k+1,1)); + Real Bz = -nz*aaz + nx*(axm*fcx(i,j,k,1)-axp*fcx(i+1,j,k,1)) + + ny*(aym*fcy(i,j,k,1)-ayp*fcy(i,j+1,k,1)); + + vfrac(i,j,k) = 0.5_rt*(B0 + nx*Bx/(dx[1]*dx[2]) + ny*By/(dx[0]*dx[2]) + nz*Bz/(dx[0]*dx[1])); // remove small cell if (vfrac(i,j,k) < small_volfrac) { @@ -143,16 +129,12 @@ void set_eb_data (const int i, const int j, const int k, is_small_cell = true; return; } - //apnorm*apnorm/barea(i,j,k) + Real bainv = bareascaling*bareascaling/apnorm; - bcent(i,j,k,0) = bainv * (Bxo/(dx[1]*dx[2]) + nx*vfrac(i,j,k)); - bcent(i,j,k,0) = bainv * (Bxo/(dx[1]*dx[2]) + nx*vfrac(i,j,k)); - Real signx = (nx > 0.0_rt) ? 1.0_rt : -1.0_rt; - Real x_ym = (-0.5_rt + aym/dx[0]/dx[2])*signx; - Real x_yp = (-0.5_rt + ayp/dx[0]/dx[2])*signx; - - bcent(i,j,k,1) = bainv * (Byo/(dx[0]*dx[2]) + ny*vfrac(i,j,k)); - bcent(i,j,k,2) = bainv * (Bzo/(dx[0]*dx[1]) + nz*vfrac(i,j,k)); + bcent(i,j,k,0) = bainv * (Bx/(dx[1]*dx[2]) + nx*vfrac(i,j,k)); + bcent(i,j,k,1) = bainv * (By/(dx[0]*dx[2]) + ny*vfrac(i,j,k)); + bcent(i,j,k,2) = bainv * (Bz/(dx[0]*dx[1]) + nz*vfrac(i,j,k)); + Real b1 = 0.5_rt*(axp-axm)/dx[1]/dx[2] + 0.5_rt*(ayp*fcy(i,j+1,k,0) + aym*fcy(i,j,k,0))/dx[0]/dx[2] + 0.5_rt*(azp*fcz(i,j,k+1,0) + azm*fcz(i,j,k,0))/dx[0]/dx[1]; Real b2 = 0.5_rt*(axp*fcx(i+1,j,k,0) + axm*fcx(i,j,k,0))/dx[1]/dx[2] + 0.5_rt*(ayp-aym)/dx[0]/dx[2] + 0.5_rt*(azp*fcz(i,j,k+1,1) + azm*fcz(i,j,k,1))/dx[0]/dx[1]; Real b3 = 0.5_rt*(axp*fcx(i+1,j,k,1) + axm*fcx(i,j,k,1))/dx[1]/dx[2] + 0.5_rt*(ayp*fcy(i,j+1,k,1) + aym*fcy(i,j,k,1))/dx[0]/dx[2] + 0.5_rt*(azp-azm)/dx[0]/dx[1]; @@ -162,6 +144,7 @@ void set_eb_data (const int i, const int j, const int k, Real b7 = -nx*0.5_rt*(axp*fcx(i+1,j,k,0) + axm*fcx(i,j,k,0))/dx[1]/dx[2] - ny*0.5_rt*(ayp*fcy(i,j+1,k,0) + aym*fcy(i,j,k,0))/dx[0]/dx[2] - nz*(m2z(i,j,k+1,2) - m2z(i,j,k,2)); Real b8 = -nx*0.5_rt*(axp*fcx(i+1,j,k,1) + axm*fcx(i,j,k,1))/dx[1]/dx[2] - ny*(m2y(i,j+1,k,2) - m2y(i,j,k,2)) - nz*0.5_rt*(azp*fcz(i,j,k+1,0) + azm*fcz(i,j,k,0))/dx[0]/dx[1]; Real b9 = -nx*(m2x(i+1,j,k,2) - m2x(i,j,k,2)) - ny*0.5_rt*(ayp*fcy(i,j+1,k,1) + aym*fcy(i,j,k,1))/dx[0]/dx[2] - nz*0.5_rt*(azp*fcz(i,j,k+1,1) + azm*fcz(i,j,k,1))/dx[0]/dx[1]; + Real ny2 = ny*ny; Real ny3 = ny2*ny; Real ny4 = ny3*ny; @@ -169,6 +152,7 @@ void set_eb_data (const int i, const int j, const int k, Real nz3 = nz2*nz; Real nz4 = nz3*nz; Real nz5 = nz4*nz; + Real Sx = (5._rt*(b1*(5._rt - 3._rt*ny2) + 2._rt*b4*nx*(5._rt - 3._rt*ny2) + ny*(nx*(b2 + 2._rt*b5*ny) + b7*(6._rt - 4._rt*ny2))) + (2._rt*b8*(15._rt - 11._rt*ny2 + ny4) + @@ -199,21 +183,14 @@ void set_eb_data (const int i, const int j, const int k, 2._rt*(-5._rt*b4 + 15._rt*b6 + (b2 + b7*nx)*ny + 2._rt*(b4 + b5 - 4._rt*b6)*ny2)*nz3 + 2._rt*b9*ny*nz4); - Real deno = 1._rt / (10._rt*(5._rt + 4._rt*nz2 - 4._rt*nz4 + 2._rt*ny4*(-2._rt + nz2) + - 2._rt*ny2*(2._rt - 3._rt*nz2 + nz4)) * (vfrac(i,j,k)+1.e-30_rt) ); Real den = 1._rt / (10._rt*(5._rt + 4._rt*nz2 - 4._rt*nz4 + 2._rt*ny4*(-2._rt + nz2) + - 2._rt*ny2*(2._rt - 3._rt*nz2 + nz4)) * (vfrac(i,j,k)+1.e-30_rt) ) / (dx[0]*dx[1]*dx[2]); - - vcent(i,j,k,0) = Sx * deno; - vcent(i,j,k,1) = Sy * deno; - vcent(i,j,k,2) = Sz * deno; - /* - bcent(i,j,k,0) *= dapx!=0 ? Math::abs(dx[0]/(dapx)) : 1e34; - bcent(i,j,k,1) *= dapy!=0 ? Math::abs(dx[1]/(dapy)) : 1e34; - bcent(i,j,k,2) *= dapz!=0 ? Math::abs(dx[2]/(dapz)) : 1e34; - */ -// if(i==19&&j==20&&k==0) -// Abort("19 20 0"); + 2._rt*ny2*(2._rt - 3._rt*nz2 + nz4)) * (vfrac(i,j,k)+1.e-30_rt) ); + + vcent(i,j,k,0) = Sx * den; + vcent(i,j,k,1) = Sy * den; + vcent(i,j,k,2) = Sz * den; + + } AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE diff --git a/Src/EB/AMReX_EB_FluxRedistribute.cpp b/Src/EB/AMReX_EB_FluxRedistribute.cpp index 8ed085da541..409576977d7 100644 --- a/Src/EB/AMReX_EB_FluxRedistribute.cpp +++ b/Src/EB/AMReX_EB_FluxRedistribute.cpp @@ -32,7 +32,7 @@ amrex_flux_redistribute ( // Check that grid is uniform // const Real* dx = geom.CellSize(); - /* + #if (AMREX_SPACEDIM == 2) if (! amrex::almostEqual(dx[0], dx[1])) #elif (AMREX_SPACEDIM == 3) @@ -42,7 +42,7 @@ amrex_flux_redistribute ( { amrex::Abort("apply_eb_redistribution(): grid spacing must be uniform"); } -*/ + const Box dbox1 = geom.growPeriodicDomain(1); const Box dbox2 = geom.growPeriodicDomain(2); diff --git a/Src/EB/AMReX_EB_Redistribution.cpp b/Src/EB/AMReX_EB_Redistribution.cpp index ffc3385c528..0bfcefa61c1 100644 --- a/Src/EB/AMReX_EB_Redistribution.cpp +++ b/Src/EB/AMReX_EB_Redistribution.cpp @@ -31,7 +31,7 @@ namespace amrex { // Check that grid is uniform // const Real* dx = geom.CellSize(); -/* + #if (AMREX_SPACEDIM == 2) if (! amrex::almostEqual(dx[0], dx[1])) { amrex::Abort("apply_eb_redistribution(): grid spacing must be uniform"); @@ -42,7 +42,7 @@ namespace amrex { amrex::Abort("apply_eb_redistribution(): grid spacing must be uniform"); } #endif -*/ + // // Get array4 from arguments // diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat b/Tests/EB_CNS/Exec/Sod/inputs_flat deleted file mode 100644 index a6fb2aa11d3..00000000000 --- a/Tests/EB_CNS/Exec/Sod/inputs_flat +++ /dev/null @@ -1,119 +0,0 @@ -amrex.fpe_trap_invalid=1 - -max_step = 100 -stop_time = 0.2 - -geometry.is_periodic = 0 0 0 -geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical -geometry.prob_lo = 0.0 0.0 0.0 -geometry.prob_hi = 1.0 0.125 0.125 -amr.n_cell = 32 4 4 - -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -# 0 = Interior 3 = Symmetry -# 1 = Inflow 4 = SlipWall -# 2 = Outflow 5 = NoSlipWall -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -cns.lo_bc = 2 4 4 -cns.hi_bc = 2 4 4 - -cns.cfl = 0.3 # cfl number for hyperbolic system - -cns.v = 2 -amr.v = 1 - -# LOAD BALANCE -amr.loadbalance_with_workestimates = 1 -amr.loadbalance_level0_int = 1000 - -# REFINEMENT / REGRIDDING -amr.max_level = 1 # 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 = 4 -amr.max_grid_size = 16 -amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est -amr.grid_eff = 0.99 # what constitutes an efficient grid - -# CHECKPOINT FILES -amr.checkpoint_files_output = 0 -amr.check_file = chk # root name of checkpoint file -amr.check_int = 100 # number of timesteps between checkpoints - -# PLOTFILES -amr.plot_files_output = 1 -amr.plot_file = plt # root name of plotfile -amr.plot_int = 10 # number of timesteps between plotfiles -amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity - -# EB -eb2.sphere_radius = 0.125 -#eb2.sphere_center = 0.45 0.65 0.54 -#eb2.sphere_center = 0.5 0.5 0.5 -eb2.sphere_center = 0.7 0.5 0.5 -eb2.sphere_has_fluid_inside = 0 - -eb2.geom_type = sphere -#eb2.geom_type = all_regular - -cns.refine_cutcells = 0 - -cns.do_visc = true -#cns.use_const_visc = false -#cns.const_visc_mu = 0.001 -#cns.const_visc_ki = 0.0 -#cns.const_lambda = 0.0 - -# case 1: a single box at the top y-boundary -#cns.refine_box_lo_0 = 0.45 0.90 0.45 -#cns.refine_box_hi_0 = 0.55 0.92 0.55 - -# case 2: two boxes, one at the top, the other at the bottom -cns.refine_box_lo_0 = 0.45 0.85 0.45 -cns.refine_box_hi_0 = 0.55 0.99 0.55 - -# case 3: similar to case 2, but the bottom box is wider -#cns.refine_box_lo_0 = 0.45 0.85 0.45 -#cns.refine_box_hi_0 = 0.55 0.99 0.55 -# -#cns.refine_box_lo_1 = 0.45 0.08 0.35 -#cns.refine_box_hi_1 = 0.55 0.10 0.65 - -# case 4: at the corner -#cns.refine_box_lo_0 = 0.85 0.85 0.85 -#cns.refine_box_hi_0 = 0.99 0.99 0.99 - -# case 5 : very wide box -#cns.refine_box_lo_0 = 0.0 0.90 0.0 -#cns.refine_box_hi_0 = 1.0 0.92 1.0 - -# case 6 : a box at the center -cns.refine_box_lo_0 = 0.48 0.048 0.048 -cns.refine_box_hi_0 = 0.52 0.052 0.052 -cns.refine_box_lo_0 = 0.48 0.048 0.0 -cns.refine_box_hi_0 = 0.52 0.052 0.0 -amr.blocking_factor = 4 -amr.max_grid_size = 64 - -# case 7 : refine everywhere -#cns.refine_box_lo_0 = 0. 0. 0. -#cns.refine_box_hi_0 = 1. 1. 1. -#geometry.is_periodic = 0 0 0 -#cns.lo_bc = 2 2 2 -#cns.hi_bc = 2 2 2 - -# -#cns.refine_box_lo_0 = 0.55 0.5 0.3 -#cns.refine_box_hi_0 = 0.85 0.65 0.7 -#amr.blocking_factor = 16 -#amr.max_grid_size = 64 - -# problem specific parameter -prob.p_l = 1.0 -prob.p_r = 0.1 -prob.rho_l = 1.0 -prob.rho_r = 0.125 -prob.u_l = 0.0 -prob.u_r = 0.0 - diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d deleted file mode 100644 index 8ca451de5ed..00000000000 --- a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d +++ /dev/null @@ -1,81 +0,0 @@ -amrex.fpe_trap_invalid=1 - -max_step = 100 -stop_time = 0.2 - -geometry.is_periodic = 0 0 0 -geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical -geometry.prob_lo = 0.0 0.0 0.0 -geometry.prob_hi = 64 4 8 -amr.n_cell = 32 4 4 - -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -# 0 = Interior 3 = Symmetry -# 1 = Inflow 4 = SlipWall -# 2 = Outflow 5 = NoSlipWall -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -cns.lo_bc = 2 4 4 -cns.hi_bc = 2 4 4 - -cns.cfl = 0.3 # cfl number for hyperbolic system - -cns.v = 2 -amr.v = 1 - -# LOAD BALANCE -amr.loadbalance_with_workestimates = 1 -amr.loadbalance_level0_int = 1000 - -# REFINEMENT / REGRIDDING -amr.max_level = 1 # 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 = 4 -amr.max_grid_size = 16 -amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est -amr.grid_eff = 0.99 # what constitutes an efficient grid - -# CHECKPOINT FILES -amr.checkpoint_files_output = 0 -amr.check_file = chk # root name of checkpoint file -amr.check_int = 100 # number of timesteps between checkpoints - -# PLOTFILES -amr.plot_files_output = 1 -amr.plot_file = plt # root name of plotfile -amr.plot_int = 10 # number of timesteps between plotfiles -amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity - -# EB -eb2.sphere_radius = 0.03125 -#eb2.sphere_center = 0.45 0.65 0.54 -#eb2.sphere_center = 0.5 0.5 0.5 -eb2.sphere_center = 0.5 0.0625 0.0625 -eb2.box_has_fluid_inside = 0 - -eb2.geom_type = box -#eb2.geom_type = all_regular -eb2.box_lo = 0.48 0.046875 0.0 -eb2.box_hi = 0.52 0.078125 0.03125 -#eb2.box_hi = 0.52 0.078125 0.0 - -eb2.box_lo = 31 1 0 -eb2.box_hi = 36 3 2 - -cns.refine_cutcells = 0 - -cns.do_visc = true -#cns.use_const_visc = false -#cns.const_visc_mu = 0.001 -#cns.const_visc_ki = 0.0 -#cns.const_lambda = 0.0 - -# problem specific parameter -prob.p_l = 1.0 -prob.p_r = 0.1 -prob.rho_l = 1.0 -prob.rho_r = 0.125 -prob.u_l = 0.0 -prob.u_r = 0.0 - diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y deleted file mode 100644 index 8ca451de5ed..00000000000 --- a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y +++ /dev/null @@ -1,81 +0,0 @@ -amrex.fpe_trap_invalid=1 - -max_step = 100 -stop_time = 0.2 - -geometry.is_periodic = 0 0 0 -geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical -geometry.prob_lo = 0.0 0.0 0.0 -geometry.prob_hi = 64 4 8 -amr.n_cell = 32 4 4 - -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -# 0 = Interior 3 = Symmetry -# 1 = Inflow 4 = SlipWall -# 2 = Outflow 5 = NoSlipWall -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -cns.lo_bc = 2 4 4 -cns.hi_bc = 2 4 4 - -cns.cfl = 0.3 # cfl number for hyperbolic system - -cns.v = 2 -amr.v = 1 - -# LOAD BALANCE -amr.loadbalance_with_workestimates = 1 -amr.loadbalance_level0_int = 1000 - -# REFINEMENT / REGRIDDING -amr.max_level = 1 # 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 = 4 -amr.max_grid_size = 16 -amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est -amr.grid_eff = 0.99 # what constitutes an efficient grid - -# CHECKPOINT FILES -amr.checkpoint_files_output = 0 -amr.check_file = chk # root name of checkpoint file -amr.check_int = 100 # number of timesteps between checkpoints - -# PLOTFILES -amr.plot_files_output = 1 -amr.plot_file = plt # root name of plotfile -amr.plot_int = 10 # number of timesteps between plotfiles -amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity - -# EB -eb2.sphere_radius = 0.03125 -#eb2.sphere_center = 0.45 0.65 0.54 -#eb2.sphere_center = 0.5 0.5 0.5 -eb2.sphere_center = 0.5 0.0625 0.0625 -eb2.box_has_fluid_inside = 0 - -eb2.geom_type = box -#eb2.geom_type = all_regular -eb2.box_lo = 0.48 0.046875 0.0 -eb2.box_hi = 0.52 0.078125 0.03125 -#eb2.box_hi = 0.52 0.078125 0.0 - -eb2.box_lo = 31 1 0 -eb2.box_hi = 36 3 2 - -cns.refine_cutcells = 0 - -cns.do_visc = true -#cns.use_const_visc = false -#cns.const_visc_mu = 0.001 -#cns.const_visc_ki = 0.0 -#cns.const_lambda = 0.0 - -# problem specific parameter -prob.p_l = 1.0 -prob.p_r = 0.1 -prob.rho_l = 1.0 -prob.rho_r = 0.125 -prob.u_l = 0.0 -prob.u_r = 0.0 - diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y_newbox b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y_newbox deleted file mode 100644 index 2af4bf93768..00000000000 --- a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1y_newbox +++ /dev/null @@ -1,81 +0,0 @@ -amrex.fpe_trap_invalid=1 - -max_step = 100 -stop_time = 0.2 - -geometry.is_periodic = 0 0 1 -geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical -geometry.prob_lo = 0.0 0.0 0.0 -geometry.prob_hi = 64 4 8 -amr.n_cell = 32 4 4 - -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -# 0 = Interior 3 = Symmetry -# 1 = Inflow 4 = SlipWall -# 2 = Outflow 5 = NoSlipWall -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -cns.lo_bc = 2 2 4 -cns.hi_bc = 2 2 4 - -cns.cfl = 0.3 # cfl number for hyperbolic system - -cns.v = 2 -amr.v = 1 - -# LOAD BALANCE -amr.loadbalance_with_workestimates = 1 -amr.loadbalance_level0_int = 1000 - -# REFINEMENT / REGRIDDING -amr.max_level = 1 # 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 = 4 -amr.max_grid_size = 16 -amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est -amr.grid_eff = 0.99 # what constitutes an efficient grid - -# CHECKPOINT FILES -amr.checkpoint_files_output = 0 -amr.check_file = chk # root name of checkpoint file -amr.check_int = 100 # number of timesteps between checkpoints - -# PLOTFILES -amr.plot_files_output = 1 -amr.plot_file = plt # root name of plotfile -amr.plot_int = 10 # number of timesteps between plotfiles -amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity - -# EB -eb2.sphere_radius = 0.03125 -#eb2.sphere_center = 0.45 0.65 0.54 -#eb2.sphere_center = 0.5 0.5 0.5 -eb2.sphere_center = 0.5 0.0625 0.0625 -eb2.box_has_fluid_inside = 0 - -eb2.geom_type = box -#eb2.geom_type = all_regular -eb2.box_lo = 0.48 0.046875 0.0 -eb2.box_hi = 0.52 0.078125 0.03125 -#eb2.box_hi = 0.52 0.078125 0.0 - -eb2.box_lo = 31 1 0 -eb2.box_hi = 36 3 4 - -cns.refine_cutcells = 0 - -cns.do_visc = true -#cns.use_const_visc = false -#cns.const_visc_mu = 0.001 -#cns.const_visc_ki = 0.0 -#cns.const_lambda = 0.0 - -# problem specific parameter -prob.p_l = 1.0 -prob.p_r = 0.1 -prob.rho_l = 1.0 -prob.rho_r = 0.125 -prob.u_l = 0.0 -prob.u_r = 0.0 - diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z deleted file mode 100644 index b69c32a3a0a..00000000000 --- a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z +++ /dev/null @@ -1,81 +0,0 @@ -amrex.fpe_trap_invalid=1 - -max_step = 100 -stop_time = 0.2 - -geometry.is_periodic = 0 0 0 -geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical -geometry.prob_lo = 0.0 0.0 0.0 -geometry.prob_hi = 64 8 4 -amr.n_cell = 32 4 4 - -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -# 0 = Interior 3 = Symmetry -# 1 = Inflow 4 = SlipWall -# 2 = Outflow 5 = NoSlipWall -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -cns.lo_bc = 2 4 4 -cns.hi_bc = 2 4 4 - -cns.cfl = 0.3 # cfl number for hyperbolic system - -cns.v = 2 -amr.v = 1 - -# LOAD BALANCE -amr.loadbalance_with_workestimates = 1 -amr.loadbalance_level0_int = 1000 - -# REFINEMENT / REGRIDDING -amr.max_level = 1 # 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 = 4 -amr.max_grid_size = 16 -amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est -amr.grid_eff = 0.99 # what constitutes an efficient grid - -# CHECKPOINT FILES -amr.checkpoint_files_output = 0 -amr.check_file = chk # root name of checkpoint file -amr.check_int = 100 # number of timesteps between checkpoints - -# PLOTFILES -amr.plot_files_output = 1 -amr.plot_file = plt # root name of plotfile -amr.plot_int = 10 # number of timesteps between plotfiles -amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity - -# EB -eb2.sphere_radius = 0.03125 -#eb2.sphere_center = 0.45 0.65 0.54 -#eb2.sphere_center = 0.5 0.5 0.5 -eb2.sphere_center = 0.5 0.0625 0.0625 -eb2.box_has_fluid_inside = 0 - -eb2.geom_type = box -#eb2.geom_type = all_regular -eb2.box_lo = 0.48 0.046875 0.0 -eb2.box_hi = 0.52 0.078125 0.03125 -#eb2.box_hi = 0.52 0.078125 0.0 - -eb2.box_lo = 31 1 0 -eb2.box_hi = 36 3 2 - -cns.refine_cutcells = 0 - -cns.do_visc = true -#cns.use_const_visc = false -#cns.const_visc_mu = 0.001 -#cns.const_visc_ki = 0.0 -#cns.const_lambda = 0.0 - -# problem specific parameter -prob.p_l = 1.0 -prob.p_r = 0.1 -prob.rho_l = 1.0 -prob.rho_r = 0.125 -prob.u_l = 0.0 -prob.u_r = 0.0 - diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z_newbox b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z_newbox deleted file mode 100644 index 0aa03da218c..00000000000 --- a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_1z_newbox +++ /dev/null @@ -1,81 +0,0 @@ -amrex.fpe_trap_invalid=1 - -max_step = 100 -stop_time = 0.2 - -geometry.is_periodic = 0 0 0 -geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical -geometry.prob_lo = 0.0 0.0 0.0 -geometry.prob_hi = 64 8 4 -amr.n_cell = 32 4 4 - -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -# 0 = Interior 3 = Symmetry -# 1 = Inflow 4 = SlipWall -# 2 = Outflow 5 = NoSlipWall -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -cns.lo_bc = 2 4 4 -cns.hi_bc = 2 4 4 - -cns.cfl = 0.3 # cfl number for hyperbolic system - -cns.v = 2 -amr.v = 1 - -# LOAD BALANCE -amr.loadbalance_with_workestimates = 1 -amr.loadbalance_level0_int = 1000 - -# REFINEMENT / REGRIDDING -amr.max_level = 1 # 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 = 4 -amr.max_grid_size = 16 -amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est -amr.grid_eff = 0.99 # what constitutes an efficient grid - -# CHECKPOINT FILES -amr.checkpoint_files_output = 0 -amr.check_file = chk # root name of checkpoint file -amr.check_int = 100 # number of timesteps between checkpoints - -# PLOTFILES -amr.plot_files_output = 1 -amr.plot_file = plt # root name of plotfile -amr.plot_int = 10 # number of timesteps between plotfiles -amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity - -# EB -eb2.sphere_radius = 0.03125 -#eb2.sphere_center = 0.45 0.65 0.54 -#eb2.sphere_center = 0.5 0.5 0.5 -eb2.sphere_center = 0.5 0.0625 0.0625 -eb2.box_has_fluid_inside = 0 - -eb2.geom_type = box -#eb2.geom_type = all_regular -eb2.box_lo = 0.48 0.046875 0.0 -eb2.box_hi = 0.52 0.078125 0.03125 -#eb2.box_hi = 0.52 0.078125 0.0 - -eb2.box_lo = 31 1 0 -eb2.box_hi = 36 3 3 - -cns.refine_cutcells = 0 - -cns.do_visc = true -#cns.use_const_visc = false -#cns.const_visc_mu = 0.001 -#cns.const_visc_ki = 0.0 -#cns.const_lambda = 0.0 - -# problem specific parameter -prob.p_l = 1.0 -prob.p_r = 0.1 -prob.rho_l = 1.0 -prob.rho_r = 0.125 -prob.u_l = 0.0 -prob.u_r = 0.0 - diff --git a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_all b/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_all deleted file mode 100644 index 2d33a226253..00000000000 --- a/Tests/EB_CNS/Exec/Sod/inputs_flat_2d_all +++ /dev/null @@ -1,81 +0,0 @@ -amrex.fpe_trap_invalid=1 - -max_step = 100 -stop_time = 0.2 - -geometry.is_periodic = 0 0 0 -geometry.coord_sys = 0 # 0 => cart, 1 => RZ 2=>spherical -geometry.prob_lo = 0.0 0.0 0.0 -geometry.prob_hi = 64 8 8 -amr.n_cell = 32 4 4 - -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -# 0 = Interior 3 = Symmetry -# 1 = Inflow 4 = SlipWall -# 2 = Outflow 5 = NoSlipWall -# >>>>>>>>>>>>> BC FLAGS <<<<<<<<<<<<<<<< -cns.lo_bc = 2 4 4 -cns.hi_bc = 2 4 4 - -cns.cfl = 0.3 # cfl number for hyperbolic system - -cns.v = 2 -amr.v = 1 - -# LOAD BALANCE -amr.loadbalance_with_workestimates = 1 -amr.loadbalance_level0_int = 1000 - -# REFINEMENT / REGRIDDING -amr.max_level = 1 # 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 = 4 -amr.max_grid_size = 16 -amr.n_error_buf = 0 0 0 0 # number of buffer cells in error est -amr.grid_eff = 0.99 # what constitutes an efficient grid - -# CHECKPOINT FILES -amr.checkpoint_files_output = 0 -amr.check_file = chk # root name of checkpoint file -amr.check_int = 100 # number of timesteps between checkpoints - -# PLOTFILES -amr.plot_files_output = 1 -amr.plot_file = plt # root name of plotfile -amr.plot_int = 10 # number of timesteps between plotfiles -amr.derive_plot_vars = pressure x_velocity y_velocity z_velocity - -# EB -eb2.sphere_radius = 0.03125 -#eb2.sphere_center = 0.45 0.65 0.54 -#eb2.sphere_center = 0.5 0.5 0.5 -eb2.sphere_center = 0.5 0.0625 0.0625 -eb2.box_has_fluid_inside = 0 - -eb2.geom_type = box -#eb2.geom_type = all_regular -eb2.box_lo = 0.48 0.046875 0.0 -eb2.box_hi = 0.52 0.078125 0.03125 -#eb2.box_hi = 0.52 0.078125 0.0 - -eb2.box_lo = 31 1 0 -eb2.box_hi = 36 3 3 - -cns.refine_cutcells = 0 - -cns.do_visc = true -#cns.use_const_visc = false -#cns.const_visc_mu = 0.001 -#cns.const_visc_ki = 0.0 -#cns.const_lambda = 0.0 - -# problem specific parameter -prob.p_l = 1.0 -prob.p_r = 0.1 -prob.rho_l = 1.0 -prob.rho_r = 0.125 -prob.u_l = 0.0 -prob.u_r = 0.0 - diff --git a/Tests/EB_CNS/Source/CNS.cpp b/Tests/EB_CNS/Source/CNS.cpp index 919e715265c..40882a4edb0 100644 --- a/Tests/EB_CNS/Source/CNS.cpp +++ b/Tests/EB_CNS/Source/CNS.cpp @@ -485,7 +485,6 @@ CNS::buildMetrics () // make sure dx == dy == dz const Real* dx = geom.CellSize(); - /* #if (AMREX_SPACEDIM == 2) if (std::abs(dx[0]-dx[1]) > 1.e-12*dx[0]) amrex::Abort("CNS: must have dx == dy\n"); @@ -493,7 +492,7 @@ CNS::buildMetrics () if (std::abs(dx[0]-dx[1]) > 1.e-12*dx[0] || std::abs(dx[0]-dx[2]) > 1.e-12*dx[0]) amrex::Abort("CNS: must have dx == dy == dz\n"); #endif - */ + const auto& ebfactory = dynamic_cast(Factory()); volfrac = &(ebfactory.getVolFrac()); From 3baed63ebd0e369059ac3e6a48bd8bee7f2879b1 Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Sun, 28 Apr 2024 12:55:20 -0700 Subject: [PATCH 17/21] Cleanup part 2 --- Src/EB/AMReX_EB2_3D_C.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index ecf903fbf9f..be6bb81a0ef 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -113,7 +113,7 @@ void set_eb_data (const int i, const int j, const int k, Real aax = 0.5_rt*(axm+axp); Real aay = 0.5_rt*(aym+ayp); Real aaz = 0.5_rt*(azm+azp); - Real B0 = aax + aay + aaz; + Real B0 = aax/dx[1]/dx[2] + aay/dx[0]/dx[2] + aaz/dx[0]/dx[1]; Real Bx = -nx*aax + ny*(aym*fcy(i,j,k,0)-ayp*fcy(i,j+1,k,0)) + nz*(azm*fcz(i,j,k,0)-azp*fcz(i,j,k+1,0)); Real By = -ny*aay + nx*(axm*fcx(i,j,k,0)-axp*fcx(i+1,j,k,0)) From 0ea4e06dda14371622b3dd03b30ace7cfe230fa2 Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Sun, 28 Apr 2024 18:43:18 -0700 Subject: [PATCH 18/21] Change apnorm to use formula instead of hypot --- Src/EB/AMReX_EB2_3D_C.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index be6bb81a0ef..ac4bb23b6f5 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -85,7 +85,7 @@ void set_eb_data (const int i, const int j, const int k, Real dapx = axm - axp; Real dapy = aym - ayp; Real dapz = azm - azp; - const Real apnorm = std::hypot(dapx,dapy,dapz) + 1.e-30_rt*std::sqrt(dx[0]*dx[1]*dx[2]); + const Real apnorm = std::sqrt(dapx*dapx+dapy*dapy+dapz*dapz) + 1.e-30_rt*std::sqrt(dx[0]*dx[1]*dx[2]); if (apnorm == 0.0_rt) { bool maybe_multi_cuts = (axm == 0.0_rt && axp == 0.0_rt) || (aym == 0.0_rt && ayp == 0.0_rt) || From 1d7562d347c47c298f6459b8288dca61783a15ce Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Mon, 29 Apr 2024 13:26:17 -0700 Subject: [PATCH 19/21] Cleanup part 3 --- Src/EB/AMReX_EB2_3D_C.cpp | 49 ++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index ac4bb23b6f5..1ecd141f8b3 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -38,12 +38,12 @@ void set_eb_data (const int i, const int j, const int k, Array4 const& bnorm, Real small_volfrac, bool& is_small_cell, bool& is_multicut) noexcept { - const Real axm = apx(i ,j ,k )*dx[1]*dx[2]; - const Real axp = apx(i+1,j ,k )*dx[1]*dx[2]; - const Real aym = apy(i ,j ,k )*dx[0]*dx[2]; - const Real ayp = apy(i ,j+1,k )*dx[0]*dx[2]; - const Real azm = apz(i ,j ,k )*dx[0]*dx[1]; - const Real azp = apz(i ,j ,k+1)*dx[0]*dx[1]; + Real axm = apx(i ,j ,k )*dx[1]*dx[2]; + Real axp = apx(i+1,j ,k )*dx[1]*dx[2]; + Real aym = apy(i ,j ,k )*dx[0]*dx[2]; + Real ayp = apy(i ,j+1,k )*dx[0]*dx[2]; + Real azm = apz(i ,j ,k )*dx[0]*dx[1]; + Real azp = apz(i ,j ,k+1)*dx[0]*dx[1]; Real axmt = apx(i,j,k); Real axpt = apx(i+1,j,k); Real aymt = apy(i,j,k); @@ -110,10 +110,17 @@ void set_eb_data (const int i, const int j, const int k, bnorm(i,j,k,2) = nz; barea(i,j,k) = (nx*dapx/dx[1]/dx[2] + ny*dapy/dx[0]/dx[2] + nz*dapz/dx[0]/dx[1]); + axm = apx(i ,j ,k ); + axp = apx(i+1,j ,k ); + aym = apy(i ,j ,k ); + ayp = apy(i ,j+1,k ); + azm = apz(i ,j ,k ); + azp = apz(i ,j ,k+1); + Real aax = 0.5_rt*(axm+axp); Real aay = 0.5_rt*(aym+ayp); Real aaz = 0.5_rt*(azm+azp); - Real B0 = aax/dx[1]/dx[2] + aay/dx[0]/dx[2] + aaz/dx[0]/dx[1]; + Real B0 = aax + aay + aaz; Real Bx = -nx*aax + ny*(aym*fcy(i,j,k,0)-ayp*fcy(i,j+1,k,0)) + nz*(azm*fcz(i,j,k,0)-azp*fcz(i,j,k+1,0)); Real By = -ny*aay + nx*(axm*fcx(i,j,k,0)-axp*fcx(i+1,j,k,0)) @@ -121,7 +128,7 @@ void set_eb_data (const int i, const int j, const int k, Real Bz = -nz*aaz + nx*(axm*fcx(i,j,k,1)-axp*fcx(i+1,j,k,1)) + ny*(aym*fcy(i,j,k,1)-ayp*fcy(i,j+1,k,1)); - vfrac(i,j,k) = 0.5_rt*(B0 + nx*Bx/(dx[1]*dx[2]) + ny*By/(dx[0]*dx[2]) + nz*Bz/(dx[0]*dx[1])); + vfrac(i,j,k) = 0.5_rt*(B0 + nx*Bx + ny*By + nz*Bz); // remove small cell if (vfrac(i,j,k) < small_volfrac) { @@ -131,19 +138,19 @@ void set_eb_data (const int i, const int j, const int k, } Real bainv = bareascaling*bareascaling/apnorm; - bcent(i,j,k,0) = bainv * (Bx/(dx[1]*dx[2]) + nx*vfrac(i,j,k)); - bcent(i,j,k,1) = bainv * (By/(dx[0]*dx[2]) + ny*vfrac(i,j,k)); - bcent(i,j,k,2) = bainv * (Bz/(dx[0]*dx[1]) + nz*vfrac(i,j,k)); - - Real b1 = 0.5_rt*(axp-axm)/dx[1]/dx[2] + 0.5_rt*(ayp*fcy(i,j+1,k,0) + aym*fcy(i,j,k,0))/dx[0]/dx[2] + 0.5_rt*(azp*fcz(i,j,k+1,0) + azm*fcz(i,j,k,0))/dx[0]/dx[1]; - Real b2 = 0.5_rt*(axp*fcx(i+1,j,k,0) + axm*fcx(i,j,k,0))/dx[1]/dx[2] + 0.5_rt*(ayp-aym)/dx[0]/dx[2] + 0.5_rt*(azp*fcz(i,j,k+1,1) + azm*fcz(i,j,k,1))/dx[0]/dx[1]; - Real b3 = 0.5_rt*(axp*fcx(i+1,j,k,1) + axm*fcx(i,j,k,1))/dx[1]/dx[2] + 0.5_rt*(ayp*fcy(i,j+1,k,1) + aym*fcy(i,j,k,1))/dx[0]/dx[2] + 0.5_rt*(azp-azm)/dx[0]/dx[1]; - Real b4 = -nx*0.25_rt*(axp-axm)/dx[1]/dx[2] - ny*(m2y(i,j+1,k,0) - m2y(i,j,k,0)) - nz*(m2z(i,j,k+1,0) - m2z(i,j,k,0)); - Real b5 = -nx*(m2x(i+1,j,k,0) - m2x(i,j,k,0)) - ny*0.25_rt*(ayp-aym)/dx[0]/dx[2] - nz*(m2z(i,j,k+1,1) - m2z(i,j,k,1)); - Real b6 = -nx*(m2x(i+1,j,k,1) - m2x(i,j,k,1)) - ny*(m2y(i,j+1,k,1) - m2y(i,j,k,1)) - nz*0.25_rt*(azp-azm)/dx[0]/dx[1]; - Real b7 = -nx*0.5_rt*(axp*fcx(i+1,j,k,0) + axm*fcx(i,j,k,0))/dx[1]/dx[2] - ny*0.5_rt*(ayp*fcy(i,j+1,k,0) + aym*fcy(i,j,k,0))/dx[0]/dx[2] - nz*(m2z(i,j,k+1,2) - m2z(i,j,k,2)); - Real b8 = -nx*0.5_rt*(axp*fcx(i+1,j,k,1) + axm*fcx(i,j,k,1))/dx[1]/dx[2] - ny*(m2y(i,j+1,k,2) - m2y(i,j,k,2)) - nz*0.5_rt*(azp*fcz(i,j,k+1,0) + azm*fcz(i,j,k,0))/dx[0]/dx[1]; - Real b9 = -nx*(m2x(i+1,j,k,2) - m2x(i,j,k,2)) - ny*0.5_rt*(ayp*fcy(i,j+1,k,1) + aym*fcy(i,j,k,1))/dx[0]/dx[2] - nz*0.5_rt*(azp*fcz(i,j,k+1,1) + azm*fcz(i,j,k,1))/dx[0]/dx[1]; + bcent(i,j,k,0) = bainv * (Bx + nx*vfrac(i,j,k)); + bcent(i,j,k,1) = bainv * (By + ny*vfrac(i,j,k)); + bcent(i,j,k,2) = bainv * (Bz + nz*vfrac(i,j,k)); + + Real b1 = 0.5_rt*(axp-axm) + 0.5_rt*(ayp*fcy(i,j+1,k,0) + aym*fcy(i,j,k,0)) + 0.5_rt*(azp*fcz(i,j,k+1,0) + azm*fcz(i,j,k,0)); + Real b2 = 0.5_rt*(axp*fcx(i+1,j,k,0) + axm*fcx(i,j,k,0)) + 0.5_rt*(ayp-aym) + 0.5_rt*(azp*fcz(i,j,k+1,1) + azm*fcz(i,j,k,1)); + Real b3 = 0.5_rt*(axp*fcx(i+1,j,k,1) + axm*fcx(i,j,k,1)) + 0.5_rt*(ayp*fcy(i,j+1,k,1) + aym*fcy(i,j,k,1)) + 0.5_rt*(azp-azm); + Real b4 = -nx*0.25_rt*(axp-axm) - ny*(m2y(i,j+1,k,0) - m2y(i,j,k,0)) - nz*(m2z(i,j,k+1,0) - m2z(i,j,k,0)); + Real b5 = -nx*(m2x(i+1,j,k,0) - m2x(i,j,k,0)) - ny*0.25_rt*(ayp-aym) - nz*(m2z(i,j,k+1,1) - m2z(i,j,k,1)); + Real b6 = -nx*(m2x(i+1,j,k,1) - m2x(i,j,k,1)) - ny*(m2y(i,j+1,k,1) - m2y(i,j,k,1)) - nz*0.25_rt*(azp-azm); + Real b7 = -nx*0.5_rt*(axp*fcx(i+1,j,k,0) + axm*fcx(i,j,k,0)) - ny*0.5_rt*(ayp*fcy(i,j+1,k,0) + aym*fcy(i,j,k,0)) - nz*(m2z(i,j,k+1,2) - m2z(i,j,k,2)); + Real b8 = -nx*0.5_rt*(axp*fcx(i+1,j,k,1) + axm*fcx(i,j,k,1)) - ny*(m2y(i,j+1,k,2) - m2y(i,j,k,2)) - nz*0.5_rt*(azp*fcz(i,j,k+1,0) + azm*fcz(i,j,k,0)); + Real b9 = -nx*(m2x(i+1,j,k,2) - m2x(i,j,k,2)) - ny*0.5_rt*(ayp*fcy(i,j+1,k,1) + aym*fcy(i,j,k,1)) - nz*0.5_rt*(azp*fcz(i,j,k+1,1) + azm*fcz(i,j,k,1)); Real ny2 = ny*ny; Real ny3 = ny2*ny; From e2bd89340622fd0c7860c651bf82c44605689287 Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Mon, 29 Apr 2024 15:58:46 -0700 Subject: [PATCH 20/21] Remove redefinition --- Src/EB/AMReX_EB2_3D_C.cpp | 67 ++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 37 deletions(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index 1ecd141f8b3..aa86c8d0749 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -38,28 +38,28 @@ void set_eb_data (const int i, const int j, const int k, Array4 const& bnorm, Real small_volfrac, bool& is_small_cell, bool& is_multicut) noexcept { - Real axm = apx(i ,j ,k )*dx[1]*dx[2]; - Real axp = apx(i+1,j ,k )*dx[1]*dx[2]; - Real aym = apy(i ,j ,k )*dx[0]*dx[2]; - Real ayp = apy(i ,j+1,k )*dx[0]*dx[2]; - Real azm = apz(i ,j ,k )*dx[0]*dx[1]; - Real azp = apz(i ,j ,k+1)*dx[0]*dx[1]; - Real axmt = apx(i,j,k); - Real axpt = apx(i+1,j,k); - Real aymt = apy(i,j,k); - Real aypt = apy(i,j+1,k); - Real azmt = apz(i,j,k); - Real azpt = apz(i,j,k+1); + const Real axmt = apx(i ,j ,k )*dx[1]*dx[2]; + const Real axpt = apx(i+1,j ,k )*dx[1]*dx[2]; + const Real aymt = apy(i ,j ,k )*dx[0]*dx[2]; + const Real aypt = apy(i ,j+1,k )*dx[0]*dx[2]; + const Real azmt = apz(i ,j ,k )*dx[0]*dx[1]; + const Real azpt = apz(i ,j ,k+1)*dx[0]*dx[1]; + const Real axm = apx(i,j,k); + const Real axp = apx(i+1,j,k); + const Real aym = apy(i,j,k); + const Real ayp = apy(i,j+1,k); + const Real azm = apz(i,j,k); + const Real azp = apz(i,j,k+1); // Check for small cell first - if (((axmt == 0.0_rt && axpt == 0.0_rt) && - (aymt == 0.0_rt && aypt == 0.0_rt) && - (azmt == 0.0_rt || azpt == 0.0_rt)) || - ((axmt == 0.0_rt && axpt == 0.0_rt) && - (aymt == 0.0_rt || aypt == 0.0_rt) && - (azmt == 0.0_rt && azpt == 0.0_rt)) || - ((axmt == 0.0_rt || axpt == 0.0_rt) && - (aymt == 0.0_rt && aypt == 0.0_rt) && - (azmt == 0.0_rt && azpt == 0.0_rt))) { + if (((axm == 0.0_rt && axp == 0.0_rt) && + (aym == 0.0_rt && ayp == 0.0_rt) && + (azm == 0.0_rt || azp == 0.0_rt)) || + ((axm == 0.0_rt && axp == 0.0_rt) && + (aym == 0.0_rt || ayp == 0.0_rt) && + (azm == 0.0_rt && azp == 0.0_rt)) || + ((axm == 0.0_rt || axp == 0.0_rt) && + (aym == 0.0_rt && ayp == 0.0_rt) && + (azm == 0.0_rt && azp == 0.0_rt))) { set_covered(i, j, k, cell, vfrac, vcent, barea, bcent, bnorm); is_small_cell = true; return; @@ -69,12 +69,12 @@ void set_eb_data (const int i, const int j, const int k, // We know there are no multiple cuts on faces by now. // We need to check the case that there are two cuts // at the opposite corners. - bool multi_cuts = (axm >= 0.5_rt*dx[1]*dx[2] && axm < dx[1]*dx[2] && - axp >= 0.5_rt*dx[1]*dx[2] && axp < dx[1]*dx[2] && - aym >= 0.5_rt*dx[0]*dx[1] && aym < dx[0]*dx[1] && - ayp >= 0.5_rt*dx[0]*dx[1] && ayp < dx[0]*dx[1] && - azm >= 0.5_rt*dx[1]*dx[2] && azm < dx[1]*dx[2] && - azp >= 0.5_rt*dx[1]*dx[2] && azp < dx[1]*dx[2]); + bool multi_cuts = (axmt >= 0.5_rt*dx[1]*dx[2] && axmt < dx[1]*dx[2] && + axpt >= 0.5_rt*dx[1]*dx[2] && axpt < dx[1]*dx[2] && + aymt >= 0.5_rt*dx[0]*dx[1] && aymt < dx[0]*dx[1] && + aypt >= 0.5_rt*dx[0]*dx[1] && aypt < dx[0]*dx[1] && + azmt >= 0.5_rt*dx[1]*dx[2] && azmt < dx[1]*dx[2] && + azpt >= 0.5_rt*dx[1]*dx[2] && azpt < dx[1]*dx[2]); if (multi_cuts) { set_covered(i, j, k, cell, vfrac, vcent, barea, bcent, bnorm); @@ -82,9 +82,9 @@ void set_eb_data (const int i, const int j, const int k, return; } - Real dapx = axm - axp; - Real dapy = aym - ayp; - Real dapz = azm - azp; + Real dapx = axmt - axpt; + Real dapy = aymt - aypt; + Real dapz = azmt - azpt; const Real apnorm = std::sqrt(dapx*dapx+dapy*dapy+dapz*dapz) + 1.e-30_rt*std::sqrt(dx[0]*dx[1]*dx[2]); if (apnorm == 0.0_rt) { bool maybe_multi_cuts = (axm == 0.0_rt && axp == 0.0_rt) || @@ -110,13 +110,6 @@ void set_eb_data (const int i, const int j, const int k, bnorm(i,j,k,2) = nz; barea(i,j,k) = (nx*dapx/dx[1]/dx[2] + ny*dapy/dx[0]/dx[2] + nz*dapz/dx[0]/dx[1]); - axm = apx(i ,j ,k ); - axp = apx(i+1,j ,k ); - aym = apy(i ,j ,k ); - ayp = apy(i ,j+1,k ); - azm = apz(i ,j ,k ); - azp = apz(i ,j ,k+1); - Real aax = 0.5_rt*(axm+axp); Real aay = 0.5_rt*(aym+ayp); Real aaz = 0.5_rt*(azm+azp); From a741cca778cbb7550ec57da77fe881177ba0ea2f Mon Sep 17 00:00:00 2001 From: "Jean M. Sexton" Date: Mon, 29 Apr 2024 18:49:09 -0700 Subject: [PATCH 21/21] Cleanup part 4 --- Src/EB/AMReX_EB2_3D_C.cpp | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/Src/EB/AMReX_EB2_3D_C.cpp b/Src/EB/AMReX_EB2_3D_C.cpp index aa86c8d0749..c2de520e7a1 100644 --- a/Src/EB/AMReX_EB2_3D_C.cpp +++ b/Src/EB/AMReX_EB2_3D_C.cpp @@ -38,12 +38,6 @@ void set_eb_data (const int i, const int j, const int k, Array4 const& bnorm, Real small_volfrac, bool& is_small_cell, bool& is_multicut) noexcept { - const Real axmt = apx(i ,j ,k )*dx[1]*dx[2]; - const Real axpt = apx(i+1,j ,k )*dx[1]*dx[2]; - const Real aymt = apy(i ,j ,k )*dx[0]*dx[2]; - const Real aypt = apy(i ,j+1,k )*dx[0]*dx[2]; - const Real azmt = apz(i ,j ,k )*dx[0]*dx[1]; - const Real azpt = apz(i ,j ,k+1)*dx[0]*dx[1]; const Real axm = apx(i,j,k); const Real axp = apx(i+1,j,k); const Real aym = apy(i,j,k); @@ -69,12 +63,12 @@ void set_eb_data (const int i, const int j, const int k, // We know there are no multiple cuts on faces by now. // We need to check the case that there are two cuts // at the opposite corners. - bool multi_cuts = (axmt >= 0.5_rt*dx[1]*dx[2] && axmt < dx[1]*dx[2] && - axpt >= 0.5_rt*dx[1]*dx[2] && axpt < dx[1]*dx[2] && - aymt >= 0.5_rt*dx[0]*dx[1] && aymt < dx[0]*dx[1] && - aypt >= 0.5_rt*dx[0]*dx[1] && aypt < dx[0]*dx[1] && - azmt >= 0.5_rt*dx[1]*dx[2] && azmt < dx[1]*dx[2] && - azpt >= 0.5_rt*dx[1]*dx[2] && azpt < dx[1]*dx[2]); + bool multi_cuts = (axm >= 0.5_rt && axm < 1.0_rt && + axp >= 0.5_rt && axp < 1.0_rt && + aym >= 0.5_rt && aym < 1.0_rt && + ayp >= 0.5_rt && ayp < 1.0_rt && + azm >= 0.5_rt && azm < 1.0_rt && + azp >= 0.5_rt && azp < 1.0_rt); if (multi_cuts) { set_covered(i, j, k, cell, vfrac, vcent, barea, bcent, bnorm); @@ -82,9 +76,9 @@ void set_eb_data (const int i, const int j, const int k, return; } - Real dapx = axmt - axpt; - Real dapy = aymt - aypt; - Real dapz = azmt - azpt; + Real dapx = (axm - axp)*(dx[1]*dx[2]); + Real dapy = (aym - ayp)*(dx[0]*dx[2]); + Real dapz = (azm - azp)*(dx[0]*dx[1]); const Real apnorm = std::sqrt(dapx*dapx+dapy*dapy+dapz*dapz) + 1.e-30_rt*std::sqrt(dx[0]*dx[1]*dx[2]); if (apnorm == 0.0_rt) { bool maybe_multi_cuts = (axm == 0.0_rt && axp == 0.0_rt) || @@ -108,7 +102,7 @@ void set_eb_data (const int i, const int j, const int k, bnorm(i,j,k,0) = nx; bnorm(i,j,k,1) = ny; bnorm(i,j,k,2) = nz; - barea(i,j,k) = (nx*dapx/dx[1]/dx[2] + ny*dapy/dx[0]/dx[2] + nz*dapz/dx[0]/dx[1]); + barea(i,j,k) = (nx*dapx/(dx[1]*dx[2]) + ny*dapy/(dx[0]*dx[2]) + nz*dapz/(dx[0]*dx[1])); Real aax = 0.5_rt*(axm+axp); Real aay = 0.5_rt*(aym+ayp);