From 7b9f7ea3bd26e3484de8dc5660e7bde779d01cf6 Mon Sep 17 00:00:00 2001 From: cgilet Date: Sun, 4 Aug 2024 21:54:33 -0400 Subject: [PATCH 1/3] Change slipwall scalar BC for BDS to respect the design choice that no new extrema get introduced. --- Source/NS_BC.H | 5 +++++ Source/NS_setup.cpp | 19 +++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Source/NS_BC.H b/Source/NS_BC.H index cfd01946..b3681e42 100644 --- a/Source/NS_BC.H +++ b/Source/NS_BC.H @@ -14,6 +14,11 @@ static int tang_vel_bc[] = amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::hoextrap, amrex::BCType::ext_dir }; +// NOTE BDS advection scheme has different BC due to it's design choice that it not introduce new extrema +static int bds_scalar_bc[] = +{ + amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::foextrap, amrex::BCType::foextrap +}; static int scalar_bc[] = { amrex::BCType::int_dir, amrex::BCType::ext_dir, amrex::BCType::foextrap, amrex::BCType::reflect_even, amrex::BCType::hoextrap, amrex::BCType::foextrap diff --git a/Source/NS_setup.cpp b/Source/NS_setup.cpp index f98bcf74..ccfcd846 100644 --- a/Source/NS_setup.cpp +++ b/Source/NS_setup.cpp @@ -70,14 +70,21 @@ set_z_vel_bc (BCRec& bc, static void set_scalar_bc (BCRec& bc, - const BCRec& phys_bc) + const BCRec& phys_bc, + std::string advection) { const int* lo_bc = phys_bc.lo(); const int* hi_bc = phys_bc.hi(); for (int i = 0; i < AMREX_SPACEDIM; i++) { - bc.setLo(i,scalar_bc[lo_bc[i]]); - bc.setHi(i,scalar_bc[hi_bc[i]]); + if (advection == "BDS"){ + bc.setLo(i,bds_scalar_bc[lo_bc[i]]); + bc.setHi(i,bds_scalar_bc[hi_bc[i]]); + } + else { + bc.setLo(i,scalar_bc[lo_bc[i]]); + bc.setHi(i,scalar_bc[hi_bc[i]]); + } } } @@ -262,15 +269,15 @@ NavierStokes::variableSetUp () // // ************** DEFINE SCALAR VARIABLES ******************** // - set_scalar_bc(bc,phys_bc); + set_scalar_bc(bc,phys_bc,advection_scheme); desc_lst.setComponent(State_Type,Density,"density",bc,state_bf); - set_scalar_bc(bc,phys_bc); + set_scalar_bc(bc,phys_bc,advection_scheme); desc_lst.setComponent(State_Type,Tracer,"tracer",bc,state_bf); if (do_trac2) { - set_scalar_bc(bc,phys_bc); + set_scalar_bc(bc,phys_bc,advection_scheme); desc_lst.setComponent(State_Type,Tracer2,"tracer2",bc,state_bf); } // From fd0c1b80cf20eee5595d5db8294ff13952e31643 Mon Sep 17 00:00:00 2001 From: cgilet Date: Sun, 4 Aug 2024 22:22:39 -0400 Subject: [PATCH 2/3] Appease clang-tidy --- Source/NS_setup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/NS_setup.cpp b/Source/NS_setup.cpp index ccfcd846..adb77cfc 100644 --- a/Source/NS_setup.cpp +++ b/Source/NS_setup.cpp @@ -71,7 +71,7 @@ static void set_scalar_bc (BCRec& bc, const BCRec& phys_bc, - std::string advection) + const std::string& advection) { const int* lo_bc = phys_bc.lo(); const int* hi_bc = phys_bc.hi(); From 0b81e1baad613706ed3c8c13c01cb608fd2f9b65 Mon Sep 17 00:00:00 2001 From: Andy Nonaka Date: Mon, 5 Aug 2024 08:12:24 -0700 Subject: [PATCH 3/3] Update Source/NS_setup.cpp --- Source/NS_setup.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/NS_setup.cpp b/Source/NS_setup.cpp index adb77cfc..a6c73b71 100644 --- a/Source/NS_setup.cpp +++ b/Source/NS_setup.cpp @@ -277,7 +277,7 @@ NavierStokes::variableSetUp () if (do_trac2) { - set_scalar_bc(bc,phys_bc,advection_scheme); + set_scalar_bc(bc,phys_bc,advection_scheme); desc_lst.setComponent(State_Type,Tracer2,"tracer2",bc,state_bf); } //