From 279f62151db3fc855afa55ff3253c163fd18e685 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Thu, 2 May 2024 18:14:00 -0400 Subject: [PATCH 1/3] some clang-tidy on MHD --- Exec/mhd_tests/OrszagTang/problem_initialize.H | 2 +- .../mhd_tests/OrszagTang/problem_initialize_mhd_data.H | 4 +--- .../OrszagTang/problem_initialize_state_data.H | 4 +--- Source/driver/Castro.H | 10 +++++----- Source/mhd/Castro_mhd.H | 8 ++++---- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Exec/mhd_tests/OrszagTang/problem_initialize.H b/Exec/mhd_tests/OrszagTang/problem_initialize.H index 42bf9dae0c..6b18d2c01a 100644 --- a/Exec/mhd_tests/OrszagTang/problem_initialize.H +++ b/Exec/mhd_tests/OrszagTang/problem_initialize.H @@ -9,7 +9,7 @@ void problem_initialize () { // temporarily give B_0 value here - constexpr Real M_SQRT_PI = std::sqrt(M_PI); + const Real M_SQRT_PI = std::sqrt(M_PI); problem::B_0 = 1.0 / (2.0_rt * M_SQRT_PI); // compute the internal energy (erg/cc) for the left and right state diff --git a/Exec/mhd_tests/OrszagTang/problem_initialize_mhd_data.H b/Exec/mhd_tests/OrszagTang/problem_initialize_mhd_data.H index 07620974b0..e83ea4da2b 100644 --- a/Exec/mhd_tests/OrszagTang/problem_initialize_mhd_data.H +++ b/Exec/mhd_tests/OrszagTang/problem_initialize_mhd_data.H @@ -6,8 +6,6 @@ void problem_initialize_mhd_data (int i, int j, int k, Array4 const& B, const int ibdir, const GeometryData& geomdata) { - int coord_type = geomdata.Coord(); - const Real* dx = geomdata.CellSize(); const Real* problo = geomdata.ProbLo(); @@ -22,7 +20,7 @@ void problem_initialize_mhd_data (int i, int j, int k, Real z = 0.0; #if AMREX_SPACEDIM == 3 - z = problo[2] + dx[2] * (static_cast(k) + 0.5_rt); + //z = problo[2] + dx[2] * (static_cast(k) + 0.5_rt); #endif if (ibdir == 0) { diff --git a/Exec/mhd_tests/OrszagTang/problem_initialize_state_data.H b/Exec/mhd_tests/OrszagTang/problem_initialize_state_data.H index c77606c235..3396ad27bf 100644 --- a/Exec/mhd_tests/OrszagTang/problem_initialize_state_data.H +++ b/Exec/mhd_tests/OrszagTang/problem_initialize_state_data.H @@ -9,14 +9,12 @@ void problem_initialize_state_data (int i, int j, int k, Array4 const& state, const GeometryData& geomdata) { - int coord_type = geomdata.Coord(); - const Real* dx = geomdata.CellSize(); const Real* problo = geomdata.ProbLo(); Real x = problo[0] + dx[0] * (static_cast(i) + 0.5_rt); Real y = problo[1] + dx[1] * (static_cast(j) + 0.5_rt); - Real z = problo[2] + dx[2] * (static_cast(k) + 0.5_rt); + //Real z = problo[2] + dx[2] * (static_cast(k) + 0.5_rt); state(i,j,k,URHO) = problem::rho_0; state(i,j,k,UMX) = -problem::rho_0 * problem::u_0 * std::sin(2.0_rt * M_PI * y); diff --git a/Source/driver/Castro.H b/Source/driver/Castro.H index 574456bc53..8f0f59a88a 100644 --- a/Source/driver/Castro.H +++ b/Source/driver/Castro.H @@ -819,11 +819,11 @@ public: /// @param Bz magnetic field in z /// @param state the state to operate on /// - void add_magnetic_e ( - amrex::MultiFab& Bx, - amrex::MultiFab& By, - amrex::MultiFab& Bz, - amrex::MultiFab& state); + static void add_magnetic_e ( + amrex::MultiFab& Bx, + amrex::MultiFab& By, + amrex::MultiFab& Bz, + amrex::MultiFab& state); /// /// Check if divergence of B is zero at initialization diff --git a/Source/mhd/Castro_mhd.H b/Source/mhd/Castro_mhd.H index 99821b31c7..ebe24c43c8 100644 --- a/Source/mhd/Castro_mhd.H +++ b/Source/mhd/Castro_mhd.H @@ -38,7 +38,7 @@ amrex::Array4 const& flux1, amrex::Array4 const& flux2); - void + static void PrimToCons(const amrex::Box& bx, amrex::Array4 const& q_arr, amrex::Array4 const& u_arr); @@ -53,21 +53,21 @@ const amrex::Real dt); - void + static void electric_edge_x(const amrex::Box& bx, amrex::Array4 const& q_arr, amrex::Array4 const& E, amrex::Array4 const& flxy, amrex::Array4 const& flxz); - void + static void electric_edge_y(const amrex::Box& bx, amrex::Array4 const& q_arr, amrex::Array4 const& E, amrex::Array4 const& flxx, amrex::Array4 const& flxz); - void + statc=ic void electric_edge_z(const amrex::Box& bx, amrex::Array4 const& q_arr, amrex::Array4 const& E, From 0112cb87f450cbbcc7eaad39caa485a8740b35e4 Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Thu, 2 May 2024 18:18:06 -0400 Subject: [PATCH 2/3] fix typo --- Source/mhd/Castro_mhd.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/mhd/Castro_mhd.H b/Source/mhd/Castro_mhd.H index ebe24c43c8..12037acc75 100644 --- a/Source/mhd/Castro_mhd.H +++ b/Source/mhd/Castro_mhd.H @@ -67,7 +67,7 @@ amrex::Array4 const& flxx, amrex::Array4 const& flxz); - statc=ic void + static void electric_edge_z(const amrex::Box& bx, amrex::Array4 const& q_arr, amrex::Array4 const& E, From 8ebf5c4e7e48a86e3fa20b35cf92f5259bb806eb Mon Sep 17 00:00:00 2001 From: Michael Zingale Date: Mon, 6 May 2024 18:37:34 -0400 Subject: [PATCH 3/3] remove dead code --- Exec/mhd_tests/OrszagTang/problem_initialize_mhd_data.H | 5 ----- Exec/mhd_tests/OrszagTang/problem_initialize_state_data.H | 1 - 2 files changed, 6 deletions(-) diff --git a/Exec/mhd_tests/OrszagTang/problem_initialize_mhd_data.H b/Exec/mhd_tests/OrszagTang/problem_initialize_mhd_data.H index e83ea4da2b..65ccb8b943 100644 --- a/Exec/mhd_tests/OrszagTang/problem_initialize_mhd_data.H +++ b/Exec/mhd_tests/OrszagTang/problem_initialize_mhd_data.H @@ -18,11 +18,6 @@ void problem_initialize_mhd_data (int i, int j, int k, y = problo[1] + dx[1] * (static_cast(j) + 0.5_rt); #endif - Real z = 0.0; -#if AMREX_SPACEDIM == 3 - //z = problo[2] + dx[2] * (static_cast(k) + 0.5_rt); -#endif - if (ibdir == 0) { B(i,j,k) = -problem::B_0 * std::sin(2.0_rt * M_PI * y); } else if (ibdir == 1) { diff --git a/Exec/mhd_tests/OrszagTang/problem_initialize_state_data.H b/Exec/mhd_tests/OrszagTang/problem_initialize_state_data.H index 3396ad27bf..c8a9bfa13d 100644 --- a/Exec/mhd_tests/OrszagTang/problem_initialize_state_data.H +++ b/Exec/mhd_tests/OrszagTang/problem_initialize_state_data.H @@ -14,7 +14,6 @@ void problem_initialize_state_data (int i, int j, int k, Real x = problo[0] + dx[0] * (static_cast(i) + 0.5_rt); Real y = problo[1] + dx[1] * (static_cast(j) + 0.5_rt); - //Real z = problo[2] + dx[2] * (static_cast(k) + 0.5_rt); state(i,j,k,URHO) = problem::rho_0; state(i,j,k,UMX) = -problem::rho_0 * problem::u_0 * std::sin(2.0_rt * M_PI * y);