From e83cc3dc822db81dff1bf4ec00fef5819ad861c5 Mon Sep 17 00:00:00 2001 From: Bruce Perry <53018946+baperry2@users.noreply.github.com> Date: Fri, 1 Dec 2023 12:52:21 -0700 Subject: [PATCH] Remove filter files that will now live in PelePhysics (#714) --- CMake/BuildPeleCExe.cmake | 10 +- CMake/BuildPeleCLib.cmake | 20 +- Docs/sphinx/LES.rst | 43 +--- Exec/Make.PeleC | 3 + Source/Constants.H | 2 +- Source/Filter.H | 170 ------------- Source/Filter.cpp | 491 -------------------------------------- Source/Geometry.cpp | 4 +- Source/Make.package | 4 +- Submodules/PelePhysics | 2 +- 10 files changed, 30 insertions(+), 719 deletions(-) delete mode 100644 Source/Filter.H delete mode 100644 Source/Filter.cpp diff --git a/CMake/BuildPeleCExe.cmake b/CMake/BuildPeleCExe.cmake index b1d76cf27..c90f40221 100644 --- a/CMake/BuildPeleCExe.cmake +++ b/CMake/BuildPeleCExe.cmake @@ -5,7 +5,7 @@ function(build_pelec_exe pelec_exe_name pelec_lib_name) add_executable(${pelec_exe_name} "") if(CLANG_TIDY_EXE) - set_target_properties(${pelec_exe_name} PROPERTIES CXX_CLANG_TIDY + set_target_properties(${pelec_exe_name} PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};--config-file=${CMAKE_SOURCE_DIR}/.clang-tidy") endif() @@ -15,7 +15,7 @@ function(build_pelec_exe pelec_exe_name pelec_lib_name) prob.H prob.cpp ) - + #PeleC include directories target_include_directories(${pelec_exe_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(${pelec_exe_name} PRIVATE ${SRC_DIR}) @@ -83,8 +83,6 @@ function(build_pelec_exe pelec_exe_name pelec_lib_name) ${SRC_DIR}/EB.cpp ${SRC_DIR}/EBStencilTypes.H ${SRC_DIR}/External.cpp - ${SRC_DIR}/Filter.H - ${SRC_DIR}/Filter.cpp ${SRC_DIR}/Forcing.cpp ${SRC_DIR}/GradUtil.H ${SRC_DIR}/Hydro.H @@ -158,10 +156,10 @@ function(build_pelec_exe pelec_exe_name pelec_lib_name) set_target_properties(${pelec_exe_name} PROPERTIES CUDA_SEPARABLE_COMPILATION ON) target_compile_options(${pelec_exe_name} PRIVATE $<$:-Xptxas --disable-optimizer-constants>) endif() - + target_link_libraries(${pelec_exe_name} PRIVATE ${pelec_lib_name} AMReX::amrex) - #Define what we want to be installed during a make install + #Define what we want to be installed during a make install install(TARGETS ${pelec_exe_name} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib diff --git a/CMake/BuildPeleCLib.cmake b/CMake/BuildPeleCLib.cmake index fbf4d4836..165b5e3fb 100644 --- a/CMake/BuildPeleCLib.cmake +++ b/CMake/BuildPeleCLib.cmake @@ -14,7 +14,7 @@ function(build_pelec_lib pelec_lib_name) endif() include(SetPeleCCompileFlags) - + target_sources(${pelec_lib_name} PRIVATE ${PELE_PHYSICS_SRC_DIR}/Utility/TurbInflow/turbinflow.cpp @@ -34,14 +34,20 @@ function(build_pelec_lib pelec_lib_name) ${PELE_PHYSICS_SRC_DIR}/Utility/Diagnostics/DiagPDF.H ${PELE_PHYSICS_SRC_DIR}/Utility/Diagnostics/DiagPDF.cpp) target_include_directories(${pelec_lib_name} PUBLIC ${PELE_PHYSICS_SRC_DIR}/Utility/Diagnostics) - + target_sources(${pelec_lib_name} PRIVATE ${PELE_PHYSICS_SRC_DIR}/Utility/PltFileManager/PltFileManager.cpp ${PELE_PHYSICS_SRC_DIR}/Utility/PltFileManager/PltFileManager.H ${PELE_PHYSICS_SRC_DIR}/Utility/PltFileManager/PltFileManagerBCFill.H) target_include_directories(${pelec_lib_name} PUBLIC ${PELE_PHYSICS_SRC_DIR}/Utility/PltFileManager) - + + target_sources(${pelec_lib_name} + PRIVATE + ${PELE_PHYSICS_SRC_DIR}/Utility/Filter/Filter.cpp + ${PELE_PHYSICS_SRC_DIR}/Utility/Filter/Filter.H) + target_include_directories(${pelec_lib_name} PUBLIC ${PELE_PHYSICS_SRC_DIR}/Utility/Filter) + target_sources(${pelec_lib_name} PRIVATE ${AMREX_SUNDIALS_DIR}/AMReX_Sundials.H ${AMREX_SUNDIALS_DIR}/AMReX_Sundials_Core.cpp ${AMREX_SUNDIALS_DIR}/AMReX_Sundials_Core.H @@ -123,9 +129,9 @@ function(build_pelec_lib pelec_lib_name) include(AMReXBuildInfo) generate_buildinfo(${pelec_lib_name} ${CMAKE_SOURCE_DIR}) target_include_directories(${pelec_lib_name} SYSTEM PUBLIC ${AMREX_SUBMOD_LOCATION}/Tools/C_scripts) - + target_link_libraries(${pelec_lib_name} PUBLIC sundials_arkode sundials_cvode) - + if(PELEC_ENABLE_CUDA) target_link_libraries(${pelec_lib_name} PUBLIC sundials_nveccuda sundials_sunlinsolcusolversp sundials_sunmatrixcusparse) elseif(PELEC_ENABLE_HIP) @@ -133,11 +139,11 @@ function(build_pelec_lib pelec_lib_name) elseif(PELEC_ENABLE_SYCL) target_link_libraries(${pelec_lib_name} PUBLIC sundials_nvecsycl) endif() - + if(PELEC_ENABLE_MPI) target_link_libraries(${pelec_lib_name} PUBLIC $<$:MPI::MPI_CXX>) endif() - + #Link to amrex libraries target_link_libraries(${pelec_lib_name} PUBLIC AMReX::amrex) diff --git a/Docs/sphinx/LES.rst b/Docs/sphinx/LES.rst index 8f6503248..77d60a91d 100644 --- a/Docs/sphinx/LES.rst +++ b/Docs/sphinx/LES.rst @@ -1,7 +1,7 @@ .. role:: cpp(code) :language: c++ - + .. _LES: LES and Hybrid LES/DNS Support @@ -89,22 +89,10 @@ should option should be turned on in the input file: ``pelec.use_explicit_filter = 1``. The user specifies the filter-grid ratio using ``pelec.les_filter_fgr = NUM``, where ``NUM`` is the filter-grid ratio desired, e.g. ``pelec.les_filter_fgr = 2``. The user -also specifies a filter type through ``pelec.les_filter_type = NUM``: - -* ``les_filter_type = 0``: no filtering -* ``les_filter_type = 1``: standard box filter -* ``les_filter_type = 2``: standard Gaussian filter - -We have also implemented a set of filters defined in Sagaut & Grohens (1999) Int. J. Num. Meth. Fluids: - -* ``les_filter_type = 3``: 3 point box filter approximation (Eq. 26) -* ``les_filter_type = 4``: 5 point box filter approximation (Eq. 27) -* ``les_filter_type = 5``: 3 point box filter optimized approximation (Table 1) -* ``les_filter_type = 6``: 5 point box filter optimized approximation (Table 1) -* ``les_filter_type = 7``: 3 point Gaussian filter approximation -* ``les_filter_type = 8``: 5 point Gaussian filter approximation (Eq. 29) -* ``les_filter_type = 9``: 3 point Gaussian filter optimized approximation (Table 1) -* ``les_filter_type = 10``: 5 point Gaussian filter optimized approximation (Table 1) +also specifies a filter type through ``pelec.les_filter_type = NUM``. +Explicit filtering utilizes the Filter utility from PelePhysics, and +the set of available filter types may be found in the +`PelePhysics documentation `_. An example input file section for a Gaussian filter with a filter-grid ration of 2 would be: @@ -114,24 +102,3 @@ ration of 2 would be: pelec.use_explicit_filter=1 pelec.les_filter_type=2 pelec.les_filter_fgr=2 - - -Developing -########## - -The weights for these filters are set in ``Filter.cpp``. To add a -filter type, one needs to add an enum to the ``filter_types`` and -define a corresponding ``set_NAME_weights`` function to be called at -initialization. - -The application of a filter can be done on a Fab or MultiFab. The loop nesting -ordering was chosen to be performant on existing HPC architectures and -discussed in PeleC milestone reports. An example call to the filtering operation is - -:: - - les_filter = Filter(les_filter_type, les_filter_fgr); - ... - les_filter.apply_filter(bxtmp, flux[i], filtered_flux[i], Density, NUM_STATE); - -The user must ensure that the correct number of grow cells is present in the Fab or MultiFab. diff --git a/Exec/Make.PeleC b/Exec/Make.PeleC index 36ab1d0ae..01cdde3f5 100644 --- a/Exec/Make.PeleC +++ b/Exec/Make.PeleC @@ -36,6 +36,9 @@ Blocs += $(PELE_PHYSICS_HOME)/Utility/PltFileManager Bpack += $(PELE_PHYSICS_HOME)/Utility/Diagnostics/Make.package Blocs += $(PELE_PHYSICS_HOME)/Utility/Diagnostics +Bpack += $(PELE_PHYSICS_HOME)/Utility/Filter/Make.package +Blocs += $(PELE_PHYSICS_HOME)/Utility/Filter + all: $(executable) ifneq ($(KEEP_BUILDINFO_CPP),TRUE) $(SILENT) $(RM) AMReX_buildInfo.cpp diff --git a/Source/Constants.H b/Source/Constants.H index e2b385baa..eb7341635 100644 --- a/Source/Constants.H +++ b/Source/Constants.H @@ -5,7 +5,7 @@ namespace constants { AMREX_GPU_HOST_DEVICE constexpr amrex::Real PI() { - return 3.14159265358979323846264338327950288; + return amrex::Math::pi(); } AMREX_GPU_HOST_DEVICE constexpr amrex::Real smallu() diff --git a/Source/Filter.H b/Source/Filter.H deleted file mode 100644 index a9a4a6299..000000000 --- a/Source/Filter.H +++ /dev/null @@ -1,170 +0,0 @@ -#ifndef FILTER_H -#define FILTER_H - -#include -#include -#include - -#include "Constants.H" - -#ifdef AMREX_USE_OMP -#include -#endif - -// Filter types -enum filter_types { - no_filter = 0, - box, // 1 - gaussian, // 2 - box_3pt_approx, // 3 - box_5pt_approx, // 4 - box_3pt_optimized_approx, // 5 - box_5pt_optimized_approx, // 6 - gaussian_3pt_approx, // 7 - gaussian_5pt_approx, // 8 - gaussian_3pt_optimized_approx, // 9 - gaussian_5pt_optimized_approx, // 10 - num_filter_types -}; - -AMREX_GPU_DEVICE -AMREX_FORCE_INLINE -void -run_filter( - const int i, - const int j, - const int k, - const int nc, - const int ng, - const int nstart, - const amrex::Real* w, - amrex::Array4 const& q, - amrex::Array4 const& qh) -{ - for (int n = -ng; n <= ng; n++) { - for (int m = -ng; m <= ng; m++) { - for (int l = -ng; l <= ng; l++) { - qh(i, j, k, nc + nstart) += w[l + ng] * w[m + ng] * w[n + ng] * - q(i + l, j + m, k + n, nc + nstart); - } - } - } -} - -class Filter -{ - -public: - explicit Filter(const int type = box, const int fgr = 2) - : _type(type), _fgr(fgr) - { - - switch (_type) { - - case box: - set_box_weights(); - break; - - case gaussian: - set_gaussian_weights(); - break; - - case box_3pt_approx: - case gaussian_3pt_approx: // same as box_3pt_approx - set_box_3pt_approx_weights(); - break; - - case box_5pt_approx: - set_box_5pt_approx_weights(); - break; - - case box_3pt_optimized_approx: - set_box_3pt_optimized_approx_weights(); - break; - - case box_5pt_optimized_approx: - set_box_5pt_optimized_approx_weights(); - break; - - case gaussian_5pt_approx: - set_gaussian_5pt_approx_weights(); - break; - - case gaussian_3pt_optimized_approx: - set_gaussian_3pt_optimized_approx_weights(); - break; - - case gaussian_5pt_optimized_approx: - set_gaussian_5pt_optimized_approx_weights(); - break; - - case no_filter: - default: - _fgr = 1; - _ngrow = 0; - _nweights = 2 * _ngrow + 1; - _weights.resize(_nweights); - _weights[0] = 1.; - break; - - } // end switch - } - - // Default destructor - ~Filter() = default; - - int get_filter_ngrow() const { return _ngrow; } - - void apply_filter(const amrex::MultiFab& in, amrex::MultiFab& out); - - void apply_filter( - const amrex::MultiFab& in, - amrex::MultiFab& out, - const int nstart, - const int ncnt); - - void apply_filter( - const amrex::Box& cbox, const amrex::FArrayBox& in, amrex::FArrayBox& out); - - void apply_filter( - const amrex::Box& cbox, - const amrex::FArrayBox& in, - amrex::FArrayBox& out, - const int nstart, - const int ncnt); - - void apply_filter( - const amrex::Box& box, - const amrex::FArrayBox& in, - amrex::FArrayBox& out, - const int nstart, - const int ncnt, - const int ncomp); - -private: - int _type; - int _fgr; - int _ngrow; - int _nweights; - amrex::Vector _weights; - - void set_box_weights(); - - void set_gaussian_weights(); - - void set_box_3pt_approx_weights(); - - void set_box_5pt_approx_weights(); - - void set_box_3pt_optimized_approx_weights(); - - void set_box_5pt_optimized_approx_weights(); - - void set_gaussian_5pt_approx_weights(); - - void set_gaussian_3pt_optimized_approx_weights(); - - void set_gaussian_5pt_optimized_approx_weights(); -}; - -#endif /*_FILTER_H*/ diff --git a/Source/Filter.cpp b/Source/Filter.cpp deleted file mode 100644 index 7d4f3417a..000000000 --- a/Source/Filter.cpp +++ /dev/null @@ -1,491 +0,0 @@ -#include "Filter.H" - -// Set the filter weights for the standard box filter -void -Filter::set_box_weights() -{ - - AMREX_ASSERT(_fgr % 2 == 0 || _fgr == 1); - _ngrow = _fgr / 2; - _nweights = 2 * _ngrow + 1; - _weights.resize(_nweights); - - // Set the weights - for (int i = 0; i < _nweights; i++) { - _weights[i] = 1.0 / _fgr; - } - - // Only half the cell is used at the ends - if (_fgr > 1) { - _weights[0] = 0.5 * _weights[0]; - _weights[_nweights - 1] = _weights[0]; - } -} - -// Set the filter weights for the standard gaussian filter -void -Filter::set_gaussian_weights() -{ - - AMREX_ASSERT(_fgr % 2 == 0); - _ngrow = _fgr / 2; - _nweights = 2 * _ngrow + 1; - _weights.resize(_nweights); - - // Set the weights - amrex::Real gamma = 6.0; - amrex::Real sigma = std::sqrt(1.0 / (2.0 * gamma)) * _fgr; - for (int i = 0; i < _nweights; i++) { - // equivalent to: std::sqrt(gamma / (PI * _fgr * _fgr)) * std::exp((-gamma - // * (i-_ngrow) * (i-_ngrow)) / (_fgr * _fgr)); - _weights[i] = - 1.0 / (std::sqrt(2.0 * constants::PI()) * sigma) * - std::exp((-(i - _ngrow) * (i - _ngrow)) / (2 * sigma * sigma)); - } - // normalize to ensure it all sums to one - amrex::Real sum = std::accumulate(_weights.begin(), _weights.end(), 0.0); - for (int i = 0; i < _nweights; i++) { - _weights[i] /= sum; - } -} - -// Set the filter weights for the 3pt polynomial truncation -// approximation of the box filter. See Eq. 26 in Sagaut & Grohens -// (1999) Int. J. Num. Meth. Fluids. -void -Filter::set_box_3pt_approx_weights() -{ - - _ngrow = 1; - _nweights = 2 * _ngrow + 1; - _weights.resize(_nweights); - - // Set the weights - _weights[0] = _fgr * _fgr / 24.0; - _weights[1] = (12.0 - _fgr * _fgr) / 12.0; - _weights[2] = _weights[0]; -} - -// Set the filter weights for the 5pt polynomial truncation -// approximation of the box filter. See Eq. 27 in Sagaut & Grohens -// (1999) Int. J. Num. Meth. Fluids (though there are typos). -void -Filter::set_box_5pt_approx_weights() -{ - - _ngrow = 2; - _nweights = 2 * _ngrow + 1; - _weights.resize(_nweights); - - // Set the weights - int _fgr2 = _fgr * _fgr; - int _fgr4 = _fgr2 * _fgr2; - _weights[0] = (3.0 * _fgr4 - 20.0 * _fgr2) / 5760.0; - _weights[1] = (80.0 * _fgr2 - 3.0 * _fgr4) / 1440.0; - _weights[2] = (3.0 * _fgr4 - 100.0 * _fgr2 + 960.0) / 960.0; - _weights[3] = _weights[1]; - _weights[4] = _weights[0]; -} - -// Set the filter weights for the 3pt optimized approximation of the -// box filter. See Table I in Sagaut & Grohens (1999) -// Int. J. Num. Meth. Fluids. -void -Filter::set_box_3pt_optimized_approx_weights() -{ - - _ngrow = 1; - _nweights = 2 * _ngrow + 1; - _weights.resize(_nweights); - - amrex::Real ratio; - switch (_fgr) { - - case 1: - ratio = 0.079; - break; - - case 2: - ratio = 0.274; - break; - - case 3: - ratio = 1.377; - break; - - case 4: - ratio = -2.375; - break; - - case 5: - ratio = -1.000; - break; - - case 6: - ratio = -0.779; - break; - - case 7: - ratio = -0.680; - break; - - case 8: - ratio = -0.627; - break; - - case 9: - ratio = -0.596; - break; - - case 10: - ratio = -0.575; - break; - - default: // default to standard box filter - set_box_weights(); - return; - break; - - } // end switch - - // Set the weights - _weights[0] = ratio / (1 + 2.0 * ratio); - _weights[1] = 1.0 - 2.0 * _weights[0]; - _weights[2] = _weights[0]; -} - -// Set the filter weights for the 5pt optimized approximation of the -// box filter. See Table I in Sagaut & Grohens (1999) -// Int. J. Num. Meth. Fluids. -void -Filter::set_box_5pt_optimized_approx_weights() -{ - - _ngrow = 2; - _nweights = 2 * _ngrow + 1; - _weights.resize(_nweights); - - amrex::Real ratio1; - amrex::Real ratio2; - switch (_fgr) { - - case 1: - ratio1 = 0.0886; - ratio2 = -0.0169; - break; - - case 2: - ratio1 = 0.3178; - ratio2 = -0.0130; - break; - - case 3: - ratio1 = 1.0237; - ratio2 = 0.0368; - break; - - case 4: - ratio1 = 2.4414; - ratio2 = 0.5559; - break; - - case 5: - ratio1 = 0.2949; - ratio2 = 0.7096; - break; - - case 6: - ratio1 = -0.5276; - ratio2 = 0.4437; - break; - - case 7: - ratio1 = -0.6708; - ratio2 = 0.3302; - break; - - case 8: - ratio1 = -0.7003; - ratio2 = 0.2767; - break; - - case 9: - ratio1 = -0.7077; - ratio2 = 0.2532; - break; - - case 10: - ratio1 = -0.6996; - ratio2 = 0.2222; - break; - - default: // default to standard box filter - set_box_weights(); - return; - break; - - } // end switch - - // Set the weights - _weights[0] = ratio2 / (1 + 2.0 * ratio1 + 2.0 * ratio2); - _weights[1] = ratio1 / ratio2 * _weights[0]; - _weights[2] = 1.0 - 2.0 * _weights[0] - 2.0 * _weights[1]; - _weights[3] = _weights[1]; - _weights[4] = _weights[0]; -} - -// Set the filter weights for the 5pt polynomial truncation -// approximation of the gaussian filter. See Eq. 29 in Sagaut & -// Grohens (1999) Int. J. Num. Meth. Fluids. -void -Filter::set_gaussian_5pt_approx_weights() -{ - - _ngrow = 2; - _nweights = 2 * _ngrow + 1; - _weights.resize(_nweights); - - // Set the weights - int _fgr2 = _fgr * _fgr; - int _fgr4 = _fgr2 * _fgr2; - _weights[0] = (_fgr4 - 4.0 * _fgr2) / 1152.0; - _weights[1] = (16.0 * _fgr2 - _fgr4) / 288.0; - _weights[2] = (_fgr4 - 20.0 * _fgr2 + 192.0) / 192.0; - _weights[3] = _weights[1]; - _weights[4] = _weights[0]; -} - -// Set the filter weights for the 3pt optimized approximation of the -// gaussian filter. See Table I in Sagaut & Grohens (1999) -// Int. J. Num. Meth. Fluids. -void -Filter::set_gaussian_3pt_optimized_approx_weights() -{ - - _ngrow = 1; - _nweights = 2 * _ngrow + 1; - _weights.resize(_nweights); - - amrex::Real ratio; - switch (_fgr) { - - case 1: - ratio = 0.0763; - break; - - case 2: - ratio = 0.2527; - break; - - case 3: - ratio = 1.1160; - break; - - case 4: - ratio = -3.144; - break; - - case 5: - ratio = -1.102; - break; - - case 6: - ratio = -0.809; - break; - - case 7: - ratio = -0.696; - break; - - case 8: - ratio = -0.638; - break; - - case 9: - ratio = -0.604; - break; - - case 10: - ratio = -0.581; - break; - - default: // default to the 3pt gaussian filter - set_box_3pt_approx_weights(); - return; - break; - - } // end switch - - // Set the weights - _weights[0] = ratio / (1 + 2.0 * ratio); - _weights[1] = 1.0 - 2.0 * _weights[0]; - _weights[2] = _weights[0]; -} - -// Set the filter weights for the 5pt optimized approximation of the -// gaussian filter. See Table I in Sagaut & Grohens (1999) -// Int. J. Num. Meth. Fluids. -void -Filter::set_gaussian_5pt_optimized_approx_weights() -{ - - _ngrow = 2; - _nweights = 2 * _ngrow + 1; - _weights.resize(_nweights); - - amrex::Real ratio1; - amrex::Real ratio2; - switch (_fgr) { - - case 1: - ratio1 = 0.0871; - ratio2 = -0.0175; - break; - - case 2: - ratio1 = 0.2596; - ratio2 = -0.0021; - break; - - case 3: - ratio1 = 0.4740; - ratio2 = 0.0785; - break; - - case 4: - ratio1 = 0.1036; - ratio2 = 0.2611; - break; - - case 5: - ratio1 = -0.4252; - ratio2 = 0.3007; - break; - - case 6: - ratio1 = -0.6134; - ratio2 = 0.2696; - break; - - case 7: - ratio1 = -0.6679; - ratio2 = 0.2419; - break; - - case 8: - ratio1 = -0.6836; - ratio2 = 0.2231; - break; - - case 9: - ratio1 = -0.6873; - ratio2 = 0.2103; - break; - - case 10: - ratio1 = -0.6870; - ratio2 = 0.2014; - break; - - default: // default to 5pt gaussian filter - set_gaussian_5pt_approx_weights(); - return; - break; - - } // end switch - - // Set the weights - _weights[0] = ratio2 / (1 + 2.0 * ratio1 + 2.0 * ratio2); - _weights[1] = ratio1 / ratio2 * _weights[0]; - _weights[2] = 1.0 - 2.0 * _weights[0] - 2.0 * _weights[1]; - _weights[3] = _weights[1]; - _weights[4] = _weights[0]; -} - -// Run the filtering operation on a MultiFab -void -Filter::apply_filter(const amrex::MultiFab& in, amrex::MultiFab& out) -{ - apply_filter(in, out, 0, out.nComp()); -} - -void -Filter::apply_filter( - const amrex::MultiFab& in, - amrex::MultiFab& out, - const int nstart, - const int ncnt) -{ - - // Ensure enough grow cells - AMREX_ASSERT(in.nGrow() >= out.nGrow() + _ngrow); - - const auto& ins = in.const_arrays(); - const auto& outs = out.arrays(); - out.setVal(0, nstart, ncnt); - - amrex::Gpu::DeviceVector weights(_weights.size()); - amrex::Real* w = weights.data(); - amrex::Gpu::copy( - amrex::Gpu::hostToDevice, _weights.begin(), _weights.end(), - weights.begin()); - const int captured_ngrow = _ngrow; - - const amrex::IntVect ngs(out.nGrow()); - amrex::ParallelFor( - in, ngs, ncnt - nstart, - [=] AMREX_GPU_DEVICE(int nbx, int i, int j, int k, int nc) noexcept { - run_filter(i, j, k, nc, captured_ngrow, nstart, w, ins[nbx], outs[nbx]); - }); - amrex::Gpu::synchronize(); -} - -// Run the filtering operation on a FAB -void -Filter::apply_filter( - const amrex::Box& cbox, const amrex::FArrayBox& in, amrex::FArrayBox& out) -{ - apply_filter(cbox, in, out, 0, out.nComp()); -} - -void -Filter::apply_filter( - const amrex::Box& cbox, - const amrex::FArrayBox& in, - amrex::FArrayBox& out, - const int nstart, - const int ncnt) -{ - BL_PROFILE("Filter::apply_filter()"); - AMREX_ASSERT(in.nComp() == out.nComp()); - - const int ncomp = in.nComp(); - apply_filter(cbox, in, out, nstart, ncnt, ncomp); -} - -void -Filter::apply_filter( - const amrex::Box& box, - const amrex::FArrayBox& in, - amrex::FArrayBox& out, - const int nstart, - const int ncnt, - const int /*ncomp*/) -{ - const auto q = in.const_array(); - out.setVal(0.0, box, nstart, ncnt); - auto qh = out.array(); - - amrex::Gpu::DeviceVector weights(_weights.size()); - amrex::Real* w = weights.data(); - amrex::Gpu::copy( - amrex::Gpu::hostToDevice, _weights.begin(), _weights.end(), - weights.begin()); - - const int captured_ngrow = _ngrow; - amrex::ParallelFor( - box, ncnt - nstart, - [=] AMREX_GPU_DEVICE(int i, int j, int k, int nc) noexcept { - run_filter(i, j, k, nc, captured_ngrow, nstart, w, q, qh); - }); -} diff --git a/Source/Geometry.cpp b/Source/Geometry.cpp index 35e34de03..ad5c110b9 100644 --- a/Source/Geometry.cpp +++ b/Source/Geometry.cpp @@ -332,7 +332,7 @@ RotatedCylinder::build( amrex::Array center = { AMREX_D_DECL(centervec[0], centervec[1], centervec[2])}; - rotation = (rotation / 180.) * M_PI; + rotation = (rotation / 180.) * constants::PI(); amrex::EB2::CylinderIF my_cyl(radius, direction, center, inside); @@ -361,7 +361,7 @@ RotatedBox::build(const amrex::Geometry& geom, const int max_coarsening_level) pp.query("box_rotation", rotation); pp.query("box_rotation_axe", rotation_axe); - rotation = (rotation / 180.) * M_PI; + rotation = (rotation / 180.) * constants::PI(); amrex::EB2::BoxIF bf(lo, hi, has_fluid_inside); diff --git a/Source/Make.package b/Source/Make.package index 44f3782d8..ecd31d6a0 100644 --- a/Source/Make.package +++ b/Source/Make.package @@ -8,7 +8,7 @@ CEXE_sources += BCfill.cpp CEXE_sources += Hydro.cpp CEXE_sources += Godunov.cpp CEXE_sources += PPM.cpp -CEXE_sources += IO.cpp +CEXE_sources += IO.cpp CEXE_sources += Sources.cpp CEXE_sources += Setup.cpp CEXE_sources += main.cpp @@ -19,7 +19,6 @@ CEXE_sources += Diffusion.cpp CEXE_sources += Utilities.cpp CEXE_sources += Transport.cpp CEXE_sources += MOL.cpp -CEXE_sources += Filter.cpp CEXE_sources += React.cpp CEXE_sources += External.cpp CEXE_sources += Forcing.cpp @@ -46,7 +45,6 @@ CEXE_headers += PPM.H CEXE_headers += Utilities.H CEXE_headers += Transport.H CEXE_headers += MOL.H -CEXE_headers += Filter.H CEXE_headers += Riemann.H CEXE_headers += LES.H CEXE_headers += WENO.H diff --git a/Submodules/PelePhysics b/Submodules/PelePhysics index 077dd3d46..769ae634f 160000 --- a/Submodules/PelePhysics +++ b/Submodules/PelePhysics @@ -1 +1 @@ -Subproject commit 077dd3d46c5c9e6141eb70693cb1831a51eb4eeb +Subproject commit 769ae634f5841212fe6ffd8fd19b36e63cecf185