Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove _specific in the Member Names of Structs #397

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/reconstruction/pcm_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
30 changes: 14 additions & 16 deletions src/reconstruction/plm_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
}
Expand All @@ -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

Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down Expand Up @@ -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_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
Expand Down
88 changes: 40 additions & 48 deletions src/reconstruction/ppmc_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -273,17 +273,15 @@ __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

Expand Down Expand Up @@ -342,24 +340,22 @@ __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] -
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] -
lambda_min * (0.5 * dtodx) *
(del_m_i.scalar_specific[i] + (1.0 + (2.0 / 3.0) * lambda_min * dtodx) * scalar_6[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]);
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]);
}
#endif // SCALAR

Expand Down Expand Up @@ -404,11 +400,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

Expand Down Expand Up @@ -446,11 +442,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

Expand Down Expand Up @@ -492,11 +488,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

Expand Down Expand Up @@ -534,11 +530,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

Expand Down Expand Up @@ -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_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

Expand Down
Loading
Loading