From b7d6aea61f089e286618c23a86349b68927f0631 Mon Sep 17 00:00:00 2001 From: Bob Caddy Date: Wed, 3 Jul 2024 19:09:41 -0400 Subject: [PATCH 1/2] Remove _specific from struct member variables --- src/reconstruction/pcm_cuda.h | 4 +- src/reconstruction/plm_cuda.h | 32 +++---- src/reconstruction/ppmc_cuda.cu | 92 +++++++++---------- src/reconstruction/reconstruction_internals.h | 44 ++++----- src/riemann_solvers/exact_cuda.cu | 16 ++-- src/riemann_solvers/hll_cuda.cu | 32 +++---- src/riemann_solvers/hllc_cuda.cu | 24 ++--- src/riemann_solvers/hlld_cuda.cu | 10 +- src/riemann_solvers/roe_cuda.cu | 28 +++--- src/utils/basic_structs.h | 14 +-- src/utils/hydro_utilities.h | 8 +- src/utils/hydro_utilities_tests.cpp | 4 +- 12 files changed, 154 insertions(+), 154 deletions(-) diff --git a/src/reconstruction/pcm_cuda.h b/src/reconstruction/pcm_cuda.h index d1c593ff2..be21cf950 100644 --- a/src/reconstruction/pcm_cuda.h +++ b/src/reconstruction/pcm_cuda.h @@ -63,11 +63,11 @@ reconstruction::InterfaceState __device__ __host__ inline PCM_Reconstruction(Rea interface_state.magnetic = conserved_data.magnetic; #endif // MHD #ifdef DE - interface_state.gas_energy_specific = primitive_data.gas_energy_specific; + interface_state.gas_energy = primitive_data.gas_energy; #endif // DE #ifdef SCALAR for (size_t i = 0; i < grid_enum::nscalars; i++) { - interface_state.scalar_specific[i] = primitive_data.scalar_specific[i]; + interface_state.scalar[i] = primitive_data.scalar[i]; } #endif // SCALAR diff --git a/src/reconstruction/plm_cuda.h b/src/reconstruction/plm_cuda.h index ec9ebe3d3..2a926dc94 100644 --- a/src/reconstruction/plm_cuda.h +++ b/src/reconstruction/plm_cuda.h @@ -65,14 +65,14 @@ void __device__ __host__ __inline__ PLM_Characteristic_Evolution(hydro_utilities interface_L_iph.pressure = interface_L_iph.pressure - qx * del_m.pressure; #ifdef DE - interface_R_imh.gas_energy_specific = interface_R_imh.gas_energy_specific + qx * del_m.gas_energy_specific; - interface_L_iph.gas_energy_specific = interface_L_iph.gas_energy_specific - qx * del_m.gas_energy_specific; + interface_R_imh.gas_energy = interface_R_imh.gas_energy + qx * del_m.gas_energy; + interface_L_iph.gas_energy = interface_L_iph.gas_energy - qx * del_m.gas_energy; #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - interface_R_imh.scalar_specific[i] = interface_R_imh.scalar_specific[i] + qx * del_m.scalar_specific[i]; - interface_L_iph.scalar_specific[i] = interface_L_iph.scalar_specific[i] - qx * del_m.scalar_specific[i]; + interface_R_imh.scalar[i] = interface_R_imh.scalar[i] + qx * del_m.scalar[i]; + interface_L_iph.scalar[i] = interface_L_iph.scalar[i] - qx * del_m.scalar[i]; } #endif // SCALAR @@ -105,11 +105,11 @@ void __device__ __host__ __inline__ PLM_Characteristic_Evolution(hydro_utilities sum_2 += lamdiff * del_m.velocity.y(); sum_3 += lamdiff * del_m.velocity.z(); #ifdef DE - sum_ge += lamdiff * del_m.gas_energy_specific; + sum_ge += lamdiff * del_m.gas_energy; #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - sum_scalar[i] += lamdiff * del_m.scalar_specific[i]; + sum_scalar[i] += lamdiff * del_m.scalar[i]; } #endif // SCALAR } @@ -129,11 +129,11 @@ void __device__ __host__ __inline__ PLM_Characteristic_Evolution(hydro_utilities interface_L_iph.velocity.z() += 0.5 * dtodx * sum_3; interface_L_iph.pressure += 0.5 * dtodx * sum_4; #ifdef DE - interface_L_iph.gas_energy_specific += 0.5 * dtodx * sum_ge; + interface_L_iph.gas_energy += 0.5 * dtodx * sum_ge; #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - interface_L_iph.scalar_specific[i] += 0.5 * dtodx * sum_scalar[i]; + interface_L_iph.scalar[i] += 0.5 * dtodx * sum_scalar[i]; } #endif // SCALAR @@ -162,11 +162,11 @@ void __device__ __host__ __inline__ PLM_Characteristic_Evolution(hydro_utilities sum_2 += lamdiff * del_m.velocity.y(); sum_3 += lamdiff * del_m.velocity.z(); #ifdef DE - sum_ge += lamdiff * del_m.gas_energy_specific; + sum_ge += lamdiff * del_m.gas_energy; #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - sum_scalar[i] += lamdiff * del_m.scalar_specific[i]; + sum_scalar[i] += lamdiff * del_m.scalar[i]; } #endif // SCALAR } @@ -186,11 +186,11 @@ void __device__ __host__ __inline__ PLM_Characteristic_Evolution(hydro_utilities interface_R_imh.velocity.z() += 0.5 * dtodx * sum_3; interface_R_imh.pressure += 0.5 * dtodx * sum_4; #ifdef DE - interface_R_imh.gas_energy_specific += 0.5 * dtodx * sum_ge; + interface_R_imh.gas_energy += 0.5 * dtodx * sum_ge; #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - interface_R_imh.scalar_specific[i] += 0.5 * dtodx * sum_scalar[i]; + interface_R_imh.scalar[i] += 0.5 * dtodx * sum_scalar[i]; } #endif // SCALAR } @@ -279,13 +279,13 @@ auto __device__ __inline__ PLM_Reconstruction(Real *dev_conserved, int const xid // Limit the variables that aren't transformed by the characteristic projection #ifdef DE - del_m.gas_energy_specific = Van_Leer_Limiter(del_L.gas_energy_specific, del_R.gas_energy_specific, - del_C.gas_energy_specific, del_G.gas_energy_specific); + del_m.gas_energy = Van_Leer_Limiter(del_L.gas_energy, del_R.gas_energy, + del_C.gas_energy, del_G.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - del_m.scalar_specific[i] = Van_Leer_Limiter(del_L.scalar_specific[i], del_R.scalar_specific[i], - del_C.scalar_specific[i], del_G.scalar_specific[i]); + del_m.scalar[i] = Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], + del_C.scalar[i], del_G.scalar[i]); } #endif // SCALAR #else // PLMP diff --git a/src/reconstruction/ppmc_cuda.cu b/src/reconstruction/ppmc_cuda.cu index c13b78b91..53c914783 100644 --- a/src/reconstruction/ppmc_cuda.cu +++ b/src/reconstruction/ppmc_cuda.cu @@ -126,13 +126,13 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun // Limit the variables that aren't transformed by the characteristic projection #ifdef DE - del_m_im1.gas_energy_specific = reconstruction::Van_Leer_Limiter( - del_L.gas_energy_specific, del_R.gas_energy_specific, del_C.gas_energy_specific, del_G.gas_energy_specific); + del_m_im1.gas_energy = reconstruction::Van_Leer_Limiter( + del_L.gas_energy, del_R.gas_energy, del_C.gas_energy, del_G.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - del_m_im1.scalar_specific[i] = reconstruction::Van_Leer_Limiter(del_L.scalar_specific[i], del_R.scalar_specific[i], - del_C.scalar_specific[i], del_G.scalar_specific[i]); + del_m_im1.scalar[i] = reconstruction::Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], + del_C.scalar[i], del_G.scalar[i]); } #endif // SCALAR @@ -179,13 +179,13 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun // Limit the variables that aren't transformed by the characteristic projection #ifdef DE - del_m_i.gas_energy_specific = reconstruction::Van_Leer_Limiter(del_L.gas_energy_specific, del_R.gas_energy_specific, - del_C.gas_energy_specific, del_G.gas_energy_specific); + del_m_i.gas_energy = reconstruction::Van_Leer_Limiter(del_L.gas_energy, del_R.gas_energy, + del_C.gas_energy, del_G.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - del_m_i.scalar_specific[i] = reconstruction::Van_Leer_Limiter(del_L.scalar_specific[i], del_R.scalar_specific[i], - del_C.scalar_specific[i], del_G.scalar_specific[i]); + del_m_i.scalar[i] = reconstruction::Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], + del_C.scalar[i], del_G.scalar[i]); } #endif // SCALAR @@ -233,13 +233,13 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun // Limit the variables that aren't transformed by the characteristic projection #ifdef DE - del_m_ip1.gas_energy_specific = reconstruction::Van_Leer_Limiter( - del_L.gas_energy_specific, del_R.gas_energy_specific, del_C.gas_energy_specific, del_G.gas_energy_specific); + del_m_ip1.gas_energy = reconstruction::Van_Leer_Limiter( + del_L.gas_energy, del_R.gas_energy, del_C.gas_energy, del_G.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - del_m_ip1.scalar_specific[i] = reconstruction::Van_Leer_Limiter(del_L.scalar_specific[i], del_R.scalar_specific[i], - del_C.scalar_specific[i], del_G.scalar_specific[i]); + del_m_ip1.scalar[i] = reconstruction::Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], + del_C.scalar[i], del_G.scalar[i]); } #endif // SCALAR @@ -273,17 +273,17 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun Real const p_6 = 6.0 * (cell_i.pressure - 0.5 * (interface_R_imh.pressure + interface_L_iph.pressure)); #ifdef DE - del_m_i.gas_energy_specific = interface_L_iph.gas_energy_specific - interface_R_imh.gas_energy_specific; - Real const ge_6 = 6.0 * (cell_i.gas_energy_specific - - 0.5 * (interface_R_imh.gas_energy_specific + interface_L_iph.gas_energy_specific)); + del_m_i.gas_energy = interface_L_iph.gas_energy - interface_R_imh.gas_energy; + Real const ge_6 = 6.0 * (cell_i.gas_energy - + 0.5 * (interface_R_imh.gas_energy + interface_L_iph.gas_energy)); #endif // DE #ifdef SCALAR Real scalar_6[NSCALARS]; for (int i = 0; i < NSCALARS; i++) { - del_m_i.scalar_specific[i] = interface_L_iph.scalar_specific[i] - interface_R_imh.scalar_specific[i]; - scalar_6[i] = 6.0 * (cell_i.scalar_specific[i] - - 0.5 * (interface_R_imh.scalar_specific[i] + interface_L_iph.scalar_specific[i])); + del_m_i.scalar[i] = interface_L_iph.scalar[i] - interface_R_imh.scalar[i]; + scalar_6[i] = 6.0 * (cell_i.scalar[i] - + 0.5 * (interface_R_imh.scalar[i] + interface_L_iph.scalar[i])); } #endif // SCALAR @@ -342,24 +342,24 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun lambda_min * (0.5 * dtodx) * (del_m_i.pressure + (1.0 + (2.0 / 3.0) * lambda_min * dtodx) * p_6); #ifdef DE - interface_L_iph.gas_energy_specific = - interface_L_iph.gas_energy_specific - - lambda_max * (0.5 * dtodx) * (del_m_i.gas_energy_specific - (1.0 - (2.0 / 3.0) * lambda_max * dtodx) * ge_6); - interface_R_imh.gas_energy_specific = - interface_R_imh.gas_energy_specific - - lambda_min * (0.5 * dtodx) * (del_m_i.gas_energy_specific + (1.0 + (2.0 / 3.0) * lambda_min * dtodx) * ge_6); + interface_L_iph.gas_energy = + interface_L_iph.gas_energy - + lambda_max * (0.5 * dtodx) * (del_m_i.gas_energy - (1.0 - (2.0 / 3.0) * lambda_max * dtodx) * ge_6); + interface_R_imh.gas_energy = + interface_R_imh.gas_energy - + lambda_min * (0.5 * dtodx) * (del_m_i.gas_energy + (1.0 + (2.0 / 3.0) * lambda_min * dtodx) * ge_6); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - interface_L_iph.scalar_specific[i] = - interface_L_iph.scalar_specific[i] - + interface_L_iph.scalar[i] = + interface_L_iph.scalar[i] - lambda_max * (0.5 * dtodx) * - (del_m_i.scalar_specific[i] - (1.0 - (2.0 / 3.0) * lambda_max * dtodx) * scalar_6[i]); - interface_R_imh.scalar_specific[i] = - interface_R_imh.scalar_specific[i] - + (del_m_i.scalar[i] - (1.0 - (2.0 / 3.0) * lambda_max * dtodx) * scalar_6[i]); + interface_R_imh.scalar[i] = + interface_R_imh.scalar[i] - lambda_min * (0.5 * dtodx) * - (del_m_i.scalar_specific[i] + (1.0 + (2.0 / 3.0) * lambda_min * dtodx) * scalar_6[i]); + (del_m_i.scalar[i] + (1.0 + (2.0 / 3.0) * lambda_min * dtodx) * scalar_6[i]); } #endif // SCALAR @@ -404,11 +404,11 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun Real const chi_4 = A * (del_m_i.velocity.z() - vz_6) + B * vz_6; Real const chi_5 = A * (del_m_i.pressure - p_6) + B * p_6; #ifdef DE - chi_ge = A * (del_m_i.gas_energy_specific - ge_6) + B * ge_6; + chi_ge = A * (del_m_i.gas_energy - ge_6) + B * ge_6; #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - chi_scalar[i] = A * (del_m_i.scalar_specific[i] - scalar_6[i]) + B * scalar_6[i]; + chi_scalar[i] = A * (del_m_i.scalar[i] - scalar_6[i]) + B * scalar_6[i]; } #endif // SCALAR @@ -446,11 +446,11 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun interface_L_iph.velocity.z() += sum_4; interface_L_iph.pressure += sum_5; #ifdef DE - interface_L_iph.gas_energy_specific += sum_ge; + interface_L_iph.gas_energy += sum_ge; #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - interface_L_iph.scalar_specific[i] += sum_scalar[i]; + interface_L_iph.scalar[i] += sum_scalar[i]; } #endif // SCALAR @@ -492,11 +492,11 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun Real const chi_4 = C * (del_m_i.velocity.z() + vz_6) + D * vz_6; Real const chi_5 = C * (del_m_i.pressure + p_6) + D * p_6; #ifdef DE - chi_ge = C * (del_m_i.gas_energy_specific + ge_6) + D * ge_6; + chi_ge = C * (del_m_i.gas_energy + ge_6) + D * ge_6; #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - chi_scalar[i] = C * (del_m_i.scalar_specific[i] + scalar_6[i]) + D * scalar_6[i]; + chi_scalar[i] = C * (del_m_i.scalar[i] + scalar_6[i]) + D * scalar_6[i]; } #endif // SCALAR @@ -534,11 +534,11 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun interface_R_imh.velocity.z() += sum_4; interface_R_imh.pressure += sum_5; #ifdef DE - interface_R_imh.gas_energy_specific += sum_ge; + interface_R_imh.gas_energy += sum_ge; #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - interface_R_imh.scalar_specific[i] += sum_scalar[i]; + interface_R_imh.scalar[i] += sum_scalar[i]; } #endif // SCALAR @@ -680,17 +680,17 @@ __global__ __launch_bounds__(TPB) void PPMC_VL(Real *dev_conserved, Real *dev_bo // Compute the interfaces for the variables that don't have characteristics #ifdef DE - reconstruction::PPM_Single_Variable(cell_im2.gas_energy_specific, cell_im1.gas_energy_specific, - cell_i.gas_energy_specific, cell_ip1.gas_energy_specific, - cell_ip2.gas_energy_specific, interface_L_iph.gas_energy_specific, - interface_R_imh.gas_energy_specific); + reconstruction::PPM_Single_Variable(cell_im2.gas_energy, cell_im1.gas_energy, + cell_i.gas_energy, cell_ip1.gas_energy, + cell_ip2.gas_energy, interface_L_iph.gas_energy, + interface_R_imh.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - reconstruction::PPM_Single_Variable(cell_im2.scalar_specific[i], cell_im1.scalar_specific[i], - cell_i.scalar_specific[i], cell_ip1.scalar_specific[i], - cell_ip2.scalar_specific[i], interface_L_iph.scalar_specific[i], - interface_R_imh.scalar_specific[i]); + reconstruction::PPM_Single_Variable(cell_im2.scalar[i], cell_im1.scalar[i], + cell_i.scalar[i], cell_ip1.scalar[i], + cell_ip2.scalar[i], interface_L_iph.scalar[i], + interface_R_imh.scalar[i]); } #endif // SCALAR diff --git a/src/reconstruction/reconstruction_internals.h b/src/reconstruction/reconstruction_internals.h index dbb624e04..66ffa677c 100644 --- a/src/reconstruction/reconstruction_internals.h +++ b/src/reconstruction/reconstruction_internals.h @@ -201,7 +201,7 @@ hydro_utilities::Primitive __device__ __host__ __inline__ Load_Data( #endif // MHD loaded_data.pressure = hydro_utilities::Get_Pressure_From_DE(energy, energy - energy_non_thermal, gas_energy, gamma); - loaded_data.gas_energy_specific = gas_energy / loaded_data.density; + loaded_data.gas_energy = gas_energy / loaded_data.density; #else // not DE #ifdef MHD loaded_data.pressure = hydro_utilities::Calc_Pressure_Primitive( @@ -217,7 +217,7 @@ hydro_utilities::Primitive __device__ __host__ __inline__ Load_Data( #ifdef SCALAR for (size_t i = 0; i < grid_enum::nscalars; i++) { - loaded_data.scalar_specific[i] = dev_conserved[(grid_enum::scalar + i) * n_cells + id] / loaded_data.density; + loaded_data.scalar[i] = dev_conserved[(grid_enum::scalar + i) * n_cells + id] / loaded_data.density; } #endif // SCALAR @@ -302,12 +302,12 @@ hydro_utilities::Primitive __device__ __host__ __inline__ Compute_Slope(hydro_ut #endif // MHD #ifdef DE - slopes.gas_energy_specific = coef * (right.gas_energy_specific - left.gas_energy_specific); + slopes.gas_energy = coef * (right.gas_energy - left.gas_energy); #endif // DE #ifdef SCALAR for (size_t i = 0; i < grid_enum::nscalars; i++) { - slopes.scalar_specific[i] = coef * (right.scalar_specific[i] - left.scalar_specific[i]); + slopes.scalar[i] = coef * (right.scalar[i] - left.scalar[i]); } #endif // SCALAR @@ -348,12 +348,12 @@ hydro_utilities::Primitive __device__ __host__ __inline__ Compute_Van_Leer_Slope #endif // MHD #ifdef DE - vl_slopes.gas_energy_specific = Calc_Vl_Slope(left_slope.gas_energy_specific, right_slope.gas_energy_specific); + vl_slopes.gas_energy = Calc_Vl_Slope(left_slope.gas_energy, right_slope.gas_energy); #endif // DE #ifdef SCALAR for (size_t i = 0; i < grid_enum::nscalars; i++) { - vl_slopes.scalar_specific[i] = Calc_Vl_Slope(left_slope.scalar_specific[i], right_slope.scalar_specific[i]); + vl_slopes.scalar[i] = Calc_Vl_Slope(left_slope.scalar[i], right_slope.scalar[i]); } #endif // SCALAR @@ -650,13 +650,13 @@ hydro_utilities::Primitive __device__ __host__ __inline__ Van_Leer_Limiter(hydro #endif // MHD #ifdef DE - del_m.gas_energy_specific = Van_Leer_Limiter(del_L.gas_energy_specific, del_R.gas_energy_specific, - del_C.gas_energy_specific, del_G.gas_energy_specific); + del_m.gas_energy = Van_Leer_Limiter(del_L.gas_energy, del_R.gas_energy, + del_C.gas_energy, del_G.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - del_m.scalar_specific[i] = Van_Leer_Limiter(del_L.scalar_specific[i], del_R.scalar_specific[i], - del_C.scalar_specific[i], del_G.scalar_specific[i]); + del_m.scalar[i] = Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], + del_C.scalar[i], del_G.scalar[i]); } #endif // SCALAR @@ -727,13 +727,13 @@ void __device__ __host__ __inline__ Monotonize_Parabolic_Interface(hydro_utiliti #endif // MHD #ifdef DE - Monotonize(cell_i.gas_energy_specific, cell_im1.gas_energy_specific, cell_ip1.gas_energy_specific, - interface_L_iph.gas_energy_specific, interface_R_imh.gas_energy_specific); + Monotonize(cell_i.gas_energy, cell_im1.gas_energy, cell_ip1.gas_energy, + interface_L_iph.gas_energy, interface_R_imh.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - Monotonize(cell_i.scalar_specific[i], cell_im1.scalar_specific[i], cell_ip1.scalar_specific[i], - interface_L_iph.scalar_specific[i], interface_R_imh.scalar_specific[i]); + Monotonize(cell_i.scalar[i], cell_im1.scalar[i], cell_ip1.scalar[i], + interface_L_iph.scalar[i], interface_R_imh.scalar[i]); } #endif // SCALAR } @@ -767,11 +767,11 @@ hydro_utilities::Primitive __device__ __host__ __inline__ Calc_Interface_Linear( #endif // MHD #ifdef DE - output.gas_energy_specific = interface(primitive.gas_energy_specific, slopes.gas_energy_specific); + output.gas_energy = interface(primitive.gas_energy, slopes.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - output.scalar_specific[i] = interface(primitive.scalar_specific[i], slopes.scalar_specific[i]); + output.scalar[i] = interface(primitive.scalar[i], slopes.scalar[i]); } #endif // SCALAR @@ -817,13 +817,13 @@ hydro_utilities::Primitive __device__ __host__ __inline__ Calc_Interface_Parabol #endif // MHD #ifdef DE - output.gas_energy_specific = interface(cell_i.gas_energy_specific, cell_im1.gas_energy_specific, - slopes_i.gas_energy_specific, slopes_im1.gas_energy_specific); + output.gas_energy = interface(cell_i.gas_energy, cell_im1.gas_energy, + slopes_i.gas_energy, slopes_im1.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - output.scalar_specific[i] = interface(cell_i.scalar_specific[i], cell_im1.scalar_specific[i], - slopes_i.scalar_specific[i], slopes_im1.scalar_specific[i]); + output.scalar[i] = interface(cell_i.scalar[i], cell_im1.scalar[i], + slopes_i.scalar[i], slopes_im1.scalar[i]); } #endif // SCALAR @@ -1021,12 +1021,12 @@ void __device__ __host__ __inline__ Write_Data(hydro_utilities::Primitive const #endif // MHD #ifdef DE - dev_interface[grid_enum::GasEnergy * n_cells + id] = interface_state.density * interface_state.gas_energy_specific; + dev_interface[grid_enum::GasEnergy * n_cells + id] = interface_state.density * interface_state.gas_energy; #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { dev_interface[(grid_enum::scalar + i) * n_cells + id] = - interface_state.density * interface_state.scalar_specific[i]; + interface_state.density * interface_state.scalar[i]; } #endif // SCALAR } diff --git a/src/riemann_solvers/exact_cuda.cu b/src/riemann_solvers/exact_cuda.cu index 736580ec5..0626e676a 100644 --- a/src/riemann_solvers/exact_cuda.cu +++ b/src/riemann_solvers/exact_cuda.cu @@ -80,11 +80,11 @@ __global__ void Calculate_Exact_Fluxes_CUDA(Real const *dev_conserved, Real cons left_state.pressure = fmax(left_state.pressure, (Real)TINY_NUMBER); #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - left_state.scalar_specific[i] = dev_bounds_L[(5 + i) * n_cells + tid] / left_state.density; + left_state.scalar[i] = dev_bounds_L[(5 + i) * n_cells + tid] / left_state.density; } #endif #ifdef DE - left_state.gas_energy_specific = dge / left_state.density; + left_state.gas_energy = dge / left_state.density; #endif right_state.density = dev_bounds_R[tid]; right_state.velocity.x() = dev_bounds_R[o1 * n_cells + tid] / right_state.density; @@ -109,11 +109,11 @@ __global__ void Calculate_Exact_Fluxes_CUDA(Real const *dev_conserved, Real cons right_state.pressure = fmax(right_state.pressure, (Real)TINY_NUMBER); #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - right_state.scalar_specific[i] = dev_bounds_R[(5 + i) * n_cells + tid] / right_state.density; + right_state.scalar[i] = dev_bounds_R[(5 + i) * n_cells + tid] / right_state.density; } #endif #ifdef DE - right_state.gas_energy_specific = dge / right_state.density; + right_state.gas_energy = dge / right_state.density; #endif } // compute sounds speeds in left and right regions @@ -144,11 +144,11 @@ __global__ void Calculate_Exact_Fluxes_CUDA(Real const *dev_conserved, Real cons dev_flux[o3 * n_cells + tid] = ds * vs * left_state.velocity.z(); #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - dev_flux[(5 + i) * n_cells + tid] = ds * vs * left_state.scalar_specific[i]; + dev_flux[(5 + i) * n_cells + tid] = ds * vs * left_state.scalar[i]; } #endif #ifdef DE - dev_flux[(n_fields - 1) * n_cells + tid] = ds * vs * left_state.gas_energy_specific; + dev_flux[(n_fields - 1) * n_cells + tid] = ds * vs * left_state.gas_energy; #endif Es = (ps / (gamma - 1.0)) + 0.5 * ds * (vs * vs + left_state.velocity.y() * left_state.velocity.y() + @@ -158,11 +158,11 @@ __global__ void Calculate_Exact_Fluxes_CUDA(Real const *dev_conserved, Real cons dev_flux[o3 * n_cells + tid] = ds * vs * right_state.velocity.z(); #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - dev_flux[(5 + i) * n_cells + tid] = ds * vs * right_state.scalar_specific[i]; + dev_flux[(5 + i) * n_cells + tid] = ds * vs * right_state.scalar[i]; } #endif #ifdef DE - dev_flux[(n_fields - 1) * n_cells + tid] = ds * vs * right_state.gas_energy_specific; + dev_flux[(n_fields - 1) * n_cells + tid] = ds * vs * right_state.gas_energy; #endif Es = (ps / (gamma - 1.0)) + 0.5 * ds * (vs * vs + right_state.velocity.y() * right_state.velocity.y() + diff --git a/src/riemann_solvers/hll_cuda.cu b/src/riemann_solvers/hll_cuda.cu index ad8adcb98..5bf90b281 100644 --- a/src/riemann_solvers/hll_cuda.cu +++ b/src/riemann_solvers/hll_cuda.cu @@ -71,11 +71,11 @@ __global__ void Calculate_HLL_Fluxes_CUDA(Real const *dev_conserved, Real const left_state.energy = dev_bounds_L[4 * n_cells + tid]; #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - left_state.scalar_specific[i] = dev_bounds_L[(5 + i) * n_cells + tid]; + left_state.scalar[i] = dev_bounds_L[(5 + i) * n_cells + tid]; } #endif #ifdef DE - left_state.gas_energy_specific = dev_bounds_L[(n_fields - 1) * n_cells + tid]; + left_state.gas_energy = dev_bounds_L[(n_fields - 1) * n_cells + tid]; #endif right_state.density = dev_bounds_R[tid]; @@ -85,11 +85,11 @@ __global__ void Calculate_HLL_Fluxes_CUDA(Real const *dev_conserved, Real const right_state.energy = dev_bounds_R[4 * n_cells + tid]; #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - right_state.scalar_specific[i] = dev_bounds_R[(5 + i) * n_cells + tid]; + right_state.scalar[i] = dev_bounds_R[(5 + i) * n_cells + tid]; } #endif #ifdef DE - right_state.gas_energy_specific = dev_bounds_R[(n_fields - 1) * n_cells + tid]; + right_state.gas_energy = dev_bounds_R[(n_fields - 1) * n_cells + tid]; #endif // calculate primitive variables @@ -102,7 +102,7 @@ __global__ void Calculate_HLL_Fluxes_CUDA(Real const *dev_conserved, Real const (left_state.velocity.x() * left_state.velocity.x() + left_state.velocity.y() * left_state.velocity.y() + left_state.velocity.z() * left_state.velocity.z()); left_state.pressure = hydro_utilities::Get_Pressure_From_DE(left_state.energy, left_state.energy - E_kin, - left_state.gas_energy_specific, gamma); + left_state.gas_energy, gamma); #else left_state.pressure = (left_state.energy - 0.5 * left_state.density * (left_state.velocity.x() * left_state.velocity.x() + @@ -113,11 +113,11 @@ __global__ void Calculate_HLL_Fluxes_CUDA(Real const *dev_conserved, Real const left_state.pressure = fmax(left_state.pressure, (Real)TINY_NUMBER); // #ifdef SCALAR // for (int i=0; i= 0.0) { - dev_flux[(5 + i) * n_cells + tid] = dev_flux[tid] * left_state.scalar_specific[i]; + dev_flux[(5 + i) * n_cells + tid] = dev_flux[tid] * left_state.scalar[i]; } else { - dev_flux[(5 + i) * n_cells + tid] = dev_flux[tid] * right_state.scalar_specific[i]; + dev_flux[(5 + i) * n_cells + tid] = dev_flux[tid] * right_state.scalar[i]; } } #endif #ifdef DE if (dev_flux[tid] >= 0.0) { - dev_flux[(n_fields - 1) * n_cells + tid] = dev_flux[tid] * left_state.gas_energy_specific; + dev_flux[(n_fields - 1) * n_cells + tid] = dev_flux[tid] * left_state.gas_energy; } else { - dev_flux[(n_fields - 1) * n_cells + tid] = dev_flux[tid] * right_state.gas_energy_specific; + dev_flux[(n_fields - 1) * n_cells + tid] = dev_flux[tid] * right_state.gas_energy; } #endif } diff --git a/src/utils/basic_structs.h b/src/utils/basic_structs.h index bdef682f9..b3467b84f 100644 --- a/src/utils/basic_structs.h +++ b/src/utils/basic_structs.h @@ -123,11 +123,11 @@ struct Primitive { #ifdef DE /// The specific thermal energy in the gas - Real gas_energy_specific; + Real gas_energy; #endif // DE #ifdef SCALAR - Real scalar_specific[grid_enum::nscalars]; + Real scalar[grid_enum::nscalars]; #endif // SCALAR /// Default constructor, should init everything to zero @@ -135,7 +135,7 @@ struct Primitive { /// Manual constructor, mostly used for testing and doesn't init all members. The `in_` prefix stands for input, /// mostly to avoid name collision with the member variables Primitive(Real const in_density, VectorXYZ const& in_velocity, Real const in_pressure, - VectorXYZ const& in_magnetic = {0, 0, 0}, Real const in_gas_energy_specific = 0.0) + VectorXYZ const& in_magnetic = {0, 0, 0}, Real const in_gas_energy = 0.0) : density(in_density), velocity(in_velocity), pressure(in_pressure) { #ifdef MHD @@ -143,7 +143,7 @@ struct Primitive { #endif // mhd #ifdef DE - gas_energy_specific = in_gas_energy_specific; + gas_energy = in_gas_energy; #endif // DE }; }; @@ -166,11 +166,11 @@ struct InterfaceState { #endif // MHD #ifdef DE - Real gas_energy_specific; + Real gas_energy; #endif // DE #ifdef SCALAR - Real scalar_specific[grid_enum::nscalars]; + Real scalar[grid_enum::nscalars]; #endif // SCALAR // Define the constructors @@ -191,7 +191,7 @@ struct InterfaceState { total_pressure = in_total_pressure; #endif // MHD #ifdef DE - gas_energy_specific = 0.0; + gas_energy = 0.0; #endif // DE }; }; diff --git a/src/utils/hydro_utilities.h b/src/utils/hydro_utilities.h index ec9759d72..ddeecd608 100644 --- a/src/utils/hydro_utilities.h +++ b/src/utils/hydro_utilities.h @@ -308,12 +308,12 @@ __inline__ __host__ __device__ Primitive Conserved_2_Primitive(Conserved const & #endif // MHD #ifdef DE - output.gas_energy_specific = conserved_in.gas_energy / conserved_in.density; + output.gas_energy = conserved_in.gas_energy / conserved_in.density; #endif // DE #ifdef SCALAR for (size_t i = 0; i < grid_enum::nscalars; i++) { - output.scalar_specific[i] = conserved_in.scalar[i] / conserved_in.density; + output.scalar[i] = conserved_in.scalar[i] / conserved_in.density; } #endif // SCALAR @@ -368,12 +368,12 @@ __inline__ __host__ __device__ Conserved Primitive_2_Conserved(Primitive const & #endif // MHD #ifdef DE - output.gas_energy = primitive_in.gas_energy_specific * primitive_in.density; + output.gas_energy = primitive_in.gas_energy * primitive_in.density; #endif // DE #ifdef SCALAR for (size_t i = 0; i < grid_enum::nscalars; i++) { - output.scalar[i] = primitive_in.scalar_specific[i] * primitive_in.density; + output.scalar[i] = primitive_in.scalar[i] * primitive_in.density; } #endif // SCALAR diff --git a/src/utils/hydro_utilities_tests.cpp b/src/utils/hydro_utilities_tests.cpp index ea04d7549..7b1b6fccd 100644 --- a/src/utils/hydro_utilities_tests.cpp +++ b/src/utils/hydro_utilities_tests.cpp @@ -425,8 +425,8 @@ TEST(tALLConserved2Primitive, CorrectInputExpectCorrectOutput) testing_utilities::Check_Results(fiducial_data.magnetic.z(), test_data.magnetic.z(), "magnetic.z"); #endif // MHD #ifdef DE - testing_utilities::Check_Results(fiducial_data.gas_energy_specific, test_data.gas_energy_specific, - "gas_energy_specific"); + testing_utilities::Check_Results(fiducial_data.gas_energy, test_data.gas_energy, + "gas_energy"); #endif // DE } From 42fcbb0e3e29077dc21492e215f6206a715e5c04 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 3 Jul 2024 23:14:39 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/reconstruction/plm_cuda.h | 6 +-- src/reconstruction/ppmc_cuda.cu | 48 ++++++++----------- src/reconstruction/reconstruction_internals.h | 23 ++++----- src/riemann_solvers/hll_cuda.cu | 8 ++-- src/riemann_solvers/hllc_cuda.cu | 6 +-- src/utils/hydro_utilities_tests.cpp | 3 +- 6 files changed, 38 insertions(+), 56 deletions(-) diff --git a/src/reconstruction/plm_cuda.h b/src/reconstruction/plm_cuda.h index 2a926dc94..65bd2e305 100644 --- a/src/reconstruction/plm_cuda.h +++ b/src/reconstruction/plm_cuda.h @@ -279,13 +279,11 @@ auto __device__ __inline__ PLM_Reconstruction(Real *dev_conserved, int const xid // Limit the variables that aren't transformed by the characteristic projection #ifdef DE - del_m.gas_energy = Van_Leer_Limiter(del_L.gas_energy, del_R.gas_energy, - del_C.gas_energy, del_G.gas_energy); + del_m.gas_energy = Van_Leer_Limiter(del_L.gas_energy, del_R.gas_energy, del_C.gas_energy, del_G.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - del_m.scalar[i] = Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], - del_C.scalar[i], del_G.scalar[i]); + del_m.scalar[i] = Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], del_C.scalar[i], del_G.scalar[i]); } #endif // SCALAR #else // PLMP diff --git a/src/reconstruction/ppmc_cuda.cu b/src/reconstruction/ppmc_cuda.cu index 53c914783..7e0d0d107 100644 --- a/src/reconstruction/ppmc_cuda.cu +++ b/src/reconstruction/ppmc_cuda.cu @@ -126,13 +126,13 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun // Limit the variables that aren't transformed by the characteristic projection #ifdef DE - del_m_im1.gas_energy = reconstruction::Van_Leer_Limiter( - del_L.gas_energy, del_R.gas_energy, del_C.gas_energy, del_G.gas_energy); + del_m_im1.gas_energy = + reconstruction::Van_Leer_Limiter(del_L.gas_energy, del_R.gas_energy, del_C.gas_energy, del_G.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - del_m_im1.scalar[i] = reconstruction::Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], - del_C.scalar[i], del_G.scalar[i]); + del_m_im1.scalar[i] = + reconstruction::Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], del_C.scalar[i], del_G.scalar[i]); } #endif // SCALAR @@ -179,13 +179,13 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun // Limit the variables that aren't transformed by the characteristic projection #ifdef DE - del_m_i.gas_energy = reconstruction::Van_Leer_Limiter(del_L.gas_energy, del_R.gas_energy, - del_C.gas_energy, del_G.gas_energy); + del_m_i.gas_energy = + reconstruction::Van_Leer_Limiter(del_L.gas_energy, del_R.gas_energy, del_C.gas_energy, del_G.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - del_m_i.scalar[i] = reconstruction::Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], - del_C.scalar[i], del_G.scalar[i]); + del_m_i.scalar[i] = + reconstruction::Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], del_C.scalar[i], del_G.scalar[i]); } #endif // SCALAR @@ -233,13 +233,13 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun // Limit the variables that aren't transformed by the characteristic projection #ifdef DE - del_m_ip1.gas_energy = reconstruction::Van_Leer_Limiter( - del_L.gas_energy, del_R.gas_energy, del_C.gas_energy, del_G.gas_energy); + del_m_ip1.gas_energy = + reconstruction::Van_Leer_Limiter(del_L.gas_energy, del_R.gas_energy, del_C.gas_energy, del_G.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - del_m_ip1.scalar[i] = reconstruction::Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], - del_C.scalar[i], del_G.scalar[i]); + del_m_ip1.scalar[i] = + reconstruction::Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], del_C.scalar[i], del_G.scalar[i]); } #endif // SCALAR @@ -274,16 +274,14 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun #ifdef DE del_m_i.gas_energy = interface_L_iph.gas_energy - interface_R_imh.gas_energy; - Real const ge_6 = 6.0 * (cell_i.gas_energy - - 0.5 * (interface_R_imh.gas_energy + interface_L_iph.gas_energy)); + Real const ge_6 = 6.0 * (cell_i.gas_energy - 0.5 * (interface_R_imh.gas_energy + interface_L_iph.gas_energy)); #endif // DE #ifdef SCALAR Real scalar_6[NSCALARS]; for (int i = 0; i < NSCALARS; i++) { del_m_i.scalar[i] = interface_L_iph.scalar[i] - interface_R_imh.scalar[i]; - scalar_6[i] = 6.0 * (cell_i.scalar[i] - - 0.5 * (interface_R_imh.scalar[i] + interface_L_iph.scalar[i])); + scalar_6[i] = 6.0 * (cell_i.scalar[i] - 0.5 * (interface_R_imh.scalar[i] + interface_L_iph.scalar[i])); } #endif // SCALAR @@ -354,12 +352,10 @@ __global__ void PPMC_CTU(Real *dev_conserved, Real *dev_bounds_L, Real *dev_boun for (int i = 0; i < NSCALARS; i++) { interface_L_iph.scalar[i] = interface_L_iph.scalar[i] - - lambda_max * (0.5 * dtodx) * - (del_m_i.scalar[i] - (1.0 - (2.0 / 3.0) * lambda_max * dtodx) * scalar_6[i]); + lambda_max * (0.5 * dtodx) * (del_m_i.scalar[i] - (1.0 - (2.0 / 3.0) * lambda_max * dtodx) * scalar_6[i]); interface_R_imh.scalar[i] = interface_R_imh.scalar[i] - - lambda_min * (0.5 * dtodx) * - (del_m_i.scalar[i] + (1.0 + (2.0 / 3.0) * lambda_min * dtodx) * scalar_6[i]); + lambda_min * (0.5 * dtodx) * (del_m_i.scalar[i] + (1.0 + (2.0 / 3.0) * lambda_min * dtodx) * scalar_6[i]); } #endif // SCALAR @@ -680,17 +676,13 @@ __global__ __launch_bounds__(TPB) void PPMC_VL(Real *dev_conserved, Real *dev_bo // Compute the interfaces for the variables that don't have characteristics #ifdef DE - reconstruction::PPM_Single_Variable(cell_im2.gas_energy, cell_im1.gas_energy, - cell_i.gas_energy, cell_ip1.gas_energy, - cell_ip2.gas_energy, interface_L_iph.gas_energy, - interface_R_imh.gas_energy); + reconstruction::PPM_Single_Variable(cell_im2.gas_energy, cell_im1.gas_energy, cell_i.gas_energy, cell_ip1.gas_energy, + cell_ip2.gas_energy, interface_L_iph.gas_energy, interface_R_imh.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - reconstruction::PPM_Single_Variable(cell_im2.scalar[i], cell_im1.scalar[i], - cell_i.scalar[i], cell_ip1.scalar[i], - cell_ip2.scalar[i], interface_L_iph.scalar[i], - interface_R_imh.scalar[i]); + reconstruction::PPM_Single_Variable(cell_im2.scalar[i], cell_im1.scalar[i], cell_i.scalar[i], cell_ip1.scalar[i], + cell_ip2.scalar[i], interface_L_iph.scalar[i], interface_R_imh.scalar[i]); } #endif // SCALAR diff --git a/src/reconstruction/reconstruction_internals.h b/src/reconstruction/reconstruction_internals.h index 66ffa677c..2f71dab0e 100644 --- a/src/reconstruction/reconstruction_internals.h +++ b/src/reconstruction/reconstruction_internals.h @@ -650,13 +650,11 @@ hydro_utilities::Primitive __device__ __host__ __inline__ Van_Leer_Limiter(hydro #endif // MHD #ifdef DE - del_m.gas_energy = Van_Leer_Limiter(del_L.gas_energy, del_R.gas_energy, - del_C.gas_energy, del_G.gas_energy); + del_m.gas_energy = Van_Leer_Limiter(del_L.gas_energy, del_R.gas_energy, del_C.gas_energy, del_G.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - del_m.scalar[i] = Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], - del_C.scalar[i], del_G.scalar[i]); + del_m.scalar[i] = Van_Leer_Limiter(del_L.scalar[i], del_R.scalar[i], del_C.scalar[i], del_G.scalar[i]); } #endif // SCALAR @@ -727,13 +725,13 @@ void __device__ __host__ __inline__ Monotonize_Parabolic_Interface(hydro_utiliti #endif // MHD #ifdef DE - Monotonize(cell_i.gas_energy, cell_im1.gas_energy, cell_ip1.gas_energy, - interface_L_iph.gas_energy, interface_R_imh.gas_energy); + Monotonize(cell_i.gas_energy, cell_im1.gas_energy, cell_ip1.gas_energy, interface_L_iph.gas_energy, + interface_R_imh.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - Monotonize(cell_i.scalar[i], cell_im1.scalar[i], cell_ip1.scalar[i], - interface_L_iph.scalar[i], interface_R_imh.scalar[i]); + Monotonize(cell_i.scalar[i], cell_im1.scalar[i], cell_ip1.scalar[i], interface_L_iph.scalar[i], + interface_R_imh.scalar[i]); } #endif // SCALAR } @@ -817,13 +815,11 @@ hydro_utilities::Primitive __device__ __host__ __inline__ Calc_Interface_Parabol #endif // MHD #ifdef DE - output.gas_energy = interface(cell_i.gas_energy, cell_im1.gas_energy, - slopes_i.gas_energy, slopes_im1.gas_energy); + output.gas_energy = interface(cell_i.gas_energy, cell_im1.gas_energy, slopes_i.gas_energy, slopes_im1.gas_energy); #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - output.scalar[i] = interface(cell_i.scalar[i], cell_im1.scalar[i], - slopes_i.scalar[i], slopes_im1.scalar[i]); + output.scalar[i] = interface(cell_i.scalar[i], cell_im1.scalar[i], slopes_i.scalar[i], slopes_im1.scalar[i]); } #endif // SCALAR @@ -1025,8 +1021,7 @@ void __device__ __host__ __inline__ Write_Data(hydro_utilities::Primitive const #endif // DE #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - dev_interface[(grid_enum::scalar + i) * n_cells + id] = - interface_state.density * interface_state.scalar[i]; + dev_interface[(grid_enum::scalar + i) * n_cells + id] = interface_state.density * interface_state.scalar[i]; } #endif // SCALAR } diff --git a/src/riemann_solvers/hll_cuda.cu b/src/riemann_solvers/hll_cuda.cu index 5bf90b281..778a187ad 100644 --- a/src/riemann_solvers/hll_cuda.cu +++ b/src/riemann_solvers/hll_cuda.cu @@ -254,14 +254,12 @@ __global__ void Calculate_HLL_Fluxes_CUDA(Real const *dev_conserved, Real const ((Sr * f_mz_l) - (Sl * f_mz_r) + Sl * Sr * (right_state.momentum.z() - left_state.momentum.z())) / (Sr - Sl); f_E = ((Sr * f_E_l) - (Sl * f_E_r) + Sl * Sr * (right_state.energy - left_state.energy)) / (Sr - Sl); #ifdef DE - Real f_ge = ((Sr * f_ge_l) - (Sl * f_ge_r) + - Sl * Sr * (right_state.gas_energy - left_state.gas_energy)) / - (Sr - Sl); + Real f_ge = + ((Sr * f_ge_l) - (Sl * f_ge_r) + Sl * Sr * (right_state.gas_energy - left_state.gas_energy)) / (Sr - Sl); #endif #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { - f_sc[i] = ((Sr * f_sc_l[i]) - (Sl * f_sc_r[i]) + - Sl * Sr * (right_state.scalar[i] - left_state.scalar[i])) / + f_sc[i] = ((Sr * f_sc_l[i]) - (Sl * f_sc_r[i]) + Sl * Sr * (right_state.scalar[i] - left_state.scalar[i])) / (Sr - Sl); } #endif diff --git a/src/riemann_solvers/hllc_cuda.cu b/src/riemann_solvers/hllc_cuda.cu index de9be4350..10a9f9265 100644 --- a/src/riemann_solvers/hllc_cuda.cu +++ b/src/riemann_solvers/hllc_cuda.cu @@ -307,9 +307,9 @@ __global__ void Calculate_HLLC_Fluxes_CUDA(Real const *dev_conserved, Real const f_E = 0.5 * (f_E_l + f_E_r + (Sr - fabs(Sm)) * Ers + (Sl + fabs(Sm)) * Els - Sl * left_state.energy - Sr * right_state.energy); #ifdef DE - Real f_ge = 0.5 * (f_ge_l + f_ge_r + (Sr - fabs(Sm)) * gers + (Sl + fabs(Sm)) * gels - - Sl * left_state.gas_energy * left_state.density - - Sr * right_state.gas_energy * right_state.density); + Real f_ge = + 0.5 * (f_ge_l + f_ge_r + (Sr - fabs(Sm)) * gers + (Sl + fabs(Sm)) * gels - + Sl * left_state.gas_energy * left_state.density - Sr * right_state.gas_energy * right_state.density); #endif #ifdef SCALAR for (int i = 0; i < NSCALARS; i++) { diff --git a/src/utils/hydro_utilities_tests.cpp b/src/utils/hydro_utilities_tests.cpp index 7b1b6fccd..d369255a9 100644 --- a/src/utils/hydro_utilities_tests.cpp +++ b/src/utils/hydro_utilities_tests.cpp @@ -425,8 +425,7 @@ TEST(tALLConserved2Primitive, CorrectInputExpectCorrectOutput) testing_utilities::Check_Results(fiducial_data.magnetic.z(), test_data.magnetic.z(), "magnetic.z"); #endif // MHD #ifdef DE - testing_utilities::Check_Results(fiducial_data.gas_energy, test_data.gas_energy, - "gas_energy"); + testing_utilities::Check_Results(fiducial_data.gas_energy, test_data.gas_energy, "gas_energy"); #endif // DE }