diff --git a/Source/Diffusion/ComputeQKESourceTerm.H b/Source/Diffusion/ComputeQKESourceTerm.H index d828aaa15..447cb95d8 100644 --- a/Source/Diffusion/ComputeQKESourceTerm.H +++ b/Source/Diffusion/ComputeQKESourceTerm.H @@ -25,7 +25,6 @@ void ComputeEquilibriumQKE (amrex::Box bx_QKE, const amrex::Array4& uvel, const amrex::Array4& vvel, - const amrex::Array4& cell_data, const amrex::Array4& cell_prim, const amrex::Array4& tm_arr, const amrex::Array4& K_turb, @@ -57,14 +56,11 @@ ComputeQKESourceTerms (int i, int j, int k, const amrex::Array4& cell_prim, const amrex::Array4& K_turb, const amrex::GpuArray& cellSizeInv, - const amrex::Box& domain, amrex::Real pbl_B1_l, const amrex::Real theta_mean) { // Compute some relevant derivatives amrex::Real dz_inv = cellSizeInv[2]; - int izmin = domain.smallEnd(2); - int izmax = domain.bigEnd(2); amrex::Real source_term = 0.0; amrex::Real dthetadz = 0.5*(cell_prim(i,j,k+1,PrimTheta_comp) - cell_prim(i,j,k-1,PrimTheta_comp))*dz_inv; diff --git a/Source/Diffusion/ComputeQKESourceTerm.cpp b/Source/Diffusion/ComputeQKESourceTerm.cpp index 65973a32e..1695f7305 100644 --- a/Source/Diffusion/ComputeQKESourceTerm.cpp +++ b/Source/Diffusion/ComputeQKESourceTerm.cpp @@ -4,7 +4,6 @@ void ComputeEquilibriumQKE (amrex::Box bx_QKE, const amrex::Array4& uvel, const amrex::Array4& vvel, - const amrex::Array4& cell_data, const amrex::Array4& cell_prim, const amrex::Array4& tm_arr, const amrex::Array4& K_turb, diff --git a/Source/Diffusion/ComputeTurbulentViscosity.cpp b/Source/Diffusion/ComputeTurbulentViscosity.cpp index 398843415..5d7bd5edf 100644 --- a/Source/Diffusion/ComputeTurbulentViscosity.cpp +++ b/Source/Diffusion/ComputeTurbulentViscosity.cpp @@ -11,7 +11,6 @@ void ComputeTurbulentViscosityPBL (const amrex::MultiFab& xvel, const amrex::MultiFab& yvel, const amrex::MultiFab& cons_in, - const amrex::MultiFab& cons_old, amrex::MultiFab& eddyViscosity, amrex::MultiFab* QKE_equil, const amrex::Geometry& geom, @@ -369,7 +368,6 @@ void ComputeTurbulentViscosity (const amrex::MultiFab& xvel , const amrex::Multi const amrex::MultiFab& Tau11, const amrex::MultiFab& Tau22, const amrex::MultiFab& Tau33, const amrex::MultiFab& Tau12, const amrex::MultiFab& Tau13, const amrex::MultiFab& Tau23, const amrex::MultiFab& cons_in, - const amrex::MultiFab& cons_old, amrex::MultiFab& eddyViscosity, amrex::MultiFab& Hfx1, amrex::MultiFab& Hfx2, amrex::MultiFab& Hfx3, amrex::MultiFab& Diss, amrex::MultiFab* QKE_equil, @@ -377,7 +375,6 @@ void ComputeTurbulentViscosity (const amrex::MultiFab& xvel , const amrex::Multi const amrex::MultiFab& mapfac_u, const amrex::MultiFab& mapfac_v, const TurbChoice& turbChoice, const Real const_grav, std::unique_ptr& most, - const amrex::BCRec* bc_ptr, bool vert_only) { BL_PROFILE_VAR("ComputeTurbulentViscosity()",ComputeTurbulentViscosity); @@ -412,8 +409,7 @@ void ComputeTurbulentViscosity (const amrex::MultiFab& xvel , const amrex::Multi } if (turbChoice.pbl_type != PBLType::None) { - // NOTE: state_new is passed in for Cons_old (due to ptr swap in advance) - ComputeTurbulentViscosityPBL(xvel, yvel, cons_in, cons_old, eddyViscosity, - QKE_equil, geom, turbChoice, most, vert_only); + ComputeTurbulentViscosityPBL(xvel, yvel, cons_in, eddyViscosity, QKE_equil, + geom, turbChoice, most, vert_only); } } diff --git a/Source/Diffusion/DiffusionSrcForState_N.cpp b/Source/Diffusion/DiffusionSrcForState_N.cpp index 491ce0dfc..4880a1d9c 100644 --- a/Source/Diffusion/DiffusionSrcForState_N.cpp +++ b/Source/Diffusion/DiffusionSrcForState_N.cpp @@ -407,7 +407,7 @@ DiffusionSrcForState_N (const amrex::Box& bx, const amrex::Box& domain, amrex::ParallelFor(bx,[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { cell_rhs(i, j, k, qty_index) += ComputeQKESourceTerms(i,j,k,u,v,cell_data,cell_prim, - mu_turb,cellSizeInv,domain, + mu_turb,cellSizeInv, pbl_B1_l,tm_arr(i,j,0)); }); } diff --git a/Source/Diffusion/DiffusionSrcForState_T.cpp b/Source/Diffusion/DiffusionSrcForState_T.cpp index 2f7b7b3d2..0bb551235 100644 --- a/Source/Diffusion/DiffusionSrcForState_T.cpp +++ b/Source/Diffusion/DiffusionSrcForState_T.cpp @@ -586,7 +586,7 @@ DiffusionSrcForState_T (const amrex::Box& bx, const amrex::Box& domain, amrex::ParallelFor(bx,[=] AMREX_GPU_DEVICE (int i, int j, int k) noexcept { cell_rhs(i, j, k, qty_index) += ComputeQKESourceTerms(i,j,k,u,v,cell_data,cell_prim, - mu_turb,dxInv,domain,pbl_B1_l,tm_arr(i,j,0)); + mu_turb,dxInv,pbl_B1_l,tm_arr(i,j,0)); }); } } diff --git a/Source/Diffusion/EddyViscosity.H b/Source/Diffusion/EddyViscosity.H index fb3e69401..4a0d75b19 100644 --- a/Source/Diffusion/EddyViscosity.H +++ b/Source/Diffusion/EddyViscosity.H @@ -12,7 +12,6 @@ ComputeTurbulentViscosity (const amrex::MultiFab& xvel , const amrex::MultiFab& const amrex::MultiFab& Tau11, const amrex::MultiFab& Tau22, const amrex::MultiFab& Tau33, const amrex::MultiFab& Tau12, const amrex::MultiFab& Tau13, const amrex::MultiFab& Tau23, const amrex::MultiFab& cons_in, - const amrex::MultiFab& cons_old, amrex::MultiFab& eddyViscosity, amrex::MultiFab& Hfx1, amrex::MultiFab& Hfx2, @@ -23,7 +22,6 @@ ComputeTurbulentViscosity (const amrex::MultiFab& xvel , const amrex::MultiFab& const amrex::MultiFab& mapfac_u, const amrex::MultiFab& mapfac_v, const TurbChoice& turbChoice, const amrex::Real const_grav, std::unique_ptr& most, - const amrex::BCRec* bc_ptr, bool vert_only = false); AMREX_GPU_DEVICE diff --git a/Source/Diffusion/PBLModels.cpp b/Source/Diffusion/PBLModels.cpp index c3a680c33..f1f32c2fd 100644 --- a/Source/Diffusion/PBLModels.cpp +++ b/Source/Diffusion/PBLModels.cpp @@ -19,7 +19,6 @@ void ComputeTurbulentViscosityPBL (const amrex::MultiFab& xvel, const amrex::MultiFab& yvel, const amrex::MultiFab& cons_in, - const amrex::MultiFab& cons_old, amrex::MultiFab& eddyViscosity, amrex::MultiFab* QKE_equil, const amrex::Geometry& geom, @@ -32,7 +31,7 @@ ComputeTurbulentViscosityPBL (const amrex::MultiFab& xvel, const amrex::Real A1 = turbChoice.pbl_A1; const amrex::Real A2 = turbChoice.pbl_A2; - const amrex::Real B1 = turbChoice.pbl_B1; + //const amrex::Real B1 = turbChoice.pbl_B1; const amrex::Real B2 = turbChoice.pbl_B2; const amrex::Real C1 = turbChoice.pbl_C1; const amrex::Real C2 = turbChoice.pbl_C2; @@ -50,7 +49,6 @@ ComputeTurbulentViscosityPBL (const amrex::MultiFab& xvel, const amrex::Box &bx = mfi.growntilebox(1); const amrex::Array4 &cell_data = cons_in.array(mfi); - const amrex::Array4 &cell_data_old = cons_old.array(mfi); const amrex::Array4 &K_turb = eddyViscosity.array(mfi); const amrex::Array4 &uvel = xvel.array(mfi); const amrex::Array4 &vvel = yvel.array(mfi); @@ -69,18 +67,15 @@ ComputeTurbulentViscosityPBL (const amrex::MultiFab& xvel, const amrex::Box xybx = PerpendicularBox(bx, amrex::IntVect{0,0,0}); amrex::FArrayBox qintegral(xybx,2); qintegral.setVal(0.0); - amrex::FArrayBox qturb(bx,1); amrex::FArrayBox qturb_old(bx,1); + amrex::FArrayBox qturb(bx,1); const amrex::Array4 qint = qintegral.array(); const amrex::Array4 qvel = qturb.array(); - const amrex::Array4 qvel_old = qturb_old.array(); amrex::ParallelFor(amrex::Gpu::KernelInfo().setReduction(true), bx, [=] AMREX_GPU_DEVICE (int i, int j, int k, amrex::Gpu::Handler const& handler) noexcept { qvel(i,j,k) = std::sqrt(cell_data(i,j,k,RhoQKE_comp) / cell_data(i,j,k,Rho_comp)); - qvel_old(i,j,k) = std::sqrt(cell_data(i,j,k,RhoQKE_comp) / cell_data(i,j,k,Rho_comp) + eps); AMREX_ASSERT_WITH_MESSAGE(qvel(i,j,k) > 0.0, "QKE must have a positive value"); - AMREX_ASSERT_WITH_MESSAGE(qvel_old(i,j,k) > 0.0, "Old QKE must have a positive value"); const amrex::Real Zval = gdata.ProbLo(2) + (k + 0.5)*gdata.CellSize(2); if (sbx.contains(i,j,k)) { diff --git a/Source/TimeIntegration/ERF_advance_dycore.cpp b/Source/TimeIntegration/ERF_advance_dycore.cpp index 0ec8859e6..9afef56cd 100644 --- a/Source/TimeIntegration/ERF_advance_dycore.cpp +++ b/Source/TimeIntegration/ERF_advance_dycore.cpp @@ -217,15 +217,14 @@ void ERF::advance_dycore(int level, // ************************************************************************* if (l_use_kturb) { - // NOTE: state_new transfers to state_old for PBL (due to ptr swap in advance) const amrex::BCRec* bc_ptr_d = domain_bcs_type_d.data(); ComputeTurbulentViscosity(xvel_old, yvel_old, *Tau11, *Tau22, *Tau33, *Tau12, *Tau13, *Tau23, - state_old[IntVar::cons],state_new[IntVar::cons], + state_old[IntVar::cons], *eddyDiffs, *Hfx1, *Hfx2, *Hfx3, *Diss, QKE_equil, // to be updated fine_geom, *mapfac_u[level], *mapfac_v[level], - tc, solverChoice.gravity, m_most, bc_ptr_d); + tc, solverChoice.gravity, m_most); } // *********************************************************************************************** diff --git a/Source/TimeIntegration/ERF_slow_rhs_post.cpp b/Source/TimeIntegration/ERF_slow_rhs_post.cpp index a50444481..433696764 100644 --- a/Source/TimeIntegration/ERF_slow_rhs_post.cpp +++ b/Source/TimeIntegration/ERF_slow_rhs_post.cpp @@ -366,7 +366,7 @@ void erf_slow_rhs_post (int level, mu_turb, dc, tc, tm_arr, grav_gpu, bc_ptr); } if (l_use_mynn) { - ComputeEquilibriumQKE(gbx_QKE, u, v, cur_cons, cur_prim, + ComputeEquilibriumQKE(gbx_QKE, u, v, cur_prim, tm_arr, mu_turb, QKE_equil_arr, dxInv, domain, tc.pbl_B1); }