From da8509fed40eb7508ae7b70f2b0f7996f161aef9 Mon Sep 17 00:00:00 2001 From: Jon Rood Date: Wed, 1 Jun 2022 19:18:49 -0600 Subject: [PATCH] Fix and suppress some warnings (#627) --- .github/workflows/ci.yml | 4 +-- amr-wind/core/SimTime.H | 2 +- amr-wind/equation_systems/AdvOp_Godunov.H | 2 +- amr-wind/equation_systems/AdvOp_MOL.H | 2 +- .../equation_systems/icns/icns_advection.H | 7 ++--- .../equation_systems/icns/icns_diffusion.H | 2 +- amr-wind/equation_systems/vof/vof_advection.H | 1 + .../bluff_body/bluff_body_ops.cpp | 2 ++ amr-wind/main.cpp | 1 + amr-wind/physics/SyntheticTurbulence.cpp | 2 +- amr-wind/physics/multiphase/MultiPhase.H | 5 +++- amr-wind/physics/multiphase/MultiPhase.cpp | 16 +++++------ .../incflo_apply_nodal_projection.cpp | 6 ++--- amr-wind/turbulence/LES/OneEqKsgs.cpp | 3 ++- amr-wind/turbulence/LES/Smagorinsky.cpp | 2 +- amr-wind/turbulence/RANS/KOmegaSST.cpp | 2 ++ amr-wind/turbulence/RANS/KOmegaSSTIDDES.cpp | 1 + amr-wind/utilities/FieldPlaneAveraging.H | 8 +++--- amr-wind/utilities/FieldPlaneAveraging.cpp | 14 +++++----- amr-wind/utilities/SecondMomentAveraging.H | 4 +-- amr-wind/utilities/SecondMomentAveraging.cpp | 2 +- amr-wind/utilities/ThirdMomentAveraging.H | 4 +-- amr-wind/utilities/ThirdMomentAveraging.cpp | 2 +- amr-wind/utilities/io.cpp | 4 +-- amr-wind/wind_energy/ABLBoundaryPlane.cpp | 4 +-- amr-wind/wind_energy/ABLWallFunction.cpp | 2 +- amr-wind/wind_energy/ShearStress.H | 6 ++--- amr-wind/wind_energy/actuator/ActuatorModel.H | 12 ++++----- docker/Dockerfile | 27 ------------------- docs/sphinx/conf.py | 2 +- unit_tests/core/test_field.cpp | 14 +++++----- unit_tests/multiphase/test_vof_cons.cpp | 2 +- .../actuator/test_disk_uniform_ct.cpp | 9 +------ 33 files changed, 77 insertions(+), 99 deletions(-) delete mode 100644 docker/Dockerfile diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 75a9048c80..dea2830a27 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,12 +13,12 @@ jobs: - name: Clone uses: actions/checkout@v3 - name: Check formatting - uses: DoozyX/clang-format-lint-action@v0.11 + uses: DoozyX/clang-format-lint-action@v0.13 with: source: './amr-wind ./unit_tests ./tools/utilities' exclude: '.' extensions: 'H,h,cpp' - clangFormatVersion: 11 + clangFormatVersion: 13 CPU: needs: Formatting runs-on: ${{matrix.os}} diff --git a/amr-wind/core/SimTime.H b/amr-wind/core/SimTime.H index 44cbb8694e..dd2ebc43a5 100644 --- a/amr-wind/core/SimTime.H +++ b/amr-wind/core/SimTime.H @@ -126,7 +126,7 @@ public: private: //! Timestep sizes - amrex::Real m_dt[max_time_states]; + amrex::Real m_dt[max_time_states]{0.0}; //! Current simulation time amrex::Real m_cur_time{0.0}; diff --git a/amr-wind/equation_systems/AdvOp_Godunov.H b/amr-wind/equation_systems/AdvOp_Godunov.H index 08c9a30756..f4ab5e20e3 100644 --- a/amr-wind/equation_systems/AdvOp_Godunov.H +++ b/amr-wind/equation_systems/AdvOp_Godunov.H @@ -79,7 +79,7 @@ struct AdvectionOp< const auto& src_term = fields.src_term; // cppcheck-suppress constVariable auto& conv_term = fields.conv_term; - auto& dof_field = fields.field.state(fstate); + const auto& dof_field = fields.field.state(fstate); auto flux_x = repo.create_scratch_field(PDE::ndim, 0, amr_wind::FieldLoc::XFACE); diff --git a/amr-wind/equation_systems/AdvOp_MOL.H b/amr-wind/equation_systems/AdvOp_MOL.H index 0e63dd9b22..c1ddabdd5c 100644 --- a/amr-wind/equation_systems/AdvOp_MOL.H +++ b/amr-wind/equation_systems/AdvOp_MOL.H @@ -43,7 +43,7 @@ struct AdvectionOp< static_assert( PDE::ndim == 1, "Invalid number of components for scalar"); - auto& repo = fields.repo; + const auto& repo = fields.repo; const auto& geom = repo.mesh().Geom(); // cppcheck-suppress constVariable diff --git a/amr-wind/equation_systems/icns/icns_advection.H b/amr-wind/equation_systems/icns/icns_advection.H index bde8f9b1ee..40e068267e 100644 --- a/amr-wind/equation_systems/icns/icns_advection.H +++ b/amr-wind/equation_systems/icns/icns_advection.H @@ -102,7 +102,7 @@ struct AdvectionOp void preadvect(const FieldState fstate, const amrex::Real dt) { - auto& repo = fields.repo; + const auto& repo = fields.repo; const auto& geom = repo.mesh().Geom(); const auto& src_term = fields.src_term; @@ -262,7 +262,7 @@ struct AdvectionOp const auto& src_term = fields.src_term; // cppcheck-suppress constVariable auto& conv_term = fields.conv_term; - auto& dof_field = fields.field.state(fstate); + const auto& dof_field = fields.field.state(fstate); auto flux_x = repo.create_scratch_field(ICNS::ndim, 0, amr_wind::FieldLoc::XFACE); @@ -375,6 +375,7 @@ struct AdvectionOp void preadvect(const FieldState fstate, const amrex::Real dt) { + // cppcheck-suppress constVariable auto& repo = fields.repo; auto& dof_field = fields.field.state(fstate); @@ -406,7 +407,7 @@ struct AdvectionOp void operator()(const FieldState fstate, const amrex::Real /*unused*/) { - auto& repo = fields.repo; + const auto& repo = fields.repo; const auto& geom = repo.mesh().Geom(); // cppcheck-suppress constVariable auto& conv_term = fields.conv_term.state(fstate); diff --git a/amr-wind/equation_systems/icns/icns_diffusion.H b/amr-wind/equation_systems/icns/icns_diffusion.H index ab59e8dc70..64fd267e4f 100644 --- a/amr-wind/equation_systems/icns/icns_diffusion.H +++ b/amr-wind/equation_systems/icns/icns_diffusion.H @@ -203,7 +203,7 @@ public: const FieldState fstate = FieldState::New; auto& repo = m_pdefields.repo; const auto& geom = repo.mesh().Geom(); - auto& field = m_pdefields.field; + const auto& field = m_pdefields.field; const auto& density = m_density.state(fstate); const int nlevels = repo.num_active_levels(); const int ndim = field.num_comp(); diff --git a/amr-wind/equation_systems/vof/vof_advection.H b/amr-wind/equation_systems/vof/vof_advection.H index d8bfdf8d07..91d3280ff2 100644 --- a/amr-wind/equation_systems/vof/vof_advection.H +++ b/amr-wind/equation_systems/vof/vof_advection.H @@ -36,6 +36,7 @@ struct AdvectionOp auto& repo = fields.repo; const auto& geom = repo.mesh().Geom(); + // cppcheck-suppress constVariable auto& dof_field = fields.field; // // Advect volume using either the Explicit Lagrangian onto-cell or diff --git a/amr-wind/immersed_boundary/bluff_body/bluff_body_ops.cpp b/amr-wind/immersed_boundary/bluff_body/bluff_body_ops.cpp index f812b72645..45dd13a346 100644 --- a/amr-wind/immersed_boundary/bluff_body/bluff_body_ops.cpp +++ b/amr-wind/immersed_boundary/bluff_body/bluff_body_ops.cpp @@ -33,6 +33,7 @@ void apply_mms_vel(CFDSim& sim) const int nlevels = sim.repo().num_active_levels(); const auto& levelset = sim.repo().get_field("ib_levelset"); + // cppcheck-suppress constVariable auto& velocity = sim.repo().get_field("velocity"); auto& m_conv_taylor_green = sim.physics_manager().get(); @@ -78,6 +79,7 @@ void apply_dirichlet_vel(CFDSim& sim, const amrex::Vector& vel_bc) { const int nlevels = sim.repo().num_active_levels(); auto& geom = sim.mesh().Geom(); + // cppcheck-suppress constVariable auto& velocity = sim.repo().get_field("velocity"); auto& levelset = sim.repo().get_field("ib_levelset"); levelset.fillpatch(sim.time().current_time()); diff --git a/amr-wind/main.cpp b/amr-wind/main.cpp index 73279ddf3a..c4f1855e55 100644 --- a/amr-wind/main.cpp +++ b/amr-wind/main.cpp @@ -17,6 +17,7 @@ int main(int argc, char* argv[]) return 1; } + // cppcheck-suppress knownConditionTrueFalse if (argc >= 2) { // Look for "-h" or "--help" flag and print usage for (auto i = 1; i < argc; i++) { diff --git a/amr-wind/physics/SyntheticTurbulence.cpp b/amr-wind/physics/SyntheticTurbulence.cpp index 84f4807f58..d155525597 100644 --- a/amr-wind/physics/SyntheticTurbulence.cpp +++ b/amr-wind/physics/SyntheticTurbulence.cpp @@ -546,7 +546,7 @@ void SyntheticTurbulence::update_impl( const InterpWeights& weights, const T& velfunc) { - auto& repo = m_turb_force.repo(); + const auto& repo = m_turb_force.repo(); const auto& geom_vec = repo.mesh().Geom(); const int sdir = (*m_wind_profile).shear_dir(); diff --git a/amr-wind/physics/multiphase/MultiPhase.H b/amr-wind/physics/multiphase/MultiPhase.H index a76e4dc251..020653c096 100644 --- a/amr-wind/physics/multiphase/MultiPhase.H +++ b/amr-wind/physics/multiphase/MultiPhase.H @@ -91,7 +91,10 @@ private: // sum of volume fractions (for vof only) amrex::Real m_total_volfrac{0.0}; - amrex::Real q0, q1, q2, sumvof0; + amrex::Real q0{0.0}; + amrex::Real q1{0.0}; + amrex::Real q2{0.0}; + amrex::Real sumvof0{0.0}; }; } // namespace amr_wind diff --git a/amr-wind/physics/multiphase/MultiPhase.cpp b/amr-wind/physics/multiphase/MultiPhase.cpp index f396a67b84..64f62493d1 100644 --- a/amr-wind/physics/multiphase/MultiPhase.cpp +++ b/amr-wind/physics/multiphase/MultiPhase.cpp @@ -240,8 +240,8 @@ void MultiPhase::set_density_via_levelset() const amrex::Array4& phi = levelset.array(mfi); const amrex::Array4& rho = density.array(mfi); const amrex::Real eps = std::cbrt(2. * dx[0] * dx[1] * dx[2]); - const amrex::Real rho1 = m_rho1; - const amrex::Real rho2 = m_rho2; + const amrex::Real captured_rho1 = m_rho1; + const amrex::Real captured_rho2 = m_rho2; amrex::ParallelFor( vbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { amrex::Real smooth_heaviside; @@ -255,8 +255,8 @@ void MultiPhase::set_density_via_levelset() (1.0 + phi(i, j, k) / eps + 1.0 / M_PI * std::sin(phi(i, j, k) * M_PI / eps)); } - rho(i, j, k) = rho1 * smooth_heaviside + - rho2 * (1.0 - smooth_heaviside); + rho(i, j, k) = captured_rho1 * smooth_heaviside + + captured_rho2 * (1.0 - smooth_heaviside); }); } } @@ -275,12 +275,12 @@ void MultiPhase::set_density_via_vof() const auto& vbx = mfi.validbox(); const amrex::Array4& F = vof.array(mfi); const amrex::Array4& rho = density.array(mfi); - const amrex::Real rho1 = m_rho1; - const amrex::Real rho2 = m_rho2; + const amrex::Real captured_rho1 = m_rho1; + const amrex::Real captured_rho2 = m_rho2; amrex::ParallelFor( vbx, [=] AMREX_GPU_DEVICE(int i, int j, int k) noexcept { - rho(i, j, k) = - rho1 * F(i, j, k) + rho2 * (1.0 - F(i, j, k)); + rho(i, j, k) = captured_rho1 * F(i, j, k) + + captured_rho2 * (1.0 - F(i, j, k)); }); } } diff --git a/amr-wind/projection/incflo_apply_nodal_projection.cpp b/amr-wind/projection/incflo_apply_nodal_projection.cpp index d4712d9ded..bc3fd2c78c 100644 --- a/amr-wind/projection/incflo_apply_nodal_projection.cpp +++ b/amr-wind/projection/incflo_apply_nodal_projection.cpp @@ -11,15 +11,15 @@ using namespace amrex; void incflo::set_inflow_velocity( int lev, amrex::Real time, MultiFab& vel, int nghost) { - auto& velocity = icns().fields().field; - velocity.set_inflow(lev, time, vel, nghost); + auto& lvelocity = icns().fields().field; + lvelocity.set_inflow(lev, time, vel, nghost); // TODO fix hack for ABL auto& phy_mgr = m_sim.physics_manager(); if (phy_mgr.contains("ABL")) { auto& abl = phy_mgr.get(); const auto& bndry_plane = abl.bndry_plane(); - bndry_plane.populate_data(lev, time, velocity, vel); + bndry_plane.populate_data(lev, time, lvelocity, vel); } } diff --git a/amr-wind/turbulence/LES/OneEqKsgs.cpp b/amr-wind/turbulence/LES/OneEqKsgs.cpp index 94bd2fb8f7..b82fa3e5b9 100644 --- a/amr-wind/turbulence/LES/OneEqKsgs.cpp +++ b/amr-wind/turbulence/LES/OneEqKsgs.cpp @@ -104,7 +104,7 @@ void OneEqKsgsM84::update_turbulent_viscosity( auto& mu_turb = this->mu_turb(); const amrex::Real Ce = this->m_Ce; const auto& den = this->m_rho.state(fstate); - auto& repo = mu_turb.repo(); + const auto& repo = mu_turb.repo(); const auto& geom_vec = repo.mesh().Geom(); const int nlevels = repo.num_active_levels(); @@ -231,6 +231,7 @@ void OneEqKsgsM84::post_advance_work() // Update sdr field based on sfs ke auto& tke = *(this->m_tke); + // cppcheck-suppress constVariable auto& sdr = *(this->m_sdr); const amrex::Real Ce = this->m_Ce; diff --git a/amr-wind/turbulence/LES/Smagorinsky.cpp b/amr-wind/turbulence/LES/Smagorinsky.cpp index 6a6ec34ea1..84b58cdaa1 100644 --- a/amr-wind/turbulence/LES/Smagorinsky.cpp +++ b/amr-wind/turbulence/LES/Smagorinsky.cpp @@ -24,7 +24,7 @@ void Smagorinsky::update_turbulent_viscosity(const FieldState fstate) "amr-wind::" + this->identifier() + "::update_turbulent_viscosity"); auto& mu_turb = this->mu_turb(); - auto& repo = mu_turb.repo(); + const auto& repo = mu_turb.repo(); const auto& vel = m_vel.state(fstate); const auto& den = m_rho.state(fstate); const auto& geom_vec = repo.mesh().Geom(); diff --git a/amr-wind/turbulence/RANS/KOmegaSST.cpp b/amr-wind/turbulence/RANS/KOmegaSST.cpp index 3d0d5fd23f..8c7974b478 100644 --- a/amr-wind/turbulence/RANS/KOmegaSST.cpp +++ b/amr-wind/turbulence/RANS/KOmegaSST.cpp @@ -64,6 +64,7 @@ void KOmegaSST::update_turbulent_viscosity(const FieldState fstate) const auto& den = this->m_rho.state(fstate); const auto& tke = (*this->m_tke).state(fstate); const auto& sdr = (*this->m_sdr).state(fstate); + // cppcheck-suppress constVariable auto& repo = mu_turb.repo(); const int nlevels = repo.num_active_levels(); @@ -80,6 +81,7 @@ void KOmegaSST::update_turbulent_viscosity(const FieldState fstate) auto& tke_lhs = (this->m_sim).repo().get_field("tke_lhs_src_term"); tke_lhs.setVal(0.0); + // cppcheck-suppress constVariable auto& sdr_lhs = (this->m_sim).repo().get_field("sdr_lhs_src_term"); const amrex::Real deltaT = (this->m_sim).time().deltaT(); diff --git a/amr-wind/turbulence/RANS/KOmegaSSTIDDES.cpp b/amr-wind/turbulence/RANS/KOmegaSSTIDDES.cpp index a8f39cb0bc..9b8180ce16 100644 --- a/amr-wind/turbulence/RANS/KOmegaSSTIDDES.cpp +++ b/amr-wind/turbulence/RANS/KOmegaSSTIDDES.cpp @@ -88,6 +88,7 @@ void KOmegaSSTIDDES::update_turbulent_viscosity( const auto& geom_vec = repo.mesh().Geom(); auto& tke_lhs = (this->m_sim).repo().get_field("tke_lhs_src_term"); tke_lhs.setVal(0.0); + // cppcheck-suppress constVariable auto& sdr_lhs = (this->m_sim).repo().get_field("sdr_lhs_src_term"); auto gradK = (this->m_sim.repo()).create_scratch_field(3, 0); diff --git a/amr-wind/utilities/FieldPlaneAveraging.H b/amr-wind/utilities/FieldPlaneAveraging.H index d8c923c9a5..d59ceb8626 100644 --- a/amr-wind/utilities/FieldPlaneAveraging.H +++ b/amr-wind/utilities/FieldPlaneAveraging.H @@ -58,8 +58,8 @@ public: */ amrex::Real line_derivative_of_average_cell(int ind, int comp) const; - void - output_line_average_ascii(std::string filename, int step, amrex::Real time); + void output_line_average_ascii( + const std::string& filename, int step, amrex::Real time); void output_line_average_ascii(int step, amrex::Real time); /** change precision of text file output */ @@ -179,8 +179,8 @@ public: // public for GPU velocity magnitude */ amrex::Real line_hvelmag_derivative_of_average_cell(int ind) const; - void - output_line_average_ascii(std::string filename, int step, amrex::Real time); + void output_line_average_ascii( + const std::string& filename, int step, amrex::Real time); void output_line_average_ascii(int step, amrex::Real time); }; diff --git a/amr-wind/utilities/FieldPlaneAveraging.cpp b/amr-wind/utilities/FieldPlaneAveraging.cpp index e3fc0609ef..a701d7e2ed 100644 --- a/amr-wind/utilities/FieldPlaneAveraging.cpp +++ b/amr-wind/utilities/FieldPlaneAveraging.cpp @@ -52,7 +52,7 @@ FPlaneAveraging::FPlaneAveraging( template void FPlaneAveraging::output_line_average_ascii( - std::string filename, int step, amrex::Real time) + const std::string& filename, int step, amrex::Real time) { BL_PROFILE("amr-wind::FPlaneAveraging::output_line_average_ascii"); @@ -97,7 +97,7 @@ template void FPlaneAveraging::output_line_average_ascii( int step, amrex::Real time) { - std::string filename = "plane_average_" + m_field.name() + ".txt"; + const std::string filename = "plane_average_" + m_field.name() + ".txt"; output_line_average_ascii(filename, step, time); } @@ -265,7 +265,7 @@ void FPlaneAveraging::compute_averages( m_line_average.data(), m_line_average.size()); amrex::Real* line_avg = lavg.data(); - const int ncomp = m_ncomp; + const int captured_ncomp = m_ncomp; #ifdef _OPENMP #pragma omp parallel if (amrex::Gpu::notInLaunchRegion()) @@ -296,9 +296,9 @@ void FPlaneAveraging::compute_averages( const int ind = idxOp(i, j, k); - for (int n = 0; n < ncomp; ++n) { + for (int n = 0; n < captured_ncomp; ++n) { amrex::Gpu::deviceReduceSum( - &line_avg[ncomp * ind + n], + &line_avg[captured_ncomp * ind + n], fab_arr(i, j, k, n) * denom, handler); } } @@ -491,7 +491,7 @@ amrex::Real VelPlaneAveraging::line_hvelmag_average_cell(int ind) const } void VelPlaneAveraging::output_line_average_ascii( - std::string filename, int step, amrex::Real time) + const std::string& filename, int step, amrex::Real time) { BL_PROFILE("amr-wind::VelPlaneAveraging::output_line_average_ascii"); @@ -536,7 +536,7 @@ void VelPlaneAveraging::output_line_average_ascii( void VelPlaneAveraging::output_line_average_ascii(int step, amrex::Real time) { - std::string filename = "plane_average_" + m_field.name() + ".txt"; + const std::string filename = "plane_average_" + m_field.name() + ".txt"; output_line_average_ascii(filename, step, time); } diff --git a/amr-wind/utilities/SecondMomentAveraging.H b/amr-wind/utilities/SecondMomentAveraging.H index 4ebf2cddd0..e09d21643c 100644 --- a/amr-wind/utilities/SecondMomentAveraging.H +++ b/amr-wind/utilities/SecondMomentAveraging.H @@ -47,8 +47,8 @@ public: }; void line_moment(int comp, amrex::Vector& l_vec); - void - output_line_average_ascii(std::string filename, int step, amrex::Real time); + void output_line_average_ascii( + const std::string& filename, int step, amrex::Real time); void output_line_average_ascii(int step, amrex::Real time); /** change precision of text file output */ diff --git a/amr-wind/utilities/SecondMomentAveraging.cpp b/amr-wind/utilities/SecondMomentAveraging.cpp index 3f5c5a05a2..10a143fa2d 100644 --- a/amr-wind/utilities/SecondMomentAveraging.cpp +++ b/amr-wind/utilities/SecondMomentAveraging.cpp @@ -3,7 +3,7 @@ namespace amr_wind { void SecondMomentAveraging::output_line_average_ascii( - std::string filename, int step, amrex::Real time) + const std::string& filename, int step, amrex::Real time) { BL_PROFILE("amr-wind::SecondMomentAveraging::output_line_average_ascii"); diff --git a/amr-wind/utilities/ThirdMomentAveraging.H b/amr-wind/utilities/ThirdMomentAveraging.H index 61b8802057..73025d1b95 100644 --- a/amr-wind/utilities/ThirdMomentAveraging.H +++ b/amr-wind/utilities/ThirdMomentAveraging.H @@ -41,8 +41,8 @@ public: }; void line_moment(int comp, amrex::Vector& l_vec); - void - output_line_average_ascii(std::string filename, int step, amrex::Real time); + void output_line_average_ascii( + const std::string& filename, int step, amrex::Real time); void output_line_average_ascii(int step, amrex::Real time); /** change precision of text file output */ diff --git a/amr-wind/utilities/ThirdMomentAveraging.cpp b/amr-wind/utilities/ThirdMomentAveraging.cpp index eed035dbfc..5e2a39bf5a 100644 --- a/amr-wind/utilities/ThirdMomentAveraging.cpp +++ b/amr-wind/utilities/ThirdMomentAveraging.cpp @@ -3,7 +3,7 @@ namespace amr_wind { void ThirdMomentAveraging::output_line_average_ascii( - std::string filename, int step, amrex::Real time) + const std::string& filename, int step, amrex::Real time) { BL_PROFILE("amr-wind::ThirdMomentAveraging::output_line_average_ascii"); diff --git a/amr-wind/utilities/io.cpp b/amr-wind/utilities/io.cpp index 76f01b8256..e168deb671 100644 --- a/amr-wind/utilities/io.cpp +++ b/amr-wind/utilities/io.cpp @@ -25,8 +25,8 @@ void incflo::ReadCheckpointFile() amrex::Print() << "Restarting from checkpoint " << restart_file << std::endl; - Real prob_lo[AMREX_SPACEDIM]; - Real prob_hi[AMREX_SPACEDIM]; + Real prob_lo[AMREX_SPACEDIM] = {0.0}; + Real prob_hi[AMREX_SPACEDIM] = {0.0}; /*************************************************************************** * Load header: set up problem domain (including BoxArray) * diff --git a/amr-wind/wind_energy/ABLBoundaryPlane.cpp b/amr-wind/wind_energy/ABLBoundaryPlane.cpp index ad32d8ef95..caf51c7ee8 100644 --- a/amr-wind/wind_energy/ABLBoundaryPlane.cpp +++ b/amr-wind/wind_energy/ABLBoundaryPlane.cpp @@ -236,8 +236,8 @@ void InletData::interpolate(const amrex::Real time) continue; } - const int nlevels = m_data_n[ori]->size(); - for (int lev = 0; lev < nlevels; ++lev) { + const int lnlevels = m_data_n[ori]->size(); + for (int lev = 0; lev < lnlevels; ++lev) { const auto& datn = (*m_data_n[ori])[lev]; const auto& datnp1 = (*m_data_np1[ori])[lev]; diff --git a/amr-wind/wind_energy/ABLWallFunction.cpp b/amr-wind/wind_energy/ABLWallFunction.cpp index 9f06ba211a..f57ce7f107 100644 --- a/amr-wind/wind_energy/ABLWallFunction.cpp +++ b/amr-wind/wind_energy/ABLWallFunction.cpp @@ -153,7 +153,7 @@ void ABLVelWallFunc::wall_model( BL_PROFILE("amr-wind::ABLVelWallFunc"); constexpr int idim = 2; - auto& repo = velocity.repo(); + const auto& repo = velocity.repo(); const auto& density = repo.get_field("density", rho_state); const auto& viscosity = repo.get_field("velocity_mueff"); const int nlevels = repo.num_active_levels(); diff --git a/amr-wind/wind_energy/ShearStress.H b/amr-wind/wind_energy/ShearStress.H index df6949f21d..0b59bbe747 100644 --- a/amr-wind/wind_energy/ShearStress.H +++ b/amr-wind/wind_energy/ShearStress.H @@ -27,19 +27,19 @@ struct ShearStressConstant {} AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real - calc_vel_x(amrex::Real /* u */, amrex::Real /* wspd */) const + calc_vel_x(amrex::Real /* u */, amrex::Real /* wspd */) const { return u_mean / wspd_mean * utau2; }; AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real - calc_vel_y(amrex::Real /* u */, amrex::Real /* wspd */) const + calc_vel_y(amrex::Real /* u */, amrex::Real /* wspd */) const { return v_mean / wspd_mean * utau2; }; AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::Real - calc_theta(amrex::Real /* wspd */, amrex::Real /* theta */) const + calc_theta(amrex::Real /* wspd */, amrex::Real /* theta */) const { return term1 * (theta_mean - theta_surface); }; diff --git a/amr-wind/wind_energy/actuator/ActuatorModel.H b/amr-wind/wind_energy/actuator/ActuatorModel.H index 0435cb58c6..1d34448ea0 100644 --- a/amr-wind/wind_energy/actuator/ActuatorModel.H +++ b/amr-wind/wind_energy/actuator/ActuatorModel.H @@ -179,20 +179,20 @@ void ActModel::determine_root_proc( ops::determine_root_proc(m_data, act_proc_count); { // Sanity checks - const auto& info = m_data.info(); - const auto& plist = info.procs; - AMREX_ALWAYS_ASSERT(info.root_proc > -1); - AMREX_ALWAYS_ASSERT(plist.find(info.root_proc) != plist.end()); + const auto& linfo = m_data.info(); + const auto& plist = linfo.procs; + AMREX_ALWAYS_ASSERT(linfo.root_proc > -1); + AMREX_ALWAYS_ASSERT(plist.find(linfo.root_proc) != plist.end()); } } template int ActModel::num_velocity_points() const { - const auto& info = m_data.info(); + const auto& linfo = m_data.info(); auto& grid = m_data.grid(); - return (info.sample_vel_in_proc) ? grid.vel.size() : 0; + return (linfo.sample_vel_in_proc) ? grid.vel.size() : 0; } } // namespace actuator diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index f92899f0ab..0000000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM exawind/exw-dev-deps:latest as base - -WORKDIR /amr-wind -COPY . /amr-wind - -ARG ENABLE_MPI=ON -ARG ENABLE_CUDA=OFF -ARG ENABLE_HIP=OFF -ARG ENABLE_DPCPP=OFF - -RUN (\ - cmake \ - -Bbuild \ - -DCMAKE_INSTALL_PREFIX=/opt/exawind \ - -DAMR_WIND_ENABLE_MPI=${ENABLE_MPI} \ - -DAMR_WIND_ENABLE_CUDA=${ENABLE_CUDA} \ - -DAMR_WIND_ENABLE_HIP=${ENABLE_HIP} \ - -DAMR_WIND_ENABLE_DPCPP=${ENABLE_DPCPP} \ - -DAMR_WIND_ENABLE_OPENMP=OFF \ - -DAMR_WIND_ENABLE_NETCDF=ON \ - -DAMR_WIND_ENABLE_HYPRE=ON \ - -DAMR_WIND_ENABLE_MASA=OFF \ - -DAMR_WIND_ENABLE_TESTS=OFF . \ - && cd build \ - && make -j$(nproc) \ - && ./amr_wind_unit_tests \ - ) diff --git a/docs/sphinx/conf.py b/docs/sphinx/conf.py index aecb9cb49f..3915eedfa2 100644 --- a/docs/sphinx/conf.py +++ b/docs/sphinx/conf.py @@ -72,7 +72,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +#language = en # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: diff --git a/unit_tests/core/test_field.cpp b/unit_tests/core/test_field.cpp index a2b3587736..b8e8f3b5b6 100644 --- a/unit_tests/core/test_field.cpp +++ b/unit_tests/core/test_field.cpp @@ -108,8 +108,8 @@ TEST_F(FieldRepoTest, field_get) const auto& frepo = mesh().field_repo(); auto& velf = frepo.get_field("vel"); - auto& presf = frepo.get_field("pressure"); - auto& vel_old = frepo.get_field("vel", amr_wind::FieldState::Old); + const auto& presf = frepo.get_field("pressure"); + const auto& vel_old = frepo.get_field("vel", amr_wind::FieldState::Old); EXPECT_EQ(velf.field_location(), amr_wind::FieldLoc::CELL); EXPECT_EQ(presf.field_location(), amr_wind::FieldLoc::NODE); @@ -175,15 +175,15 @@ TEST_F(FieldRepoTest, field_location) initialize_mesh(); auto& field_repo = mesh().field_repo(); - auto& velocity = field_repo.declare_field("vel", 3, 0, 2); - auto& pressure = + const auto& velocity = field_repo.declare_field("vel", 3, 0, 2); + const auto& pressure = field_repo.declare_field("p", 1, 0, 1, amr_wind::FieldLoc::NODE); - auto& umac = + const auto& umac = field_repo.declare_field("umac", 1, 0, 1, amr_wind::FieldLoc::XFACE); - auto& vmac = + const auto& vmac = field_repo.declare_field("vmac", 1, 0, 1, amr_wind::FieldLoc::YFACE); - auto& wmac = + const auto& wmac = field_repo.declare_field("wmac", 1, 0, 1, amr_wind::FieldLoc::ZFACE); EXPECT_EQ(velocity.field_location(), amr_wind::FieldLoc::CELL); diff --git a/unit_tests/multiphase/test_vof_cons.cpp b/unit_tests/multiphase/test_vof_cons.cpp index 2f88347ec4..5a4b40fc11 100644 --- a/unit_tests/multiphase/test_vof_cons.cpp +++ b/unit_tests/multiphase/test_vof_cons.cpp @@ -15,7 +15,6 @@ initialize_volume_fractions(const int dir, const int nx, amr_wind::Field& vof) auto vof_arr = vof(lev).array(mfi); const auto& bx = mfi.validbox(); amrex::ParallelFor(bx, [=] AMREX_GPU_DEVICE(int i, int j, int k) { - int icheck = 0; if (dir < 0) { // Bottom left half is liquid, top right half is gas if (i + j + k == 3) { @@ -28,6 +27,7 @@ initialize_volume_fractions(const int dir, const int nx, amr_wind::Field& vof) } } } else { + int icheck = 0; // Left half is liquid, right half is gas switch (dir) { case 0: diff --git a/unit_tests/wind_energy/actuator/test_disk_uniform_ct.cpp b/unit_tests/wind_energy/actuator/test_disk_uniform_ct.cpp index 318ebf1563..286657fc63 100644 --- a/unit_tests/wind_energy/actuator/test_disk_uniform_ct.cpp +++ b/unit_tests/wind_energy/actuator/test_disk_uniform_ct.cpp @@ -14,7 +14,6 @@ class UniformCtTest : public AmrexTest { AmrexTest::SetUp(); { - amrex::ParmParse pp("Actuator"); amrex::ParmParse pu("Actuator.UniformCtDisk"); pu.add("num_force_points", 3); pu.add("epsilon", 1); @@ -22,9 +21,6 @@ class UniformCtTest : public AmrexTest std::vector ct{1}; pu.addarr("thrust_coeff", ct); } - { - amrex::ParmParse pp("Coriolis"); - } } }; } // namespace @@ -99,9 +95,6 @@ TEST_F(UniformCtTest, compute_vecs_with_different_north) pp.addarr("north_vector", north); pp.addarr("east_vector", east); } - { - amrex::ParmParse pp("Actuator.UniformCtDisk"); - } act::utils::ActParser ap("Actuator.UniformCtDisk", "Actuator"); act::utils::ActParser cp("Coriolis.Forcing", "Coriolis"); ASSERT_TRUE(cp.contains("north_vector")); @@ -256,4 +249,4 @@ TEST_F(UniformCtTest, sample_yawed_normal_is_opposite_expected_wind_dir) } } } -} // namespace amr_wind_tests \ No newline at end of file +} // namespace amr_wind_tests