diff --git a/CHANGES b/CHANGES index e8a03bfe6..511f819e6 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,18 @@ +# 24.11 + -- AMReX submodule set to 24.11 release hash (4a6e7c8) + + -- AMR functionality (#1916-1920) + + -- GAD functionality (#1912, #1875) + + -- Remove QKE (#1905) + + -- NOAH-MP interface (#1835) + + -- Line and plane sampling (#1897) + + -- AMReX & KOKKOS docs (#1889) + # 24.10 -- Add WENO7 advection operators (#1858) diff --git a/CMake/BuildERFExe.cmake b/CMake/BuildERFExe.cmake index 6c5d6195d..a2ef237cb 100644 --- a/CMake/BuildERFExe.cmake +++ b/CMake/BuildERFExe.cmake @@ -187,6 +187,7 @@ function(build_erf_lib erf_lib_name) ${SRC_DIR}/TimeIntegration/ERF_fast_rhs_N.cpp ${SRC_DIR}/TimeIntegration/ERF_fast_rhs_T.cpp ${SRC_DIR}/TimeIntegration/ERF_fast_rhs_MT.cpp + ${SRC_DIR}/Utils/ERF_AverageDown.cpp ${SRC_DIR}/Utils/ERF_ChopGrids.cpp ${SRC_DIR}/Utils/ERF_MomentumToVelocity.cpp ${SRC_DIR}/Utils/ERF_TerrainMetrics.cpp @@ -202,10 +203,10 @@ function(build_erf_lib erf_lib_name) ${SRC_DIR}/Microphysics/Kessler/ERF_Init_Kessler.cpp ${SRC_DIR}/Microphysics/Kessler/ERF_Kessler.cpp ${SRC_DIR}/Microphysics/Kessler/ERF_Update_Kessler.cpp - ${SRC_DIR}/WindFarmParametrization/Fitch/ERF_AdvanceFitch.cpp - ${SRC_DIR}/WindFarmParametrization/EWP/ERF_AdvanceEWP.cpp - ${SRC_DIR}/WindFarmParametrization/SimpleActuatorDisk/ERF_AdvanceSimpleAD.cpp - ${SRC_DIR}/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp + ${SRC_DIR}/WindFarmParametrization/Fitch/ERF_AdvanceFitch.cpp + ${SRC_DIR}/WindFarmParametrization/EWP/ERF_AdvanceEWP.cpp + ${SRC_DIR}/WindFarmParametrization/SimpleActuatorDisk/ERF_AdvanceSimpleAD.cpp + ${SRC_DIR}/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp ${SRC_DIR}/LandSurfaceModel/SLM/ERF_SLM.cpp ${SRC_DIR}/LandSurfaceModel/MM5/ERF_MM5.cpp ) diff --git a/CMakeLists.txt b/CMakeLists.txt index e045d2eb6..3b8d6b340 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,7 +247,7 @@ target_link_libraries(erf_api PUBLIC erf_srclib) add_library(${PROJECT_NAME}::erf_api ALIAS erf_srclib) # Collect all headers and make them installable with the target -set(ERF_INCLUDES "Source/ERF.H;Source/ERF_Constants.H;Source/WindFarmParametrization/SimpleActuatorDisk/ERF_SimpleAD.H;Source/WindFarmParametrization/EWP/ERF_EWP.H;Source/WindFarmParametrization/Null/ERF_NullWindFarm.H;Source/WindFarmParametrization/ERF_WindFarm.H;Source/WindFarmParametrization/Fitch/ERF_Fitch.H;Source/BoundaryConditions/ERF_PhysBCFunct.H;Source/BoundaryConditions/ERF_MOSTAverage.H;Source/BoundaryConditions/ERF_MOSTRoughness.H;Source/BoundaryConditions/ERF_ABLMost.H;Source/BoundaryConditions/ERF_FillPatcher.H;Source/BoundaryConditions/ERF_MOSTStress.H;Source/BoundaryConditions/ERF_TimeInterpolatedData.H;Source/Utils/ERF_Interpolation.H;Source/Utils/ERF_TileNoZ.H;Source/Utils/ERF_PlaneAverage.H;Source/Utils/ERF_Interpolation_WENO.H;Source/Utils/ERF_DirectionSelector.H;Source/Utils/ERF_ParFunctions.H;Source/Utils/ERF_Wstar.H;Source/Utils/ERF_Microphysics_Utils.H;Source/Utils/ERF_Sat_methods.H;Source/Utils/ERF_Interpolation_1D.H;Source/Utils/ERF_Interpolation_UPW.H;Source/Utils/ERF_TerrainMetrics.H;Source/Utils/ERF_Interpolation_WENO_Z.H;Source/Utils/ERF_Thetav.H;Source/Utils/ERF_Water_vapor_saturation.H;Source/Utils/ERF_Utils.H;Source/Utils/ERF_Orbit.H;Source/Utils/ERF_EOS.H;Source/Utils/ERF_HSE_utils.H;Source/EB/ERF_TerrainIF.H;Source/EB/ERF_FlowerIF.H;Source/EB/ERF_eb_if.H;Source/Particles/ERFPC.H;Source/Particles/ERF_ParticleData.H;Source/Prob/ERF_init_density_hse_dry.H;Source/Prob/ERF_init_rayleigh_damping.H;Source/Prob/ERF_init_constant_density_hse.H;Source/ERF_prob_common.H;Source/ERF_Derive.H;Source/Radiation/ERF_Mam4_constituents.H;Source/Radiation/ERF_Mam4_aero.H;Source/Radiation/ERF_Optics.H;Source/Radiation/ERF_Modal_aero_wateruptake.H;Source/Radiation/ERF_Cloud_rad_props.H;Source/Radiation/ERF_Phys_prop.H;Source/Radiation/ERF_Radiation.H;Source/Radiation/ERF_Albedo.H;Source/Radiation/ERF_Parameterizations.H;Source/Radiation/ERF_Rad_constants.H;Source/Radiation/ERF_Aero_rad_props.H;Source/Radiation/ERF_m2005_effradius.H;Source/Radiation/ERF_Linear_interpolate.H;Source/Radiation/ERF_Slingo.H;Source/Radiation/ERF_Rrtmgp.H;Source/Radiation/ERF_Ebert_curry.H;Source/SourceTerms/ERF_NumericalDiffusion.H;Source/SourceTerms/ERF_Src_headers.H;Source/IO/ERF_NCInterface.H;Source/IO/ERF_NCWpsFile.H;Source/IO/ERF_NCPlotFile.H;Source/IO/ERF_ReadBndryPlanes.H;Source/IO/ERF_WriteBndryPlanes.H;Source/PBL/ERF_MYNNStruct.H;Source/PBL/ERF_PBLModels.H;Source/PBL/ERF_PBLHeight.H;Source/TimeIntegration/ERF_TI_fast_rhs_fun.H;Source/TimeIntegration/ERF_TI_slow_headers.H;Source/TimeIntegration/ERF_TI_slow_rhs_fun.H;Source/TimeIntegration/ERF_TI_fast_headers.H;Source/TimeIntegration/ERF_TI_utils.H;Source/TimeIntegration/ERF_MRI.H;Source/TimeIntegration/ERF_TI_no_substep_fun.H;Source/LandSurfaceModel/Null/ERF_NullSurf.H;Source/LandSurfaceModel/ERF_LandSurface.H;Source/LandSurfaceModel/MM5/ERF_MM5.H;Source/LandSurfaceModel/SLM/ERF_SLM.H;Source/ERF_IndexDefines.H;Source/Advection/ERF_AdvectionSrcForMom_N.H;Source/Advection/ERF_AdvectionSrcForScalars.H;Source/Advection/ERF_AdvectionSrcForMom_T.H;Source/Advection/ERF_Advection.H;Source/MultiBlock/ERF_MultiBlockContainer.H;Source/Initialization/ERF_Metgrid_utils.H;Source/Diffusion/ERF_EddyViscosity.H;Source/Diffusion/ERF_Diffusion.H;Source/Microphysics/Null/ERF_NullMoistLagrangian.H;Source/Microphysics/Null/ERF_NullMoist.H;Source/Microphysics/ERF_Microphysics.H;Source/Microphysics/ERF_LagrangianMicrophysics.H;Source/Microphysics/ERF_EulerianMicrophysics.H;Source/Microphysics/Kessler/ERF_Kessler.H;Source/Microphysics/SAM/ERF_SAM.H;Source/DataStructs/ERF_InputSpongeData.H;Source/DataStructs/ERF_TurbPertStruct.H;Source/DataStructs/ERF_SpongeStruct.H;Source/DataStructs/ERF_AdvStruct.H;Source/DataStructs/ERF_DataStruct.H;Source/DataStructs/ERF_InputSoundingData.H;Source/DataStructs/ERF_DiffStruct.H;Source/DataStructs/ERF_TurbStruct.H") +set(ERF_INCLUDES "Source/ERF.H;Source/ERF_Constants.H;Source/WindFarmParametrization/SimpleActuatorDisk/ERF_SimpleAD.H;Source/WindFarmParametrization/EWP/ERF_EWP.H;Source/WindFarmParametrization/Null/ERF_NullWindFarm.H;Source/WindFarmParametrization/ERF_WindFarm.H;Source/WindFarmParametrization/Fitch/ERF_Fitch.H;Source/BoundaryConditions/ERF_PhysBCFunct.H;Source/BoundaryConditions/ERF_MOSTAverage.H;Source/BoundaryConditions/ERF_MOSTRoughness.H;Source/BoundaryConditions/ERF_ABLMost.H;Source/BoundaryConditions/ERF_FillPatcher.H;Source/BoundaryConditions/ERF_MOSTStress.H;Source/BoundaryConditions/ERF_TimeInterpolatedData.H;Source/Utils/ERF_Interpolation.H;Source/Utils/ERF_TileNoZ.H;Source/Utils/ERF_PlaneAverage.H;Source/Utils/ERF_Interpolation_WENO.H;Source/Utils/ERF_DirectionSelector.H;Source/Utils/ERF_ParFunctions.H;Source/Utils/ERF_Wstar.H;Source/Utils/ERF_Microphysics_Utils.H;Source/Utils/ERF_Sat_methods.H;Source/Utils/ERF_Interpolation_1D.H;Source/Utils/ERF_Interpolation_UPW.H;Source/Utils/ERF_TerrainMetrics.H;Source/Utils/ERF_Interpolation_WENO_Z.H;Source/Utils/ERF_Thetav.H;Source/Utils/ERF_Water_vapor_saturation.H;Source/Utils/ERF_Utils.H;Source/Utils/ERF_Orbit.H;Source/Utils/ERF_EOS.H;Source/Utils/ERF_HSE_utils.H;Source/EB/ERF_TerrainIF.H;Source/EB/ERF_FlowerIF.H;Source/EB/ERF_eb_if.H;Source/Particles/ERFPC.H;Source/Particles/ERF_ParticleData.H;Source/Prob/ERF_init_density_hse_dry.H;Source/Prob/ERF_init_rayleigh_damping.H;Source/Prob/ERF_init_constant_density_hse.H;Source/ERF_prob_common.H;Source/ERF_Derive.H;Source/Radiation/ERF_Mam4_constituents.H;Source/Radiation/ERF_Mam4_aero.H;Source/Radiation/ERF_Optics.H;Source/Radiation/ERF_Modal_aero_wateruptake.H;Source/Radiation/ERF_Cloud_rad_props.H;Source/Radiation/ERF_Phys_prop.H;Source/Radiation/ERF_Radiation.H;Source/Radiation/ERF_Albedo.H;Source/Radiation/ERF_Parameterizations.H;Source/Radiation/ERF_Rad_constants.H;Source/Radiation/ERF_Aero_rad_props.H;Source/Radiation/ERF_m2005_effradius.H;Source/Radiation/ERF_Linear_interpolate.H;Source/Radiation/ERF_Slingo.H;Source/Radiation/ERF_Rrtmgp.H;Source/Radiation/ERF_Ebert_curry.H;Source/SourceTerms/ERF_NumericalDiffusion.H;Source/SourceTerms/ERF_Src_headers.H;Source/IO/ERF_NCInterface.H;Source/IO/ERF_NCWpsFile.H;Source/IO/ERF_NCPlotFile.H;Source/IO/ERF_ReadBndryPlanes.H;Source/IO/ERF_WriteBndryPlanes.H;Source/PBL/ERF_MYNNStruct.H;Source/PBL/ERF_PBLModels.H;Source/PBL/ERF_PBLHeight.H;Source/TimeIntegration/ERF_TI_substep_fun.H;Source/TimeIntegration/ERF_TI_slow_headers.H;Source/TimeIntegration/ERF_TI_slow_rhs_fun.H;Source/TimeIntegration/ERF_TI_fast_headers.H;Source/TimeIntegration/ERF_TI_utils.H;Source/TimeIntegration/ERF_MRI.H;Source/TimeIntegration/ERF_TI_no_substep_fun.H;Source/LandSurfaceModel/Null/ERF_NullSurf.H;Source/LandSurfaceModel/ERF_LandSurface.H;Source/LandSurfaceModel/MM5/ERF_MM5.H;Source/LandSurfaceModel/SLM/ERF_SLM.H;Source/ERF_IndexDefines.H;Source/Advection/ERF_AdvectionSrcForMom_N.H;Source/Advection/ERF_AdvectionSrcForScalars.H;Source/Advection/ERF_AdvectionSrcForMom_T.H;Source/Advection/ERF_Advection.H;Source/MultiBlock/ERF_MultiBlockContainer.H;Source/Initialization/ERF_Metgrid_utils.H;Source/Diffusion/ERF_EddyViscosity.H;Source/Diffusion/ERF_Diffusion.H;Source/Microphysics/Null/ERF_NullMoistLagrangian.H;Source/Microphysics/Null/ERF_NullMoist.H;Source/Microphysics/ERF_Microphysics.H;Source/Microphysics/ERF_LagrangianMicrophysics.H;Source/Microphysics/ERF_EulerianMicrophysics.H;Source/Microphysics/Kessler/ERF_Kessler.H;Source/Microphysics/SAM/ERF_SAM.H;Source/DataStructs/ERF_InputSpongeData.H;Source/DataStructs/ERF_TurbPertStruct.H;Source/DataStructs/ERF_SpongeStruct.H;Source/DataStructs/ERF_AdvStruct.H;Source/DataStructs/ERF_DataStruct.H;Source/DataStructs/ERF_InputSoundingData.H;Source/DataStructs/ERF_DiffStruct.H;Source/DataStructs/ERF_TurbStruct.H") set_target_properties( erf_srclib PROPERTIES PUBLIC_HEADER "${ERF_INCLUDES}") diff --git a/Docs/sphinx_doc/Inputs.rst b/Docs/sphinx_doc/Inputs.rst index 2f78a91fe..8ee356c32 100644 --- a/Docs/sphinx_doc/Inputs.rst +++ b/Docs/sphinx_doc/Inputs.rst @@ -23,11 +23,21 @@ Governing Equations | | equations (instead of | | | | | the compressible equations) | | | +--------------------------+-----------------------------+---------------+-------------+ +| **erf.use_fft** | use FFT rather than | true / false | false | +| | multigrid to solve the | | | +| | the Poisson equations | | | ++--------------------------+-----------------------------+---------------+-------------+ +| **erf.mg_v** | verbosity of the multigrid | Integer >= 0 | 0 | +| | solver if used | | | +| | the Poisson equations | | | ++--------------------------+-----------------------------+---------------+-------------+ .. note:: - To solve the anelastic equations, you must set ERF_USE_POISSON_SOLVE = TRUE if using - gmake or ERF_ENABLE_POISSON_SOLVE if using cmake. + To solve the anelastic equations, you must set USE_POISSON_SOLVE = TRUE if using + gmake or ERF_ENABLE_POISSON_SOLVE if using cmake. This will enable use of the + AMReX-based Poisson solver. To optionally use the FFT solver, you must additionally + set USE_FFT = TRUE if using gmake. Problem Geometry ================ @@ -1331,7 +1341,8 @@ integrating the hydrostatic equation from the surface. If **erf.init_type = custom** or **erf.init_type = input_sounding**, ``erf.nc_init_file`` and ``erf.nc_bdy_file`` do not need to be set. -Setting **erf.project_initial_velocity = 1** will have no effect if the code is not built with **ERF_USE_POISSON_SOLVE** defined. +Setting **erf.project_initial_velocity = 1** will have no effect if the code is not built with **ERF_USE_POISSON_SOLVE** defined +if using cmake or with **USE_POISSON_SOLVE = TRUE** if using gmake. Map Scale Factors ================= diff --git a/Docs/sphinx_doc/RegressionTests.rst b/Docs/sphinx_doc/RegressionTests.rst index 559b41a21..e121ebef7 100644 --- a/Docs/sphinx_doc/RegressionTests.rst +++ b/Docs/sphinx_doc/RegressionTests.rst @@ -247,9 +247,9 @@ Test Location: `Tests/test_files/ScalarAdvectionUniformU`_ .. _`Tests/test_files/ScalarAdvectionUniformU`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/ScalarAdvectionUniformU -Problem Location: `Exec/RegTests/ScalarAdvDiff`_ +Problem Location: `Exec/DryRegTests/ScalarAdvDiff`_ -.. _`Exec/RegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/ScalarAdvDiff +.. _`Exec/DryRegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/ScalarAdvDiff .. |a2| image:: figures/tests/scalar_advec_uniform_u_start.png :width: 200 @@ -275,9 +275,9 @@ Test Location: `Tests/test_files/ScalarAdvectionShearedU`_ .. _`Tests/test_files/ScalarAdvectionShearedU`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/ScalarAdvectionShearedU -Problem Location: `Exec/RegTests/ScalarAdvDiff`_ +Problem Location: `Exec/DryRegTests/ScalarAdvDiff`_ -.. _`Exec/RegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/ScalarAdvDiff +.. _`Exec/DryRegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/ScalarAdvDiff .. |a3| image:: figures/tests/scalar_advec_sheared_u_start.png :width: 200 @@ -304,9 +304,9 @@ Test Location: `Tests/test_files/ScalarDiffusionGaussian`_ .. _`Tests/test_files/ScalarDiffusionGaussian`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/ScalarDiffusionGaussian -Problem Location: `Exec/RegTests/ScalarAdvDiff`_ +Problem Location: `Exec/DryRegTests/ScalarAdvDiff`_ -.. _`Exec/RegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/ScalarAdvDiff +.. _`Exec/DryRegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/ScalarAdvDiff .. |a5| image:: figures/tests/scalar_diff_start.png :width: 300 @@ -332,9 +332,9 @@ Test Location: `Tests/test_files/ScalarDiffusionSine`_ .. _`Tests/test_files/ScalarDiffusionSine`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/ScalarDiffusionSine -Problem Location: `Exec/RegTests/ScalarAdvDiff`_ +Problem Location: `Exec/DryRegTests/ScalarAdvDiff`_ -.. _`Exec/RegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/ScalarAdvDiff +.. _`Exec/DryRegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/ScalarAdvDiff .. |a6| image:: figures/tests/scalar_diff_sine_start.png :width: 300 @@ -361,9 +361,9 @@ Test Location (for 2nd order): `Tests/test_files/ScalarAdvDiff_order2`_ .. _`Tests/test_files/ScalarAdvDiff_order2`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/ScalarAdvDiff_order2 -Problem Location: `Exec/RegTests/ScalarAdvDiff`_ +Problem Location: `Exec/DryRegTests/ScalarAdvDiff`_ -.. _`Exec/RegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/ScalarAdvDiff +.. _`Exec/DryRegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/ScalarAdvDiff .. |a7| image:: figures/tests/scalar_advec_diff_start.png :width: 300 @@ -391,9 +391,9 @@ Test Location: `Tests/test_files/RayleighDamping`_ .. _`Tests/test_files/RayleighDamping`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/RayleighDamping -Problem Location: `Exec/RegTests/ScalarAdvDiff`_ +Problem Location: `Exec/DryRegTests/ScalarAdvDiff`_ -.. _`Exec/RegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/ScalarAdvDiff +.. _`Exec/DryRegTests/ScalarAdvDiff`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/ScalarAdvDiff Isentropic Vortex: Stationary @@ -404,9 +404,9 @@ Test Location: `Tests/test_files/IsentropicVortexStationary`_ .. _`Tests/test_files/IsentropicVortexStationary`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/IsentropicVortexStationary -Problem Location: `Exec/RegTests/IsentropicVortex`_ +Problem Location: `Exec/DryRegTests/IsentropicVortex`_ -.. _`Exec/RegTests/IsentropicVortex`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/IsentropicVortex +.. _`Exec/DryRegTests/IsentropicVortex`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/IsentropicVortex Isentropic Vortex: Advecting ---------------------------- @@ -416,9 +416,9 @@ Test Location: `Tests/test_files/IsentropicVortexAdvecting`_ .. _`Tests/test_files/IsentropicVortexAdvecting`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/IsentropicVortexAdvecting -Problem Location: `Exec/RegTests/IsentropicVortex`_ +Problem Location: `Exec/DryRegTests/IsentropicVortex`_ -.. _`Exec/RegTests/IsentropicVortex`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/IsentropicVortex +.. _`Exec/DryRegTests/IsentropicVortex`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/IsentropicVortex Taylor Green Vortex: Advection ------------------------------------------------ @@ -428,9 +428,9 @@ Test Location: `Tests/test_files/TaylorGreenAdvecting`_ .. _`Tests/test_files/TaylorGreenAdvecting`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/TaylorGreenAdvecting -Problem Location: `Exec/RegTests/TaylorGreenVortex`_ +Problem Location: `Exec/DryRegTests/TaylorGreenVortex`_ -.. _`Exec/RegTests/TaylorGreenVortex`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/TaylorGreenVortex +.. _`Exec/DryRegTests/TaylorGreenVortex`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/TaylorGreenVortex Taylor Green Vortex: Advection and Diffusion ------------------------------------------------ @@ -440,9 +440,9 @@ Test Location: `Tests/test_files/TaylorGreenAdvectingDiffusing`_ .. _`Tests/test_files/TaylorGreenAdvectingDiffusing`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/TaylorGreenAdvectingDiffusing -Problem Location: `Exec/RegTests/TaylorGreenVortex`_ +Problem Location: `Exec/DryRegTests/TaylorGreenVortex`_ -.. _`Exec/RegTests/TaylorGreenVortex`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/TaylorGreenVortex +.. _`Exec/DryRegTests/TaylorGreenVortex`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/TaylorGreenVortex .. |a8| image:: figures/tests/TGV_start.png :width: 300 @@ -472,9 +472,9 @@ Test Location: `Tests/test_files/CouetteFlow_x`_ .. _`Tests/test_files/CouetteFlow`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/CouetteFlow_x -Problem Location: `Exec/RegTests/CouetteFlow_x`_ +Problem Location: `Exec/DryRegTests/CouetteFlow_x`_ -.. _`Exec/RegTests/Couette_Poiseuille`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/Couette_Poiseuille +.. _`Exec/DryRegTests/Couette_Poiseuille`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/Couette_Poiseuille Couette Flow (y-direction) --------------------------- @@ -488,9 +488,9 @@ Test Location: `Tests/test_files/CouetteFlow_y`_ .. _`Tests/test_files/CouetteFlow`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/CouetteFlow_y -Problem Location: `Exec/RegTests/CouetteFlow_y`_ +Problem Location: `Exec/DryRegTests/CouetteFlow_y`_ -.. _`Exec/RegTests/Couette_Poiseuille`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/Couette_Poiseuille +.. _`Exec/DryRegTests/Couette_Poiseuille`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/Couette_Poiseuille Poiseuille Flow (x-direction) ----------------------------- @@ -504,9 +504,9 @@ Test Location: `Tests/test_files/PoiseuilleFlow_x`_ .. _`Tests/test_files/PoiseuilleFlow_x`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/PoiseuilleFlow_x -Problem Location: `Exec/RegTests/PoiseuilleFlow_x`_ +Problem Location: `Exec/DryRegTests/PoiseuilleFlow_x`_ -.. _`Exec/RegTests/Couette_Poiseuille`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/Couette_Poiseuille +.. _`Exec/DryRegTests/Couette_Poiseuille`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/Couette_Poiseuille Poiseuille Flow (y-direction) ----------------------------- @@ -520,9 +520,9 @@ Test Location: `Tests/test_files/PoiseuilleFlow_y`_ .. _`Tests/test_files/PoiseuilleFlow_y`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/PoiseuilleFlow_y -Problem Location: `Exec/RegTests/PoiseuilleFlow_y`_ +Problem Location: `Exec/DryRegTests/PoiseuilleFlow_y`_ -.. _`Exec/RegTests/Couette_Poiseuille`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/Couette_Poiseuille +.. _`Exec/DryRegTests/Couette_Poiseuille`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/Couette_Poiseuille Nonlinear Density Current --------------------------- @@ -534,9 +534,9 @@ Test Location: `Tests/test_files/DensityCurrent`_ .. _`Tests/test_files/DensityCurrent`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/DensityCurrent -Problem Location: `Exec/RegTests/DensityCurrent`_ +Problem Location: `Exec/DryRegTests/DensityCurrent`_ -.. _`Exec/DensityCurrent`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/DensityCurrent +.. _`Exec/DensityCurrent`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/DensityCurrent Ekman Spiral --------------------------- @@ -548,6 +548,6 @@ Test Location: `Tests/test_files/EkmanSpiral`_ .. _`Tests/test_files/EkmanSpiral`: https://github.com/erf-model/ERF/tree/development/Tests/test_files/EkmanSpiral -Problem Location: `Exec/RegTests/EkmanSpiral`_ +Problem Location: `Exec/DryRegTests/EkmanSpiral`_ -.. _`Exec/RegTests/EkmanSpiral`: https://github.com/erf-model/ERF/tree/development/Exec/RegTests/EkmanSpiral +.. _`Exec/DryRegTests/EkmanSpiral`: https://github.com/erf-model/ERF/tree/development/Exec/DryRegTests/EkmanSpiral diff --git a/Docs/sphinx_doc/Verification.rst b/Docs/sphinx_doc/Verification.rst index 1e995be4b..c0f5b89fe 100644 --- a/Docs/sphinx_doc/Verification.rst +++ b/Docs/sphinx_doc/Verification.rst @@ -159,7 +159,7 @@ Dry bubble and moist bubble rise simulations Benchmark simulations of dry and moist bubble rises in `Bryan and Fritsch`_ are reproduced. The test case consists of a warm bubble rising in dry and moist conditions. The potential temperature perturbation and the vertical velocity are compared as shown in the figures below. Excellent quantitative comparisons are obtained. The dry and moist bubble cases are -in ``Exec/RegTests/Bubble`` with the corresponding input files ``inputs_BF02_dry_bubble`` and ``inputs_BF02_moist_bubble``. +in ``Exec/DryRegTests/Bubble`` with the corresponding input files ``inputs_BF02_dry_bubble`` and ``inputs_BF02_moist_bubble``. .. _`Bryan and Fritsch`: https://journals.ametsoc.org/view/journals/mwre/130/12/1520-0493_2002_130_2917_absfmn_2.0.co_2.xml diff --git a/Docs/sphinx_doc/building.rst b/Docs/sphinx_doc/building.rst index 1777e9419..c477cde01 100644 --- a/Docs/sphinx_doc/building.rst +++ b/Docs/sphinx_doc/building.rst @@ -33,10 +33,10 @@ ERF uses the paradigm that different executables are built in different subdirec using gmake (see below), the user/developer should build in the directory of the selected problem. When using cmake (see below), separate executables are built for all of the problem directories listed in ``Exec/CMakeLists.txt``. The problem directories within ``Exec`` are sorted into 1) science-relevant setups, such as ``ABL`` for modeling the atmospheric -boundary layer or ``DensityCurrent`` for running the standard density current test case, etc, 2) regression tests in -``Exec/RegTests`` that are used for testing specific known aspects of the code functionality, such as boundary conditions or -Rayleigh damping, and 3) tests for features under development in ``Exec/DevTests``, such as moving terrain. There is a -README in each problem directory that describes the purpose/role of that problem. +boundary layer or ``DensityCurrent`` for running the standard density current test case, etc, 2) dry and moist regression tests in +``Exec/DryRegTests`` and ``Exec/MoistRegTests`` respectively, that are used for testing specific known aspects of the code functionality, +such as boundary conditions or Rayleigh damping, and 3) tests for features under development in ``Exec/DevTests``, such as moving terrain. +There is a README in each problem directory that describes the purpose/role of that problem. GNU Make ~~~~~~~~ @@ -70,7 +70,7 @@ or if using tcsh, setenv AMREX_HOME /path/to/external/amrex -#. ``cd`` to the desired build directory, e.g. ``ERF/Exec/RegTests/IsentropicVortex/`` +#. ``cd`` to the desired build directory, e.g. ``ERF/Exec/DryRegTests/IsentropicVortex/`` #. Edit the ``GNUmakefile``; options include @@ -130,7 +130,7 @@ or if using tcsh, The name of the resulting executable (generated by the GNUmake system) encodes several of the build characteristics, including dimensionality of the problem, compiler name, and whether MPI and/or OpenMP were linked with the executable. Thus, several different build configurations may coexist simultaneously in a problem folder. - For example, the default build in ``ERF/Exec/RegTests/IsentropicVortex`` will look + For example, the default build in ``ERF/Exec/DryRegTests/IsentropicVortex`` will look like ``ERF3d.gnu.MPI.ex``, indicating that this is a 3-d version of the code, made with ``COMP=gnu``, and ``USE_MPI=TRUE``. diff --git a/Docs/sphinx_doc/testing.rst b/Docs/sphinx_doc/testing.rst index e19fc9d3a..f23f04ad9 100644 --- a/Docs/sphinx_doc/testing.rst +++ b/Docs/sphinx_doc/testing.rst @@ -52,10 +52,11 @@ Adding Tests Developers are encouraged to add tests to ERF and in this section we describe how the tests are organized in the CTest framework. The locations (relative to the ERF code base) of the tests are in ``Tests``. To add a test, first -create a problem directory with a name in ``Exec/RegTests/`` (for problems to be used -as regression tests) or ``Exec/DevTests/`` (for problems testing features under development), +create a problem directory with a name in ``Exec/DryRegTests/`` or +``Exec/MoistRegTests/`` (for problems to be used as regression tests) +or ``Exec/DevTests/`` (for problems testing features under development), depending on which type of test is being added. Prepare a suitable input file. -As an example, the ``TaylorGreenVortex`` problem with input file ``Exec/RegTests/TaylorGreenVortex/inputs_ex`` +As an example, the ``TaylorGreenVortex`` problem with input file ``Exec/DryRegTests/TaylorGreenVortex/inputs_ex`` solves a simple advection-diffusion problem. The corresponding regression tests are driven by the input files ``Tests/test_files/TaylorGreenAdvecting/TaylorGreenAdvecting.i`` and ``Tests/test_files/TaylorGreenAdvectingDiffusing/TaylorGreenAdvectingDiffusing.i``. diff --git a/Exec/ABL/ERF_prob.cpp b/Exec/ABL/ERF_prob.cpp index 99808abcb..2d04b9222 100644 --- a/Exec/ABL/ERF_prob.cpp +++ b/Exec/ABL/ERF_prob.cpp @@ -134,16 +134,6 @@ Problem::init_custom_pert( 1e-12); } } - if (state_pert.nComp() > RhoQKE_comp) { - // PBL - state_pert(i, j, k, RhoQKE_comp) = r_hse(i,j,k) * 2.0 * parms_d.KE_0; - if (parms_d.KE_decay_height > 0) { - // scale initial SGS kinetic energy with height - state_pert(i, j, k, RhoQKE_comp) *= max( - std::pow(1 - min(z/parms_d.KE_decay_height,1.0), parms_d.KE_decay_order), - 1e-12); - } - } if (use_moisture) { state_pert(i, j, k, RhoQ1_comp) = 0.0; diff --git a/Exec/ABL/inputs_GABLS1_mynn25 b/Exec/ABL/inputs_GABLS1_mynn25 index 3612bc9b3..bd4afb195 100644 --- a/Exec/ABL/inputs_GABLS1_mynn25 +++ b/Exec/ABL/inputs_GABLS1_mynn25 @@ -44,7 +44,7 @@ erf.check_int = -1 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 300 # number of timesteps between plotfiles -erf.plot_vars_1 = density x_velocity y_velocity z_velocity pressure theta rhoQKE Kmv Khv +erf.plot_vars_1 = density x_velocity y_velocity z_velocity pressure theta rhoKE Kmv Khv # SOLVER CHOICE diff --git a/Exec/ABL/inputs_GABLS1_ysu b/Exec/ABL/inputs_GABLS1_ysu index 96889dbce..3b65f0ae6 100644 --- a/Exec/ABL/inputs_GABLS1_ysu +++ b/Exec/ABL/inputs_GABLS1_ysu @@ -45,7 +45,7 @@ erf.check_int = -1 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 300 # number of timesteps between plotfiles -erf.plot_vars_1 = density x_velocity y_velocity z_velocity pressure theta rhoQKE Kmv Khv Lpbl +erf.plot_vars_1 = density x_velocity y_velocity z_velocity pressure theta rhoKE Kmv Khv Lpbl # SOLVER CHOICE diff --git a/Exec/ABL_input_sounding/ERF_prob.H b/Exec/ABL_input_sounding/ERF_prob.H index 1c59364b9..58b9594a7 100644 --- a/Exec/ABL_input_sounding/ERF_prob.H +++ b/Exec/ABL_input_sounding/ERF_prob.H @@ -11,7 +11,7 @@ struct ProbParm : ProbParmDefaults { amrex::Real rho_0 = 0.0; amrex::Real T_0 = 0.0; amrex::Real A_0 = 1.0; - amrex::Real QKE_0 = 0.1; + amrex::Real KE_0 = 0.1; amrex::Real U_0 = 0.0; amrex::Real V_0 = 0.0; diff --git a/Exec/ABL_input_sounding/ERF_prob.cpp b/Exec/ABL_input_sounding/ERF_prob.cpp index 73355dd84..6b3cf46d1 100644 --- a/Exec/ABL_input_sounding/ERF_prob.cpp +++ b/Exec/ABL_input_sounding/ERF_prob.cpp @@ -16,7 +16,7 @@ Problem::Problem(const amrex::Real* problo, const amrex::Real* probhi) pp.query("rho_0", parms.rho_0); pp.query("T_0", parms.T_0); pp.query("A_0", parms.A_0); - pp.query("QKE_0", parms.QKE_0); + pp.query("KE_0", parms.KE_0); pp.query("U_0", parms.U_0); pp.query("V_0", parms.V_0); @@ -80,8 +80,8 @@ Problem::init_custom_pert( // Set scalar = A_0*exp(-10r^2), where r is distance from center of domain state_pert(i, j, k, RhoScalar_comp) = parms_d.A_0 * exp(-10.*r*r); - // Set an initial value for QKE - state_pert(i, j, k, RhoQKE_comp) = parms_d.QKE_0; + // Set an initial value for KE + state_pert(i, j, k, RhoKE_comp) = parms_d.KE_0; if (use_moisture) { state_pert(i, j, k, RhoQ1_comp) = 0.0; diff --git a/Exec/CMakeLists.txt b/Exec/CMakeLists.txt index a5b384ebd..16e72968c 100644 --- a/Exec/CMakeLists.txt +++ b/Exec/CMakeLists.txt @@ -8,32 +8,30 @@ build_erf_lib(${erf_lib_name}) if (ERF_ENABLE_MULTIBLOCK) add_subdirectory(DevTests/MultiBlock) elseif (ERF_ENABLE_REGRESSION_TESTS_ONLY) -# add_subdirectory(RegTests/Bubble) - add_subdirectory(RegTests/Couette_Poiseuille) - add_subdirectory(RegTests/DensityCurrent) - add_subdirectory(RegTests/DynamicRefinement) - add_subdirectory(RegTests/EkmanSpiral) - add_subdirectory(RegTests/IsentropicVortex) - add_subdirectory(RegTests/ScalarAdvDiff) - add_subdirectory(RegTests/TaylorGreenVortex) + add_subdirectory(DryRegTests/Couette_Poiseuille) + add_subdirectory(DryRegTests/DensityCurrent) + add_subdirectory(DryRegTests/EkmanSpiral) + add_subdirectory(DryRegTests/IsentropicVortex) + add_subdirectory(DryRegTests/ScalarAdvDiff) + add_subdirectory(DryRegTests/TaylorGreenVortex) + add_subdirectory(DryRegTests/TurbulentInflow) add_subdirectory(DevTests/MovingTerrain) else () add_subdirectory(ABL) - add_subdirectory(SuperCell) - add_subdirectory(SquallLine_2D) - add_subdirectory(RegTests/Bubble) - add_subdirectory(RegTests/Couette_Poiseuille) - add_subdirectory(RegTests/DensityCurrent) - add_subdirectory(RegTests/DynamicRefinement) - add_subdirectory(RegTests/EkmanSpiral) - add_subdirectory(RegTests/IsentropicVortex) - add_subdirectory(RegTests/ParticlesOverWoA) - add_subdirectory(RegTests/ScalarAdvDiff) - add_subdirectory(RegTests/TaylorGreenVortex) - add_subdirectory(RegTests/WitchOfAgnesi) - add_subdirectory(RegTests/WPS_Test) - add_subdirectory(RegTests/Bomex) - add_subdirectory(RegTests/TurbulentInflow) + add_subdirectory(MoistRegTests/Bomex) + add_subdirectory(MoistRegTests/Bubble) + add_subdirectory(MoistRegTests/SquallLine_2D) + add_subdirectory(MoistRegTests/SuperCell_3D) + add_subdirectory(DryRegTests/Couette_Poiseuille) + add_subdirectory(DryRegTests/DensityCurrent) + add_subdirectory(DryRegTests/EkmanSpiral) + add_subdirectory(DryRegTests/IsentropicVortex) + add_subdirectory(DryRegTests/ParticlesOverWoA) + add_subdirectory(DryRegTests/ScalarAdvDiff) + add_subdirectory(DryRegTests/TaylorGreenVortex) + add_subdirectory(DryRegTests/TurbulentInflow) + add_subdirectory(DryRegTests/WitchOfAgnesi) + add_subdirectory(DryRegTests/WPS_Test) add_subdirectory(DevTests/LandSurfaceModel) add_subdirectory(DevTests/MetGrid) add_subdirectory(DevTests/MovingTerrain) diff --git a/Exec/DevTests/ABL_with_WW3/ERF_prob.H b/Exec/DevTests/ABL_with_WW3/ERF_prob.H index 67077f6e5..aaedb9c7b 100644 --- a/Exec/DevTests/ABL_with_WW3/ERF_prob.H +++ b/Exec/DevTests/ABL_with_WW3/ERF_prob.H @@ -12,7 +12,6 @@ struct ProbParm : ProbParmDefaults { amrex::Real T_0 = 0.0; amrex::Real A_0 = 1.0; amrex::Real KE_0 = 0.1; - amrex::Real QKE_0 = 0.1; amrex::Real KE_decay_height = -1; amrex::Real KE_decay_order = 1; diff --git a/Exec/DevTests/ABL_with_WW3/ERF_prob.cpp b/Exec/DevTests/ABL_with_WW3/ERF_prob.cpp index 8790b3ebf..2d04b9222 100644 --- a/Exec/DevTests/ABL_with_WW3/ERF_prob.cpp +++ b/Exec/DevTests/ABL_with_WW3/ERF_prob.cpp @@ -17,7 +17,6 @@ Problem::Problem(const amrex::Real* problo, const amrex::Real* probhi) pp.query("T_0", parms.T_0); pp.query("A_0", parms.A_0); pp.query("KE_0", parms.KE_0); - pp.query("QKE_0", parms.QKE_0); pp.query("KE_decay_height", parms.KE_decay_height); pp.query("KE_decay_order", parms.KE_decay_order); @@ -135,16 +134,6 @@ Problem::init_custom_pert( 1e-12); } } - if (state_pert.nComp() > RhoQKE_comp) { - // PBL - state_pert(i, j, k, RhoQKE_comp) = r_hse(i,j,k) * parms_d.QKE_0; - if (parms_d.KE_decay_height > 0) { - // scale initial SGS kinetic energy with height - state_pert(i, j, k, RhoQKE_comp) *= max( - std::pow(1 - min(z/parms_d.KE_decay_height,1.0), parms_d.KE_decay_order), - 1e-12); - } - } if (use_moisture) { state_pert(i, j, k, RhoQ1_comp) = 0.0; diff --git a/Exec/DevTests/LandSurfaceModel/inputs b/Exec/DevTests/LandSurfaceModel/inputs index cb29c9132..de93aa53d 100644 --- a/Exec/DevTests/LandSurfaceModel/inputs +++ b/Exec/DevTests/LandSurfaceModel/inputs @@ -55,7 +55,7 @@ erf.molec_diff_type = "None" erf.les_type = "Smagorinsky" erf.Cs = 0.1 #erf.pbl_type = "MYNN2.5" -#erf.QKE_0 = 0.5 +#erf.KE_0 = 0.5 erf.use_terrain = true erf.terrain_smoothing = 2 diff --git a/Exec/DevTests/Radiation/ERF_prob.H b/Exec/DevTests/Radiation/ERF_prob.H index 94f58ed36..6e5afd46c 100644 --- a/Exec/DevTests/Radiation/ERF_prob.H +++ b/Exec/DevTests/Radiation/ERF_prob.H @@ -54,7 +54,7 @@ public: amrex::Real zdamp) override; protected: - std::string name() override { return "Supercell"; } + std::string name() override { return "Radiation"; } private: ProbParm parms; diff --git a/Exec/DevTests/TemperatureSource/ERF_prob.H b/Exec/DevTests/TemperatureSource/ERF_prob.H index df04de7c6..036f331ef 100644 --- a/Exec/DevTests/TemperatureSource/ERF_prob.H +++ b/Exec/DevTests/TemperatureSource/ERF_prob.H @@ -11,7 +11,7 @@ struct ProbParm : ProbParmDefaults { amrex::Real rho_0 = 0.0; amrex::Real T_0 = 0.0; amrex::Real A_0 = 1.0; - amrex::Real QKE_0 = 0.1; + amrex::Real KE_0 = 0.1; amrex::Real U_0 = 0.0; amrex::Real V_0 = 0.0; diff --git a/Exec/DevTests/TemperatureSource/ERF_prob.cpp b/Exec/DevTests/TemperatureSource/ERF_prob.cpp index 80e83a867..1b096f21a 100644 --- a/Exec/DevTests/TemperatureSource/ERF_prob.cpp +++ b/Exec/DevTests/TemperatureSource/ERF_prob.cpp @@ -17,7 +17,7 @@ Problem::Problem(const amrex::Real* problo, const amrex::Real* probhi) pp.query("rho_0", parms.rho_0); pp.query("T_0", parms.T_0); pp.query("A_0", parms.A_0); - pp.query("QKE_0", parms.QKE_0); + pp.query("KE_0", parms.KE_0); pp.query("U_0", parms.U_0); pp.query("V_0", parms.V_0); @@ -96,8 +96,8 @@ Problem::init_custom_pert( // Set scalar = A_0*exp(-10r^2), where r is distance from center of domain state_pert(i, j, k, RhoScalar_comp) = parms_d.A_0 * exp(-10.*r*r); - // Set an initial value for QKE - state_pert(i, j, k, RhoQKE_comp) = parms_d.QKE_0; + // Set an initial value for KE + state_pert(i, j, k, RhoKE_comp) = parms_d.KE_0; if (use_moisture) { state_pert(i, j, k, RhoQ1_comp) = 0.0; diff --git a/Exec/DevTests/TropicalCyclone/ERF_prob.H b/Exec/DevTests/TropicalCyclone/ERF_prob.H index 3c0a0319f..faf57a918 100644 --- a/Exec/DevTests/TropicalCyclone/ERF_prob.H +++ b/Exec/DevTests/TropicalCyclone/ERF_prob.H @@ -8,7 +8,7 @@ #include "ERF_prob_common.H" struct ProbParm : ProbParmDefaults { - amrex::Real QKE_0 = 0.1; + amrex::Real KE_0 = 0.1; amrex::Real Xc_0 = 0.0; amrex::Real Yc_0 = 0.0; diff --git a/Exec/DevTests/TropicalCyclone/ERF_prob.cpp b/Exec/DevTests/TropicalCyclone/ERF_prob.cpp index 5e51e818a..e28f156a3 100644 --- a/Exec/DevTests/TropicalCyclone/ERF_prob.cpp +++ b/Exec/DevTests/TropicalCyclone/ERF_prob.cpp @@ -19,7 +19,7 @@ Problem::Problem() pp.query("U_0", parms.U_0); // for Rayleigh damping pp.query("V_0", parms.V_0); // for Rayleigh damping pp.query("W_0", parms.W_0); // for Rayleigh damping - pp.query("QKE_0", parms.QKE_0); + pp.query("KE_0", parms.KE_0); pp.query("Xc_0", parms.Xc_0); pp.query("Yc_0", parms.Yc_0); @@ -60,11 +60,11 @@ Problem::init_custom_pert( // and/or set initial values for other scalars // - // QKE for PBL - Real QKE_0 = parms.QKE_0; + // KE for MYNN or Deardorff + Real KE_0 = parms.KE_0; amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { - state_pert(i, j, k, RhoQKE_comp) = r_hse(i,j,k) * QKE_0; + state_pert(i, j, k, RhoKE_comp) = r_hse(i,j,k) * KE_0; }); // diff --git a/Exec/DevTests/TropicalCyclone/inputs b/Exec/DevTests/TropicalCyclone/inputs index 66994811b..7373205bc 100644 --- a/Exec/DevTests/TropicalCyclone/inputs +++ b/Exec/DevTests/TropicalCyclone/inputs @@ -57,12 +57,12 @@ erf.check_int = 1000 # number of timesteps between checkpoints #erf.plotfile_type = netcdf erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 200 # number of timesteps between plotfiles -erf.plot_vars_1 = density x_velocity y_velocity z_velocity pressure theta QKE Kmv Khv +erf.plot_vars_1 = density x_velocity y_velocity z_velocity pressure theta KE Kmv Khv # SOLVER CHOICE erf.use_gravity = true erf.pbl_type = "MYNN2.5" -erf.advect_QKE = false +erf.advect_KE = false erf.les_type = "None" erf.molec_diff_type = "None" #erf.molec_diff_type = "Constant" @@ -92,7 +92,7 @@ prob.RZERO = 100e3 prob.ZZERO = 5e3 prob.RMAX = 20e3 prob.VMAX = 15. -prob.QKE_0 = 0.5 +prob.KE_0 = 0.5 # INITIALIZATION WITH ATM DATA erf.init_type = "input_sounding" diff --git a/Exec/RegTests/Couette_Poiseuille/CMakeLists.txt b/Exec/DryRegTests/Couette_Poiseuille/CMakeLists.txt similarity index 100% rename from Exec/RegTests/Couette_Poiseuille/CMakeLists.txt rename to Exec/DryRegTests/Couette_Poiseuille/CMakeLists.txt diff --git a/Exec/RegTests/Couette_Poiseuille/ERF_prob.H b/Exec/DryRegTests/Couette_Poiseuille/ERF_prob.H similarity index 100% rename from Exec/RegTests/Couette_Poiseuille/ERF_prob.H rename to Exec/DryRegTests/Couette_Poiseuille/ERF_prob.H diff --git a/Exec/RegTests/Couette_Poiseuille/ERF_prob.cpp b/Exec/DryRegTests/Couette_Poiseuille/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/Couette_Poiseuille/ERF_prob.cpp rename to Exec/DryRegTests/Couette_Poiseuille/ERF_prob.cpp diff --git a/Exec/RegTests/Couette_Poiseuille/GNUmakefile b/Exec/DryRegTests/Couette_Poiseuille/GNUmakefile similarity index 87% rename from Exec/RegTests/Couette_Poiseuille/GNUmakefile rename to Exec/DryRegTests/Couette_Poiseuille/GNUmakefile index 1efc87478..86ea62113 100644 --- a/Exec/RegTests/Couette_Poiseuille/GNUmakefile +++ b/Exec/DryRegTests/Couette_Poiseuille/GNUmakefile @@ -29,5 +29,5 @@ Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/Couette_Poiseuille +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/Couette_Poiseuille include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/AWAKEN/Make.package b/Exec/DryRegTests/Couette_Poiseuille/Make.package similarity index 100% rename from Exec/AWAKEN/Make.package rename to Exec/DryRegTests/Couette_Poiseuille/Make.package diff --git a/Exec/RegTests/Couette_Poiseuille/README b/Exec/DryRegTests/Couette_Poiseuille/README similarity index 100% rename from Exec/RegTests/Couette_Poiseuille/README rename to Exec/DryRegTests/Couette_Poiseuille/README diff --git a/Exec/RegTests/Couette_Poiseuille/couette_helpers.py b/Exec/DryRegTests/Couette_Poiseuille/couette_helpers.py similarity index 100% rename from Exec/RegTests/Couette_Poiseuille/couette_helpers.py rename to Exec/DryRegTests/Couette_Poiseuille/couette_helpers.py diff --git a/Exec/RegTests/Couette_Poiseuille/inputs_couette_x b/Exec/DryRegTests/Couette_Poiseuille/inputs_couette_x similarity index 100% rename from Exec/RegTests/Couette_Poiseuille/inputs_couette_x rename to Exec/DryRegTests/Couette_Poiseuille/inputs_couette_x diff --git a/Exec/RegTests/Couette_Poiseuille/inputs_couette_y b/Exec/DryRegTests/Couette_Poiseuille/inputs_couette_y similarity index 100% rename from Exec/RegTests/Couette_Poiseuille/inputs_couette_y rename to Exec/DryRegTests/Couette_Poiseuille/inputs_couette_y diff --git a/Exec/RegTests/Couette_Poiseuille/inputs_poiseuille_x b/Exec/DryRegTests/Couette_Poiseuille/inputs_poiseuille_x similarity index 100% rename from Exec/RegTests/Couette_Poiseuille/inputs_poiseuille_x rename to Exec/DryRegTests/Couette_Poiseuille/inputs_poiseuille_x diff --git a/Exec/RegTests/Couette_Poiseuille/inputs_poiseuille_y b/Exec/DryRegTests/Couette_Poiseuille/inputs_poiseuille_y similarity index 100% rename from Exec/RegTests/Couette_Poiseuille/inputs_poiseuille_y rename to Exec/DryRegTests/Couette_Poiseuille/inputs_poiseuille_y diff --git a/Exec/RegTests/Couette_Poiseuille/plot_couette_flow_evolution.py b/Exec/DryRegTests/Couette_Poiseuille/plot_couette_flow_evolution.py similarity index 100% rename from Exec/RegTests/Couette_Poiseuille/plot_couette_flow_evolution.py rename to Exec/DryRegTests/Couette_Poiseuille/plot_couette_flow_evolution.py diff --git a/Exec/RegTests/DensityCurrent/CMakeLists.txt b/Exec/DryRegTests/DensityCurrent/CMakeLists.txt similarity index 100% rename from Exec/RegTests/DensityCurrent/CMakeLists.txt rename to Exec/DryRegTests/DensityCurrent/CMakeLists.txt diff --git a/Exec/RegTests/DensityCurrent/ERF_prob.H b/Exec/DryRegTests/DensityCurrent/ERF_prob.H similarity index 100% rename from Exec/RegTests/DensityCurrent/ERF_prob.H rename to Exec/DryRegTests/DensityCurrent/ERF_prob.H diff --git a/Exec/RegTests/DensityCurrent/ERF_prob.cpp b/Exec/DryRegTests/DensityCurrent/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/DensityCurrent/ERF_prob.cpp rename to Exec/DryRegTests/DensityCurrent/ERF_prob.cpp diff --git a/Exec/DryRegTests/DensityCurrent/GNUmakefile b/Exec/DryRegTests/DensityCurrent/GNUmakefile new file mode 100644 index 000000000..f61d2ae0e --- /dev/null +++ b/Exec/DryRegTests/DensityCurrent/GNUmakefile @@ -0,0 +1,34 @@ +# AMReX +COMP = gnu +PRECISION = DOUBLE + +# Profiling +PROFILE = FALSE +TINY_PROFILE = FALSE +COMM_PROFILE = FALSE +TRACE_PROFILE = FALSE +MEM_PROFILE = FALSE +USE_GPROF = FALSE + +# Performance +USE_MPI = TRUE +USE_OMP = FALSE + +USE_CUDA = FALSE +USE_HIP = FALSE +USE_SYCL = FALSE + +# Debugging +DEBUG = FALSE + +TEST = TRUE +USE_ASSERTION = TRUE + +USE_POISSON_SOLVE = TRUE + +# GNU Make +Bpack := ./Make.package +Blocs := . +ERF_HOME := ../../.. +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/DensityCurrent +include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/EWP/Make.package b/Exec/DryRegTests/DensityCurrent/Make.package similarity index 100% rename from Exec/EWP/Make.package rename to Exec/DryRegTests/DensityCurrent/Make.package diff --git a/Exec/RegTests/DensityCurrent/README b/Exec/DryRegTests/DensityCurrent/README similarity index 100% rename from Exec/RegTests/DensityCurrent/README rename to Exec/DryRegTests/DensityCurrent/README diff --git a/Exec/RegTests/DensityCurrent/inputs_amr b/Exec/DryRegTests/DensityCurrent/inputs_amr similarity index 93% rename from Exec/RegTests/DensityCurrent/inputs_amr rename to Exec/DryRegTests/DensityCurrent/inputs_amr index 11a5373d4..173529de8 100644 --- a/Exec/RegTests/DensityCurrent/inputs_amr +++ b/Exec/DryRegTests/DensityCurrent/inputs_amr @@ -36,8 +36,8 @@ amr.max_level = 1 # maximum level number allowed amr.n_cell = 128 1 32 # dx=dy=dz=100 m, Straka et al 1993 / Xue et al 2000 erf.fixed_dt = 2.0 # fixed time step [s] -- Straka et al 1993 erf.fixed_fast_dt = 0.5 # fixed time step [s] -- Straka et al 1993 -erf.plot_int_1 = 100 # number of timesteps between plotfiles -erf.check_int =-1000 # number of timesteps between checkpoints +erf.plot_int_1 = 150 # number of timesteps between plotfiles +erf.check_int =-100 # number of timesteps between checkpoints # DIAGNOSTICS & VERBOSITY erf.sum_interval =-1 # timesteps between computing mass @@ -73,7 +73,6 @@ prob.U_0 = 0.0 ################################ MULTILEVEL ################################ amr.ref_ratio_vect = 2 1 2 -erf.coupling_type = "OneWay" erf.regrid_int = 10 erf.refinement_indicators = lo_theta diff --git a/Exec/RegTests/DensityCurrent/inputs_crse_halfdomain b/Exec/DryRegTests/DensityCurrent/inputs_crse_halfdomain similarity index 100% rename from Exec/RegTests/DensityCurrent/inputs_crse_halfdomain rename to Exec/DryRegTests/DensityCurrent/inputs_crse_halfdomain diff --git a/Exec/RegTests/DensityCurrent/inputs_crse_halfdomain_zlev b/Exec/DryRegTests/DensityCurrent/inputs_crse_halfdomain_zlev similarity index 100% rename from Exec/RegTests/DensityCurrent/inputs_crse_halfdomain_zlev rename to Exec/DryRegTests/DensityCurrent/inputs_crse_halfdomain_zlev diff --git a/Exec/RegTests/DensityCurrent/inputs_refsoln b/Exec/DryRegTests/DensityCurrent/inputs_refsoln similarity index 100% rename from Exec/RegTests/DensityCurrent/inputs_refsoln rename to Exec/DryRegTests/DensityCurrent/inputs_refsoln diff --git a/Exec/RegTests/DensityCurrent/inputs_wrf_baseline b/Exec/DryRegTests/DensityCurrent/inputs_wrf_baseline similarity index 100% rename from Exec/RegTests/DensityCurrent/inputs_wrf_baseline rename to Exec/DryRegTests/DensityCurrent/inputs_wrf_baseline diff --git a/Exec/RegTests/DensityCurrent/runscript_baseline b/Exec/DryRegTests/DensityCurrent/runscript_baseline similarity index 100% rename from Exec/RegTests/DensityCurrent/runscript_baseline rename to Exec/DryRegTests/DensityCurrent/runscript_baseline diff --git a/Exec/RegTests/DensityCurrent/runscript_refsoln b/Exec/DryRegTests/DensityCurrent/runscript_refsoln similarity index 100% rename from Exec/RegTests/DensityCurrent/runscript_refsoln rename to Exec/DryRegTests/DensityCurrent/runscript_refsoln diff --git a/Exec/RegTests/EkmanSpiral/CMakeLists.txt b/Exec/DryRegTests/EkmanSpiral/CMakeLists.txt similarity index 100% rename from Exec/RegTests/EkmanSpiral/CMakeLists.txt rename to Exec/DryRegTests/EkmanSpiral/CMakeLists.txt diff --git a/Exec/RegTests/EkmanSpiral/ERF_prob.H b/Exec/DryRegTests/EkmanSpiral/ERF_prob.H similarity index 100% rename from Exec/RegTests/EkmanSpiral/ERF_prob.H rename to Exec/DryRegTests/EkmanSpiral/ERF_prob.H diff --git a/Exec/RegTests/EkmanSpiral/ERF_prob.cpp b/Exec/DryRegTests/EkmanSpiral/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/EkmanSpiral/ERF_prob.cpp rename to Exec/DryRegTests/EkmanSpiral/ERF_prob.cpp diff --git a/Exec/RegTests/EkmanSpiral/GNUmakefile b/Exec/DryRegTests/EkmanSpiral/GNUmakefile similarity index 89% rename from Exec/RegTests/EkmanSpiral/GNUmakefile rename to Exec/DryRegTests/EkmanSpiral/GNUmakefile index 63e0a52ef..23a64fb3e 100644 --- a/Exec/RegTests/EkmanSpiral/GNUmakefile +++ b/Exec/DryRegTests/EkmanSpiral/GNUmakefile @@ -32,5 +32,5 @@ Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/EkmanSpiral +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/EkmanSpiral include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/Bomex/Make.package b/Exec/DryRegTests/EkmanSpiral/Make.package similarity index 100% rename from Exec/RegTests/Bomex/Make.package rename to Exec/DryRegTests/EkmanSpiral/Make.package diff --git a/Exec/RegTests/EkmanSpiral/README b/Exec/DryRegTests/EkmanSpiral/README similarity index 100% rename from Exec/RegTests/EkmanSpiral/README rename to Exec/DryRegTests/EkmanSpiral/README diff --git a/Exec/RegTests/EkmanSpiral/check_convergence.py b/Exec/DryRegTests/EkmanSpiral/check_convergence.py similarity index 100% rename from Exec/RegTests/EkmanSpiral/check_convergence.py rename to Exec/DryRegTests/EkmanSpiral/check_convergence.py diff --git a/Exec/RegTests/EkmanSpiral/input_sounding_file b/Exec/DryRegTests/EkmanSpiral/input_sounding_file similarity index 100% rename from Exec/RegTests/EkmanSpiral/input_sounding_file rename to Exec/DryRegTests/EkmanSpiral/input_sounding_file diff --git a/Exec/RegTests/EkmanSpiral/inputs_custom b/Exec/DryRegTests/EkmanSpiral/inputs_custom similarity index 100% rename from Exec/RegTests/EkmanSpiral/inputs_custom rename to Exec/DryRegTests/EkmanSpiral/inputs_custom diff --git a/Exec/RegTests/EkmanSpiral/inputs_ideal b/Exec/DryRegTests/EkmanSpiral/inputs_ideal similarity index 100% rename from Exec/RegTests/EkmanSpiral/inputs_ideal rename to Exec/DryRegTests/EkmanSpiral/inputs_ideal diff --git a/Exec/RegTests/EkmanSpiral/inputs_input_sounding b/Exec/DryRegTests/EkmanSpiral/inputs_input_sounding similarity index 100% rename from Exec/RegTests/EkmanSpiral/inputs_input_sounding rename to Exec/DryRegTests/EkmanSpiral/inputs_input_sounding diff --git a/Exec/RegTests/EkmanSpiral/run_convergence_study.sh b/Exec/DryRegTests/EkmanSpiral/run_convergence_study.sh similarity index 100% rename from Exec/RegTests/EkmanSpiral/run_convergence_study.sh rename to Exec/DryRegTests/EkmanSpiral/run_convergence_study.sh diff --git a/Exec/RegTests/EkmanSpiral/wrfinput_ekman_d01 b/Exec/DryRegTests/EkmanSpiral/wrfinput_ekman_d01 similarity index 100% rename from Exec/RegTests/EkmanSpiral/wrfinput_ekman_d01 rename to Exec/DryRegTests/EkmanSpiral/wrfinput_ekman_d01 diff --git a/Exec/RegTests/IsentropicVortex/CMakeLists.txt b/Exec/DryRegTests/IsentropicVortex/CMakeLists.txt similarity index 100% rename from Exec/RegTests/IsentropicVortex/CMakeLists.txt rename to Exec/DryRegTests/IsentropicVortex/CMakeLists.txt diff --git a/Exec/RegTests/IsentropicVortex/ERF_prob.H b/Exec/DryRegTests/IsentropicVortex/ERF_prob.H similarity index 100% rename from Exec/RegTests/IsentropicVortex/ERF_prob.H rename to Exec/DryRegTests/IsentropicVortex/ERF_prob.H diff --git a/Exec/RegTests/IsentropicVortex/ERF_prob.cpp b/Exec/DryRegTests/IsentropicVortex/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/IsentropicVortex/ERF_prob.cpp rename to Exec/DryRegTests/IsentropicVortex/ERF_prob.cpp diff --git a/Exec/RegTests/DynamicRefinement/GNUmakefile b/Exec/DryRegTests/IsentropicVortex/GNUmakefile similarity index 87% rename from Exec/RegTests/DynamicRefinement/GNUmakefile rename to Exec/DryRegTests/IsentropicVortex/GNUmakefile index 329e9d444..10b5158be 100644 --- a/Exec/RegTests/DynamicRefinement/GNUmakefile +++ b/Exec/DryRegTests/IsentropicVortex/GNUmakefile @@ -29,5 +29,5 @@ Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/DynamicRefinement +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/IsentropicVortex include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/Bubble/Make.package b/Exec/DryRegTests/IsentropicVortex/Make.package similarity index 100% rename from Exec/RegTests/Bubble/Make.package rename to Exec/DryRegTests/IsentropicVortex/Make.package diff --git a/Exec/RegTests/IsentropicVortex/animate.py b/Exec/DryRegTests/IsentropicVortex/animate.py similarity index 100% rename from Exec/RegTests/IsentropicVortex/animate.py rename to Exec/DryRegTests/IsentropicVortex/animate.py diff --git a/Exec/RegTests/IsentropicVortex/check_initial_solution.py b/Exec/DryRegTests/IsentropicVortex/check_initial_solution.py similarity index 100% rename from Exec/RegTests/IsentropicVortex/check_initial_solution.py rename to Exec/DryRegTests/IsentropicVortex/check_initial_solution.py diff --git a/Exec/RegTests/IsentropicVortex/check_stationary_vortex_rmse.py b/Exec/DryRegTests/IsentropicVortex/check_stationary_vortex_rmse.py similarity index 100% rename from Exec/RegTests/IsentropicVortex/check_stationary_vortex_rmse.py rename to Exec/DryRegTests/IsentropicVortex/check_stationary_vortex_rmse.py diff --git a/Exec/RegTests/IsentropicVortex/check_vortex_rmse.py b/Exec/DryRegTests/IsentropicVortex/check_vortex_rmse.py similarity index 100% rename from Exec/RegTests/IsentropicVortex/check_vortex_rmse.py rename to Exec/DryRegTests/IsentropicVortex/check_vortex_rmse.py diff --git a/Exec/RegTests/IsentropicVortex/inputs_advecting b/Exec/DryRegTests/IsentropicVortex/inputs_advecting similarity index 100% rename from Exec/RegTests/IsentropicVortex/inputs_advecting rename to Exec/DryRegTests/IsentropicVortex/inputs_advecting diff --git a/Exec/RegTests/IsentropicVortex/inputs_advecting_ml b/Exec/DryRegTests/IsentropicVortex/inputs_advecting_ml similarity index 100% rename from Exec/RegTests/IsentropicVortex/inputs_advecting_ml rename to Exec/DryRegTests/IsentropicVortex/inputs_advecting_ml diff --git a/Exec/RegTests/IsentropicVortex/inputs_advecting_msf b/Exec/DryRegTests/IsentropicVortex/inputs_advecting_msf similarity index 100% rename from Exec/RegTests/IsentropicVortex/inputs_advecting_msf rename to Exec/DryRegTests/IsentropicVortex/inputs_advecting_msf diff --git a/Exec/RegTests/IsentropicVortex/inputs_advecting_no_msf b/Exec/DryRegTests/IsentropicVortex/inputs_advecting_no_msf similarity index 100% rename from Exec/RegTests/IsentropicVortex/inputs_advecting_no_msf rename to Exec/DryRegTests/IsentropicVortex/inputs_advecting_no_msf diff --git a/Exec/RegTests/IsentropicVortex/inputs_stationary b/Exec/DryRegTests/IsentropicVortex/inputs_stationary similarity index 100% rename from Exec/RegTests/IsentropicVortex/inputs_stationary rename to Exec/DryRegTests/IsentropicVortex/inputs_stationary diff --git a/Exec/RegTests/IsentropicVortex/inputs_stationary_msf b/Exec/DryRegTests/IsentropicVortex/inputs_stationary_msf similarity index 100% rename from Exec/RegTests/IsentropicVortex/inputs_stationary_msf rename to Exec/DryRegTests/IsentropicVortex/inputs_stationary_msf diff --git a/Exec/RegTests/IsentropicVortex/inputs_stationary_no_msf b/Exec/DryRegTests/IsentropicVortex/inputs_stationary_no_msf similarity index 100% rename from Exec/RegTests/IsentropicVortex/inputs_stationary_no_msf rename to Exec/DryRegTests/IsentropicVortex/inputs_stationary_no_msf diff --git a/Exec/RegTests/IsentropicVortex/isentropic_vortex_helpers.py b/Exec/DryRegTests/IsentropicVortex/isentropic_vortex_helpers.py similarity index 100% rename from Exec/RegTests/IsentropicVortex/isentropic_vortex_helpers.py rename to Exec/DryRegTests/IsentropicVortex/isentropic_vortex_helpers.py diff --git a/Exec/RegTests/ParticlesOverWoA/CMakeLists.txt b/Exec/DryRegTests/ParticlesOverWoA/CMakeLists.txt similarity index 100% rename from Exec/RegTests/ParticlesOverWoA/CMakeLists.txt rename to Exec/DryRegTests/ParticlesOverWoA/CMakeLists.txt diff --git a/Exec/RegTests/ParticlesOverWoA/ERF_prob.H b/Exec/DryRegTests/ParticlesOverWoA/ERF_prob.H similarity index 100% rename from Exec/RegTests/ParticlesOverWoA/ERF_prob.H rename to Exec/DryRegTests/ParticlesOverWoA/ERF_prob.H diff --git a/Exec/RegTests/ParticlesOverWoA/ERF_prob.cpp b/Exec/DryRegTests/ParticlesOverWoA/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/ParticlesOverWoA/ERF_prob.cpp rename to Exec/DryRegTests/ParticlesOverWoA/ERF_prob.cpp diff --git a/Exec/RegTests/ParticlesOverWoA/GNUmakefile b/Exec/DryRegTests/ParticlesOverWoA/GNUmakefile similarity index 88% rename from Exec/RegTests/ParticlesOverWoA/GNUmakefile rename to Exec/DryRegTests/ParticlesOverWoA/GNUmakefile index 8bc175ef1..01a7a7dac 100644 --- a/Exec/RegTests/ParticlesOverWoA/GNUmakefile +++ b/Exec/DryRegTests/ParticlesOverWoA/GNUmakefile @@ -31,5 +31,5 @@ Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/ParticlesOverWoA +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/ParticlesOverWoA include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/Couette_Poiseuille/Make.package b/Exec/DryRegTests/ParticlesOverWoA/Make.package similarity index 100% rename from Exec/RegTests/Couette_Poiseuille/Make.package rename to Exec/DryRegTests/ParticlesOverWoA/Make.package diff --git a/Exec/RegTests/ParticlesOverWoA/README b/Exec/DryRegTests/ParticlesOverWoA/README similarity index 100% rename from Exec/RegTests/ParticlesOverWoA/README rename to Exec/DryRegTests/ParticlesOverWoA/README diff --git a/Exec/RegTests/ParticlesOverWoA/inputs b/Exec/DryRegTests/ParticlesOverWoA/inputs similarity index 100% rename from Exec/RegTests/ParticlesOverWoA/inputs rename to Exec/DryRegTests/ParticlesOverWoA/inputs diff --git a/Exec/RegTests/ScalarAdvDiff/CMakeLists.txt b/Exec/DryRegTests/ScalarAdvDiff/CMakeLists.txt similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/CMakeLists.txt rename to Exec/DryRegTests/ScalarAdvDiff/CMakeLists.txt diff --git a/Exec/RegTests/ScalarAdvDiff/ERF_prob.H b/Exec/DryRegTests/ScalarAdvDiff/ERF_prob.H similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/ERF_prob.H rename to Exec/DryRegTests/ScalarAdvDiff/ERF_prob.H diff --git a/Exec/RegTests/ScalarAdvDiff/ERF_prob.cpp b/Exec/DryRegTests/ScalarAdvDiff/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/ERF_prob.cpp rename to Exec/DryRegTests/ScalarAdvDiff/ERF_prob.cpp diff --git a/Exec/RegTests/ScalarAdvDiff/GNUmakefile b/Exec/DryRegTests/ScalarAdvDiff/GNUmakefile similarity index 87% rename from Exec/RegTests/ScalarAdvDiff/GNUmakefile rename to Exec/DryRegTests/ScalarAdvDiff/GNUmakefile index a81273724..1975a7109 100644 --- a/Exec/RegTests/ScalarAdvDiff/GNUmakefile +++ b/Exec/DryRegTests/ScalarAdvDiff/GNUmakefile @@ -29,5 +29,5 @@ Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/ScalarAdvDiff +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/ScalarAdvDiff include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/DensityCurrent/Make.package b/Exec/DryRegTests/ScalarAdvDiff/Make.package similarity index 100% rename from Exec/RegTests/DensityCurrent/Make.package rename to Exec/DryRegTests/ScalarAdvDiff/Make.package diff --git a/Exec/RegTests/ScalarAdvDiff/README b/Exec/DryRegTests/ScalarAdvDiff/README similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/README rename to Exec/DryRegTests/ScalarAdvDiff/README diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_WENO b/Exec/DryRegTests/ScalarAdvDiff/inputs_WENO similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_WENO rename to Exec/DryRegTests/ScalarAdvDiff/inputs_WENO diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_WENO_Z b/Exec/DryRegTests/ScalarAdvDiff/inputs_WENO_Z similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_WENO_Z rename to Exec/DryRegTests/ScalarAdvDiff/inputs_WENO_Z diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_adv_diff_uniformU b/Exec/DryRegTests/ScalarAdvDiff/inputs_adv_diff_uniformU similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_adv_diff_uniformU rename to Exec/DryRegTests/ScalarAdvDiff/inputs_adv_diff_uniformU diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_advdiffinflowoutflow b/Exec/DryRegTests/ScalarAdvDiff/inputs_advdiffinflowoutflow similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_advdiffinflowoutflow rename to Exec/DryRegTests/ScalarAdvDiff/inputs_advdiffinflowoutflow diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_advect_shearU b/Exec/DryRegTests/ScalarAdvDiff/inputs_advect_shearU similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_advect_shearU rename to Exec/DryRegTests/ScalarAdvDiff/inputs_advect_shearU diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_advect_shearU_msf b/Exec/DryRegTests/ScalarAdvDiff/inputs_advect_shearU_msf similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_advect_shearU_msf rename to Exec/DryRegTests/ScalarAdvDiff/inputs_advect_shearU_msf diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_advect_shearU_no_msf b/Exec/DryRegTests/ScalarAdvDiff/inputs_advect_shearU_no_msf similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_advect_shearU_no_msf rename to Exec/DryRegTests/ScalarAdvDiff/inputs_advect_shearU_no_msf diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_advect_uniformU b/Exec/DryRegTests/ScalarAdvDiff/inputs_advect_uniformU similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_advect_uniformU rename to Exec/DryRegTests/ScalarAdvDiff/inputs_advect_uniformU diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_advect_uniformU_msf b/Exec/DryRegTests/ScalarAdvDiff/inputs_advect_uniformU_msf similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_advect_uniformU_msf rename to Exec/DryRegTests/ScalarAdvDiff/inputs_advect_uniformU_msf diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_advect_uniformU_no_msf b/Exec/DryRegTests/ScalarAdvDiff/inputs_advect_uniformU_no_msf similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_advect_uniformU_no_msf rename to Exec/DryRegTests/ScalarAdvDiff/inputs_advect_uniformU_no_msf diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_diffuse_gaussian b/Exec/DryRegTests/ScalarAdvDiff/inputs_diffuse_gaussian similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_diffuse_gaussian rename to Exec/DryRegTests/ScalarAdvDiff/inputs_diffuse_gaussian diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_diffuse_msf b/Exec/DryRegTests/ScalarAdvDiff/inputs_diffuse_msf similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_diffuse_msf rename to Exec/DryRegTests/ScalarAdvDiff/inputs_diffuse_msf diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_diffuse_no_msf b/Exec/DryRegTests/ScalarAdvDiff/inputs_diffuse_no_msf similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_diffuse_no_msf rename to Exec/DryRegTests/ScalarAdvDiff/inputs_diffuse_no_msf diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_diffuse_sine b/Exec/DryRegTests/ScalarAdvDiff/inputs_diffuse_sine similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_diffuse_sine rename to Exec/DryRegTests/ScalarAdvDiff/inputs_diffuse_sine diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_ml b/Exec/DryRegTests/ScalarAdvDiff/inputs_ml similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_ml rename to Exec/DryRegTests/ScalarAdvDiff/inputs_ml diff --git a/Exec/RegTests/ScalarAdvDiff/inputs_test_rayleigh b/Exec/DryRegTests/ScalarAdvDiff/inputs_test_rayleigh similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/inputs_test_rayleigh rename to Exec/DryRegTests/ScalarAdvDiff/inputs_test_rayleigh diff --git a/Exec/RegTests/ScalarAdvDiff/prob.cpp.convergence b/Exec/DryRegTests/ScalarAdvDiff/prob.cpp.convergence similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/prob.cpp.convergence rename to Exec/DryRegTests/ScalarAdvDiff/prob.cpp.convergence diff --git a/Exec/RegTests/StokesSecondProblem/CMakeLists.txt b/Exec/DryRegTests/StokesSecondProblem/CMakeLists.txt similarity index 100% rename from Exec/RegTests/StokesSecondProblem/CMakeLists.txt rename to Exec/DryRegTests/StokesSecondProblem/CMakeLists.txt diff --git a/Exec/RegTests/StokesSecondProblem/ERF_prob.H b/Exec/DryRegTests/StokesSecondProblem/ERF_prob.H similarity index 100% rename from Exec/RegTests/StokesSecondProblem/ERF_prob.H rename to Exec/DryRegTests/StokesSecondProblem/ERF_prob.H diff --git a/Exec/RegTests/StokesSecondProblem/ERF_prob.cpp b/Exec/DryRegTests/StokesSecondProblem/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/StokesSecondProblem/ERF_prob.cpp rename to Exec/DryRegTests/StokesSecondProblem/ERF_prob.cpp diff --git a/Exec/RegTests/StokesSecondProblem/GNUmakefile b/Exec/DryRegTests/StokesSecondProblem/GNUmakefile similarity index 87% rename from Exec/RegTests/StokesSecondProblem/GNUmakefile rename to Exec/DryRegTests/StokesSecondProblem/GNUmakefile index db7266fb0..71e096c63 100644 --- a/Exec/RegTests/StokesSecondProblem/GNUmakefile +++ b/Exec/DryRegTests/StokesSecondProblem/GNUmakefile @@ -29,5 +29,5 @@ USE_TERRAIN_VELOCITY = TRUE Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/StokesSecondProblem +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/StokesSecondProblem include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/StokesSecondProblem/Make.package b/Exec/DryRegTests/StokesSecondProblem/Make.package similarity index 100% rename from Exec/RegTests/StokesSecondProblem/Make.package rename to Exec/DryRegTests/StokesSecondProblem/Make.package diff --git a/Exec/RegTests/StokesSecondProblem/inputs b/Exec/DryRegTests/StokesSecondProblem/inputs similarity index 100% rename from Exec/RegTests/StokesSecondProblem/inputs rename to Exec/DryRegTests/StokesSecondProblem/inputs diff --git a/Exec/RegTests/StokesSecondProblem/inputs_stretched_z_levels b/Exec/DryRegTests/StokesSecondProblem/inputs_stretched_z_levels similarity index 100% rename from Exec/RegTests/StokesSecondProblem/inputs_stretched_z_levels rename to Exec/DryRegTests/StokesSecondProblem/inputs_stretched_z_levels diff --git a/Exec/RegTests/TaylorGreenVortex/CMakeLists.txt b/Exec/DryRegTests/TaylorGreenVortex/CMakeLists.txt similarity index 100% rename from Exec/RegTests/TaylorGreenVortex/CMakeLists.txt rename to Exec/DryRegTests/TaylorGreenVortex/CMakeLists.txt diff --git a/Exec/RegTests/TaylorGreenVortex/ERF_prob.H b/Exec/DryRegTests/TaylorGreenVortex/ERF_prob.H similarity index 100% rename from Exec/RegTests/TaylorGreenVortex/ERF_prob.H rename to Exec/DryRegTests/TaylorGreenVortex/ERF_prob.H diff --git a/Exec/RegTests/TaylorGreenVortex/ERF_prob.cpp b/Exec/DryRegTests/TaylorGreenVortex/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/TaylorGreenVortex/ERF_prob.cpp rename to Exec/DryRegTests/TaylorGreenVortex/ERF_prob.cpp diff --git a/Exec/DryRegTests/TaylorGreenVortex/GNUmakefile b/Exec/DryRegTests/TaylorGreenVortex/GNUmakefile new file mode 100644 index 000000000..42fdd8879 --- /dev/null +++ b/Exec/DryRegTests/TaylorGreenVortex/GNUmakefile @@ -0,0 +1,33 @@ +# AMReX +COMP = gnu +PRECISION = DOUBLE + +# Profiling +PROFILE = FALSE +TINY_PROFILE = FALSE +COMM_PROFILE = FALSE +TRACE_PROFILE = FALSE +MEM_PROFILE = FALSE +USE_GPROF = FALSE + +# Performance +USE_MPI = TRUE +USE_OMP = FALSE + +USE_CUDA = FALSE +USE_HIP = FALSE +USE_SYCL = FALSE + +# Debugging +DEBUG = FALSE + +TEST = TRUE +USE_ASSERTION = TRUE + +# GNU Make +Bpack := ./Make.package +Blocs := . + +ERF_HOME := ../../.. +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/TaylorGreenVortex +include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/DynamicRefinement/Make.package b/Exec/DryRegTests/TaylorGreenVortex/Make.package similarity index 100% rename from Exec/RegTests/DynamicRefinement/Make.package rename to Exec/DryRegTests/TaylorGreenVortex/Make.package diff --git a/Exec/RegTests/TaylorGreenVortex/README b/Exec/DryRegTests/TaylorGreenVortex/README similarity index 100% rename from Exec/RegTests/TaylorGreenVortex/README rename to Exec/DryRegTests/TaylorGreenVortex/README diff --git a/Exec/RegTests/TaylorGreenVortex/inputs_advdiff b/Exec/DryRegTests/TaylorGreenVortex/inputs_advdiff similarity index 100% rename from Exec/RegTests/TaylorGreenVortex/inputs_advdiff rename to Exec/DryRegTests/TaylorGreenVortex/inputs_advdiff diff --git a/Exec/RegTests/TaylorGreenVortex/inputs_advonly b/Exec/DryRegTests/TaylorGreenVortex/inputs_advonly similarity index 100% rename from Exec/RegTests/TaylorGreenVortex/inputs_advonly rename to Exec/DryRegTests/TaylorGreenVortex/inputs_advonly diff --git a/Exec/RegTests/TaylorGreenVortex/inputs_multilevel b/Exec/DryRegTests/TaylorGreenVortex/inputs_multilevel similarity index 100% rename from Exec/RegTests/TaylorGreenVortex/inputs_multilevel rename to Exec/DryRegTests/TaylorGreenVortex/inputs_multilevel diff --git a/Exec/RegTests/Terrain2d_Cylinder/CMakeLists.txt b/Exec/DryRegTests/Terrain2d_Cylinder/CMakeLists.txt similarity index 100% rename from Exec/RegTests/Terrain2d_Cylinder/CMakeLists.txt rename to Exec/DryRegTests/Terrain2d_Cylinder/CMakeLists.txt diff --git a/Exec/RegTests/Terrain2d_Cylinder/ERF_prob.H b/Exec/DryRegTests/Terrain2d_Cylinder/ERF_prob.H similarity index 100% rename from Exec/RegTests/Terrain2d_Cylinder/ERF_prob.H rename to Exec/DryRegTests/Terrain2d_Cylinder/ERF_prob.H diff --git a/Exec/RegTests/Terrain2d_Cylinder/ERF_prob.cpp b/Exec/DryRegTests/Terrain2d_Cylinder/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/Terrain2d_Cylinder/ERF_prob.cpp rename to Exec/DryRegTests/Terrain2d_Cylinder/ERF_prob.cpp diff --git a/Exec/RegTests/Terrain3d_Hemisphere/GNUmakefile b/Exec/DryRegTests/Terrain2d_Cylinder/GNUmakefile similarity index 87% rename from Exec/RegTests/Terrain3d_Hemisphere/GNUmakefile rename to Exec/DryRegTests/Terrain2d_Cylinder/GNUmakefile index 2097f715b..1668b3711 100644 --- a/Exec/RegTests/Terrain3d_Hemisphere/GNUmakefile +++ b/Exec/DryRegTests/Terrain2d_Cylinder/GNUmakefile @@ -28,5 +28,5 @@ USE_ASSERTION = TRUE Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/Terrain3d_Hemisphere +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/Terrain2d_Cylinder include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/EkmanSpiral/Make.package b/Exec/DryRegTests/Terrain2d_Cylinder/Make.package similarity index 100% rename from Exec/RegTests/EkmanSpiral/Make.package rename to Exec/DryRegTests/Terrain2d_Cylinder/Make.package diff --git a/Exec/RegTests/Terrain2d_Cylinder/inputs b/Exec/DryRegTests/Terrain2d_Cylinder/inputs similarity index 100% rename from Exec/RegTests/Terrain2d_Cylinder/inputs rename to Exec/DryRegTests/Terrain2d_Cylinder/inputs diff --git a/Exec/RegTests/Terrain2d_Cylinder/inputs.amr b/Exec/DryRegTests/Terrain2d_Cylinder/inputs.amr similarity index 100% rename from Exec/RegTests/Terrain2d_Cylinder/inputs.amr rename to Exec/DryRegTests/Terrain2d_Cylinder/inputs.amr diff --git a/Exec/RegTests/Terrain2d_Cylinder/inputs_most_test b/Exec/DryRegTests/Terrain2d_Cylinder/inputs_most_test similarity index 100% rename from Exec/RegTests/Terrain2d_Cylinder/inputs_most_test rename to Exec/DryRegTests/Terrain2d_Cylinder/inputs_most_test diff --git a/Exec/RegTests/Terrain2d_Cylinder/inputs_stretched_z_levels b/Exec/DryRegTests/Terrain2d_Cylinder/inputs_stretched_z_levels similarity index 100% rename from Exec/RegTests/Terrain2d_Cylinder/inputs_stretched_z_levels rename to Exec/DryRegTests/Terrain2d_Cylinder/inputs_stretched_z_levels diff --git a/Exec/RegTests/Terrain2d_Cylinder/inputs_verification_final b/Exec/DryRegTests/Terrain2d_Cylinder/inputs_verification_final similarity index 100% rename from Exec/RegTests/Terrain2d_Cylinder/inputs_verification_final rename to Exec/DryRegTests/Terrain2d_Cylinder/inputs_verification_final diff --git a/Exec/RegTests/Terrain3d_Hemisphere/CMakeLists.txt b/Exec/DryRegTests/Terrain3d_Hemisphere/CMakeLists.txt similarity index 100% rename from Exec/RegTests/Terrain3d_Hemisphere/CMakeLists.txt rename to Exec/DryRegTests/Terrain3d_Hemisphere/CMakeLists.txt diff --git a/Exec/RegTests/Terrain3d_Hemisphere/ERF_prob.H b/Exec/DryRegTests/Terrain3d_Hemisphere/ERF_prob.H similarity index 100% rename from Exec/RegTests/Terrain3d_Hemisphere/ERF_prob.H rename to Exec/DryRegTests/Terrain3d_Hemisphere/ERF_prob.H diff --git a/Exec/RegTests/Terrain3d_Hemisphere/ERF_prob.cpp b/Exec/DryRegTests/Terrain3d_Hemisphere/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/Terrain3d_Hemisphere/ERF_prob.cpp rename to Exec/DryRegTests/Terrain3d_Hemisphere/ERF_prob.cpp diff --git a/Exec/RegTests/Terrain2d_Cylinder/GNUmakefile b/Exec/DryRegTests/Terrain3d_Hemisphere/GNUmakefile similarity index 86% rename from Exec/RegTests/Terrain2d_Cylinder/GNUmakefile rename to Exec/DryRegTests/Terrain3d_Hemisphere/GNUmakefile index 9569d1b2b..18888b3b1 100644 --- a/Exec/RegTests/Terrain2d_Cylinder/GNUmakefile +++ b/Exec/DryRegTests/Terrain3d_Hemisphere/GNUmakefile @@ -28,5 +28,5 @@ USE_ASSERTION = TRUE Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/Terrain2d_Cylinder +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/Terrain3d_Hemisphere include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/IsentropicVortex/Make.package b/Exec/DryRegTests/Terrain3d_Hemisphere/Make.package similarity index 100% rename from Exec/RegTests/IsentropicVortex/Make.package rename to Exec/DryRegTests/Terrain3d_Hemisphere/Make.package diff --git a/Exec/RegTests/Terrain3d_Hemisphere/inputs b/Exec/DryRegTests/Terrain3d_Hemisphere/inputs similarity index 100% rename from Exec/RegTests/Terrain3d_Hemisphere/inputs rename to Exec/DryRegTests/Terrain3d_Hemisphere/inputs diff --git a/Exec/RegTests/Terrain3d_Hemisphere/inputs.amr b/Exec/DryRegTests/Terrain3d_Hemisphere/inputs.amr similarity index 100% rename from Exec/RegTests/Terrain3d_Hemisphere/inputs.amr rename to Exec/DryRegTests/Terrain3d_Hemisphere/inputs.amr diff --git a/Exec/RegTests/Terrain3d_Hemisphere/inputs_most_test b/Exec/DryRegTests/Terrain3d_Hemisphere/inputs_most_test similarity index 100% rename from Exec/RegTests/Terrain3d_Hemisphere/inputs_most_test rename to Exec/DryRegTests/Terrain3d_Hemisphere/inputs_most_test diff --git a/Exec/RegTests/Terrain3d_Hemisphere/run_3d.sh b/Exec/DryRegTests/Terrain3d_Hemisphere/run_3d.sh similarity index 100% rename from Exec/RegTests/Terrain3d_Hemisphere/run_3d.sh rename to Exec/DryRegTests/Terrain3d_Hemisphere/run_3d.sh diff --git a/Exec/RegTests/TurbulentInflow/CMakeLists.txt b/Exec/DryRegTests/TurbulentInflow/CMakeLists.txt similarity index 100% rename from Exec/RegTests/TurbulentInflow/CMakeLists.txt rename to Exec/DryRegTests/TurbulentInflow/CMakeLists.txt diff --git a/Exec/RegTests/TurbulentInflow/ERF_prob.H b/Exec/DryRegTests/TurbulentInflow/ERF_prob.H similarity index 98% rename from Exec/RegTests/TurbulentInflow/ERF_prob.H rename to Exec/DryRegTests/TurbulentInflow/ERF_prob.H index e24b1b914..5cf575dae 100644 --- a/Exec/RegTests/TurbulentInflow/ERF_prob.H +++ b/Exec/DryRegTests/TurbulentInflow/ERF_prob.H @@ -12,7 +12,6 @@ struct ProbParm : ProbParmDefaults { amrex::Real T_0 = 300.0; amrex::Real A_0 = 1.0; amrex::Real KE_0 = 0.1; - amrex::Real QKE_0 = 0.1; amrex::Real KE_decay_height = -1; amrex::Real KE_decay_order = 1; diff --git a/Exec/RegTests/TurbulentInflow/ERF_prob.cpp b/Exec/DryRegTests/TurbulentInflow/ERF_prob.cpp similarity index 94% rename from Exec/RegTests/TurbulentInflow/ERF_prob.cpp rename to Exec/DryRegTests/TurbulentInflow/ERF_prob.cpp index 8790b3ebf..2d04b9222 100644 --- a/Exec/RegTests/TurbulentInflow/ERF_prob.cpp +++ b/Exec/DryRegTests/TurbulentInflow/ERF_prob.cpp @@ -17,7 +17,6 @@ Problem::Problem(const amrex::Real* problo, const amrex::Real* probhi) pp.query("T_0", parms.T_0); pp.query("A_0", parms.A_0); pp.query("KE_0", parms.KE_0); - pp.query("QKE_0", parms.QKE_0); pp.query("KE_decay_height", parms.KE_decay_height); pp.query("KE_decay_order", parms.KE_decay_order); @@ -135,16 +134,6 @@ Problem::init_custom_pert( 1e-12); } } - if (state_pert.nComp() > RhoQKE_comp) { - // PBL - state_pert(i, j, k, RhoQKE_comp) = r_hse(i,j,k) * parms_d.QKE_0; - if (parms_d.KE_decay_height > 0) { - // scale initial SGS kinetic energy with height - state_pert(i, j, k, RhoQKE_comp) *= max( - std::pow(1 - min(z/parms_d.KE_decay_height,1.0), parms_d.KE_decay_order), - 1e-12); - } - } if (use_moisture) { state_pert(i, j, k, RhoQ1_comp) = 0.0; diff --git a/Exec/RegTests/TurbulentInflow/GNUmakefile b/Exec/DryRegTests/TurbulentInflow/GNUmakefile similarity index 88% rename from Exec/RegTests/TurbulentInflow/GNUmakefile rename to Exec/DryRegTests/TurbulentInflow/GNUmakefile index e1f9ee033..1ab8b7fbb 100644 --- a/Exec/RegTests/TurbulentInflow/GNUmakefile +++ b/Exec/DryRegTests/TurbulentInflow/GNUmakefile @@ -31,5 +31,5 @@ USE_POISSON_SOLVE = FALSE Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/TurbulentInflow +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/TurbulentInflow include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/TurbulentInflow/InflowPerturbationGeneration_HowTo.pdf b/Exec/DryRegTests/TurbulentInflow/InflowPerturbationGeneration_HowTo.pdf similarity index 100% rename from Exec/RegTests/TurbulentInflow/InflowPerturbationGeneration_HowTo.pdf rename to Exec/DryRegTests/TurbulentInflow/InflowPerturbationGeneration_HowTo.pdf diff --git a/Exec/RegTests/ParticlesOverWoA/Make.package b/Exec/DryRegTests/TurbulentInflow/Make.package similarity index 100% rename from Exec/RegTests/ParticlesOverWoA/Make.package rename to Exec/DryRegTests/TurbulentInflow/Make.package diff --git a/Exec/RegTests/TurbulentInflow/README b/Exec/DryRegTests/TurbulentInflow/README similarity index 100% rename from Exec/RegTests/TurbulentInflow/README rename to Exec/DryRegTests/TurbulentInflow/README diff --git a/Exec/RegTests/TurbulentInflow/compressible_direct_inputs b/Exec/DryRegTests/TurbulentInflow/compressible_direct_inputs similarity index 100% rename from Exec/RegTests/TurbulentInflow/compressible_direct_inputs rename to Exec/DryRegTests/TurbulentInflow/compressible_direct_inputs diff --git a/Exec/RegTests/TurbulentInflow/compressible_source_inputs b/Exec/DryRegTests/TurbulentInflow/compressible_source_inputs similarity index 100% rename from Exec/RegTests/TurbulentInflow/compressible_source_inputs rename to Exec/DryRegTests/TurbulentInflow/compressible_source_inputs diff --git a/Exec/RegTests/TurbulentInflow/generateLogLawProfile.py b/Exec/DryRegTests/TurbulentInflow/generateLogLawProfile.py similarity index 100% rename from Exec/RegTests/TurbulentInflow/generateLogLawProfile.py rename to Exec/DryRegTests/TurbulentInflow/generateLogLawProfile.py diff --git a/Exec/RegTests/TurbulentInflow/incompressible_direct_inputs b/Exec/DryRegTests/TurbulentInflow/incompressible_direct_inputs similarity index 100% rename from Exec/RegTests/TurbulentInflow/incompressible_direct_inputs rename to Exec/DryRegTests/TurbulentInflow/incompressible_direct_inputs diff --git a/Exec/RegTests/TurbulentInflow/incompressible_source_inputs b/Exec/DryRegTests/TurbulentInflow/incompressible_source_inputs similarity index 100% rename from Exec/RegTests/TurbulentInflow/incompressible_source_inputs rename to Exec/DryRegTests/TurbulentInflow/incompressible_source_inputs diff --git a/Exec/RegTests/TurbulentInflow/sourceRun.sh b/Exec/DryRegTests/TurbulentInflow/sourceRun.sh similarity index 100% rename from Exec/RegTests/TurbulentInflow/sourceRun.sh rename to Exec/DryRegTests/TurbulentInflow/sourceRun.sh diff --git a/Exec/RegTests/WPS_Test/CMakeLists.txt b/Exec/DryRegTests/WPS_Test/CMakeLists.txt similarity index 100% rename from Exec/RegTests/WPS_Test/CMakeLists.txt rename to Exec/DryRegTests/WPS_Test/CMakeLists.txt diff --git a/Exec/RegTests/WPS_Test/ERF_prob.H b/Exec/DryRegTests/WPS_Test/ERF_prob.H similarity index 100% rename from Exec/RegTests/WPS_Test/ERF_prob.H rename to Exec/DryRegTests/WPS_Test/ERF_prob.H diff --git a/Exec/RegTests/WPS_Test/ERF_prob.cpp b/Exec/DryRegTests/WPS_Test/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/WPS_Test/ERF_prob.cpp rename to Exec/DryRegTests/WPS_Test/ERF_prob.cpp diff --git a/Exec/RegTests/WPS_Test/GNUmakefile b/Exec/DryRegTests/WPS_Test/GNUmakefile similarity index 89% rename from Exec/RegTests/WPS_Test/GNUmakefile rename to Exec/DryRegTests/WPS_Test/GNUmakefile index 3e501d0a0..83fd3d453 100644 --- a/Exec/RegTests/WPS_Test/GNUmakefile +++ b/Exec/DryRegTests/WPS_Test/GNUmakefile @@ -32,5 +32,5 @@ Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/WPS_Test +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/WPS_Test include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/ScalarAdvDiff/Make.package b/Exec/DryRegTests/WPS_Test/Make.package similarity index 100% rename from Exec/RegTests/ScalarAdvDiff/Make.package rename to Exec/DryRegTests/WPS_Test/Make.package diff --git a/Exec/RegTests/WPS_Test/README b/Exec/DryRegTests/WPS_Test/README similarity index 100% rename from Exec/RegTests/WPS_Test/README rename to Exec/DryRegTests/WPS_Test/README diff --git a/Exec/RegTests/WPS_Test/inputs_real_ChisholmView b/Exec/DryRegTests/WPS_Test/inputs_real_ChisholmView similarity index 100% rename from Exec/RegTests/WPS_Test/inputs_real_ChisholmView rename to Exec/DryRegTests/WPS_Test/inputs_real_ChisholmView diff --git a/Exec/RegTests/WitchOfAgnesi/CMakeLists.txt b/Exec/DryRegTests/WitchOfAgnesi/CMakeLists.txt similarity index 100% rename from Exec/RegTests/WitchOfAgnesi/CMakeLists.txt rename to Exec/DryRegTests/WitchOfAgnesi/CMakeLists.txt diff --git a/Exec/RegTests/WitchOfAgnesi/ERF_prob.H b/Exec/DryRegTests/WitchOfAgnesi/ERF_prob.H similarity index 100% rename from Exec/RegTests/WitchOfAgnesi/ERF_prob.H rename to Exec/DryRegTests/WitchOfAgnesi/ERF_prob.H diff --git a/Exec/RegTests/WitchOfAgnesi/ERF_prob.cpp b/Exec/DryRegTests/WitchOfAgnesi/ERF_prob.cpp similarity index 100% rename from Exec/RegTests/WitchOfAgnesi/ERF_prob.cpp rename to Exec/DryRegTests/WitchOfAgnesi/ERF_prob.cpp diff --git a/Exec/RegTests/WitchOfAgnesi/GNUmakefile b/Exec/DryRegTests/WitchOfAgnesi/GNUmakefile similarity index 88% rename from Exec/RegTests/WitchOfAgnesi/GNUmakefile rename to Exec/DryRegTests/WitchOfAgnesi/GNUmakefile index ddc8e0298..78d097d48 100644 --- a/Exec/RegTests/WitchOfAgnesi/GNUmakefile +++ b/Exec/DryRegTests/WitchOfAgnesi/GNUmakefile @@ -29,5 +29,5 @@ Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/WitchOfAgnesi +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/DryRegTests/WitchOfAgnesi include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/TaylorGreenVortex/Make.package b/Exec/DryRegTests/WitchOfAgnesi/Make.package similarity index 100% rename from Exec/RegTests/TaylorGreenVortex/Make.package rename to Exec/DryRegTests/WitchOfAgnesi/Make.package diff --git a/Exec/RegTests/WitchOfAgnesi/README b/Exec/DryRegTests/WitchOfAgnesi/README similarity index 100% rename from Exec/RegTests/WitchOfAgnesi/README rename to Exec/DryRegTests/WitchOfAgnesi/README diff --git a/Exec/RegTests/WitchOfAgnesi/input_sounding b/Exec/DryRegTests/WitchOfAgnesi/input_sounding similarity index 100% rename from Exec/RegTests/WitchOfAgnesi/input_sounding rename to Exec/DryRegTests/WitchOfAgnesi/input_sounding diff --git a/Exec/RegTests/WitchOfAgnesi/inputs b/Exec/DryRegTests/WitchOfAgnesi/inputs similarity index 100% rename from Exec/RegTests/WitchOfAgnesi/inputs rename to Exec/DryRegTests/WitchOfAgnesi/inputs diff --git a/Exec/RegTests/WitchOfAgnesi/inputs_most_test b/Exec/DryRegTests/WitchOfAgnesi/inputs_most_test similarity index 100% rename from Exec/RegTests/WitchOfAgnesi/inputs_most_test rename to Exec/DryRegTests/WitchOfAgnesi/inputs_most_test diff --git a/Exec/RegTests/WitchOfAgnesi/inputs_static_twolevel b/Exec/DryRegTests/WitchOfAgnesi/inputs_static_twolevel similarity index 100% rename from Exec/RegTests/WitchOfAgnesi/inputs_static_twolevel rename to Exec/DryRegTests/WitchOfAgnesi/inputs_static_twolevel diff --git a/Exec/RegTests/WitchOfAgnesi/inputs_zlevels b/Exec/DryRegTests/WitchOfAgnesi/inputs_zlevels similarity index 100% rename from Exec/RegTests/WitchOfAgnesi/inputs_zlevels rename to Exec/DryRegTests/WitchOfAgnesi/inputs_zlevels diff --git a/Exec/RegTests/Bomex/CMakeLists.txt b/Exec/MoistRegTests/Bomex/CMakeLists.txt similarity index 100% rename from Exec/RegTests/Bomex/CMakeLists.txt rename to Exec/MoistRegTests/Bomex/CMakeLists.txt diff --git a/Exec/RegTests/Bomex/ERF_prob.H b/Exec/MoistRegTests/Bomex/ERF_prob.H similarity index 100% rename from Exec/RegTests/Bomex/ERF_prob.H rename to Exec/MoistRegTests/Bomex/ERF_prob.H diff --git a/Exec/RegTests/Bomex/ERF_prob.cpp b/Exec/MoistRegTests/Bomex/ERF_prob.cpp similarity index 99% rename from Exec/RegTests/Bomex/ERF_prob.cpp rename to Exec/MoistRegTests/Bomex/ERF_prob.cpp index 078b7709b..9f77ee875 100644 --- a/Exec/RegTests/Bomex/ERF_prob.cpp +++ b/Exec/MoistRegTests/Bomex/ERF_prob.cpp @@ -17,7 +17,7 @@ Problem::Problem (const Real* problo, const Real* probhi) pp.query("rho_0", parms.rho_0); pp.query("T_0", parms.T_0); pp.query("A_0", parms.A_0); - pp.query("QKE_0", parms.KE_0); + pp.query("KE_0", parms.KE_0); pp.query("U_0", parms.U_0); pp.query("V_0", parms.V_0); @@ -129,7 +129,7 @@ Problem::init_custom_pert ( // Set scalar = A_0*exp(-10r^2), where r is distance from center of domain state_pert(i, j, k, RhoScalar_comp) = parms_d.A_0 * exp(-10.*r*r); - // Set an initial value for QKE + // Set an initial value for KE if (parms_d.custom_TKE) { state_pert(i, j, k, RhoKE_comp) = (1.0 - z/prob_hi[2]) * r_hse(i,j,k); } else { diff --git a/Exec/RegTests/Bomex/GNUmakefile b/Exec/MoistRegTests/Bomex/GNUmakefile similarity index 89% rename from Exec/RegTests/Bomex/GNUmakefile rename to Exec/MoistRegTests/Bomex/GNUmakefile index d94c15c2d..23a7b5683 100644 --- a/Exec/RegTests/Bomex/GNUmakefile +++ b/Exec/MoistRegTests/Bomex/GNUmakefile @@ -30,5 +30,5 @@ USE_ASSERTION = TRUE Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/Bomex +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/MoistRegTests/Bomex include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/Terrain2d_Cylinder/Make.package b/Exec/MoistRegTests/Bomex/Make.package similarity index 100% rename from Exec/RegTests/Terrain2d_Cylinder/Make.package rename to Exec/MoistRegTests/Bomex/Make.package diff --git a/Exec/RegTests/Bomex/README b/Exec/MoistRegTests/Bomex/README similarity index 100% rename from Exec/RegTests/Bomex/README rename to Exec/MoistRegTests/Bomex/README diff --git a/Exec/RegTests/Bomex/input_Kessler b/Exec/MoistRegTests/Bomex/input_Kessler similarity index 100% rename from Exec/RegTests/Bomex/input_Kessler rename to Exec/MoistRegTests/Bomex/input_Kessler diff --git a/Exec/RegTests/Bomex/input_SAM b/Exec/MoistRegTests/Bomex/input_SAM similarity index 100% rename from Exec/RegTests/Bomex/input_SAM rename to Exec/MoistRegTests/Bomex/input_SAM diff --git a/Exec/RegTests/Bomex/input_sounding b/Exec/MoistRegTests/Bomex/input_sounding similarity index 100% rename from Exec/RegTests/Bomex/input_sounding rename to Exec/MoistRegTests/Bomex/input_sounding diff --git a/Exec/RegTests/Bubble/CMakeLists.txt b/Exec/MoistRegTests/Bubble/CMakeLists.txt similarity index 100% rename from Exec/RegTests/Bubble/CMakeLists.txt rename to Exec/MoistRegTests/Bubble/CMakeLists.txt diff --git a/Exec/RegTests/Bubble/ERF_prob.H b/Exec/MoistRegTests/Bubble/ERF_prob.H similarity index 100% rename from Exec/RegTests/Bubble/ERF_prob.H rename to Exec/MoistRegTests/Bubble/ERF_prob.H diff --git a/Exec/RegTests/Bubble/ERF_prob.cpp b/Exec/MoistRegTests/Bubble/ERF_prob.cpp similarity index 93% rename from Exec/RegTests/Bubble/ERF_prob.cpp rename to Exec/MoistRegTests/Bubble/ERF_prob.cpp index 87f12a7c0..5edf0e671 100644 --- a/Exec/RegTests/Bubble/ERF_prob.cpp +++ b/Exec/MoistRegTests/Bubble/ERF_prob.cpp @@ -1,6 +1,7 @@ #include "ERF_prob.H" #include "ERF_Microphysics_Utils.H" #include "ERF_Constants.H" +#include "ERF_EOS.H" using namespace amrex; @@ -52,13 +53,6 @@ Real compute_relative_humidity () return 1.0; } -AMREX_FORCE_INLINE -AMREX_GPU_HOST_DEVICE -Real compute_vapor_pressure (const Real p_s, const Real RH) -{ - return p_s*RH; -} - AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Real vapor_mixing_ratio (const Real p_b, const Real T_b, const Real RH) @@ -118,30 +112,20 @@ Real compute_dewpoint_temperature (const Real T_b, const Real RH) return T_dp; } -AMREX_FORCE_INLINE -AMREX_GPU_HOST_DEVICE -Real Problem::compute_theta(const Real T_b, const Real p_b) -{ - return T_b*std::pow(p_0/p_b, R_d/Cp_d); -} - -AMREX_FORCE_INLINE -AMREX_GPU_HOST_DEVICE -Real compute_temperature_from_theta(const Real theta, const Real p) -{ - return theta*std::pow(p/p_0, R_d/Cp_d); -} - AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE void Problem::compute_rho (const Real& pressure, Real& theta, Real& rho, Real& q_v, Real& T_dp, Real& T_b) { T_b = compute_temperature(pressure); - theta = compute_theta(T_b, pressure); + + theta = getThgivenPandT(T_b, pressure, (R_d/Cp_d)); + Real RH = compute_relative_humidity(); q_v = vapor_mixing_ratio(pressure, T_b, RH); - rho = pressure/(R_d*T_b*(1.0 + (R_v/R_d)*q_v)); + + rho = getRhogivenTandPress(T_b, pressure, q_v); rho = rho*(1.0 + parms.qt_init); // q_t = 0.02 a given constant for this test case + T_dp = compute_dewpoint_temperature(T_b, RH); } @@ -228,16 +212,10 @@ Problem::erf_init_dens_hse_moist (MultiFab& rho_hse, Vector h_q_v(khi+2); Gpu::DeviceVector d_r(khi+2); - Gpu::DeviceVector d_p(khi+2); - Gpu::DeviceVector d_t(khi+2); - Gpu::DeviceVector d_q_v(khi+2); init_isentropic_hse_no_terrain(h_t.data(), h_r.data(),h_p.data(), h_q_v.data(), dz, khi); Gpu::copyAsync(Gpu::hostToDevice, h_r.begin(), h_r.end(), d_r.begin()); - Gpu::copyAsync(Gpu::hostToDevice, h_p.begin(), h_p.end(), d_p.begin()); - Gpu::copyAsync(Gpu::hostToDevice, h_t.begin(), h_t.end(), d_t.begin()); - Gpu::copyAsync(Gpu::hostToDevice, h_q_v.begin(), h_q_v.end(), d_q_v.begin()); Real* r = d_r.data(); @@ -392,13 +370,13 @@ Problem::init_custom_pert( } theta_total = theta_back[k]*(delta_theta/300.0 + 1); - Real T = compute_temperature_from_theta(theta_total, p_back[k]); + Real T = getTgivenPandTh(theta_total, p_back[k], (R_d/Cp_d)); rho = p_back[k]/(R_d*T*(1.0 + (R_v/R_d)*q_v_back[k])); RH = compute_relative_humidity(); Real q_v_hot = vapor_mixing_ratio(p_back[k], T, RH); // Compute background quantities - Real T_back = compute_temperature_from_theta(theta_back[k], p_back[k]); + Real T_back = getTgivenPandTh(theta_back[k], p_back[k], (R_d/Cp_d)); Real rho_back = p_back[k]/(R_d*T_back*(1.0 + (R_v/R_d)*q_v_back[k])); // This version perturbs rho but not p diff --git a/Exec/RegTests/Bubble/GNUmakefile b/Exec/MoistRegTests/Bubble/GNUmakefile similarity index 88% rename from Exec/RegTests/Bubble/GNUmakefile rename to Exec/MoistRegTests/Bubble/GNUmakefile index fef156b43..6f61e4185 100644 --- a/Exec/RegTests/Bubble/GNUmakefile +++ b/Exec/MoistRegTests/Bubble/GNUmakefile @@ -28,5 +28,5 @@ Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/Bubble +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/MoistRegTests/Bubble include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/Terrain3d_Hemisphere/Make.package b/Exec/MoistRegTests/Bubble/Make.package similarity index 100% rename from Exec/RegTests/Terrain3d_Hemisphere/Make.package rename to Exec/MoistRegTests/Bubble/Make.package diff --git a/Exec/RegTests/Bubble/input_sounding_squall2d b/Exec/MoistRegTests/Bubble/input_sounding_squall2d similarity index 100% rename from Exec/RegTests/Bubble/input_sounding_squall2d rename to Exec/MoistRegTests/Bubble/input_sounding_squall2d diff --git a/Exec/RegTests/Bubble/inputs_BF02_dry_bubble b/Exec/MoistRegTests/Bubble/inputs_BF02_dry_bubble similarity index 100% rename from Exec/RegTests/Bubble/inputs_BF02_dry_bubble rename to Exec/MoistRegTests/Bubble/inputs_BF02_dry_bubble diff --git a/Exec/RegTests/Bubble/inputs_BF02_moist_bubble b/Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble similarity index 100% rename from Exec/RegTests/Bubble/inputs_BF02_moist_bubble rename to Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble diff --git a/Exec/RegTests/Bubble/inputs_BF02_moist_bubble_Kessler b/Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble_Kessler similarity index 100% rename from Exec/RegTests/Bubble/inputs_BF02_moist_bubble_Kessler rename to Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble_Kessler diff --git a/Exec/RegTests/Bubble/inputs_BF02_moist_bubble_OpenBC b/Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble_OpenBC similarity index 100% rename from Exec/RegTests/Bubble/inputs_BF02_moist_bubble_OpenBC rename to Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble_OpenBC diff --git a/Exec/RegTests/Bubble/inputs_BF02_moist_bubble_SAM b/Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble_SAM similarity index 100% rename from Exec/RegTests/Bubble/inputs_BF02_moist_bubble_SAM rename to Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble_SAM diff --git a/Exec/RegTests/Bubble/inputs_BF02_moist_bubble_SAM_NoIce b/Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble_SAM_NoIce similarity index 100% rename from Exec/RegTests/Bubble/inputs_BF02_moist_bubble_SAM_NoIce rename to Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble_SAM_NoIce diff --git a/Exec/RegTests/Bubble/inputs_BF02_moist_bubble_SAM_NoPrecip_NoIce b/Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble_SAM_NoPrecip_NoIce similarity index 100% rename from Exec/RegTests/Bubble/inputs_BF02_moist_bubble_SAM_NoPrecip_NoIce rename to Exec/MoistRegTests/Bubble/inputs_BF02_moist_bubble_SAM_NoPrecip_NoIce diff --git a/Exec/RegTests/Bubble/inputs_grav2d_x b/Exec/MoistRegTests/Bubble/inputs_grav2d_x similarity index 100% rename from Exec/RegTests/Bubble/inputs_grav2d_x rename to Exec/MoistRegTests/Bubble/inputs_grav2d_x diff --git a/Exec/RegTests/Bubble/inputs_squall2d_x b/Exec/MoistRegTests/Bubble/inputs_squall2d_x similarity index 100% rename from Exec/RegTests/Bubble/inputs_squall2d_x rename to Exec/MoistRegTests/Bubble/inputs_squall2d_x diff --git a/Exec/RegTests/Bubble/inputs_test_outflow b/Exec/MoistRegTests/Bubble/inputs_test_outflow similarity index 100% rename from Exec/RegTests/Bubble/inputs_test_outflow rename to Exec/MoistRegTests/Bubble/inputs_test_outflow diff --git a/Exec/SquallLine_2D/CMakeLists.txt b/Exec/MoistRegTests/SquallLine_2D/CMakeLists.txt similarity index 100% rename from Exec/SquallLine_2D/CMakeLists.txt rename to Exec/MoistRegTests/SquallLine_2D/CMakeLists.txt diff --git a/Exec/SquallLine_2D/ERF_prob.H b/Exec/MoistRegTests/SquallLine_2D/ERF_prob.H similarity index 98% rename from Exec/SquallLine_2D/ERF_prob.H rename to Exec/MoistRegTests/SquallLine_2D/ERF_prob.H index 4cdc03bdb..7fd584299 100644 --- a/Exec/SquallLine_2D/ERF_prob.H +++ b/Exec/MoistRegTests/SquallLine_2D/ERF_prob.H @@ -109,7 +109,7 @@ public: const int& khi); protected: - std::string name () override { return "Supercell"; } + std::string name () override { return "SquallLine"; } private: ProbParm parms; diff --git a/Exec/SquallLine_2D/ERF_prob.cpp b/Exec/MoistRegTests/SquallLine_2D/ERF_prob.cpp similarity index 89% rename from Exec/SquallLine_2D/ERF_prob.cpp rename to Exec/MoistRegTests/SquallLine_2D/ERF_prob.cpp index a0d555625..01a96d0b2 100644 --- a/Exec/SquallLine_2D/ERF_prob.cpp +++ b/Exec/MoistRegTests/SquallLine_2D/ERF_prob.cpp @@ -69,13 +69,6 @@ Real compute_relative_humidity (const Real z, const Real height, const Real z_tr } } -AMREX_FORCE_INLINE -AMREX_GPU_HOST_DEVICE -Real compute_vapor_pressure (const Real p_s, const Real RH) -{ - return p_s*RH; -} - AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Real vapor_mixing_ratio (const Real z, const Real height, const Real p_b, const Real T_b, const Real RH) @@ -92,13 +85,6 @@ Real vapor_mixing_ratio (const Real z, const Real height, const Real p_b, const } } -AMREX_FORCE_INLINE -AMREX_GPU_HOST_DEVICE -Real compute_temperature (const Real p_b, const Real theta_b) -{ - return theta_b*std::pow(p_b/p_0,R_d/Cp_d); -} - AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Real compute_dewpoint_temperature (const Real T_b, const Real RH) @@ -119,10 +105,10 @@ void Problem::compute_rho (const Real& z, const Real& pressure, Real& theta, Rea { theta = compute_theta(z); - T_b = compute_temperature(pressure, theta); + T_b = getTgivenPandTh(theta, pressure, (R_d/Cp_d)); Real RH = compute_relative_humidity(z, parms.height, parms.z_tr, pressure, T_b); q_v = vapor_mixing_ratio(z, parms.height, pressure, T_b, RH); - rho = pressure/(R_d*T_b*(1.0 + (R_v/R_d)*q_v)); + rho = getRhogivenTandPress(T_b, pressure, q_v); rho = rho*(1.0 + q_v); T_dp = compute_dewpoint_temperature(T_b, RH); } @@ -168,26 +154,19 @@ Problem::init_isentropic_hse_no_terrain(Real *theta, Real* r, Real* p, Real *q_v const Real& dz, const Real& prob_lo_z, const int& khi) { - - //FILE *file_IC; - //file_IC = fopen("input_sounding_probcpp.txt","w"); Real z, T_b, T_dp; // Compute the quantities at z = 0.5*dz (first cell center) z = prob_lo_z + 0.5*dz; p[0] = p_0; compute_p_k(p[0], p_0, theta[0], r[0], q_v[0], T_dp, T_b, dz, z, 0.0); - //fprintf(file_IC, "%0.15g %0.15g %0.15g %0.15g %0.15g %0.15g %0.15g\n", z, T_b-273.15, T_dp, p[0], r[0], theta[0], q_v[0]); for (int k=1;k<=khi;k++){ z = prob_lo_z + (k+0.5)*dz; p[k] = p[k-1]; compute_p_k(p[k], p[k-1], theta[k], r[k], q_v[k], T_dp, T_b, dz, z, r[k-1]); - //fprintf(file_IC, "%0.15g %0.15g %0.15g %0.15g %0.15g %0.15g %0.15g\n", z, T_b-273.15, T_dp, p[k], r[k], theta[k], q_v[k]); } - //fclose(file_IC); - r[khi+1] = r[khi]; } @@ -239,17 +218,11 @@ Problem::erf_init_dens_hse_moist (MultiFab& rho_hse, Vector h_t(khi+2); Vector h_q_v(khi+2); - amrex::Gpu::DeviceVector d_r(khi+2); - amrex::Gpu::DeviceVector d_p(khi+2); - amrex::Gpu::DeviceVector d_t(khi+2); - amrex::Gpu::DeviceVector d_q_v(khi+2); - init_isentropic_hse_no_terrain(h_t.data(), h_r.data(),h_p.data(), h_q_v.data(), dz,prob_lo_z,khi); + amrex::Gpu::DeviceVector d_r(khi+2); + amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, h_r.begin(), h_r.end(), d_r.begin()); - amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, h_p.begin(), h_p.end(), d_p.begin()); - amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, h_t.begin(), h_t.end(), d_t.begin()); - amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, h_q_v.begin(), h_q_v.end(), d_q_v.begin()); Real* r = d_r.data(); @@ -352,15 +325,18 @@ Problem::init_custom_pert ( } theta_total = t[k] + delta_theta; - temperature = compute_temperature(p[k], theta_total); - Real T_b = compute_temperature(p[k], t[k]); + + temperature = getTgivenPandTh(theta_total, p[k], (R_d/Cp_d)); + Real T_b = getTgivenPandTh(t[k] , p[k], (R_d/Cp_d)); + RH = compute_relative_humidity(z, height, z_tr, p[k], T_b); Real q_v_hot = vapor_mixing_ratio(z, height, p[k], T_b, RH); rho = p[k]/(R_d*temperature*(1.0 + (R_v/R_d)*q_v_hot)); // Compute background quantities - Real temperature_back = compute_temperature(p[k], t[k]); - Real T_back = compute_temperature(p[k], t[k]); + Real temperature_back = getTgivenPandTh(t[k], p[k], (R_d/Cp_d)); + Real T_back = getTgivenPandTh(t[k], p[k], (R_d/Cp_d)); + Real RH_back = compute_relative_humidity(z, height, z_tr, p[k], T_back); Real q_v_back = vapor_mixing_ratio(z, height, p[k], T_back, RH_back); Real rho_back = p[k]/(R_d*temperature_back*(1.0 + (R_v/R_d)*q_v_back)); diff --git a/Exec/RegTests/TaylorGreenVortex/GNUmakefile b/Exec/MoistRegTests/SquallLine_2D/GNUmakefile similarity index 87% rename from Exec/RegTests/TaylorGreenVortex/GNUmakefile rename to Exec/MoistRegTests/SquallLine_2D/GNUmakefile index 71f0c930a..f664f464a 100644 --- a/Exec/RegTests/TaylorGreenVortex/GNUmakefile +++ b/Exec/MoistRegTests/SquallLine_2D/GNUmakefile @@ -27,7 +27,6 @@ USE_ASSERTION = TRUE # GNU Make Bpack := ./Make.package Blocs := . - ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/TaylorGreenVortex +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/MoistRegTests/SquallLine_2D include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/TurbulentInflow/Make.package b/Exec/MoistRegTests/SquallLine_2D/Make.package similarity index 100% rename from Exec/RegTests/TurbulentInflow/Make.package rename to Exec/MoistRegTests/SquallLine_2D/Make.package diff --git a/Exec/SquallLine_2D/README b/Exec/MoistRegTests/SquallLine_2D/README similarity index 100% rename from Exec/SquallLine_2D/README rename to Exec/MoistRegTests/SquallLine_2D/README diff --git a/Exec/SquallLine_2D/inputs_ml b/Exec/MoistRegTests/SquallLine_2D/inputs_ml similarity index 100% rename from Exec/SquallLine_2D/inputs_ml rename to Exec/MoistRegTests/SquallLine_2D/inputs_ml diff --git a/Exec/SquallLine_2D/inputs_moisture_Gabersek b/Exec/MoistRegTests/SquallLine_2D/inputs_moisture_Gabersek similarity index 100% rename from Exec/SquallLine_2D/inputs_moisture_Gabersek rename to Exec/MoistRegTests/SquallLine_2D/inputs_moisture_Gabersek diff --git a/Exec/SquallLine_2D/inputs_moisture_SAM b/Exec/MoistRegTests/SquallLine_2D/inputs_moisture_SAM similarity index 100% rename from Exec/SquallLine_2D/inputs_moisture_SAM rename to Exec/MoistRegTests/SquallLine_2D/inputs_moisture_SAM diff --git a/Exec/SquallLine_2D/inputs_moisture_WRF b/Exec/MoistRegTests/SquallLine_2D/inputs_moisture_WRF similarity index 100% rename from Exec/SquallLine_2D/inputs_moisture_WRF rename to Exec/MoistRegTests/SquallLine_2D/inputs_moisture_WRF diff --git a/Exec/SuperCell_3D/CMakeLists.txt b/Exec/MoistRegTests/SuperCell_3D/CMakeLists.txt similarity index 100% rename from Exec/SuperCell_3D/CMakeLists.txt rename to Exec/MoistRegTests/SuperCell_3D/CMakeLists.txt diff --git a/Exec/SuperCell_3D/ERF_prob.H b/Exec/MoistRegTests/SuperCell_3D/ERF_prob.H similarity index 100% rename from Exec/SuperCell_3D/ERF_prob.H rename to Exec/MoistRegTests/SuperCell_3D/ERF_prob.H diff --git a/Exec/SuperCell_3D/ERF_prob.cpp b/Exec/MoistRegTests/SuperCell_3D/ERF_prob.cpp similarity index 89% rename from Exec/SuperCell_3D/ERF_prob.cpp rename to Exec/MoistRegTests/SuperCell_3D/ERF_prob.cpp index 164026bcd..2aaff6787 100644 --- a/Exec/SuperCell_3D/ERF_prob.cpp +++ b/Exec/MoistRegTests/SuperCell_3D/ERF_prob.cpp @@ -71,13 +71,6 @@ Real compute_relative_humidity (const Real z, const Real height, const Real z_tr } } -AMREX_FORCE_INLINE -AMREX_GPU_HOST_DEVICE -Real compute_vapor_pressure (const Real p_s, const Real RH) -{ - return p_s*RH; -} - AMREX_FORCE_INLINE AMREX_GPU_HOST_DEVICE Real vapor_mixing_ratio (const Real z, const Real height, const Real p_b, const Real T_b, const Real RH) @@ -121,11 +114,13 @@ void Problem::compute_rho (const Real& z, const Real& pressure, Real& theta, Rea { theta = compute_theta(z); - T_b = compute_temperature(pressure, theta); + T_b = getTgivenPandTh(theta, pressure, (R_d/Cp_d)); Real RH = compute_relative_humidity(z, parms.height, parms.z_tr, pressure, T_b); q_v = vapor_mixing_ratio(z, parms.height, pressure, T_b, RH); - rho = pressure/(R_d*T_b*(1.0 + (R_v/R_d)*q_v)); + + rho = getRhogivenTandPress(T_b, pressure, q_v); rho = rho*(1.0 + q_v); + T_dp = compute_dewpoint_temperature(T_b, RH); } @@ -170,26 +165,19 @@ Problem::init_isentropic_hse_no_terrain(Real *theta, Real* r, Real* p, Real *q_v const Real& dz, const Real& prob_lo_z, const int& khi) { - - //FILE *file_IC; - //file_IC = fopen("input_sounding_probcpp.txt","w"); Real z, T_b, T_dp; // Compute the quantities at z = 0.5*dz (first cell center) z = prob_lo_z + 0.5*dz; p[0] = p_0; compute_p_k(p[0], p_0, theta[0], r[0], q_v[0], T_dp, T_b, dz, z, 0.0); - //fprintf(file_IC, "%0.15g %0.15g %0.15g %0.15g %0.15g %0.15g %0.15g\n", z, T_b-273.15, T_dp, p[0], r[0], theta[0], q_v[0]); for (int k=1;k<=khi;k++){ z = prob_lo_z + (k+0.5)*dz; p[k] = p[k-1]; compute_p_k(p[k], p[k-1], theta[k], r[k], q_v[k], T_dp, T_b, dz, z, r[k-1]); - //fprintf(file_IC, "%0.15g %0.15g %0.15g %0.15g %0.15g %0.15g %0.15g\n", z, T_b-273.15, T_dp, p[k], r[k], theta[k], q_v[k]); } - //fclose(file_IC); - r[khi+1] = r[khi]; } @@ -199,8 +187,6 @@ Problem::erf_init_dens_hse_moist (MultiFab& rho_hse, std::unique_ptr& z_phys_nd, Geometry const& geom) { - - const Real prob_lo_z = geom.ProbLo()[2]; const Real dz = geom.CellSize()[2]; const int khi = geom.Domain().bigEnd()[2]; @@ -241,17 +227,11 @@ Problem::erf_init_dens_hse_moist (MultiFab& rho_hse, Vector h_t(khi+2); Vector h_q_v(khi+2); - amrex::Gpu::DeviceVector d_r(khi+2); - amrex::Gpu::DeviceVector d_p(khi+2); - amrex::Gpu::DeviceVector d_t(khi+2); - amrex::Gpu::DeviceVector d_q_v(khi+2); - init_isentropic_hse_no_terrain(h_t.data(), h_r.data(),h_p.data(), h_q_v.data(), dz,prob_lo_z,khi); + amrex::Gpu::DeviceVector d_r(khi+2); + amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, h_r.begin(), h_r.end(), d_r.begin()); - amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, h_p.begin(), h_p.end(), d_p.begin()); - amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, h_t.begin(), h_t.end(), d_t.begin()); - amrex::Gpu::copyAsync(amrex::Gpu::hostToDevice, h_q_v.begin(), h_q_v.end(), d_q_v.begin()); Real* r = d_r.data(); @@ -328,9 +308,6 @@ Problem::init_custom_pert ( const Real x_c = parms.x_c, y_c = parms.y_c, z_c = parms.z_c, x_r = parms.x_r, y_r = parms.y_r, z_r = parms.z_r, theta_c = parms.theta_c, r_c = 1.0; //const Real x_c = 0.0, z_c = 2.0e3, x_r = 10.0e3, z_r = 1.5e3, r_c = 1.0, theta_c = 3.0; - Real Rd_by_Cp = sc.rdOcp; - Rd_by_Cp = Rd_by_Cp; - Real height = parms.height; Real z_tr = parms.z_tr; @@ -358,18 +335,18 @@ Problem::init_custom_pert ( } theta_total = t[k] + delta_theta; - temperature = compute_temperature(p[k], theta_total); - Real T_b = compute_temperature(p[k], t[k]); + temperature = getTgivenPandTh(theta_total, p[k], (R_d/Cp_d)); + Real T_b = getTgivenPandTh(t[k] , p[k], (R_d/Cp_d)); RH = compute_relative_humidity(z, height, z_tr, p[k], T_b); Real q_v_hot = vapor_mixing_ratio(z, height, p[k], T_b, RH); rho = p[k]/(R_d*temperature*(1.0 + (R_v/R_d)*q_v_hot)); // Compute background quantities - Real temperature_back = compute_temperature(p[k], t[k]); - Real T_back = compute_temperature(p[k], t[k]); + Real temperature_back = getTgivenPandTh(t[k], p[k], (R_d/Cp_d)); + Real T_back = getTgivenPandTh(t[k], p[k], (R_d/Cp_d)); Real RH_back = compute_relative_humidity(z, height, z_tr, p[k], T_back); Real q_v_back = vapor_mixing_ratio(z, height, p[k], T_back, RH_back); - Real rho_back = p[k]/(R_d*temperature_back*(1.0 + (R_v/R_d)*q_v_back)); + Real rho_back = getRhogivenTandPress(temperature_back, p[k], q_v_back); // This version perturbs rho but not p state_pert(i, j, k, RhoTheta_comp) = rho*theta_total - rho_back*t[k]*(1.0 + (R_v/R_d)*q_v_back);// rho*d_t[k]*(1.0 + R_v_by_R_d*q_v_hot); diff --git a/Exec/RegTests/DensityCurrent/GNUmakefile b/Exec/MoistRegTests/SuperCell_3D/GNUmakefile similarity index 87% rename from Exec/RegTests/DensityCurrent/GNUmakefile rename to Exec/MoistRegTests/SuperCell_3D/GNUmakefile index 75690762b..8a260c0f3 100644 --- a/Exec/RegTests/DensityCurrent/GNUmakefile +++ b/Exec/MoistRegTests/SuperCell_3D/GNUmakefile @@ -28,5 +28,5 @@ USE_ASSERTION = TRUE Bpack := ./Make.package Blocs := . ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/DensityCurrent +ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/MoistRegTests/SuperCell_3D include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/RegTests/WPS_Test/Make.package b/Exec/MoistRegTests/SuperCell_3D/Make.package similarity index 100% rename from Exec/RegTests/WPS_Test/Make.package rename to Exec/MoistRegTests/SuperCell_3D/Make.package diff --git a/Exec/SuperCell/README b/Exec/MoistRegTests/SuperCell_3D/README similarity index 100% rename from Exec/SuperCell/README rename to Exec/MoistRegTests/SuperCell_3D/README diff --git a/Exec/SuperCell_3D/inputs_Supercell_3D b/Exec/MoistRegTests/SuperCell_3D/inputs_Supercell_3D similarity index 100% rename from Exec/SuperCell_3D/inputs_Supercell_3D rename to Exec/MoistRegTests/SuperCell_3D/inputs_Supercell_3D diff --git a/Exec/RegTests/DynamicRefinement/CMakeLists.txt b/Exec/RegTests/DynamicRefinement/CMakeLists.txt deleted file mode 100644 index f5e544b89..000000000 --- a/Exec/RegTests/DynamicRefinement/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set(erf_exe_name erf_dynamic_refinement) - -add_executable(${erf_exe_name} "") -target_sources(${erf_exe_name} - PRIVATE - ERF_prob.cpp -) - -target_include_directories(${erf_exe_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - -include(${CMAKE_SOURCE_DIR}/CMake/BuildERFExe.cmake) -build_erf_exe(${erf_exe_name}) diff --git a/Exec/RegTests/DynamicRefinement/ERF_prob.H b/Exec/RegTests/DynamicRefinement/ERF_prob.H deleted file mode 100644 index c759964b8..000000000 --- a/Exec/RegTests/DynamicRefinement/ERF_prob.H +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef ERF_PROB_H_ -#define ERF_PROB_H_ - -#include - -#include "AMReX_REAL.H" - -#include "ERF_prob_common.H" -#include "ERF_Constants.H" - -struct ProbParm : ProbParmDefaults { - amrex::Real p_inf = p_0; //freestream pressure [Pa] - amrex::Real T_inf = 300.0; //freestream temperature [K] - amrex::Real M_inf = 0.2; //freestream Mach number [-] - amrex::Real alpha = 0.0; //inflow angle, 0 --> x-aligned [rad] - amrex::Real gamma = Gamma; //specific heat ratio [-] - amrex::Real beta = 0.01; //non-dimensional max perturbation strength [-] - amrex::Real sigma = 1.0; //Gaussian standard deviation, i.e., spreading parameter [-] - amrex::Real R = 2.0; //characteristic length scale for grid [m] - amrex::Real xc = 0.5; //normalized x-location of vortex center [-] - amrex::Real yc = 0.5; //normalized y-location of vortex center [-] - // calculated quantiites - amrex::Real rho_0; //characteristic density [m/s] - amrex::Real a_inf; //speed of sound [m/s] - amrex::Real inv_gm1; //1/(gamma - 1) [-] -}; // namespace ProbParm - -class Problem : public ProblemBase -{ -public: - Problem(const amrex_real* problo, const amrex_real* probhi); - -#include "Prob/ERF_init_constant_density_hse.H" - - void init_custom_pert ( - const amrex::Box& bx, - const amrex::Box& xbx, - const amrex::Box& ybx, - const amrex::Box& zbx, - amrex::Array4 const& state, - amrex::Array4 const& state_pert, - amrex::Array4 const& x_vel_pert, - amrex::Array4 const& y_vel_pert, - amrex::Array4 const& z_vel_pert, - amrex::Array4 const& r_hse, - amrex::Array4 const& p_hse, - amrex::Array4 const& z_nd, - amrex::Array4 const& z_cc, - amrex::GeometryData const& geomdata, - amrex::Array4 const& mf_m, - amrex::Array4 const& mf_u, - amrex::Array4 const& mf_v, - const SolverChoice& sc) override; - -protected: - std::string name() override { return "Dynamic Refinement"; } - -private: - ProbParm parms; -}; - -#endif diff --git a/Exec/RegTests/DynamicRefinement/ERF_prob.cpp b/Exec/RegTests/DynamicRefinement/ERF_prob.cpp deleted file mode 100644 index 3f6bbd304..000000000 --- a/Exec/RegTests/DynamicRefinement/ERF_prob.cpp +++ /dev/null @@ -1,177 +0,0 @@ -#include "ERF_prob.H" - -using namespace amrex; - -std::unique_ptr -amrex_probinit(const amrex_real* problo, const amrex_real* probhi) -{ - return std::make_unique(problo, probhi); -} - -Problem::Problem(const amrex_real* problo, const amrex_real* probhi) -{ - // Parse params - ParmParse pp("prob"); - pp.query("p_inf", parms.p_inf); - pp.query("T_inf", parms.T_inf); - pp.query("M_inf", parms.M_inf); - pp.query("alpha", parms.alpha); - pp.query("gamma", parms.gamma); - pp.query("beta", parms.beta); - pp.query("sigma", parms.sigma); - pp.query("R", parms.R); - pp.query("xc", parms.xc); - pp.query("yc", parms.yc); - - parms.xc = problo[0] + parms.xc * (probhi[0] - problo[0]); - parms.yc = problo[1] + parms.yc * (probhi[1] - problo[1]); - amrex::Print() << " vortex initialized at (" - << parms.xc << ", " - << parms.yc << ")" - << std::endl; - - parms.inv_gm1 = 1.0 / (parms.gamma - 1.0); - - amrex::Print() << " reference pressure = " << parms.p_inf << " Pa" << std::endl; - amrex::Print() << " reference temperature = " << parms.T_inf << " K" << std::endl; - amrex::Print() << " reference potential temperature (not used) = " << parms.T_0 << " K" << std::endl; - - parms.rho_0 = parms.p_inf / (R_d * parms.T_inf); - amrex::Print() << " calculated freestream air density = " - << parms.rho_0 << " kg/m^3" - << std::endl; - - parms.a_inf = std::sqrt(parms.gamma * R_d * parms.T_inf); - amrex::Print() << " calculated speed of sound, a = " - << parms.a_inf << " m/s" - << std::endl; - - amrex::Print() << " freestream u/a = " - << parms.M_inf * std::cos(parms.alpha) - << std::endl; - amrex::Print() << " freestream v/a = " - << parms.M_inf * std::sin(parms.alpha) - << std::endl; - - init_base_parms(parms.rho_0, parms.T_0); -} - -AMREX_GPU_DEVICE -static -Real -erf_vortex_Gaussian( - Real x, Real y, - Real xc, Real yc, - Real R, Real beta, - Real sigma) -{ - // Evaluate Gaussian function - const Real r2 = ((x-xc)*(x-xc) + (y-yc)*(y-yc)) / (R*R); - return beta * std::exp(-r2/(2.*sigma*sigma)); -} - -void -Problem::init_custom_pert( - const Box& bx, - const Box& xbx, - const Box& ybx, - const Box& zbx, - Array4 const& /*state*/, - Array4 const& state_pert, - Array4 const& x_vel_pert, - Array4 const& y_vel_pert, - Array4 const& z_vel_pert, - Array4 const& /*r_hse*/, - Array4 const& /*p_hse*/, - Array4 const& /*z_nd*/, - Array4 const& /*z_cc*/, - amrex::GeometryData const& geomdata, - Array4 const& /*mf_m*/, - Array4 const& /*mf_u*/, - Array4 const& /*mf_v*/, - const SolverChoice& sc) -{ - const bool use_moisture = (sc.moisture_type != MoistureType::None); - - Real xc = parms.xc; Real yc = parms.yc; - Real R = parms.R ; Real beta = parms.beta; - Real sigma = parms.sigma; - - const Real rdOcp = sc.rdOcp; - - ParallelFor(bx, [=, parms_d=parms] AMREX_GPU_DEVICE(int i, int j, int k) noexcept - { - const Real* prob_lo = geomdata.ProbLo(); - const Real* dx = geomdata.CellSize(); - const Real x = prob_lo[0] + (i + 0.5) * dx[0]; // cell center - const Real y = prob_lo[1] + (j + 0.5) * dx[1]; // cell center - - // Calculate perturbation temperature - const Real Omg = erf_vortex_Gaussian(x,y,xc,yc,R,beta,sigma); - const Real deltaT = -(parms_d.gamma - 1.0)/(2.0*sigma*sigma) * Omg*Omg; - - // Set the perturbation density - const Real rho_norm = std::pow(1.0 + deltaT, parms_d.inv_gm1); - state_pert(i, j, k, Rho_comp) = (rho_norm - 1.0) * parms_d.rho_0; - - // Initial _potential_ temperature - const Real T = (1.0 + deltaT) * parms_d.T_inf; - const Real p = std::pow(rho_norm, Gamma) / Gamma // isentropic relation - * parms_d.rho_0*parms_d.a_inf*parms_d.a_inf; - const Real rho_theta = parms_d.rho_0 * rho_norm * (T * std::pow(p_0 / p, rdOcp)); // T --> theta - state_pert(i, j, k, RhoTheta_comp) = rho_theta - parms_d.rho_0 * parms_d.T_0; // Set the perturbation rho*theta - - // Set scalar = 0 -- unused - state_pert(i, j, k, RhoScalar_comp) = 1.0 + Omg; - - if (use_moisture) { - state_pert(i, j, k, RhoQ1_comp) = 0.0; - state_pert(i, j, k, RhoQ2_comp) = 0.0; - } - }); - - // Set the x-velocity - ParallelFor(xbx, [=, parms_d=parms] AMREX_GPU_DEVICE(int i, int j, int k) noexcept - { - const Real* prob_lo = geomdata.ProbLo(); - const Real* dx = geomdata.CellSize(); - - const Real x = prob_lo[0] + i * dx[0]; // face center - const Real y = prob_lo[1] + (j + 0.5) * dx[1]; // cell center - const Real Omg = erf_vortex_Gaussian(x,y,xc,yc,R,beta,sigma); - - x_vel_pert(i, j, k) = (parms_d.M_inf * std::cos(parms_d.alpha) - - (y - parms_d.yc)/parms_d.R * Omg) * parms_d.a_inf; - }); - - // Set the y-velocity - ParallelFor(ybx, [=, parms_d=parms] AMREX_GPU_DEVICE(int i, int j, int k) noexcept - { - const Real* prob_lo = geomdata.ProbLo(); - const Real* dx = geomdata.CellSize(); - - const Real x = prob_lo[0] + (i + 0.5) * dx[0]; // cell center - const Real y = prob_lo[1] + j * dx[1]; // face center - const Real Omg = erf_vortex_Gaussian(x,y,xc,yc,R,beta,sigma); - - y_vel_pert(i, j, k) = (parms_d.M_inf * std::sin(parms_d.alpha) - + (x - parms_d.xc)/parms_d.R * Omg) * parms_d.a_inf; - }); - - // Set the z-velocity - ParallelFor(zbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept - { - z_vel_pert(i, j, k) = 0.0; - }); -} - -#if 0 -AMREX_GPU_DEVICE -Real -dhdt(int /*i*/, int /*j*/, - const GpuArray /*dx*/, - const Real /*time_mt*/, const Real /*delta_t*/) -{ - return 0.; -} -#endif diff --git a/Exec/RegTests/DynamicRefinement/inputs_threelevel b/Exec/RegTests/DynamicRefinement/inputs_threelevel deleted file mode 100644 index b5dc591e5..000000000 --- a/Exec/RegTests/DynamicRefinement/inputs_threelevel +++ /dev/null @@ -1,83 +0,0 @@ -# ------------------ INPUTS TO MAIN PROGRAM ------------------- -max_step = 2000 - -amrex.fpe_trap_invalid = 1 - -fabarray.mfiter_tile_size = 1024 1024 1024 - -# PROBLEM SIZE & GEOMETRY -geometry.prob_lo = -6 -6 -1 -geometry.prob_hi = 6 6 1 -amr.n_cell = 96 96 4 - -amr.blocking_factor_x = 16 16 16 -amr.blocking_factor_y = 16 16 16 -amr.blocking_factor_z = 1 1 1 - -geometry.is_periodic = 1 1 0 - -zlo.type = "SlipWall" -zhi.type = "SlipWall" - -# TIME STEP CONTROL -erf.substepping_type = Implicit -erf.fixed_dt = 0.000015 - -# DIAGNOSTICS & VERBOSITY -erf.sum_interval = 1 # timesteps between computing mass -erf.v = 1 # verbosity in ERF.cpp -amr.v = 1 # verbosity in Amr.cpp - -# REFINEMENT / REGRIDDING -amr.max_level = 2 # maximum level number allowed -amr.ref_ratio_vect = 2 2 1 4 4 1 -erf.refinement_indicators = hi_scal1 hi_scal2 -erf.hi_scal1.max_level = 1 -erf.hi_scal1.field_name = scalar -erf.hi_scal1.value_greater = 1. -erf.hi_scal2.max_level = 2 -erf.hi_scal2.field_name = scalar -erf.hi_scal2.value_greater = 2. -amr.n_error_buf = 4 -erf.regrid_int = 2 -erf.cf_width = 4 # Internal relaxation (not ready w/ multiple boxes at a level) -erf.cf_set_width = 1 # Internal Dirichlet (not ready w/ multiple boxes at a level) -amr.iterate_grids = true # Prevents level 1 BA decomposition (use true to decompose) - -# CHECKPOINT FILES -erf.check_file = chk # root name of checkpoint file -erf.check_int = -100 # number of timesteps between checkpoints - -# PLOTFILES -erf.plot_file_1 = plt # prefix of plotfile name -erf.plot_int_1 = 1 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhotheta x_velocity y_velocity z_velocity pressure theta temp scalar pres_hse dens_hse pert_pres pert_dens mapfac - -# SOLVER CHOICE -erf.alpha_T = 0.0 -erf.alpha_C = 0.0 -erf.use_gravity = false - -erf.les_type = "None" -erf.molec_diff_type = "None" -erf.dynamicViscosity = 0.0 - -erf.init_type = "uniform" - -# PROBLEM PARAMETERS -prob.p_inf = 1e5 # reference pressure [Pa] -prob.T_inf = 300. # reference temperature [K] -prob.M_inf = 1.1952286093343936 # freestream Mach number [-] -prob.alpha = 0.7853981633974483 # inflow angle, 0 --> x-aligned [rad] -prob.beta = 1.1088514254079065 # non-dimensional max perturbation strength [-] -prob.R = 1.0 # characteristic length scale for grid [m] -prob.sigma = 1.0 # Gaussian standard deviation [-] - -# PROBLEM PARAMETERS - STATIONARY -#prob.M_inf = 0.0 # freestream Mach number [-] -#prob.alpha = 0.0 # inflow angle, 0 --> x-aligned [rad] -#prob.gamma = 1.4 # specific heat ratio [-] -#prob.beta = 0.05 # non-dimensional max perturbation strength [-] - - - diff --git a/Exec/RegTests/DynamicRefinement/inputs_twolevel b/Exec/RegTests/DynamicRefinement/inputs_twolevel deleted file mode 100644 index ab3fe43d2..000000000 --- a/Exec/RegTests/DynamicRefinement/inputs_twolevel +++ /dev/null @@ -1,87 +0,0 @@ -# ------------------ INPUTS TO MAIN PROGRAM ------------------- -max_step = 2000 - -erf.coupling_type = TwoWay -erf.cf_width = 0 # Internal relaxation -erf.cf_set_width = 0 # Internal Dirichlet - -amrex.fpe_trap_invalid = 1 - -fabarray.mfiter_tile_size = 1024 1024 1024 - -# PROBLEM SIZE & GEOMETRY -geometry.prob_lo = -6 -6 -1 -geometry.prob_hi = 6 6 1 -amr.n_cell = 96 96 4 - -amr.max_grid_size_x = 128 128 -amr.max_grid_size_y = 128 128 - -amr.max_grid_size_x = 128 128 -amr.max_grid_size_y = 128 32 - -amr.blocking_factor_z = 1 1 - -geometry.is_periodic = 1 1 0 - -zlo.type = "SlipWall" -zhi.type = "SlipWall" - -# TIME STEP CONTROL -erf.substepping_type = None -erf.fixed_dt = 0.000015 -erf.fixed_fast_dt = 0.000005 - -# DIAGNOSTICS & VERBOSITY -erf.sum_interval = 1 # timesteps between computing mass -erf.v = 1 # verbosity in ERF.cpp -amr.v = 1 # verbosity in Amr.cpp - -# REFINEMENT / REGRIDDING -amr.max_level = 1 # maximum level number allowed -amr.ref_ratio_vect = 3 3 1 -amr.ref_ratio_vect = 2 2 1 -erf.refinement_indicators = hi_scal1 -erf.hi_scal1.max_level = 1 -erf.hi_scal1.field_name = scalar -erf.hi_scal1.value_greater = 1. -amr.n_error_buf = 4 -erf.regrid_int = 2 - -# CHECKPOINT FILES -erf.check_file = chk # root name of checkpoint file -erf.check_int = 200 # number of timesteps between checkpoints - -# PLOTFILES -erf.plot_file_1 = plt # prefix of plotfile name -erf.plot_int_1 = 50 # number of timesteps between plotfiles -erf.plot_vars_1 = density x_velocity y_velocity z_velocity pressure theta temp scalar pres_hse dens_hse pert_pres pert_dens - -# SOLVER CHOICE -erf.alpha_T = 0.0 -erf.alpha_C = 0.0 -erf.use_gravity = false - -erf.les_type = "None" -erf.molec_diff_type = "None" -erf.dynamicViscosity = 0.0 - -erf.init_type = "uniform" - -# PROBLEM PARAMETERS -prob.p_inf = 1e5 # reference pressure [Pa] -prob.T_inf = 300. # reference temperature [K] -prob.M_inf = 1.1952286093343936 # freestream Mach number [-] -prob.alpha = 0.7853981633974483 # inflow angle, 0 --> x-aligned [rad] -prob.beta = 1.1088514254079065 # non-dimensional max perturbation strength [-] -prob.R = 1.0 # characteristic length scale for grid [m] -prob.sigma = 1.0 # Gaussian standard deviation [-] - -# PROBLEM PARAMETERS - STATIONARY -#prob.M_inf = 0.0 # freestream Mach number [-] -#prob.alpha = 0.0 # inflow angle, 0 --> x-aligned [rad] -#prob.gamma = 1.4 # specific heat ratio [-] -#prob.beta = 0.05 # non-dimensional max perturbation strength [-] - - - diff --git a/Exec/RegTests/IsentropicVortex/GNUmakefile b/Exec/RegTests/IsentropicVortex/GNUmakefile deleted file mode 100644 index ff44aa90f..000000000 --- a/Exec/RegTests/IsentropicVortex/GNUmakefile +++ /dev/null @@ -1,33 +0,0 @@ -# AMReX -COMP = gnu -PRECISION = DOUBLE - -# Profiling -PROFILE = FALSE -TINY_PROFILE = FALSE -COMM_PROFILE = FALSE -TRACE_PROFILE = FALSE -MEM_PROFILE = FALSE -USE_GPROF = FALSE - -# Performance -USE_MPI = TRUE -USE_OMP = FALSE - -USE_CUDA = FALSE -USE_HIP = FALSE -USE_SYCL = FALSE - -# Debugging -DEBUG = FALSE - -TEST = TRUE -USE_ASSERTION = TRUE - -# GNU Make -Bpack := ./Make.package -Blocs := . - -ERF_HOME := ../../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/RegTests/IsentropicVortex -include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/SquallLine_2D/GNUmakefile b/Exec/SquallLine_2D/GNUmakefile deleted file mode 100644 index 5705fc951..000000000 --- a/Exec/SquallLine_2D/GNUmakefile +++ /dev/null @@ -1,32 +0,0 @@ -# AMReX -COMP = gnu -PRECISION = DOUBLE - -# Profiling -PROFILE = FALSE -TINY_PROFILE = FALSE -COMM_PROFILE = FALSE -TRACE_PROFILE = FALSE -MEM_PROFILE = FALSE -USE_GPROF = FALSE - -# Performance -USE_MPI = TRUE -USE_OMP = FALSE - -USE_CUDA = FALSE -USE_HIP = FALSE -USE_SYCL = FALSE - -# Debugging -DEBUG = FALSE - -TEST = TRUE -USE_ASSERTION = TRUE - -# GNU Make -Bpack := ./Make.package -Blocs := . -ERF_HOME := ../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/SquallLine_2D -include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/SuperCell/CMakeLists.txt b/Exec/SuperCell/CMakeLists.txt deleted file mode 100644 index 5fc424233..000000000 --- a/Exec/SuperCell/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -set(erf_exe_name erf_super_cell) - -add_executable(${erf_exe_name} "") -target_sources(${erf_exe_name} - PRIVATE - ERF_prob.cpp -) - -target_include_directories(${erf_exe_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - -include(${CMAKE_SOURCE_DIR}/CMake/BuildERFExe.cmake) -build_erf_exe(${erf_exe_name}) diff --git a/Exec/SuperCell/ERF_prob.H b/Exec/SuperCell/ERF_prob.H deleted file mode 100644 index 94f58ed36..000000000 --- a/Exec/SuperCell/ERF_prob.H +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef ERF_PROB_H_ -#define ERF_PROB_H_ - -#include - -#include "AMReX_REAL.H" - -#include "ERF_prob_common.H" - -struct ProbParm : ProbParmDefaults { - amrex::Real T_0 = 300.0; // surface temperature == mean potential temperature - amrex::Real U_0 = 10.0; - amrex::Real V_0 = 0.0; - amrex::Real x_c = 0.0; // center of thermal perturbation - amrex::Real z_c = 3200.0; - amrex::Real x_r = 1000.0; - amrex::Real z_r = 1000.0; - amrex::Real T_pert = 5.0; // perturbation temperature - // overridden physical constants - amrex::Real C_p = 1004.0; -}; // namespace ProbParm - -class Problem : public ProblemBase -{ -public: - Problem(); - -#include "Prob/ERF_init_density_hse_dry.H" - - void init_custom_pert ( - const amrex::Box& bx, - const amrex::Box& xbx, - const amrex::Box& ybx, - const amrex::Box& zbx, - amrex::Array4 const& state, - amrex::Array4 const& state_pert, - amrex::Array4 const& x_vel_pert, - amrex::Array4 const& y_vel_pert, - amrex::Array4 const& z_vel_pert, - amrex::Array4 const& r_hse, - amrex::Array4 const& p_hse, - amrex::Array4 const& z_nd, - amrex::Array4 const& z_cc, - amrex::GeometryData const& geomdata, - amrex::Array4 const& mf_m, - amrex::Array4 const& mf_u, - amrex::Array4 const& mf_v, - const SolverChoice& sc) override; - - void erf_init_rayleigh ( - amrex::Vector >& rayleigh_ptrs, - amrex::Geometry const& geom, - std::unique_ptr& z_phys_nd, - amrex::Real zdamp) override; - -protected: - std::string name() override { return "Supercell"; } - -private: - ProbParm parms; -}; - -#endif diff --git a/Exec/SuperCell/ERF_prob.cpp b/Exec/SuperCell/ERF_prob.cpp deleted file mode 100644 index 41ed24774..000000000 --- a/Exec/SuperCell/ERF_prob.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#include "ERF_prob.H" -#include "ERF_EOS.H" - -using namespace amrex; - -std::unique_ptr -amrex_probinit( - const amrex_real* /*problo*/, - const amrex_real* /*probhi*/) -{ - return std::make_unique(); -} - -Problem::Problem() -{ - // Parse params - amrex::ParmParse pp("prob"); - pp.query("T_0", parms.T_0); - pp.query("U_0", parms.U_0); - pp.query("x_c", parms.x_c); - pp.query("z_c", parms.z_c); - pp.query("x_r", parms.x_r); - pp.query("z_r", parms.z_r); - pp.query("T_pert", parms.T_pert); - - init_base_parms(parms.rho_0, parms.T_0); -} - -AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE -amrex::Real -init_supercell_temperature(amrex::Real z, amrex::Real z_0, amrex::Real z_trop, amrex::Real z_top, - amrex::Real T_0, amrex::Real T_trop, amrex::Real T_top) -{ - if (z <= z_trop) { - amrex::Real lapse = - (T_trop - T_0) / (z_trop - z_0); - return T_0 - lapse * (z - z_0); - } else { - amrex::Real lapse = - (T_top - T_trop) / (z_top - z_trop); - return T_trop - lapse * (z - z_trop); - } -} - -AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE -amrex::Real -init_supercell_pressure(amrex::Real z, amrex::Real z_0, - amrex::Real z_trop, amrex::Real z_top, - amrex::Real T_0, amrex::Real T_trop, amrex::Real T_top) -{ - if (z <= z_trop) { - amrex::Real lapse = - (T_trop - T_0) / (z_trop - z_0); - amrex::Real T = init_supercell_temperature(z, z_0, z_trop, z_top, T_0, T_trop, T_top); - return p_0 * std::pow( T / T_0 , CONST_GRAV/(R_d*lapse) ); - } else { - // Get pressure at the tropopause - amrex::Real lapse = - (T_trop - T_0) / (z_trop - z_0); - amrex::Real p_trop = p_0 * std::pow( T_trop / T_0 , CONST_GRAV/(R_d*lapse) ); - // Get pressure at requested height - lapse = - (T_top - T_trop) / (z_top - z_trop); - if (lapse != 0) { - amrex::Real T = init_supercell_temperature(z, z_0, z_trop, z_top, T_0, T_trop, T_top); - return p_trop * std::pow( T / T_trop , CONST_GRAV/(R_d*lapse) ); - } else { - return p_trop * std::exp(-CONST_GRAV*(z-z_trop)/(R_d*T_trop)); - } - } -} - -AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE -amrex::Real -init_supercell_sat_mix(amrex::Real press, amrex::Real T ) { - return 380./(press) * std::exp(17.27*(T-273.)/(T-36.)); -} - -AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE -amrex::Real -init_supercell_relhum(amrex::Real z, amrex::Real z_trop) -{ - if (z <= z_trop) { - return 1. - 0.75 * pow(z / z_trop , 1.25); - } else { - return 0.25; - } -} - -void -Problem::init_custom_pert( - const Box& bx, - const Box& xbx, - const Box& ybx, - const Box& zbx, - Array4 const& /*state*/, - Array4 const& state_pert, - Array4 const& x_vel_pert, - Array4 const& y_vel_pert, - Array4 const& z_vel_pert, - Array4 const& r_hse, - Array4 const& p_hse, - Array4 const& /*z_nd*/, - Array4 const& /*z_cc*/, - GeometryData const& geomdata, - Array4 const& /*mf_m*/, - Array4 const& /*mf_u*/, - Array4 const& /*mf_v*/, - const SolverChoice& sc) -{ - const bool use_moisture = (sc.moisture_type != MoistureType::None); - - const int khi = geomdata.Domain().bigEnd()[2]; - - AMREX_ALWAYS_ASSERT(bx.length()[2] == khi+1); - - // This is what we do at k = 0 -- note we assume p = p_0 and T = T_0 at z=0 - const amrex::Real& dz = geomdata.CellSize()[2]; - const amrex::Real& prob_lo_z = geomdata.ProbLo()[2]; - const amrex::Real& prob_hi_z = geomdata.ProbHi()[2]; - - const amrex::Real rdOcp = sc.rdOcp; - - // const amrex::Real thetatr = 343.0; - // const amrex::Real theta0 = 300.0; - const amrex::Real ztr = 12000.0; - const amrex::Real Ttr = 213.0; - const amrex::Real Ttop = 213.0; - const amrex::Real deltaz = 1000.*0.0; - const amrex::Real zs = 5000.; - const amrex::Real us = 30.; - const amrex::Real uc = 15.; - - amrex::ParallelForRNG(bx, [=, parms_d=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept - { - // Geometry (note we must include these here to get the data on device) - const auto prob_lo = geomdata.ProbLo(); - const auto dx = geomdata.CellSize(); - const amrex::Real z = prob_lo[2] + (k + 0.5) * dx[2]; - - amrex::Real relhum = init_supercell_relhum(z, ztr); - amrex::Real temp = init_supercell_temperature(z, prob_lo_z, ztr, prob_hi_z, parms_d.T_0, Ttr, Ttop); - amrex::Real press = init_supercell_pressure(z, prob_lo_z, ztr, prob_hi_z, parms_d.T_0, Ttr, Ttop); - amrex::Real qvs = init_supercell_sat_mix(press, temp); - -#if 0 - amrex::Real thetaeq; - amrex::Real faceq; - if (z <= ztr) { - thetaeq = theta0 + (thetatr - theta0)*std::pow(z/ztr, 5./4.); - } - else { - thetaeq = thetatr*std::exp(CONST_GRAV*(z-ztr)/c_p*Ttr); - } - - faceq = 1.; - for (int km = 0; km < k; ++km) { - amrex::Real zloc = prob_lo[2]+(km+0.5)*dx[2]; - amrex::Real theq; - if (zloc <= ztr) { - theq = theta0 + (thetatr - theta0)*std::pow(zloc/ztr, 5./4.); - } else { - theq = thetatr*std::exp(CONST_GRAV*(zloc-ztr)/c_p*Ttr); - } - faceq -= CONST_GRAV/(c_p*theq)*dz; - } - - temp = faceq*thetaeq; -#endif - - if (relhum*qvs > 0.014) relhum = 0.014/qvs; - amrex::Real qvapor = std::min(0.014, qvs*relhum); - amrex::Real rho = press/(R_d+qvapor*R_v)/temp; - - // perturb theta - amrex::Real rand_double = amrex::Random(engine) - 1.0; // Random number in [-1,1] - amrex::Real scaling = (khi-static_cast(k))/khi; // Less effect at higher levels - amrex::Real deltaT = parms_d.T_pert*scaling*rand_double; - - amrex::Real theta = getThgivenRandT(rho, temp+deltaT, rdOcp); - - // This version perturbs rho but not p - state_pert(i, j, k, RhoTheta_comp) = rho*theta - getRhoThetagivenP(p_hse(i,j,k)); - state_pert(i, j, k, Rho_comp) = rho - r_hse(i,j,k); - - // Set scalar = 0 everywhere - state_pert(i, j, k, RhoScalar_comp) = 0.0; - - // mean states - if (use_moisture) { - state_pert(i, j, k, RhoQ1_comp) = rho*qvapor; - state_pert(i, j, k, RhoQ2_comp) = 0.0; - } - }); - - // Set the x-velocity - amrex::ParallelFor(xbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { - const amrex::Real z = prob_lo_z + (k+0.5) * dz; - if (z < zs-deltaz) { - x_vel_pert(i, j, k) = us*(z/zs) - uc; - } else if (std::abs(z-zs) < deltaz) { - x_vel_pert(i, j, k) = (-0.8+3.*(z/zs)-1.25*(z/zs)*(z/zs))*us-uc; - } else { - x_vel_pert(i, j, k) = us-uc; - } - }); - - // Set the y-velocity - amrex::ParallelFor(ybx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { - y_vel_pert(i, j, k) = 0.0; - }); - - // Set the z-velocity - amrex::ParallelFor(zbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { - z_vel_pert(i, j, k) = 0.0; - }); - - amrex::Gpu::streamSynchronize(); -} - -void -Problem::erf_init_rayleigh( - amrex::Vector >& rayleigh_ptrs, - amrex::Geometry const& geom, - std::unique_ptr& /*z_phys_nd*/, - amrex::Real /*zdamp*/) -{ - const int khi = geom.Domain().bigEnd()[2]; - - // We just use these values to test the Rayleigh damping - for (int k = 0; k <= khi; k++) - { - rayleigh_ptrs[Rayleigh::ubar][k] = 2.0; - rayleigh_ptrs[Rayleigh::vbar][k] = 1.0; - rayleigh_ptrs[Rayleigh::wbar][k] = 0.0; - rayleigh_ptrs[Rayleigh::thetabar][k] = parms.T_0; - } -} diff --git a/Exec/SuperCell/GNUmakefile b/Exec/SuperCell/GNUmakefile deleted file mode 100644 index 968d704e3..000000000 --- a/Exec/SuperCell/GNUmakefile +++ /dev/null @@ -1,32 +0,0 @@ -# AMReX -COMP = gnu -PRECISION = DOUBLE - -# Profiling -PROFILE = FALSE -TINY_PROFILE = FALSE -COMM_PROFILE = FALSE -TRACE_PROFILE = FALSE -MEM_PROFILE = FALSE -USE_GPROF = FALSE - -# Performance -USE_MPI = TRUE -USE_OMP = FALSE - -USE_CUDA = FALSE -USE_HIP = FALSE -USE_SYCL = FALSE - -# Debugging -DEBUG = FALSE - -TEST = TRUE -USE_ASSERTION = TRUE - -# GNU Make -Bpack := ./Make.package -Blocs := . -ERF_HOME := ../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/SuperCell -include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/SuperCell/Make.package b/Exec/SuperCell/Make.package deleted file mode 100644 index 5fc21f61c..000000000 --- a/Exec/SuperCell/Make.package +++ /dev/null @@ -1,2 +0,0 @@ -CEXE_headers += ERF_prob.H -CEXE_sources += ERF_prob.cpp diff --git a/Exec/SuperCell/inputs_moisture b/Exec/SuperCell/inputs_moisture deleted file mode 100644 index 92e812fe7..000000000 --- a/Exec/SuperCell/inputs_moisture +++ /dev/null @@ -1,63 +0,0 @@ -# ------------------ INPUTS TO MAIN PROGRAM ------------------- -max_step = 1000 -stop_time = 90000.0 - -amrex.fpe_trap_invalid = 1 - -fabarray.mfiter_tile_size = 2048 1024 2048 - -# PROBLEM SIZE & GEOMETRY -geometry.prob_lo = -25600. 0. 0. -geometry.prob_hi = 25600. 400. 12800. -amr.n_cell = 128 4 32 # dx=dy=dz=100 m - -# periodic in x to match WRF setup -# - as an alternative, could use symmetry at x=0 and outflow at x=25600 -geometry.is_periodic = 1 1 0 -zlo.type = "SlipWall" -zhi.type = "SlipWall" - -# TIME STEP CONTROL -erf.fixed_dt = 1.0 # fixed time step [s] -- Straka et al 1993 -erf.fixed_fast_dt = 0.25 # fixed time step [s] -- Straka et al 1993 - -# DIAGNOSTICS & VERBOSITY -erf.sum_interval = 1 # timesteps between computing mass -erf.v = 1 # verbosity in ERF.cpp -amr.v = 1 # verbosity in Amr.cpp - -# REFINEMENT / REGRIDDING -amr.max_level = 0 # maximum level number allowed - -# CHECKPOINT FILES -amr.check_file = chk # root name of checkpoint file -amr.check_int = 10000 # number of timesteps between checkpoints -#amr.restart = chk01000 - -# PLOTFILES -erf.plot_file_1 = plt # root name of plotfile -erf.plot_int_1 = 1 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhotheta rhoQ1 rhoQ2 rhoQ3 x_velocity y_velocity z_velocity pressure theta temp qt qp qv qc qi - -# SOLVER CHOICE -erf.use_gravity = true -erf.use_coriolis = false - -erf.moisture_model = "SAM" - -erf.les_type = "Deardorff" -erf.KE_0 = 0.1 # for Deardorff -#erf.les_type = "None" -# -# diffusion coefficient from Straka, K = 75 m^2/s -# -#erf.molec_diff_type = "ConstantAlpha" -erf.molec_diff_type = "None" -erf.rho0_trans = 1.0 # [kg/m^3], used to convert input diffusivities -erf.dynamicViscosity = 75.0 # [kg/(m-s)] ==> nu = 75.0 m^2/s -erf.alpha_T = 75.0 # [m^2/s] - -# PROBLEM PARAMETERS (optional) -prob.T_0 = 300.0 -prob.U_0 = 0 -prob.T_pert = 3 diff --git a/Exec/SuperCell_3D/GNUmakefile b/Exec/SuperCell_3D/GNUmakefile deleted file mode 100644 index c13672992..000000000 --- a/Exec/SuperCell_3D/GNUmakefile +++ /dev/null @@ -1,32 +0,0 @@ -# AMReX -COMP = gnu -PRECISION = DOUBLE - -# Profiling -PROFILE = FALSE -TINY_PROFILE = FALSE -COMM_PROFILE = FALSE -TRACE_PROFILE = FALSE -MEM_PROFILE = FALSE -USE_GPROF = FALSE - -# Performance -USE_MPI = TRUE -USE_OMP = FALSE - -USE_CUDA = FALSE -USE_HIP = FALSE -USE_SYCL = FALSE - -# Debugging -DEBUG = FALSE - -TEST = TRUE -USE_ASSERTION = TRUE - -# GNU Make -Bpack := ./Make.package -Blocs := . -ERF_HOME := ../.. -ERF_PROBLEM_DIR = $(ERF_HOME)/Exec/SuperCell_3D -include $(ERF_HOME)/Exec/Make.ERF diff --git a/Exec/SuperCell_3D/Make.package b/Exec/SuperCell_3D/Make.package deleted file mode 100644 index 5fc21f61c..000000000 --- a/Exec/SuperCell_3D/Make.package +++ /dev/null @@ -1,2 +0,0 @@ -CEXE_headers += ERF_prob.H -CEXE_sources += ERF_prob.cpp diff --git a/Exec/SuperCell_3D/README b/Exec/SuperCell_3D/README deleted file mode 100644 index 9242958db..000000000 --- a/Exec/SuperCell_3D/README +++ /dev/null @@ -1,2 +0,0 @@ -This problem setup is the evolution of a supercell, which primarily tests the ability -of ERF to model moisture physics. diff --git a/Exec/AWAKEN/CMakeLists.txt b/Exec/WindFarmTests/AWAKEN/CMakeLists.txt similarity index 100% rename from Exec/AWAKEN/CMakeLists.txt rename to Exec/WindFarmTests/AWAKEN/CMakeLists.txt diff --git a/Exec/AWAKEN/ERF_prob.H b/Exec/WindFarmTests/AWAKEN/ERF_prob.H similarity index 98% rename from Exec/AWAKEN/ERF_prob.H rename to Exec/WindFarmTests/AWAKEN/ERF_prob.H index b509c8d45..b587046f4 100644 --- a/Exec/AWAKEN/ERF_prob.H +++ b/Exec/WindFarmTests/AWAKEN/ERF_prob.H @@ -11,7 +11,7 @@ struct ProbParm : ProbParmDefaults { amrex::Real rho_0 = 0.0; amrex::Real T_0 = 0.0; amrex::Real A_0 = 1.0; - amrex::Real QKE_0 = 0.1; + amrex::Real KE_0 = 0.1; amrex::Real U_0 = 0.0; amrex::Real V_0 = 0.0; diff --git a/Exec/AWAKEN/ERF_prob.cpp b/Exec/WindFarmTests/AWAKEN/ERF_prob.cpp similarity index 98% rename from Exec/AWAKEN/ERF_prob.cpp rename to Exec/WindFarmTests/AWAKEN/ERF_prob.cpp index 7f5fdda42..75514b1d1 100644 --- a/Exec/AWAKEN/ERF_prob.cpp +++ b/Exec/WindFarmTests/AWAKEN/ERF_prob.cpp @@ -16,7 +16,7 @@ Problem::Problem(const amrex::Real* problo, const amrex::Real* probhi) pp.query("rho_0", parms.rho_0); pp.query("T_0", parms.T_0); pp.query("A_0", parms.A_0); - pp.query("QKE_0", parms.QKE_0); + pp.query("KE_0", parms.KE_0); pp.query("U_0", parms.U_0); pp.query("V_0", parms.V_0); @@ -90,8 +90,8 @@ Problem::init_custom_pert( // Set scalar = A_0*exp(-10r^2), where r is distance from center of domain state_pert(i, j, k, RhoScalar_comp) = parms_d.A_0 * exp(-10.*r*r); - // Set an initial value for QKE - state_pert(i, j, k, RhoQKE_comp) = parms_d.QKE_0; + // Set an initial value for KE + state_pert(i, j, k, RhoKE_comp) = parms_d.KE_0; if (use_moisture) { state_pert(i, j, k, RhoQ1_comp) = 0.0; diff --git a/Exec/AWAKEN/GNUmakefile b/Exec/WindFarmTests/AWAKEN/GNUmakefile similarity index 100% rename from Exec/AWAKEN/GNUmakefile rename to Exec/WindFarmTests/AWAKEN/GNUmakefile diff --git a/Exec/RegTests/WitchOfAgnesi/Make.package b/Exec/WindFarmTests/AWAKEN/Make.package similarity index 100% rename from Exec/RegTests/WitchOfAgnesi/Make.package rename to Exec/WindFarmTests/AWAKEN/Make.package diff --git a/Exec/AWAKEN/README b/Exec/WindFarmTests/AWAKEN/README similarity index 100% rename from Exec/AWAKEN/README rename to Exec/WindFarmTests/AWAKEN/README diff --git a/Exec/AWAKEN/inputs_All_EWP b/Exec/WindFarmTests/AWAKEN/inputs_All_EWP similarity index 98% rename from Exec/AWAKEN/inputs_All_EWP rename to Exec/WindFarmTests/AWAKEN/inputs_All_EWP index cda4dff42..87cc49fc1 100644 --- a/Exec/AWAKEN/inputs_All_EWP +++ b/Exec/WindFarmTests/AWAKEN/inputs_All_EWP @@ -68,7 +68,7 @@ erf.check_int = 10000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 1200 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE vorticity SMark +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE vorticity SMark # SOLVER CHOICE erf.alpha_T = 0.0 diff --git a/Exec/AWAKEN/inputs_KingPlains_EWP b/Exec/WindFarmTests/AWAKEN/inputs_KingPlains_EWP similarity index 97% rename from Exec/AWAKEN/inputs_KingPlains_EWP rename to Exec/WindFarmTests/AWAKEN/inputs_KingPlains_EWP index 653b75e3c..912911ae7 100644 --- a/Exec/AWAKEN/inputs_KingPlains_EWP +++ b/Exec/WindFarmTests/AWAKEN/inputs_KingPlains_EWP @@ -58,7 +58,7 @@ erf.check_int = 10000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 100 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE vorticity SMark +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE vorticity SMark # SOLVER CHOICE erf.alpha_T = 0.0 diff --git a/Exec/AWAKEN/inputs_KingPlains_Fitch b/Exec/WindFarmTests/AWAKEN/inputs_KingPlains_Fitch similarity index 97% rename from Exec/AWAKEN/inputs_KingPlains_Fitch rename to Exec/WindFarmTests/AWAKEN/inputs_KingPlains_Fitch index 169f2a8d5..d356cbbd0 100644 --- a/Exec/AWAKEN/inputs_KingPlains_Fitch +++ b/Exec/WindFarmTests/AWAKEN/inputs_KingPlains_Fitch @@ -58,7 +58,7 @@ erf.check_int = 10000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 100 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE vorticity SMark +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE vorticity SMark # SOLVER CHOICE erf.alpha_T = 0.0 diff --git a/Exec/AWAKEN/inputs_KingPlains_SimpleAD b/Exec/WindFarmTests/AWAKEN/inputs_KingPlains_SimpleAD similarity index 97% rename from Exec/AWAKEN/inputs_KingPlains_SimpleAD rename to Exec/WindFarmTests/AWAKEN/inputs_KingPlains_SimpleAD index 9b1822545..949916782 100644 --- a/Exec/AWAKEN/inputs_KingPlains_SimpleAD +++ b/Exec/WindFarmTests/AWAKEN/inputs_KingPlains_SimpleAD @@ -60,7 +60,7 @@ erf.check_int = 10000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 100 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE vorticity SMark +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE vorticity SMark # SOLVER CHOICE erf.alpha_T = 0.0 diff --git a/Exec/AWAKEN/windturbines_All.txt b/Exec/WindFarmTests/AWAKEN/windturbines_All.txt similarity index 100% rename from Exec/AWAKEN/windturbines_All.txt rename to Exec/WindFarmTests/AWAKEN/windturbines_All.txt diff --git a/Exec/AWAKEN/windturbines_ArmadilloFlats.txt b/Exec/WindFarmTests/AWAKEN/windturbines_ArmadilloFlats.txt similarity index 100% rename from Exec/AWAKEN/windturbines_ArmadilloFlats.txt rename to Exec/WindFarmTests/AWAKEN/windturbines_ArmadilloFlats.txt diff --git a/Exec/AWAKEN/windturbines_KingPlains.txt b/Exec/WindFarmTests/AWAKEN/windturbines_KingPlains.txt similarity index 100% rename from Exec/AWAKEN/windturbines_KingPlains.txt rename to Exec/WindFarmTests/AWAKEN/windturbines_KingPlains.txt diff --git a/Exec/AWAKEN/windturbines_spec_AWAKEN.tbl b/Exec/WindFarmTests/AWAKEN/windturbines_spec_AWAKEN.tbl similarity index 100% rename from Exec/AWAKEN/windturbines_spec_AWAKEN.tbl rename to Exec/WindFarmTests/AWAKEN/windturbines_spec_AWAKEN.tbl diff --git a/Exec/EWP/CMakeLists.txt b/Exec/WindFarmTests/EWP/CMakeLists.txt similarity index 100% rename from Exec/EWP/CMakeLists.txt rename to Exec/WindFarmTests/EWP/CMakeLists.txt diff --git a/Exec/SimpleActuatorDisk/ERF_prob.H b/Exec/WindFarmTests/EWP/ERF_prob.H similarity index 98% rename from Exec/SimpleActuatorDisk/ERF_prob.H rename to Exec/WindFarmTests/EWP/ERF_prob.H index afbc3736f..777be4724 100644 --- a/Exec/SimpleActuatorDisk/ERF_prob.H +++ b/Exec/WindFarmTests/EWP/ERF_prob.H @@ -11,7 +11,7 @@ struct ProbParm : ProbParmDefaults { amrex::Real rho_0 = 0.0; amrex::Real T_0 = 0.0; amrex::Real A_0 = 1.0; - amrex::Real QKE_0 = 0.1; + amrex::Real KE_0 = 0.1; amrex::Real U_0 = 0.0; amrex::Real V_0 = 0.0; diff --git a/Exec/EWP/ERF_prob.cpp b/Exec/WindFarmTests/EWP/ERF_prob.cpp similarity index 98% rename from Exec/EWP/ERF_prob.cpp rename to Exec/WindFarmTests/EWP/ERF_prob.cpp index adce92fe8..145f66ad6 100644 --- a/Exec/EWP/ERF_prob.cpp +++ b/Exec/WindFarmTests/EWP/ERF_prob.cpp @@ -16,7 +16,7 @@ Problem::Problem(const amrex::Real* problo, const amrex::Real* probhi) pp.query("rho_0", parms.rho_0); pp.query("T_0", parms.T_0); pp.query("A_0", parms.A_0); - pp.query("QKE_0", parms.QKE_0); + pp.query("KE_0", parms.KE_0); pp.query("U_0", parms.U_0); pp.query("V_0", parms.V_0); @@ -87,8 +87,8 @@ Problem::init_custom_pert( // Set scalar = A_0*exp(-10r^2), where r is distance from center of domain state_pert(i, j, k, RhoScalar_comp) = parms_d.A_0 * exp(-10.*r*r); - // Set an initial value for QKE - state_pert(i, j, k, RhoQKE_comp) = parms_d.QKE_0; + // Set an initial value for KE + state_pert(i, j, k, RhoKE_comp) = parms_d.KE_0; if (use_moisture) { state_pert(i, j, k, RhoQ1_comp) = 0.0; diff --git a/Exec/EWP/GNUmakefile b/Exec/WindFarmTests/EWP/GNUmakefile similarity index 100% rename from Exec/EWP/GNUmakefile rename to Exec/WindFarmTests/EWP/GNUmakefile diff --git a/Exec/SimpleActuatorDisk/Make.package b/Exec/WindFarmTests/EWP/Make.package similarity index 100% rename from Exec/SimpleActuatorDisk/Make.package rename to Exec/WindFarmTests/EWP/Make.package diff --git a/Exec/EWP/README b/Exec/WindFarmTests/EWP/README similarity index 100% rename from Exec/EWP/README rename to Exec/WindFarmTests/EWP/README diff --git a/Exec/EWP/inputs_1WT_lat_lon b/Exec/WindFarmTests/EWP/inputs_1WT_lat_lon similarity index 98% rename from Exec/EWP/inputs_1WT_lat_lon rename to Exec/WindFarmTests/EWP/inputs_1WT_lat_lon index 215618298..73acdfc52 100644 --- a/Exec/EWP/inputs_1WT_lat_lon +++ b/Exec/WindFarmTests/EWP/inputs_1WT_lat_lon @@ -70,7 +70,7 @@ erf.check_int = 1000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 100 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE num_turb vorticity +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE num_turb vorticity # ADVECTION SCHEMES erf.dycore_horiz_adv_type = "Centered_2nd" diff --git a/Exec/EWP/inputs_1WT_x_y b/Exec/WindFarmTests/EWP/inputs_1WT_x_y similarity index 98% rename from Exec/EWP/inputs_1WT_x_y rename to Exec/WindFarmTests/EWP/inputs_1WT_x_y index e9c1296ef..7c0b067f1 100644 --- a/Exec/EWP/inputs_1WT_x_y +++ b/Exec/WindFarmTests/EWP/inputs_1WT_x_y @@ -68,7 +68,7 @@ erf.check_int = 1000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 100 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE num_turb vorticity +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE num_turb vorticity # ADVECTION SCHEMES erf.dycore_horiz_adv_type = "Centered_2nd" diff --git a/Exec/EWP/inputs_WindFarm_lat_lon b/Exec/WindFarmTests/EWP/inputs_WindFarm_lat_lon similarity index 97% rename from Exec/EWP/inputs_WindFarm_lat_lon rename to Exec/WindFarmTests/EWP/inputs_WindFarm_lat_lon index 0b4b92a4b..6bb90ce8e 100644 --- a/Exec/EWP/inputs_WindFarm_lat_lon +++ b/Exec/WindFarmTests/EWP/inputs_WindFarm_lat_lon @@ -55,7 +55,7 @@ erf.check_int = 10000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 1000 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE num_turb vorticity +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE num_turb vorticity # SOLVER CHOICE erf.alpha_T = 0.0 diff --git a/Exec/EWP/inputs_WindFarm_x_y b/Exec/WindFarmTests/EWP/inputs_WindFarm_x_y similarity index 97% rename from Exec/EWP/inputs_WindFarm_x_y rename to Exec/WindFarmTests/EWP/inputs_WindFarm_x_y index 1f102dc4d..198eece95 100644 --- a/Exec/EWP/inputs_WindFarm_x_y +++ b/Exec/WindFarmTests/EWP/inputs_WindFarm_x_y @@ -53,7 +53,7 @@ erf.check_int = 10000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 1000 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE num_turb vorticity +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE num_turb vorticity # SOLVER CHOICE erf.alpha_T = 0.0 diff --git a/Exec/EWP/windturbines_loc_lat_lon_1WT.txt b/Exec/WindFarmTests/EWP/windturbines_loc_lat_lon_1WT.txt similarity index 100% rename from Exec/EWP/windturbines_loc_lat_lon_1WT.txt rename to Exec/WindFarmTests/EWP/windturbines_loc_lat_lon_1WT.txt diff --git a/Exec/EWP/windturbines_loc_lat_lon_WindFarm.txt b/Exec/WindFarmTests/EWP/windturbines_loc_lat_lon_WindFarm.txt similarity index 100% rename from Exec/EWP/windturbines_loc_lat_lon_WindFarm.txt rename to Exec/WindFarmTests/EWP/windturbines_loc_lat_lon_WindFarm.txt diff --git a/Exec/EWP/windturbines_loc_x_y_1WT.txt b/Exec/WindFarmTests/EWP/windturbines_loc_x_y_1WT.txt similarity index 100% rename from Exec/EWP/windturbines_loc_x_y_1WT.txt rename to Exec/WindFarmTests/EWP/windturbines_loc_x_y_1WT.txt diff --git a/Exec/EWP/windturbines_loc_x_y_WindFarm.txt b/Exec/WindFarmTests/EWP/windturbines_loc_x_y_WindFarm.txt similarity index 100% rename from Exec/EWP/windturbines_loc_x_y_WindFarm.txt rename to Exec/WindFarmTests/EWP/windturbines_loc_x_y_WindFarm.txt diff --git a/Exec/EWP/windturbines_spec_1WT.tbl b/Exec/WindFarmTests/EWP/windturbines_spec_1WT.tbl similarity index 100% rename from Exec/EWP/windturbines_spec_1WT.tbl rename to Exec/WindFarmTests/EWP/windturbines_spec_1WT.tbl diff --git a/Exec/EWP/windturbines_spec_WindFarm.tbl b/Exec/WindFarmTests/EWP/windturbines_spec_WindFarm.tbl similarity index 100% rename from Exec/EWP/windturbines_spec_WindFarm.tbl rename to Exec/WindFarmTests/EWP/windturbines_spec_WindFarm.tbl diff --git a/Exec/SimpleActuatorDisk/ERF_prob.cpp b/Exec/WindFarmTests/GeneralActuatorDisk/ERF_prob.cpp similarity index 99% rename from Exec/SimpleActuatorDisk/ERF_prob.cpp rename to Exec/WindFarmTests/GeneralActuatorDisk/ERF_prob.cpp index adce92fe8..3eeff25fa 100644 --- a/Exec/SimpleActuatorDisk/ERF_prob.cpp +++ b/Exec/WindFarmTests/GeneralActuatorDisk/ERF_prob.cpp @@ -88,7 +88,7 @@ Problem::init_custom_pert( state_pert(i, j, k, RhoScalar_comp) = parms_d.A_0 * exp(-10.*r*r); // Set an initial value for QKE - state_pert(i, j, k, RhoQKE_comp) = parms_d.QKE_0; + //state_pert(i, j, k, RhoQKE_comp) = parms_d.QKE_0; if (use_moisture) { state_pert(i, j, k, RhoQ1_comp) = 0.0; diff --git a/Exec/SimpleActuatorDisk/CMakeLists.txt b/Exec/WindFarmTests/SimpleActuatorDisk/CMakeLists.txt similarity index 100% rename from Exec/SimpleActuatorDisk/CMakeLists.txt rename to Exec/WindFarmTests/SimpleActuatorDisk/CMakeLists.txt diff --git a/Exec/EWP/ERF_prob.H b/Exec/WindFarmTests/SimpleActuatorDisk/ERF_prob.H similarity index 98% rename from Exec/EWP/ERF_prob.H rename to Exec/WindFarmTests/SimpleActuatorDisk/ERF_prob.H index afbc3736f..777be4724 100644 --- a/Exec/EWP/ERF_prob.H +++ b/Exec/WindFarmTests/SimpleActuatorDisk/ERF_prob.H @@ -11,7 +11,7 @@ struct ProbParm : ProbParmDefaults { amrex::Real rho_0 = 0.0; amrex::Real T_0 = 0.0; amrex::Real A_0 = 1.0; - amrex::Real QKE_0 = 0.1; + amrex::Real KE_0 = 0.1; amrex::Real U_0 = 0.0; amrex::Real V_0 = 0.0; diff --git a/Exec/WindFarmTests/SimpleActuatorDisk/ERF_prob.cpp b/Exec/WindFarmTests/SimpleActuatorDisk/ERF_prob.cpp new file mode 100644 index 000000000..145f66ad6 --- /dev/null +++ b/Exec/WindFarmTests/SimpleActuatorDisk/ERF_prob.cpp @@ -0,0 +1,164 @@ +#include "ERF_prob.H" +#include "AMReX_Random.H" + +using namespace amrex; + +std::unique_ptr +amrex_probinit(const amrex_real* problo, const amrex_real* probhi) +{ + return std::make_unique(problo, probhi); +} + +Problem::Problem(const amrex::Real* problo, const amrex::Real* probhi) +{ + // Parse params + ParmParse pp("prob"); + pp.query("rho_0", parms.rho_0); + pp.query("T_0", parms.T_0); + pp.query("A_0", parms.A_0); + pp.query("KE_0", parms.KE_0); + + pp.query("U_0", parms.U_0); + pp.query("V_0", parms.V_0); + pp.query("W_0", parms.W_0); + pp.query("U_0_Pert_Mag", parms.U_0_Pert_Mag); + pp.query("V_0_Pert_Mag", parms.V_0_Pert_Mag); + pp.query("W_0_Pert_Mag", parms.W_0_Pert_Mag); + pp.query("T_0_Pert_Mag", parms.T_0_Pert_Mag); + + pp.query("pert_deltaU", parms.pert_deltaU); + pp.query("pert_deltaV", parms.pert_deltaV); + pp.query("pert_periods_U", parms.pert_periods_U); + pp.query("pert_periods_V", parms.pert_periods_V); + pp.query("pert_ref_height", parms.pert_ref_height); + parms.aval = parms.pert_periods_U * 2.0 * PI / (probhi[1] - problo[1]); + parms.bval = parms.pert_periods_V * 2.0 * PI / (probhi[0] - problo[0]); + parms.ufac = parms.pert_deltaU * std::exp(0.5) / parms.pert_ref_height; + parms.vfac = parms.pert_deltaV * std::exp(0.5) / parms.pert_ref_height; + + init_base_parms(parms.rho_0, parms.T_0); +} + +void +Problem::init_custom_pert( + const amrex::Box& bx, + const amrex::Box& xbx, + const amrex::Box& ybx, + const amrex::Box& zbx, + amrex::Array4 const& /*state*/, + amrex::Array4 const& state_pert, + amrex::Array4 const& x_vel_pert, + amrex::Array4 const& y_vel_pert, + amrex::Array4 const& z_vel_pert, + amrex::Array4 const& /*r_hse*/, + amrex::Array4 const& /*p_hse*/, + amrex::Array4 const& /*z_nd*/, + amrex::Array4 const& /*z_cc*/, + amrex::GeometryData const& geomdata, + amrex::Array4 const& /*mf_m*/, + amrex::Array4 const& /*mf_u*/, + amrex::Array4 const& /*mf_v*/, + const SolverChoice& sc) +{ + const bool use_moisture = (sc.moisture_type != MoistureType::None); + + ParallelForRNG(bx, [=, parms_d=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept { + // Geometry + const Real* prob_lo = geomdata.ProbLo(); + const Real* prob_hi = geomdata.ProbHi(); + const Real* dx = geomdata.CellSize(); + const Real x = prob_lo[0] + (i + 0.5) * dx[0]; + const Real y = prob_lo[1] + (j + 0.5) * dx[1]; + const Real z = prob_lo[2] + (k + 0.5) * dx[2]; + + // Define a point (xc,yc,zc) at the center of the domain + const Real xc = 0.5 * (prob_lo[0] + prob_hi[0]); + const Real yc = 0.5 * (prob_lo[1] + prob_hi[1]); + const Real zc = 0.5 * (prob_lo[2] + prob_hi[2]); + + const Real r = std::sqrt((x-xc)*(x-xc) + (y-yc)*(y-yc) + (z-zc)*(z-zc)); + + // Add temperature perturbations + if ((z <= parms_d.pert_ref_height) && (parms_d.T_0_Pert_Mag != 0.0)) { + Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0 + state_pert(i, j, k, RhoTheta_comp) = (rand_double*2.0 - 1.0)*parms_d.T_0_Pert_Mag; + } + + // Set scalar = A_0*exp(-10r^2), where r is distance from center of domain + state_pert(i, j, k, RhoScalar_comp) = parms_d.A_0 * exp(-10.*r*r); + + // Set an initial value for KE + state_pert(i, j, k, RhoKE_comp) = parms_d.KE_0; + + if (use_moisture) { + state_pert(i, j, k, RhoQ1_comp) = 0.0; + state_pert(i, j, k, RhoQ2_comp) = 0.0; + } + }); + + // Set the x-velocity + ParallelForRNG(xbx, [=, parms_d=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept { + const Real* prob_lo = geomdata.ProbLo(); + const Real* dx = geomdata.CellSize(); + const Real y = prob_lo[1] + (j + 0.5) * dx[1]; + const Real z = prob_lo[2] + (k + 0.5) * dx[2]; + + // Set the x-velocity + x_vel_pert(i, j, k) = parms_d.U_0; + if ((z <= parms_d.pert_ref_height) && (parms_d.U_0_Pert_Mag != 0.0)) + { + Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0 + Real x_vel_prime = (rand_double*2.0 - 1.0)*parms_d.U_0_Pert_Mag; + x_vel_pert(i, j, k) += x_vel_prime; + } + if (parms_d.pert_deltaU != 0.0) + { + const amrex::Real yl = y - prob_lo[1]; + const amrex::Real zl = z / parms_d.pert_ref_height; + const amrex::Real damp = std::exp(-0.5 * zl * zl); + x_vel_pert(i, j, k) += parms_d.ufac * damp * z * std::cos(parms_d.aval * yl); + } + }); + + // Set the y-velocity + ParallelForRNG(ybx, [=, parms_d=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept { + const Real* prob_lo = geomdata.ProbLo(); + const Real* dx = geomdata.CellSize(); + const Real x = prob_lo[0] + (i + 0.5) * dx[0]; + const Real z = prob_lo[2] + (k + 0.5) * dx[2]; + + // Set the y-velocity + y_vel_pert(i, j, k) = parms_d.V_0; + if ((z <= parms_d.pert_ref_height) && (parms_d.V_0_Pert_Mag != 0.0)) + { + Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0 + Real y_vel_prime = (rand_double*2.0 - 1.0)*parms_d.V_0_Pert_Mag; + y_vel_pert(i, j, k) += y_vel_prime; + } + if (parms_d.pert_deltaV != 0.0) + { + const amrex::Real xl = x - prob_lo[0]; + const amrex::Real zl = z / parms_d.pert_ref_height; + const amrex::Real damp = std::exp(-0.5 * zl * zl); + y_vel_pert(i, j, k) += parms_d.vfac * damp * z * std::cos(parms_d.bval * xl); + } + }); + + // Set the z-velocity + ParallelForRNG(zbx, [=, parms_d=parms] AMREX_GPU_DEVICE(int i, int j, int k, const amrex::RandomEngine& engine) noexcept { + const int dom_lo_z = geomdata.Domain().smallEnd()[2]; + const int dom_hi_z = geomdata.Domain().bigEnd()[2]; + + // Set the z-velocity + if (k == dom_lo_z || k == dom_hi_z+1) + { + z_vel_pert(i, j, k) = 0.0; + } + else if (parms_d.W_0_Pert_Mag != 0.0) + { + Real rand_double = amrex::Random(engine); // Between 0.0 and 1.0 + Real z_vel_prime = (rand_double*2.0 - 1.0)*parms_d.W_0_Pert_Mag; + z_vel_pert(i, j, k) = parms_d.W_0 + z_vel_prime; + } + }); +} diff --git a/Exec/SimpleActuatorDisk/GNUmakefile b/Exec/WindFarmTests/SimpleActuatorDisk/GNUmakefile similarity index 100% rename from Exec/SimpleActuatorDisk/GNUmakefile rename to Exec/WindFarmTests/SimpleActuatorDisk/GNUmakefile diff --git a/Exec/SquallLine_2D/Make.package b/Exec/WindFarmTests/SimpleActuatorDisk/Make.package similarity index 100% rename from Exec/SquallLine_2D/Make.package rename to Exec/WindFarmTests/SimpleActuatorDisk/Make.package diff --git a/Exec/SimpleActuatorDisk/README b/Exec/WindFarmTests/SimpleActuatorDisk/README similarity index 100% rename from Exec/SimpleActuatorDisk/README rename to Exec/WindFarmTests/SimpleActuatorDisk/README diff --git a/Exec/SimpleActuatorDisk/inputs_1WT_lat_lon b/Exec/WindFarmTests/SimpleActuatorDisk/inputs_1WT_lat_lon similarity index 98% rename from Exec/SimpleActuatorDisk/inputs_1WT_lat_lon rename to Exec/WindFarmTests/SimpleActuatorDisk/inputs_1WT_lat_lon index ff237b1cc..4781b7b8a 100644 --- a/Exec/SimpleActuatorDisk/inputs_1WT_lat_lon +++ b/Exec/WindFarmTests/SimpleActuatorDisk/inputs_1WT_lat_lon @@ -70,7 +70,7 @@ erf.check_int = 1000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 100 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE num_turb vorticity +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE num_turb vorticity # ADVECTION SCHEMES erf.dycore_horiz_adv_type = "Centered_2nd" diff --git a/Exec/SimpleActuatorDisk/inputs_1WT_x_y b/Exec/WindFarmTests/SimpleActuatorDisk/inputs_1WT_x_y similarity index 97% rename from Exec/SimpleActuatorDisk/inputs_1WT_x_y rename to Exec/WindFarmTests/SimpleActuatorDisk/inputs_1WT_x_y index 4796a2cf4..56be43a86 100644 --- a/Exec/SimpleActuatorDisk/inputs_1WT_x_y +++ b/Exec/WindFarmTests/SimpleActuatorDisk/inputs_1WT_x_y @@ -68,7 +68,7 @@ erf.check_int = 1000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 10 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE num_turb vorticity_x vorticity_y vorticity_z +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE num_turb vorticity_x vorticity_y vorticity_z # ADVECTION SCHEMES erf.dycore_horiz_adv_type = "Centered_2nd" diff --git a/Exec/SimpleActuatorDisk/inputs_WindFarm_lat_lon b/Exec/WindFarmTests/SimpleActuatorDisk/inputs_WindFarm_lat_lon similarity index 97% rename from Exec/SimpleActuatorDisk/inputs_WindFarm_lat_lon rename to Exec/WindFarmTests/SimpleActuatorDisk/inputs_WindFarm_lat_lon index 8fe3e2e82..8c6e9c77d 100644 --- a/Exec/SimpleActuatorDisk/inputs_WindFarm_lat_lon +++ b/Exec/WindFarmTests/SimpleActuatorDisk/inputs_WindFarm_lat_lon @@ -55,7 +55,7 @@ erf.check_int = 10000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 1000 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE num_turb vorticity +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE num_turb vorticity # SOLVER CHOICE erf.alpha_T = 0.0 diff --git a/Exec/SimpleActuatorDisk/inputs_WindFarm_x_y b/Exec/WindFarmTests/SimpleActuatorDisk/inputs_WindFarm_x_y similarity index 97% rename from Exec/SimpleActuatorDisk/inputs_WindFarm_x_y rename to Exec/WindFarmTests/SimpleActuatorDisk/inputs_WindFarm_x_y index 72e9af156..1733cfe54 100644 --- a/Exec/SimpleActuatorDisk/inputs_WindFarm_x_y +++ b/Exec/WindFarmTests/SimpleActuatorDisk/inputs_WindFarm_x_y @@ -53,7 +53,7 @@ erf.check_int = 10000 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 1000 # number of timesteps between plotfiles -erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta QKE num_turb vorticity +erf.plot_vars_1 = density rhoadv_0 x_velocity y_velocity z_velocity pressure temp theta KE num_turb vorticity # SOLVER CHOICE erf.alpha_T = 0.0 diff --git a/Exec/SimpleActuatorDisk/windturbines_loc_lat_lon_1WT.txt b/Exec/WindFarmTests/SimpleActuatorDisk/windturbines_loc_lat_lon_1WT.txt similarity index 100% rename from Exec/SimpleActuatorDisk/windturbines_loc_lat_lon_1WT.txt rename to Exec/WindFarmTests/SimpleActuatorDisk/windturbines_loc_lat_lon_1WT.txt diff --git a/Exec/SimpleActuatorDisk/windturbines_loc_x_y_1WT.txt b/Exec/WindFarmTests/SimpleActuatorDisk/windturbines_loc_x_y_1WT.txt similarity index 100% rename from Exec/SimpleActuatorDisk/windturbines_loc_x_y_1WT.txt rename to Exec/WindFarmTests/SimpleActuatorDisk/windturbines_loc_x_y_1WT.txt diff --git a/Exec/SimpleActuatorDisk/windturbines_spec_1WT.tbl b/Exec/WindFarmTests/SimpleActuatorDisk/windturbines_spec_1WT.tbl similarity index 100% rename from Exec/SimpleActuatorDisk/windturbines_spec_1WT.tbl rename to Exec/WindFarmTests/SimpleActuatorDisk/windturbines_spec_1WT.tbl diff --git a/Exec/inputs.mesh_refinement b/Exec/inputs.mesh_refinement deleted file mode 100644 index 55da0226c..000000000 --- a/Exec/inputs.mesh_refinement +++ /dev/null @@ -1,15 +0,0 @@ - -# This file is meant to serve as an example of how to specify parameters -# that are only relevant when running with mesh refinement - -# REFINEMENT / REGRIDDING -amr.max_level = 1 # maximum level number allowed -amr.ref_ratio_vect = 2 2 1 3 3 1 # refinement ratio written as lev0_x lev0_y lev0_z lev1_x lev1_y lev1_z ... -amr.n_error_buf = 2 2 2 2 # number of buffer cells in error est - -erf.regrid_int = 2 2 2 2 # how often to regrid - -# How to specify a region for static refinement -erf.refinement_indicators = box1 -erf.box1.in_box_lo = .15 .25 -erf.box1.in_box_hi = .55 .65 diff --git a/Source/BoundaryConditions/ERF_BoundaryConditions_basestate.cpp b/Source/BoundaryConditions/ERF_BoundaryConditions_basestate.cpp index e7a47ad52..de97493ae 100644 --- a/Source/BoundaryConditions/ERF_BoundaryConditions_basestate.cpp +++ b/Source/BoundaryConditions/ERF_BoundaryConditions_basestate.cpp @@ -1,5 +1,6 @@ #include "AMReX_PhysBCFunct.H" #include +#include using namespace amrex; @@ -11,15 +12,18 @@ using namespace amrex; * @param[in] domain simulation domain */ -void ERFPhysBCFunct_base::impose_lateral_basestate_bcs (const Array4& dest_arr, const Box& bx, const Box& domain) +void ERFPhysBCFunct_base::impose_lateral_basestate_bcs (const Array4& dest_arr, const Box& bx, const Box& domain, + int ncomp, const IntVect& nghost) { BL_PROFILE_VAR("impose_lateral_base_bcs()",impose_lateral_base_bcs); - - int icomp = 0; - int ncomp = 3; + // + // Note that the "bx" that comes in here has already been grown in the lateral directions + // but not in the vertical + // const int* bxlo = bx.loVect(); const int* bxhi = bx.hiVect(); + const int* dlo = domain.loVect(); const int* dhi = domain.hiVect(); @@ -61,18 +65,96 @@ void ERFPhysBCFunct_base::impose_lateral_basestate_bcs (const Array4& dest // Do ghost cells in x-direction but not reaching out in y // The corners we miss here will be covered in the y-loop below or by periodicity if (!is_periodic_in_x) + { + // Populate ghost cells on lo-x and hi-x domain boundaries + Box bx_xlo(bx); bx_xlo.setBig (0,dom_lo.x-nghost[0]); + Box bx_xhi(bx); bx_xhi.setSmall(0,dom_hi.x+nghost[0]); + + ParallelFor( + bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) + { + int dest_comp = n; + int l_bc_type = bc_ptr[n].lo(0); + int iflip = dom_lo.x - 1 - i; + if (l_bc_type == ERFBCType::foextrap) { + dest_arr(i,j,k,dest_comp) = dest_arr(dom_lo.x,j,k,dest_comp); + } else if (l_bc_type == ERFBCType::open) { + dest_arr(i,j,k,dest_comp) = dest_arr(dom_lo.x,j,k,dest_comp); + } else if (l_bc_type == ERFBCType::reflect_even) { + dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp); + } + }, + bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) + { + int dest_comp = n; + int h_bc_type = bc_ptr[n].hi(0); + int iflip = 2*dom_hi.x + 1 - i; + if (h_bc_type == ERFBCType::foextrap) { + dest_arr(i,j,k,dest_comp) = dest_arr(dom_hi.x,j,k,dest_comp); + } else if (h_bc_type == ERFBCType::open) { + dest_arr(i,j,k,dest_comp) = dest_arr(dom_hi.x,j,k,dest_comp); + } else if (h_bc_type == ERFBCType::reflect_even) { + dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp); + } + } + ); + } + + if (!is_periodic_in_y) + { + // Populate ghost cells on lo-y and hi-y domain boundaries + Box bx_ylo(bx); bx_ylo.setBig (1,dom_lo.y-nghost[1]); + Box bx_yhi(bx); bx_yhi.setSmall(1,dom_hi.y+nghost[1]); + if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,nghost[2]); + if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,nghost[2]); + if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,nghost[2]); + if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,nghost[2]); + ParallelFor( + bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) + { + int dest_comp = n; + int l_bc_type = bc_ptr[n].lo(1); + int jflip = dom_lo.y - 1 - j; + if (l_bc_type == ERFBCType::foextrap) { + dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_lo.y,k,dest_comp); + } else if (l_bc_type == ERFBCType::open) { + dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_lo.y,k,dest_comp); + } else if (l_bc_type == ERFBCType::reflect_even) { + dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp); + } + + }, + bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) + { + int dest_comp = n; + int h_bc_type = bc_ptr[n].hi(1); + int jflip = 2*dom_hi.y + 1 - j; + if (h_bc_type == ERFBCType::foextrap) { + dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_hi.y,k,dest_comp); + } else if (h_bc_type == ERFBCType::open) { + dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_hi.y,k,dest_comp); + } else if (h_bc_type == ERFBCType::reflect_even) { + dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp); + } + } + ); + } + + // Next do ghost cells in x-direction but not reaching out in y + // The corners we miss here will be covered in the y-loop below or by periodicity + if (!is_periodic_in_x) { // Populate ghost cells on lo-x and hi-x domain boundaries Box bx_xlo(bx); bx_xlo.setBig (0,dom_lo.x-1); Box bx_xhi(bx); bx_xhi.setSmall(0,dom_hi.x+1); - if (bx_xlo.smallEnd(2) != domain.smallEnd(2)) bx_xlo.growLo(2,1); - if (bx_xlo.bigEnd(2) != domain.bigEnd(2)) bx_xlo.growHi(2,1); - if (bx_xhi.smallEnd(2) != domain.smallEnd(2)) bx_xhi.growLo(2,1); - if (bx_xhi.bigEnd(2) != domain.bigEnd(2)) bx_xhi.growHi(2,1); + if (bx_xlo.smallEnd(2) != domain.smallEnd(2)) bx_xlo.growLo(2,nghost[2]); + if (bx_xlo.bigEnd(2) != domain.bigEnd(2)) bx_xlo.growHi(2,nghost[2]); + if (bx_xhi.smallEnd(2) != domain.smallEnd(2)) bx_xhi.growLo(2,nghost[2]); + if (bx_xhi.bigEnd(2) != domain.bigEnd(2)) bx_xhi.growHi(2,nghost[2]); ParallelFor( bx_xlo, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) { - int dest_comp = icomp+n; + int dest_comp = n; int l_bc_type = bc_ptr[n].lo(0); int iflip = dom_lo.x - 1 - i; if (l_bc_type == ERFBCType::foextrap) { @@ -81,11 +163,16 @@ void ERFPhysBCFunct_base::impose_lateral_basestate_bcs (const Array4& dest dest_arr(i,j,k,dest_comp) = dest_arr(dom_lo.x,j,k,dest_comp); } else if (l_bc_type == ERFBCType::reflect_even) { dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp); + } else if (l_bc_type == ERFBCType::reflect_odd) { + dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp); + } else if (l_bc_type == ERFBCType::hoextrapcc) { + Real delta_i = (dom_lo.x - i); + dest_arr(i,j,k,dest_comp) = (1.0 + delta_i)*dest_arr(dom_lo.x,j,k,dest_comp) - delta_i*dest_arr(dom_lo.x+1,j,k,dest_comp) ; } }, bx_xhi, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) { - int dest_comp = icomp+n; + int dest_comp = n; int h_bc_type = bc_ptr[n].hi(0); int iflip = 2*dom_hi.x + 1 - i; if (h_bc_type == ERFBCType::foextrap) { @@ -94,6 +181,11 @@ void ERFPhysBCFunct_base::impose_lateral_basestate_bcs (const Array4& dest dest_arr(i,j,k,dest_comp) = dest_arr(dom_hi.x,j,k,dest_comp); } else if (h_bc_type == ERFBCType::reflect_even) { dest_arr(i,j,k,dest_comp) = dest_arr(iflip,j,k,dest_comp); + } else if (h_bc_type == ERFBCType::reflect_odd) { + dest_arr(i,j,k,dest_comp) = -dest_arr(iflip,j,k,dest_comp); + } else if (h_bc_type == ERFBCType::hoextrapcc) { + Real delta_i = (i - dom_hi.x); + dest_arr(i,j,k,dest_comp) = (1.0 + delta_i)*dest_arr(dom_hi.x,j,k,dest_comp) - delta_i*dest_arr(dom_hi.x-1,j,k,dest_comp) ; } } ); @@ -104,14 +196,14 @@ void ERFPhysBCFunct_base::impose_lateral_basestate_bcs (const Array4& dest // Populate ghost cells on lo-y and hi-y domain boundaries Box bx_ylo(bx); bx_ylo.setBig (1,dom_lo.y-1); Box bx_yhi(bx); bx_yhi.setSmall(1,dom_hi.y+1); - if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,1); - if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,1); - if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,1); - if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,1); + if (bx_ylo.smallEnd(2) != domain.smallEnd(2)) bx_ylo.growLo(2,nghost[2]); + if (bx_ylo.bigEnd(2) != domain.bigEnd(2)) bx_ylo.growHi(2,nghost[2]); + if (bx_yhi.smallEnd(2) != domain.smallEnd(2)) bx_yhi.growLo(2,nghost[2]); + if (bx_yhi.bigEnd(2) != domain.bigEnd(2)) bx_yhi.growHi(2,nghost[2]); ParallelFor( bx_ylo, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) { - int dest_comp = icomp+n; + int dest_comp = n; int l_bc_type = bc_ptr[n].lo(1); int jflip = dom_lo.y - 1 - j; if (l_bc_type == ERFBCType::foextrap) { @@ -120,12 +212,17 @@ void ERFPhysBCFunct_base::impose_lateral_basestate_bcs (const Array4& dest dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_lo.y,k,dest_comp); } else if (l_bc_type == ERFBCType::reflect_even) { dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp); + } else if (l_bc_type == ERFBCType::reflect_odd) { + dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp); + } else if (l_bc_type == ERFBCType::hoextrapcc) { + Real delta_j = (dom_lo.y - j); + dest_arr(i,j,k,dest_comp) = (1.0 + delta_j)*dest_arr(i,dom_lo.y,k,dest_comp) - delta_j*dest_arr(i,dom_lo.y+1,k,dest_comp) ; } }, bx_yhi, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) { - int dest_comp = icomp+n; + int dest_comp = n; int h_bc_type = bc_ptr[n].hi(1); int jflip = 2*dom_hi.y + 1 - j; if (h_bc_type == ERFBCType::foextrap) { @@ -134,6 +231,11 @@ void ERFPhysBCFunct_base::impose_lateral_basestate_bcs (const Array4& dest dest_arr(i,j,k,dest_comp) = dest_arr(i,dom_hi.y,k,dest_comp); } else if (h_bc_type == ERFBCType::reflect_even) { dest_arr(i,j,k,dest_comp) = dest_arr(i,jflip,k,dest_comp); + } else if (h_bc_type == ERFBCType::reflect_odd) { + dest_arr(i,j,k,dest_comp) = -dest_arr(i,jflip,k,dest_comp); + } else if (h_bc_type == ERFBCType::hoextrapcc) { + Real delta_j = (j - dom_hi.y); + dest_arr(i,j,k,dest_comp) = (1.0 + delta_j)*dest_arr(i,dom_hi.y,k,dest_comp) - delta_j*dest_arr(i,dom_hi.y-1,k,dest_comp); } } ); @@ -141,3 +243,38 @@ void ERFPhysBCFunct_base::impose_lateral_basestate_bcs (const Array4& dest Gpu::streamSynchronize(); } +void ERFPhysBCFunct_base::impose_vertical_basestate_bcs (const Array4& dest_arr, const Box& bx, const Box& domain, + int ncomp, const IntVect& /*nghost*/) +{ + BL_PROFILE_VAR("impose_vertical_base_bcs()",impose_vertical_base_bcs); + + const auto& dom_lo = lbound(domain); + const auto& dom_hi = ubound(domain); + + const Real hz = Real(0.5) * m_geom.CellSize(2); + + Box bx_zlo1(bx); bx_zlo1.setBig(2,dom_lo.z-1); if (bx_zlo1.ok()) bx_zlo1.setSmall(2,dom_lo.z-1); + ParallelFor( + bx_zlo1, [=] AMREX_GPU_DEVICE (int i, int j, int k) + { + dest_arr(i,j,k,BaseState::r0_comp) = dest_arr(i,j,dom_lo.z,BaseState::r0_comp); + dest_arr(i,j,k,BaseState::p0_comp) = p_0 - + dest_arr(i,j,k,BaseState::r0_comp) * hz * CONST_GRAV; + dest_arr(i,j,k,BaseState::pi0_comp) = dest_arr(i,j,dom_lo.z,BaseState::pi0_comp); + dest_arr(i,j,k,BaseState::th0_comp) = dest_arr(i,j,dom_lo.z,BaseState::th0_comp); + } + ); + + Box bx_zlo(bx); bx_zlo.setBig(2,dom_lo.z-2); + Box bx_zhi(bx); bx_zhi.setSmall(2,dom_hi.z+1); + ParallelFor( + bx_zlo, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) + { + dest_arr(i,j,k,n) = dest_arr(i,j,dom_lo.z-1,n); + }, + bx_zhi, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) + { + dest_arr(i,j,k,n) = dest_arr(i,j,dom_hi.z,n); + } + ); +} diff --git a/Source/BoundaryConditions/ERF_BoundaryConditions_cons.cpp b/Source/BoundaryConditions/ERF_BoundaryConditions_cons.cpp index 1a2edbd1c..5932ee22b 100644 --- a/Source/BoundaryConditions/ERF_BoundaryConditions_cons.cpp +++ b/Source/BoundaryConditions/ERF_BoundaryConditions_cons.cpp @@ -261,7 +261,7 @@ void ERFPhysBCFunct_cons::impose_lateral_cons_bcs (const Array4& dest_arr, void ERFPhysBCFunct_cons::impose_vertical_cons_bcs (const Array4& dest_arr, const Box& bx, const Box& domain, const Array4& z_phys_nd, const GpuArray dxInv, - int icomp, int ncomp) + int icomp, int ncomp, bool do_terrain_adjustment) { BL_PROFILE_VAR("impose_vertical_cons_bcs()",impose_vertical_cons_bcs); const auto& dom_lo = lbound(domain); @@ -416,7 +416,7 @@ void ERFPhysBCFunct_cons::impose_vertical_cons_bcs (const Array4& dest_arr ); } - if (m_z_phys_nd) { + if (do_terrain_adjustment && m_z_phys_nd) { const auto& bx_lo = lbound(bx); const auto& bx_hi = ubound(bx); const BCRec* bc_ptr_h = bcrs.data(); diff --git a/Source/BoundaryConditions/ERF_BoundaryConditions_realbdy.cpp b/Source/BoundaryConditions/ERF_BoundaryConditions_realbdy.cpp index 5d6be8b7d..a665685bc 100644 --- a/Source/BoundaryConditions/ERF_BoundaryConditions_realbdy.cpp +++ b/Source/BoundaryConditions/ERF_BoundaryConditions_realbdy.cpp @@ -35,14 +35,13 @@ ERF::fill_from_realbdy (const Vector& mfs, Real oma = 1.0 - alpha; // Flags for read vars and index mapping - Vector cons_read = {0, 1, 0, - 0, 0, 1, - 0, 0, 0, - 0, 0}; - Vector cons_map = {Rho_comp, RealBdyVars::T, RhoKE_comp, - RhoQKE_comp, RhoScalar_comp, RealBdyVars::QV, - RhoQ2_comp, RhoQ3_comp, RhoQ4_comp, - RhoQ5_comp, RhoQ6_comp}; + Vector cons_read = {0, 1, 0, 0, + 1, 0, 0, + 0, 0, 0}; + + Vector cons_map = {Rho_comp, RealBdyVars::T, RhoKE_comp, RhoScalar_comp, + RealBdyVars::QV, RhoQ2_comp, RhoQ3_comp, + RhoQ4_comp, RhoQ5_comp, RhoQ6_comp}; Vector> is_read; is_read.push_back( cons_read ); diff --git a/Source/BoundaryConditions/ERF_FillCoarsePatch.cpp b/Source/BoundaryConditions/ERF_FillCoarsePatch.cpp index 9815d050a..fb900ea7d 100644 --- a/Source/BoundaryConditions/ERF_FillCoarsePatch.cpp +++ b/Source/BoundaryConditions/ERF_FillCoarsePatch.cpp @@ -29,11 +29,18 @@ ERF::FillCoarsePatch (int lev, Real time) //**************************************************************************************************************** // bool cons_only = false; - FillPatch(lev-1, time, {&vars_new[lev-1][Vars::cons], &vars_new[lev-1][Vars::xvel], - &vars_new[lev-1][Vars::yvel], &vars_new[lev-1][Vars::zvel]}, - {&vars_new[lev-1][Vars::cons], - &rU_new[lev-1], &rV_new[lev-1], &rW_new[lev-1]}, - false, cons_only); + if (lev == 1) { + FillPatch(lev-1, time, {&vars_new[lev-1][Vars::cons], &vars_new[lev-1][Vars::xvel], + &vars_new[lev-1][Vars::yvel], &vars_new[lev-1][Vars::zvel]}, + cons_only); + } else { + FillPatch(lev-1, time, {&vars_new[lev-1][Vars::cons], &vars_new[lev-1][Vars::xvel], + &vars_new[lev-1][Vars::yvel], &vars_new[lev-1][Vars::zvel]}, + {&vars_new[lev-1][Vars::cons], + &rU_new[lev-1], &rV_new[lev-1], &rW_new[lev-1]}, + base_state[lev-1], base_state[lev-1], + false, cons_only); + } // // ************************************************ diff --git a/Source/BoundaryConditions/ERF_FillIntermediatePatch.cpp b/Source/BoundaryConditions/ERF_FillIntermediatePatch.cpp index 99be97002..982040c74 100644 --- a/Source/BoundaryConditions/ERF_FillIntermediatePatch.cpp +++ b/Source/BoundaryConditions/ERF_FillIntermediatePatch.cpp @@ -61,28 +61,26 @@ ERF::FillIntermediatePatch (int lev, Real time, } } - AMREX_ALWAYS_ASSERT(mfs_mom.size() == IntVars::NumTypes); - AMREX_ALWAYS_ASSERT(mfs_vel.size() == Vars::NumTypes); + // amrex::Print() << "LEVEL " << lev << " CONS ONLY " << cons_only << + // " ICOMP NCOMP " << icomp_cons << " " << ncomp_cons << " NGHOST " << ng_cons << std::endl; - // Enforce no penetration for thin immersed body - if (xflux_imask[lev]) { - ApplyMask(*mfs_mom[IntVars::xmom], *xflux_imask[lev]); - } - if (yflux_imask[lev]) { - ApplyMask(*mfs_mom[IntVars::ymom], *yflux_imask[lev]); - } - if (zflux_imask[lev]) { - ApplyMask(*mfs_mom[IntVars::zmom], *zflux_imask[lev]); + if (!cons_only) { + AMREX_ALWAYS_ASSERT(mfs_mom.size() == IntVars::NumTypes); + AMREX_ALWAYS_ASSERT(mfs_vel.size() == Vars::NumTypes); } - // We always come in to this call with updated momenta but we need to create updated velocity - // in order to impose the rest of the bc's + // Enforce no penetration for thin immersed body if (!cons_only) { - // This only fills VALID region of velocity - MomentumToVelocity(*mfs_vel[Vars::xvel], *mfs_vel[Vars::yvel], *mfs_vel[Vars::zvel], - *mfs_vel[Vars::cons], - *mfs_mom[IntVars::xmom], *mfs_mom[IntVars::ymom], *mfs_mom[IntVars::zmom], - Geom(lev).Domain(), domain_bcs_type); + // Enforce no penetration for thin immersed body + if (xflux_imask[lev]) { + ApplyMask(*mfs_mom[IntVars::xmom], *xflux_imask[lev]); + } + if (yflux_imask[lev]) { + ApplyMask(*mfs_mom[IntVars::ymom], *yflux_imask[lev]); + } + if (zflux_imask[lev]) { + ApplyMask(*mfs_mom[IntVars::zmom], *zflux_imask[lev]); + } } // @@ -93,19 +91,80 @@ ERF::FillIntermediatePatch (int lev, Real time, // We don't do anything here because we will call the physbcs routines below, // which calls FillBoundary and fills other domain boundary conditions // Physical boundaries will be filled below + + if (!cons_only) + { + // *************************************************************************** + // We always come in to this call with updated momenta but we need to create updated velocity + // in order to impose the rest of the bc's + // *************************************************************************** + // This only fills VALID region of velocity + MomentumToVelocity(*mfs_vel[Vars::xvel], *mfs_vel[Vars::yvel], *mfs_vel[Vars::zvel], + *mfs_vel[Vars::cons], + *mfs_mom[IntVars::xmom], *mfs_mom[IntVars::ymom], *mfs_mom[IntVars::zmom], + Geom(lev).Domain(), domain_bcs_type); + } } else { - MultiFab& mf = *mfs_vel[Vars::cons]; - - Vector fmf = {&mf,&mf}; + // + // We must fill a temporary then copy it back so we don't double add/subtract + // + MultiFab mf(mfs_vel[Vars::cons]->boxArray(),mfs_vel[Vars::cons]->DistributionMap(), + mfs_vel[Vars::cons]->nComp() ,mfs_vel[Vars::cons]->nGrowVect()); + // + // Set all components to 1.789e19, then copy just the density from *mfs_vel[Vars::cons] + // + mf.setVal(1.789e19); + MultiFab::Copy(mf,*mfs_vel[Vars::cons],Rho_comp,Rho_comp,1,mf.nGrowVect()); + + Vector fmf = {mfs_vel[Vars::cons],mfs_vel[Vars::cons]}; Vector cmf = {&vars_old[lev-1][Vars::cons], &vars_new[lev-1][Vars::cons]}; Vector ctime = {t_old[lev-1], t_new[lev-1]}; Vector ftime = {time,time}; - // Impose physical bc's on coarse data (note time and 0 are not used) - (*physbcs_cons[lev-1])(vars_old[lev-1][Vars::cons],0,ncomp_cons,IntVect{ng_cons},time,BCVars::cons_bc,true); - (*physbcs_cons[lev-1])(vars_new[lev-1][Vars::cons],0,ncomp_cons,IntVect{ng_cons},time,BCVars::cons_bc,true); + // Impose physical bc's on fine data (note time and 0 are not used) + bool do_fb = true; bool do_terrain_adjustment = false; + (*physbcs_cons[lev])(*mfs_vel[Vars::cons],icomp_cons,ncomp_cons,IntVect{ng_cons},time,BCVars::cons_bc, + do_fb, do_terrain_adjustment); + + if ( (icomp_cons+ncomp_cons > 1) && (interpolation_type == StateInterpType::Perturbational) ) + { + // Divide (rho theta) by rho to get theta + MultiFab::Divide(*mfs_vel[Vars::cons],*mfs_vel[Vars::cons],Rho_comp,RhoTheta_comp,1,IntVect{0}); + + // Subtract theta_0 from theta + MultiFab::Subtract(*mfs_vel[Vars::cons],base_state[lev],BaseState::th0_comp,RhoTheta_comp,1,IntVect{0}); + + if (!amrex::almostEqual(time,ctime[1])) { + MultiFab::Divide(vars_old[lev-1][Vars::cons], vars_old[lev-1][Vars::cons], + Rho_comp,RhoTheta_comp,1,vars_old[lev-1][Vars::cons].nGrowVect()); + MultiFab::Subtract(vars_old[lev-1][Vars::cons], base_state[lev-1], + BaseState::th0_comp,RhoTheta_comp,1,vars_old[lev-1][Vars::cons].nGrowVect()); + } + if (!amrex::almostEqual(time,ctime[0])) { + MultiFab::Divide(vars_new[lev-1][Vars::cons], vars_new[lev-1][Vars::cons], + Rho_comp,RhoTheta_comp,1,vars_new[lev-1][Vars::cons].nGrowVect()); + MultiFab::Subtract(vars_new[lev-1][Vars::cons], base_state[lev-1], + BaseState::th0_comp,RhoTheta_comp,1,vars_new[lev-1][Vars::cons].nGrowVect()); + } + } + + // Subtract rho_0 from rho before we interpolate -- note we only subtract + // on valid region of mf since the ghost cells will be filled below + if (icomp_cons == 0 && (interpolation_type == StateInterpType::Perturbational)) + { + MultiFab::Subtract(*mfs_vel[Vars::cons],base_state[lev],BaseState::r0_comp,Rho_comp,1,IntVect{0}); + + if (!amrex::almostEqual(time,ctime[1])) { + MultiFab::Subtract(vars_old[lev-1][Vars::cons], base_state[lev-1], + BaseState::r0_comp,Rho_comp,1,vars_old[lev-1][Vars::cons].nGrowVect()); + } + if (!amrex::almostEqual(time,ctime[0])) { + MultiFab::Subtract(vars_new[lev-1][Vars::cons], base_state[lev-1], + BaseState::r0_comp,Rho_comp,1,vars_new[lev-1][Vars::cons].nGrowVect()); + } + } // Call FillPatchTwoLevels which ASSUMES that all ghost cells have already been filled mapper = &cell_cons_interp; @@ -115,10 +174,73 @@ ERF::FillIntermediatePatch (int lev, Real time, refRatio(lev-1), mapper, domain_bcs_type, icomp_cons); + if (icomp_cons == 0 && (interpolation_type == StateInterpType::Perturbational)) + { + // Restore the coarse values to what they were + if (!amrex::almostEqual(time,ctime[1])) { + MultiFab::Add(vars_old[lev-1][Vars::cons], base_state[lev-1], + BaseState::r0_comp,Rho_comp,1,vars_old[lev-1][Vars::cons].nGrowVect()); + } + if (!amrex::almostEqual(time,ctime[0])) { + MultiFab::Add(vars_new[lev-1][Vars::cons], base_state[lev-1], + BaseState::r0_comp,Rho_comp,1,vars_new[lev-1][Vars::cons].nGrowVect()); + } + + // Set values in the cells outside the domain boundary so that we can do the Add + // without worrying about uninitialized values outside the domain -- these + // will be filled in the physbcs call + mf.setDomainBndry(1.234e20,Rho_comp,1,geom[lev]); + + // Add rho_0 back to rho after we interpolate -- on all the valid + ghost region + MultiFab::Add(mf, base_state[lev],BaseState::r0_comp,Rho_comp,1,IntVect{ng_cons}); + } + + if ( (icomp_cons+ncomp_cons > 1) && (interpolation_type == StateInterpType::Perturbational) ) + { + // Add theta_0 to theta + if (!amrex::almostEqual(time,ctime[1])) { + MultiFab::Add(vars_old[lev-1][Vars::cons], base_state[lev-1], + BaseState::th0_comp,RhoTheta_comp,1,vars_old[lev-1][Vars::cons].nGrowVect()); + MultiFab::Multiply(vars_old[lev-1][Vars::cons], vars_old[lev-1][Vars::cons], + Rho_comp,RhoTheta_comp,1,vars_old[lev-1][Vars::cons].nGrowVect()); + } + if (!amrex::almostEqual(time,ctime[0])) { + MultiFab::Add(vars_new[lev-1][Vars::cons], base_state[lev-1], + BaseState::th0_comp,RhoTheta_comp,1,vars_new[lev-1][Vars::cons].nGrowVect()); + MultiFab::Multiply(vars_new[lev-1][Vars::cons], vars_new[lev-1][Vars::cons], + Rho_comp,RhoTheta_comp,1,vars_new[lev-1][Vars::cons].nGrowVect()); + } + + // Multiply theta by rho to get (rho theta) + MultiFab::Multiply(*mfs_vel[Vars::cons],*mfs_vel[Vars::cons],Rho_comp,RhoTheta_comp,1,IntVect{0}); + + // Add theta_0 to theta + MultiFab::Add(*mfs_vel[Vars::cons],base_state[lev],BaseState::th0_comp,RhoTheta_comp,1,IntVect{0}); + + // Add theta_0 back to theta + MultiFab::Add(mf,base_state[lev],BaseState::th0_comp,RhoTheta_comp,1,IntVect{ng_cons}); + + // Multiply (theta) by rho to get (rho theta) + MultiFab::Multiply(mf,mf,Rho_comp,RhoTheta_comp,1,IntVect{ng_cons}); + } + + // Make sure to only copy back the components we worked on + MultiFab::Copy(*mfs_vel[Vars::cons],mf,icomp_cons,icomp_cons,ncomp_cons,IntVect{ng_cons}); + // ***************************************************************************************** if (!cons_only) { + // *************************************************************************** + // We always come in to this call with updated momenta but we need to create updated velocity + // in order to impose the rest of the bc's + // *************************************************************************** + // This only fills VALID region of velocity + MomentumToVelocity(*mfs_vel[Vars::xvel], *mfs_vel[Vars::yvel], *mfs_vel[Vars::zvel], + *mfs_vel[Vars::cons], + *mfs_mom[IntVars::xmom], *mfs_mom[IntVars::ymom], *mfs_mom[IntVars::zmom], + Geom(lev).Domain(), domain_bcs_type); + mapper = &face_cons_linear_interp; // @@ -135,10 +257,6 @@ ERF::FillIntermediatePatch (int lev, Real time, fmf = {&mfu,&mfu}; cmf = {&vars_old[lev-1][Vars::xvel], &vars_new[lev-1][Vars::xvel]}; - // Impose physical bc's on coarse data (note time and 0 are not used) - (*physbcs_u[lev-1])(vars_old[lev-1][Vars::xvel],0,1,IntVect{ng_vel},time,BCVars::xvel_bc,true); - (*physbcs_u[lev-1])(vars_new[lev-1][Vars::xvel],0,1,IntVect{ng_vel},time,BCVars::xvel_bc,true); - // Call FillPatchTwoLevels which ASSUMES that all ghost cells have already been filled FillPatchTwoLevels(mfu, IntVect{ng_vel}, IntVect(0,0,0), time, cmf, ctime, fmf, ftime, @@ -153,10 +271,6 @@ ERF::FillIntermediatePatch (int lev, Real time, fmf = {&mfv,&mfv}; cmf = {&vars_old[lev-1][Vars::yvel], &vars_new[lev-1][Vars::yvel]}; - // Impose physical bc's on coarse data (note time and 0 are not used) - (*physbcs_v[lev-1])(vars_old[lev-1][Vars::yvel],0,1,IntVect{ng_vel},time,BCVars::yvel_bc,true); - (*physbcs_v[lev-1])(vars_new[lev-1][Vars::yvel],0,1,IntVect{ng_vel},time,BCVars::yvel_bc,true); - // Call FillPatchTwoLevels which ASSUMES that all ghost cells have already been filled FillPatchTwoLevels(mfv, IntVect{ng_vel}, IntVect(0,0,0), time, cmf, ctime, fmf, ftime, @@ -171,16 +285,6 @@ ERF::FillIntermediatePatch (int lev, Real time, fmf = {&mfw,&mfw}; cmf = {&vars_old[lev-1][Vars::zvel], &vars_new[lev-1][Vars::zvel]}; - // Impose physical bc's on coarse data (note time and 0 are not used) - (*physbcs_w[lev-1])(vars_old[lev-1][Vars::zvel], - vars_old[lev-1][Vars::xvel], - vars_old[lev-1][Vars::yvel], - IntVect{ng_vel},time,BCVars::zvel_bc,true); - (*physbcs_w[lev-1])(vars_new[lev-1][Vars::zvel], - vars_new[lev-1][Vars::xvel], - vars_new[lev-1][Vars::yvel], - IntVect{ng_vel},time,BCVars::zvel_bc,true); - // Call FillPatchTwoLevels which ASSUMES that all ghost cells have already been filled FillPatchTwoLevels(mfw, IntVect{ng_vel}, IntVect(0,0,0), time, cmf, ctime, fmf, ftime, @@ -201,7 +305,7 @@ ERF::FillIntermediatePatch (int lev, Real time, #ifdef ERF_USE_NETCDF // We call this here because it is an ERF routine if (use_real_bcs && (lev==0)) { - fill_from_realbdy(mfs_vel,time,cons_only,icomp_cons,ncomp_cons,ngvect_cons, ngvect_vels); + fill_from_realbdy(mfs_vel,time,cons_only,icomp_cons,ncomp_cons,ngvect_cons,ngvect_vels); do_fb = false; } #endif diff --git a/Source/BoundaryConditions/ERF_FillPatch.cpp b/Source/BoundaryConditions/ERF_FillPatch.cpp index 03f272b55..5913f110b 100644 --- a/Source/BoundaryConditions/ERF_FillPatch.cpp +++ b/Source/BoundaryConditions/ERF_FillPatch.cpp @@ -20,11 +20,15 @@ void ERF::FillPatch (int lev, Real time, const Vector& mfs_vel, // This includes cc quantities and VELOCITIES const Vector& mfs_mom, // This includes cc quantities and MOMENTA + const MultiFab& old_base_state, + const MultiFab& new_base_state, bool fillset, bool cons_only) { BL_PROFILE_VAR("ERF::FillPatch()",ERF_FillPatch); Interpolater* mapper = nullptr; + AMREX_ALWAYS_ASSERT(lev > 0); + PhysBCFunctNoOp null_bc; // @@ -38,7 +42,7 @@ ERF::FillPatch (int lev, Real time, // conditions are imposed on velocity, so we convert to momentum here then // convert back. // *************************************************************************** - if (lev>0 && fillset) { + if (fillset) { if (cf_set_width > 0) { FPr_c[lev-1].FillSet(*mfs_vel[Vars::cons], time, null_bc, domain_bcs_type); } @@ -70,48 +74,56 @@ ERF::FillPatch (int lev, Real time, IntVect ngvect_cons = mfs_vel[Vars::cons]->nGrowVect(); IntVect ngvect_vels = mfs_vel[Vars::xvel]->nGrowVect(); - if (lev == 0) { Vector ftime = {t_old[lev], t_new[lev]}; - - // - // Below we call FillPatchSingleLevel which does NOT fill ghost cells outside the domain - // - - Vector fmf = {&vars_old[lev][Vars::cons], &vars_new[lev][Vars::cons]}; - const int ncomp = mfs_vel[Vars::cons]->nComp(); - - FillPatchSingleLevel(*mfs_vel[Vars::cons], ngvect_cons, time, fmf, IntVect(0,0,0), ftime, - 0, 0, ncomp, geom[lev]); - - if (!cons_only) { - fmf = {&vars_old[lev][Vars::xvel], &vars_new[lev][Vars::xvel]}; - FillPatchSingleLevel(*mfs_vel[Vars::xvel], ngvect_vels, time, fmf, - IntVect(0,0,0), ftime, 0, 0, 1, geom[lev]); - - fmf = {&vars_old[lev][Vars::yvel], &vars_new[lev][Vars::yvel]}; - FillPatchSingleLevel(*mfs_vel[Vars::yvel], ngvect_vels, time, fmf, - IntVect(0,0,0), ftime, 0, 0, 1, geom[lev]); - - fmf = {&vars_old[lev][Vars::zvel], &vars_new[lev][Vars::zvel]}; - FillPatchSingleLevel(*mfs_vel[Vars::zvel], ngvect_vels, time, fmf, - IntVect(0,0,0), ftime, 0, 0, 1, geom[lev]); - } // !cons_only - - } else { - - Vector ftime = {t_old[lev], t_new[lev]}; Vector ctime = {t_old[lev-1], t_new[lev-1]}; Vector fmf = {&vars_old[lev ][Vars::cons], &vars_new[lev ][Vars::cons]}; Vector cmf = {&vars_old[lev-1][Vars::cons], &vars_new[lev-1][Vars::cons]}; - MultiFab& mf_c = *mfs_vel[Vars::cons]; + + // We must fill a temporary then copy it back so we don't double add/subtract + MultiFab mf_c(mfs_vel[Vars::cons]->boxArray(),mfs_vel[Vars::cons]->DistributionMap(), + mfs_vel[Vars::cons]->nComp() ,mfs_vel[Vars::cons]->nGrowVect()); + mapper = &cell_cons_interp; - // Impose physical bc's on coarse data (note time and 0 are not used) - // Note that we call FillBoundary inside the physbcs call - // We should not need to call this on old data since that would have been filled before the timestep started - (*physbcs_cons[lev-1])(vars_new[lev-1][Vars::cons],0,mf_c.nComp(),ngvect_cons,time,BCVars::cons_bc,true); + if (interpolation_type == StateInterpType::Perturbational) + { + // Divide (rho theta) by rho to get theta (before we subtract rho0 from rho!) + if (!amrex::almostEqual(time,ctime[1])) { + MultiFab::Divide(vars_old[lev-1][Vars::cons],vars_old[lev-1][Vars::cons], + Rho_comp,RhoTheta_comp,1,ngvect_cons); + MultiFab::Subtract(vars_old[lev-1][Vars::cons],base_state[lev-1], + BaseState::r0_comp,Rho_comp,1,ngvect_cons); + MultiFab::Subtract(vars_old[lev-1][Vars::cons],base_state[lev-1], + BaseState::th0_comp,RhoTheta_comp,1,ngvect_cons); + } + if (!amrex::almostEqual(time,ctime[0])) { + MultiFab::Divide(vars_new[lev-1][Vars::cons],vars_new[lev-1][Vars::cons], + Rho_comp,RhoTheta_comp,1,ngvect_cons); + MultiFab::Subtract(vars_new[lev-1][Vars::cons],base_state[lev-1], + BaseState::r0_comp,Rho_comp,1,ngvect_cons); + MultiFab::Subtract(vars_new[lev-1][Vars::cons],base_state[lev-1], + BaseState::th0_comp,RhoTheta_comp,1,ngvect_cons); + } + + if (!amrex::almostEqual(time,ftime[1])) { + MultiFab::Divide(vars_old[lev ][Vars::cons],vars_old[lev ][Vars::cons], + Rho_comp,RhoTheta_comp,1,IntVect{0}); + MultiFab::Subtract(vars_old[lev ][Vars::cons],old_base_state, + BaseState::r0_comp,Rho_comp,1,IntVect{0}); + MultiFab::Subtract(vars_old[lev ][Vars::cons],old_base_state, + BaseState::th0_comp,RhoTheta_comp,1,IntVect{0}); + } + if (!amrex::almostEqual(time,ftime[0])) { + MultiFab::Divide(vars_new[lev ][Vars::cons],vars_new[lev ][Vars::cons], + Rho_comp,RhoTheta_comp,1,IntVect{0}); + MultiFab::Subtract(vars_new[lev ][Vars::cons],old_base_state, + BaseState::r0_comp,Rho_comp,1,IntVect{0}); + MultiFab::Subtract(vars_new[lev ][Vars::cons],old_base_state, + BaseState::th0_comp,RhoTheta_comp,1,IntVect{0}); + } + } // Call FillPatchTwoLevels which ASSUMES that all ghost cells have already been filled FillPatchTwoLevels(mf_c, ngvect_cons, IntVect(0,0,0), @@ -120,6 +132,56 @@ ERF::FillPatch (int lev, Real time, refRatio(lev-1), mapper, domain_bcs_type, BCVars::cons_bc); + if (interpolation_type == StateInterpType::Perturbational) + { + // Restore the coarse values to what they were + if (!amrex::almostEqual(time,ctime[1])) { + MultiFab::Add(vars_old[lev-1][Vars::cons], base_state[lev-1], + BaseState::r0_comp,Rho_comp,1,ngvect_cons); + MultiFab::Add(vars_old[lev-1][Vars::cons], base_state[lev-1], + BaseState::th0_comp,RhoTheta_comp,1,ngvect_cons); + MultiFab::Multiply(vars_old[lev-1][Vars::cons], vars_old[lev-1][Vars::cons], + Rho_comp,RhoTheta_comp,1,ngvect_cons); + } + if (!amrex::almostEqual(time,ctime[0])) { + MultiFab::Add(vars_new[lev-1][Vars::cons], base_state[lev-1], + BaseState::r0_comp,Rho_comp,1,vars_new[lev-1][Vars::cons].nGrowVect()); + MultiFab::Add(vars_new[lev-1][Vars::cons], base_state[lev-1], + BaseState::th0_comp,RhoTheta_comp,1,vars_new[lev-1][Vars::cons].nGrowVect()); + MultiFab::Multiply(vars_new[lev-1][Vars::cons], vars_new[lev-1][Vars::cons], + Rho_comp,RhoTheta_comp,1,ngvect_cons); + } + + if (!amrex::almostEqual(time,ftime[1])) { + MultiFab::Add(vars_old[lev][Vars::cons],base_state[lev ],BaseState::r0_comp,Rho_comp,1,ngvect_cons); + MultiFab::Add(vars_old[lev][Vars::cons],base_state[lev ],BaseState::th0_comp,RhoTheta_comp,1,ngvect_cons); + MultiFab::Multiply(vars_old[lev][Vars::cons], vars_old[lev][Vars::cons], + Rho_comp,RhoTheta_comp,1,ngvect_cons); + } + if (!amrex::almostEqual(time,ftime[0])) { + MultiFab::Add(vars_new[lev][Vars::cons], base_state[lev],BaseState::r0_comp,Rho_comp,1,ngvect_cons); + MultiFab::Add(vars_new[lev][Vars::cons], base_state[lev],BaseState::th0_comp,RhoTheta_comp,1,ngvect_cons); + MultiFab::Multiply(vars_new[lev][Vars::cons], vars_new[lev][Vars::cons], + Rho_comp,RhoTheta_comp,1,ngvect_cons); + } + + // Set values in the cells outside the domain boundary so that we can do the Add + // without worrying about uninitialized values outside the domain -- these + // will be filled in the physbcs call + mf_c.setDomainBndry(1.234e20,0,2,geom[lev]); // Do both rho and (rho theta) together + + // Add rho_0 back to rho and theta_0 back to theta + MultiFab::Add(mf_c, new_base_state,BaseState::r0_comp,Rho_comp,1,ngvect_cons); + MultiFab::Add(mf_c, new_base_state,BaseState::th0_comp,RhoTheta_comp,1,ngvect_cons); + + // Multiply (theta) by rho to get (rho theta) + MultiFab::Multiply(mf_c,mf_c,Rho_comp,RhoTheta_comp,1,ngvect_cons); + } + + MultiFab::Copy(*mfs_vel[Vars::cons],mf_c,0,0,mf_c.nComp(),mf_c.nGrowVect()); + + // *************************************************************************************** + if (!cons_only) { mapper = &face_cons_linear_interp; @@ -130,13 +192,6 @@ ERF::FillPatch (int lev, Real time, // ********************************************************************** - cmf = {&vars_old[lev-1][Vars::xvel], &vars_new[lev-1][Vars::xvel]}; - - // Impose physical bc's on coarse data (note time and 0 are not used) - // Note that we call FillBoundary inside the physbcs call - // We should not need to call this on old data since that would have been filled before the timestep started - (*physbcs_u[lev-1])(vars_new[lev-1][Vars::xvel],0,1,ngvect_vels,time,BCVars::xvel_bc,true); - fmf = {&vars_old[lev ][Vars::xvel], &vars_new[lev ][Vars::xvel]}; cmf = {&vars_old[lev-1][Vars::xvel], &vars_new[lev-1][Vars::xvel]}; @@ -149,13 +204,6 @@ ERF::FillPatch (int lev, Real time, // ********************************************************************** - cmf = {&vars_old[lev-1][Vars::yvel], &vars_new[lev-1][Vars::yvel]}; - - // Impose physical bc's on coarse data (note time and 0 are not used) - // Note that we call FillBoundary inside the physbcs call - // We should not need to call this on old data since that would have been filled before the timestep started - (*physbcs_v[lev-1])(vars_new[lev-1][Vars::yvel],0,1,ngvect_vels,time,BCVars::yvel_bc,true); - fmf = {&vars_old[lev ][Vars::yvel], &vars_new[lev ][Vars::yvel]}; cmf = {&vars_old[lev-1][Vars::yvel], &vars_new[lev-1][Vars::yvel]}; @@ -168,16 +216,6 @@ ERF::FillPatch (int lev, Real time, // ********************************************************************** - cmf = {&vars_old[lev-1][Vars::zvel], &vars_new[lev-1][Vars::zvel]}; - - // Impose physical bc's on coarse data (note time and 0 are not used) - // Note that we call FillBoundary inside the physbcs call - // We should not need to call this on old data since that would have been filled before the timestep started - (*physbcs_w[lev-1])(vars_new[lev-1][Vars::zvel], - vars_new[lev-1][Vars::xvel], - vars_new[lev-1][Vars::yvel], - ngvect_vels,time,BCVars::zvel_bc,true); - fmf = {&vars_old[lev ][Vars::zvel], &vars_new[lev ][Vars::zvel]}; cmf = {&vars_old[lev-1][Vars::zvel], &vars_new[lev-1][Vars::zvel]}; @@ -198,6 +236,65 @@ ERF::FillPatch (int lev, Real time, bool do_fb = true; + if (m_r2d) fill_from_bndryregs(mfs_vel,time); + + // We call these even if init_type == InitType::Real because these will fill the vertical bcs + // Note that we call FillBoundary inside the physbcs call + (*physbcs_cons[lev])(*mfs_vel[Vars::cons],icomp_cons,ncomp_cons,ngvect_cons,time,BCVars::cons_bc, do_fb); + if (!cons_only) { + (*physbcs_u[lev])(*mfs_vel[Vars::xvel],0,1,ngvect_vels,time,BCVars::xvel_bc, do_fb); + (*physbcs_v[lev])(*mfs_vel[Vars::yvel],0,1,ngvect_vels,time,BCVars::yvel_bc, do_fb); + (*physbcs_w[lev])(*mfs_vel[Vars::zvel],*mfs_vel[Vars::xvel],*mfs_vel[Vars::yvel], + ngvect_vels,time,BCVars::zvel_bc, do_fb); + } +} + +void +ERF::FillPatch (int lev, Real time, + const Vector& mfs_vel, // This includes cc quantities and VELOCITIES + bool cons_only) +{ + BL_PROFILE_VAR("ERF::FillPatch()",ERF_FillPatch); + + AMREX_ALWAYS_ASSERT(lev == 0); + + IntVect ngvect_cons = mfs_vel[Vars::cons]->nGrowVect(); + IntVect ngvect_vels = mfs_vel[Vars::xvel]->nGrowVect(); + + Vector ftime = {t_old[lev], t_new[lev]}; + + // + // Below we call FillPatchSingleLevel which does NOT fill ghost cells outside the domain + // + + Vector fmf = {&vars_old[lev][Vars::cons], &vars_new[lev][Vars::cons]}; + const int ncomp = mfs_vel[Vars::cons]->nComp(); + + FillPatchSingleLevel(*mfs_vel[Vars::cons], ngvect_cons, time, fmf, IntVect(0,0,0), ftime, + 0, 0, ncomp, geom[lev]); + + if (!cons_only) { + fmf = {&vars_old[lev][Vars::xvel], &vars_new[lev][Vars::xvel]}; + FillPatchSingleLevel(*mfs_vel[Vars::xvel], ngvect_vels, time, fmf, + IntVect(0,0,0), ftime, 0, 0, 1, geom[lev]); + + fmf = {&vars_old[lev][Vars::yvel], &vars_new[lev][Vars::yvel]}; + FillPatchSingleLevel(*mfs_vel[Vars::yvel], ngvect_vels, time, fmf, + IntVect(0,0,0), ftime, 0, 0, 1, geom[lev]); + + fmf = {&vars_old[lev][Vars::zvel], &vars_new[lev][Vars::zvel]}; + FillPatchSingleLevel(*mfs_vel[Vars::zvel], ngvect_vels, time, fmf, + IntVect(0,0,0), ftime, 0, 0, 1, geom[lev]); + } // !cons_only + + // *************************************************************************** + // Physical bc's at domain boundary + // *************************************************************************** + int icomp_cons = 0; + int ncomp_cons = mfs_vel[Vars::cons]->nComp(); + + bool do_fb = true; + #ifdef ERF_USE_NETCDF // We call this here because it is an ERF routine if (use_real_bcs && (lev==0)) { diff --git a/Source/BoundaryConditions/ERF_PhysBCFunct.H b/Source/BoundaryConditions/ERF_PhysBCFunct.H index d74a9834e..6e201adb9 100644 --- a/Source/BoundaryConditions/ERF_PhysBCFunct.H +++ b/Source/BoundaryConditions/ERF_PhysBCFunct.H @@ -53,7 +53,7 @@ public: */ void operator() (amrex::MultiFab& mf, int icomp, int ncomp, amrex::IntVect const& nghost, const amrex::Real time, int bccomp_cons, - bool do_fb); + bool do_fb = true, bool do_terrain_adjustment = true); void impose_lateral_cons_bcs (const amrex::Array4& dest_arr, const amrex::Box& bx, const amrex::Box& domain, @@ -62,7 +62,7 @@ public: const amrex::Box& bx, const amrex::Box& domain, const amrex::Array4& z_nd, const amrex::GpuArray dxInv, - int icomp, int ncomp); + int icomp, int ncomp, bool do_terrain_adjustment = true); private: int m_lev; @@ -262,8 +262,10 @@ class ERFPhysBCFunct_base public: ERFPhysBCFunct_base (const int lev, const amrex::Geometry& geom, const amrex::Vector& domain_bcs_type, - const amrex::Gpu::DeviceVector& domain_bcs_type_d) + const amrex::Gpu::DeviceVector& domain_bcs_type_d, + bool moving_terrain) : m_lev(lev), m_geom(geom), + m_moving_terrain(moving_terrain), m_domain_bcs_type(domain_bcs_type), m_domain_bcs_type_d(domain_bcs_type_d) {} @@ -279,15 +281,19 @@ public: * @param[in] nghost number of ghost cells to be filled for conserved variables * @param[in] time time at which the data should be filled */ - void operator() (amrex::MultiFab& mf, int icomp, int ncomp, - amrex::IntVect const& nghost, const amrex::Real time, int bccomp_cons); + void operator() (amrex::MultiFab& mf, int icomp, int ncomp, amrex::IntVect const& nghost); void impose_lateral_basestate_bcs (const amrex::Array4& dest_arr, - const amrex::Box& bx, const amrex::Box& domain); + const amrex::Box& bx, const amrex::Box& domain, + int ncomp, const amrex::IntVect& nghost); + void impose_vertical_basestate_bcs (const amrex::Array4& dest_arr, + const amrex::Box& bx, const amrex::Box& domain, + int ncomp, const amrex::IntVect& nghost); private: int m_lev; amrex::Geometry m_geom; + bool m_moving_terrain; amrex::Vector m_domain_bcs_type; amrex::Gpu::DeviceVector m_domain_bcs_type_d; }; diff --git a/Source/BoundaryConditions/ERF_PhysBCFunct.cpp b/Source/BoundaryConditions/ERF_PhysBCFunct.cpp index 5ab47fb88..49714b383 100644 --- a/Source/BoundaryConditions/ERF_PhysBCFunct.cpp +++ b/Source/BoundaryConditions/ERF_PhysBCFunct.cpp @@ -15,7 +15,7 @@ using namespace amrex; void ERFPhysBCFunct_cons::operator() (MultiFab& mf, int icomp, int ncomp, IntVect const& nghost, const Real /*time*/, int /*bccomp*/, - bool do_fb) + bool do_fb, bool do_terrain_adjustment) { BL_PROFILE("ERFPhysBCFunct_cons::()"); @@ -32,21 +32,6 @@ void ERFPhysBCFunct_cons::operator() (MultiFab& mf, int icomp, int ncomp, } } - MultiFab z_nd_mf_loc; - if (m_z_phys_nd) { - m_z_phys_nd->FillBoundary(m_geom.periodicity()); - BoxList bl_z_phys = convert(mf.boxArray(),IntVect(1,1,1)).boxList(); - for (auto& b : bl_z_phys) { - b.setSmall(2,0); - b.setBig(2,1); - } - BoxArray ba_z(std::move(bl_z_phys)); - - z_nd_mf_loc.define(ba_z,mf.DistributionMap(),1,IntVect(nghost[0],nghost[1],0)); - z_nd_mf_loc.ParallelCopy(*m_z_phys_nd,0,0,1,m_z_phys_nd->nGrowVect(), - z_nd_mf_loc.nGrowVect()); - } - // // We fill all of the interior and periodic ghost cells first, so we can fill // those directly inside the lateral and vertical calls. @@ -77,7 +62,7 @@ void ERFPhysBCFunct_cons::operator() (MultiFab& mf, int icomp, int ncomp, if (m_z_phys_nd) { - z_nd_arr = z_nd_mf_loc.const_array(mfi); + z_nd_arr = m_z_phys_nd->const_array(mfi); } if (!gdomain.contains(cbx2)) @@ -91,7 +76,7 @@ void ERFPhysBCFunct_cons::operator() (MultiFab& mf, int icomp, int ncomp, } // We send the full FAB box with ghost cells - impose_vertical_cons_bcs(cons_arr,cbx2,domain,z_nd_arr,dxInv,icomp,ncomp); + impose_vertical_cons_bcs(cons_arr,cbx2,domain,z_nd_arr,dxInv,icomp,ncomp,do_terrain_adjustment); } } // MFIter @@ -116,20 +101,6 @@ void ERFPhysBCFunct_u::operator() (MultiFab& mf, int /*icomp*/, int /*ncomp*/, } } - MultiFab z_nd_mf_loc; - if (m_z_phys_nd) { - m_z_phys_nd->FillBoundary(m_geom.periodicity()); - BoxList bl_z_phys = convert(mf.boxArray(),IntVect(1,1,1)).boxList(); - for (auto& b : bl_z_phys) { - b.setSmall(2,0); - b.setBig(2,1); - } - BoxArray ba_z(std::move(bl_z_phys)); - z_nd_mf_loc.define(ba_z,mf.DistributionMap(),1,IntVect(nghost[0]+1,nghost[1],0)); - z_nd_mf_loc.ParallelCopy(*m_z_phys_nd,0,0,1,m_z_phys_nd->nGrowVect(), - z_nd_mf_loc.nGrowVect()); - } - // // We fill all of the interior and periodic ghost cells first, so we can fill // those directly inside the lateral and vertical calls. @@ -163,7 +134,7 @@ void ERFPhysBCFunct_u::operator() (MultiFab& mf, int /*icomp*/, int /*ncomp*/, if (m_z_phys_nd) { - z_nd_arr = z_nd_mf_loc.const_array(mfi); + z_nd_arr = m_z_phys_nd->const_array(mfi); } if (!gdomainx.contains(xbx2)) @@ -202,20 +173,6 @@ void ERFPhysBCFunct_v::operator() (MultiFab& mf, int /*icomp*/, int /*ncomp*/, } } - MultiFab z_nd_mf_loc; - if (m_z_phys_nd) { - m_z_phys_nd->FillBoundary(m_geom.periodicity()); - BoxList bl_z_phys = convert(mf.boxArray(),IntVect(1,1,1)).boxList(); - for (auto& b : bl_z_phys) { - b.setSmall(2,0); - b.setBig(2,1); - } - BoxArray ba_z(std::move(bl_z_phys)); - z_nd_mf_loc.define(ba_z,mf.DistributionMap(),1,IntVect(nghost[0],nghost[1]+1,0)); - z_nd_mf_loc.ParallelCopy(*m_z_phys_nd,0,0,1,m_z_phys_nd->nGrowVect(), - z_nd_mf_loc.nGrowVect()); - } - // // We fill all of the interior and periodic ghost cells first, so we can fill // those directly inside the lateral and vertical calls. @@ -249,7 +206,7 @@ void ERFPhysBCFunct_v::operator() (MultiFab& mf, int /*icomp*/, int /*ncomp*/, if (m_z_phys_nd) { - z_nd_arr = z_nd_mf_loc.const_array(mfi); + z_nd_arr = m_z_phys_nd->const_array(mfi); } if (!gdomainy.contains(ybx2)) @@ -293,21 +250,6 @@ void ERFPhysBCFunct_w::operator() (MultiFab& mf, MultiFab& xvel, MultiFab& yvel, // if (gdomainz.smallEnd(2) == 0) gdomainz.setSmall(2,1); - Box ndomain = convert(domain,IntVect(1,1,1)); - - MultiFab z_nd_mf_loc; - if (m_z_phys_nd) { - BoxList bl_z_phys = convert(mf.boxArray(),IntVect(1,1,1)).boxList(); - for (auto& b : bl_z_phys) { - b &= ndomain; - } - BoxArray ba_z(std::move(bl_z_phys)); - z_nd_mf_loc.define(ba_z,mf.DistributionMap(),1,IntVect(nghost[0],nghost[1],0)); - z_nd_mf_loc.ParallelCopy(*m_z_phys_nd,0,0,1,m_z_phys_nd->nGrowVect(), - z_nd_mf_loc.nGrowVect()); - } - z_nd_mf_loc.FillBoundary(m_geom.periodicity()); - // // We fill all of the interior and periodic ghost cells first, so we can fill // those directly inside the lateral and vertical calls. @@ -339,7 +281,7 @@ void ERFPhysBCFunct_w::operator() (MultiFab& mf, MultiFab& xvel, MultiFab& yvel, if (m_z_phys_nd) { - z_nd_arr = z_nd_mf_loc.const_array(mfi); + z_nd_arr = m_z_phys_nd->const_array(mfi); } // @@ -366,13 +308,17 @@ void ERFPhysBCFunct_w::operator() (MultiFab& mf, MultiFab& xvel, MultiFab& yvel, } // OpenMP } // operator() -void ERFPhysBCFunct_base::operator() (MultiFab& mf, int /*icomp*/, int /*ncomp*/, - IntVect const& nghost, const Real /*time*/, int /*bccomp*/) +void ERFPhysBCFunct_base::operator() (MultiFab& mf, int /*icomp*/, int ncomp, IntVect const& nghost) { BL_PROFILE("ERFPhysBCFunct_base::()"); if (m_geom.isAllPeriodic()) return; + if (m_moving_terrain) { + mf.FillBoundary(m_geom.periodicity()); + return; + } + const auto& domain = m_geom.Domain(); // Create a grown domain box containing valid + periodic cells @@ -383,6 +329,12 @@ void ERFPhysBCFunct_base::operator() (MultiFab& mf, int /*icomp*/, int /*ncomp*/ } } + // + // We fill all of the interior and periodic ghost cells first, so we can fill + // those directly inside the lateral and vertical calls. + // + mf.FillBoundary(m_geom.periodicity()); + #ifdef AMREX_USE_OMP #pragma omp parallel if (Gpu::notInLaunchRegion()) #endif @@ -403,9 +355,10 @@ void ERFPhysBCFunct_base::operator() (MultiFab& mf, int /*icomp*/, int /*ncomp*/ if (!gdomain.contains(cbx2)) { - const Array4 cons_arr = mf.array(mfi); + const Array4 base_arr = mf.array(mfi); - impose_lateral_basestate_bcs(cons_arr,cbx1,domain); + impose_lateral_basestate_bcs(base_arr,cbx1,domain,ncomp,nghost); + impose_vertical_basestate_bcs(base_arr,cbx2,domain,ncomp,nghost); } } // MFIter diff --git a/Source/DataStructs/ERF_DataStruct.H b/Source/DataStructs/ERF_DataStruct.H index 645b5c7a5..0eff71724 100644 --- a/Source/DataStructs/ERF_DataStruct.H +++ b/Source/DataStructs/ERF_DataStruct.H @@ -339,7 +339,7 @@ struct SolverChoice { // Which type of multilevel coupling - coupling_type = CouplingType::OneWay; // Default + coupling_type = CouplingType::TwoWay; // Default pp.query_enum_case_insensitive("coupling_type",coupling_type); // Which type of windfarm model diff --git a/Source/DataStructs/ERF_TurbStruct.H b/Source/DataStructs/ERF_TurbStruct.H index a8a10f72a..d649d61e7 100644 --- a/Source/DataStructs/ERF_TurbStruct.H +++ b/Source/DataStructs/ERF_TurbStruct.H @@ -78,9 +78,9 @@ struct TurbChoice { // Right now, solving the QKE equation is only supported when MYNN PBL is turned on if (pbl_type == PBLType::MYNN25) { - use_QKE = true; - query_one_or_per_level(pp, "advect_QKE" , advect_QKE, lev, max_level); - query_one_or_per_level(pp, "diffuse_QKE_3D", diffuse_QKE_3D, lev, max_level); + use_KE = true; + query_one_or_per_level(pp, "advect_KE" , advect_KE, lev, max_level); + query_one_or_per_level(pp, "diffuse_KE_3D", diffuse_KE_3D, lev, max_level); } // LES constants... @@ -202,9 +202,9 @@ struct TurbChoice { amrex::Real pbl_ysu_land_Ribcr = 0.25; // Critical Bulk Richardson number of Land for stable conditions amrex::Real pbl_ysu_unst_Ribcr = 0.0; // Critical Bulk Richardson number for unstable conditions - // QKE stuff - default is not to use it, if MYNN2.5 PBL is used default is turb transport in Z-direction only - bool use_QKE = false; - bool diffuse_QKE_3D = false; - bool advect_QKE = true; + // QKE stuff - default is to use it, if MYNN2.5 PBL is used default is turb transport in Z-direction only + bool use_KE = true; + bool diffuse_KE_3D = true; + bool advect_KE = true; }; #endif diff --git a/Source/Diffusion/ERF_ComputeTurbulentViscosity.cpp b/Source/Diffusion/ERF_ComputeTurbulentViscosity.cpp index 5e9bc6e5c..9e23f43d4 100644 --- a/Source/Diffusion/ERF_ComputeTurbulentViscosity.cpp +++ b/Source/Diffusion/ERF_ComputeTurbulentViscosity.cpp @@ -207,6 +207,8 @@ void ComputeTurbulentViscosityLES (const MultiFab& Tau11, const MultiFab& Tau22, mu_turb(i,j,k,EddyDiff::Mom_v) = mu_turb(i,j,k,EddyDiff::Mom_h); // KH = (1 + 2*l/delta) * mu_turb mu_turb(i,j,k,EddyDiff::Theta_v) = (1.+2.*length/DeltaMsf) * mu_turb(i,j,k,EddyDiff::Mom_v); + // Store lengthscale for TKE source terms + mu_turb(i,j,k,EddyDiff::Turb_lengthscale) = length; // Calculate SFS quantities // - dissipation @@ -217,6 +219,7 @@ void ComputeTurbulentViscosityLES (const MultiFab& Tau11, const MultiFab& Tau22, Ce = 1.9*l_C_k + Ce_lcoeff*length / DeltaMsf; } diss(i,j,k) = cell_data(i,j,k,Rho_comp) * Ce * std::pow(E,1.5) / length; + // - heat flux // (Note: If using ERF_EXPLICIT_MOST_STRESS, the value at k=0 will // be overwritten when BCs are applied) @@ -230,14 +233,14 @@ void ComputeTurbulentViscosityLES (const MultiFab& Tau11, const MultiFab& Tau22, // Extrapolate Kturb in x/y, fill remaining elements (relevant to lev==0) //*********************************************************************************** int ngc(1); - // EddyDiff mapping : Theta_h KE_h QKE_h Scalar_h Q_h - Vector Factors = {inv_Pr_t, inv_sigma_k, inv_sigma_k, inv_Sc_t, inv_Sc_t}; // alpha = mu/Pr + // EddyDiff mapping : Theta_h KE_h Scalar_h Q_h + Vector Factors = {inv_Pr_t, inv_sigma_k, inv_Sc_t, inv_Sc_t}; // alpha = mu/Pr Gpu::AsyncVector d_Factors; d_Factors.resize(Factors.size()); Gpu::copy(Gpu::hostToDevice, Factors.begin(), Factors.end(), d_Factors.begin()); Real* fac_ptr = d_Factors.data(); - bool use_KE = (turbChoice.les_type == LESType::Deardorff); - bool use_QKE = turbChoice.use_QKE; + const bool use_KE = ( (turbChoice.les_type == LESType::Deardorff) || + (turbChoice.pbl_type == PBLType::MYNN25) ); #ifdef _OPENMP #pragma omp parallel if (Gpu::notInLaunchRegion()) @@ -324,18 +327,6 @@ void ComputeTurbulentViscosityLES (const MultiFab& Tau11, const MultiFab& Tau22, int offset = (EddyDiff::NumDiffs-1)/2; switch (n) { - case EddyDiff::QKE_h: - // Populate element other than mom_h/v on the whole grid - if(use_QKE) { - ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept - { - int indx = n; - int indx_v = indx + offset; - mu_turb(i,j,k,indx) = mu_turb(i,j,k,EddyDiff::Mom_h) * fac_ptr[indx-1]; - mu_turb(i,j,k,indx_v) = mu_turb(i,j,k,indx); - }); - } - break; case EddyDiff::KE_h: if (use_KE) { ParallelFor(bxcc, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept @@ -389,20 +380,6 @@ void ComputeTurbulentViscosityLES (const MultiFab& Tau11, const MultiFab& Tau22, int offset = (EddyDiff::NumDiffs-1)/2; switch (n) { - case EddyDiff::QKE_h: - // Extrap all components at top & bottom - if(use_QKE) { - ParallelFor(planez, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept - { - int indx = n; - int indx_v = indx + offset; - mu_turb(i, j, k_lo-k, indx ) = mu_turb(i, j, k_lo, indx ); - mu_turb(i, j, k_hi+k, indx ) = mu_turb(i, j, k_hi, indx ); - mu_turb(i, j, k_lo-k, indx_v) = mu_turb(i, j, k_lo, indx_v); - mu_turb(i, j, k_hi+k, indx_v) = mu_turb(i, j, k_hi, indx_v); - }); - } - break; case EddyDiff::KE_h: if (use_KE) { ParallelFor(planez, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept diff --git a/Source/Diffusion/ERF_DiffusionSrcForState_N.cpp b/Source/Diffusion/ERF_DiffusionSrcForState_N.cpp index 58fde87ac..e4429425b 100644 --- a/Source/Diffusion/ERF_DiffusionSrcForState_N.cpp +++ b/Source/Diffusion/ERF_DiffusionSrcForState_N.cpp @@ -79,11 +79,12 @@ DiffusionSrcForState_N (const Box& bx, const Box& domain, const auto& dom_lo = lbound(domain); const auto& dom_hi = ubound(domain); - bool l_use_QKE = turbChoice.use_QKE; - bool l_use_deardorff = (turbChoice.les_type == LESType::Deardorff); Real l_inv_theta0 = 1.0 / turbChoice.theta_ref; Real l_abs_g = std::abs(grav_gpu[2]); + bool l_use_ddorf = (turbChoice.les_type == LESType::Deardorff); + bool l_use_mynn = (turbChoice.pbl_type == PBLType::MYNN25); + bool l_consA = (diffChoice.molec_diff_type == MolecDiffType::ConstantAlpha); bool l_turb = ( (turbChoice.les_type == LESType::Smagorinsky) || (turbChoice.les_type == LESType::Deardorff ) || @@ -96,7 +97,7 @@ DiffusionSrcForState_N (const Box& bx, const Box& domain, const int end_comp = start_comp + num_comp - 1; - // Theta, KE, QKE, Scalar + // Theta, KE, Scalar Vector alpha_eff(NPRIMVAR_max, 0.0); if (l_consA) { for (int i = 0; i < NPRIMVAR_max; ++i) { @@ -164,15 +165,15 @@ DiffusionSrcForState_N (const Box& bx, const Box& domain, } } - Vector eddy_diff_idx{EddyDiff::Theta_h, EddyDiff::KE_h, EddyDiff::QKE_h, EddyDiff::Scalar_h, - EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h , - EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h }; - Vector eddy_diff_idy{EddyDiff::Theta_h, EddyDiff::KE_h, EddyDiff::QKE_h, EddyDiff::Scalar_h, - EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h , - EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h }; - Vector eddy_diff_idz{EddyDiff::Theta_v, EddyDiff::KE_v, EddyDiff::QKE_v, EddyDiff::Scalar_v, - EddyDiff::Q_v , EddyDiff::Q_v, EddyDiff::Q_v , - EddyDiff::Q_v , EddyDiff::Q_v, EddyDiff::Q_v }; + Vector eddy_diff_idx{EddyDiff::Theta_h, EddyDiff::KE_h, EddyDiff::Scalar_h, + EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h , + EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h }; + Vector eddy_diff_idy{EddyDiff::Theta_h, EddyDiff::KE_h, EddyDiff::Scalar_h, + EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h , + EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h }; + Vector eddy_diff_idz{EddyDiff::Theta_v, EddyDiff::KE_v, EddyDiff::Scalar_v, + EddyDiff::Q_v , EddyDiff::Q_v, EddyDiff::Q_v , + EddyDiff::Q_v , EddyDiff::Q_v, EddyDiff::Q_v }; // Device vectors Gpu::AsyncVector alpha_eff_d; @@ -678,7 +679,7 @@ DiffusionSrcForState_N (const Box& bx, const Box& domain, // The surface heat flux hfx_z(i,j,-1) is updated in MOSTStress at // each RK stage if using the ERF_EXPLICIT_MOST_STRESS path, but that // does not change the buoyancy production term here. - if (l_use_deardorff && start_comp <= RhoKE_comp && end_comp >=RhoKE_comp) { + if (l_use_ddorf && (start_comp <= RhoKE_comp) && (end_comp >=RhoKE_comp)) { int qty_index = RhoKE_comp; ParallelFor(bx,[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { @@ -707,8 +708,8 @@ DiffusionSrcForState_N (const Box& bx, const Box& domain, } // Using PBL - if (l_use_QKE && start_comp <= RhoQKE_comp && end_comp >=RhoQKE_comp) { - int qty_index = RhoQKE_comp; + if (l_use_mynn && start_comp <= RhoKE_comp && end_comp >=RhoKE_comp) { + int qty_index = RhoKE_comp; auto pbl_mynn_B1_l = turbChoice.pbl_mynn.B1; const int rhoqv_comp = solverChoice.RhoQv_comp; @@ -734,5 +735,4 @@ DiffusionSrcForState_N (const Box& bx, const Box& domain, use_most); }); } - } diff --git a/Source/Diffusion/ERF_DiffusionSrcForState_T.cpp b/Source/Diffusion/ERF_DiffusionSrcForState_T.cpp index d210b512c..8b4e1bcc5 100644 --- a/Source/Diffusion/ERF_DiffusionSrcForState_T.cpp +++ b/Source/Diffusion/ERF_DiffusionSrcForState_T.cpp @@ -91,11 +91,12 @@ DiffusionSrcForState_T (const Box& bx, const Box& domain, const auto& dom_hi = ubound(domain); - bool l_use_QKE = turbChoice.use_QKE; - bool l_use_deardorff = (turbChoice.les_type == LESType::Deardorff); Real l_inv_theta0 = 1.0 / turbChoice.theta_ref; Real l_abs_g = std::abs(grav_gpu[2]); + bool l_use_ddorf = (turbChoice.les_type == LESType::Deardorff); + bool l_use_mynn = (turbChoice.pbl_type == PBLType::MYNN25); + bool l_consA = (diffChoice.molec_diff_type == MolecDiffType::ConstantAlpha); bool l_turb = ( (turbChoice.les_type == LESType::Smagorinsky) || (turbChoice.les_type == LESType::Deardorff ) || @@ -109,7 +110,7 @@ DiffusionSrcForState_T (const Box& bx, const Box& domain, const int end_comp = start_comp + num_comp - 1; - // Theta, KE, QKE, Scalar + // Theta, KE, Scalar Vector alpha_eff(NPRIMVAR_max, 0.0); if (l_consA) { for (int i = 0; i < NPRIMVAR_max; ++i) { @@ -177,15 +178,15 @@ DiffusionSrcForState_T (const Box& bx, const Box& domain, } } - Vector eddy_diff_idx{EddyDiff::Theta_h, EddyDiff::KE_h, EddyDiff::QKE_h, EddyDiff::Scalar_h, - EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h , - EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h }; - Vector eddy_diff_idy{EddyDiff::Theta_h, EddyDiff::KE_h, EddyDiff::QKE_h, EddyDiff::Scalar_h, - EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h , - EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h }; - Vector eddy_diff_idz{EddyDiff::Theta_v, EddyDiff::KE_v, EddyDiff::QKE_v, EddyDiff::Scalar_v, - EddyDiff::Q_v , EddyDiff::Q_v, EddyDiff::Q_v , - EddyDiff::Q_v , EddyDiff::Q_v, EddyDiff::Q_v }; + Vector eddy_diff_idx{EddyDiff::Theta_h, EddyDiff::KE_h, EddyDiff::Scalar_h, + EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h , + EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h }; + Vector eddy_diff_idy{EddyDiff::Theta_h, EddyDiff::KE_h, EddyDiff::Scalar_h, + EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h , + EddyDiff::Q_h , EddyDiff::Q_h, EddyDiff::Q_h }; + Vector eddy_diff_idz{EddyDiff::Theta_v, EddyDiff::KE_v, EddyDiff::Scalar_v, + EddyDiff::Q_v , EddyDiff::Q_v, EddyDiff::Q_v , + EddyDiff::Q_v , EddyDiff::Q_v, EddyDiff::Q_v }; // Device vectors Gpu::AsyncVector alpha_eff_d; @@ -789,7 +790,7 @@ DiffusionSrcForState_T (const Box& bx, const Box& domain, // The surface heat flux hfx_z(i,j,-1) is updated in MOSTStress at // each RK stage if using the ERF_EXPLICIT_MOST_STRESS path, but that // does not change the buoyancy production term here. - if (l_use_deardorff && start_comp <= RhoKE_comp && end_comp >=RhoKE_comp) { + if (l_use_ddorf && (start_comp <= RhoKE_comp) && (end_comp >= RhoKE_comp)) { int qty_index = RhoKE_comp; ParallelFor(bx,[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { @@ -818,8 +819,8 @@ DiffusionSrcForState_T (const Box& bx, const Box& domain, } // Using PBL - if (l_use_QKE && start_comp <= RhoQKE_comp && end_comp >=RhoQKE_comp) { - int qty_index = RhoQKE_comp; + if (l_use_mynn && start_comp <= RhoKE_comp && end_comp >=RhoKE_comp) { + int qty_index = RhoKE_comp; auto pbl_mynn_B1_l = turbChoice.pbl_mynn.B1; const int rhoqv_comp = solverChoice.RhoQv_comp; @@ -834,7 +835,6 @@ DiffusionSrcForState_T (const Box& bx, const Box& domain, bool v_ext_dir_on_zlo = ( (bc_ptr[BCVars::yvel_bc].lo(2) == ERFBCType::ext_dir) ); bool v_ext_dir_on_zhi = ( (bc_ptr[BCVars::yvel_bc].lo(5) == ERFBCType::ext_dir) ); - const Real met_h_zeta = detJ(i,j,k); // This computes shear production, buoyancy production, and dissipation terms only. cell_rhs(i, j, k, qty_index) += ComputeQKESourceTerms(i,j,k,u,v,cell_data,cell_prim, mu_turb,cellSizeInv,domain, @@ -843,7 +843,7 @@ DiffusionSrcForState_T (const Box& bx, const Box& domain, c_ext_dir_on_zlo, c_ext_dir_on_zhi, u_ext_dir_on_zlo, u_ext_dir_on_zhi, v_ext_dir_on_zlo, v_ext_dir_on_zhi, - use_most, met_h_zeta); + use_most); }); } } diff --git a/Source/Diffusion/ERF_EddyViscosity.H b/Source/Diffusion/ERF_EddyViscosity.H index cc47191dc..a6f2cd317 100644 --- a/Source/Diffusion/ERF_EddyViscosity.H +++ b/Source/Diffusion/ERF_EddyViscosity.H @@ -39,12 +39,6 @@ ComputeSmnSmn (int& i, int& j, int& k, const bool& use_most, const bool& exp_most) { - amrex::Real s11bar = tau11(i,j,k); - amrex::Real s22bar = tau22(i,j,k); - amrex::Real s33bar = tau33(i,j,k); - amrex::Real s12bar = 0.25 * ( tau12(i , j , k ) + tau12(i , j+1, k ) - + tau12(i+1, j , k ) + tau12(i+1, j+1, k ) ); - // NOTES: // - If ERF_EXPLICIT_MOST_STRESS is not used, then we do not use the // strains lying on the bottom boundary with MOST. These values are @@ -76,6 +70,12 @@ ComputeSmnSmn (int& i, int& j, int& k, + tau23(i , j+1, k ) + tau23(i , j+1, k+1) ); } + amrex::Real s11bar = tau11(i,j,k); + amrex::Real s22bar = tau22(i,j,k); + amrex::Real s33bar = tau33(i,j,k); + amrex::Real s12bar = 0.25 * ( tau12(i , j , k ) + tau12(i , j+1, k ) + + tau12(i+1, j , k ) + tau12(i+1, j+1, k ) ); + amrex::Real SmnSmn = s11bar*s11bar + s22bar*s22bar + s33bar*s33bar + 2.0*s12bar*s12bar + 2.0*s13bar*s13bar + 2.0*s23bar*s23bar; diff --git a/Source/ERF.H b/Source/ERF.H index 9c07a779f..cd1b68c4e 100644 --- a/Source/ERF.H +++ b/Source/ERF.H @@ -78,6 +78,22 @@ AMREX_ENUM(InitType, None, Input_Sounding, Ideal, Real, Metgrid, Uniform ); +/** + * Enum of possible interpolation types between coarse/fine +*/ +AMREX_ENUM(StateInterpType, + FullState, Perturbational +); + +/** + * Enum of possible plotfile types +*/ +AMREX_ENUM(PlotFileType, + None, Amrex, Netcdf, HDF5 +); + + +#if 0 /** * Enum of possible coarse/fine interpolation options */ @@ -94,6 +110,7 @@ namespace InterpType { FaceConserativeLinear }; } +#endif /** * Main class in ERF code, instantiated from main.cpp @@ -318,7 +335,7 @@ public: void derive_upwp (amrex::Vector& h_havg); // write plotfile to disk - void WritePlotFile (int which, amrex::Vector plot_var_names); + void WritePlotFile (int which, PlotFileType plotfile_type, amrex::Vector plot_var_names); void WriteMultiLevelPlotfileWithTerrain (const std::string &plotfilename, int nlevels, @@ -348,7 +365,7 @@ public: const std::string &mfPrefix) const; void erf_enforce_hse (int lev, - amrex::MultiFab& dens, amrex::MultiFab& pres, amrex::MultiFab& pi, + amrex::MultiFab& dens, amrex::MultiFab& pres, amrex::MultiFab& pi, amrex::MultiFab& th, std::unique_ptr& z_cc); #ifdef ERF_USE_NETCDF @@ -427,7 +444,8 @@ public: amrex::MultiFab& U_old, amrex::MultiFab& V_old, amrex::MultiFab& W_old, amrex::MultiFab& mf_vars_windfarm, const amrex::MultiFab& mf_Nturb, - const amrex::MultiFab& mf_SMark); + const amrex::MultiFab& mf_SMark, + const amrex::Real& time); #endif #ifdef ERF_USE_EB @@ -440,6 +458,15 @@ public: // more flexible version of AverageDown() that lets you average down across multiple levels void AverageDownTo (int crse_lev, int scomp, int ncomp); // NOLINT + // write checkpoint file to disk + void WriteCheckpointFile () const; + + // read checkpoint file from disk + void ReadCheckpointFile (); + + // read checkpoint file from disk -- called after instantiating m_most + void ReadCheckpointFileMOST (); + private: /////////////////////////// @@ -498,9 +525,17 @@ private: // // NOTE: FillPatch takes in an empty MF, and returns cell-centered + velocities (not momenta) // + // This one works only at level = 0 (base state does not change) + void FillPatch (int lev, amrex::Real time, + const amrex::Vector& mfs_vel, + bool cons_only=false); + + // This one works only at level > 0 (base state does change) void FillPatch (int lev, amrex::Real time, const amrex::Vector& mfs_vel, const amrex::Vector& mfs_mom, + const amrex::MultiFab& old_base_state, + const amrex::MultiFab& new_base_state, bool fillset=true, bool cons_only=false); // Compute new multifabs by copying data from valid region and filling ghost cells. @@ -629,15 +664,6 @@ private: // Function to read and populate above vectors (if input file exists) void init_Dirichlet_bc_data (const std::string input_file); - // write checkpoint file to disk - void WriteCheckpointFile () const; - - // read checkpoint file from disk - void ReadCheckpointFile (); - - // read checkpoint file from disk -- called after instantiating m_most - void ReadCheckpointFileMOST (); - // Read the file passed to amr.restart and use it as an initial condition for // the current simulation. Supports a different number of components and // ghost cells. @@ -705,6 +731,10 @@ private: amrex::Vector rW_old; amrex::Vector rW_new; + // amrex::Vector xmom_crse_rhs; + // amrex::Vector ymom_crse_rhs; + amrex::Vector zmom_crse_rhs; + std::unique_ptr micro; amrex::Vector> qmoist; // (lev,ncomp) This has up to 8 components: qt, qv, qc, qi, qp, qr, qs, qg @@ -887,12 +917,12 @@ private: amrex::Vector plot_var_names_1; amrex::Vector plot_var_names_2; - const amrex::Vector cons_names {"density", "rhotheta", "rhoKE", "rhoQKE", "rhoadv_0", + const amrex::Vector cons_names {"density", "rhotheta", "rhoKE", "rhoadv_0", "rhoQ1", "rhoQ2", "rhoQ3", "rhoQ4", "rhoQ5", "rhoQ6"}; // Note that the order of variable names here must match the order in ERF_Derive.cpp - const amrex::Vector derived_names {"soundspeed", "temp", "theta", "KE", "QKE", "scalar", + const amrex::Vector derived_names {"soundspeed", "temp", "theta", "KE", "scalar", "vorticity_x","vorticity_y","vorticity_z", "magvel", "divU", "pres_hse", "dens_hse", "pressure", "pert_pres", "pert_dens", @@ -906,7 +936,7 @@ private: // eddy diffusivity of heat "Khv","Khh", // mynn pbl lengthscale - "Lpbl", + "Lturb", // moisture vars "qt", "qv", "qc", "qi", "qp", "qrain", "qsnow", "qgraup", "qsat", "rain_accum", "snow_accum", "graup_accum" @@ -964,10 +994,12 @@ private: static int pert_interval; static amrex::Real sum_per; - // Native or NetCDF - static std::string plotfile_type; + // Write in native AMReX or NetCDF format for each plotfile + static PlotFileType plotfile_type_1; + static PlotFileType plotfile_type_2; static InitType init_type; + static StateInterpType interpolation_type; // sponge_type: "input_sponge" static std::string sponge_type; diff --git a/Source/ERF.cpp b/Source/ERF.cpp index 1234c661a..d20b06b1c 100644 --- a/Source/ERF.cpp +++ b/Source/ERF.cpp @@ -41,9 +41,11 @@ Real ERF::sum_per = -1.0; int ERF::pert_interval = -1; // Native AMReX vs NetCDF -std::string ERF::plotfile_type = "amrex"; +PlotFileType ERF::plotfile_type_1 = PlotFileType::None; +PlotFileType ERF::plotfile_type_2 = PlotFileType::None; InitType ERF::init_type; +StateInterpType ERF::interpolation_type; // use_real_bcs: only true if 1) ( (init_type == InitType::Real) or (init_type == InitGrid::Metgrid) ) // AND 2) we want to use the bc's from the WRF bdy file @@ -195,6 +197,10 @@ ERF::ERF_shared () rV_old.resize(nlevs_max); rW_old.resize(nlevs_max); + // xmom_crse_rhs.resize(nlevs_max); + // ymom_crse_rhs.resize(nlevs_max); + zmom_crse_rhs.resize(nlevs_max); + for (int lev = 0; lev < nlevs_max; ++lev) { vars_new[lev].resize(Vars::NumTypes); vars_old[lev].resize(Vars::NumTypes); @@ -369,11 +375,11 @@ ERF::Evolve () if (writeNow(cur_time, dt[0], step+1, m_plot_int_1, m_plot_per_1)) { last_plot_file_step_1 = step+1; - WritePlotFile(1,plot_var_names_1); + WritePlotFile(1,plotfile_type_1,plot_var_names_1); } if (writeNow(cur_time, dt[0], step+1, m_plot_int_2, m_plot_per_2)) { last_plot_file_step_2 = step+1; - WritePlotFile(2,plot_var_names_2); + WritePlotFile(2,plotfile_type_2,plot_var_names_2); } if (writeNow(cur_time, dt[0], step+1, m_check_int, m_check_per)) { @@ -401,10 +407,10 @@ ERF::Evolve () // Write plotfiles at final time if ( (m_plot_int_1 > 0 || m_plot_per_1 > 0.) && istep[0] > last_plot_file_step_1 ) { - WritePlotFile(1,plot_var_names_1); + WritePlotFile(1,plotfile_type_1,plot_var_names_1); } if ( (m_plot_int_2 > 0 || m_plot_per_2 > 0.) && istep[0] > last_plot_file_step_2) { - WritePlotFile(2,plot_var_names_2); + WritePlotFile(2,plotfile_type_1,plot_var_names_2); } if ( (m_check_int > 0 || m_check_per > 0.) && istep[0] > last_check_file_step) { @@ -458,8 +464,9 @@ ERF::post_timestep (int nstep, Real time, Real dt_lev0) } } // mfi - // This call refluxes from the lev/lev+1 interface onto lev - getAdvFluxReg(lev+1)->Reflux(vars_new[lev][Vars::cons], 0, 0, ncomp); + // This call refluxes all "slow" cell-centered variables + // (i.e. not density or (rho theta) or velocities) from the lev/lev+1 interface onto lev + getAdvFluxReg(lev+1)->Reflux(vars_new[lev][Vars::cons], 2, 2, ncomp-2); // Here we multiply (rho S) by m^2 after refluxing for (MFIter mfi(vars_new[lev][Vars::cons], TilingIfNotGPU()); mfi.isValid(); ++mfi) { @@ -552,7 +559,7 @@ ERF::post_timestep (int nstep, Real time, Real dt_lev0) // Copy z_phs_nd and detJ_cc at end of timestep MultiFab::Copy(*z_phys_nd[lev], *z_phys_nd_new[lev], 0, 0, 1, z_phys_nd[lev]->nGrowVect()); MultiFab::Copy( *detJ_cc[lev], *detJ_cc_new[lev], 0, 0, 1, detJ_cc[lev]->nGrowVect()); - MultiFab::Copy(base_state[lev],base_state_new[lev],0,0,3,1); + MultiFab::Copy(base_state[lev],base_state_new[lev],0,0,BaseState::num_comps,base_state[lev].nGrowVect()); make_zcc(geom[lev],*z_phys_nd[lev],*z_phys_cc[lev]); } @@ -675,24 +682,6 @@ ERF::InitData_post () } // lev } - Real QKE_0; - if (pp.query("QKE_0", QKE_0)) { - Print() << "Initializing uniform QKE=" << QKE_0 << std::endl; - for (int lev = 0; lev <= finest_level; lev++) { - auto& lev_new = vars_new[lev]; - for (MFIter mfi(lev_new[Vars::cons], TilingIfNotGPU()); mfi.isValid(); ++mfi) { - const Box &bx = mfi.tilebox(); - const auto &cons_arr = lev_new[Vars::cons].array(mfi); - // We want to set the lateral BC values, too - Box gbx = bx; // Copy constructor - gbx.grow(0,1); gbx.grow(1,1); // Grow by one in the lateral directions - ParallelFor(gbx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { - cons_arr(i,j,k,RhoQKE_comp) = cons_arr(i,j,k,Rho_comp) * QKE_0; - }); - } // mfi - } - } - if (solverChoice.coupling_type == CouplingType::TwoWay) { AverageDown(); } @@ -721,8 +710,10 @@ ERF::InitData_post () restart(); // Create the physbc objects for {cons, u, v, w, base state} + // We fill the additional base state ghost cells just in case we have read the old format for (int lev(0); lev <= max_level; ++lev) { make_physbcs(lev); + (*physbcs_base[lev])(base_state[lev],0,base_state[lev].nComp(),base_state[lev].nGrowVect()); } } @@ -889,6 +880,18 @@ ERF::InitData_post () int ncomp = lev_new[Vars::cons].nComp(); + // *************************************************************************** + // Physical bc's at domain boundary + // *************************************************************************** + IntVect ngvect_cons = vars_new[lev][Vars::cons].nGrowVect(); + IntVect ngvect_vels = vars_new[lev][Vars::xvel].nGrowVect(); + + (*physbcs_cons[lev])(lev_new[Vars::cons],0,ncomp,ngvect_cons,t_new[lev],BCVars::cons_bc,true); + ( *physbcs_u[lev])(lev_new[Vars::xvel],0,1 ,ngvect_vels,t_new[lev],BCVars::xvel_bc,true); + ( *physbcs_v[lev])(lev_new[Vars::yvel],0,1 ,ngvect_vels,t_new[lev],BCVars::yvel_bc,true); + ( *physbcs_w[lev])(lev_new[Vars::zvel],lev_new[Vars::xvel],lev_new[Vars::yvel], + ngvect_vels,t_new[lev],BCVars::zvel_bc,true); + MultiFab::Copy(lev_old[Vars::cons],lev_new[Vars::cons],0,0,ncomp,lev_new[Vars::cons].nGrowVect()); MultiFab::Copy(lev_old[Vars::xvel],lev_new[Vars::xvel],0,0, 1,lev_new[Vars::xvel].nGrowVect()); MultiFab::Copy(lev_old[Vars::yvel],lev_new[Vars::yvel],0,0, 1,lev_new[Vars::yvel].nGrowVect()); @@ -920,10 +923,16 @@ ERF::InitData_post () // Fill boundary conditions -- not sure why we need this here // bool fillset = false; - FillPatch(lev, t_new[lev], - {&lev_new[Vars::cons],&lev_new[Vars::xvel],&lev_new[Vars::yvel],&lev_new[Vars::zvel]}, - {&lev_new[Vars::cons],&rU_new[lev],&rV_new[lev],&rW_new[lev]}, - fillset); + if (lev == 0) { + FillPatch(lev, t_new[lev], + {&lev_new[Vars::cons],&lev_new[Vars::xvel],&lev_new[Vars::yvel],&lev_new[Vars::zvel]}); + } else { + FillPatch(lev, t_new[lev], + {&lev_new[Vars::cons],&lev_new[Vars::xvel],&lev_new[Vars::yvel],&lev_new[Vars::zvel]}, + {&lev_new[Vars::cons],&rU_new[lev],&rV_new[lev],&rW_new[lev]}, + base_state[lev], base_state[lev], + fillset); + } // // We do this here to make sure level (lev-1) boundary conditions are filled @@ -943,8 +952,8 @@ ERF::InitData_post () base_state[lev].FillBoundary(geom[lev].periodicity()); // For moving terrain only - if (solverChoice.terrain_type != TerrainType::Static) { - MultiFab::Copy(base_state_new[lev],base_state[lev],0,0,3,1); + if (solverChoice.terrain_type == TerrainType::Moving) { + MultiFab::Copy(base_state_new[lev],base_state[lev],0,0,BaseState::num_comps,base_state[lev].nGrowVect()); base_state_new[lev].FillBoundary(geom[lev].periodicity()); } @@ -1082,12 +1091,12 @@ ERF::InitData_post () { if (m_plot_int_1 > 0 || m_plot_per_1 > 0.) { - WritePlotFile(1,plot_var_names_1); + WritePlotFile(1,plotfile_type_1,plot_var_names_1); last_plot_file_step_1 = istep[0]; } if (m_plot_int_2 > 0 || m_plot_per_2 > 0.) { - WritePlotFile(2,plot_var_names_2); + WritePlotFile(2,plotfile_type_2,plot_var_names_2); last_plot_file_step_2 = istep[0]; } } @@ -1490,8 +1499,46 @@ ERF::ReadParameters () pp.query("metgrid_order", metgrid_order); pp.query("metgrid_force_sfc_k", metgrid_force_sfc_k); - // Output format - pp.query("plotfile_type", plotfile_type); + // Set default to FullState for now ... later we will try Perturbation + interpolation_type = StateInterpType::FullState; + pp.query_enum_case_insensitive("interpolation_type" ,interpolation_type); + + PlotFileType plotfile_type_temp = PlotFileType::None; + pp.query_enum_case_insensitive("plotfile_type" ,plotfile_type_temp); + pp.query_enum_case_insensitive("plotfile_type_1",plotfile_type_1); + pp.query_enum_case_insensitive("plotfile_type_2",plotfile_type_2); + // + // This option is for backward consistency -- if only plotfile_type is set, + // then it will be used for both 1 and 2 if and only if they are not set + // + // Default is native amrex if no type is specified + // + if (plotfile_type_temp == PlotFileType::None) { + if (plotfile_type_1 == PlotFileType::None) { + plotfile_type_1 = PlotFileType::Amrex; + } + if (plotfile_type_2 == PlotFileType::None) { + plotfile_type_2 = PlotFileType::Amrex; + } + } else { + if (plotfile_type_1 == PlotFileType::None) { + plotfile_type_1 = plotfile_type_temp; + } else { + amrex::Abort("You must set either plotfile_type or plotfile_type_1, not both"); + } + if (plotfile_type_2 == PlotFileType::None) { + plotfile_type_2 = plotfile_type_temp; + } else { + amrex::Abort("You must set either plotfile_type or plotfile_type_2, not both"); + } + } +#ifndef ERF_USE_NETCDF + if (plotfile_type_1 == PlotFileType::Netcdf || + plotfile_type_2 == PlotFileType::Netcdf) { + amrex::Abort("Plotfile type = Netcdf is not allowed without USE_NETCDF = TRUE"); + } +#endif + pp.query("plot_file_1", plot_file_1); pp.query("plot_file_2", plot_file_2); pp.query("plot_int_1" , m_plot_int_1); @@ -1597,7 +1644,7 @@ ERF::ParameterSanityChecks () { AMREX_ALWAYS_ASSERT(cfl > 0. || fixed_dt[0] > 0.); - // We don't allow use_real_bcs to be true if init_type is not either InitType::Rreal or InitType::Metgrid + // We don't allow use_real_bcs to be true if init_type is not either InitType::Real or InitType::Metgrid AMREX_ALWAYS_ASSERT(!use_real_bcs || ((init_type == InitType::Real) || (init_type == InitType::Metgrid)) ); AMREX_ALWAYS_ASSERT(real_width >= 0); @@ -1617,14 +1664,6 @@ ERF::ParameterSanityChecks () } } - if (plotfile_type != "amrex" && - plotfile_type != "netcdf" && plotfile_type != "NetCDF" && - plotfile_type != "hdf5" && plotfile_type != "HDF5" ) - { - Print() << "User selected plotfile_type = " << plotfile_type << std::endl; - Abort("Dont know this plotfile_type"); - } - // If fixed_mri_dt_ratio is set, it must be even if (fixed_mri_dt_ratio > 0 && (fixed_mri_dt_ratio%2 != 0) ) { @@ -1695,7 +1734,7 @@ ERF::MakeHorizontalAverages () fab_arr(i, j, k, 1) = cons_arr(i, j, k, RhoTheta_comp) / dens; if (!use_moisture) { if (is_anelastic) { - fab_arr(i,j,k,2) = hse_arr(i,j,k,1); + fab_arr(i,j,k,2) = hse_arr(i,j,k,BaseState::p0_comp); } else { fab_arr(i,j,k,2) = getPgivenRTh(cons_arr(i,j,k,RhoTheta_comp)); } @@ -1715,7 +1754,7 @@ ERF::MakeHorizontalAverages () ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) { Real dens = cons_arr(i, j, k, Rho_comp); if (is_anelastic) { - fab_arr(i,j,k,2) = hse_arr(i,j,k,1); + fab_arr(i,j,k,2) = hse_arr(i,j,k,BaseState::p0_comp); } else { Real qv = cons_arr(i, j, k, RhoQ1_comp) / dens; fab_arr(i, j, k, 2) = getPgivenRTh(cons_arr(i, j, k, RhoTheta_comp), qv); @@ -1818,115 +1857,6 @@ ERF::MakeDiagnosticAverage (Vector& h_havg, MultiFab& S, int n) } } -// Set covered coarse cells to be the average of overlying fine cells for all levels -void -ERF::AverageDown () -{ - AMREX_ALWAYS_ASSERT(solverChoice.coupling_type == CouplingType::TwoWay); - int src_comp = 0; - int num_comp = vars_new[0][Vars::cons].nComp(); - for (int lev = finest_level-1; lev >= 0; --lev) - { - AverageDownTo(lev,src_comp,num_comp); - } -} - -// Set covered coarse cells to be the average of overlying fine cells at level crse_lev -void -ERF::AverageDownTo (int crse_lev, int scomp, int ncomp) // NOLINT -{ - AMREX_ALWAYS_ASSERT(solverChoice.coupling_type == CouplingType::TwoWay); - - // ****************************************************************************************** - // First do cell-centered quantities - // The quantity that is conserved is not (rho S), but rather (rho S / m^2) where - // m is the map scale factor at cell centers - // Here we pre-divide (rho S) by m^2 before average down - // ****************************************************************************************** - for (int lev = crse_lev; lev <= crse_lev+1; lev++) { - for (MFIter mfi(vars_new[lev][Vars::cons], TilingIfNotGPU()); mfi.isValid(); ++mfi) { - const Box& bx = mfi.tilebox(); - const Array4< Real> cons_arr = vars_new[lev][Vars::cons].array(mfi); - const Array4 mapfac_arr = mapfac_m[lev]->const_array(mfi); - if (solverChoice.use_terrain) { - const Array4 detJ_arr = detJ_cc[lev]->const_array(mfi); - ParallelFor(bx, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept - { - cons_arr(i,j,k,scomp+n) *= detJ_arr(i,j,k) / (mapfac_arr(i,j,0)*mapfac_arr(i,j,0)); - }); - } else { - ParallelFor(bx, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept - { - cons_arr(i,j,k,scomp+n) /= (mapfac_arr(i,j,0)*mapfac_arr(i,j,0)); - }); - } - } // mfi - } // lev - - average_down(vars_new[crse_lev+1][Vars::cons], - vars_new[crse_lev ][Vars::cons], - scomp, ncomp, refRatio(crse_lev)); - - // Here we multiply (rho S) by m^2 after average down - for (int lev = crse_lev; lev <= crse_lev+1; lev++) { - for (MFIter mfi(vars_new[lev][Vars::cons], TilingIfNotGPU()); mfi.isValid(); ++mfi) { - const Box& bx = mfi.tilebox(); - const Array4< Real> cons_arr = vars_new[lev][Vars::cons].array(mfi); - const Array4 mapfac_arr = mapfac_m[lev]->const_array(mfi); - if (solverChoice.use_terrain) { - const Array4 detJ_arr = detJ_cc[lev]->const_array(mfi); - ParallelFor(bx, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept - { - cons_arr(i,j,k,scomp+n) *= (mapfac_arr(i,j,0)*mapfac_arr(i,j,0)) / detJ_arr(i,j,k); - }); - } else { - ParallelFor(bx, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept - { - cons_arr(i,j,k,scomp+n) *= (mapfac_arr(i,j,0)*mapfac_arr(i,j,0)); - }); - } - } // mfi - } // lev - - // ****************************************************************************************** - // Now average down momenta. - // Note that vars_new holds velocities not momenta, but we want to do conservative - // averaging so we first convert to momentum, then average down, then convert - // back to velocities -- only on the valid region - // ****************************************************************************************** - for (int lev = crse_lev; lev <= crse_lev+1; lev++) - { - // FillBoundary for density so we can go back and forth between velocity and momentum - vars_new[lev][Vars::cons].FillBoundary(geom[lev].periodicity()); - - VelocityToMomentum(vars_new[lev][Vars::xvel], IntVect(0,0,0), - vars_new[lev][Vars::yvel], IntVect(0,0,0), - vars_new[lev][Vars::zvel], IntVect(0,0,0), - vars_new[lev][Vars::cons], - rU_new[lev], - rV_new[lev], - rW_new[lev], - Geom(lev).Domain(), - domain_bcs_type); - } - - average_down_faces(rU_new[crse_lev+1], rU_new[crse_lev], refRatio(crse_lev), geom[crse_lev]); - average_down_faces(rV_new[crse_lev+1], rV_new[crse_lev], refRatio(crse_lev), geom[crse_lev]); - average_down_faces(rW_new[crse_lev+1], rW_new[crse_lev], refRatio(crse_lev), geom[crse_lev]); - - for (int lev = crse_lev; lev <= crse_lev+1; lev++) { - MomentumToVelocity(vars_new[lev][Vars::xvel], - vars_new[lev][Vars::yvel], - vars_new[lev][Vars::zvel], - vars_new[lev][Vars::cons], - rU_new[lev], - rV_new[lev], - rW_new[lev], - Geom(lev).Domain(), - domain_bcs_type); - } -} - void ERF::Construct_ERFFillPatchers (int lev) { diff --git a/Source/ERF_Derive.H b/Source/ERF_Derive.H index 0090ef07b..7eb56aa5c 100644 --- a/Source/ERF_Derive.H +++ b/Source/ERF_Derive.H @@ -89,17 +89,6 @@ void erf_derKE ( const int* bcrec, const int level); -void erf_derQKE ( - const amrex::Box& bx, - amrex::FArrayBox& derfab, - int dcomp, - int ncomp, - const amrex::FArrayBox& datfab, - const amrex::Geometry& geomdata, - amrex::Real time, - const int* bcrec, - const int level); - void erf_dervortx ( const amrex::Box& bx, amrex::FArrayBox& derfab, diff --git a/Source/ERF_Derive.cpp b/Source/ERF_Derive.cpp index 75ff631ba..33fa8f118 100644 --- a/Source/ERF_Derive.cpp +++ b/Source/ERF_Derive.cpp @@ -196,27 +196,6 @@ erf_derKE (const Box& bx, erf_derrhodivide(bx, derfab, datfab, RhoKE_comp); } -/** - * Function to define QKE by dividing (rho QKE) by rho - * - * @params[in] bx box on which to divide by density - * @params[out] derfab array of derived quantity -- here it holds QKE - * @params[in] datfab array of data used to construct derived quantity -*/ -void -erf_derQKE (const Box& bx, - FArrayBox& derfab, - int /*dcomp*/, - int /*ncomp*/, - const FArrayBox& datfab, - const Geometry& /*geomdata*/, - Real /*time*/, - const int* /*bcrec*/, - const int /*level*/) -{ - erf_derrhodivide(bx, derfab, datfab, RhoQKE_comp); -} - void erf_dervortx ( const amrex::Box& bx, diff --git a/Source/ERF_IndexDefines.H b/Source/ERF_IndexDefines.H index 811946464..d0eb364d9 100644 --- a/Source/ERF_IndexDefines.H +++ b/Source/ERF_IndexDefines.H @@ -9,8 +9,8 @@ */ // This defines the ACTUAL number of non-moisture vars = -// rho, rhotheta, rhoKE, rhoQKE -#define NDRY 4 +// rho, rhotheta, rhoKE +#define NDRY 3 // This defines the ACTUAL number of non-moisture scalar vars #define NSCALARS 1 @@ -35,10 +35,9 @@ // Cell-centered state variables #define Rho_comp 0 #define RhoTheta_comp (Rho_comp+1) -#define RhoKE_comp (Rho_comp+2) // for Deardorff LES Model -#define RhoQKE_comp (Rho_comp+3) // for MYNN or YSU PBL Model +#define RhoKE_comp (Rho_comp+2) // for Deardorff LES Model or MYNN PBL Model -#define RhoScalar_comp (RhoQKE_comp+1) +#define RhoScalar_comp (RhoKE_comp+1) #define RhoQ1_comp (RhoScalar_comp+NSCALARS) #define RhoQ2_comp (RhoQ1_comp+1) @@ -50,7 +49,6 @@ // Cell-centered primitive variables #define PrimTheta_comp (RhoTheta_comp -1) #define PrimKE_comp (RhoKE_comp -1) -#define PrimQKE_comp (RhoQKE_comp -1) #define PrimScalar_comp (RhoScalar_comp-1) #define PrimQ1_comp (RhoQ1_comp-1) #define PrimQ2_comp (RhoQ2_comp-1) @@ -59,6 +57,17 @@ #define PrimQ5_comp (RhoQ5_comp-1) #define PrimQ6_comp (RhoQ6_comp-1) +// Base state variables +namespace BaseState { + enum { + r0_comp = 0, + p0_comp, + pi0_comp, + th0_comp, + num_comps + }; +} + // NOTE: we still use this indexing even if no moisture // NOTE: We assume a single boundary condition for all passive scalars // NOTE: and a single boundary condition for all components of the base state @@ -68,7 +77,6 @@ namespace BCVars { Rho_bc_comp = 0, RhoTheta_bc_comp, RhoKE_bc_comp, - RhoQKE_bc_comp, RhoScalar_bc_comp, RhoQ1_bc_comp, RhoQ2_bc_comp, @@ -143,16 +151,14 @@ namespace EddyDiff { Mom_h = 0, Theta_h, KE_h, - QKE_h, Scalar_h, Q_h, Mom_v, Theta_v, KE_v, - QKE_v, Scalar_v, Q_v, - PBL_lengthscale, + Turb_lengthscale, NumDiffs }; } diff --git a/Source/ERF_make_new_arrays.cpp b/Source/ERF_make_new_arrays.cpp index 78a249141..d1a856c19 100644 --- a/Source/ERF_make_new_arrays.cpp +++ b/Source/ERF_make_new_arrays.cpp @@ -26,13 +26,16 @@ ERF::init_stuff (int lev, const BoxArray& ba, const DistributionMapping& dm, std::unique_ptr& tmp_zphys_nd) { // ******************************************************************************************** - // Base state holds r_0, pres_0, pi_0 (in that order) + // Base state holds r_0, pres_0, pi_0, th_0 (in that order) + // + // Here is where we set 3 ghost cells for the base state! + // // ******************************************************************************************** - tmp_base_state.define(ba,dm,3,1); + tmp_base_state.define(ba,dm,BaseState::num_comps,3); tmp_base_state.setVal(0.); - if (solverChoice.use_terrain && solverChoice.terrain_type != TerrainType::Static) { - base_state_new[lev].define(ba,dm,3,1); + if (solverChoice.use_terrain && solverChoice.terrain_type == TerrainType::Moving) { + base_state_new[lev].define(ba,dm,BaseState::num_comps,base_state[lev].nGrowVect()); base_state_new[lev].setVal(0.); } @@ -42,7 +45,7 @@ ERF::init_stuff (int lev, const BoxArray& ba, const DistributionMapping& dm, if (solverChoice.use_terrain) { z_phys_cc[lev] = std::make_unique(ba,dm,1,1); - if (solverChoice.terrain_type != TerrainType::Static) + if (solverChoice.terrain_type == TerrainType::Moving) { detJ_cc_new[lev] = std::make_unique(ba,dm,1,1); detJ_cc_src[lev] = std::make_unique(ba,dm,1,1); @@ -65,7 +68,7 @@ ERF::init_stuff (int lev, const BoxArray& ba, const DistributionMapping& dm, int ngrow = ComputeGhostCells(solverChoice.advChoice, solverChoice.use_NumDiff) + 2; tmp_zphys_nd = std::make_unique(ba_nd,dm,1,IntVect(ngrow,ngrow,ngrow)); - if (solverChoice.terrain_type != TerrainType::Static) { + if (solverChoice.terrain_type == TerrainType::Moving) { z_phys_nd_new[lev] = std::make_unique(ba_nd,dm,1,IntVect(ngrow,ngrow,ngrow)); z_phys_nd_src[lev] = std::make_unique(ba_nd,dm,1,IntVect(ngrow,ngrow,ngrow)); } @@ -146,6 +149,12 @@ ERF::init_stuff (int lev, const BoxArray& ba, const DistributionMapping& dm, rW_old[lev].define(convert(ba, IntVect(0,0,1)), dm, 1, ngrow_vels); rW_new[lev].define(convert(ba, IntVect(0,0,1)), dm, 1, ngrow_vels); + if (lev > 0) { + //xmom_crse_rhs[lev].define(convert(ba, IntVect(1,0,0)), dm, 1, IntVect{0}); + //ymom_crse_rhs[lev].define(convert(ba, IntVect(0,1,0)), dm, 1, IntVect{0}); + zmom_crse_rhs[lev].define(convert(ba, IntVect(0,0,1)), dm, 1, IntVect{0}); + } + // We do this here just so they won't be undefined in the initial FillPatch rU_old[lev].setVal(1.2e21); rV_old[lev].setVal(3.4e22); @@ -362,7 +371,7 @@ ERF::update_diffusive_arrays (int lev, const BoxArray& ba, const DistributionMap (solverChoice.turbChoice[lev].pbl_type != PBLType::None) ); bool l_use_kturb = ( (solverChoice.turbChoice[lev].les_type != LESType::None) || (solverChoice.turbChoice[lev].pbl_type != PBLType::None) ); - bool l_use_ddorf = ( solverChoice.turbChoice[lev].les_type == LESType::Deardorff); + bool l_use_ddorf = (solverChoice.turbChoice[lev].les_type == LESType::Deardorff); bool l_use_moist = ( solverChoice.moisture_type != MoistureType::None ); BoxArray ba12 = convert(ba, IntVect(1,1,0)); @@ -557,5 +566,6 @@ ERF::make_physbcs (int lev) m_bc_extdir_vals, m_bc_neumann_vals, solverChoice.terrain_type, z_phys_nd[lev], use_real_bcs, zvel_bc_data[lev].data()); - physbcs_base[lev] = std::make_unique (lev, geom[lev], domain_bcs_type, domain_bcs_type_d); + physbcs_base[lev] = std::make_unique (lev, geom[lev], domain_bcs_type, domain_bcs_type_d, + (solverChoice.terrain_type == TerrainType::Moving)); } diff --git a/Source/ERF_make_new_level.cpp b/Source/ERF_make_new_level.cpp index 64e458e80..dbe285ec8 100644 --- a/Source/ERF_make_new_level.cpp +++ b/Source/ERF_make_new_level.cpp @@ -47,7 +47,9 @@ void ERF::MakeNewLevelFromScratch (int lev, Real time, const BoxArray& ba_in, // Define dmap[lev] to be dm SetDistributionMap(lev, dm); - amrex::Print() <<" BA FROM SCRATCH AT LEVEL " << lev << " " << ba << std::endl; + if (verbose) { + amrex::Print() <<" BA FROM SCRATCH AT LEVEL " << lev << " " << ba << std::endl; + } if (lev == 0) init_bcs(); @@ -61,11 +63,6 @@ void ERF::MakeNewLevelFromScratch (int lev, Real time, const BoxArray& ba_in, m_factory[lev] = std::make_unique(); #endif - // The number of ghost cells for density must be 1 greater than that for velocity - // so that we can go back in forth between velocity and momentum on all faces - // int ngrow_state = ComputeGhostCells(solverChoice.advChoice, solverChoice.use_NumDiff) + 1; - // int ngrow_vels = ComputeGhostCells(solverChoice.advChoice, solverChoice.use_NumDiff); - auto& lev_new = vars_new[lev]; auto& lev_old = vars_old[lev]; @@ -179,7 +176,9 @@ ERF::MakeNewLevelFromCoarse (int lev, Real time, const BoxArray& ba, { AMREX_ALWAYS_ASSERT(lev > 0); - // amrex::Print() <<" NEW BA FROM COARSE AT LEVEL " << lev << " " << ba << std::endl; + if (verbose) { + amrex::Print() <<" NEW BA FROM COARSE AT LEVEL " << lev << " " << ba << std::endl; + } //******************************************************************************************** // This allocates all kinds of things, including but not limited to: solution arrays, @@ -232,7 +231,7 @@ ERF::MakeNewLevelFromCoarse (int lev, Real time, const BoxArray& ba, // InterpFromCoarseLevel(base_state[lev], base_state[lev].nGrowVect(), IntVect(0,0,0), // do not fill ghost cells outside the domain - base_state[lev-1], 0, 0, 3, + base_state[lev-1], 0, 0, base_state[lev].nComp(), geom[lev-1], geom[lev], refRatio(lev-1), &cell_cons_interp, domain_bcs_type, BCVars::cons_bc); @@ -283,7 +282,9 @@ ERF::MakeNewLevelFromCoarse (int lev, Real time, const BoxArray& ba, void ERF::RemakeLevel (int lev, Real time, const BoxArray& ba, const DistributionMapping& dm) { - amrex::Print() <<" REMAKING WITH NEW BA AT LEVEL " << lev << " " << ba << std::endl; + if (verbose) { + amrex::Print() <<" REMAKING WITH NEW BA AT LEVEL " << lev << " " << ba << std::endl; + } AMREX_ALWAYS_ASSERT(lev > 0); AMREX_ALWAYS_ASSERT(solverChoice.terrain_type != TerrainType::Moving); @@ -291,12 +292,13 @@ ERF::RemakeLevel (int lev, Real time, const BoxArray& ba, const DistributionMapp BoxArray ba_old(vars_new[lev][Vars::cons].boxArray()); DistributionMapping dm_old(vars_new[lev][Vars::cons].DistributionMap()); - // amrex::Print() <<" OLD BA AT LEVEL " << lev << " " << ba_old << std::endl; + if (verbose) { + amrex::Print() <<" OLD BA AT LEVEL " << lev << " " << ba_old << std::endl; + } int ncomp_cons = vars_new[lev][Vars::cons].nComp(); IntVect ngrow_state = vars_new[lev][Vars::cons].nGrowVect(); - // int ngrow_state = ComputeGhostCells(solverChoice.advChoice, solverChoice.use_NumDiff) + 1; int ngrow_vels = ComputeGhostCells(solverChoice.advChoice, solverChoice.use_NumDiff); Vector temp_lev_new(Vars::NumTypes); @@ -332,42 +334,40 @@ ERF::RemakeLevel (int lev, Real time, const BoxArray& ba, const DistributionMapp // ***************************************************************************************************** make_physbcs(lev); - // ************************************************************************************************* - // This will fill the temporary MultiFabs with data from vars_new - // NOTE: the momenta here are only used as scratch space, the momenta themselves are not fillpatched - // ************************************************************************************************* - FillPatch(lev, time, {&temp_lev_new[Vars::cons],&temp_lev_new[Vars::xvel], - &temp_lev_new[Vars::yvel],&temp_lev_new[Vars::zvel]}, - {&temp_lev_new[Vars::cons],&rU_new[lev],&rV_new[lev],&rW_new[lev]}, - false); - // ******************************************************************************************** // Update the base state at this level by interpolation from coarser level AND copy // from previous (pre-regrid) base_state array // ******************************************************************************************** - if (lev > 0) { - // Interp all three components: rho, p, pi - int icomp = 0; int bccomp = 0; int ncomp = 3; + Interpolater* mapper = &cell_cons_interp; - Interpolater* mapper = &cell_cons_interp; + Vector fmf = {&base_state[lev ], &base_state[lev ]}; + Vector cmf = {&base_state[lev-1], &base_state[lev-1]}; + Vector ftime = {time, time}; + Vector ctime = {time, time}; - Vector fmf = {&base_state[lev ], &base_state[lev ]}; - Vector cmf = {&base_state[lev-1], &base_state[lev-1]}; - Vector ftime = {time, time}; - Vector ctime = {time, time}; + // Call FillPatch which ASSUMES that all ghost cells at lev-1 have already been filled + FillPatchTwoLevels(temp_base_state, temp_base_state.nGrowVect(), IntVect(0,0,0), + time, cmf, ctime, fmf, ftime, + 0, 0, temp_base_state.nComp(), geom[lev-1], geom[lev], + refRatio(lev-1), mapper, domain_bcs_type, + BCVars::base_bc); - // Call FillPatch which ASSUMES that all ghost cells at lev-1 have already been filled - FillPatchTwoLevels(temp_base_state, temp_base_state.nGrowVect(), IntVect(0,0,0), - time, cmf, ctime, fmf, ftime, - 0, 0, temp_base_state.nComp(), geom[lev-1], geom[lev], - refRatio(lev-1), mapper, domain_bcs_type, - BCVars::base_bc); + // Impose bc's outside the domain + (*physbcs_base[lev])(temp_base_state,0,temp_base_state.nComp(),base_state[lev].nGrowVect()); - // Impose bc's outside the domain - (*physbcs_base[lev])(temp_base_state,icomp,ncomp,base_state[lev].nGrowVect(),time,bccomp); + // ************************************************************************************************* + // This will fill the temporary MultiFabs with data from vars_new + // NOTE: the momenta here are only used as scratch space, the momenta themselves are not fillpatched + // NOTE: we must create the new base state before calling FillPatch because we will + // interpolate perturbational quantities + // ************************************************************************************************* + FillPatch(lev, time, {&temp_lev_new[Vars::cons],&temp_lev_new[Vars::xvel], + &temp_lev_new[Vars::yvel],&temp_lev_new[Vars::zvel]}, + {&temp_lev_new[Vars::cons],&rU_new[lev],&rV_new[lev],&rW_new[lev]}, + base_state[lev], temp_base_state, false); - std::swap(temp_base_state, base_state[lev]); - } + // Now swap the pointers since we needed both old and new in the FillPatch + std::swap(temp_base_state, base_state[lev]); // ******************************************************************************************** // Copy from new into old just in case @@ -448,6 +448,10 @@ ERF::ClearLevel (int lev) rW_new[lev].clear(); rW_old[lev].clear(); + if (lev > 0) { + zmom_crse_rhs[lev].clear(); + } + if (solverChoice.anelastic[lev] == 1) { pp_inc[lev].clear(); } diff --git a/Source/ERF_read_waves.cpp b/Source/ERF_read_waves.cpp index cbc8b83ba..d15eb2b4b 100644 --- a/Source/ERF_read_waves.cpp +++ b/Source/ERF_read_waves.cpp @@ -22,71 +22,68 @@ ERF::read_waves (int lev) for ( MFIter mfi(*Hwave_onegrid[lev],false); mfi.isValid(); ++mfi) { + const auto & bx = mfi.validbox(); + + amrex::Print() << " Just called ERF::read_waves to receive from WW3 " << bx << std::endl; + amrex::Array4 my_H_arr = Hwave_onegrid[lev]->array(mfi); + amrex::Array4 my_L_arr = Lwave_onegrid[lev]->array(mfi); + + Real* my_H_ptr = my_H_arr.dataPtr(); + Real* my_L_ptr = my_L_arr.dataPtr(); + + int rank_offset = amrex::MPMD::MyProc() - amrex::ParallelDescriptor::MyProc(); + int this_root, other_root; + if (rank_offset == 0) { // First program + this_root = 0; + other_root = amrex::ParallelDescriptor::NProcs(); + } else { + this_root = rank_offset; + other_root = 0; + } + + int nx=2147483647; + int ny=2147483647; // sanity check + + //JUST RECEIVED + if (amrex::MPMD::MyProc() == this_root) { + if (rank_offset == 0) // First program + { + MPI_Recv(&nx, 1, MPI_INT, other_root, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + MPI_Recv(&ny, 1, MPI_INT, other_root, 7, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + } + else // Second program + { + MPI_Recv(&nx, 1, MPI_INT, other_root, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + MPI_Recv(&ny, 1, MPI_INT, other_root, 6, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + } + //This may not be necessary + ParallelDescriptor::Bcast(&nx, 1); + ParallelDescriptor::Bcast(&ny, 1); + } + + if((nx)*(ny) > 0) { + int nsealm = (nx)*ny; + + if (amrex::MPMD::MyProc() == this_root) { + if (rank_offset == 0) // the first program + { + MPI_Recv(my_H_ptr, nsealm, MPI_DOUBLE, other_root, 3, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + MPI_Recv(my_L_ptr, nsealm, MPI_DOUBLE, other_root, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + } + else // the second program + { + MPI_Recv(my_H_ptr, nsealm, MPI_DOUBLE, other_root, 2, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + MPI_Recv(my_L_ptr, nsealm, MPI_DOUBLE, other_root, 4, MPI_COMM_WORLD, MPI_STATUS_IGNORE); + } + } - const auto & bx = mfi.validbox(); - - amrex::Print() << " Just called ERF::read_waves to receive from WW3 " << bx << std::endl; - amrex::Array4 my_H_arr = Hwave_onegrid[lev]->array(mfi); - amrex::Array4 my_L_arr = Lwave_onegrid[lev]->array(mfi); - - Real* my_H_ptr = my_H_arr.dataPtr(); - Real* my_L_ptr = my_L_arr.dataPtr(); - - int rank_offset = amrex::MPMD::MyProc() - amrex::ParallelDescriptor::MyProc(); - int this_root, other_root; - if (rank_offset == 0) { // First program - this_root = 0; - other_root = amrex::ParallelDescriptor::NProcs(); - } else { - this_root = rank_offset; - other_root = 0; - } - - - int nx=2147483647; - int ny=2147483647; // sanity check - - //JUST RECEIVED - if (amrex::MPMD::MyProc() == this_root) { - if (rank_offset == 0) // First program - { - MPI_Recv(&nx, 1, MPI_INT, other_root, 1, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - MPI_Recv(&ny, 1, MPI_INT, other_root, 7, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - } - else // Second program - { - MPI_Recv(&nx, 1, MPI_INT, other_root, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - MPI_Recv(&ny, 1, MPI_INT, other_root, 6, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - } - //This may not be necessary - ParallelDescriptor::Bcast(&nx, 1); - ParallelDescriptor::Bcast(&ny, 1); - } - - if((nx)*(ny) > 0) { - int nsealm = (nx)*ny; - - if (amrex::MPMD::MyProc() == this_root) { - if (rank_offset == 0) // the first program - { - MPI_Recv(my_H_ptr, nsealm, MPI_DOUBLE, other_root, 3, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - MPI_Recv(my_L_ptr, nsealm, MPI_DOUBLE, other_root, 5, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - } - else // the second program - { - MPI_Recv(my_H_ptr, nsealm, MPI_DOUBLE, other_root, 2, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - MPI_Recv(my_L_ptr, nsealm, MPI_DOUBLE, other_root, 4, MPI_COMM_WORLD, MPI_STATUS_IGNORE); - } - } - - amrex::AllPrintToFile("output_HS_cpp.txt")<ParallelCopy(*Hwave_onegrid[lev]); @@ -99,21 +96,24 @@ ERF::read_waves (int lev) Box bx = mfi.tilebox(); const Array4& Hwave_arr = Hwave[lev]->const_array(mfi); const Array4& Lmask_arr = lmask_lev[lev][0]->array(mfi); - ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k){ + ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) + { if (Hwave_arr(i,j,k)<0) { Lmask_arr(i,j,k) = 1; - } else { + } else { Lmask_arr(i,j,k) = 0; } }); } - // amrex::Real myclock = ParallelDescriptor::second(); - // amrex::AllPrintToFile("timer.txt") << "At " << myclock << " seconds, I reached the end of read_waves" << std::endl; + // amrex::Real myclock = ParallelDescriptor::second(); + // amrex::AllPrintToFile("timer.txt") << "At " << myclock << " seconds, I reached the end of read_waves" << std::endl; timedif = ( ((double) clock()) / CLOCKS_PER_SEC) - clkStart; - amrex::AllPrintToFile("timer.txt") << "It took " << timedif << " seconds to reach the end of read_waves" << std::endl; + amrex::AllPrintToFile("timer.txt") << "It took " << timedif + << " seconds to reach the end of read_waves" + << std::endl; } void @@ -168,12 +168,8 @@ ERF::send_to_ww3 (int lev) // Initialize Multifabs to store x_avg, y_avg, u_mag, u_dir at cell centers MultiFab x_avg(lev_new[Vars::cons].boxArray(), lev_new[Vars::cons].DistributionMap(), 1, lev_new[Vars::cons].nGrowVect()); - MultiFab y_avg(lev_new[Vars::cons].boxArray(), lev_new[Vars::cons].DistributionMap(), 1, lev_new[Vars::cons].nGrowVect()); - MultiFab u_mag(lev_new[Vars::cons].boxArray(), lev_new[Vars::cons].DistributionMap(), 1, lev_new[Vars::cons].nGrowVect()); - - MultiFab u_dir(lev_new[Vars::cons].boxArray(), lev_new[Vars::cons].DistributionMap(), 1, lev_new[Vars::cons].nGrowVect()); @@ -191,7 +187,10 @@ ERF::send_to_ww3 (int lev) ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k){ u_vel(i,j,k) = 0.5 *( velx_arr(i,j,k) + velx_arr(i+1,j,k) ); - amrex::AllPrintToFile("uvel.txt") << amrex::IntVect(i,j,k) << " [" <> theta_onegrid; - // create a new BoxArray and DistributionMapping for a MultiFab with 1 box - BoxArray ba_onegrid(geom[lev].Domain()); - BoxList bl2d_onegrid = ba_onegrid.boxList(); - for (auto& b : bl2d_onegrid) { - b.setRange(2,0); - } - BoxArray ba2d_onegrid(std::move(bl2d_onegrid)); - Vector pmap; - pmap.resize(1); - pmap[0]=0; - DistributionMapping dm_onegrid(ba2d_onegrid); - dm_onegrid.define(pmap); - - ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k){ + // create a new BoxArray and DistributionMapping for a MultiFab with 1 box + BoxArray ba_onegrid(geom[lev].Domain()); + BoxList bl2d_onegrid = ba_onegrid.boxList(); + for (auto& b : bl2d_onegrid) { + b.setRange(2,0); + } + BoxArray ba2d_onegrid(std::move(bl2d_onegrid)); + Vector pmap; + pmap.resize(1); + pmap[0]=0; + DistributionMapping dm_onegrid(ba2d_onegrid); + dm_onegrid.define(pmap); - // magnitude(i,j,k) = std::sqrt( pow(u(i,j,k), 2) + pow(v(i,j,k), 2) ); + ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) + { + //magnitude(i,j,k) = std::sqrt( pow(u(i,j,k), 2) + pow(v(i,j,k), 2) ); double u_val = u(i, j, k); double v_val = v(i, j, k); @@ -257,47 +259,49 @@ ERF::send_to_ww3 (int lev) theta(i,j,k) = atan ( v_val / u_val ); } - - amrex::AllPrintToFile("mag_theta.txt") << amrex::IntVect(i,j,k) << " Magnitude: " << magnitude(i,j,k) << " Theta: " << theta(i,j,k) < magnitude_values(n_elements); - std::vector theta_values(n_elements); - std::vector indices(n_elements); - // Copy values - int counter = 0; - for (BoxIterator bi(slice_box_ref); bi.ok(); ++bi) { - IntVect iv = bi(); - magnitude_values[counter] = magnitude(iv); - theta_values[counter] = theta(iv); - indices[counter] = iv; - ++counter; - } -// timedif2 = ( ((double) clock()) / CLOCKS_PER_SEC) - clkStart2; -// amrex::AllPrintToFile("timer.txt") << "It took " << (double) timedif2 << " seconds to reach the part before sending" << std::endl; -//amrex::Print() << "It took " << (double) timedif2 << " seconds to reach the part before sending" << std::endl; - -// Print magnitude values and corresponding IntVect indices -for (int j = 0; j < n_elements; ++j) { - amrex::AllPrintToFile("debug_send.txt") - << "dz, k_ref " << dz << ", " << k_ref << " " - << "Index: " << j - << ", IntVect: (" << indices[j][0] << ", " << indices[j][1] << ", " << indices[j][2] << ")" - << ", Magnitude: " << magnitude_values[j] - << ", Theta: " << theta_values[j] - << std::endl; -} + // Calculate the number of elements in the current box + int n_elements = slice_box_ref.numPts(); + + // Initialize vectors to send to WW3 + std::vector magnitude_values(n_elements); + std::vector theta_values(n_elements); + std::vector indices(n_elements); + // Copy values + int counter = 0; + for (BoxIterator bi(slice_box_ref); bi.ok(); ++bi) { + IntVect iv = bi(); + magnitude_values[counter] = magnitude(iv); + theta_values[counter] = theta(iv); + indices[counter] = iv; + ++counter; + } + + // timedif2 = ( ((double) clock()) / CLOCKS_PER_SEC) - clkStart2; + // amrex::AllPrintToFile("timer.txt") << "It took " << (double) timedif2 << " seconds to reach the part before sending" << std::endl; + //amrex::Print() << "It took " << (double) timedif2 << " seconds to reach the part before sending" << std::endl; + + // Print magnitude values and corresponding IntVect indices + for (int j = 0; j < n_elements; ++j) { + amrex::AllPrintToFile("debug_send.txt") + << "dz, k_ref " << dz << ", " << k_ref << " " + << "Index: " << j + << ", IntVect: (" << indices[j][0] << ", " << indices[j][1] << ", " << indices[j][2] << ")" + << ", Magnitude: " << magnitude_values[j] + << ", Theta: " << theta_values[j] + << std::endl; + } int rank_offset = amrex::MPMD::MyProc() - amrex::ParallelDescriptor::MyProc(); int this_root, other_root; @@ -309,35 +313,32 @@ for (int j = 0; j < n_elements; ++j) { other_root = 0; } - amrex::Print()<< "Sending " << n_elements << " from ERF::send_to_ww3 now" << std::endl; if (amrex::MPMD::MyProc() == this_root) { - if (rank_offset == 0) // First program - { - MPI_Send(&n_elements, 1, MPI_INT, other_root, 11, MPI_COMM_WORLD); -MPI_Send(magnitude_values.data(), n_elements, MPI_DOUBLE, other_root, 13, MPI_COMM_WORLD); -MPI_Send(theta_values.data(), n_elements, MPI_DOUBLE, other_root, 15, MPI_COMM_WORLD); + if (rank_offset == 0) { // First program + MPI_Send(&n_elements, 1, MPI_INT, other_root, 11, MPI_COMM_WORLD); + MPI_Send(magnitude_values.data(), n_elements, MPI_DOUBLE, other_root, 13, MPI_COMM_WORLD); + MPI_Send(theta_values.data(), n_elements, MPI_DOUBLE, other_root, 15, MPI_COMM_WORLD); } else // Second program { MPI_Send(&n_elements, 1, MPI_INT, other_root, 10, MPI_COMM_WORLD); -MPI_Send(magnitude_values.data(), n_elements, MPI_DOUBLE, other_root, 12, MPI_COMM_WORLD); -MPI_Send(theta_values.data(), n_elements, MPI_DOUBLE, other_root, 14, MPI_COMM_WORLD); + MPI_Send(magnitude_values.data(), n_elements, MPI_DOUBLE, other_root, 12, MPI_COMM_WORLD); + MPI_Send(theta_values.data(), n_elements, MPI_DOUBLE, other_root, 14, MPI_COMM_WORLD); //MPI_Recv(&nx, 1, MPI_INT, other_root, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE); //MPI_Recv(&ny, 1, MPI_INT, other_root, 6, MPI_COMM_WORLD, MPI_STATUS_IGNORE); } } - timedif = ( ((double) clock()) / CLOCKS_PER_SEC) - clkStart; - -// amrex::Real myclock = ParallelDescriptor::second(); -// amrex::AllPrintToFile("timer.txt") << "At " << myclock << " seconds I reached the end of send_to_ww3" << std::endl; + timedif = ( ((double) clock()) / CLOCKS_PER_SEC) - clkStart; - amrex::AllPrintToFile("timer.txt") << "It took " << timedif << " seconds to reach the end of send_to_WW3" << std::endl; - - -} + // amrex::Real myclock = ParallelDescriptor::second(); + // amrex::AllPrintToFile("timer.txt") << "At " << myclock << " seconds I reached the end of send_to_ww3" << std::endl; + amrex::AllPrintToFile("timer.txt") << "It took " << timedif + << " seconds to reach the end of send_to_WW3" + << std::endl; + } // mfi } #endif diff --git a/Source/IO/ERF_Checkpoint.cpp b/Source/IO/ERF_Checkpoint.cpp index 7a3452a51..9137bace2 100644 --- a/Source/IO/ERF_Checkpoint.cpp +++ b/Source/IO/ERF_Checkpoint.cpp @@ -131,14 +131,23 @@ ERF::WriteCheckpointFile () const VisMF::Write(zvel, MultiFabFileFullPrefix(lev, checkpointname, "Level_", "ZFace")); // Note that we write the ghost cells of the base state (unlike above) - IntVect ng = base_state[lev].nGrowVect(); - MultiFab base(grids[lev],dmap[lev],base_state[lev].nComp(),ng); - MultiFab::Copy(base,base_state[lev],0,0,base.nComp(),ng); + // For backward compatibility we only write the first components and 1 ghost cell + IntVect ng_base; int ncomp_base; + bool write_old_base_state = true; + if (write_old_base_state) { + ng_base = IntVect{1}; + ncomp_base = 3; + } else { + ng_base = base_state[lev].nGrowVect(); + ncomp_base = base_state[lev].nComp(); + } + MultiFab base(grids[lev],dmap[lev],ncomp_base,ng_base); + MultiFab::Copy(base,base_state[lev],0,0,ncomp_base,ng_base); VisMF::Write(base, MultiFabFileFullPrefix(lev, checkpointname, "Level_", "BaseState")); if (solverChoice.use_terrain) { // Note that we also write the ghost cells of z_phys_nd - ng = z_phys_nd[lev]->nGrowVect(); + IntVect ng = z_phys_nd[lev]->nGrowVect(); MultiFab z_height(convert(grids[lev],IntVect(1,1,1)),dmap[lev],1,ng); MultiFab::Copy(z_height,*z_phys_nd[lev],0,0,1,ng); VisMF::Write(z_height, MultiFabFileFullPrefix(lev, checkpointname, "Level_", "Z_Phys_nd")); @@ -151,10 +160,10 @@ ERF::WriteCheckpointFile () const micro->Get_Qmoist_Restart_Vars(lev, solverChoice, qmoist_indices, qmoist_names); int qmoist_nvar = qmoist_indices.size(); for (int var = 0; var < qmoist_nvar; var++) { - ng = qmoist[lev][qmoist_indices[var]]->nGrowVect(); + IntVect ng_moist = qmoist[lev][qmoist_indices[var]]->nGrowVect(); const int ncomp = 1; - MultiFab moist_vars(grids[lev],dmap[lev],ncomp,ng); - MultiFab::Copy(moist_vars,*(qmoist[lev][qmoist_indices[var]]),0,0,ncomp,ng); + MultiFab moist_vars(grids[lev],dmap[lev],ncomp,ng_moist); + MultiFab::Copy(moist_vars,*(qmoist[lev][qmoist_indices[var]]),0,0,ncomp,ng_moist); VisMF::Write(moist_vars, amrex::MultiFabFileFullPrefix(lev, checkpointname, "Level_", qmoist_names[var])); } @@ -162,9 +171,9 @@ ERF::WriteCheckpointFile () const if(solverChoice.windfarm_type == WindFarmType::Fitch or solverChoice.windfarm_type == WindFarmType::EWP or solverChoice.windfarm_type == WindFarmType::SimpleAD){ - ng = Nturb[lev].nGrowVect(); - MultiFab mf_Nturb(grids[lev],dmap[lev],1,ng); - MultiFab::Copy(mf_Nturb,Nturb[lev],0,0,1,ng); + IntVect ng_turb = Nturb[lev].nGrowVect(); + MultiFab mf_Nturb(grids[lev],dmap[lev],1,ng_turb); + MultiFab::Copy(mf_Nturb,Nturb[lev],0,0,1,ng_turb); VisMF::Write(mf_Nturb, amrex::MultiFabFileFullPrefix(lev, checkpointname, "Level_", "NumTurb")); } #endif @@ -173,7 +182,7 @@ ERF::WriteCheckpointFile () const for (int mvar(0); mvarboxArray(); DistributionMapping dm = lsm_data[lev][mvar]->DistributionMap(); - ng = lsm_data[lev][mvar]->nGrowVect(); + IntVect ng = lsm_data[lev][mvar]->nGrowVect(); int nvar = lsm_data[lev][mvar]->nComp(); MultiFab lsm_vars(ba,dm,nvar,ng); MultiFab::Copy(lsm_vars,*(lsm_data[lev][mvar]),0,0,nvar,ng); @@ -188,7 +197,7 @@ ERF::WriteCheckpointFile () const } BoxArray ba2d(std::move(bl2d)); - ng = mapfac_m[lev]->nGrowVect(); + IntVect ng = mapfac_m[lev]->nGrowVect(); MultiFab mf_m(ba2d,dmap[lev],1,ng); MultiFab::Copy(mf_m,*mapfac_m[lev],0,0,1,ng); VisMF::Write(mf_m, MultiFabFileFullPrefix(lev, checkpointname, "Level_", "MapFactor_m")); @@ -353,15 +362,38 @@ ERF::ReadCheckpointFile () // ncomp is only valid after we MakeNewLevelFromScratch (asks micro how many vars) // NOTE: Data is written over ncomp, so check that we match the header file int ncomp_cons = vars_new[0][Vars::cons].nComp(); - AMREX_ASSERT(chk_ncomp_cons == ncomp_cons); + + // NOTE: QKE was removed so this is for backward compatibility + AMREX_ASSERT((chk_ncomp_cons==ncomp_cons) || ((chk_ncomp_cons-1)==ncomp_cons)); // read in the MultiFab data for (int lev = 0; lev <= finest_level; ++lev) { - MultiFab cons(grids[lev],dmap[lev],ncomp_cons,0); - VisMF::Read(cons, MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "Cell")); - MultiFab::Copy(vars_new[lev][Vars::cons],cons,0,0,ncomp_cons,0); - vars_new[lev][Vars::cons].setBndry(1.0e34); + // NOTE: For backward compatibility (chk file has QKE) + if ((chk_ncomp_cons-1)==ncomp_cons) { + MultiFab cons(grids[lev],dmap[lev],chk_ncomp_cons,0); + VisMF::Read(cons, MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "Cell")); + + // Copy up to RhoKE_comp + MultiFab::Copy(vars_new[lev][Vars::cons],cons,0,0,(RhoKE_comp+1),0); + + // Only if we have a PBL model do we need to copy QKE is src to KE in dst + if (solverChoice.turbChoice[lev].pbl_type == PBLType::MYNN25) { + MultiFab::Copy(vars_new[lev][Vars::cons],cons,(RhoKE_comp+1),RhoKE_comp,1,0); + vars_new[lev][Vars::cons].mult(0.5,RhoKE_comp,1,0); + } + + // Copy other components + int ncomp_remainder = ncomp_cons - (RhoKE_comp + 1); + MultiFab::Copy(vars_new[lev][Vars::cons],cons,(RhoKE_comp+2),(RhoKE_comp+1),ncomp_remainder,0); + + vars_new[lev][Vars::cons].setBndry(1.0e34); + } else { + MultiFab cons(grids[lev],dmap[lev],ncomp_cons,0); + VisMF::Read(cons, MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "Cell")); + MultiFab::Copy(vars_new[lev][Vars::cons],cons,0,0,ncomp_cons,0); + vars_new[lev][Vars::cons].setBndry(1.0e34); + } MultiFab xvel(convert(grids[lev],IntVect(1,0,0)),dmap[lev],1,0); VisMF::Read(xvel, MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "XFace")); @@ -379,15 +411,38 @@ ERF::ReadCheckpointFile () vars_new[lev][Vars::zvel].setBndry(1.0e34); // Note that we read the ghost cells of the base state (unlike above) - IntVect ng = base_state[lev].nGrowVect(); - MultiFab base(grids[lev],dmap[lev],base_state[lev].nComp(),ng); + + // The original base state only had 3 components and 1 ghost cell -- we read this + // here to be consistent with the old style + IntVect ng_base; int ncomp_base; + bool read_old_base_state = true; + if (read_old_base_state) { + ng_base = IntVect{1}; + ncomp_base = 3; + } else { + ng_base = base_state[lev].nGrowVect(); + ncomp_base = base_state[lev].nComp(); + } + MultiFab base(grids[lev],dmap[lev],ncomp_base,ng_base); VisMF::Read(base, MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "BaseState")); - MultiFab::Copy(base_state[lev],base,0,0,base.nComp(),ng); + MultiFab::Copy(base_state[lev],base,0,0,ncomp_base,ng_base); + if (read_old_base_state) { + for (MFIter mfi(base_state[lev],TilingIfNotGPU()); mfi.isValid(); ++mfi) + { + const Box& bx = mfi.growntilebox(1); + Array4 const& fab = base_state[lev].array(mfi); + amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) + { + fab(i,j,k,BaseState::th0_comp) = getRhoThetagivenP(fab(i,j,k,BaseState::p0_comp)) + / fab(i,j,k,BaseState::r0_comp); + }); + } + } base_state[lev].FillBoundary(geom[lev].periodicity()); if (solverChoice.use_terrain) { // Note that we also read the ghost cells of z_phys_nd - ng = z_phys_nd[lev]->nGrowVect(); + IntVect ng = z_phys_nd[lev]->nGrowVect(); MultiFab z_height(convert(grids[lev],IntVect(1,1,1)),dmap[lev],1,ng); VisMF::Read(z_height, MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "Z_Phys_nd")); MultiFab::Copy(*z_phys_nd[lev],z_height,0,0,1,ng); @@ -400,11 +455,11 @@ ERF::ReadCheckpointFile () micro->Get_Qmoist_Restart_Vars(lev, solverChoice, qmoist_indices, qmoist_names); int qmoist_nvar = qmoist_indices.size(); for (int var = 0; var < qmoist_nvar; var++) { - ng = qmoist[lev][qmoist_indices[var]]->nGrowVect(); - const int ncomp = 1; - MultiFab moist_vars(grids[lev],dmap[lev],ncomp,ng); + IntVect ng_moist = qmoist[lev][qmoist_indices[var]]->nGrowVect(); + const int ncomp_moist = 1; + MultiFab moist_vars(grids[lev],dmap[lev],ncomp_moist,ng_moist); VisMF::Read(moist_vars, amrex::MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", qmoist_names[var])); - MultiFab::Copy(*(qmoist[lev][qmoist_indices[var]]),moist_vars,0,0,ncomp,ng); + MultiFab::Copy(*(qmoist[lev][qmoist_indices[var]]),moist_vars,0,0,ncomp_moist,ng_moist); } #if defined(ERF_USE_WINDFARM) @@ -422,7 +477,7 @@ ERF::ReadCheckpointFile () for (int mvar(0); mvarboxArray(); DistributionMapping dm = lsm_data[lev][mvar]->DistributionMap(); - ng = lsm_data[lev][mvar]->nGrowVect(); + IntVect ng = lsm_data[lev][mvar]->nGrowVect(); int nvar = lsm_data[lev][mvar]->nComp(); MultiFab lsm_vars(ba,dm,nvar,ng); VisMF::Read(lsm_vars, MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "LsmVars")); @@ -437,7 +492,8 @@ ERF::ReadCheckpointFile () } BoxArray ba2d(std::move(bl2d)); - ng = mapfac_m[lev]->nGrowVect(); + { + IntVect ng = mapfac_m[lev]->nGrowVect(); MultiFab mf_m(ba2d,dmap[lev],1,ng); VisMF::Read(mf_m, MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "MapFactor_m")); MultiFab::Copy(*mapfac_m[lev],mf_m,0,0,1,ng); @@ -451,6 +507,7 @@ ERF::ReadCheckpointFile () MultiFab mf_v(convert(ba2d,IntVect(0,1,0)),dmap[lev],1,ng); VisMF::Read(mf_v, MultiFabFileFullPrefix(lev, restart_chkfile, "Level_", "MapFactor_v")); MultiFab::Copy(*mapfac_v[lev],mf_v,0,0,1,ng); + } } #ifdef ERF_USE_PARTICLES diff --git a/Source/IO/ERF_NCColumnFile.cpp b/Source/IO/ERF_NCColumnFile.cpp index eba2f2931..68720d353 100644 --- a/Source/IO/ERF_NCColumnFile.cpp +++ b/Source/IO/ERF_NCColumnFile.cpp @@ -121,10 +121,16 @@ ERF::writeToNCColumnFile (const int lev, // Need data in one grow cell for interpolation // Note that vars_new is what's filled here; rU_new/rV_new/rW_new are just used as scratch space - FillPatch(lev, t_new[lev], {&vars_new[lev][Vars::cons], &vars_new[lev][Vars::xvel], - &vars_new[lev][Vars::yvel], &vars_new[lev][Vars::zvel]}, - {&vars_new[lev][Vars::cons], &rU_new[lev], - &rV_new[lev], &rW_new[lev]}); + if (lev == 0) { + FillPatch(lev, t_new[lev], {&vars_new[lev][Vars::cons], &vars_new[lev][Vars::xvel], + &vars_new[lev][Vars::yvel], &vars_new[lev][Vars::zvel]}); + } else { + FillPatch(lev, t_new[lev], {&vars_new[lev][Vars::cons], &vars_new[lev][Vars::xvel], + &vars_new[lev][Vars::yvel], &vars_new[lev][Vars::zvel]}, + {&vars_new[lev][Vars::cons], &rU_new[lev], + &rV_new[lev], &rW_new[lev]}, + base_state[lev], base_state[lev]); + } MultiFab& S_new = vars_new[lev][Vars::cons]; MultiFab& U_new = vars_new[lev][Vars::xvel]; diff --git a/Source/IO/ERF_Plotfile.cpp b/Source/IO/ERF_Plotfile.cpp index 75557acd4..100ed7458 100644 --- a/Source/IO/ERF_Plotfile.cpp +++ b/Source/IO/ERF_Plotfile.cpp @@ -183,7 +183,7 @@ ERF::PlotFileVarNames (Vector plot_var_names ) // Write plotfile to disk void -ERF::WritePlotFile (int which, Vector plot_var_names) +ERF::WritePlotFile (int which, PlotFileType plotfile_type, Vector plot_var_names) { const Vector varnames = PlotFileVarNames(plot_var_names); const int ncomp_mf = varnames.size(); @@ -196,12 +196,18 @@ ERF::WritePlotFile (int which, Vector plot_var_names) // which require ghost cells to be filled. We do not need to call FillPatcher // because we don't need to set interior fine points. // NOTE: the momenta here are only used as scratch space, the momenta themselves are not fillpatched - for (int lev = 0; lev <= finest_level; ++lev) { + + // Level 0 FilLPatch + FillPatch(0, t_new[0], {&vars_new[0][Vars::cons], &vars_new[0][Vars::xvel], + &vars_new[0][Vars::yvel], &vars_new[0][Vars::zvel]}); + + for (int lev = 1; lev <= finest_level; ++lev) { bool fillset = false; FillPatch(lev, t_new[lev], {&vars_new[lev][Vars::cons], &vars_new[lev][Vars::xvel], &vars_new[lev][Vars::yvel], &vars_new[lev][Vars::zvel]}, - {&vars_new[lev][Vars::cons], &rU_new[lev], - &rV_new[lev], &rW_new[lev]}, fillset); + {&vars_new[lev][Vars::cons], + &rU_new[lev], &rV_new[lev], &rW_new[lev]}, + base_state[lev], base_state[lev], fillset); } // Get qmoist pointers if using moisture @@ -331,7 +337,6 @@ ERF::WritePlotFile (int which, Vector plot_var_names) } calculate_derived("theta", vars_new[lev][Vars::cons], derived::erf_dertheta); calculate_derived("KE", vars_new[lev][Vars::cons], derived::erf_derKE); - calculate_derived("QKE", vars_new[lev][Vars::cons], derived::erf_derQKE); calculate_derived("scalar", vars_new[lev][Vars::cons], derived::erf_derscalar); calculate_derived("vorticity_x", mf_cc_vel[lev] , derived::erf_dervortx); calculate_derived("vorticity_y", mf_cc_vel[lev] , derived::erf_dervorty); @@ -972,8 +977,8 @@ ERF::WritePlotFile (int which, Vector plot_var_names) MultiFab::Copy(mf[lev],*eddyDiffs_lev[lev],EddyDiff::Theta_h,mf_comp,1,0); mf_comp ++; } - if (containerHasElement(plot_var_names, "Lpbl")) { - MultiFab::Copy(mf[lev],*eddyDiffs_lev[lev],EddyDiff::PBL_lengthscale,mf_comp,1,0); + if (containerHasElement(plot_var_names, "Lturb")) { + MultiFab::Copy(mf[lev],*eddyDiffs_lev[lev],EddyDiff::Turb_lengthscale,mf_comp,1,0); mf_comp ++; } @@ -1338,10 +1343,11 @@ ERF::WritePlotFile (int which, Vector plot_var_names) } std::string plotfilename; - if (which == 1) + if (which == 1) { plotfilename = Concatenate(plot_file_1, istep[0], 5); - else if (which == 2) + } else if (which == 2) { plotfilename = Concatenate(plot_file_2, istep[0], 5); + } // LSM writes it's own data if (which==1 && plot_lsm) { @@ -1359,7 +1365,8 @@ ERF::WritePlotFile (int which, Vector plot_var_names) // Single level if (finest_level == 0) { - if (plotfile_type == "amrex") { + if (plotfile_type == PlotFileType::Amrex) + { Print() << "Writing native plotfile " << plotfilename << "\n"; if (solverChoice.use_terrain) { WriteMultiLevelPlotfileWithTerrain(plotfilename, finest_level+1, @@ -1379,7 +1386,7 @@ ERF::WritePlotFile (int which, Vector plot_var_names) particleData.writePlotFile(plotfilename); #endif #ifdef ERF_USE_HDF5 - } else if (plotfile_type == "hdf5" || plotfile_type == "HDF5") { + } else if (plotfile_type == PlotFileType::HDF5) { Print() << "Writing plotfile " << plotfilename+"d01.h5" << "\n"; WriteMultiLevelPlotfileHDF5(plotfilename, finest_level+1, GetVecOfConstPtrs(mf), @@ -1387,26 +1394,31 @@ ERF::WritePlotFile (int which, Vector plot_var_names) Geom(), t_new[0], istep, refRatio()); #endif #ifdef ERF_USE_NETCDF - } else if (plotfile_type == "netcdf" || plotfile_type == "NetCDF") { + } else if (plotfile_type == PlotFileType::Netcdf) { int lev = 0; int l_which = 0; writeNCPlotFile(lev, l_which, plotfilename, GetVecOfConstPtrs(mf), varnames, istep, t_new[0]); #endif } else { - Print() << "User specified plot_filetype = " << plotfile_type << std::endl; - Abort("Dont know this plot_filetype"); + // Here we assume the plotfile_type is PlotFileType::None + Print() << "Writing no plotfile since plotfile_type is none" << std::endl; } } else { // Multilevel - if (plotfile_type == "amrex") { + if (plotfile_type == PlotFileType::Amrex) { int lev0 = 0; int desired_ratio = std::max(std::max(ref_ratio[lev0][0],ref_ratio[lev0][1]),ref_ratio[lev0][2]); - bool any_ratio_one = ( ( (ref_ratio[lev0][0] == 0) || (ref_ratio[lev0][1] == 0) ) || - (ref_ratio[lev0][2] == 0) ); + bool any_ratio_one = ( ( (ref_ratio[lev0][0] == 1) || (ref_ratio[lev0][1] == 1) ) || + (ref_ratio[lev0][2] == 1) ); + for (int lev = 1; lev < finest_level; lev++) { + any_ratio_one = any_ratio_one || + ( ( (ref_ratio[lev][0] == 1) || (ref_ratio[lev][1] == 1) ) || + (ref_ratio[lev][2] == 1) ); + } - if (any_ratio_one == 1 && m_expand_plotvars_to_unif_rr) + if (any_ratio_one && m_expand_plotvars_to_unif_rr) { Vector r2(finest_level); Vector g2(finest_level+1); @@ -1428,9 +1440,9 @@ ERF::WritePlotFile (int which, Vector plot_var_names) for (int lev = 1; lev <= finest_level; ++lev) { if (lev > 1) { - r2[lev-1][0] *= desired_ratio / ref_ratio[lev-1][0]; - r2[lev-1][1] *= desired_ratio / ref_ratio[lev-1][1]; - r2[lev-1][2] *= desired_ratio / ref_ratio[lev-1][2]; + r2[lev-1][0] = r2[lev-2][0] * desired_ratio / ref_ratio[lev-1][0]; + r2[lev-1][1] = r2[lev-2][1] * desired_ratio / ref_ratio[lev-1][1]; + r2[lev-1][2] = r2[lev-2][2] * desired_ratio / ref_ratio[lev-1][2]; } mf2[lev].define(refine(grids[lev],r2[lev-1]), dmap[lev], ncomp_mf, 0); @@ -1492,7 +1504,7 @@ ERF::WritePlotFile (int which, Vector plot_var_names) #endif #ifdef ERF_USE_NETCDF - } else if (plotfile_type == "netcdf" || plotfile_type == "NetCDF") { + } else if (plotfile_type == PlotFileType::Netcdf) { for (int lev = 0; lev <= finest_level; ++lev) { for (int which_box = 0; which_box < num_boxes_at_level[lev]; which_box++) { writeNCPlotFile(lev, which_box, plotfilename, GetVecOfConstPtrs(mf), varnames, istep, t_new[0]); diff --git a/Source/IO/ERF_ReadBndryPlanes.H b/Source/IO/ERF_ReadBndryPlanes.H index 8435daedc..e6dd27e5e 100644 --- a/Source/IO/ERF_ReadBndryPlanes.H +++ b/Source/IO/ERF_ReadBndryPlanes.H @@ -45,7 +45,6 @@ public: [[nodiscard]] int ingested_q1() const {return is_q1_read;} [[nodiscard]] int ingested_q2() const {return is_q2_read;} [[nodiscard]] int ingested_KE() const {return is_KE_read;} - [[nodiscard]] int ingested_QKE() const {return is_QKE_read;} private: @@ -101,7 +100,6 @@ private: int is_q1_read; int is_q2_read; int is_KE_read; - int is_QKE_read; int last_file_read; }; diff --git a/Source/IO/ERF_ReadBndryPlanes.cpp b/Source/IO/ERF_ReadBndryPlanes.cpp index b95710f38..fff5d425c 100644 --- a/Source/IO/ERF_ReadBndryPlanes.cpp +++ b/Source/IO/ERF_ReadBndryPlanes.cpp @@ -159,7 +159,6 @@ ReadBndryPlanes::ReadBndryPlanes (const Geometry& geom, const Real& rdOcp_in) is_q1_read = 0; is_q2_read = 0; is_KE_read = 0; - is_QKE_read = 0; if (pp.contains("bndry_input_var_names")) { @@ -175,7 +174,6 @@ ReadBndryPlanes::ReadBndryPlanes (const Geometry& geom, const Real& rdOcp_in) if (m_var_names[i] == "qv") is_q1_read = 1; if (m_var_names[i] == "qc") is_q2_read = 1; if (m_var_names[i] == "ke") is_KE_read = 1; - if (m_var_names[i] == "qke") is_QKE_read = 1; } } @@ -415,7 +413,6 @@ void ReadBndryPlanes::read_file (const int idx, if (var_name == "theta") n_offset = BCVars::RhoTheta_bc_comp; if (var_name == "temperature") n_offset = BCVars::RhoTheta_bc_comp; if (var_name == "ke") n_offset = BCVars::RhoKE_bc_comp; - if (var_name == "qke") n_offset = BCVars::RhoQKE_bc_comp; if (var_name == "scalar") n_offset = BCVars::RhoScalar_bc_comp; if (var_name == "qv") n_offset = BCVars::RhoQ1_bc_comp; if (var_name == "qc") n_offset = BCVars::RhoQ2_bc_comp; @@ -480,7 +477,7 @@ void ReadBndryPlanes::read_file (const int idx, bndry_mf_arr(i, j, k, 0) = 0.5 * (R1*Th1 + R2*Th2); }); } else if (var_name == "scalar" || var_name == "qv" || var_name == "qc" || - var_name == "ke" || var_name == "qke") { + var_name == "ke") { ParallelFor( bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { Real R1 = bndry_read_r_arr(i, j, k, 0); @@ -510,7 +507,7 @@ void ReadBndryPlanes::read_file (const int idx, bndry_mf_arr(i, j, k, 0) = 0.5 * (R1*Th1 + R2*Th2); }); } else if (var_name == "scalar" || var_name == "qv" || var_name == "qc" || - var_name == "ke" || var_name == "qke") { + var_name == "ke") { ParallelFor( bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { Real R1 = l_bc_extdir_vals_d[BCVars::Rho_bc_comp][ori]; diff --git a/Source/IO/ERF_Write1DProfiles.cpp b/Source/IO/ERF_Write1DProfiles.cpp index 450515a7a..d49d10567 100644 --- a/Source/IO/ERF_Write1DProfiles.cpp +++ b/Source/IO/ERF_Write1DProfiles.cpp @@ -210,8 +210,8 @@ ERF::derive_diag_profiles(Real /*time*/, bool l_use_kturb = ((solverChoice.turbChoice[lev].les_type != LESType::None) || (solverChoice.turbChoice[lev].pbl_type != PBLType::None)); - bool l_use_KE = (solverChoice.turbChoice[lev].les_type == LESType::Deardorff); - bool l_use_QKE = solverChoice.turbChoice[lev].use_QKE; + bool l_use_KE = ( (solverChoice.turbChoice[lev].les_type == LESType::Deardorff) || + (solverChoice.turbChoice[lev].pbl_type == PBLType::MYNN25) ); // This will hold rho, theta, ksgs, Kmh, Kmv, uu, uv, uw, vv, vw, ww, uth, vth, wth, // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 @@ -263,7 +263,7 @@ ERF::derive_diag_profiles(Real /*time*/, int nvars = vars_new[lev][Vars::cons].nComp(); MultiFab mf_cons(vars_new[lev][Vars::cons], make_alias, 0, nvars); - MultiFab p_hse (base_state[lev], make_alias, 1, 1); // p_0 is second component + MultiFab p_hse (base_state[lev], make_alias, BaseState::p0_comp, 1); bool use_moisture = (solverChoice.moisture_type != MoistureType::None); @@ -287,8 +287,6 @@ ERF::derive_diag_profiles(Real /*time*/, Real ksgs = 0.0; if (l_use_KE) { ksgs = cons_arr(i,j,k,RhoKE_comp) / cons_arr(i,j,k,Rho_comp); - } else if (l_use_QKE) { - ksgs = cons_arr(i,j,k,RhoQKE_comp) / cons_arr(i,j,k,Rho_comp); } fab_arr(i, j, k, 2) = ksgs; #if 1 diff --git a/Source/IO/ERF_Write1DProfiles_stag.cpp b/Source/IO/ERF_Write1DProfiles_stag.cpp index 81fa117f5..da0611202 100644 --- a/Source/IO/ERF_Write1DProfiles_stag.cpp +++ b/Source/IO/ERF_Write1DProfiles_stag.cpp @@ -316,8 +316,8 @@ ERF::derive_diag_profiles_stag (Real /*time*/, bool l_use_kturb = ((solverChoice.turbChoice[lev].les_type != LESType::None) || (solverChoice.turbChoice[lev].pbl_type != PBLType::None)); - bool l_use_KE = (solverChoice.turbChoice[lev].les_type == LESType::Deardorff); - bool l_use_QKE = solverChoice.turbChoice[lev].use_QKE; + bool l_use_KE = ( (solverChoice.turbChoice[lev].les_type == LESType::Deardorff) || + (solverChoice.turbChoice[lev].pbl_type == PBLType::MYNN25) ); // Note: "uiui" == u_i*u_i = u*u + v*v + w*w // This will hold rho, theta, ksgs, Kmh, Kmv, uu, uv, vv, uth, vth, @@ -345,7 +345,7 @@ ERF::derive_diag_profiles_stag (Real /*time*/, int nvars = vars_new[lev][Vars::cons].nComp(); MultiFab mf_cons(vars_new[lev][Vars::cons], make_alias, 0, nvars); - MultiFab p_hse (base_state[lev], make_alias, 1, 1); // p_0 is second component + MultiFab p_hse (base_state[lev], make_alias, BaseState::p0_comp, 1); bool use_moisture = (solverChoice.moisture_type != MoistureType::None); @@ -375,8 +375,6 @@ ERF::derive_diag_profiles_stag (Real /*time*/, Real ksgs = 0.0; if (l_use_KE) { ksgs = cons_arr(i,j,k,RhoKE_comp) / cons_arr(i,j,k,Rho_comp); - } else if (l_use_QKE) { - ksgs = cons_arr(i,j,k,RhoQKE_comp) / cons_arr(i,j,k,Rho_comp); } fab_arr(i, j, k, 2) = ksgs; if (l_use_kturb) { diff --git a/Source/IO/ERF_WriteBndryPlanes.cpp b/Source/IO/ERF_WriteBndryPlanes.cpp index 5ddc4c458..def6541e5 100644 --- a/Source/IO/ERF_WriteBndryPlanes.cpp +++ b/Source/IO/ERF_WriteBndryPlanes.cpp @@ -196,17 +196,6 @@ void WriteBndryPlanes::write_planes (const int t_step, const Real time, derived::erf_derrhodivide(bx, Temp[mfi], S[mfi], RhoKE_comp); } bndry.copyFrom(Temp, nghost, 0, 0, ncomp, m_geom[bndry_lev].periodicity()); - - } else if (var_name == "qke") { - - MultiFab Temp(S.boxArray(),S.DistributionMap(),ncomp,0); - for (MFIter mfi(Temp, TilingIfNotGPU()); mfi.isValid(); ++mfi) - { - const Box& bx = mfi.tilebox(); - derived::erf_derrhodivide(bx, Temp[mfi], S[mfi], RhoQKE_comp); - } - bndry.copyFrom(Temp, nghost, 0, 0, ncomp, m_geom[bndry_lev].periodicity()); - } else if (var_name == "qv") { if (S.nComp() > RhoQ2_comp) { MultiFab Temp(S.boxArray(),S.DistributionMap(),ncomp,0); diff --git a/Source/IO/ERF_WriteScalarProfiles.cpp b/Source/IO/ERF_WriteScalarProfiles.cpp index b531afc85..854b0136b 100644 --- a/Source/IO/ERF_WriteScalarProfiles.cpp +++ b/Source/IO/ERF_WriteScalarProfiles.cpp @@ -39,7 +39,7 @@ ERF::sum_integrated_quantities (Real time) MultiFab pert_dens(vars_new[lev][Vars::cons].boxArray(), vars_new[lev][Vars::cons].DistributionMap(), 1,0); - MultiFab r_hse (base_state[lev], make_alias, 0, 1); // r_0 is first component + MultiFab r_hse (base_state[lev], make_alias, BaseState::r0_comp, 1); for ( MFIter mfi(pert_dens,TilingIfNotGPU()); mfi.isValid(); ++mfi) { const Box& bx = mfi.tilebox(); diff --git a/Source/Initialization/ERF_Metgrid_utils.H b/Source/Initialization/ERF_Metgrid_utils.H index c43de892e..2bb002d60 100644 --- a/Source/Initialization/ERF_Metgrid_utils.H +++ b/Source/Initialization/ERF_Metgrid_utils.H @@ -104,6 +104,7 @@ init_base_state_from_metgrid (const bool use_moisture, amrex::FArrayBox& r_hse_fab, amrex::FArrayBox& p_hse_fab, amrex::FArrayBox& pi_hse_fab, + amrex::FArrayBox& th_hse_fab, amrex::FArrayBox& z_phys_cc_fab, const amrex::Vector& NC_psfc_fab, amrex::Vector>& fabs_for_bcs); diff --git a/Source/Initialization/ERF_init1d.cpp b/Source/Initialization/ERF_init1d.cpp index 40612b852..5bbe00d32 100644 --- a/Source/Initialization/ERF_init1d.cpp +++ b/Source/Initialization/ERF_init1d.cpp @@ -19,19 +19,18 @@ using namespace amrex; void ERF::initHSE (int lev) { - // This integrates up through column to update p_hse, pi_hse; + // This integrates up through column to update p_hse, pi_hse, th_hse; // r_hse is not const b/c FillBoundary is called at the end for r_hse and p_hse - MultiFab r_hse (base_state[lev], make_alias, 0, 1); // r_0 is first component - MultiFab p_hse (base_state[lev], make_alias, 1, 1); // p_0 is second component - MultiFab pi_hse(base_state[lev], make_alias, 2, 1); // pi_0 is third component + MultiFab r_hse (base_state[lev], make_alias, BaseState::r0_comp, 1); + MultiFab p_hse (base_state[lev], make_alias, BaseState::p0_comp, 1); + MultiFab pi_hse(base_state[lev], make_alias, BaseState::pi0_comp, 1); + MultiFab th_hse(base_state[lev], make_alias, BaseState::th0_comp, 1); bool all_boxes_touch_bottom = true; Box domain(geom[lev].Domain()); - int icomp = 0; int bccomp = BCVars::base_bc; int ncomp = 3; - - Real time = 0.; + int icomp = 0; int ncomp = BaseState::num_comps; if (lev == 0) { BoxArray ba(base_state[lev].boxArray()); @@ -63,7 +62,7 @@ ERF::initHSE (int lev) // We need to do this here because the interpolation above may leave corners unfilled // when the corners need to be filled by, for example, reflection of the fine ghost // cell outside the fine region but inide the domain. - (*physbcs_base[lev])(base_state[lev],icomp,ncomp,base_state[lev].nGrowVect(),time,bccomp); + (*physbcs_base[lev])(base_state[lev],icomp,ncomp,base_state[lev].nGrowVect()); } if (all_boxes_touch_bottom || lev > 0) { @@ -75,7 +74,7 @@ ERF::initHSE (int lev) prob->erf_init_dens_hse(r_hse, z_phys_nd[lev], z_phys_cc[lev], geom[lev]); } - erf_enforce_hse(lev, r_hse, p_hse, pi_hse, z_phys_cc[lev]); + erf_enforce_hse(lev, r_hse, p_hse, pi_hse, th_hse, z_phys_cc[lev]); } else { @@ -85,12 +84,14 @@ ERF::initHSE (int lev) DistributionMapping dm_new(ba_new); - MultiFab new_base_state(ba_new, dm_new, 3, 1); - new_base_state.ParallelCopy(base_state[lev],0,0,3,1,1); + MultiFab new_base_state(ba_new, dm_new, BaseState::num_comps, base_state[lev].nGrowVect()); + new_base_state.ParallelCopy(base_state[lev],0,0,base_state[lev].nComp(), + base_state[lev].nGrowVect(),base_state[lev].nGrowVect()); - MultiFab new_r_hse (new_base_state, make_alias, 0, 1); // r_0 is first component - MultiFab new_p_hse (new_base_state, make_alias, 1, 1); // p_0 is second component - MultiFab new_pi_hse(new_base_state, make_alias, 2, 1); // pi_0 is third component + MultiFab new_r_hse (new_base_state, make_alias, BaseState::r0_comp, 1); + MultiFab new_p_hse (new_base_state, make_alias, BaseState::p0_comp, 1); + MultiFab new_pi_hse(new_base_state, make_alias, BaseState::pi0_comp, 1); + MultiFab new_th_hse(new_base_state, make_alias, BaseState::th0_comp, 1); std::unique_ptr new_z_phys_cc; std::unique_ptr new_z_phys_nd; @@ -111,19 +112,18 @@ ERF::initHSE (int lev) prob->erf_init_dens_hse(new_r_hse, new_z_phys_nd, new_z_phys_cc, geom[lev]); } - erf_enforce_hse(lev, new_r_hse, new_p_hse, new_pi_hse, new_z_phys_cc); + erf_enforce_hse(lev, new_r_hse, new_p_hse, new_pi_hse, new_th_hse, new_z_phys_cc); // Now copy back into the original arrays - base_state[lev].ParallelCopy(new_base_state,0,0,3,1,1); + base_state[lev].ParallelCopy(new_base_state,0,0,base_state[lev].nComp(), + base_state[lev].nGrowVect(),base_state[lev].nGrowVect()); } // // Impose physical bc's on the base state -- the values outside the fine region // but inside the domain have already been filled in the call above to InterpFromCoarseLevel // - (*physbcs_base[lev])(base_state[lev],icomp,ncomp,base_state[lev].nGrowVect(),time,bccomp); - - base_state[lev].FillBoundary(geom[lev].periodicity()); + (*physbcs_base[lev])(base_state[lev],0,base_state[lev].nComp(),base_state[lev].nGrowVect()); } void @@ -147,7 +147,7 @@ ERF::initHSE () */ void ERF::erf_enforce_hse (int lev, - MultiFab& dens, MultiFab& pres, MultiFab& pi, + MultiFab& dens, MultiFab& pres, MultiFab& pi, MultiFab& theta, std::unique_ptr& z_cc) { Real l_gravity = solverChoice.gravity; @@ -156,8 +156,6 @@ ERF::erf_enforce_hse (int lev, const auto geomdata = geom[lev].data(); const Real dz = geomdata.CellSize(2); - const Box& domain = geom[lev].Domain(); - for ( MFIter mfi(dens, TileNoZ()); mfi.isValid(); ++mfi ) { // Create a flat box with same horizontal extent but only one cell in vertical @@ -165,8 +163,10 @@ ERF::erf_enforce_hse (int lev, int klo = tbz.smallEnd(2); int khi = tbz.bigEnd(2); + // Note we only grow by 1 because that is how big z_cc is. Box b2d = tbz; // Copy constructor - b2d.grow(0,1); b2d.grow(1,1); // Grow by one in the lateral directions + b2d.grow(0,1); + b2d.grow(1,1); b2d.setRange(2,0); // We integrate to the first cell (and below) by using rho in this cell @@ -181,6 +181,7 @@ ERF::erf_enforce_hse (int lev, Array4 rho_arr = dens.array(mfi); Array4 pres_arr = pres.array(mfi); Array4 pi_arr = pi.array(mfi); + Array4 th_arr = theta.array(mfi); Array4 zcc_arr; if (l_use_terrain) { zcc_arr = z_cc->array(mfi); @@ -191,7 +192,8 @@ ERF::erf_enforce_hse (int lev, ParallelFor(b2d, [=] AMREX_GPU_DEVICE (int i, int j, int) { // Set value at surface from Newton iteration for rho - if (klo == 0) { + if (klo == 0) + { // Physical height of the terrain at cell center Real hz; if (l_use_terrain) { @@ -200,14 +202,20 @@ ERF::erf_enforce_hse (int lev, hz = 0.5*dz; } - pres_arr(i,j,klo ) = p_0 - hz * rho_arr(i,j,klo) * l_gravity; - pi_arr(i,j,klo ) = getExnergivenP(pres_arr(i,j,klo ), rdOcp); + pres_arr(i,j,klo) = p_0 - hz * rho_arr(i,j,klo) * l_gravity; + pi_arr(i,j,klo) = getExnergivenP(pres_arr(i,j,klo), rdOcp); + th_arr(i,j,klo) =getRhoThetagivenP(pres_arr(i,j,klo)) / rho_arr(i,j,klo); + // // Set ghost cell with dz and rho at boundary + // (We will set the rest of the ghost cells in the boundary condition routine) + // pres_arr(i,j,klo-1) = p_0 + hz * rho_arr(i,j,klo) * l_gravity; - pi_arr(i,j,klo-1) = getExnergivenP(pres_arr(i,j,klo-1), rdOcp); + pi_arr(i,j,klo-1) = getExnergivenP(pres_arr(i,j,klo-1), rdOcp); + th_arr(i,j,klo-1) = getRhoThetagivenP(pres_arr(i,j,klo-1)) / rho_arr(i,j,klo-1); } else { + // If level > 0 and klo > 0, we need to use the value of pres_arr(i,j,klo-1) which was // filled from FillPatch-ing it. Real dz_loc; @@ -221,7 +229,10 @@ ERF::erf_enforce_hse (int lev, pres_arr(i,j,klo) = pres_arr(i,j,klo-1) - dz_loc * dens_interp * l_gravity; pi_arr(i,j,klo ) = getExnergivenP(pres_arr(i,j,klo ), rdOcp); + th_arr(i,j,klo ) = getRhoThetagivenP(pres_arr(i,j,klo )) / rho_arr(i,j,klo ); + pi_arr(i,j,klo-1) = getExnergivenP(pres_arr(i,j,klo-1), rdOcp); + th_arr(i,j,klo-1) = getRhoThetagivenP(pres_arr(i,j,klo-1)) / rho_arr(i,j,klo-1); } Real dens_interp; @@ -231,64 +242,22 @@ ERF::erf_enforce_hse (int lev, dens_interp = 0.5*(rho_arr(i,j,k) + rho_arr(i,j,k-1)); pres_arr(i,j,k) = pres_arr(i,j,k-1) - dz_loc * dens_interp * l_gravity; pi_arr(i,j,k) = getExnergivenP(pres_arr(i,j,k), rdOcp); + th_arr(i,j,k) = getRhoThetagivenP(pres_arr(i,j,k)) / rho_arr(i,j,k); } } else { for (int k = klo+1; k <= khi; k++) { dens_interp = 0.5*(rho_arr(i,j,k) + rho_arr(i,j,k-1)); pres_arr(i,j,k) = pres_arr(i,j,k-1) - dz * dens_interp * l_gravity; pi_arr(i,j,k) = getExnergivenP(pres_arr(i,j,k), rdOcp); + th_arr(i,j,k) = getRhoThetagivenP(pres_arr(i,j,k)) / rho_arr(i,j,k); } } }); - int domlo_x = domain.smallEnd(0); int domhi_x = domain.bigEnd(0); - int domlo_y = domain.smallEnd(1); int domhi_y = domain.bigEnd(1); - - if (pres[mfi].box().smallEnd(0) < domlo_x) - { - Box bx = mfi.nodaltilebox(2); - bx.setSmall(0,domlo_x-1); - bx.setBig(0,domlo_x-1); - ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) { - pres_arr(i,j,k) = pres_arr(domlo_x,j,k); - pi_arr(i,j,k) = getExnergivenP(pres_arr(i,j,k), rdOcp); - }); - } - - if (pres[mfi].box().bigEnd(0) > domhi_x) - { - Box bx = mfi.nodaltilebox(2); - bx.setSmall(0,domhi_x+1); - bx.setBig(0,domhi_x+1); - ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) { - pres_arr(i,j,k) = pres_arr(domhi_x,j,k); - pi_arr(i,j,k) = getExnergivenP(pres_arr(i,j,k), rdOcp); - }); - } - - if (pres[mfi].box().smallEnd(1) < domlo_y) - { - Box bx = mfi.nodaltilebox(2); - bx.setSmall(1,domlo_y-1); - bx.setBig(1,domlo_y-1); - ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) { - pres_arr(i,j,k) = pres_arr(i,domlo_y,k); - pi_arr(i,j,k) = getExnergivenP(pres_arr(i,j,k), rdOcp); - }); - } - - if (pres[mfi].box().bigEnd(1) > domhi_y) - { - Box bx = mfi.nodaltilebox(2); - bx.setSmall(1,domhi_y+1); - bx.setBig(1,domhi_y+1); - ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) { - pres_arr(i,j,k) = pres_arr(i,domhi_y,k); - pi_arr(i,j,k) = getExnergivenP(pres_arr(i,j,k), rdOcp); - }); - } - } + } // mfi - dens.FillBoundary(geom[lev].periodicity()); - pres.FillBoundary(geom[lev].periodicity()); + dens.FillBoundary(geom[lev].periodicity()); + pres.FillBoundary(geom[lev].periodicity()); + pi.FillBoundary(geom[lev].periodicity()); + theta.FillBoundary(geom[lev].periodicity()); } diff --git a/Source/Initialization/ERF_init_bcs.cpp b/Source/Initialization/ERF_init_bcs.cpp index f4e05cfdb..4f99b069b 100644 --- a/Source/Initialization/ERF_init_bcs.cpp +++ b/Source/Initialization/ERF_init_bcs.cpp @@ -30,7 +30,6 @@ void ERF::init_bcs () m_bc_extdir_vals[BCVars::RhoTheta_bc_comp][ori] = -1.0; // It is important to set this negative // because the sign is tested on below m_bc_extdir_vals[BCVars::RhoKE_bc_comp][ori] = 0.0; - m_bc_extdir_vals[BCVars::RhoQKE_bc_comp][ori] = 0.0; m_bc_extdir_vals[BCVars::RhoScalar_bc_comp][ori] = 0.0; m_bc_extdir_vals[BCVars::RhoQ1_bc_comp][ori] = 0.0; m_bc_extdir_vals[BCVars::RhoQ2_bc_comp][ori] = 0.0; @@ -48,7 +47,6 @@ void ERF::init_bcs () m_bc_neumann_vals[BCVars::RhoTheta_bc_comp][ori] = 0.0; m_bc_neumann_vals[BCVars::RhoKE_bc_comp][ori] = 0.0; - m_bc_neumann_vals[BCVars::RhoQKE_bc_comp][ori] = 0.0; m_bc_neumann_vals[BCVars::RhoScalar_bc_comp][ori] = 0.0; m_bc_neumann_vals[BCVars::RhoQ1_bc_comp][ori] = 0.0; m_bc_neumann_vals[BCVars::RhoQ2_bc_comp][ori] = 0.0; @@ -172,14 +170,6 @@ void ERF::init_bcs () if (pp.query("KE", KE_in)) m_bc_extdir_vals[BCVars::RhoKE_bc_comp][ori] = rho_in*KE_in; } - Real QKE_in = 0.; - if (input_bndry_planes && m_r2d->ingested_QKE()) { - m_bc_extdir_vals[BCVars::RhoQKE_bc_comp][ori] = 0.; - } else { - if (pp.query("QKE", QKE_in)) - m_bc_extdir_vals[BCVars::RhoQKE_bc_comp][ori] = rho_in*QKE_in; - } - } else if (bc_type == "noslipwall") { @@ -550,7 +540,6 @@ void ERF::init_bcs () ( (BCVars::cons_bc+i == BCVars::Rho_bc_comp) && m_r2d->ingested_density()) || ( (BCVars::cons_bc+i == BCVars::RhoTheta_bc_comp) && m_r2d->ingested_theta() ) || ( (BCVars::cons_bc+i == BCVars::RhoKE_bc_comp) && m_r2d->ingested_KE() ) || - ( (BCVars::cons_bc+i == BCVars::RhoQKE_bc_comp) && m_r2d->ingested_QKE() ) || ( (BCVars::cons_bc+i == BCVars::RhoScalar_bc_comp) && m_r2d->ingested_scalar() ) || ( (BCVars::cons_bc+i == BCVars::RhoQ1_bc_comp) && m_r2d->ingested_q1() ) || ( (BCVars::cons_bc+i == BCVars::RhoQ2_bc_comp) && m_r2d->ingested_q2() )) ) @@ -568,7 +557,6 @@ void ERF::init_bcs () ( (BCVars::cons_bc+i == BCVars::Rho_bc_comp) && m_r2d->ingested_density()) || ( (BCVars::cons_bc+i == BCVars::RhoTheta_bc_comp) && m_r2d->ingested_theta() ) || ( (BCVars::cons_bc+i == BCVars::RhoKE_bc_comp) && m_r2d->ingested_KE() ) || - ( (BCVars::cons_bc+i == BCVars::RhoQKE_bc_comp) && m_r2d->ingested_QKE() ) || ( (BCVars::cons_bc+i == BCVars::RhoScalar_bc_comp) && m_r2d->ingested_scalar() ) || ( (BCVars::cons_bc+i == BCVars::RhoQ1_bc_comp) && m_r2d->ingested_q1() ) || ( (BCVars::cons_bc+i == BCVars::RhoQ2_bc_comp) && m_r2d->ingested_q2() ) diff --git a/Source/Initialization/ERF_init_custom.cpp b/Source/Initialization/ERF_init_custom.cpp index 984c57004..596135530 100644 --- a/Source/Initialization/ERF_init_custom.cpp +++ b/Source/Initialization/ERF_init_custom.cpp @@ -27,8 +27,8 @@ ERF::init_custom (int lev) { auto& lev_new = vars_new[lev]; - MultiFab r_hse(base_state[lev], make_alias, 0, 1); // r_0 is first component - MultiFab p_hse(base_state[lev], make_alias, 1, 1); // p_0 is second component + MultiFab r_hse(base_state[lev], make_alias, BaseState::r0_comp, 1); + MultiFab p_hse(base_state[lev], make_alias, BaseState::p0_comp, 1); MultiFab cons_pert(lev_new[Vars::cons].boxArray(), lev_new[Vars::cons].DistributionMap(), lev_new[Vars::cons].nComp() , lev_new[Vars::cons].nGrow()); @@ -89,18 +89,12 @@ ERF::init_custom (int lev) MultiFab::Add(lev_new[Vars::cons], cons_pert, RhoTheta_comp, RhoTheta_comp, 1, cons_pert.nGrow()); MultiFab::Add(lev_new[Vars::cons], cons_pert, RhoScalar_comp,RhoScalar_comp,NSCALARS, cons_pert.nGrow()); - // RhoKE is only relevant if using Deardorff with LES - if (solverChoice.turbChoice[lev].les_type == LESType::Deardorff) { + // RhoKE is only relevant if using Deardorff with LES or MYNN with PBL + if ((solverChoice.turbChoice[lev].les_type == LESType::Deardorff) || + (solverChoice.turbChoice[lev].pbl_type == PBLType::MYNN25)) { MultiFab::Add(lev_new[Vars::cons], cons_pert, RhoKE_comp, RhoKE_comp, 1, cons_pert.nGrow()); } - // RhoQKE is only relevant if using MYNN2.5 - if (solverChoice.turbChoice[lev].pbl_type != PBLType::MYNN25) { - lev_new[Vars::cons].setVal(0.0,RhoQKE_comp,1); - } else { - MultiFab::Add(lev_new[Vars::cons], cons_pert, RhoQKE_comp, RhoQKE_comp, 1, cons_pert.nGrow()); - } - if (solverChoice.moisture_type != MoistureType::None) { int qstate_size = micro->Get_Qstate_Size(); MultiFab::Add(lev_new[Vars::cons], cons_pert, RhoQ1_comp, RhoQ1_comp, 1, cons_pert.nGrow()); diff --git a/Source/Initialization/ERF_init_from_hse.cpp b/Source/Initialization/ERF_init_from_hse.cpp index 9623cb8e7..6dbc3c768 100644 --- a/Source/Initialization/ERF_init_from_hse.cpp +++ b/Source/Initialization/ERF_init_from_hse.cpp @@ -6,8 +6,6 @@ #include #include -#include "AMReX_Print.H" - using namespace amrex; /** @@ -23,8 +21,8 @@ using namespace amrex; * - save r_hse * - call ERF::enforce_hse(...), calculates p_hse from saved r_hse (redundant, * but needed because p_hse is not necessarily calculated by the Problem - * implementation) and pi_hse -- note: this pressure does not exactly match - * the p_hse from before because what is calculated by init_isentropic_hse + * implementation) and pi_hse and th_hse -- note: this pressure does not exactly + * match the p_hse from before because what is calculated by init_isentropic_hse * comes from the EOS whereas what is calculated here comes from the hydro- * static equation * @@ -35,8 +33,8 @@ ERF::init_from_hse (int lev) { auto& lev_new = vars_new[lev]; - MultiFab r_hse(base_state[lev], make_alias, 0, 1); // r_0 is first component - MultiFab p_hse(base_state[lev], make_alias, 1, 1); // p_0 is second component + MultiFab r_hse(base_state[lev], make_alias, BaseState::r0_comp, 1); + MultiFab p_hse(base_state[lev], make_alias, BaseState::p0_comp, 1); #ifdef _OPENMP #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) diff --git a/Source/Initialization/ERF_init_from_input_sounding.cpp b/Source/Initialization/ERF_init_from_input_sounding.cpp index abbf40565..e05e97043 100644 --- a/Source/Initialization/ERF_init_from_input_sounding.cpp +++ b/Source/Initialization/ERF_init_from_input_sounding.cpp @@ -23,6 +23,7 @@ init_bx_scalars_from_input_sounding_hse (const Box &bx, Array4 const &r_hse_arr, Array4 const &p_hse_arr, Array4 const &pi_hse_arr, + Array4 const &th_hse_arr, GeometryData const &geomdata, Array4 const &z_cc_arr, const Real& l_gravity, @@ -79,7 +80,7 @@ ERF::init_from_input_sounding (int lev) // InterpFromCoarseLevel(base_state[lev], base_state[lev].nGrowVect(), IntVect(0,0,0), // do not fill ghost cells outside the domain - base_state[lev-1], 0, 0, 3, + base_state[lev-1], 0, 0, base_state[lev].nComp(), geom[lev-1], geom[lev], refRatio(lev-1), &cell_cons_interp, domain_bcs_type, BCVars::base_bc); @@ -87,17 +88,16 @@ ERF::init_from_input_sounding (int lev) // We need to do this here because the interpolation above may leave corners unfilled // when the corners need to be filled by, for example, reflection of the fine ghost // cell outside the fine region but inide the domain. - int bccomp = BCVars::base_bc; - int icomp = 0; int ncomp = 3; Real dummy_time = 0.; - (*physbcs_base[lev])(base_state[lev],icomp,ncomp,base_state[lev].nGrowVect(),dummy_time,bccomp); + (*physbcs_base[lev])(base_state[lev],0,base_state[lev].nComp(),base_state[lev].nGrowVect()); } auto& lev_new = vars_new[lev]; // update if init_sounding_ideal == true - MultiFab r_hse (base_state[lev], make_alias, 0, 1); // r_0 is first component - MultiFab p_hse (base_state[lev], make_alias, 1, 1); // p_0 is second component - MultiFab pi_hse(base_state[lev], make_alias, 2, 1); // pi_0 is third component + MultiFab r_hse (base_state[lev], make_alias, BaseState::r0_comp, 1); + MultiFab p_hse (base_state[lev], make_alias, BaseState::p0_comp, 1); + MultiFab pi_hse(base_state[lev], make_alias, BaseState::pi0_comp, 1); + MultiFab th_hse(base_state[lev], make_alias, BaseState::th0_comp, 1); const Real l_gravity = solverChoice.gravity; const Real l_rdOcp = solverChoice.rdOcp; @@ -112,9 +112,10 @@ ERF::init_from_input_sounding (int lev) const auto &xvel_arr = lev_new[Vars::xvel].array(mfi); const auto &yvel_arr = lev_new[Vars::yvel].array(mfi); const auto &zvel_arr = lev_new[Vars::zvel].array(mfi); - Array4 r_hse_arr = r_hse.array(mfi); - Array4 p_hse_arr = p_hse.array(mfi); + Array4 r_hse_arr = r_hse.array(mfi); + Array4 p_hse_arr = p_hse.array(mfi); Array4 pi_hse_arr = pi_hse.array(mfi); + Array4 th_hse_arr = th_hse.array(mfi); Array4 z_cc_arr = (solverChoice.use_terrain) ? z_phys_cc[lev]->const_array(mfi) : Array4{}; Array4 z_nd_arr = (solverChoice.use_terrain) ? z_phys_nd[lev]->const_array(mfi) : Array4{}; @@ -125,7 +126,7 @@ ERF::init_from_input_sounding (int lev) // calculated by calc_rho_p() init_bx_scalars_from_input_sounding_hse( bx, cons_arr, - r_hse_arr, p_hse_arr, pi_hse_arr, + r_hse_arr, p_hse_arr, pi_hse_arr, th_hse_arr, geom[lev].data(), z_cc_arr, l_gravity, l_rdOcp, l_moist, input_sounding_data); } @@ -211,6 +212,7 @@ init_bx_scalars_from_input_sounding (const Box &bx, * @param r_hse_arr Array4 specifying the density HSE base state data we are to initialize * @param p_hse_arr Array4 specifying the pressure HSE base state data we are to initialize * @param pi_hse_arr Array4 specifying the Exner pressure HSE base state data we are to initialize + * @param th_hse_arr Array4 specifying the base state potential temperature we are to initialize * @param geomdata GeometryData object specifying the domain geometry * @param l_gravity Real number specifying the gravitational acceleration constant * @param l_rdOcp Real number specifying the Rhydberg constant ($R_d$) divided by specific heat at constant pressure ($c_p$) @@ -222,6 +224,7 @@ init_bx_scalars_from_input_sounding_hse (const Box &bx, Array4 const &r_hse_arr, Array4 const &p_hse_arr, Array4 const &pi_hse_arr, + Array4 const &th_hse_arr, GeometryData const &geomdata, Array4 const &z_cc_arr, const Real& /*l_gravity*/, @@ -269,22 +272,33 @@ init_bx_scalars_from_input_sounding_hse (const Box &bx, // Update hse quantities with values calculated from InputSoundingData.calc_rho_p() qv_k = (l_moist) ? interpolate_1d(z_inp_sound, qv_inp_sound, z, inp_sound_size) : 0.0; - r_hse_arr (i, j, k) = rho_k * (1.0 + qv_k); - p_hse_arr (i, j, k) = getPgivenRTh(rhoTh_k, qv_k); - pi_hse_arr(i, j, k) = getExnergivenRTh(rhoTh_k, l_rdOcp); + r_hse_arr (i,j,k) = rho_k * (1.0 + qv_k); + p_hse_arr (i,j,k) = getPgivenRTh(rhoTh_k, qv_k); + pi_hse_arr(i,j,k) = getExnergivenRTh(rhoTh_k, l_rdOcp); + th_hse_arr(i,j,k) = getRhoThetagivenP(p_hse_arr(i,j,k)) / r_hse_arr(i,j,k); + + // TODO: we should be setting this to the number of ghost cells of base_state[lev] + // instead of hard-wiring it here! + int ng = 3; // FOEXTRAP hse arrays if (k==kbot) { - r_hse_arr (i, j, k-1) = r_hse_arr (i,j,k); - p_hse_arr (i, j, k-1) = p_hse_arr (i,j,k); - pi_hse_arr(i, j, k-1) = pi_hse_arr(i,j,k); + for (int kk = 1; kk <= ng; kk++) { + r_hse_arr(i, j, k-kk) = r_hse_arr(i,j,k); + p_hse_arr(i, j, k-kk) = p_hse_arr(i,j,k); + pi_hse_arr(i, j, k-kk) = pi_hse_arr(i,j,k); + th_hse_arr(i, j, k-kk) = th_hse_arr(i,j,k); + } } else if (k==ktop) { - r_hse_arr (i, j, k+1) = r_hse_arr (i,j,k); - p_hse_arr (i, j, k+1) = p_hse_arr (i,j,k); - pi_hse_arr(i, j, k+1) = pi_hse_arr(i,j,k); + for (int kk = 1; kk <= ng; kk++) { + r_hse_arr(i, j, k+kk) = r_hse_arr(i,j,k); + p_hse_arr(i, j, k+kk) = p_hse_arr(i,j,k); + pi_hse_arr(i, j, k+kk) = pi_hse_arr(i,j,k); + th_hse_arr(i, j, k+kk) = th_hse_arr(i,j,k); + } } // total nonprecipitating water (Q1) == water vapor (Qv), i.e., there diff --git a/Source/Initialization/ERF_init_from_metgrid.cpp b/Source/Initialization/ERF_init_from_metgrid.cpp index 324c2da25..788757958 100644 --- a/Source/Initialization/ERF_init_from_metgrid.cpp +++ b/Source/Initialization/ERF_init_from_metgrid.cpp @@ -246,8 +246,6 @@ ERF::init_from_metgrid (int lev) if (use_moisture) MetGridBdyEnd = MetGridBdyVars::NumTypes; // Zero out fabs_for_bcs on the global domain - Print() << "zero out fabs_for_bcs" << std::endl; - Print() << "ntimes = " << ntimes << std::endl; Vector> fabs_for_bcs; fabs_for_bcs.resize(ntimes); for (int itime(0); itime < ntimes; itime++) { @@ -256,7 +254,6 @@ ERF::init_from_metgrid (int lev) Box gdomain; Box ldomain; for (int nvar(0); nvar 0.0, "KE must have a positive value"); Real fac = (sbx.contains(i,j,k)) ? 1.0 : 0.0; const Real Zval = Compute_Zrel_AtCellCenter(i,j,k,z_nd_arr); - const Real dz = Compute_h_zeta_AtCellCenter(i,j,k,invCellSize,z_nd_arr); + const Real dz = Compute_h_zeta_AtCellCenter(i,j,k,invCellSize,z_nd_arr); Gpu::Atomic::Add(&qint(i,j,0,0), Zval*qvel(i,j,k)*dz*fac); Gpu::Atomic::Add(&qint(i,j,0,1), qvel(i,j,k)*dz*fac); }); } else { ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { - qvel(i,j,k) = std::sqrt(cell_data(i,j,k,RhoQKE_comp) / cell_data(i,j,k,Rho_comp)); - AMREX_ASSERT_WITH_MESSAGE(qvel(i,j,k) > 0.0, "QKE must have a positive value"); + qvel(i,j,k) = std::sqrt(2.0 * cell_data(i,j,k,RhoKE_comp) / cell_data(i,j,k,Rho_comp)); + AMREX_ASSERT_WITH_MESSAGE(qvel(i,j,k) > 0.0, "KE must have a positive value"); // Not multiplying by dz: its constant and would fall out when we divide qint0/qint1 anyway @@ -237,7 +237,7 @@ ComputeDiffusivityMYNN25 (const MultiFab& xvel, const Real rho = cell_data(i,j,k,Rho_comp); K_turb(i,j,k,EddyDiff::Mom_v) = rho * Lm * qvel(i,j,k) * SM; K_turb(i,j,k,EddyDiff::Theta_v) = rho * Lm * qvel(i,j,k) * SH; - K_turb(i,j,k,EddyDiff::QKE_v) = rho * Lm * qvel(i,j,k) * SQ; + K_turb(i,j,k,EddyDiff::KE_v) = rho * Lm * qvel(i,j,k) * SQ; // TODO: implement partial-condensation scheme? // Currently, implementation matches NN09 without rain (i.e., @@ -250,7 +250,7 @@ ComputeDiffusivityMYNN25 (const MultiFab& xvel, K_turb(i,j,k,EddyDiff::Q_v) = rho * Lm * qvel(i,j,k) * SH; } - K_turb(i,j,k,EddyDiff::PBL_lengthscale) = Lm; + K_turb(i,j,k,EddyDiff::Turb_lengthscale) = Lm; }); } } diff --git a/Source/PBL/ERF_ComputeDiffusivityYSU.cpp b/Source/PBL/ERF_ComputeDiffusivityYSU.cpp index 92503e5f7..f197fdf33 100644 --- a/Source/PBL/ERF_ComputeDiffusivityYSU.cpp +++ b/Source/PBL/ERF_ComputeDiffusivityYSU.cpp @@ -238,7 +238,7 @@ ComputeDiffusivityYSU (const MultiFab& xvel, const Real rhoKmax = rho * Kmax; K_turb(i,j,k,EddyDiff::Mom_v) = std::max(std::min(K_turb(i,j,k,EddyDiff::Mom_v) ,rhoKmax), rhoKmin); K_turb(i,j,k,EddyDiff::Theta_v) = std::max(std::min(K_turb(i,j,k,EddyDiff::Theta_v) ,rhoKmax), rhoKmin); - K_turb(i,j,k,EddyDiff::PBL_lengthscale) = pblh_arr(i,j,0); + K_turb(i,j,k,EddyDiff::Turb_lengthscale) = pblh_arr(i,j,0); }); // HACK set bottom ghost cell to 1st cell diff --git a/Source/PBL/ERF_MYNNStruct.H b/Source/PBL/ERF_MYNNStruct.H index 15fbde688..8fce2c81c 100644 --- a/Source/PBL/ERF_MYNNStruct.H +++ b/Source/PBL/ERF_MYNNStruct.H @@ -10,7 +10,7 @@ struct MYNNLevel25 { /* * Calculate the stability functions that determine the eddy diffusivities - * of momentum, heat, QKE, and (optionally) moisture. + * of momentum, heat, KE, and (optionally) moisture. */ AMREX_GPU_DEVICE AMREX_FORCE_INLINE diff --git a/Source/PBL/ERF_PBLHeight.H b/Source/PBL/ERF_PBLHeight.H index 772ba6b05..1ca84631f 100644 --- a/Source/PBL/ERF_PBLHeight.H +++ b/Source/PBL/ERF_PBLHeight.H @@ -130,9 +130,9 @@ struct MYNNPBLH { // // Find PBL height based on TKE (for SBLs only) // - amrex::Real tke = 0.5 * cons_arr(i,j,k ,RhoQKE_comp) / cons_arr(i,j,k ,Rho_comp); - amrex::Real tke1 = 0.5 * cons_arr(i,j,k+1,RhoQKE_comp) / cons_arr(i,j,k+1,Rho_comp); - amrex::Real maxtke = 0.5 * cons_arr(i,j,0 ,RhoQKE_comp) / cons_arr(i,j,0 ,Rho_comp); + amrex::Real tke = cons_arr(i,j,k ,RhoKE_comp) / cons_arr(i,j,k ,Rho_comp); + amrex::Real tke1 = cons_arr(i,j,k+1,RhoKE_comp) / cons_arr(i,j,k+1,Rho_comp); + amrex::Real maxtke = cons_arr(i,j,0 ,RhoKE_comp) / cons_arr(i,j,0 ,Rho_comp); // - threshold is 5% of max TKE (Kosovic & Curry 2000, JAS) amrex::Real TKEeps = 0.05 * maxtke; TKEeps = amrex::max(TKEeps, 0.02); // min val from WRF @@ -142,7 +142,7 @@ struct MYNNPBLH { // Interpolate to get lowest height where TKE -> 0 pblh_tke_arr(i,j,0) = zphys_arr(ii,jj,k) + (zphys_arr(ii,jj,k+1)-zphys_arr(ii,jj,k))/(tke1-tke) - * (TKEeps - tke); + * (TKEeps - tke); } } }); @@ -202,9 +202,9 @@ struct MYNNPBLH { // // Find PBL height based on TKE (for SBLs only) // - amrex::Real tke = 0.5 * cons_arr(i,j,k ,RhoQKE_comp) / cons_arr(i,j,k ,Rho_comp); - amrex::Real tke1 = 0.5 * cons_arr(i,j,k+1,RhoQKE_comp) / cons_arr(i,j,k+1,Rho_comp); - amrex::Real maxtke = 0.5 * cons_arr(i,j,0 ,RhoQKE_comp) / cons_arr(i,j,0 ,Rho_comp); + amrex::Real tke = cons_arr(i,j,k ,RhoKE_comp) / cons_arr(i,j,k ,Rho_comp); + amrex::Real tke1 = cons_arr(i,j,k+1,RhoKE_comp) / cons_arr(i,j,k+1,Rho_comp); + amrex::Real maxtke = cons_arr(i,j,0 ,RhoKE_comp) / cons_arr(i,j,0 ,Rho_comp); // - threshold is 5% of max TKE (Kosovic & Curry 2000, JAS) amrex::Real TKEeps = 0.05 * maxtke; TKEeps = amrex::max(TKEeps, 0.02); // min val from WRF @@ -249,7 +249,7 @@ struct MYNNPBLH { // // Finally, blend between the two PBLH estimates // - amrex::Real maxqke = cons_arr(i,j,0 ,RhoQKE_comp) / cons_arr(i,j,0 ,Rho_comp); + amrex::Real maxqke = 2.0 * cons_arr(i,j,0 ,RhoKE_comp) / cons_arr(i,j,0 ,Rho_comp); if (maxqke > 0.05) { amrex::Real wt = 0.5*std::tanh((zi - sbl_lim)/sbl_damp) + 0.5; pblh_arr(i,j,0) = (1.-wt)*pblh_tke_arr(i,j,0) + wt*pblh_arr(i,j,0); diff --git a/Source/PBL/ERF_PBLModels.H b/Source/PBL/ERF_PBLModels.H index d2fdd9d3c..9c0ee5086 100644 --- a/Source/PBL/ERF_PBLModels.H +++ b/Source/PBL/ERF_PBLModels.H @@ -201,16 +201,16 @@ ComputeQKESourceTerms (int i, int j, int k, // DiffusionSrcForState_* is called from ERF_slow_rhs_post. // Shear Production - source_term += 2.0*K_turb(i,j,k,EddyDiff::Mom_v) * (dudz*dudz + dvdz*dvdz); + source_term += K_turb(i,j,k,EddyDiff::Mom_v) * (dudz*dudz + dvdz*dvdz); // Buoyancy Production - source_term -= 2.0*(CONST_GRAV/theta_mean)*K_turb(i,j,k,EddyDiff::Theta_v)*dthetadz; + source_term -= (CONST_GRAV/theta_mean)*K_turb(i,j,k,EddyDiff::Theta_v)*dthetadz; // Dissipation - amrex::Real qke = cell_prim(i,j,k,PrimQKE_comp); + amrex::Real qke = 2.0 * cell_prim(i,j,k,PrimKE_comp); if (std::abs(qke) > 0.0) { - source_term -= 2.0 * cell_data(i,j,k,Rho_comp) * std::pow(qke,1.5) / - (pbl_mynn_B1_l * K_turb(i,j,k,EddyDiff::PBL_lengthscale)); + source_term -= cell_data(i,j,k,Rho_comp) * std::pow(qke,1.5) / + (pbl_mynn_B1_l * K_turb(i,j,k,EddyDiff::Turb_lengthscale)); } return source_term; diff --git a/Source/SourceTerms/ERF_NumericalDiffusion.H b/Source/SourceTerms/ERF_NumericalDiffusion.H index 14212e417..03666b002 100644 --- a/Source/SourceTerms/ERF_NumericalDiffusion.H +++ b/Source/SourceTerms/ERF_NumericalDiffusion.H @@ -5,23 +5,46 @@ #include #include -void NumericalDiffusion (const amrex::Box& bx, - const int start_comp, - const int num_comp, - const amrex::Real dt, - const amrex::Real num_diff_coeff, - const amrex::Array4& data, - const amrex::Array4< amrex::Real>& rhs, - const amrex::Array4& mf_x, - const amrex::Array4& mf_y, - const bool avg_mf_x_y, - const bool avg_mf_y_x); -void NumericalDiffusionVert (const amrex::Box& bx, - const int start_comp, - const int num_comp, - const amrex::Real dt, - const amrex::Real num_diff_coeff, - const amrex::Array4& data, - const amrex::Array4< amrex::Real>& rhs); +AMREX_GPU_DEVICE +AMREX_FORCE_INLINE +amrex::Real +calc_fifth_order_deriv (const amrex::Real& dnp2, + const amrex::Real& dnp1, + const amrex::Real& dn, + const amrex::Real& dnm1, + const amrex::Real& dnm2, + const amrex::Real& dnm3) +{ + amrex::Real interp = 10. * (dn - dnm1) + - 5. * (dnp1 - dnm2) + + (dnp2 - dnm3); + return interp; +} + +void NumericalDiffusion_Scal (const amrex::Box& bx, + const int start_comp, + const int num_comp, + const amrex::Real dt, + const amrex::Real num_diff_coeff, + const amrex::Array4& prim_data, + const amrex::Array4& cell_data, + const amrex::Array4< amrex::Real>& rhs, + const amrex::Array4& mf); + +void NumericalDiffusion_Xmom (const amrex::Box& bx, + const amrex::Real dt, + const amrex::Real num_diff_coeff, + const amrex::Array4& prim_data, + const amrex::Array4& cell_data, + const amrex::Array4< amrex::Real>& rhs, + const amrex::Array4& mf); + +void NumericalDiffusion_Ymom (const amrex::Box& bx, + const amrex::Real dt, + const amrex::Real num_diff_coeff, + const amrex::Array4& prim_data, + const amrex::Array4& cell_data, + const amrex::Array4< amrex::Real>& rhs, + const amrex::Array4& mf); #endif diff --git a/Source/SourceTerms/ERF_NumericalDiffusion.cpp b/Source/SourceTerms/ERF_NumericalDiffusion.cpp index e5d287d40..580d2febf 100644 --- a/Source/SourceTerms/ERF_NumericalDiffusion.cpp +++ b/Source/SourceTerms/ERF_NumericalDiffusion.cpp @@ -9,76 +9,130 @@ using namespace amrex; * @param[in] start_comp staring component index * @param[in] num_comp number of total components * @param[in] num_diff_coeff - * @param[in] data variables used to compute RHS + * @param[in] prim_data primitive variables + * @param[in] cell_data cell center variables * @param[out] rhs store the right hand side - * @param[in] mf_x map factor at x-face - * @param[in] mf_y map factor at y-face - * @param[in] avg_mf_x_y flag to average map factor x in y-dir - * @param[in] avg_mf_y_x flag to average map factor y in x-dir + * @param[in] mf map factor */ void -NumericalDiffusion (const Box& bx, - const int start_comp, - const int num_comp, - const Real dt, - const Real num_diff_coeff, - const Array4& data, - const Array4< Real>& rhs, - const Array4& mf_x, - const Array4& mf_y, - const bool avg_mf_x_y, - const bool avg_mf_y_x) +NumericalDiffusion_Scal (const Box& bx, + const int start_comp, + const int num_comp, + const Real dt, + const Real num_diff_coeff, + const Array4& prim_data, + const Array4& cell_data, + const Array4< Real>& rhs, + const Array4& mf_arr) { - BL_PROFILE_VAR("NumericalDiffusion()",NumericalDiffusion); - - // Average map factors to correct locations - Box planebx(bx); planebx.setSmall(2,0); planebx.setBig(2,0); - FArrayBox mf_x_bar; mf_x_bar.resize(planebx,1,The_Async_Arena()); - FArrayBox mf_y_bar; mf_y_bar.resize(planebx,1,The_Async_Arena()); - const Array4& mfx_arr = mf_x_bar.array(); - const Array4& mfy_arr = mf_y_bar.array(); - ParallelFor(planebx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept + BL_PROFILE_VAR("NumericalDiffusion_Scal()",NumericalDiffusion_Scal); + + // Capture diffusion coeff + Real coeff6 = num_diff_coeff / (2.0 * dt); + + // Compute 5th order derivative and augment RHS + ParallelFor(bx, num_comp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int m) noexcept { - if (avg_mf_x_y) { - mfx_arr(i,j,k) = 0.5 * ( mf_x(i,j-1,k) + mf_x(i,j,k) ); - } else { - mfx_arr(i,j,k) = mf_x(i,j,k); - } - if (avg_mf_y_x) { - mfy_arr(i,j,k) = 0.5 * ( mf_y(i-1,j,k) + mf_y(i,j,k) ); - } else { - mfy_arr(i,j,k) = mf_y(i,j,k); - } + int n = start_comp + m; // conserved index + int nm1 = (n==0) ? 0 : n - 1; // prim index + Real rho_x_lo = (n==0) ? 1.0 : 0.5 * ( cell_data(i-1,j,k,Rho_comp) + cell_data(i ,j,k,Rho_comp) ); + Real xflux_lo = rho_x_lo * calc_fifth_order_deriv(prim_data(i+2,j,k,nm1), prim_data(i+1,j,k,nm1), + prim_data(i ,j,k,nm1), prim_data(i-1,j,k,nm1), + prim_data(i-2,j,k,nm1), prim_data(i-3,j,k,nm1)); + if ( (xflux_lo * (prim_data(i,j,k,nm1) - prim_data(i-1,j,k,nm1)) ) < 0.) xflux_lo = 0.; + + + Real rho_x_hi = (n==0) ? 1.0 : 0.5 * ( cell_data(i+1,j,k,Rho_comp) + cell_data(i ,j,k,Rho_comp) ); + Real xflux_hi = rho_x_hi * calc_fifth_order_deriv(prim_data(i+3,j,k,nm1), prim_data(i+2,j,k,nm1), + prim_data(i+1,j,k,nm1), prim_data(i ,j,k,nm1), + prim_data(i-1,j,k,nm1), prim_data(i-2,j,k,nm1)); + if ( (xflux_hi * (prim_data(i+1,j,k,nm1) - prim_data(i,j,k,nm1)) ) < 0.) xflux_hi = 0.; + + + Real rho_y_lo = (n==0) ? 1.0 : 0.5 * ( cell_data(i,j-1,k,Rho_comp) + cell_data(i,j ,k,Rho_comp) ); + Real yflux_lo = rho_y_lo * calc_fifth_order_deriv(prim_data(i,j+2,k,nm1), prim_data(i,j+1,k,nm1), + prim_data(i,j ,k,nm1), prim_data(i,j-1,k,nm1), + prim_data(i,j-2,k,nm1), prim_data(i,j-3,k,nm1)); + if ( (yflux_lo * (prim_data(i,j,k,nm1) - prim_data(i,j-1,k,nm1)) ) < 0.) yflux_lo = 0.; + + + Real rho_y_hi = (n==0) ? 1.0 : 0.5 * ( cell_data(i,j+1,k,Rho_comp) + cell_data(i,j ,k,Rho_comp) ); + Real yflux_hi = rho_y_hi * calc_fifth_order_deriv(prim_data(i,j+3,k,nm1), prim_data(i,j+2,k,nm1), + prim_data(i,j+1,k,nm1), prim_data(i,j ,k,nm1), + prim_data(i,j-1,k,nm1), prim_data(i,j-2,k,nm1)); + if ( (yflux_hi * (prim_data(i,j+1,k,nm1) - prim_data(i,j,k,nm1)) ) < 0.) yflux_hi = 0.; + + + rhs(i,j,k,n) += coeff6 * mf_arr(i,j,0) * ( (xflux_hi - xflux_lo) + + (yflux_hi - yflux_lo) ); }); +} + +/** + * Function to compute 6th order numerical diffusion RHS. + * + * @param[in] bx box to loop over + * @param[in] start_comp staring component index + * @param[in] num_comp number of total components + * @param[in] num_diff_coeff + * @param[in] prim_data primitive variables + * @param[in] cell_data cell center variables + * @param[out] rhs store the right hand side + * @param[in] mf map factor + */ +void +NumericalDiffusion_Xmom (const Box& bx, + const Real dt, + const Real num_diff_coeff, + const Array4& prim_data, + const Array4& cell_data, + const Array4< Real>& rhs, + const Array4& mf_arr) +{ + BL_PROFILE_VAR("NumericalDiffusion_Xmom()",NumericalDiffusion_Xmom); // Capture diffusion coeff Real coeff6 = num_diff_coeff / (2.0 * dt); // Compute 5th order derivative and augment RHS - ParallelFor(bx, num_comp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int m) noexcept + ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { - int n = start_comp + m; - Real xflux_lo = 10. * (data(i ,j,k,n) - data(i-1,j,k,n)) - - 5. * (data(i+1,j,k,n) - data(i-2,j,k,n)) - + (data(i+2,j,k,n) - data(i-3,j,k,n)); - if ( (xflux_lo * (data(i,j,k,n) - data(i-1,j,k,n)) ) < 0.) xflux_lo = 0.; - Real xflux_hi = 10. * (data(i+1,j,k,n) - data(i ,j,k,n)) - - 5. * (data(i+2,j,k,n) - data(i-1,j,k,n)) - + (data(i+3,j,k,n) - data(i-2,j,k,n)); - if ( (xflux_hi * (data(i+1,j,k,n) - data(i,j,k,n)) ) < 0.) xflux_hi = 0.; - Real yflux_lo = 10. * (data(i,j ,k,n) - data(i,j-1,k,n)) - - 5. * (data(i,j+1,k,n) - data(i,j-2,k,n)) - + (data(i,j+2,k,n) - data(i,j-3,k,n)); - if ( (yflux_lo * (data(i,j,k,n) - data(i,j-1,k,n)) ) < 0.) yflux_lo = 0.; - Real yflux_hi = 10. * (data(i,j+1,k,n) - data(i,j ,k,n)) - - 5. * (data(i,j+2,k,n) - data(i,j-1,k,n)) - + (data(i,j+3,k,n) - data(i,j-2,k,n)); - if ( (yflux_hi * (data(i,j+1,k,n) - data(i,j,k,n)) ) < 0.) yflux_hi = 0.; - rhs(i,j,k,n) += coeff6 * ( (xflux_hi - xflux_lo) * mfx_arr(i,j,0) - + (yflux_hi - yflux_lo) * mfy_arr(i,j,0) ); + Real rho_x_lo = cell_data(i-1,j,k,Rho_comp); + Real xflux_lo = rho_x_lo * calc_fifth_order_deriv(prim_data(i+2,j,k), prim_data(i+1,j,k), + prim_data(i ,j,k), prim_data(i-1,j,k), + prim_data(i-2,j,k), prim_data(i-3,j,k)); + if ( (xflux_lo * (prim_data(i,j,k) - prim_data(i-1,j,k)) ) < 0.) xflux_lo = 0.; + + + Real rho_x_hi = cell_data(i ,j,k,Rho_comp); + Real xflux_hi = rho_x_hi * calc_fifth_order_deriv(prim_data(i+3,j,k), prim_data(i+2,j,k), + prim_data(i+1,j,k), prim_data(i ,j,k), + prim_data(i-1,j,k), prim_data(i-2,j,k)); + if ( (xflux_hi * (prim_data(i+1,j,k) - prim_data(i,j,k)) ) < 0.) xflux_hi = 0.; + + + Real rho_y_lo = 0.25 * ( cell_data(i ,j ,k,Rho_comp) + cell_data(i-1,j ,k,Rho_comp) + + cell_data(i ,j-1,k,Rho_comp) + cell_data(i-1,j-1,k,Rho_comp) ); + Real yflux_lo = rho_y_lo * calc_fifth_order_deriv(prim_data(i,j+2,k), prim_data(i,j+1,k), + prim_data(i,j ,k), prim_data(i,j-1,k), + prim_data(i,j-2,k), prim_data(i,j-3,k)); + if ( (yflux_lo * (prim_data(i,j,k) - prim_data(i,j-1,k)) ) < 0.) yflux_lo = 0.; + + + Real rho_y_hi = 0.25 * ( cell_data(i ,j ,k,Rho_comp) + cell_data(i-1,j ,k,Rho_comp) + + cell_data(i ,j+1,k,Rho_comp) + cell_data(i-1,j+1,k,Rho_comp) ); + Real yflux_hi = rho_y_hi * calc_fifth_order_deriv(prim_data(i,j+3,k), prim_data(i,j+2,k), + prim_data(i,j+1,k), prim_data(i,j ,k), + prim_data(i,j-1,k), prim_data(i,j-2,k)); + if ( (yflux_hi * (prim_data(i,j+1,k) - prim_data(i,j,k)) ) < 0.) yflux_hi = 0.; + + + rhs(i,j,k) += coeff6 * mf_arr(i,j,0) * ( (xflux_hi - xflux_lo) + + (yflux_hi - yflux_lo) ); }); } + /** * Function to compute 6th order numerical diffusion RHS. * @@ -86,35 +140,59 @@ NumericalDiffusion (const Box& bx, * @param[in] start_comp staring component index * @param[in] num_comp number of total components * @param[in] num_diff_coeff - * @param[in] data variables used to compute RHS + * @param[in] prim_data primitive variables + * @param[in] cell_data cell center variables * @param[out] rhs store the right hand side + * @param[in] mf map factor */ void -NumericalDiffusionVert (const Box& bx, - const int start_comp, - const int num_comp, - const Real dt, - const Real num_diff_coeff, - const Array4& data, - const Array4< Real>& rhs) +NumericalDiffusion_Ymom (const Box& bx, + const Real dt, + const Real num_diff_coeff, + const Array4& prim_data, + const Array4& cell_data, + const Array4< Real>& rhs, + const Array4& mf_arr) { - BL_PROFILE_VAR("NumericalDiffusionVert()",NumericalDiffusionVert); + BL_PROFILE_VAR("NumericalDiffusion_Ymom()",NumericalDiffusion_Ymom); // Capture diffusion coeff Real coeff6 = num_diff_coeff / (2.0 * dt); // Compute 5th order derivative and augment RHS - ParallelFor(bx, num_comp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int m) noexcept + ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { - int n = start_comp + m; - Real zflux_lo = 10. * (data(i,j,k ,n) - data(i,j,k-1,n)) - - 5. * (data(i,j,k+1,n) - data(i,j,k-2,n)) - + (data(i,j,k+2,n) - data(i,j,k-3,n)); - if ( (zflux_lo * (data(i,j,k,n) - data(i,j,k-1,n)) ) < 0.) zflux_lo = 0.; - Real zflux_hi = 10. * (data(i,j,k+1,n) - data(i,j,k ,n)) - - 5. * (data(i,j,k+2,n) - data(i,j,k-1,n)) - + (data(i,j,k+3,n) - data(i,j,k-2,n)); - if ( (zflux_hi * (data(i,j,k+1,n) - data(i,j,k,n)) ) < 0.) zflux_hi = 0.; - rhs(i,j,k,n) += coeff6 * ( (zflux_hi - zflux_lo) ); + Real rho_x_lo = 0.25 * ( cell_data(i ,j ,k,Rho_comp) + cell_data(i ,j-1,k,Rho_comp) + + cell_data(i-1,j ,k,Rho_comp) + cell_data(i-1,j-1,k,Rho_comp) ); + Real xflux_lo = rho_x_lo * calc_fifth_order_deriv(prim_data(i+2,j,k), prim_data(i+1,j,k), + prim_data(i ,j,k), prim_data(i-1,j,k), + prim_data(i-2,j,k), prim_data(i-3,j,k)); + if ( (xflux_lo * (prim_data(i,j,k) - prim_data(i-1,j,k)) ) < 0.) xflux_lo = 0.; + + + Real rho_x_hi = 0.25 * ( cell_data(i ,j ,k,Rho_comp) + cell_data(i ,j-1,k,Rho_comp) + + cell_data(i+1,j ,k,Rho_comp) + cell_data(i+1,j-1,k,Rho_comp) ); + Real xflux_hi = rho_x_hi * calc_fifth_order_deriv(prim_data(i+3,j,k), prim_data(i+2,j,k), + prim_data(i+1,j,k), prim_data(i ,j,k), + prim_data(i-1,j,k), prim_data(i-2,j,k)); + if ( (xflux_hi * (prim_data(i+1,j,k) - prim_data(i,j,k)) ) < 0.) xflux_hi = 0.; + + + Real rho_y_lo = cell_data(i,j-1,k,Rho_comp); + Real yflux_lo = rho_y_lo * calc_fifth_order_deriv(prim_data(i,j+2,k), prim_data(i,j+1,k), + prim_data(i,j ,k), prim_data(i,j-1,k), + prim_data(i,j-2,k), prim_data(i,j-3,k)); + if ( (yflux_lo * (prim_data(i,j,k) - prim_data(i,j-1,k)) ) < 0.) yflux_lo = 0.; + + + Real rho_y_hi = cell_data(i,j ,k,Rho_comp); + Real yflux_hi = rho_y_hi * calc_fifth_order_deriv(prim_data(i,j+3,k), prim_data(i,j+2,k), + prim_data(i,j+1,k), prim_data(i,j ,k), + prim_data(i,j-1,k), prim_data(i,j-2,k)); + if ( (yflux_hi * (prim_data(i,j ,k) - prim_data(i,j,k)) ) < 0.) yflux_hi = 0.; + + + rhs(i,j,k) += coeff6 * mf_arr(i,j,0) * ( (xflux_hi - xflux_lo) + + (yflux_hi - yflux_lo) ); }); } diff --git a/Source/SourceTerms/ERF_Src_headers.H b/Source/SourceTerms/ERF_Src_headers.H index d8ec184ca..667a9dfe7 100644 --- a/Source/SourceTerms/ERF_Src_headers.H +++ b/Source/SourceTerms/ERF_Src_headers.H @@ -20,8 +20,7 @@ void make_buoyancy (amrex::Vector< amrex::MultiFab>& S_data, amrex::MultiFab& buoyancy, const amrex::Geometry geom, const SolverChoice& solverChoice, - const amrex::MultiFab* r0, - const amrex::MultiFab* p0, + const amrex::MultiFab& base_state, const int n_qstate, const int anelastic); @@ -38,6 +37,7 @@ void make_sources (int level, int nrk, const SolverChoice& solverChoice, std::unique_ptr& mapfac_u, std::unique_ptr& mapfac_v, + std::unique_ptr& mapfac_m, const amrex::Real* dptr_rhotheta_src, const amrex::Real* dptr_rhoqt_src, const amrex::Real* dptr_wbar_sub, @@ -56,8 +56,7 @@ void make_mom_sources (int level, int nrk, amrex::MultiFab& xmom_source, amrex::MultiFab& ymom_source, amrex::MultiFab& zmom_source, - amrex::MultiFab* r0, - amrex::MultiFab* p0, + const amrex::MultiFab& base_state, const amrex::Geometry geom, const SolverChoice& solverChoice, std::unique_ptr& mapfac_m, diff --git a/Source/SourceTerms/ERF_buoyancy_utils.H b/Source/SourceTerms/ERF_buoyancy_utils.H new file mode 100644 index 000000000..e8db1015e --- /dev/null +++ b/Source/SourceTerms/ERF_buoyancy_utils.H @@ -0,0 +1,275 @@ +#ifndef ERF_BUOYANCY_UTILS_H_ +#define ERF_BUOYANCY_UTILS_H_ + +#include +#include + +AMREX_GPU_DEVICE +AMREX_FORCE_INLINE +amrex::Real +buoyancy_dry_anelastic (int& i, + int& j, + int& k, + amrex::Real const& grav_gpu, + const amrex::Array4& r0_arr, + const amrex::Array4& p0_arr, + const amrex::Array4& cell_data) +{ + // Note: this is the same term as the moist anelastic buoyancy when qv = qc = qt = 0 + amrex::Real theta_d_lo = cell_data(i,j,k-1,RhoTheta_comp)/r0_arr(i,j,k-1); + amrex::Real theta_d_hi = cell_data(i,j,k ,RhoTheta_comp)/r0_arr(i,j,k); + + amrex::Real theta_d_wface = amrex::Real(0.5) * (theta_d_lo + theta_d_hi); + + amrex::Real theta_d_0_lo = getRhoThetagivenP(p0_arr(i,j,k-1)) / r0_arr(i,j,k-1); + amrex::Real theta_d_0_hi = getRhoThetagivenP(p0_arr(i,j,k )) / r0_arr(i,j,k ); + + amrex::Real theta_d_0_wface = amrex::Real(0.5) * (theta_d_0_lo + theta_d_0_hi); + + return (-grav_gpu * (theta_d_wface - theta_d_0_wface) / theta_d_0_wface * 0.5 * (r0_arr(i,j,k) + r0_arr(i,j,k-1))); +} + +AMREX_GPU_DEVICE +AMREX_FORCE_INLINE +amrex::Real +buoyancy_dry_anelastic_T (int& i, + int& j, + int& k, + amrex::Real const& grav_gpu, + amrex::Real const& rd_over_cp, + const amrex::Array4& r0_arr, + const amrex::Array4& p0_arr, + const amrex::Array4& cell_data) +{ + amrex::Real rt0_hi = getRhoThetagivenP(p0_arr(i,j,k)); + amrex::Real t0_hi = getTgivenPandTh(p0_arr(i,j,k), rt0_hi/r0_arr(i,j,k), rd_over_cp); + amrex::Real t_hi = getTgivenPandTh(p0_arr(i,j,k), cell_data(i,j,k,RhoTheta_comp)/r0_arr(i,j,k), rd_over_cp); + amrex::Real qplus = (t_hi-t0_hi)/t0_hi; + + amrex::Real rt0_lo = getRhoThetagivenP(p0_arr(i,j,k-1)); + amrex::Real t0_lo = getTgivenPandTh(p0_arr(i,j,k-1), rt0_lo/r0_arr(i,j,k-1), rd_over_cp); + amrex::Real t_lo = getTgivenPandTh(p0_arr(i,j,k-1), cell_data(i,j,k-1,RhoTheta_comp)/r0_arr(i,j,k-1), rd_over_cp); + amrex::Real qminus = (t_lo-t0_lo)/t0_lo; + + amrex::Real r0_q_avg = amrex::Real(0.5) * (r0_arr(i,j,k) * qplus + r0_arr(i,j,k-1) * qminus); + return (-r0_q_avg * grav_gpu); +} + + +AMREX_GPU_DEVICE +AMREX_FORCE_INLINE +amrex::Real +buoyancy_moist_anelastic (int& i, + int& j, + int& k, + amrex::Real const& grav_gpu, + amrex::Real const& rv_over_rd, + const amrex::Array4& r0_arr, + const amrex::Array4& th0_arr, + const amrex::Array4& cell_data) +{ + amrex::Real theta_d_lo = cell_data(i,j,k-1,RhoTheta_comp)/r0_arr(i,j,k-1); + amrex::Real qv_lo = cell_data(i,j,k-1,RhoQ1_comp) /r0_arr(i,j,k-1); + amrex::Real qc_lo = cell_data(i,j,k-1,RhoQ2_comp) /r0_arr(i,j,k-1); + amrex::Real qt_lo = qv_lo + qc_lo; + amrex::Real theta_v_lo = theta_d_lo * (1.0 - (1.0 - rv_over_rd)*qt_lo - rv_over_rd*qc_lo); + + amrex::Real theta_d_hi = cell_data(i,j,k,RhoTheta_comp)/r0_arr(i,j,k); + amrex::Real qv_hi = cell_data(i,j,k,RhoQ1_comp) /r0_arr(i,j,k); + amrex::Real qc_hi = cell_data(i,j,k,RhoQ2_comp) /r0_arr(i,j,k); + amrex::Real qt_hi = qv_hi + qc_hi; + amrex::Real theta_v_hi = theta_d_hi * (1.0 - (1.0 - rv_over_rd)*qt_hi - rv_over_rd*qc_hi); + + amrex::Real theta_v_wface = amrex::Real(0.5) * (theta_v_lo + theta_v_hi); + + amrex::Real theta_v_0_lo = th0_arr(i,j,k-1) * (1.0 - (1.0 - rv_over_rd)*qt_lo - rv_over_rd*qc_lo); + amrex::Real theta_v_0_hi = th0_arr(i,j,k ) * (1.0 - (1.0 - rv_over_rd)*qt_hi - rv_over_rd*qc_hi); + + amrex::Real theta_v_0_wface = amrex::Real(0.5) * (theta_v_0_lo + theta_v_0_hi); + + return (-grav_gpu * (theta_v_wface - theta_v_0_wface) / theta_v_0_wface * 0.5 * (r0_arr(i,j,k) + r0_arr(i,j,k-1))); +} + +AMREX_GPU_DEVICE +AMREX_FORCE_INLINE +amrex::Real +buoyancy_dry_default (int& i, + int& j, + int& k, + amrex::Real const& grav_gpu, + amrex::Real const& rd_over_cp, + const amrex::Array4& r0_arr, + const amrex::Array4& p0_arr, + const amrex::Array4& th0_arr, + const amrex::Array4& cell_data) +{ + amrex::Real t0_hi = getTgivenPandTh(p0_arr(i,j,k), th0_arr(i,j,k), rd_over_cp); + amrex::Real t_hi = getTgivenRandRTh(cell_data(i,j,k ,Rho_comp), cell_data(i,j,k ,RhoTheta_comp)); + amrex::Real qplus = (t_hi-t0_hi)/t0_hi; + + amrex::Real t0_lo = getTgivenPandTh(p0_arr(i,j,k-1), th0_arr(i,j,k-1), rd_over_cp); + amrex::Real t_lo = getTgivenRandRTh(cell_data(i,j,k-1,Rho_comp), cell_data(i,j,k-1,RhoTheta_comp)); + amrex::Real qminus = (t_lo-t0_lo)/t0_lo; + + amrex::Real r0_q_avg = amrex::Real(0.5) * (r0_arr(i,j,k) * qplus + r0_arr(i,j,k-1) * qminus); + return (-r0_q_avg * grav_gpu); +} + +AMREX_GPU_DEVICE +AMREX_FORCE_INLINE +amrex::Real +buoyancy_type1 (int& i, + int& j, + int& k, + const int& n_qstate, + amrex::Real const& grav_gpu, + const amrex::Array4& r0_arr, + const amrex::Array4& cell_data) +{ + amrex::Real rhop_hi = cell_data(i,j,k ,Rho_comp) - r0_arr(i,j,k ); + amrex::Real rhop_lo = cell_data(i,j,k-1,Rho_comp) - r0_arr(i,j,k-1); + for (int q_offset(0); q_offset& cell_prim, + const amrex::Array4& cell_data) +{ + amrex::Real tempp1d = getTgivenRandRTh(rho_d_ptr[k ], rho_d_ptr[k ]*theta_d_ptr[k ], qv_d_ptr[k ]); + amrex::Real tempm1d = getTgivenRandRTh(rho_d_ptr[k-1], rho_d_ptr[k-1]*theta_d_ptr[k-1], qv_d_ptr[k-1]); + + amrex::Real tempp3d = getTgivenRandRTh(cell_data(i,j,k ,Rho_comp), + cell_data(i,j,k ,RhoTheta_comp), + cell_data(i,j,k ,RhoQ1_comp)/cell_data(i,j,k ,Rho_comp)); + amrex::Real tempm3d = getTgivenRandRTh(cell_data(i,j,k-1,Rho_comp), + cell_data(i,j,k-1,RhoTheta_comp), + cell_data(i,j,k-1,RhoQ1_comp)/cell_data(i,j,k-1,Rho_comp)); + + amrex::Real qv_plus = (n_qstate >= 1) ? cell_prim(i,j,k ,PrimQ1_comp) : 0.0; + amrex::Real qv_minus = (n_qstate >= 1) ? cell_prim(i,j,k-1,PrimQ1_comp) : 0.0; + + amrex::Real qc_plus = (n_qstate >= 2) ? cell_prim(i,j,k ,PrimQ2_comp) : 0.0; + amrex::Real qc_minus = (n_qstate >= 2) ? cell_prim(i,j,k-1,PrimQ2_comp) : 0.0; + + amrex::Real qp_plus = (n_qstate >= 3) ? cell_prim(i,j,k ,PrimQ3_comp) : 0.0; + amrex::Real qp_minus = (n_qstate >= 3) ? cell_prim(i,j,k-1,PrimQ3_comp) : 0.0; + + amrex::Real qplus = 0.61 * ( qv_plus - qv_d_ptr[k] ) - + ( qc_plus - qc_d_ptr[k] + + qp_plus - qp_d_ptr[k] ) + + (tempp3d-tempp1d)/tempp1d*(amrex::Real(1.0) + amrex::Real(0.61)*qv_d_ptr[k]-qc_d_ptr[k]-qp_d_ptr[k]); + + amrex::Real qminus = 0.61 * ( qv_minus - qv_d_ptr[k-1] ) - + ( qc_minus - qc_d_ptr[k-1] + + qp_minus - qp_d_ptr[k-1] ) + + (tempm3d-tempm1d)/tempm1d*(amrex::Real(1.0) + amrex::Real(0.61)*qv_d_ptr[k-1]-qc_d_ptr[k-1]-qp_d_ptr[k-1]); + + amrex::Real qavg = amrex::Real(0.5) * (qplus + qminus); + amrex::Real r0avg = amrex::Real(0.5) * (rho_d_ptr[k] + rho_d_ptr[k-1]); + + return (-qavg * r0avg * grav_gpu); +} + + +AMREX_GPU_DEVICE +AMREX_FORCE_INLINE +amrex::Real +buoyancy_type3 (int& i, + int& j, + int& k, + const int& n_qstate, + amrex::Real const& grav_gpu, + amrex::Real* rho_d_ptr, + amrex::Real* theta_d_ptr, + amrex::Real* qv_d_ptr, + const amrex::Array4& cell_prim, + const amrex::Array4& cell_data) +{ + amrex::Real tempp1d = getTgivenRandRTh(rho_d_ptr[k ], rho_d_ptr[k ]*theta_d_ptr[k ], qv_d_ptr[k ]); + amrex::Real tempm1d = getTgivenRandRTh(rho_d_ptr[k-1], rho_d_ptr[k-1]*theta_d_ptr[k-1], qv_d_ptr[k-1]); + + amrex::Real tempp3d = getTgivenRandRTh(cell_data(i,j,k ,Rho_comp), + cell_data(i,j,k ,RhoTheta_comp), + cell_data(i,j,k ,RhoQ1_comp)/cell_data(i,j,k ,Rho_comp)); + amrex::Real tempm3d = getTgivenRandRTh(cell_data(i,j,k-1,Rho_comp), + cell_data(i,j,k-1,RhoTheta_comp), + cell_data(i,j,k-1,RhoQ1_comp)/cell_data(i,j,k-1,Rho_comp)); + + amrex::Real qv_plus = (n_qstate >= 1) ? cell_prim(i,j,k ,PrimQ1_comp) : 0.0; + amrex::Real qv_minus = (n_qstate >= 1) ? cell_prim(i,j,k-1,PrimQ1_comp) : 0.0; + + amrex::Real qc_plus = (n_qstate >= 2) ? cell_prim(i,j,k ,PrimQ2_comp) : 0.0; + amrex::Real qc_minus = (n_qstate >= 2) ? cell_prim(i,j,k-1,PrimQ2_comp) : 0.0; + + amrex::Real qp_plus = (n_qstate >= 3) ? cell_prim(i,j,k ,PrimQ3_comp) : 0.0; + amrex::Real qp_minus = (n_qstate >= 3) ? cell_prim(i,j,k-1,PrimQ3_comp) : 0.0; + + amrex::Real qplus = 0.61 * qv_plus - (qc_plus + qp_plus) + (tempp3d-tempp1d)/tempp1d; + + amrex::Real qminus = 0.61 * qv_minus - (qc_minus + qp_minus) + (tempm3d-tempm1d)/tempm1d; + + amrex::Real qavg = amrex::Real(0.5) * (qplus + qminus); + amrex::Real r0avg = amrex::Real(0.5) * (rho_d_ptr[k] + rho_d_ptr[k-1]); + + return ( -qavg * r0avg * grav_gpu ); +} + + +AMREX_GPU_DEVICE +AMREX_FORCE_INLINE +amrex::Real +buoyancy_type4 (int& i, + int& j, + int& k, + const int& n_qstate, + amrex::Real const& grav_gpu, + amrex::Real* rho_d_ptr, + amrex::Real* theta_d_ptr, + amrex::Real* qv_d_ptr, + amrex::Real* qc_d_ptr, + amrex::Real* qp_d_ptr, + const amrex::Array4& cell_prim, + const amrex::Array4& cell_data) +{ + amrex::Real qv_plus = (n_qstate >= 1) ? cell_prim(i,j,k ,PrimQ1_comp) : 0.0; + amrex::Real qv_minus = (n_qstate >= 1) ? cell_prim(i,j,k-1,PrimQ1_comp) : 0.0; + + amrex::Real qc_plus = (n_qstate >= 2) ? cell_prim(i,j,k ,PrimQ2_comp) : 0.0; + amrex::Real qc_minus = (n_qstate >= 2) ? cell_prim(i,j,k-1,PrimQ2_comp) : 0.0; + + amrex::Real qp_plus = (n_qstate >= 3) ? cell_prim(i,j,k ,PrimQ3_comp) : 0.0; + amrex::Real qp_minus = (n_qstate >= 3) ? cell_prim(i,j,k-1,PrimQ3_comp) : 0.0; + + amrex::Real qplus = amrex::Real(0.61) * ( qv_plus - qv_d_ptr[k] ) - + ( qc_plus - qc_d_ptr[k] + + qp_plus - qp_d_ptr[k] ) + + (cell_data(i,j,k ,RhoTheta_comp)/cell_data(i,j,k ,Rho_comp) - theta_d_ptr[k ])/theta_d_ptr[k ]; + + amrex::Real qminus = amrex::Real(0.61) * ( qv_minus - qv_d_ptr[k-1] ) - + ( qc_minus - qc_d_ptr[k-1] + + qp_minus - qp_d_ptr[k-1] ) + + (cell_data(i,j,k-1,RhoTheta_comp)/cell_data(i,j,k-1,Rho_comp) - theta_d_ptr[k-1])/theta_d_ptr[k-1]; + + amrex::Real qavg = amrex::Real(0.5) * (qplus + qminus); + amrex::Real r0avg = amrex::Real(0.5) * (rho_d_ptr[k] + rho_d_ptr[k-1]); + + return (-qavg * r0avg * grav_gpu); +} +#endif diff --git a/Source/SourceTerms/ERF_make_buoyancy.cpp b/Source/SourceTerms/ERF_make_buoyancy.cpp index d9ec30a53..ca101605e 100644 --- a/Source/SourceTerms/ERF_make_buoyancy.cpp +++ b/Source/SourceTerms/ERF_make_buoyancy.cpp @@ -7,7 +7,7 @@ #include #include #include -//#include +#include using namespace amrex; @@ -34,8 +34,7 @@ void make_buoyancy (Vector& S_data, MultiFab& buoyancy, const amrex::Geometry geom, const SolverChoice& solverChoice, - const MultiFab* r0, - const MultiFab* p0, + const MultiFab& base_state, const int n_qstate, const int anelastic) { @@ -48,6 +47,11 @@ void make_buoyancy (Vector& S_data, const int khi = geom.Domain().bigEnd()[2] + 1; Real rd_over_cp = solverChoice.rdOcp; + Real rv_over_rd = R_v/R_d; + + MultiFab r0 (base_state, make_alias, BaseState::r0_comp , 1); + MultiFab p0 (base_state, make_alias, BaseState::p0_comp , 1); + MultiFab th0(base_state, make_alias, BaseState::th0_comp, 1); if (anelastic == 1) { #ifdef _OPENMP @@ -65,24 +69,28 @@ void make_buoyancy (Vector& S_data, const Array4< Real> & buoyancy_fab = buoyancy.array(mfi); // Base state density and pressure - const Array4& r0_arr = r0->const_array(mfi); - const Array4& p0_arr = p0->const_array(mfi); + const Array4& r0_arr = r0.const_array(mfi); + const Array4& p0_arr = p0.const_array(mfi); + const Array4& th0_arr = th0.const_array(mfi); - ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) - { - Real rt0_hi = getRhoThetagivenP(p0_arr(i,j,k)); - Real t0_hi = getTgivenPandTh(p0_arr(i,j,k), rt0_hi/r0_arr(i,j,k), rd_over_cp); - Real t_hi = getTgivenPandTh(p0_arr(i,j,k), cell_data(i,j,k,RhoTheta_comp)/r0_arr(i,j,k), rd_over_cp); - Real qplus = (t_hi-t0_hi)/t0_hi; - - Real rt0_lo = getRhoThetagivenP(p0_arr(i,j,k-1)); - Real t0_lo = getTgivenPandTh(p0_arr(i,j,k-1), rt0_lo/r0_arr(i,j,k-1), rd_over_cp); - Real t_lo = getTgivenPandTh(p0_arr(i,j,k-1), cell_data(i,j,k-1,RhoTheta_comp)/r0_arr(i,j,k-1), rd_over_cp); - Real qminus = (t_lo-t0_lo)/t0_lo; - - Real r0_q_avg = Real(0.5) * (r0_arr(i,j,k) * qplus + r0_arr(i,j,k-1) * qminus); - buoyancy_fab(i, j, k) = -r0_q_avg * grav_gpu[2]; - }); + if (solverChoice.moisture_type == MoistureType::None) { + ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) + { + buoyancy_fab(i, j, k) = buoyancy_dry_anelastic(i,j,k, + grav_gpu[2], + r0_arr,p0_arr,cell_data); + }); + } else { + // NOTE: For decomposition in the vertical direction, klo may not + // reside in the valid box and this call will yield an out + // of bounds error since it depends upon the surface theta_l + ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) + { + buoyancy_fab(i, j, k) = buoyancy_moist_anelastic(i,j,k, + grav_gpu[2],rv_over_rd, + r0_arr,th0_arr,cell_data); + }); + } } // mfi } else @@ -92,75 +100,67 @@ void make_buoyancy (Vector& S_data, // ****************************************************************************************** if (solverChoice.moisture_type == MoistureType::None) { - if (solverChoice.buoyancy_type == 1) { + int n_q_dry = 0; + if (solverChoice.buoyancy_type == 1) { #ifdef _OPENMP #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) #endif - for ( MFIter mfi(buoyancy,TilingIfNotGPU()); mfi.isValid(); ++mfi) - { - Box tbz = mfi.tilebox(); + for ( MFIter mfi(buoyancy,TilingIfNotGPU()); mfi.isValid(); ++mfi) + { + Box tbz = mfi.tilebox(); - // We don't compute a source term for z-momentum on the bottom or top domain boundary - if (tbz.smallEnd(2) == klo) tbz.growLo(2,-1); - if (tbz.bigEnd(2) == khi) tbz.growHi(2,-1); + // We don't compute a source term for z-momentum on the bottom or top domain boundary + if (tbz.smallEnd(2) == klo) tbz.growLo(2,-1); + if (tbz.bigEnd(2) == khi) tbz.growHi(2,-1); - const Array4 & cell_data = S_data[IntVars::cons].array(mfi); - const Array4< Real> & buoyancy_fab = buoyancy.array(mfi); + const Array4 & cell_data = S_data[IntVars::cons].array(mfi); + const Array4< Real> & buoyancy_fab = buoyancy.array(mfi); - // Base state density - const Array4& r0_arr = r0->const_array(mfi); + // Base state density + const Array4& r0_arr = r0.const_array(mfi); - ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) - { - buoyancy_fab(i, j, k) = grav_gpu[2] * 0.5 * ( (cell_data(i,j,k ) - r0_arr(i,j,k )) - +(cell_data(i,j,k-1) - r0_arr(i,j,k-1)) ); - }); - } // mfi + ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) + { + buoyancy_fab(i, j, k) = buoyancy_type1(i,j,k,n_q_dry,grav_gpu[2],r0_arr,cell_data); + }); + } // mfi - } - else // (buoyancy_type != 1) - { - // We now use the base state rather than planar average because - // 1) we don't want to average over the limited region of the fine level if doing multilevel. - // 2) it's cheaper to use the base state than to compute the horizontal averages - // 3) when running in a smallish domain, the horizontal average may evolve over time, - // which is not necessarily the intended behavior - // + } + else // (buoyancy_type != 1) + { + // We now use the base state rather than planar average because + // 1) we don't want to average over the limited region of the fine level if doing multilevel. + // 2) it's cheaper to use the base state than to compute the horizontal averages + // 3) when running in a smallish domain, the horizontal average may evolve over time, + // which is not necessarily the intended behavior + // #ifdef _OPENMP #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) #endif - for ( MFIter mfi(buoyancy,TilingIfNotGPU()); mfi.isValid(); ++mfi) - { - Box tbz = mfi.tilebox(); + for ( MFIter mfi(buoyancy,TilingIfNotGPU()); mfi.isValid(); ++mfi) + { + Box tbz = mfi.tilebox(); - // We don't compute a source term for z-momentum on the bottom or top boundary - if (tbz.smallEnd(2) == klo) tbz.growLo(2,-1); - if (tbz.bigEnd(2) == khi) tbz.growHi(2,-1); + // We don't compute a source term for z-momentum on the bottom or top boundary + if (tbz.smallEnd(2) == klo) tbz.growLo(2,-1); + if (tbz.bigEnd(2) == khi) tbz.growHi(2,-1); - // Base state density and pressure - const Array4& r0_arr = r0->const_array(mfi); - const Array4& p0_arr = p0->const_array(mfi); + // Base state density and pressure + const Array4& r0_arr = r0.const_array(mfi); + const Array4& p0_arr = p0.const_array(mfi); + const Array4& th0_arr = th0.const_array(mfi); - const Array4 & cell_data = S_data[IntVars::cons].array(mfi); - const Array4< Real> & buoyancy_fab = buoyancy.array(mfi); + const Array4 & cell_data = S_data[IntVars::cons].array(mfi); + const Array4< Real> & buoyancy_fab = buoyancy.array(mfi); - ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) - { - Real rt0_hi = getRhoThetagivenP(p0_arr(i,j,k)); - Real t0_hi = getTgivenPandTh(p0_arr(i,j,k), rt0_hi/r0_arr(i,j,k), rd_over_cp); - Real t_hi = getTgivenRandRTh(cell_data(i,j,k ,Rho_comp), cell_data(i,j,k ,RhoTheta_comp)); - Real qplus = (t_hi-t0_hi)/t0_hi; - - Real rt0_lo = getRhoThetagivenP(p0_arr(i,j,k-1)); - Real t0_lo = getTgivenPandTh(p0_arr(i,j,k-1), rt0_lo/r0_arr(i,j,k-1), rd_over_cp); - Real t_lo = getTgivenRandRTh(cell_data(i,j,k-1,Rho_comp), cell_data(i,j,k-1,RhoTheta_comp)); - Real qminus = (t_lo-t0_lo)/t0_lo; - - Real r0_q_avg = Real(0.5) * (r0_arr(i,j,k) * qplus + r0_arr(i,j,k-1) * qminus); - buoyancy_fab(i, j, k) = -r0_q_avg * grav_gpu[2]; - }); - } // mfi - } // buoyancy_type + ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) + { + buoyancy_fab(i, j, k) = buoyancy_dry_default(i,j,k, + grav_gpu[2],rd_over_cp, + r0_arr,p0_arr,th0_arr,cell_data); + }); + } // mfi + } // buoyancy_type } // moisture type else { @@ -192,27 +192,19 @@ void make_buoyancy (Vector& S_data, const Array4< Real> & buoyancy_fab = buoyancy.array(mfi); // Base state density - const Array4& r0_arr = r0->const_array(mfi); + const Array4& r0_arr = r0.const_array(mfi); ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) { - Real rhop_hi = cell_data(i,j,k ,Rho_comp) + cell_data(i,j,k ,RhoQ1_comp) - + cell_data(i,j,k ,RhoQ2_comp) - r0_arr(i,j,k ); - Real rhop_lo = cell_data(i,j,k-1,Rho_comp) + cell_data(i,j,k-1,RhoQ1_comp) - + cell_data(i,j,k-1,RhoQ2_comp) - r0_arr(i,j,k-1); - - for (int q_offset(2); q_offset& S_data, const Array4 & cell_prim = S_prim.array(mfi); // TODO: ice has not been dealt with (q1=qv, q2=qv, q3=qp) - ParallelFor(tbz, [=, buoyancy_type=solverChoice.buoyancy_type] AMREX_GPU_DEVICE (int i, int j, int k) - { - Real tempp1d = getTgivenRandRTh(rho_d_ptr[k ], rho_d_ptr[k ]*theta_d_ptr[k ], qv_d_ptr[k ]); - Real tempm1d = getTgivenRandRTh(rho_d_ptr[k-1], rho_d_ptr[k-1]*theta_d_ptr[k-1], qv_d_ptr[k-1]); - - Real tempp3d = getTgivenRandRTh(cell_data(i,j,k ,Rho_comp), - cell_data(i,j,k ,RhoTheta_comp), - cell_data(i,j,k ,RhoQ1_comp)/cell_data(i,j,k ,Rho_comp)); - Real tempm3d = getTgivenRandRTh(cell_data(i,j,k-1,Rho_comp), - cell_data(i,j,k-1,RhoTheta_comp), - cell_data(i,j,k-1,RhoQ1_comp)/cell_data(i,j,k-1,Rho_comp)); - - Real qplus, qminus; - - Real qv_plus = (n_qstate >= 1) ? cell_prim(i,j,k ,PrimQ1_comp) : 0.0; - Real qv_minus = (n_qstate >= 1) ? cell_prim(i,j,k-1,PrimQ1_comp) : 0.0; - - Real qc_plus = (n_qstate >= 2) ? cell_prim(i,j,k ,PrimQ2_comp) : 0.0; - Real qc_minus = (n_qstate >= 2) ? cell_prim(i,j,k-1,PrimQ2_comp) : 0.0; - - Real qp_plus = (n_qstate >= 3) ? cell_prim(i,j,k ,PrimQ3_comp) : 0.0; - Real qp_minus = (n_qstate >= 3) ? cell_prim(i,j,k-1,PrimQ3_comp) : 0.0; - - if (buoyancy_type == 2) { - qplus = 0.61 * ( qv_plus - qv_d_ptr[k] ) - - ( qc_plus - qc_d_ptr[k] + - qp_plus - qp_d_ptr[k] ) - + (tempp3d-tempp1d)/tempp1d*(Real(1.0) + Real(0.61)*qv_d_ptr[k]-qc_d_ptr[k]-qp_d_ptr[k]); - - qminus = 0.61 * ( qv_minus - qv_d_ptr[k-1] ) - - ( qc_minus - qc_d_ptr[k-1] + - qp_minus - qp_d_ptr[k-1] ) - + (tempm3d-tempm1d)/tempm1d*(Real(1.0) + Real(0.61)*qv_d_ptr[k-1]-qc_d_ptr[k-1]-qp_d_ptr[k-1]); - - } else { // (buoyancy_type == 4) - qplus = 0.61 * ( qv_plus - qv_d_ptr[k] ) - - ( qc_plus - qc_d_ptr[k] + - qp_plus - qp_d_ptr[k] ) - + (cell_data(i,j,k ,RhoTheta_comp)/cell_data(i,j,k ,Rho_comp) - theta_d_ptr[k ])/theta_d_ptr[k ]; - - qminus = 0.61 * ( qv_minus - qv_d_ptr[k-1] ) - - ( qc_minus - qc_d_ptr[k-1] + - qp_minus - qp_d_ptr[k-1] ) - + (cell_data(i,j,k-1,RhoTheta_comp)/cell_data(i,j,k-1,Rho_comp) - theta_d_ptr[k-1])/theta_d_ptr[k-1]; - } - - Real qavg = Real(0.5) * (qplus + qminus); - Real r0avg = Real(0.5) * (rho_d_ptr[k] + rho_d_ptr[k-1]); - - buoyancy_fab(i, j, k) = -qavg * r0avg * grav_gpu[2]; - }); + if (solverChoice.buoyancy_type == 2) { + ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) + { + buoyancy_fab(i, j, k) = buoyancy_type2(i,j,k,n_qstate,grav_gpu[2], + rho_d_ptr,theta_d_ptr, + qv_d_ptr,qc_d_ptr,qp_d_ptr, + cell_prim,cell_data); + }); + } else { + ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) + { + buoyancy_fab(i, j, k) = buoyancy_type4(i,j,k,n_qstate,grav_gpu[2], + rho_d_ptr,theta_d_ptr, + qv_d_ptr,qc_d_ptr,qp_d_ptr, + cell_prim,cell_data); + }); + } } // mfi } else if (solverChoice.buoyancy_type == 3) { @@ -344,33 +302,9 @@ void make_buoyancy (Vector& S_data, ParallelFor(tbz, [=] AMREX_GPU_DEVICE (int i, int j, int k) { - Real tempp1d = getTgivenRandRTh(rho_d_ptr[k ], rho_d_ptr[k ]*theta_d_ptr[k ], qv_d_ptr[k ]); - Real tempm1d = getTgivenRandRTh(rho_d_ptr[k-1], rho_d_ptr[k-1]*theta_d_ptr[k-1], qv_d_ptr[k-1]); - - Real tempp3d = getTgivenRandRTh(cell_data(i,j,k ,Rho_comp), - cell_data(i,j,k ,RhoTheta_comp), - cell_data(i,j,k ,RhoQ1_comp)/cell_data(i,j,k ,Rho_comp)); - Real tempm3d = getTgivenRandRTh(cell_data(i,j,k-1,Rho_comp), - cell_data(i,j,k-1,RhoTheta_comp), - cell_data(i,j,k-1,RhoQ1_comp)/cell_data(i,j,k-1,Rho_comp)); - - Real qv_plus = (n_qstate >= 1) ? cell_prim(i,j,k ,PrimQ1_comp) : 0.0; - Real qv_minus = (n_qstate >= 1) ? cell_prim(i,j,k-1,PrimQ1_comp) : 0.0; - - Real qc_plus = (n_qstate >= 2) ? cell_prim(i,j,k ,PrimQ2_comp) : 0.0; - Real qc_minus = (n_qstate >= 2) ? cell_prim(i,j,k-1,PrimQ2_comp) : 0.0; - - Real qp_plus = (n_qstate >= 3) ? cell_prim(i,j,k ,PrimQ3_comp) : 0.0; - Real qp_minus = (n_qstate >= 3) ? cell_prim(i,j,k-1,PrimQ3_comp) : 0.0; - - Real qplus = 0.61 * qv_plus - (qc_plus + qp_plus) + (tempp3d-tempp1d)/tempp1d; - - Real qminus = 0.61 * qv_minus - (qc_minus + qp_minus) + (tempm3d-tempm1d)/tempm1d; - - Real qavg = Real(0.5) * (qplus + qminus); - Real r0avg = Real(0.5) * (rho_d_ptr[k] + rho_d_ptr[k-1]); - - buoyancy_fab(i, j, k) = -qavg * r0avg * grav_gpu[2]; + buoyancy_fab(i, j, k) = buoyancy_type3(i,j,k,n_qstate,grav_gpu[2], + rho_d_ptr,theta_d_ptr,qv_d_ptr, + cell_prim,cell_data); }); } // mfi } // buoyancy_type diff --git a/Source/SourceTerms/ERF_make_mom_sources.cpp b/Source/SourceTerms/ERF_make_mom_sources.cpp index b60190bfe..44c4ccb46 100644 --- a/Source/SourceTerms/ERF_make_mom_sources.cpp +++ b/Source/SourceTerms/ERF_make_mom_sources.cpp @@ -38,7 +38,9 @@ using namespace amrex; */ void make_mom_sources (int level, - int /*nrk*/, Real dt, Real time, + int /*nrk*/, + Real /*dt*/, + Real time, Vector& S_data, const MultiFab & S_prim, std::unique_ptr& z_phys_nd, @@ -48,12 +50,12 @@ void make_mom_sources (int level, MultiFab & xmom_src, MultiFab & ymom_src, MultiFab & zmom_src, - MultiFab* r0, MultiFab* p0, + const MultiFab& base_state, const Geometry geom, const SolverChoice& solverChoice, - std::unique_ptr& mapfac_m, - std::unique_ptr& mapfac_u, - std::unique_ptr& mapfac_v, + std::unique_ptr& /*mapfac_m*/, + std::unique_ptr& /*mapfac_u*/, + std::unique_ptr& /*mapfac_v*/, const Real* dptr_u_geos, const Real* dptr_v_geos, const Real* dptr_wbar_sub, @@ -190,7 +192,7 @@ void make_mom_sources (int level, // ***************************************************************************** // 1. Create the BUOYANCY forcing term in the z-direction // ***************************************************************************** - make_buoyancy(S_data, S_prim, zmom_src, geom, solverChoice, r0, p0, + make_buoyancy(S_data, S_prim, zmom_src, geom, solverChoice, base_state, n_qstate, solverChoice.anelastic[level]); // ***************************************************************************** @@ -208,14 +210,17 @@ void make_mom_sources (int level, const Array4& rho_v = S_data[IntVars::ymom].array(mfi); const Array4& rho_w = S_data[IntVars::zmom].array(mfi); + //const Array4& u = xvel.array(mfi); + //const Array4& v = yvel.array(mfi); + const Array4< Real>& xmom_src_arr = xmom_src.array(mfi); const Array4< Real>& ymom_src_arr = ymom_src.array(mfi); const Array4< Real>& zmom_src_arr = zmom_src.array(mfi); // Map factors - const Array4& mf_m = mapfac_m->const_array(mfi); - const Array4& mf_u = mapfac_u->const_array(mfi); - const Array4& mf_v = mapfac_v->const_array(mfi); + //const Array4& mf_m = mapfac_m->const_array(mfi); + //const Array4& mf_u = mapfac_u->const_array(mfi); + //const Array4& mf_v = mapfac_v->const_array(mfi); const Array4& z_nd_arr = (use_terrain) ? z_phys_nd->const_array(mfi) : Array4{}; const Array4& z_cc_arr = (use_terrain) ? z_phys_cc->const_array(mfi) : Array4{}; @@ -424,12 +429,12 @@ void make_mom_sources (int level, // 7. Add NUMERICAL DIFFUSION terms // ***************************************************************************** if (l_use_ndiff) { - NumericalDiffusion(tbx, 0, 1, dt, solverChoice.NumDiffCoeff, - rho_u, xmom_src_arr, mf_m, mf_v, false, true); - NumericalDiffusion(tby, 0, 1, dt, solverChoice.NumDiffCoeff, - rho_v, ymom_src_arr, mf_u, mf_m, true, false); - NumericalDiffusion(tbz, 0, 1, dt, solverChoice.NumDiffCoeff, - rho_w, zmom_src_arr, mf_u, mf_v, false, false); + /* + NumericalDiffusion_Xmom(tbx, dt, solverChoice.NumDiffCoeff, + u, cell_data, xmom_src_arr, mf_u); + NumericalDiffusion_Ymom(tby, dt, solverChoice.NumDiffCoeff, + v, cell_data, ymom_src_arr, mf_v); + */ } // ***************************************************************************** diff --git a/Source/SourceTerms/ERF_make_sources.cpp b/Source/SourceTerms/ERF_make_sources.cpp index a2f7000e1..d97cd41c1 100644 --- a/Source/SourceTerms/ERF_make_sources.cpp +++ b/Source/SourceTerms/ERF_make_sources.cpp @@ -40,8 +40,9 @@ void make_sources (int level, #endif const Geometry geom, const SolverChoice& solverChoice, - std::unique_ptr& mapfac_u, - std::unique_ptr& mapfac_v, + std::unique_ptr& /*mapfac_u*/, + std::unique_ptr& /*mapfac_v*/, + std::unique_ptr& mapfac_m, const Real* dptr_rhotheta_src, const Real* dptr_rhoqt_src, const Real* dptr_wbar_sub, @@ -60,8 +61,9 @@ void make_sources (int level, const bool use_terrain = solverChoice.use_terrain; TurbChoice tc = solverChoice.turbChoice[level]; - const bool l_use_deardorff = (tc.les_type == LESType::Deardorff); - const bool l_use_QKE = tc.use_QKE && tc.diffuse_QKE_3D; + const bool l_use_KE = ( (tc.les_type == LESType::Deardorff) || + (tc.pbl_type == PBLType::MYNN25) ); + const bool l_diff_KE = tc.diffuse_KE_3D; const Box& domain = geom.Domain(); @@ -329,33 +331,27 @@ void make_sources (int level, // 6. Add numerical diffuion for rho and (rho theta) // ************************************************************************************* if (l_use_ndiff) { - int start_comp = 0; - int num_comp = 2; + int sc; + int nc; - const Array4& mf_u = mapfac_u->const_array(mfi); - const Array4& mf_v = mapfac_v->const_array(mfi); + const Array4& mf_m = mapfac_m->const_array(mfi); - NumericalDiffusion(bx, start_comp, num_comp, dt, solverChoice.NumDiffCoeff, - cell_data, cell_src, mf_u, mf_v, false, false); + // Rho is a special case + NumericalDiffusion_Scal(bx, sc=0, nc=1, dt, solverChoice.NumDiffCoeff, + cell_data, cell_data, cell_src, mf_m); - if (l_use_deardorff) { - int sc = RhoKE_comp; - int nc = 1; - NumericalDiffusion(bx, sc, nc, dt, solverChoice.NumDiffCoeff, - cell_data, cell_src, mf_u, mf_v, false, false); - } - if (l_use_QKE) { - int sc = RhoQKE_comp; - int nc = 1; - NumericalDiffusion(bx, sc, nc, dt, solverChoice.NumDiffCoeff, - cell_data, cell_src, mf_u, mf_v, false, false); - } - { - int sc = RhoScalar_comp; - int nc = NSCALARS; - NumericalDiffusion(bx, sc, nc, dt, solverChoice.NumDiffCoeff, - cell_data, cell_src, mf_u, mf_v, false, false); + // Other scalars proceed as normal + NumericalDiffusion_Scal(bx, sc=1, nc=1, dt, solverChoice.NumDiffCoeff, + cell_prim, cell_data, cell_src, mf_m); + + + if (l_use_KE && l_diff_KE) { + NumericalDiffusion_Scal(bx, sc=RhoKE_comp, nc=1, dt, solverChoice.NumDiffCoeff, + cell_prim, cell_data, cell_src, mf_m); } + + NumericalDiffusion_Scal(bx, sc=RhoScalar_comp, nc=NSCALARS, dt, solverChoice.NumDiffCoeff, + cell_prim, cell_data, cell_src, mf_m); } // ************************************************************************************* diff --git a/Source/SourceTerms/ERF_moist_set_rhs.cpp b/Source/SourceTerms/ERF_moist_set_rhs.cpp index 8a0854d3d..3b63b6a0a 100644 --- a/Source/SourceTerms/ERF_moist_set_rhs.cpp +++ b/Source/SourceTerms/ERF_moist_set_rhs.cpp @@ -160,11 +160,11 @@ moist_set_rhs (const Box& tbx, tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi, ng_vect, true); - wrfbdy_set_rhs_in_spec_region(dt, RhoQ1_comp, 1, - width, set_width, dom_lo, dom_hi, - tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi, - arr_xlo, arr_xhi, arr_ylo, arr_yhi, - old_cons, cell_rhs); + realbdy_set_rhs_in_spec_region(dt, RhoQ1_comp, 1, + width, set_width, dom_lo, dom_hi, + tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi, + arr_xlo, arr_xhi, arr_ylo, arr_yhi, + old_cons, cell_rhs); } @@ -178,11 +178,11 @@ moist_set_rhs (const Box& tbx, compute_interior_ghost_bxs_xy(tbx, domain, width, set_width, tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi); - wrfbdy_compute_laplacian_relaxation(RhoQ1_comp, 1, - width, set_width, dom_lo, dom_hi, F1, F2, - tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi, - arr_xlo, arr_xhi, arr_ylo, arr_yhi, - new_cons, cell_rhs); + realbdy_compute_laplacian_relaxation(RhoQ1_comp, 1, + width, set_width, dom_lo, dom_hi, F1, F2, + tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi, + arr_xlo, arr_xhi, arr_ylo, arr_yhi, + new_cons, cell_rhs); } /* diff --git a/Source/SourceTerms/Make.package b/Source/SourceTerms/Make.package index 32cf2443a..2ed03c5a6 100644 --- a/Source/SourceTerms/Make.package +++ b/Source/SourceTerms/Make.package @@ -12,4 +12,4 @@ endif CEXE_headers += ERF_NumericalDiffusion.H CEXE_headers += ERF_Src_headers.H - +CEXE_headers += ERF_buoyancy_utils.H diff --git a/Source/TimeIntegration/ERF_Advance.cpp b/Source/TimeIntegration/ERF_Advance.cpp index db7cbf1a0..6f99b3a0b 100644 --- a/Source/TimeIntegration/ERF_Advance.cpp +++ b/Source/TimeIntegration/ERF_Advance.cpp @@ -35,6 +35,35 @@ ERF::Advance (int lev, Real time, Real dt_lev, int iteration, int /*ncycle*/) MultiFab& V_new = vars_new[lev][Vars::yvel]; MultiFab& W_new = vars_new[lev][Vars::zvel]; + // We need to set these because otherwise in the first call to erf_advance we may + // read uninitialized data on ghost values in setting the bc's on the velocities + U_new.setVal(1.e34,U_new.nGrowVect()); + V_new.setVal(1.e34,V_new.nGrowVect()); + W_new.setVal(1.e34,W_new.nGrowVect()); + + // + // NOTE: the momenta here are not fillpatched (they are only used as scratch space) + // If lev == 0 we have already FillPatched this in ERF::TimeStep + // +// if (lev == 0) { +// FillPatch(lev, time, {&S_old, &U_old, &V_old, &W_old}); +// } else { + if (lev > 0) { + FillPatch(lev, time, {&S_old, &U_old, &V_old, &W_old}, + {&S_old, &rU_old[lev], &rV_old[lev], &rW_old[lev]}, + base_state[lev], base_state[lev]); + } + + // + // So we must convert the fillpatched to momenta, including the ghost values + // + VelocityToMomentum(U_old, rU_old[lev].nGrowVect(), + V_old, rV_old[lev].nGrowVect(), + W_old, rW_old[lev].nGrowVect(), + S_old, rU_old[lev], rV_old[lev], rW_old[lev], + Geom(lev).Domain(), + domain_bcs_type); + // TODO: Can test on multiple levels later // Update the inflow perturbation update time and amplitude if (lev == 0) { @@ -86,31 +115,10 @@ ERF::Advance (int lev, Real time, Real dt_lev, int iteration, int /*ncycle*/) } } - // We need to set these because otherwise in the first call to erf_advance we may - // read uninitialized data on ghost values in setting the bc's on the velocities - U_new.setVal(1.e34,U_new.nGrowVect()); - V_new.setVal(1.e34,V_new.nGrowVect()); - W_new.setVal(1.e34,W_new.nGrowVect()); - - // - // NOTE: the momenta here are not fillpatched (they are only used as scratch space) - // - FillPatch(lev, time, {&S_old, &U_old, &V_old, &W_old}, - {&S_old, &rU_old[lev], &rV_old[lev], &rW_old[lev]}); - // - // So we must convert the fillpatched to momenta, including the ghost values - // - VelocityToMomentum(U_old, rU_old[lev].nGrowVect(), - V_old, rV_old[lev].nGrowVect(), - W_old, rW_old[lev].nGrowVect(), - S_old, rU_old[lev], rV_old[lev], rW_old[lev], - Geom(lev).Domain(), - domain_bcs_type); - #if defined(ERF_USE_WINDFARM) if (solverChoice.windfarm_type != WindFarmType::None) { advance_windfarm(Geom(lev), dt_lev, S_old, - U_old, V_old, W_old, vars_windfarm[lev], Nturb[lev], SMark[lev]); + U_old, V_old, W_old, vars_windfarm[lev], Nturb[lev], SMark[lev], time); } #endif @@ -192,6 +200,20 @@ ERF::Advance (int lev, Real time, Real dt_lev, int iteration, int /*ncycle*/) evolveTracers( lev, dt_lev, vars_new, z_phys_nd ); #endif + // *********************************************************************************************** + // Impose domain boundary conditions here so that in FillPatching the fine data we won't + // need to re-fill these + // *********************************************************************************************** + if (lev < finest_level) { + IntVect ngvect_vels = vars_new[lev][Vars::xvel].nGrowVect(); + (*physbcs_cons[lev])(vars_new[lev][Vars::cons],0,vars_new[lev][Vars::cons].nComp(), + vars_new[lev][Vars::cons].nGrowVect(),time,BCVars::cons_bc,true); + (*physbcs_u[lev])(vars_new[lev][Vars::xvel],0,1,ngvect_vels,time,BCVars::xvel_bc,true); + (*physbcs_v[lev])(vars_new[lev][Vars::yvel],0,1,ngvect_vels,time,BCVars::yvel_bc,true); + (*physbcs_w[lev])(vars_new[lev][Vars::zvel], vars_new[lev][Vars::xvel], vars_new[lev][Vars::yvel], + ngvect_vels,time,BCVars::zvel_bc,true); + } + // ************************************************************************************** // Register old and new coarse data if we are at a level less than the finest level // ************************************************************************************** @@ -222,6 +244,37 @@ ERF::Advance (int lev, Real time, Real dt_lev, int iteration, int /*ncycle*/) FPr_w[lev].RegisterCoarseData({&state_old[IntVars::zmom], &state_new[IntVars::zmom]}, {time, time + dt_lev}); } + + // + // Now create a MultiFab that holds (S_new - S_old) / dt from the coarse level interpolated + // on to the coarse/fine boundary at the fine resolution + // + Interpolater* mapper_f = &face_cons_linear_interp; + + // PhysBCFunctNoOp null_bc; + // MultiFab tempx(vars_new[lev+1][Vars::xvel].boxArray(),vars_new[lev+1][Vars::xvel].DistributionMap(),1,0); + // tempx.setVal(0.0); + // xmom_crse_rhs[lev+1].setVal(0.0); + // FPr_u[lev].FillSet(tempx , time , null_bc, domain_bcs_type); + // FPr_u[lev].FillSet(xmom_crse_rhs[lev+1], time+dt_lev, null_bc, domain_bcs_type); + // MultiFab::Subtract(xmom_crse_rhs[lev+1],tempx,0,0,1,IntVect{0}); + // xmom_crse_rhs[lev+1].mult(1.0/dt_lev,0,1,0); + + // MultiFab tempy(vars_new[lev+1][Vars::yvel].boxArray(),vars_new[lev+1][Vars::yvel].DistributionMap(),1,0); + // tempy.setVal(0.0); + // ymom_crse_rhs[lev+1].setVal(0.0); + // FPr_v[lev].FillSet(tempy , time , null_bc, domain_bcs_type); + // FPr_v[lev].FillSet(ymom_crse_rhs[lev+1], time+dt_lev, null_bc, domain_bcs_type); + // MultiFab::Subtract(ymom_crse_rhs[lev+1],tempy,0,0,1,IntVect{0}); + // ymom_crse_rhs[lev+1].mult(1.0/dt_lev,0,1,0); + + MultiFab temp_state(zmom_crse_rhs[lev+1].boxArray(),zmom_crse_rhs[lev+1].DistributionMap(),1,0); + InterpFromCoarseLevel(temp_state, IntVect{0}, IntVect{0}, state_old[IntVars::zmom], 0, 0, 1, + geom[lev], geom[lev+1], refRatio(lev), mapper_f, domain_bcs_type, BCVars::zvel_bc); + InterpFromCoarseLevel(zmom_crse_rhs[lev+1], IntVect{0}, IntVect{0}, state_new[IntVars::zmom], 0, 0, 1, + geom[lev], geom[lev+1], refRatio(lev), mapper_f, domain_bcs_type, BCVars::zvel_bc); + MultiFab::Subtract(zmom_crse_rhs[lev+1],temp_state,0,0,1,IntVect{0}); + zmom_crse_rhs[lev+1].mult(1.0/dt_lev,0,1,0); } // *********************************************************************************************** diff --git a/Source/TimeIntegration/ERF_MRI.H b/Source/TimeIntegration/ERF_MRI.H index 0a38cc63c..9e69858d7 100644 --- a/Source/TimeIntegration/ERF_MRI.H +++ b/Source/TimeIntegration/ERF_MRI.H @@ -56,11 +56,8 @@ private: int force_stage1_single_substep; /** - * \brief The pre_update function is called by the integrator on stage data before using it to evaluate a right-hand side. - * \brief The post_update function is called by the integrator on stage data at the end of the stage + * \brief The no_substep function is called when we have no acoustic substepping */ - std::function pre_update; - std::function post_update; std::function no_substep; @@ -164,16 +161,6 @@ public: return slow_fast_timestep_ratio; } - void set_pre_update (std::function F) - { - pre_update = F; - } - - void set_post_update (std::function F) - { - post_update = F; - } - void set_no_substep (std::function F) { no_substep = F; @@ -247,8 +234,6 @@ public: // RK3 for compressible integrator for (int nrk = 0; nrk < 3; nrk++) { - // amrex::Print() << "Starting RK3: Step " << nrk+1 << std::endl; - // Capture the time we got to in the previous RK step old_time_stage = time_stage; @@ -285,12 +270,6 @@ public: // step 2 starts with S_stage = S^* and we always start substepping at the old time // step 3 starts with S_stage = S^** and we always start substepping at the old time - // All pre_update does is call cons_to_prim, and we have done this with the old - // data already before starting the RK steps - if (nrk > 0) { - pre_update(S_new, S_new[IntVars::cons].nGrow()); - } - // S_scratch also holds the average momenta over the fast iterations -- // to be used to update the slow variables -- we will initialize with // the momenta used in the first call to the slow_rhs, then update @@ -327,10 +306,6 @@ public: // (because we did update the fast variables in the substepping) // **************************************************** slow_rhs_post(*F_slow, S_old, S_new, *S_sum, *S_scratch, time, old_time_stage, time_stage, nrk); - - // Call the post-update hook for S_new after all the fast steps completed - // This will update S_prim that is used in the slow RHS - post_update(S_new, time + nsubsteps*dtau, S_new[IntVars::cons].nGrow(), S_new[IntVars::xmom].nGrow()); } // nrk } else { @@ -343,12 +318,6 @@ public: if (nrk == 0) { nsubsteps = 1; dtau = timestep; time_stage = time + timestep; } if (nrk == 1) { nsubsteps = 1; dtau = timestep; time_stage = time + timestep; } - // All pre_update does is call cons_to_prim, and we have done this with the old - // data already before starting the RK steps - if (nrk > 0) { - pre_update(S_new, S_new[IntVars::cons].nGrow()); - } - // S_scratch also holds the average momenta over the fast iterations -- // to be used to update the slow variables -- we will initialize with // the momenta used in the first call to the slow_rhs, then update @@ -358,9 +327,14 @@ public: no_substep(*S_sum, S_old, *F_slow, time + nsubsteps*dtau, nsubsteps*dtau, nrk); + // **************************************************** + // Evaluate F_slow(S_stage) only for the slow variables + // Note that we are using the current stage versions (in S_new) of the slow variables + // (because we didn't update the slow variables in the substepping) + // but we are using the "new" versions (in S_sum) of the velocities + // (because we did update the fast variables in the substepping) + // **************************************************** slow_rhs_post(*F_slow, S_old, S_new, *S_sum, *S_scratch, time, old_time_stage, time_stage, nrk); - - post_update(S_new, time + nsubsteps*dtau, S_new[IntVars::cons].nGrow(), S_new[IntVars::xmom].nGrow()); } // nrk } diff --git a/Source/TimeIntegration/ERF_TI_no_substep_fun.H b/Source/TimeIntegration/ERF_TI_no_substep_fun.H index f49314a7c..1b7987799 100644 --- a/Source/TimeIntegration/ERF_TI_no_substep_fun.H +++ b/Source/TimeIntegration/ERF_TI_no_substep_fun.H @@ -16,6 +16,10 @@ const amrex::GpuArray scomp_fast = {0,0,0,0}; const amrex::GpuArray ncomp_fast = {2,1,1,1}; + if (verbose) amrex::Print() << " No-substepping time integration at level " << level + << " to " << time_for_fp + << " with dt = " << slow_dt << std::endl; + // Update S_sum = S_stage only for the fast variables #ifdef _OPENMP #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) @@ -127,9 +131,8 @@ // Even if we update all the conserved variables we don't need // to fillpatch the slow ones every acoustic substep - int ng_cons = S_sum[IntVars::cons].nGrow(); - int ng_vel = S_sum[IntVars::xmom].nGrow(); - apply_bcs(S_sum, time_for_fp, ng_cons, ng_vel, fast_only=true, vel_and_mom_synced=false); + apply_bcs(S_sum, time_for_fp, S_sum[IntVars::cons].nGrow(), S_sum[IntVars::xmom].nGrow(), + fast_only=true, vel_and_mom_synced=false); #ifdef ERF_USE_POISSON_SOLVE if (solverChoice.anelastic[level]) { diff --git a/Source/TimeIntegration/ERF_TI_slow_headers.H b/Source/TimeIntegration/ERF_TI_slow_headers.H index b4959ac65..14ab70cde 100644 --- a/Source/TimeIntegration/ERF_TI_slow_headers.H +++ b/Source/TimeIntegration/ERF_TI_slow_headers.H @@ -67,6 +67,7 @@ void erf_slow_rhs_pre (int level, int finest_level, int nrk, const amrex::MultiFab& xmom_src, const amrex::MultiFab& ymom_src, const amrex::MultiFab& zmom_src, + const amrex::MultiFab* zmom_crse_rhs, amrex::MultiFab* Tau11, amrex::MultiFab* Tau22, amrex::MultiFab* Tau33, diff --git a/Source/TimeIntegration/ERF_TI_slow_rhs_fun.H b/Source/TimeIntegration/ERF_TI_slow_rhs_fun.H index 994379325..d26784ad7 100644 --- a/Source/TimeIntegration/ERF_TI_slow_rhs_fun.H +++ b/Source/TimeIntegration/ERF_TI_slow_rhs_fun.H @@ -12,6 +12,15 @@ const Real new_stage_time, const int nrk) { + // + // Define primitive variables for all later RK stages + // (We have already done this for the first RK step) + // + if (nrk > 0) { + int ng_cons = S_data[IntVars::cons].nGrow(); + cons_to_prim(S_data[IntVars::cons], ng_cons); + } + BL_PROFILE("slow_rhs_fun_pre"); if (verbose) Print() << "Making slow rhs at time " << old_stage_time << " for fast variables advancing from " << old_step_time << " to " << new_stage_time << std::endl; @@ -44,7 +53,7 @@ qheating_rates[level].get(), #endif fine_geom, solverChoice, - mapfac_u[level], mapfac_v[level], + mapfac_u[level], mapfac_v[level], mapfac_m[level], dptr_rhotheta_src, dptr_rhoqt_src, dptr_wbar_sub, d_rayleigh_ptrs_at_lev, input_sounding_data, turbPert); @@ -102,18 +111,21 @@ } // mfi - MultiFab r_hse_new (base_state_new[level], make_alias, 0, 1); // r_0 is first component - MultiFab p_hse_new (base_state_new[level], make_alias, 1, 1); // p_0 is second component - MultiFab pi_hse_new(base_state_new[level], make_alias, 2, 1); // pi_0 is second component + MultiFab r_hse_new (base_state_new[level], make_alias, BaseState::r0_comp, 1); + MultiFab p_hse_new (base_state_new[level], make_alias, BaseState::p0_comp, 1); + MultiFab pi_hse_new (base_state_new[level], make_alias, BaseState::pi0_comp, 1); + MultiFab th_hse_new (base_state_new[level], make_alias, BaseState::th0_comp, 1); - MultiFab* r0_new = &r_hse_new; - MultiFab* p0_new = &p_hse_new; + MultiFab* r0_new = &r_hse_new; + MultiFab* p0_new = &p_hse_new; + MultiFab* pi0_new = &pi_hse_new; + MultiFab* th0_new = &th_hse_new; make_mom_sources(level, nrk, slow_dt, old_stage_time, S_data, S_prim, z_phys_nd[level], z_phys_cc[level], xvel_new, yvel_new, xmom_src, ymom_src, zmom_src, - r0_new, p0_new, fine_geom, solverChoice, + base_state_new[level], fine_geom, solverChoice, mapfac_m[level], mapfac_u[level], mapfac_v[level], dptr_u_geos, dptr_v_geos, dptr_wbar_sub, d_rayleigh_ptrs_at_lev, d_sponge_ptrs_at_lev, @@ -122,6 +134,7 @@ erf_slow_rhs_pre(level, finest_level, nrk, slow_dt, S_rhs, S_old, S_data, S_prim, S_scratch, xvel_new, yvel_new, zvel_new, z_t_rk[level], Omega, cc_src, xmom_src, ymom_src, zmom_src, + (level > 0) ? &zmom_crse_rhs[level] : nullptr, Tau11_lev[level].get(), Tau22_lev[level].get(), Tau33_lev[level].get(), Tau12_lev[level].get(), Tau13_lev[level].get(), Tau21_lev[level].get(), Tau23_lev[level].get(), Tau31_lev[level].get(), Tau32_lev[level].get(), SmnSmn, eddyDiffs, Hfx1, Hfx2, Hfx3, Q1fx1, Q1fx2, Q1fx3, Q2fx3, Diss, @@ -156,6 +169,8 @@ const GpuArray dxInv = fine_geom.InvCellSizeArray(); + const Real l_rdOcp = solverChoice.rdOcp; + #ifdef _OPENMP #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) #endif @@ -168,8 +183,10 @@ const Array4 r0_new_arr = r0_new->array(mfi); const Array4 r0_tmp_arr = r0_temp.array(mfi); - const Array4 p0_arr = p0->const_array(mfi); - const Array4 p0_new_arr = p0_new->array(mfi); + const Array4 p0_arr = p0->const_array(mfi); + const Array4 p0_new_arr = p0_new->array(mfi); + const Array4 pi0_new_arr = pi0_new->array(mfi); + const Array4 th0_new_arr = th0_new->array(mfi); const Array4& z_t_arr = z_t_rk[level]->array(mfi); @@ -205,7 +222,9 @@ r0_new_arr(i,j,k) = rho0_new / dJ_new_arr(i,j,k); rt0_tmp_new /= dJ_new_arr(i,j,k); - p0_new_arr(i,j,k) = getPgivenRTh(rt0_tmp_new); + p0_new_arr(i,j,k) = getPgivenRTh(rt0_tmp_new); + pi0_new_arr(i,j,k) = getExnergivenRTh(rt0_tmp_new, l_rdOcp); + th0_new_arr(i,j,k) = rt0_tmp_new / r0_new_arr(i,j,k); }); } // MFIter r0_new->FillBoundary(fine_geom.periodicity()); @@ -217,7 +236,7 @@ z_phys_nd[level], z_phys_cc[level], xvel_new, yvel_new, xmom_src, ymom_src, zmom_src, - r0, p0, fine_geom, solverChoice, + base_state[level], fine_geom, solverChoice, mapfac_m[level], mapfac_u[level], mapfac_v[level], dptr_u_geos, dptr_v_geos, dptr_wbar_sub, d_rayleigh_ptrs_at_lev, d_sponge_ptrs_at_lev, @@ -226,6 +245,7 @@ erf_slow_rhs_pre(level, finest_level, nrk, slow_dt, S_rhs, S_old, S_data, S_prim, S_scratch, xvel_new, yvel_new, zvel_new, z_t_rk[level], Omega, cc_src, xmom_src, ymom_src, zmom_src, + (level > 0) ? &zmom_crse_rhs[level] : nullptr, Tau11_lev[level].get(), Tau22_lev[level].get(), Tau33_lev[level].get(), Tau12_lev[level].get(), Tau13_lev[level].get(), Tau21_lev[level].get(), Tau23_lev[level].get(), Tau31_lev[level].get(), Tau32_lev[level].get(), SmnSmn, eddyDiffs, Hfx1, Hfx2, Hfx3, Q1fx1, Q1fx2, Q1fx3,Q2fx3, Diss, @@ -270,23 +290,6 @@ #endif }; // end slow_rhs_fun_pre - // ************************************************************* - // This called before RK stage - // ************************************************************* - auto pre_update_fun = [&](Vector& S_data, int ng_cons) - { - cons_to_prim(S_data[IntVars::cons], ng_cons); - }; - - // ************************************************************* - // This called after every RK stage -- from MRI or SRI - // ************************************************************* - auto post_update_fun = [&](Vector& S_data, - const Real time_for_fp, int ng_cons, int ng_vel) - { - apply_bcs(S_data, time_for_fp, ng_cons, ng_vel, fast_only=false, vel_and_mom_synced=false); - }; - // ************************************************************* // The "slow" integrator for MRI and the only integrator for SRI // ************************************************************* @@ -301,15 +304,17 @@ const int nrk) { amrex::ignore_unused(nrk); - if (verbose) Print() << "Making slow rhs at time " << old_stage_time << - " for slow variables advancing from " << - old_step_time << " to " << new_stage_time << std::endl; // Note that the "old" and "new" metric terms correspond to // t^n and the RK stage (either t^*, t^** or t^{n+1} that this source // will be used to advance to Real slow_dt = new_stage_time - old_step_time; + if (verbose) amrex::Print() << "Time integration of scalars at level " << level + << " from " << old_step_time << " to " << new_stage_time + << " with dt = " << slow_dt + << " using RHS created at " << old_stage_time << std::endl; + int n_qstate = micro->Get_Qstate_Size(); #if defined(ERF_USE_NETCDF) @@ -342,8 +347,7 @@ if ( solverChoice.use_terrain && (solverChoice.terrain_type == TerrainType::Moving) ) { erf_slow_rhs_post(level, finest_level, nrk, slow_dt, n_qstate, S_rhs, S_old, S_new, S_data, S_prim, S_scratch, - xvel_new, yvel_new, zvel_new, - cc_src, SmnSmn, eddyDiffs, + xvel_new, yvel_new, zvel_new, cc_src, SmnSmn, eddyDiffs, Hfx1, Hfx2, Hfx3, Q1fx1, Q1fx2, Q1fx3, Q2fx3, Diss, fine_geom, solverChoice, m_most, domain_bcs_type_d, domain_bcs_type, z_phys_nd[level], ax[level], ay[level], az[level], detJ_cc[level], detJ_cc_new[level], @@ -360,8 +364,7 @@ } else { erf_slow_rhs_post(level, finest_level, nrk, slow_dt, n_qstate, S_rhs, S_old, S_new, S_data, S_prim, S_scratch, - xvel_new, yvel_new, zvel_new, - cc_src, SmnSmn, eddyDiffs, + xvel_new, yvel_new, zvel_new, cc_src, SmnSmn, eddyDiffs, Hfx1, Hfx2, Hfx3, Q1fx1, Q1fx2, Q1fx3, Q2fx3, Diss, fine_geom, solverChoice, m_most, domain_bcs_type_d, domain_bcs_type, z_phys_nd[level], ax[level], ay[level], az[level], detJ_cc[level], detJ_cc[level], @@ -376,6 +379,12 @@ #endif fr_as_crse, fr_as_fine); } + + // Apply boundary conditions on all the state variables that have been updated + // in both the fast and slow integrators + apply_bcs(S_new, new_stage_time, S_new[IntVars::cons].nGrow(), S_new[IntVars::xmom].nGrow(), + fast_only=false, vel_and_mom_synced=false); + }; // end slow_rhs_fun_post auto slow_rhs_fun_inc = [&](Vector& S_rhs, @@ -390,6 +399,14 @@ BL_PROFILE("slow_rhs_fun_inc"); if (verbose) Print() << "Making slow rhs at time " << old_stage_time << " for fast variables advancing from " << old_step_time << " to " << new_stage_time << std::endl; + // + // Define primitive variables for all later RK stages + // (We have already done this for the first RK step) + // + if (nrk > 0) { + int ng_cons = S_data[IntVars::cons].nGrow(); + cons_to_prim(S_data[IntVars::cons], ng_cons); + } Real slow_dt = new_stage_time - old_step_time; @@ -416,7 +433,7 @@ qheating_rates[level], #endif fine_geom, solverChoice, - mapfac_u[level], mapfac_v[level], + mapfac_u[level], mapfac_v[level], mapfac_m[level], dptr_rhotheta_src, dptr_rhoqt_src, dptr_wbar_sub, d_rayleigh_ptrs_at_lev, input_sounding_data, turbPert); @@ -426,7 +443,7 @@ z_phys_nd[level], z_phys_cc[level], xvel_new, yvel_new, xmom_src, ymom_src, zmom_src, - r0, p0, fine_geom, solverChoice, + base_state[level], fine_geom, solverChoice, mapfac_m[level], mapfac_u[level], mapfac_v[level], dptr_u_geos, dptr_v_geos, dptr_wbar_sub, d_rayleigh_ptrs_at_lev, d_sponge_ptrs_at_lev, @@ -436,6 +453,7 @@ S_rhs, S_old, S_data, S_prim, S_scratch, xvel_new, yvel_new, zvel_new, z_t_rk[level], Omega, cc_src, xmom_src, ymom_src, zmom_src, + (level > 0) ? &zmom_crse_rhs[level] : nullptr, Tau11_lev[level].get(), Tau22_lev[level].get(), Tau33_lev[level].get(), Tau12_lev[level].get(), Tau13_lev[level].get(), Tau21_lev[level].get(), Tau23_lev[level].get(), Tau31_lev[level].get(), Tau32_lev[level].get(), SmnSmn, eddyDiffs, Hfx1, Hfx2, Hfx3, Q1fx1, Q1fx2, Q1fx3, Q2fx3, Diss, diff --git a/Source/TimeIntegration/ERF_TI_fast_rhs_fun.H b/Source/TimeIntegration/ERF_TI_substep_fun.H similarity index 97% rename from Source/TimeIntegration/ERF_TI_fast_rhs_fun.H rename to Source/TimeIntegration/ERF_TI_substep_fun.H index 1213b8cf6..bddb14930 100644 --- a/Source/TimeIntegration/ERF_TI_fast_rhs_fun.H +++ b/Source/TimeIntegration/ERF_TI_substep_fun.H @@ -13,7 +13,9 @@ auto fast_rhs_fun = [&](int fast_step, int /*n_sub*/, int nrk, const Real new_substep_time) { BL_PROFILE("fast_rhs_fun"); - if (verbose) amrex::Print() << "Calling fast rhs at level " << level << " with dt = " << dtau << std::endl; + if (verbose) amrex::Print() << "Fast time integration at level " << level + << " from " << old_substep_time << " to " << new_substep_time + << " with dt = " << dtau << std::endl; // Define beta_s here so that it is consistent between where we make the fast coefficients // and where we use them diff --git a/Source/TimeIntegration/ERF_TI_utils.H b/Source/TimeIntegration/ERF_TI_utils.H index 7870508a4..d6e581d48 100644 --- a/Source/TimeIntegration/ERF_TI_utils.H +++ b/Source/TimeIntegration/ERF_TI_utils.H @@ -45,10 +45,7 @@ }; /** - * This routine is called before the first step of the time integration, *and* in the case - * of a multi-stage method like RK3, this is called from "pre_update_fun" which is called - * before every subsequent stage. Since we advance the variables in conservative form, - * we must convert momentum to velocity before imposing the bcs. + * This routine is called after the scalars are updated for each RK stage */ auto apply_bcs = [&](Vector& S_data, const Real time_for_fp, int ng_cons, int ng_vel, diff --git a/Source/TimeIntegration/ERF_TimeStep.cpp b/Source/TimeIntegration/ERF_TimeStep.cpp index 3460582fd..e512a9a2b 100644 --- a/Source/TimeIntegration/ERF_TimeStep.cpp +++ b/Source/TimeIntegration/ERF_TimeStep.cpp @@ -15,6 +15,26 @@ using namespace amrex; void ERF::timeStep (int lev, Real time, int /*iteration*/) { + // + // We need to FillPatch the coarse level before assessing whether to regrid + // We have not done the swap yet so we fill the "new" which will become the "old" + // + MultiFab& S_new = vars_new[lev][Vars::cons]; + MultiFab& U_new = vars_new[lev][Vars::xvel]; + MultiFab& V_new = vars_new[lev][Vars::yvel]; + MultiFab& W_new = vars_new[lev][Vars::zvel]; + + // + // NOTE: the momenta here are not fillpatched (they are only used as scratch space) + // + if (lev == 0) { + FillPatch(lev, time, {&S_new, &U_new, &V_new, &W_new}); + } else if (lev < finest_level) { + FillPatch(lev, time, {&S_new, &U_new, &V_new, &W_new}, + {&S_new, &rU_new[lev], &rV_new[lev], &rW_new[lev]}, + base_state[lev], base_state[lev]); + } + if (regrid_int > 0) // We may need to regrid { // help keep track of whether a level was already regridded diff --git a/Source/TimeIntegration/ERF_advance_dycore.cpp b/Source/TimeIntegration/ERF_advance_dycore.cpp index 8c78fcfb3..e211ff464 100644 --- a/Source/TimeIntegration/ERF_advance_dycore.cpp +++ b/Source/TimeIntegration/ERF_advance_dycore.cpp @@ -52,9 +52,9 @@ void ERF::advance_dycore(int level, TurbChoice tc = solverChoice.turbChoice[level]; SpongeChoice sc = solverChoice.spongeChoice; - MultiFab r_hse (base_state[level], make_alias, 0, 1); // r_0 is first component - MultiFab p_hse (base_state[level], make_alias, 1, 1); // p_0 is second component - MultiFab pi_hse(base_state[level], make_alias, 2, 1); // pi_0 is second component + MultiFab r_hse (base_state[level], make_alias, BaseState::r0_comp , 1); + MultiFab p_hse (base_state[level], make_alias, BaseState::p0_comp , 1); + MultiFab pi_hse(base_state[level], make_alias, BaseState::pi0_comp, 1); // These pointers are used in the MRI utility functions MultiFab* r0 = &r_hse; @@ -276,8 +276,8 @@ void ERF::advance_dycore(int level, cons_to_prim(state_old[IntVars::cons], state_old[IntVars::cons].nGrow()); #include "ERF_TI_no_substep_fun.H" +#include "ERF_TI_substep_fun.H" #include "ERF_TI_slow_rhs_fun.H" -#include "ERF_TI_fast_rhs_fun.H" // *************************************************************************************** // Setup the integrator and integrate for a single timestep @@ -288,8 +288,6 @@ void ERF::advance_dycore(int level, // any state data (e.g. at RK stages or at the end of a timestep) mri_integrator.set_slow_rhs_pre(slow_rhs_fun_pre); mri_integrator.set_slow_rhs_post(slow_rhs_fun_post); - mri_integrator.set_pre_update (pre_update_fun); - mri_integrator.set_post_update(post_update_fun); if (solverChoice.anelastic[level]) { mri_integrator.set_slow_rhs_inc(slow_rhs_fun_inc); diff --git a/Source/TimeIntegration/ERF_fast_rhs_N.cpp b/Source/TimeIntegration/ERF_fast_rhs_N.cpp index 5bafd34bf..a77fda150 100644 --- a/Source/TimeIntegration/ERF_fast_rhs_N.cpp +++ b/Source/TimeIntegration/ERF_fast_rhs_N.cpp @@ -191,17 +191,17 @@ void erf_fast_rhs_N (int step, int nrk, // ********************************************************************* // Define updates in the RHS of {x, y, z}-momentum equations // ********************************************************************* - if (nrk == 0 and step == 0) { + if (nrk == 0 and step == 0) { // prev == stage ParallelFor(tbx, tby, [=] AMREX_GPU_DEVICE (int i, int j, int k) { - Real new_drho_u = prev_xmom(i,j,k) - stage_xmom(i,j,k) + dtau * slow_rhs_rho_u(i,j,k); + Real new_drho_u = dtau * slow_rhs_rho_u(i,j,k); avg_xmom(i,j,k) += facinv*new_drho_u; temp_cur_xmom_arr(i,j,k) = stage_xmom(i,j,k) + new_drho_u; }, [=] AMREX_GPU_DEVICE (int i, int j, int k) { - Real new_drho_v = prev_ymom(i,j,k) - stage_ymom(i,j,k) + dtau * slow_rhs_rho_v(i,j,k); + Real new_drho_v = dtau * slow_rhs_rho_v(i,j,k); avg_ymom(i,j,k) += facinv*new_drho_v; temp_cur_ymom_arr(i,j,k) = stage_ymom(i,j,k) + new_drho_v; }); @@ -220,11 +220,10 @@ void erf_fast_rhs_N (int step, int nrk, } Real pi_c = 0.5 * (pi_stage_ca(i-1,j,k,0) + pi_stage_ca(i,j,k,0)); - Real fast_rhs_rho_u = -Gamma * R_d * pi_c * gpx; Real new_drho_u = prev_xmom(i,j,k) - stage_xmom(i,j,k) - + dtau * fast_rhs_rho_u + dtau * slow_rhs_rho_u(i,j,k); + + dtau * fast_rhs_rho_u + dtau * slow_rhs_rho_u(i,j,k); avg_xmom(i,j,k) += facinv*new_drho_u; @@ -243,11 +242,10 @@ void erf_fast_rhs_N (int step, int nrk, } Real pi_c = 0.5 * (pi_stage_ca(i,j-1,k,0) + pi_stage_ca(i,j,k,0)); - Real fast_rhs_rho_v = -Gamma * R_d * pi_c * gpy; Real new_drho_v = prev_ymom(i,j,k) - stage_ymom(i,j,k) - + dtau * fast_rhs_rho_v + dtau * slow_rhs_rho_v(i,j,k); + + dtau * fast_rhs_rho_v + dtau * slow_rhs_rho_v(i,j,k); avg_ymom(i,j,k) += facinv*new_drho_v; @@ -422,13 +420,13 @@ void erf_fast_rhs_N (int step, int nrk, ParallelFor(b2d, [=] AMREX_GPU_DEVICE (int i, int j, int) { - // w at bottom boundary of grid is 0 if at domain boundary, otherwise w = w_old + dtau * slow_rhs - RHS_a (i,j,lo.z ) = prev_zmom(i,j,lo.z ) - stage_zmom(i,j,lo.z) + // w at bottom boundary of grid is 0 if at domain boundary, otherwise w = w_old + dtau * slow_rhs + RHS_a (i,j,lo.z) = prev_zmom(i,j,lo.z) - stage_zmom(i,j,lo.z) + dtau * slow_rhs_rho_w(i,j,lo.z); - // w at top boundary of grid is 0 if at domain boundary, otherwise w = w_old + dtau * slow_rhs - RHS_a (i,j,hi.z+1) = prev_zmom(i,j,hi.z+1) - stage_zmom(i,j,hi.z+1) - + dtau * slow_rhs_rho_w(i,j,hi.z+1); + // w at top boundary of grid is 0 if at domain boundary, otherwise w = w_old + dtau * slow_rhs + RHS_a (i,j,hi.z+1) = prev_zmom(i,j,hi.z+1) - stage_zmom(i,j,hi.z+1) + + dtau * slow_rhs_rho_w(i,j,hi.z+1); }); // b2d #ifdef AMREX_USE_GPU diff --git a/Source/TimeIntegration/ERF_make_tau_terms.cpp b/Source/TimeIntegration/ERF_make_tau_terms.cpp index 30c8251b0..f00d1aa4f 100644 --- a/Source/TimeIntegration/ERF_make_tau_terms.cpp +++ b/Source/TimeIntegration/ERF_make_tau_terms.cpp @@ -50,6 +50,7 @@ void erf_make_tau_terms (int level, int nrk, tc.les_type == LESType::Deardorff || tc.pbl_type == PBLType::MYNN25 || tc.pbl_type == PBLType::YSU ); + const bool use_ddorf = (tc.les_type == LESType::Deardorff); const bool use_most = (most != nullptr); const bool exp_most = (solverChoice.use_explicit_most); @@ -232,11 +233,14 @@ void erf_make_tau_terms (int level, int nrk, // Populate SmnSmn if using Deardorff (used as diff src in post) // and in the first RK stage (TKE tendencies constant for nrk>0, following WRF) - if ((nrk==0) && (tc.les_type == LESType::Deardorff)) { + if ((nrk==0) && (use_ddorf)) { SmnSmn_a = SmnSmn->array(mfi); ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { - SmnSmn_a(i,j,k) = ComputeSmnSmn(i,j,k,s11,s22,s33,s12,s13,s23,domlo_z,use_most,exp_most); + SmnSmn_a(i,j,k) = ComputeSmnSmn(i,j,k, + s11,s22,s33, + s12,s13,s23, + domlo_z,use_most,exp_most); }); } @@ -344,11 +348,14 @@ void erf_make_tau_terms (int level, int nrk, // Populate SmnSmn if using Deardorff (used as diff src in post) // and in the first RK stage (TKE tendencies constant for nrk>0, following WRF) - if ((nrk==0) && (tc.les_type == LESType::Deardorff)) { + if ((nrk==0) && (use_ddorf)) { SmnSmn_a = SmnSmn->array(mfi); ParallelFor(bx, [=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { - SmnSmn_a(i,j,k) = ComputeSmnSmn(i,j,k,s11,s22,s33,s12,s13,s23,domlo_z,use_most,exp_most); + SmnSmn_a(i,j,k) = ComputeSmnSmn(i,j,k, + s11,s22,s33, + s12,s13,s23, + domlo_z,use_most,exp_most); }); } diff --git a/Source/TimeIntegration/ERF_slow_rhs_post.cpp b/Source/TimeIntegration/ERF_slow_rhs_post.cpp index a91e7bdde..50491b2d8 100644 --- a/Source/TimeIntegration/ERF_slow_rhs_post.cpp +++ b/Source/TimeIntegration/ERF_slow_rhs_post.cpp @@ -120,9 +120,10 @@ void erf_slow_rhs_post (int level, int finest_level, if (l_moving_terrain) AMREX_ALWAYS_ASSERT(l_use_terrain); const bool l_use_mono_adv = solverChoice.use_mono_adv; - const bool l_use_QKE = tc.use_QKE; - const bool l_advect_QKE = tc.use_QKE && tc.advect_QKE; - const bool l_use_deardorff = (tc.les_type == LESType::Deardorff); + const bool l_use_ddorf = (tc.les_type == LESType::Deardorff); + const bool l_use_KE = ( (tc.les_type == LESType::Deardorff) || + (tc.pbl_type == PBLType::MYNN25) ); + const bool l_advect_KE = (tc.use_KE && tc.advect_KE); const bool l_use_diff = ((dc.molec_diff_type != MolecDiffType::None) || (tc.les_type != LESType::None) || (tc.pbl_type != PBLType::None) ); @@ -167,9 +168,8 @@ void erf_slow_rhs_post (int level, int finest_level, // Valid vars Vector is_valid_slow_var; is_valid_slow_var.resize(RhoQ1_comp+1,0); - if (l_use_deardorff) {is_valid_slow_var[ RhoKE_comp] = 1;} - if (l_use_QKE) {is_valid_slow_var[ RhoQKE_comp] = 1;} - is_valid_slow_var[RhoScalar_comp] = 1; + if (l_use_KE) {is_valid_slow_var[ RhoKE_comp] = 1;} + is_valid_slow_var[RhoScalar_comp] = 1; if (solverChoice.moisture_type != MoistureType::None) { is_valid_slow_var[RhoQ1_comp] = 1; } @@ -282,7 +282,7 @@ void erf_slow_rhs_post (int level, int finest_level, const Array4& mf_v = mapfac_v->const_array(mfi); // SmnSmn for KE src with Deardorff - const Array4& SmnSmn_a = l_use_deardorff ? SmnSmn->const_array(mfi) : Array4{}; + const Array4& SmnSmn_a = l_use_ddorf ? SmnSmn->const_array(mfi) : Array4{}; // ************************************************************************** // Here we fill the "current" data with "new" data because that is the result of the previous RK stage @@ -395,8 +395,8 @@ void erf_slow_rhs_post (int level, int finest_level, num_comp = 1; } - if (( ivar != RhoQKE_comp ) || - ((ivar == RhoQKE_comp) && l_advect_QKE)) + if (( ivar != RhoKE_comp ) || + ((ivar == RhoKE_comp) && l_advect_KE)) { AdvectionSrcForScalars(dt, tbx, start_comp, num_comp, avg_xmom, avg_ymom, avg_zmom, cur_cons, cur_prim, cell_rhs, @@ -408,9 +408,7 @@ void erf_slow_rhs_post (int level, int finest_level, } if (l_use_diff) { - const Array4 tm_arr = t_mean_mf ? t_mean_mf->const_array(mfi) : Array4{}; - if (l_use_terrain) { DiffusionSrcForState_T(tbx, domain, start_comp, num_comp, exp_most, rot_most, u, v, new_cons, cur_prim, cell_rhs, @@ -475,8 +473,6 @@ void erf_slow_rhs_post (int level, int finest_level, cur_cons(i,j,k,n) = temp_val / detJ_new_arr(i,j,k); if (ivar == RhoKE_comp) { cur_cons(i,j,k,n) = amrex::max(cur_cons(i,j,k,n), eps); - } else if (ivar == RhoQKE_comp) { - cur_cons(i,j,k,n) = amrex::max(cur_cons(i,j,k,n), 1e-12); } }); @@ -489,8 +485,6 @@ void erf_slow_rhs_post (int level, int finest_level, cur_cons(i,j,k,n) = old_cons(i,j,k,n) + dt * cell_rhs(i,j,k,n); if (ivar == RhoKE_comp) { cur_cons(i,j,k,n) = amrex::max(cur_cons(i,j,k,n), eps); - } else if (ivar == RhoQKE_comp) { - cur_cons(i,j,k,n) = amrex::max(cur_cons(i,j,k,n), 1e-12); } else if (ivar >= RhoQ1_comp) { cur_cons(i,j,k,n) = amrex::max(cur_cons(i,j,k,n), 0.0); } diff --git a/Source/TimeIntegration/ERF_slow_rhs_pre.cpp b/Source/TimeIntegration/ERF_slow_rhs_pre.cpp index 51890a8cd..1a42951f0 100644 --- a/Source/TimeIntegration/ERF_slow_rhs_pre.cpp +++ b/Source/TimeIntegration/ERF_slow_rhs_pre.cpp @@ -32,6 +32,7 @@ using namespace amrex; * @param[in] xmom_src source terms for x-momentum * @param[in] ymom_src source terms for y-momentum * @param[in] zmom_src source terms for z-momentum + * @param[in] zmom_crse_rhs update term from coarser level for z-momentum; non-zero on c/f boundary only * @param[in] Tau11 tau_11 component of stress tensor * @param[in] Tau22 tau_22 component of stress tensor * @param[in] Tau33 tau_33 component of stress tensor @@ -81,6 +82,7 @@ void erf_slow_rhs_pre (int level, int finest_level, const MultiFab& xmom_src, const MultiFab& ymom_src, const MultiFab& zmom_src, + const MultiFab* zmom_crse_rhs, MultiFab* Tau11, MultiFab* Tau22, MultiFab* Tau33, MultiFab* Tau12, MultiFab* Tau13, MultiFab* Tau21, MultiFab* Tau23, MultiFab* Tau31, MultiFab* Tau32, @@ -167,6 +169,7 @@ void erf_slow_rhs_pre (int level, int finest_level, AMREX_ALWAYS_ASSERT(!l_use_terrain || !l_anelastic); const Box& domain = geom.Domain(); + const int domlo_z = domain.smallEnd(2); const int domhi_z = domain.bigEnd(2); const GpuArray dxInv = geom.InvCellSizeArray(); @@ -743,6 +746,31 @@ void erf_slow_rhs_pre (int level, int finest_level, } }); + auto const lo = lbound(bx); + auto const hi = ubound(bx); + + // Note: the logic below assumes no tiling in z! + if (level > 0) { + + const Array4& rho_w_rhs_crse = zmom_crse_rhs->const_array(mfi); + + Box b2d = bx; b2d.setRange(2,0); + + if (lo.z > domlo_z) { + ParallelFor(b2d, [=] AMREX_GPU_DEVICE (int i, int j, int ) // bottom of box but not of domain + { + rho_w_rhs(i,j,lo.z) = rho_w_rhs_crse(i,j,lo.z); + }); + } + + if (hi.z < domhi_z+1) { + ParallelFor(b2d, [=] AMREX_GPU_DEVICE (int i, int j, int ) // top of box but not of domain + { + rho_w_rhs(i,j,hi.z+1) = rho_w_rhs_crse(i,j,hi.z+1); + }); + } + } + { BL_PROFILE("slow_rhs_pre_fluxreg"); // We only add to the flux registers in the final RK step diff --git a/Source/TimeIntegration/Make.package b/Source/TimeIntegration/Make.package index d117f5e87..7333d3676 100644 --- a/Source/TimeIntegration/Make.package +++ b/Source/TimeIntegration/Make.package @@ -12,9 +12,9 @@ CEXE_sources += ERF_fast_rhs_N.cpp CEXE_sources += ERF_fast_rhs_T.cpp CEXE_sources += ERF_fast_rhs_MT.cpp -CEXE_headers += ERF_TI_fast_rhs_fun.H CEXE_headers += ERF_TI_slow_rhs_fun.H CEXE_headers += ERF_TI_no_substep_fun.H +CEXE_headers += ERF_TI_substep_fun.H CEXE_headers += ERF_TI_fast_headers.H CEXE_headers += ERF_TI_slow_headers.H CEXE_headers += ERF_TI_utils.H diff --git a/Source/Utils/ERF_AverageDown.cpp b/Source/Utils/ERF_AverageDown.cpp new file mode 100644 index 000000000..1741b011f --- /dev/null +++ b/Source/Utils/ERF_AverageDown.cpp @@ -0,0 +1,162 @@ +/** + * \file ERF_AverageDown.cpp + */ + +/** + * Main class in ERF code, instantiated from main.cpp +*/ + +#include +#include + +using namespace amrex; + +// Set covered coarse cells to be the average of overlying fine cells for all levels +void +ERF::AverageDown () +{ + AMREX_ALWAYS_ASSERT(solverChoice.coupling_type == CouplingType::TwoWay); + int src_comp = 0; + int num_comp = vars_new[0][Vars::cons].nComp(); + for (int lev = finest_level-1; lev >= 0; --lev) + { + AverageDownTo(lev,src_comp,num_comp); + } +} + +// Set covered coarse cells to be the average of overlying fine cells at level crse_lev +void +ERF::AverageDownTo (int crse_lev, int scomp, int ncomp) // NOLINT +{ + AMREX_ALWAYS_ASSERT(scomp == 0); + AMREX_ALWAYS_ASSERT(ncomp == vars_new[crse_lev][Vars::cons].nComp()); + AMREX_ALWAYS_ASSERT(solverChoice.coupling_type == CouplingType::TwoWay); + + // ****************************************************************************************** + // First do cell-centered quantities + // The quantity that is conserved is not (rho S), but rather (rho S / m^2) where + // m is the map scale factor at cell centers + // Here we pre-divide (rho S) by m^2 before average down + // ****************************************************************************************** + for (int lev = crse_lev; lev <= crse_lev+1; lev++) { + for (MFIter mfi(vars_new[lev][Vars::cons], TilingIfNotGPU()); mfi.isValid(); ++mfi) { + const Box& bx = mfi.tilebox(); + const Array4< Real> cons_arr = vars_new[lev][Vars::cons].array(mfi); + const Array4 mapfac_arr = mapfac_m[lev]->const_array(mfi); + if (solverChoice.use_terrain) { + const Array4 detJ_arr = detJ_cc[lev]->const_array(mfi); + ParallelFor(bx, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept + { + cons_arr(i,j,k,scomp+n) *= detJ_arr(i,j,k) / (mapfac_arr(i,j,0)*mapfac_arr(i,j,0)); + }); + } else { + ParallelFor(bx, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept + { + cons_arr(i,j,k,scomp+n) /= (mapfac_arr(i,j,0)*mapfac_arr(i,j,0)); + }); + } + } // mfi + } // lev + + int fine_lev = crse_lev+1; + + if (interpolation_type == StateInterpType::Perturbational) { + // Make the fine rho and (rho theta) be perturbational + MultiFab::Divide(vars_new[fine_lev][Vars::cons],vars_new[fine_lev][Vars::cons], + Rho_comp,RhoTheta_comp,1,IntVect{0}); + MultiFab::Subtract(vars_new[fine_lev][Vars::cons],base_state[fine_lev], + BaseState::r0_comp,Rho_comp,1,IntVect{0}); + MultiFab::Subtract(vars_new[fine_lev][Vars::cons],base_state[fine_lev], + BaseState::th0_comp,RhoTheta_comp,1,IntVect{0}); + + // Make the crse rho and (rho theta) be perturbational + MultiFab::Divide(vars_new[crse_lev][Vars::cons],vars_new[crse_lev][Vars::cons], + Rho_comp,RhoTheta_comp,1,IntVect{0}); + MultiFab::Subtract(vars_new[crse_lev][Vars::cons],base_state[crse_lev], + BaseState::r0_comp,Rho_comp,1,IntVect{0}); + MultiFab::Subtract(vars_new[crse_lev][Vars::cons],base_state[crse_lev], + BaseState::th0_comp,RhoTheta_comp,1,IntVect{0}); + } + + average_down(vars_new[crse_lev+1][Vars::cons],vars_new[crse_lev ][Vars::cons], + scomp, ncomp, refRatio(crse_lev)); + + if (interpolation_type == StateInterpType::Perturbational) { + // Restore the fine data to what it was + MultiFab::Add(vars_new[fine_lev][Vars::cons],base_state[fine_lev], + BaseState::r0_comp,Rho_comp,1,IntVect{0}); + MultiFab::Add(vars_new[fine_lev][Vars::cons],base_state[fine_lev], + BaseState::th0_comp,RhoTheta_comp,1,IntVect{0}); + MultiFab::Multiply(vars_new[fine_lev][Vars::cons],vars_new[fine_lev][Vars::cons], + Rho_comp,RhoTheta_comp,1,IntVect{0}); + + // Make the crse data be full values not perturbational + MultiFab::Add(vars_new[crse_lev][Vars::cons],base_state[crse_lev], + BaseState::r0_comp,Rho_comp,1,IntVect{0}); + MultiFab::Add(vars_new[crse_lev][Vars::cons],base_state[crse_lev], + BaseState::th0_comp,RhoTheta_comp,1,IntVect{0}); + MultiFab::Multiply(vars_new[crse_lev][Vars::cons],vars_new[crse_lev][Vars::cons], + Rho_comp,RhoTheta_comp,1,IntVect{0}); + } + + vars_new[crse_lev][Vars::cons].FillBoundary(geom[crse_lev].periodicity()); + + // Here we multiply (rho S) by m^2 after average down + for (int lev = crse_lev; lev <= crse_lev+1; lev++) { + for (MFIter mfi(vars_new[lev][Vars::cons], TilingIfNotGPU()); mfi.isValid(); ++mfi) { + const Box& bx = mfi.tilebox(); + const Array4< Real> cons_arr = vars_new[lev][Vars::cons].array(mfi); + const Array4 mapfac_arr = mapfac_m[lev]->const_array(mfi); + if (solverChoice.use_terrain) { + const Array4 detJ_arr = detJ_cc[lev]->const_array(mfi); + ParallelFor(bx, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept + { + cons_arr(i,j,k,scomp+n) *= (mapfac_arr(i,j,0)*mapfac_arr(i,j,0)) / detJ_arr(i,j,k); + }); + } else { + ParallelFor(bx, ncomp, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept + { + cons_arr(i,j,k,scomp+n) *= (mapfac_arr(i,j,0)*mapfac_arr(i,j,0)); + }); + } + } // mfi + } // lev + + // ****************************************************************************************** + // Now average down momenta. + // Note that vars_new holds velocities not momenta, but we want to do conservative + // averaging so we first convert to momentum, then average down, then convert + // back to velocities -- only on the valid region + // ****************************************************************************************** + for (int lev = crse_lev; lev <= crse_lev+1; lev++) + { + // FillBoundary for density so we can go back and forth between velocity and momentum + vars_new[lev][Vars::cons].FillBoundary(geom[lev].periodicity()); + + VelocityToMomentum(vars_new[lev][Vars::xvel], IntVect(0,0,0), + vars_new[lev][Vars::yvel], IntVect(0,0,0), + vars_new[lev][Vars::zvel], IntVect(0,0,0), + vars_new[lev][Vars::cons], + rU_new[lev], + rV_new[lev], + rW_new[lev], + Geom(lev).Domain(), + domain_bcs_type); + } + + average_down_faces(rU_new[crse_lev+1], rU_new[crse_lev], refRatio(crse_lev), geom[crse_lev]); + average_down_faces(rV_new[crse_lev+1], rV_new[crse_lev], refRatio(crse_lev), geom[crse_lev]); + average_down_faces(rW_new[crse_lev+1], rW_new[crse_lev], refRatio(crse_lev), geom[crse_lev]); + + for (int lev = crse_lev; lev <= crse_lev+1; lev++) { + MomentumToVelocity(vars_new[lev][Vars::xvel], + vars_new[lev][Vars::yvel], + vars_new[lev][Vars::zvel], + vars_new[lev][Vars::cons], + rU_new[lev], + rV_new[lev], + rW_new[lev], + Geom(lev).Domain(), + domain_bcs_type); + } +} diff --git a/Source/Utils/ERF_EOS.H b/Source/Utils/ERF_EOS.H index 3d47639b8..978926a19 100644 --- a/Source/Utils/ERF_EOS.H +++ b/Source/Utils/ERF_EOS.H @@ -9,34 +9,38 @@ /** * Function to return potential temperature given pressure and temperature * - * @params[in] pressure - * @params[in] temperature - * @params[in] rdOcp ratio of R_d to c_p + * @params[in ] P pressure + * @params[in ] T temperature + * @params[in ] rdOcp ratio of R_d to c_p + * @params[ out] potential temperature */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getThgivenPandT(const amrex::Real T, const amrex::Real P, const amrex::Real rdOcp) { - return T*std::pow(p_0/P, rdOcp); + return T * std::pow(p_0/P, rdOcp); } /** * Function to return temperature given pressure and potential temperature * - * @params[in] pressure - * @params[in] potential temperature - * @params[in] rdOcp ratio of R_d to c_p + * @params[in ] P pressure + * @params[in ] th potential temperature + * @params[in ] rdOcp ratio of R_d to c_p + * @params[ out] temperature */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE -amrex::Real getTgivenPandTh(const amrex::Real P, const amrex::Real Th, const amrex::Real rdOcp) +amrex::Real getTgivenPandTh(const amrex::Real P, const amrex::Real th, const amrex::Real rdOcp) { - return Th / std::pow(p_0/P, rdOcp); + return th / std::pow(p_0/P, rdOcp); } /** * Function to return temperature given density and potential temperature * - * @params[in] rho density - * @params[in] rhotheta density times potential temperature theta + * @params[in ] rho density + * @params[in ] rhotheta (density times potential temperature) + * @params[in ] qv water vapor + * @params[ out] temperature */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getTgivenRandRTh(const amrex::Real rho, const amrex::Real rhotheta, const amrex::Real qv=0.0) @@ -53,15 +57,18 @@ amrex::Real getTgivenRandRTh(const amrex::Real rho, const amrex::Real rhotheta, /** * Function to return potential temperature given density and temperature * - * @params[in] rho density - * @params[in] T temperature - * @params[in] rdOcp ratio of R_d to c_p + * @params[in ] rho density + * @params[in ] T temperature + * @params[in ] rdOcp ratio of R_d to c_p + * @params[in ] qv water vapor + * @params[ out] potential temperature */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getThgivenRandT(const amrex::Real rho, const amrex::Real T, const amrex::Real rdOcp, const amrex::Real qv=0.0) { // p = rho_d * R_d * T_moist amrex::Real p_loc = rho * R_d * T * (1.0 + R_v/R_d*qv); + // theta_d = T * (p0/p)^(R_d/C_p) return T * std::pow((p_0/p_loc),rdOcp); } @@ -69,49 +76,69 @@ amrex::Real getThgivenRandT(const amrex::Real rho, const amrex::Real T, const am /** * Function to return pressure given density times theta * - * @params[in] rhotheta density times potential temperature - * @params[in] qv water vapor + * @params[in ] rhotheta density times potential temperature + * @params[in ] qv water vapor + * @params[ out] pressure */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getPgivenRTh(const amrex::Real rhotheta, const amrex::Real qv = 0.) { - return p_0 * std::pow(R_d * rhotheta * (1.0+(R_v/R_d)*qv) * ip_0, Gamma); + return p_0 * std::pow(R_d * rhotheta * ( amrex::Real(1.0) + (R_v/R_d)*qv) * ip_0, Gamma); } /** * Function to return density given theta and pressure * - * @params[in] theta potential temperature - * @params[in] p pressure - * @params[in] rdOcp ratio of R_d to c_p + * @params[in ] theta potential temperature + * @params[in ] p pressure + * @params[in ] rdOcp ratio of R_d to c_p + * @params[in ] qv water vapor + * @params[ out] density */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE -amrex::Real getRhogivenThetaPress (const amrex::Real theta, const amrex::Real p, const amrex::Real rdOcp, const amrex::Real qv=0.0) +amrex::Real getRhogivenThetaPress (const amrex::Real th, const amrex::Real p, const amrex::Real rdOcp, const amrex::Real qv=0.0) { // We should be using moist value of theta when using moisture // theta_m = theta * (1 + R_v/R_d*qv) - return std::pow(p_0, rdOcp) * std::pow(p, iGamma) / (R_d * theta * (1.0 + R_v/R_d*qv) ); + return std::pow(p_0, rdOcp) * std::pow(p, iGamma) / (R_d * th * (amrex::Real(1.0) + R_v/R_d*qv) ); +} + +/** + * Function to return density given temperature and pressure + * + * @params[in ] theta potential temperature + * @params[in ] p pressure + * @params[in ] rdOcp ratio of R_d to c_p + * @params[in ] qv water vapor + * @params[ out] density +*/ +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE +amrex::Real getRhogivenTandPress (const amrex::Real T, const amrex::Real p, const amrex::Real qv=0.0) +{ + return p / ( R_d * T * (amrex::Real(1.0) + (R_v/R_d)*qv) ); } /** * Function to return dP/drho at constant theta * - * @params[in] theta potential temperature - * @params[in] p pressure - * @params[in] rdOcp ratio of R_d to c_p + * @params[in ] rho density + * @params[in ] theta potential temperature + * @params[in ] qv water vapor + * @params[ out] pressure */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getdPdRgivenConstantTheta(const amrex::Real rho, const amrex::Real theta, const amrex::Real qv=0.0) { // We should be using moist value of theta when using moisture // theta_m = theta * (1 + R_v/R_d*qv) - return Gamma * p_0 * std::pow( (R_d * theta * (1.0 + R_v/R_d*qv) * ip_0), Gamma) * std::pow(rho, Gamma-1.0) ; + return Gamma * p_0 * std::pow( (R_d * theta * (amrex::Real(1.0) + R_v/R_d*qv) * ip_0), Gamma) * std::pow(rho, Gamma-1.0) ; } /** * Function to return the Exner function pi given pressure - * @params[in] p pressure - * @params[in] rdOcp ratio of R_d to c_p + * @params[in ] p pressure + * @params[in ] rdOcp ratio of R_d to c_p + * @params[ out] Exner function */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getExnergivenP(const amrex::Real P, const amrex::Real rdOcp) @@ -121,10 +148,12 @@ amrex::Real getExnergivenP(const amrex::Real P, const amrex::Real rdOcp) } /** - * Function to return the Exner function pi given densith times potential temperature + * Function to return the Exner function pi given density times potential temperature * - * @params[in] rhotheta density times potential temperature - * @params[in] rdOcp ratio of R_d to c_p + * @params[in ] rhotheta density times potential temperature + * @params[in ] rdOcp ratio of R_d to c_p + * @params[in ] qv water vapor + * @params[ out] Exner function */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getExnergivenRTh(const amrex::Real rhotheta, const amrex::Real rdOcp, const amrex::Real qv=0.0 ) @@ -136,9 +165,11 @@ amrex::Real getExnergivenRTh(const amrex::Real rhotheta, const amrex::Real rdOcp } /** - * Function to return the density given pressure + * Function to return (rho theta) given pressure * - * @params[in] p pressure + * @params[in ] p pressure + * @params[in ] qv water vapor + * @params[ out] density times potential temperature */ AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real getRhoThetagivenP(const amrex::Real p, const amrex::Real qv=0.0) @@ -149,5 +180,11 @@ amrex::Real getRhoThetagivenP(const amrex::Real p, const amrex::Real qv=0.0) return std::pow(p*std::pow(p_0, Gamma-1), iGamma) * iR_d / (1.0 + R_v/R_d*qv) ; } +AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE +amrex::Real compute_vapor_pressure (const amrex::Real p_s, const amrex::Real RH) +{ + return p_s*RH; +} + #endif diff --git a/Source/Utils/ERF_InteriorGhostCells.cpp b/Source/Utils/ERF_InteriorGhostCells.cpp index 76a57beea..19c07d684 100644 --- a/Source/Utils/ERF_InteriorGhostCells.cpp +++ b/Source/Utils/ERF_InteriorGhostCells.cpp @@ -119,7 +119,7 @@ realbdy_compute_interior_ghost_rhs (const Real& bdy_time_interval, Vector>& bdy_data_ylo, Vector>& bdy_data_yhi) { - BL_PROFILE_REGION("wrfbdy_compute_interior_ghost_RHS()"); + BL_PROFILE_REGION("realbdy_compute_interior_ghost_RHS()"); // NOTE: We pass the full width into this routine. // For relaxation, the last cell is a halo @@ -395,11 +395,11 @@ realbdy_compute_interior_ghost_rhs (const Real& bdy_time_interval, continue; } - wrfbdy_set_rhs_in_spec_region(delta_t, icomp, 1, - width, set_width, dom_lo, dom_hi, - tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi, - arr_xlo, arr_xhi, arr_ylo, arr_yhi, - data_arr, rhs_arr); + realbdy_set_rhs_in_spec_region(delta_t, icomp, 1, + width, set_width, dom_lo, dom_hi, + tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi, + arr_xlo, arr_xhi, arr_ylo, arr_yhi, + data_arr, rhs_arr); } // mfi } // ivar } // set_width @@ -455,11 +455,11 @@ realbdy_compute_interior_ghost_rhs (const Real& bdy_time_interval, continue; } - wrfbdy_compute_laplacian_relaxation(icomp, 1, - width2, set_width, dom_lo, dom_hi, F1, F2, - tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi, - arr_xlo, arr_xhi, arr_ylo, arr_yhi, - data_arr, rhs_arr); + realbdy_compute_laplacian_relaxation(icomp, 1, + width2, set_width, dom_lo, dom_hi, F1, F2, + tbx_xlo, tbx_xhi, tbx_ylo, tbx_yhi, + arr_xlo, arr_xhi, arr_ylo, arr_yhi, + data_arr, rhs_arr); /* // UNIT TEST DEBUG diff --git a/Source/Utils/ERF_Interpolation.H b/Source/Utils/ERF_Interpolation.H index a1a8f05fb..f2e196e76 100644 --- a/Source/Utils/ERF_Interpolation.H +++ b/Source/Utils/ERF_Interpolation.H @@ -49,8 +49,7 @@ InterpolateInX (int i, int j, int k, const amrex::Array4& qty amrex::Real scaled_upw = 0.; // // The value that comes in has not been normalized so we do that here - if (upw != 0.) - scaled_upw = (upw > 0) ? 1. : -1.; + if (upw != 0.) { scaled_upw = (upw > 0) ? 1. : -1.; } avg1 = (qty(i, j, k, qty_index) + qty(i-1, j, k, qty_index)); diff1 = (qty(i, j, k, qty_index) - qty(i-1, j, k, qty_index)); @@ -80,8 +79,7 @@ InterpolateInY (int i, int j, int k, const amrex::Array4& qty amrex::Real scaled_upw = 0.; // The value that comes in has not been normalized so we do that here - if (upw != 0.) - scaled_upw = (upw > 0) ? 1. : -1.; + if (upw != 0.) { scaled_upw = (upw > 0) ? 1. : -1.; } avg1 = (qty(i, j , k, qty_index) + qty(i, j-1, k, qty_index)); diff1 = (qty(i, j , k, qty_index) - qty(i, j-1, k, qty_index)); @@ -110,8 +108,7 @@ InterpolateInZ (int i, int j, int k, const amrex::Array4& qty amrex::Real diff1 = 0.; amrex::Real diff2 = 0.; amrex::Real diff3 = 0.; amrex::Real scaled_upw = 0.; // The value that comes in has not been normalized so we do that here - if (upw != 0.) - scaled_upw = (upw > 0) ? 1. : -1.; + if (upw != 0.) { scaled_upw = (upw > 0) ? 1. : -1.; } avg1 = (qty(i, j, k , qty_index) + qty(i, j, k-1, qty_index)); diff1 = (qty(i, j, k , qty_index) - qty(i, j, k-1, qty_index)); @@ -139,8 +136,7 @@ InterpolatePertFromCell (int i, int j, int k, amrex::Real scaled_upw = 0.; // The value that comes in has not been normalized so we do that here - if (upw != 0.) - scaled_upw = upw / std::abs(upw); + if (upw != 0.) { scaled_upw = (upw > 0) ? 1. : -1.; } if (coordDir == Coord::x) { avg1 = (qty(i , j, k, qty_index) + qty(i-1, j, k, qty_index)); diff --git a/Source/Utils/ERF_PoissonSolve.cpp b/Source/Utils/ERF_PoissonSolve.cpp index d5a82fbc4..6e8916ca5 100644 --- a/Source/Utils/ERF_PoissonSolve.cpp +++ b/Source/Utils/ERF_PoissonSolve.cpp @@ -72,7 +72,7 @@ void ERF::project_velocities (int lev, Real l_dt, Vector& mom_mf, Mult MLPoisson mlpoisson(geom_tmp, ba_tmp, dm_tmp, info); - MultiFab r_hse(base_state[lev], make_alias, 0, 1); // r_0 is first component + MultiFab r_hse(base_state[lev], make_alias, BaseState::r0_comp, 1); auto bclo = get_projection_bc(Orientation::low); auto bchi = get_projection_bc(Orientation::high); diff --git a/Source/Utils/ERF_Utils.H b/Source/Utils/ERF_Utils.H index f713347f2..cfe2922d2 100644 --- a/Source/Utils/ERF_Utils.H +++ b/Source/Utils/ERF_Utils.H @@ -145,23 +145,23 @@ Time_Avg_Vel_atCC (const amrex::Real& dt, AMREX_GPU_HOST AMREX_FORCE_INLINE void -wrfbdy_set_rhs_in_spec_region (const amrex::Real& dt, - const int& icomp, - const int& num_var, - const int& width, - const int& set_width, - const amrex::Dim3& dom_lo, - const amrex::Dim3& dom_hi, - const amrex::Box& bx_xlo, - const amrex::Box& bx_xhi, - const amrex::Box& bx_ylo, - const amrex::Box& bx_yhi, - const amrex::Array4& arr_xlo, - const amrex::Array4& arr_xhi, - const amrex::Array4& arr_ylo, - const amrex::Array4& arr_yhi, - const amrex::Array4& data_arr, - const amrex::Array4& rhs_arr) +realbdy_set_rhs_in_spec_region (const amrex::Real& dt, + const int& icomp, + const int& num_var, + const int& width, + const int& set_width, + const amrex::Dim3& dom_lo, + const amrex::Dim3& dom_hi, + const amrex::Box& bx_xlo, + const amrex::Box& bx_xhi, + const amrex::Box& bx_ylo, + const amrex::Box& bx_yhi, + const amrex::Array4& arr_xlo, + const amrex::Array4& arr_xhi, + const amrex::Array4& arr_ylo, + const amrex::Array4& arr_yhi, + const amrex::Array4& data_arr, + const amrex::Array4& rhs_arr) { int Spec_z = set_width; amrex::ParallelFor(bx_xlo, num_var, [=] AMREX_GPU_DEVICE (int i, int j, int k, int n) noexcept @@ -235,24 +235,24 @@ wrfbdy_set_rhs_in_spec_region (const amrex::Real& dt, AMREX_GPU_HOST AMREX_FORCE_INLINE void -wrfbdy_compute_laplacian_relaxation (const int& icomp, - const int& num_var, - const int& width, - const int& set_width, - const amrex::Dim3& dom_lo, - const amrex::Dim3& dom_hi, - const amrex::Real& F1, - const amrex::Real& F2, - const amrex::Box& bx_xlo, - const amrex::Box& bx_xhi, - const amrex::Box& bx_ylo, - const amrex::Box& bx_yhi, - const amrex::Array4& arr_xlo, - const amrex::Array4& arr_xhi, - const amrex::Array4& arr_ylo, - const amrex::Array4& arr_yhi, - const amrex::Array4& data_arr, - const amrex::Array4& rhs_arr) +realbdy_compute_laplacian_relaxation (const int& icomp, + const int& num_var, + const int& width, + const int& set_width, + const amrex::Dim3& dom_lo, + const amrex::Dim3& dom_hi, + const amrex::Real& F1, + const amrex::Real& F2, + const amrex::Box& bx_xlo, + const amrex::Box& bx_xhi, + const amrex::Box& bx_ylo, + const amrex::Box& bx_yhi, + const amrex::Array4& arr_xlo, + const amrex::Array4& arr_xhi, + const amrex::Array4& arr_ylo, + const amrex::Array4& arr_yhi, + const amrex::Array4& data_arr, + const amrex::Array4& rhs_arr) { // RHS computation int Spec_z = set_width; diff --git a/Source/Utils/Make.package b/Source/Utils/Make.package index f757c99f9..238eccb8c 100644 --- a/Source/Utils/Make.package +++ b/Source/Utils/Make.package @@ -16,6 +16,7 @@ CEXE_headers += ERF_Sat_methods.H CEXE_headers += ERF_Water_vapor_saturation.H CEXE_headers += ERF_DirectionSelector.H +CEXE_sources += ERF_AverageDown.cpp CEXE_sources += ERF_ChopGrids.cpp CEXE_sources += ERF_MomentumToVelocity.cpp CEXE_sources += ERF_VelocityToMomentum.cpp diff --git a/Source/WindFarmParametrization/ERF_InitWindFarm.cpp b/Source/WindFarmParametrization/ERF_InitWindFarm.cpp index 99a6f2f20..933e1ada8 100644 --- a/Source/WindFarmParametrization/ERF_InitWindFarm.cpp +++ b/Source/WindFarmParametrization/ERF_InitWindFarm.cpp @@ -31,10 +31,10 @@ WindFarm::read_tables (std::string windfarm_loc_table, } void -WindFarm::read_windfarm_locations_table(const std::string windfarm_loc_table, - bool x_y, bool lat_lon, - const Real windfarm_x_shift, - const Real windfarm_y_shift) +WindFarm::read_windfarm_locations_table (const std::string windfarm_loc_table, + bool x_y, bool lat_lon, + const Real windfarm_x_shift, + const Real windfarm_y_shift) { if(x_y) { init_windfarm_x_y(windfarm_loc_table); @@ -125,14 +125,6 @@ WindFarm::init_windfarm_lat_lon (const std::string windfarm_loc_table, xloc[it] = xloc[it] - xloc_min + windfarm_x_shift; yloc[it] = yloc[it] - yloc_min + windfarm_y_shift; } - - FILE* file_xy_loc; - file_xy_loc = fopen("file_xy_loc_KingPlains.txt","w"); - - for(int it = 0;it d_xloc(xloc.size()); @@ -406,10 +398,10 @@ WindFarm::fill_Nturb_multifab(const Geometry& geom, } void -WindFarm::fill_SMark_multifab(const Geometry& geom, - MultiFab& mf_SMark, - const Real& sampling_distance_by_D, - const Real& turb_disk_angle) +WindFarm::fill_SMark_multifab (const Geometry& geom, + MultiFab& mf_SMark, + const Real& sampling_distance_by_D, + const Real& turb_disk_angle) { amrex::Gpu::DeviceVector d_xloc(xloc.size()); amrex::Gpu::DeviceVector d_yloc(yloc.size()); @@ -456,6 +448,8 @@ WindFarm::fill_SMark_multifab(const Geometry& geom, Real z = ProbLoArr[2] + (kk+0.5) * dx[2]; + int turb_indices_overlap[2]; + int check_int = 0; for(int it=0; it 1){ + printf("Actuator disks with indices %d and %d are overlapping\n", + turb_indices_overlap[0],turb_indices_overlap[1]); + amrex::Error("Actuator disks are overlapping. Visualize actuator_disks.vtk " + " and check the windturbine locations input file. Exiting.."); + } } - } }); } } void -WindFarm::write_turbine_locations_vtk() +WindFarm::write_turbine_locations_vtk () { if (ParallelDescriptor::IOProcessor()){ FILE* file_turbloc_vtk; @@ -499,7 +501,7 @@ WindFarm::write_turbine_locations_vtk() void -WindFarm::write_actuator_disks_vtk(const Geometry& geom) +WindFarm::write_actuator_disks_vtk (const Geometry& geom) { if (ParallelDescriptor::IOProcessor()){ diff --git a/Source/WindFarmParametrization/ERF_WindFarm.H b/Source/WindFarmParametrization/ERF_WindFarm.H index 100a81f0a..a94778fdf 100644 --- a/Source/WindFarmParametrization/ERF_WindFarm.H +++ b/Source/WindFarmParametrization/ERF_WindFarm.H @@ -15,9 +15,9 @@ class WindFarm : public NullWindFarm { public: - WindFarm(){} + WindFarm (){} - virtual ~WindFarm() = default; + virtual ~WindFarm () = default; WindFarm (int nlev, const WindFarmType& a_windfarm_type) @@ -50,37 +50,37 @@ public: const amrex::Real windfarm_x_shift = 0.0, const amrex::Real windfarm_y_shift = 0.0); - void init_windfarm_lat_lon(const std::string windfarm_loc_table, - const amrex::Real windfarm_x_shift, - const amrex::Real windfarm_y_shift); + void init_windfarm_lat_lon (const std::string windfarm_loc_table, + const amrex::Real windfarm_x_shift, + const amrex::Real windfarm_y_shift); - void init_windfarm_x_y(const std::string windfarm_loc_table); + void init_windfarm_x_y (const std::string windfarm_loc_table); - void read_windfarm_locations_table(const std::string windfarm_loc_table, - bool x_y, bool lat_lon, - const amrex::Real windfarm_x_shift = 0.0, - const amrex::Real windfarm_y_shift = 0.0); + void read_windfarm_locations_table (const std::string windfarm_loc_table, + bool x_y, bool lat_lon, + const amrex::Real windfarm_x_shift = 0.0, + const amrex::Real windfarm_y_shift = 0.0); - void read_windfarm_spec_table(const std::string windfarm_spec_table); + void read_windfarm_spec_table (const std::string windfarm_spec_table); - void read_windfarm_blade_table(const std::string windfarm_blade_table); + void read_windfarm_blade_table (const std::string windfarm_blade_table); - void read_windfarm_airfoil_tables(const std::string windfarm_airfoil_tables, - const std::string windfarm_blade_table); + void read_windfarm_airfoil_tables (const std::string windfarm_airfoil_tables, + const std::string windfarm_blade_table); - void read_windfarm_spec_table_extra(const std::string windfarm_spec_table_extra); + void read_windfarm_spec_table_extra (const std::string windfarm_spec_table_extra); - void fill_Nturb_multifab(const amrex::Geometry& geom, - amrex::MultiFab& mf_Nturb); + void fill_Nturb_multifab (const amrex::Geometry& geom, + amrex::MultiFab& mf_Nturb); - void fill_SMark_multifab(const amrex::Geometry& geom, - amrex::MultiFab& mf_SMark, - const amrex::Real& sampling_distance_by_D, - const amrex::Real& turb_disk_angle); + void fill_SMark_multifab (const amrex::Geometry& geom, + amrex::MultiFab& mf_SMark, + const amrex::Real& sampling_distance_by_D, + const amrex::Real& turb_disk_angle); - void write_turbine_locations_vtk(); + void write_turbine_locations_vtk (); - void write_actuator_disks_vtk(const amrex::Geometry& geom); + void write_actuator_disks_vtk (const amrex::Geometry& geom); void advance (const amrex::Geometry& a_geom, const amrex::Real& dt_advance, @@ -90,16 +90,17 @@ public: amrex::MultiFab& V_old, amrex::MultiFab& W_old, const amrex::MultiFab& mf_Nturb, - const amrex::MultiFab& mf_SMark) override + const amrex::MultiFab& mf_SMark, + const amrex::Real& time) override { m_windfarm_model[0]->advance(a_geom, dt_advance, cons_in, mf_vars_windfarm, - U_old, V_old, W_old, mf_Nturb, mf_SMark); + U_old, V_old, W_old, mf_Nturb, mf_SMark, time); } - void set_turb_spec(const amrex::Real& a_rotor_rad, const amrex::Real& a_hub_height, - const amrex::Real& a_thrust_coeff_standing, const amrex::Vector& a_wind_speed, - const amrex::Vector& a_thrust_coeff, - const amrex::Vector& a_power) override + void set_turb_spec (const amrex::Real& a_rotor_rad, const amrex::Real& a_hub_height, + const amrex::Real& a_thrust_coeff_standing, const amrex::Vector& a_wind_speed, + const amrex::Vector& a_thrust_coeff, + const amrex::Vector& a_power) override { m_windfarm_model[0]->set_turb_spec(a_rotor_rad, a_hub_height, a_thrust_coeff_standing, a_wind_speed, a_thrust_coeff, a_power); diff --git a/Source/WindFarmParametrization/EWP/ERF_AdvanceEWP.cpp b/Source/WindFarmParametrization/EWP/ERF_AdvanceEWP.cpp index 0b7915381..8ba23af86 100644 --- a/Source/WindFarmParametrization/EWP/ERF_AdvanceEWP.cpp +++ b/Source/WindFarmParametrization/EWP/ERF_AdvanceEWP.cpp @@ -14,9 +14,11 @@ EWP::advance (const Geometry& geom, MultiFab& V_old, MultiFab& W_old, const MultiFab& mf_Nturb, - const MultiFab& mf_SMark) + const MultiFab& mf_SMark, + const Real& time) { AMREX_ALWAYS_ASSERT(mf_SMark.nComp() > 0); + AMREX_ALWAYS_ASSERT(time > -1.0); source_terms_cellcentered(geom, cons_in, mf_vars_ewp, U_old, V_old, W_old, mf_Nturb); update(dt_advance, cons_in, U_old, V_old, mf_vars_ewp); } @@ -51,7 +53,7 @@ EWP::update (const Real& dt_advance, }, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { - cons_array(i,j,k,RhoQKE_comp) = cons_array(i,j,k,RhoQKE_comp) + ewp_array(i,j,k,2)*dt_advance; + cons_array(i,j,k,RhoKE_comp) = cons_array(i,j,k,RhoKE_comp) + ewp_array(i,j,k,2)*dt_advance; }); } } diff --git a/Source/WindFarmParametrization/EWP/ERF_EWP.H b/Source/WindFarmParametrization/EWP/ERF_EWP.H index c62dd33e4..119590a27 100644 --- a/Source/WindFarmParametrization/EWP/ERF_EWP.H +++ b/Source/WindFarmParametrization/EWP/ERF_EWP.H @@ -10,9 +10,9 @@ class EWP : public NullWindFarm { public: - EWP(){} + EWP (){} - virtual ~EWP() = default; + virtual ~EWP () = default; void advance (const amrex::Geometry& geom, const amrex::Real& dt_advance, @@ -22,7 +22,8 @@ public: amrex::MultiFab& V_old, amrex::MultiFab& W_old, const amrex::MultiFab& mf_Nturb, - const amrex::MultiFab& mf_SMark) override; + const amrex::MultiFab& mf_SMark, + const amrex::Real& time) override; void source_terms_cellcentered (const amrex::Geometry& geom, const amrex::MultiFab& cons_in, diff --git a/Source/WindFarmParametrization/Fitch/ERF_AdvanceFitch.cpp b/Source/WindFarmParametrization/Fitch/ERF_AdvanceFitch.cpp index 5fbf55232..6f1036339 100644 --- a/Source/WindFarmParametrization/Fitch/ERF_AdvanceFitch.cpp +++ b/Source/WindFarmParametrization/Fitch/ERF_AdvanceFitch.cpp @@ -7,9 +7,9 @@ using namespace amrex; AMREX_FORCE_INLINE AMREX_GPU_DEVICE -Real compute_A(const Real z, - const Real hub_height, - const Real rotor_rad) +Real compute_A (const Real z, + const Real hub_height, + const Real rotor_rad) { Real d = std::min(std::fabs(z - hub_height), rotor_rad); @@ -22,10 +22,10 @@ Real compute_A(const Real z, AMREX_FORCE_INLINE AMREX_GPU_DEVICE -Real compute_Aijk(const Real z_k, - const Real z_kp1, - const Real hub_height, - const Real rotor_rad) +Real compute_Aijk (const Real z_k, + const Real z_kp1, + const Real hub_height, + const Real rotor_rad) { Real A_k = compute_A(z_k, hub_height, rotor_rad); @@ -53,10 +53,12 @@ Fitch::advance (const Geometry& geom, MultiFab& V_old, MultiFab& W_old, const MultiFab& mf_Nturb, - const MultiFab& mf_SMark) + const MultiFab& mf_SMark, + const Real& time) { AMREX_ALWAYS_ASSERT(W_old.nComp() > 0); AMREX_ALWAYS_ASSERT(mf_SMark.nComp() > 0); + AMREX_ALWAYS_ASSERT(time > -1.0); source_terms_cellcentered(geom, cons_in, mf_vars_fitch, U_old, V_old, W_old, mf_Nturb); update(dt_advance, cons_in, U_old, V_old, mf_vars_fitch); } @@ -91,7 +93,7 @@ Fitch::update (const Real& dt_advance, }, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { - cons_array(i,j,k,RhoQKE_comp) = cons_array(i,j,k,RhoQKE_comp) + fitch_array(i,j,k,4)*dt_advance; + cons_array(i,j,k,RhoKE_comp) = cons_array(i,j,k,RhoKE_comp) + fitch_array(i,j,k,4)*dt_advance; }); } } diff --git a/Source/WindFarmParametrization/Fitch/ERF_Fitch.H b/Source/WindFarmParametrization/Fitch/ERF_Fitch.H index ca450ecb9..baa557e22 100644 --- a/Source/WindFarmParametrization/Fitch/ERF_Fitch.H +++ b/Source/WindFarmParametrization/Fitch/ERF_Fitch.H @@ -10,9 +10,9 @@ class Fitch : public NullWindFarm { public: - Fitch() {} + Fitch () {} - virtual ~Fitch() = default; + virtual ~Fitch () = default; void advance (const amrex::Geometry& geom, const amrex::Real& dt_advance, @@ -22,7 +22,8 @@ public: amrex::MultiFab& V_old, amrex::MultiFab& W_old, const amrex::MultiFab& mf_Nturb, - const amrex::MultiFab& mf_SMark) override; + const amrex::MultiFab& mf_SMark, + const amrex::Real& time) override; void source_terms_cellcentered (const amrex::Geometry& geom, const amrex::MultiFab& cons_in, diff --git a/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp b/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp index 42f9d4be3..2f5873f63 100644 --- a/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp +++ b/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_AdvanceGeneralAD.cpp @@ -7,18 +7,20 @@ using namespace amrex; void GeneralAD::advance (const Geometry& geom, - const Real& dt_advance, - MultiFab& cons_in, - MultiFab& mf_vars_generalAD, - MultiFab& U_old, - MultiFab& V_old, - MultiFab& W_old, - const MultiFab& mf_Nturb, - const MultiFab& mf_SMark) + const Real& dt_advance, + MultiFab& cons_in, + MultiFab& mf_vars_generalAD, + MultiFab& U_old, + MultiFab& V_old, + MultiFab& W_old, + const MultiFab& mf_Nturb, + const MultiFab& mf_SMark, + const Real& time) { AMREX_ALWAYS_ASSERT(W_old.nComp() > 0); AMREX_ALWAYS_ASSERT(mf_Nturb.nComp() > 0); AMREX_ALWAYS_ASSERT(mf_vars_generalAD.nComp() > 0); + AMREX_ALWAYS_ASSERT(time > -1.0); compute_freestream_velocity(cons_in, U_old, V_old, mf_SMark); source_terms_cellcentered(geom, cons_in, mf_SMark, mf_vars_generalAD); update(dt_advance, cons_in, U_old, V_old, W_old, mf_vars_generalAD); @@ -26,11 +28,11 @@ GeneralAD::advance (const Geometry& geom, void GeneralAD::update (const Real& dt_advance, - MultiFab& cons_in, - MultiFab& U_old, - MultiFab& V_old, - MultiFab& W_old, - const MultiFab& mf_vars_generalAD) + MultiFab& cons_in, + MultiFab& U_old, + MultiFab& V_old, + MultiFab& W_old, + const MultiFab& mf_vars_generalAD) { for ( MFIter mfi(cons_in,TilingIfNotGPU()); mfi.isValid(); ++mfi) { @@ -61,10 +63,10 @@ GeneralAD::update (const Real& dt_advance, } } -void GeneralAD::compute_freestream_velocity(const MultiFab& cons_in, - const MultiFab& U_old, - const MultiFab& V_old, - const MultiFab& mf_SMark) +void GeneralAD::compute_freestream_velocity (const MultiFab& cons_in, + const MultiFab& U_old, + const MultiFab& V_old, + const MultiFab& mf_SMark) { get_turb_loc(xloc, yloc); freestream_velocity.clear(); @@ -139,9 +141,9 @@ void GeneralAD::compute_freestream_velocity(const MultiFab& cons_in, AMREX_FORCE_INLINE AMREX_GPU_DEVICE -int find_rad_loc_index(const Real rad, - const Real* bld_rad_loc, - const int n_bld_sections) +int find_rad_loc_index (const Real rad, + const Real* bld_rad_loc, + const int n_bld_sections) { // Find the index of the radial location int index=-1; @@ -239,7 +241,7 @@ compute_source_terms_Fn_Ft (const Real rad, AMREX_ALWAYS_ASSERT(std::fabs(std::exp(-fhub))<=1.0); AMREX_ALWAYS_ASSERT(std::fabs(std::exp(-ftip))<=1.0); - F = 1.0;//2.0/PI*(std::acos(std::exp(-ftip)) + std::acos(std::exp(-fhub)) ); + F = 2.0/PI*(std::acos(std::exp(-ftip)) + std::acos(std::exp(-fhub)) ); at_new = 1.0/ ( 4.0*F*std::sin(psi)*std::cos(psi)/(s*Ct+1e-10) - 1.0 ); an_new = 1.0/ ( 1.0 + 4.0*F*std::pow(std::sin(psi),2)/(s*Cn + 1e-10) ); @@ -283,9 +285,9 @@ compute_source_terms_Fn_Ft (const Real rad, void GeneralAD::source_terms_cellcentered (const Geometry& geom, - const MultiFab& cons_in, - const MultiFab& mf_SMark, - MultiFab& mf_vars_generalAD) + const MultiFab& cons_in, + const MultiFab& mf_SMark, + MultiFab& mf_vars_generalAD) { get_turb_loc(xloc, yloc); @@ -417,7 +419,6 @@ GeneralAD::source_terms_cellcentered (const Geometry& geom, Real y = ProbLoArr[1] + (jj+0.5)*dx[1]; Real z = ProbLoArr[2] + (kk+0.5)*dx[2]; // ?? Density needed here - Real inv_dens_vol = 1.0/(1.0*dx[0]*dx[1]*dx[2]); int check_int = 0; @@ -468,17 +469,19 @@ GeneralAD::source_terms_cellcentered (const Geometry& geom, d_blade_pitch_ptr, n_spec_extra); - Real Fn = Fn_and_Ft[0]; - Real Ft = Fn_and_Ft[1]; + Real Fn = 3.0*Fn_and_Ft[0]; + Real Ft = 3.0*Fn_and_Ft[1]; // Compute the source terms - pass in radial distance, free stream velocity Real Fx = Fn*std::cos(phi) + Ft*std::sin(zeta)*std::sin(phi); Real Fy = Fn*std::sin(phi) - Ft*std::sin(zeta)*std::cos(phi); Real Fz = -Ft*std::cos(zeta); - source_x = -Fx*inv_dens_vol; - source_y = -Fy*inv_dens_vol; - source_z = -Fz*inv_dens_vol; + //Real dn = ( + + source_x = -Fx/(2.0*PI*rad*dx[0])*1.0/std::pow(2.0*PI,0.5); + source_y = -Fy/(2.0*PI*rad*dx[0])*1.0/std::pow(2.0*PI,0.5); + source_z = -Fz/(2.0*PI*rad*dx[0])*1.0/std::pow(2.0*PI,0.5); //printf("Val source_x, is %0.15g, %0.15g, %0.15g %0.15g %0.15g %0.15g\n", rad, Fn, Ft, source_x, source_y, source_z); diff --git a/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_GeneralAD.H b/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_GeneralAD.H index 593b16a48..e4f8d75ed 100644 --- a/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_GeneralAD.H +++ b/Source/WindFarmParametrization/GeneralActuatorDisk/ERF_GeneralAD.H @@ -9,9 +9,9 @@ class GeneralAD : public NullWindFarm { public: - GeneralAD() {} + GeneralAD () {} - virtual ~GeneralAD() = default; + virtual ~GeneralAD () = default; void advance (const amrex::Geometry& geom, const amrex::Real& dt_advance, @@ -21,7 +21,8 @@ public: amrex::MultiFab& V_old, amrex::MultiFab& W_old, const amrex::MultiFab& mf_Nturb, - const amrex::MultiFab& mf_SMark) override; + const amrex::MultiFab& mf_SMark, + const amrex::Real& time) override; void compute_freestream_velocity (const amrex::MultiFab& cons_in, const amrex::MultiFab& U_old, diff --git a/Source/WindFarmParametrization/Null/ERF_NullWindFarm.H b/Source/WindFarmParametrization/Null/ERF_NullWindFarm.H index 2daea0aa5..6134e976c 100644 --- a/Source/WindFarmParametrization/Null/ERF_NullWindFarm.H +++ b/Source/WindFarmParametrization/Null/ERF_NullWindFarm.H @@ -10,24 +10,25 @@ class NullWindFarm { public: - NullWindFarm() {} + NullWindFarm () {} - virtual ~NullWindFarm() = default; + virtual ~NullWindFarm () = default; virtual void advance (const amrex::Geometry& a_geom, - const amrex::Real& dt_advance, - amrex::MultiFab& cons_in, - amrex::MultiFab& mf_vars_windfarm, - amrex::MultiFab& U_old, - amrex::MultiFab& V_old, - amrex::MultiFab& W_old, - const amrex::MultiFab& mf_Nturb, - const amrex::MultiFab& mf_SMark) = 0; - - virtual void set_turb_spec(const amrex::Real& rotor_rad, const amrex::Real& hub_height, - const amrex::Real& thrust_coeff_standing, const amrex::Vector& wind_speed, - const amrex::Vector& thrust_coeff, - const amrex::Vector& power) + const amrex::Real& dt_advance, + amrex::MultiFab& cons_in, + amrex::MultiFab& mf_vars_windfarm, + amrex::MultiFab& U_old, + amrex::MultiFab& V_old, + amrex::MultiFab& W_old, + const amrex::MultiFab& mf_Nturb, + const amrex::MultiFab& mf_SMark, + const amrex::Real& time) = 0; + + virtual void set_turb_spec (const amrex::Real& rotor_rad, const amrex::Real& hub_height, + const amrex::Real& thrust_coeff_standing, const amrex::Vector& wind_speed, + const amrex::Vector& thrust_coeff, + const amrex::Vector& power) { m_rotor_rad = rotor_rad; m_hub_height = hub_height; @@ -49,29 +50,29 @@ public: m_turb_disk_angle = turb_disk_angle; } - virtual void set_blade_spec(const amrex::Vector& bld_rad_loc, - const amrex::Vector& bld_twist, - const amrex::Vector& bld_chord) + virtual void set_blade_spec (const amrex::Vector& bld_rad_loc, + const amrex::Vector& bld_twist, + const amrex::Vector& bld_chord) { m_bld_rad_loc = bld_rad_loc; m_bld_twist = bld_twist; m_bld_chord = bld_chord; } - virtual void set_blade_airfoil_spec(const amrex::Vector>& bld_airfoil_aoa, - const amrex::Vector>& bld_airfoil_Cl, - const amrex::Vector>& bld_airfoil_Cd) + virtual void set_blade_airfoil_spec (const amrex::Vector>& bld_airfoil_aoa, + const amrex::Vector>& bld_airfoil_Cl, + const amrex::Vector>& bld_airfoil_Cd) { m_bld_airfoil_aoa = bld_airfoil_aoa; m_bld_airfoil_Cl = bld_airfoil_Cl; m_bld_airfoil_Cd = bld_airfoil_Cd; } - virtual void set_turb_spec_extra(const amrex::Vector& velocity, - const amrex::Vector& C_P, - const amrex::Vector& C_T, - const amrex::Vector& rotor_RPM, - const amrex::Vector& blade_pitch) + virtual void set_turb_spec_extra (const amrex::Vector& velocity, + const amrex::Vector& C_P, + const amrex::Vector& C_T, + const amrex::Vector& rotor_RPM, + const amrex::Vector& blade_pitch) { m_velocity = velocity; m_C_P = C_P; @@ -104,29 +105,29 @@ public: turb_disk_angle = m_turb_disk_angle; } - void get_blade_spec(amrex::Vector& bld_rad_loc, - amrex::Vector& bld_twist, - amrex::Vector& bld_chord) + void get_blade_spec (amrex::Vector& bld_rad_loc, + amrex::Vector& bld_twist, + amrex::Vector& bld_chord) { bld_rad_loc = m_bld_rad_loc; bld_twist = m_bld_twist; bld_chord = m_bld_chord; } - void get_blade_airfoil_spec(amrex::Vector>& bld_airfoil_aoa, - amrex::Vector>& bld_airfoil_Cl, - amrex::Vector>& bld_airfoil_Cd) + void get_blade_airfoil_spec (amrex::Vector>& bld_airfoil_aoa, + amrex::Vector>& bld_airfoil_Cl, + amrex::Vector>& bld_airfoil_Cd) { bld_airfoil_aoa = m_bld_airfoil_aoa; bld_airfoil_Cl = m_bld_airfoil_Cl; bld_airfoil_Cd = m_bld_airfoil_Cd; } - void get_turb_spec_extra(amrex::Vector& velocity, - amrex::Vector& C_P, - amrex::Vector& C_T, - amrex::Vector& rotor_RPM, - amrex::Vector& blade_pitch) + void get_turb_spec_extra (amrex::Vector& velocity, + amrex::Vector& C_P, + amrex::Vector& C_T, + amrex::Vector& rotor_RPM, + amrex::Vector& blade_pitch) { velocity = m_velocity; C_P = m_C_P; @@ -136,10 +137,10 @@ public: } static AMREX_GPU_DEVICE -bool find_if_marked(amrex::Real x1, amrex::Real x2, amrex::Real y1, amrex::Real y2, - amrex::Real x0, amrex::Real y0, amrex::Real nx, amrex::Real ny, - amrex::Real d_hub_height, amrex::Real d_rotor_rad, - amrex::Real z) +bool find_if_marked (amrex::Real x1, amrex::Real x2, amrex::Real y1, amrex::Real y2, + amrex::Real x0, amrex::Real y0, amrex::Real nx, amrex::Real ny, + amrex::Real d_hub_height, amrex::Real d_rotor_rad, + amrex::Real z) { // Plane is (x-x0)*nx + (y-y0)*ny = 0. And the planes to intersect are diff --git a/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_AdvanceSimpleAD.cpp b/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_AdvanceSimpleAD.cpp index 38a10d65e..116de0b48 100644 --- a/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_AdvanceSimpleAD.cpp +++ b/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_AdvanceSimpleAD.cpp @@ -6,20 +6,51 @@ using namespace amrex; void SimpleAD::advance (const Geometry& geom, - const Real& dt_advance, - MultiFab& cons_in, - MultiFab& mf_vars_simpleAD, - MultiFab& U_old, - MultiFab& V_old, - MultiFab& W_old, - const MultiFab& mf_Nturb, - const MultiFab& mf_SMark) + const Real& dt_advance, + MultiFab& cons_in, + MultiFab& mf_vars_simpleAD, + MultiFab& U_old, + MultiFab& V_old, + MultiFab& W_old, + const MultiFab& mf_Nturb, + const MultiFab& mf_SMark, + const Real& time) { AMREX_ALWAYS_ASSERT(W_old.nComp() > 0); AMREX_ALWAYS_ASSERT(mf_Nturb.nComp() > 0); compute_freestream_velocity(cons_in, U_old, V_old, mf_SMark); source_terms_cellcentered(geom, cons_in, mf_SMark, mf_vars_simpleAD); update(dt_advance, cons_in, U_old, V_old, mf_vars_simpleAD); + compute_power_output(time); +} + +void +SimpleAD::compute_power_output (const Real& time) +{ + get_turb_loc(xloc, yloc); + get_turb_spec(rotor_rad, hub_height, thrust_coeff_standing, + wind_speed, thrust_coeff, power); + + const int n_spec_table = wind_speed.size(); + // Compute power based on the look-up table + + if (ParallelDescriptor::IOProcessor()){ + static std::ofstream file("power_output.txt", std::ios::app); + // Check if the file opened successfully + if (!file.is_open()) { + std::cerr << "Error opening file!" << std::endl; + Abort("Could not open file to write power output in ERF_AdvanceSimpleAD.cpp"); + } + Real total_power = 0.0; + for(int it=0; it(SMark_array(ii,jj,kk,1)); + + if(it != -1) { Real avg_vel = d_freestream_velocity_ptr[it]/(d_disk_cell_count_ptr[it] + 1e-10); Real phi = d_freestream_phi_ptr[it]/(d_disk_cell_count_ptr[it] + 1e-10); @@ -210,8 +242,6 @@ SimpleAD::source_terms_cellcentered (const Geometry& geom, a = 0.5 - 0.5*std::pow(1.0-C_T,0.5); } Real Uinfty_dot_nhat = avg_vel*(std::cos(phi)*nx + std::sin(phi)*ny); - if(SMark_array(ii,jj,kk,1) == static_cast(it)) { - check_int++; if(C_T <= 1) { source_x = -2.0*std::pow(Uinfty_dot_nhat, 2.0)*a*(1.0-a)*dx[1]*dx[2]*std::cos(d_turb_disk_angle)/(dx[0]*dx[1]*dx[2])*std::cos(phi); source_y = -2.0*std::pow(Uinfty_dot_nhat, 2.0)*a*(1.0-a)*dx[1]*dx[2]*std::cos(d_turb_disk_angle)/(dx[0]*dx[1]*dx[2])*std::sin(phi); @@ -220,12 +250,7 @@ SimpleAD::source_terms_cellcentered (const Geometry& geom, source_x = -0.5*C_T*std::pow(Uinfty_dot_nhat, 2.0)*dx[1]*dx[2]*std::cos(d_turb_disk_angle)/(dx[0]*dx[1]*dx[2])*std::cos(phi); source_y = -0.5*C_T*std::pow(Uinfty_dot_nhat, 2.0)*dx[1]*dx[2]*std::cos(d_turb_disk_angle)/(dx[0]*dx[1]*dx[2])*std::sin(phi); } - } - } - if(check_int > 1){ - amrex::Error("Actuator disks are overlapping. Visualize actuator_disks.vtk " - "and check the windturbine locations input file. Exiting.."); - } + } simpleAD_array(i,j,k,0) = source_x; simpleAD_array(i,j,k,1) = source_y; diff --git a/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_SimpleAD.H b/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_SimpleAD.H index 9acccc457..2889e8ecb 100644 --- a/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_SimpleAD.H +++ b/Source/WindFarmParametrization/SimpleActuatorDisk/ERF_SimpleAD.H @@ -9,9 +9,9 @@ class SimpleAD : public NullWindFarm { public: - SimpleAD() {} + SimpleAD () {} - virtual ~SimpleAD() = default; + virtual ~SimpleAD () = default; void advance (const amrex::Geometry& geom, const amrex::Real& dt_advance, @@ -21,12 +21,13 @@ public: amrex::MultiFab& V_old, amrex::MultiFab& W_old, const amrex::MultiFab& mf_Nturb, - const amrex::MultiFab& mf_SMark) override; + const amrex::MultiFab& mf_SMark, + const amrex::Real& time) override; - void compute_freestream_velocity(const amrex::MultiFab& cons_in, - const amrex::MultiFab& U_old, - const amrex::MultiFab& V_old, - const amrex::MultiFab& mf_SMark); + void compute_freestream_velocity (const amrex::MultiFab& cons_in, + const amrex::MultiFab& U_old, + const amrex::MultiFab& V_old, + const amrex::MultiFab& mf_SMark); void source_terms_cellcentered (const amrex::Geometry& geom, const amrex::MultiFab& cons_in, @@ -39,6 +40,8 @@ public: amrex::MultiFab& V_old, const amrex::MultiFab& mf_vars); + void compute_power_output (const amrex::Real& time); + protected: amrex::Vector xloc, yloc; amrex::Real turb_disk_angle; diff --git a/Tests/CTestList.cmake b/Tests/CTestList.cmake index 231bdf855..e4eb44dd8 100644 --- a/Tests/CTestList.cmake +++ b/Tests/CTestList.cmake @@ -102,86 +102,84 @@ endfunction(add_test_0) # Regression tests #============================================================================= if(WIN32) -#add_test_r(Bubble_DensityCurrent "Bubble/bubble.exe" "plt00010") -add_test_r(CouetteFlow_x "RegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00050") -add_test_r(CouetteFlow_y "RegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00050") -add_test_r(DensityCurrent "RegTests/DensityCurrent/*/erf_density_current.exe" "plt00010") -add_test_r(DensityCurrent_detJ2 "RegTests/DensityCurrent/*/erf_density_current.exe" "plt00010") -add_test_r(DensityCurrent_detJ2_nosub "RegTests/DensityCurrent/*/erf_density_current.exe" "plt00020") -add_test_r(DensityCurrent_detJ2_MT "RegTests/DensityCurrent/*/erf_density_current.exe" "plt00010") -add_test_r(EkmanSpiral "RegTests/EkmanSpiral/*/erf_ekman_spiral.exe" "plt00010") -add_test_r(IsentropicVortexStationary "RegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") -add_test_r(IsentropicVortexAdvecting "RegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") -add_test_r(IVA_NumDiff "RegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") +add_test_r(CouetteFlow_x "DryRegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00050") +add_test_r(CouetteFlow_y "DryRegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00050") +add_test_r(DensityCurrent "DryRegTests/DensityCurrent/*/erf_density_current.exe" "plt00010") +add_test_r(DensityCurrent_detJ2 "DryRegTests/DensityCurrent/*/erf_density_current.exe" "plt00010") +add_test_r(DensityCurrent_detJ2_nosub "DryRegTests/DensityCurrent/*/erf_density_current.exe" "plt00020") +add_test_r(DensityCurrent_detJ2_MT "DryRegTests/DensityCurrent/*/erf_density_current.exe" "plt00010") +add_test_r(EkmanSpiral "DryRegTests/EkmanSpiral/*/erf_ekman_spiral.exe" "plt00010") +add_test_r(IsentropicVortexStationary "DryRegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") +add_test_r(IsentropicVortexAdvecting "DryRegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") +add_test_r(IVA_NumDiff "DryRegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") add_test_r(MovingTerrain_nosub "DevTests/MovingTerrain/*/erf_moving_terrain.exe" "plt00020") add_test_r(MovingTerrain_sub "DevTests/MovingTerrain/*/erf_moving_terrain.exe" "plt00010") -add_test_r(PoiseuilleFlow_x "RegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00010") -add_test_r(PoiseuilleFlow_y "RegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00010") -add_test_r(RayleighDamping "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00100") -add_test_r(ScalarAdvectionUniformU "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvectionShearedU "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00080") -add_test_r(ScalarAdvDiff_order2 "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_order3 "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_order4 "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_order5 "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_order6 "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_weno3 "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_d(ScalarAdvDiff_weno3z "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_weno5 "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_d(ScalarAdvDiff_weno5z "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarAdvDiff_wenomzq3 "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarDiffusionGaussian "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(ScalarDiffusionSine "RegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") -add_test_r(TaylorGreenAdvecting "RegTests/TaylorGreenVortex/*/erf_taylor_green.exe" "plt00010") -add_test_r(TaylorGreenAdvectingDiffusing "RegTests/TaylorGreenVortex/*/erf_taylor_green.exe" "plt00010") -add_test_r(MSF_NoSub_IsentropicVortexAdv "RegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") -add_test_r(MSF_Sub_IsentropicVortexAdv "RegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") +add_test_r(PoiseuilleFlow_x "DryRegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00010") +add_test_r(PoiseuilleFlow_y "DryRegTests/Couette_Poiseuille/*/erf_couette_poiseuille.exe" "plt00010") +add_test_r(RayleighDamping "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00100") +add_test_r(ScalarAdvectionUniformU "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_r(ScalarAdvectionShearedU "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00080") +add_test_r(ScalarAdvDiff_order2 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_r(ScalarAdvDiff_order3 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_r(ScalarAdvDiff_order4 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_r(ScalarAdvDiff_order5 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_r(ScalarAdvDiff_order6 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_r(ScalarAdvDiff_weno3 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_d(ScalarAdvDiff_weno3z "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_r(ScalarAdvDiff_weno5 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_d(ScalarAdvDiff_weno5z "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_r(ScalarAdvDiff_wenomzq3 "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_r(ScalarDiffusionGaussian "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_r(ScalarDiffusionSine "DryRegTests/ScalarAdvDiff/*/erf_scalar_advdiff.exe" "plt00020") +add_test_r(TaylorGreenAdvecting "DryRegTests/TaylorGreenVortex/*/erf_taylor_green.exe" "plt00010") +add_test_r(TaylorGreenAdvectingDiffusing "DryRegTests/TaylorGreenVortex/*/erf_taylor_green.exe" "plt00010") +add_test_r(MSF_NoSub_IsentropicVortexAdv "DryRegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") +add_test_r(MSF_Sub_IsentropicVortexAdv "DryRegTests/IsentropicVortex/*/erf_isentropic_vortex.exe" "plt00010") add_test_r(ABL_MOST "ABL/*/erf_abl.exe" "plt00010") add_test_r(ABL_MYNN_PBL "ABL/*/erf_abl.exe" "plt00100" INPUT_SOUNDING "input_sounding_GABLS1") add_test_r(ABL_InflowFile "ABL/*/erf_abl.exe" "plt00010") -add_test_r(MoistBubble "RegTests/Bubble/*/erf_bubble.exe" "plt00010") +add_test_r(MoistBubble "MoistRegTests/Bubble/*/erf_bubble.exe" "plt00010") add_test_0(Deardorff_stationary "ABL/*/erf_abl.exe" "plt00010") else() -#add_test_r(Bubble_DensityCurrent "Bubble/bubble" "plt00010") -add_test_r(CouetteFlow_x "RegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00050") -add_test_r(CouetteFlow_y "RegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00050") -add_test_r(DensityCurrent "RegTests/DensityCurrent/erf_density_current" "plt00010") -add_test_r(DensityCurrent_detJ2 "RegTests/DensityCurrent/erf_density_current" "plt00010") -add_test_r(DensityCurrent_detJ2_nosub "RegTests/DensityCurrent/erf_density_current" "plt00020") -add_test_r(DensityCurrent_detJ2_MT "RegTests/DensityCurrent/erf_density_current" "plt00010") -add_test_r(EkmanSpiral "RegTests/EkmanSpiral/erf_ekman_spiral" "plt00010") -add_test_r(IsentropicVortexStationary "RegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") -add_test_r(IsentropicVortexAdvecting "RegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") -add_test_r(IVA_NumDiff "RegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") +add_test_r(CouetteFlow_x "DryRegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00050") +add_test_r(CouetteFlow_y "DryRegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00050") +add_test_r(DensityCurrent "DryRegTests/DensityCurrent/erf_density_current" "plt00010") +add_test_r(DensityCurrent_detJ2 "DryRegTests/DensityCurrent/erf_density_current" "plt00010") +add_test_r(DensityCurrent_detJ2_nosub "DryRegTests/DensityCurrent/erf_density_current" "plt00020") +add_test_r(DensityCurrent_detJ2_MT "DryRegTests/DensityCurrent/erf_density_current" "plt00010") +add_test_r(EkmanSpiral "DryRegTests/EkmanSpiral/erf_ekman_spiral" "plt00010") +add_test_r(IsentropicVortexStationary "DryRegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") +add_test_r(IsentropicVortexAdvecting "DryRegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") +add_test_r(IVA_NumDiff "DryRegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") add_test_r(MovingTerrain_nosub "DevTests/MovingTerrain/erf_moving_terrain" "plt00020") add_test_r(MovingTerrain_sub "DevTests/MovingTerrain/erf_moving_terrain" "plt00010") -add_test_r(PoiseuilleFlow_x "RegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00010") -add_test_r(PoiseuilleFlow_y "RegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00010") -add_test_r(RayleighDamping "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00100") -add_test_r(ScalarAdvectionUniformU "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvectionShearedU "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00080") -add_test_r(ScalarAdvDiff_order2 "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_order3 "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_order4 "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_order5 "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_order6 "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_weno3 "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_d(ScalarAdvDiff_weno3z "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_weno5 "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_d(ScalarAdvDiff_weno5z "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarAdvDiff_wenomzq3 "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarDiffusionGaussian "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(ScalarDiffusionSine "RegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") -add_test_r(TaylorGreenAdvecting "RegTests/TaylorGreenVortex/erf_taylor_green" "plt00010") -add_test_r(TaylorGreenAdvectingDiffusing "RegTests/TaylorGreenVortex/erf_taylor_green" "plt00010") -add_test_r(MSF_NoSub_IsentropicVortexAdv "RegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") -add_test_r(MSF_Sub_IsentropicVortexAdv "RegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") +add_test_r(PoiseuilleFlow_x "DryRegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00010") +add_test_r(PoiseuilleFlow_y "DryRegTests/Couette_Poiseuille/erf_couette_poiseuille" "plt00010") +add_test_r(RayleighDamping "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00100") +add_test_r(ScalarAdvectionUniformU "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvectionShearedU "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00080") +add_test_r(ScalarAdvDiff_order2 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_order3 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_order4 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_order5 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_order6 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_weno3 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_d(ScalarAdvDiff_weno3z "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_weno5 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_d(ScalarAdvDiff_weno5z "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_r(ScalarAdvDiff_wenomzq3 "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_r(ScalarDiffusionGaussian "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_r(ScalarDiffusionSine "DryRegTests/ScalarAdvDiff/erf_scalar_advdiff" "plt00020") +add_test_r(TaylorGreenAdvecting "DryRegTests/TaylorGreenVortex/erf_taylor_green" "plt00010") +add_test_r(TaylorGreenAdvectingDiffusing "DryRegTests/TaylorGreenVortex/erf_taylor_green" "plt00010") +add_test_r(MSF_NoSub_IsentropicVortexAdv "DryRegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") +add_test_r(MSF_Sub_IsentropicVortexAdv "DryRegTests/IsentropicVortex/erf_isentropic_vortex" "plt00010") add_test_r(ABL_MOST "ABL/erf_abl" "plt00010") add_test_r(ABL_MYNN_PBL "ABL/erf_abl" "plt00100" INPUT_SOUNDING "input_sounding_GABLS1") add_test_r(ABL_InflowFile "ABL/erf_abl" "plt00010") -add_test_r(MoistBubble "RegTests/Bubble/erf_bubble" "plt00010") +add_test_r(MoistBubble "MoistRegTests/Bubble/erf_bubble" "plt00010") add_test_0(InitSoundingIdeal_stationary "ABL/erf_abl" "plt00010") add_test_0(Deardorff_stationary "ABL/erf_abl" "plt00010") diff --git a/Tests/ERFGoldFiles/ABL_MYNN_PBL/Header b/Tests/ERFGoldFiles/ABL_MYNN_PBL/Header index 3b02ebe35..7d9bb4e58 100644 --- a/Tests/ERFGoldFiles/ABL_MYNN_PBL/Header +++ b/Tests/ERFGoldFiles/ABL_MYNN_PBL/Header @@ -1,7 +1,7 @@ HyperCLaw-V1.1 9 density -rhoQKE +rhoKE x_velocity y_velocity z_velocity diff --git a/Tests/ERFGoldFiles/ABL_MYNN_PBL/Level_0/Cell_D_00000 b/Tests/ERFGoldFiles/ABL_MYNN_PBL/Level_0/Cell_D_00000 index b1199550f..0394293ed 100644 Binary files a/Tests/ERFGoldFiles/ABL_MYNN_PBL/Level_0/Cell_D_00000 and b/Tests/ERFGoldFiles/ABL_MYNN_PBL/Level_0/Cell_D_00000 differ diff --git a/Tests/ERFGoldFiles/ABL_MYNN_PBL/Level_0/Cell_H b/Tests/ERFGoldFiles/ABL_MYNN_PBL/Level_0/Cell_H index 104dcfc62..e38478257 100644 --- a/Tests/ERFGoldFiles/ABL_MYNN_PBL/Level_0/Cell_H +++ b/Tests/ERFGoldFiles/ABL_MYNN_PBL/Level_0/Cell_H @@ -9,8 +9,8 @@ FabOnDisk: Cell_D_00000 0 1,9 -1.26070047102875904e+00,9.99999999999999980e-13,4.46574933952489417e+00,-1.12232648780406732e-08,-7.69073595650813326e-07,2.64998234491972653e+02,9.57655146925807348e+04,9.99044297877987339e-12,1.51954705866529331e-12, +1.26070047102875948e+00,1.95988662697085971e-13,4.46574935406356754e+00,-1.12232668115563200e-08,-7.69073637415686026e-07,2.64998234491976461e+02,9.57655146925806912e+04,3.92674027217218053e-12,5.97257035770471087e-13, 1,9 -1.32197155095610364e+00,1.22162865373526963e+00,8.00000067867087772e+00,2.08085771745764106e-02,1.28715031999786871e-05,2.67968750004692424e+02,1.00759448324675468e+05,4.06335629715192681e+00,3.80301353767852346e+00, +1.32197155095608410e+00,6.10814301669270532e-01,8.00000067867098608e+00,2.08085770779100759e-02,1.28715033383124336e-05,2.67968750004692254e+02,1.00759448324675410e+05,4.06335445086042224e+00,3.80301188647594257e+00, diff --git a/Tests/ERFGoldFiles/IVA_NumDiff/Header b/Tests/ERFGoldFiles/IVA_NumDiff/Header index 17ab11925..d75438415 100644 --- a/Tests/ERFGoldFiles/IVA_NumDiff/Header +++ b/Tests/ERFGoldFiles/IVA_NumDiff/Header @@ -18,18 +18,12 @@ pressure 0.5 0.5 0.5 0 0 -0 4 0.005000000000000001 +0 2 0.005000000000000001 10 --12 0 --12 0 --1 1 -0 12 +-12 12 -12 0 -1 1 --12 0 -0 12 --1 1 -0 12 +-12 12 0 12 -1 1 Level_0/Cell diff --git a/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_D_00000 b/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_D_00000 index 4cf93a1a3..789d45751 100644 Binary files a/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_D_00000 and b/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_D_00000 differ diff --git a/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_D_00001 b/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_D_00001 index ef53c3659..10e4c91b9 100644 Binary files a/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_D_00001 and b/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_D_00001 differ diff --git a/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_H b/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_H index efb9a8d3d..89dc2b9c9 100644 --- a/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_H +++ b/Tests/ERFGoldFiles/IVA_NumDiff/Level_0/Cell_H @@ -2,27 +2,19 @@ 1 7 0 -(4 0 -((0,0,0) (23,23,3) (0,0,0)) -((24,0,0) (47,23,3) (0,0,0)) -((0,24,0) (23,47,3) (0,0,0)) -((24,24,0) (47,47,3) (0,0,0)) +(2 0 +((0,0,0) (47,23,3) (0,0,0)) +((0,24,0) (47,47,3) (0,0,0)) ) -4 +2 FabOnDisk: Cell_D_00000 0 FabOnDisk: Cell_D_00001 0 -FabOnDisk: Cell_D_00002 0 -FabOnDisk: Cell_D_00003 0 -4,7 -1.1508066720086045e+00,2.9304939255617569e+02,2.5272927470640192e+02,0.0000000000000000e+00,2.9889831292387811e+02,2.9999999999999983e+02,9.8720587583530491e+04, -1.0999769859575013e+00,2.9312815840001815e+02,2.3942933114150043e+02,0.0000000000000000e+00,2.9354585669301952e+02,2.9999999999999989e+02,9.2670488078738548e+04, -1.0989702618831949e+00,2.4281464598114090e+02,1.3971517233403904e+02,0.0000000000000000e+00,2.9343836322209842e+02,2.9999999999999983e+02,9.2551770009631713e+04, -6.7267281853664840e-01,9.8985671404306828e+01,8.2922251084239434e+01,0.0000000000000000e+00,2.4112601395574711e+02,2.9999999999999983e+02,4.6551088728444331e+04, +2,7 +1.09998311200565024e+00,2.93049359375847871e+02,2.39429342203333533e+02,0.00000000000000000e+00,2.93546342981243754e+02,2.99999471208575528e+02,9.26711577028009197e+04, +6.72705062982049462e-01,9.89835916836365328e+01,8.29183612143245483e+01,0.00000000000000000e+00,2.41116530931248263e+02,2.99987464049565176e+02,4.65514892931960494e+04, -4,7 -1.1658895079646976e+00,3.3570958010749922e+02,2.9360350865676918e+02,0.0000000000000000e+00,3.0045917672032266e+02,3.0000000000000017e+02,1.0053673189075137e+05, -1.1654120069094225e+00,4.4005067884988495e+02,3.5146580220748069e+02,0.0000000000000000e+00,3.0040994831415992e+02,3.0000000000000017e+02,1.0047909053822359e+05, -1.1656645868467823e+00,3.5574961605285102e+02,2.9371771689681793e+02,0.0000000000000000e+00,3.0043598978020367e+02,3.0000000000000017e+02,1.0050957944959997e+05, -1.1631889438662057e+00,4.9220112212460123e+02,4.7707727843213706e+02,0.0000000000000000e+00,3.0018060013105736e+02,3.0000000000000017e+02,1.0021085875260815e+05, +2,7 +1.16588949797919716e+00,4.40051889512429284e+02,3.51466161252507618e+02,0.00000000000000000e+00,3.00459146875921590e+02,3.00000797593949358e+02,1.00536721043440295e+05, +1.16566457380817878e+00,4.92208769971793572e+02,4.77083602499372148e+02,0.00000000000000000e+00,3.00436213487944030e+02,3.00002718967787814e+02,1.00509653165814598e+05, diff --git a/Tests/test_files/ABL_MYNN_PBL/ABL_MYNN_PBL.i b/Tests/test_files/ABL_MYNN_PBL/ABL_MYNN_PBL.i index a652a0367..4435b73d3 100644 --- a/Tests/test_files/ABL_MYNN_PBL/ABL_MYNN_PBL.i +++ b/Tests/test_files/ABL_MYNN_PBL/ABL_MYNN_PBL.i @@ -45,7 +45,7 @@ erf.check_int = -1 # number of timesteps between checkpoints # PLOTFILES erf.plot_file_1 = plt # prefix of plotfile name erf.plot_int_1 = 300 # number of timesteps between plotfiles -erf.plot_vars_1 = density x_velocity y_velocity z_velocity pressure theta rhoQKE Kmv Khv +erf.plot_vars_1 = density x_velocity y_velocity z_velocity pressure theta rhoKE Kmv Khv # SOLVER CHOICE