From deef210e2d2215dd4ec20be334bbe6ec6313cb90 Mon Sep 17 00:00:00 2001 From: helenarichie Date: Mon, 10 Jul 2023 18:12:06 -0400 Subject: [PATCH 01/13] change function names to conform to Cholla naming standards and turn on readability-identifier-naming check --- .clang-tidy | 21 +- run_check.sh | 11 + src/analysis/feedback_analysis_gpu.cu | 6 +- src/global/global.cpp | 36 +- src/global/global.h | 10 +- src/gravity/paris/ParisPeriodic.cu | 20 +- src/gravity/paris/PoissonZero3DBlockedGPU.cu | 26 +- src/gravity/potential_paris_3D.cu | 2 +- src/hydro/hydro_cuda_tests.cu | 4 +- src/io/io.cpp | 78 +-- src/io/io.h | 18 +- src/io/io_gpu.cu | 4 +- src/main.cpp | 18 +- src/main_tests.cpp | 20 +- src/mhd/ct_electric_fields_tests.cu | 10 +- src/mhd/magnetic_divergence_tests.cu | 2 +- src/mhd/magnetic_update_tests.cu | 6 +- src/model/disk_ICs.cpp | 132 ++--- src/particles/feedback_CIC_gpu.cu | 18 +- src/reconstruction/plmc_cuda_tests.cu | 8 +- src/reconstruction/reconstruction_tests.cu | 164 +++--- src/riemann_solvers/hllc_cuda_tests.cu | 8 +- src/riemann_solvers/hlld_cuda_tests.cu | 554 +++++++++---------- src/system_tests/hydro_system_tests.cpp | 12 +- src/system_tests/mhd_system_tests.cpp | 30 +- src/utils/DeviceVector_tests.cu | 10 +- src/utils/cuda_utilities_tests.cpp | 2 +- src/utils/hydro_utilities_tests.cpp | 22 +- src/utils/math_utilities_tests.cpp | 8 +- src/utils/mhd_utilities_tests.cu | 32 +- src/utils/reduction_utilities_tests.cu | 2 +- src/utils/testing_utilities.cpp | 2 +- src/utils/testing_utilities.h | 4 +- src/utils/timing_functions.cpp | 8 +- 34 files changed, 659 insertions(+), 649 deletions(-) create mode 100644 run_check.sh diff --git a/.clang-tidy b/.clang-tidy index eccdfe06e..af3796ff8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -122,7 +122,6 @@ Checks: "*, -readability-else-after-return, -readability-function-cognitive-complexity, -readability-identifier-length, - -readability-identifier-naming, -readability-implicit-bool-conversion, -readability-inconsistent-declaration-parameter-name, -readability-isolate-declaration, @@ -149,23 +148,23 @@ CheckOptions: # - aNy_CasE # # Entries that are commented out probably aren't needed but it should be verified - readability-identifier-naming.VariableCase: 'lower_case' + # readability-identifier-naming.VariableCase: 'lower_case' readability-identifier-naming.FunctionCase: 'Camel_Snake_Case' readability-identifier-naming.NamespaceCase: 'lower_case' - readability-identifier-naming.MacroDefinitionCase: 'UPPER_CASE' - readability-identifier-naming.TypedefCase: 'CamelCase' - readability-identifier-naming.TypeAliasCase: 'CamelCase' + # readability-identifier-naming.MacroDefinitionCase: 'UPPER_CASE' + # readability-identifier-naming.TypedefCase: 'CamelCase' + # readability-identifier-naming.TypeAliasCase: 'CamelCase' readability-identifier-naming.EnumCase: 'CamelCase' - readability-identifier-naming.ConstantCase: 'lower_case' + # readability-identifier-naming.ConstantCase: 'lower_case' - readability-identifier-naming.ConstantPrefix: 'k_' - readability-identifier-naming.GlobalVariablePrefix: 'g_' + # readability-identifier-naming.ConstantPrefix: 'k_' + # readability-identifier-naming.GlobalVariablePrefix: 'g_' - readability-identifier-naming.ClassCase: 'CamelCase' + # readability-identifier-naming.ClassCase: 'CamelCase' # readability-identifier-naming.MemberCase: 'lower_case' # readability-identifier-naming.MethodCase: 'CamelCase' - readability-identifier-naming.PrivateMemberSuffix: '_' - readability-identifier-naming.PrivateMethodSuffix: '_' + # readability-identifier-naming.PrivateMemberSuffix: '_' + # readability-identifier-naming.PrivateMethodSuffix: '_' # readability-identifier-naming.StructCase: 'CamelCase' ... diff --git a/run_check.sh b/run_check.sh new file mode 100644 index 000000000..01168bf12 --- /dev/null +++ b/run_check.sh @@ -0,0 +1,11 @@ +cd /ix/eschneider/helena/code/cholla + +make tidy TYPE=hydro & +make tidy TYPE=gravity & +make tidy TYPE=disk & +make tidy TYPE=particles & +make tidy TYPE=cosmology & +make tidy TYPE=mhd & +make tidy TYPE=dust & + +wait diff --git a/src/analysis/feedback_analysis_gpu.cu b/src/analysis/feedback_analysis_gpu.cu index 9ef268216..778ee921c 100644 --- a/src/analysis/feedback_analysis_gpu.cu +++ b/src/analysis/feedback_analysis_gpu.cu @@ -11,7 +11,7 @@ #define MIN_DENSITY (0.01 * MP * MU * LENGTH_UNIT * LENGTH_UNIT * LENGTH_UNIT / MASS_UNIT) // 148279.7 #define TPB_ANALYSIS 1024 -__device__ void warpReduce(volatile Real *buff, size_t tid) +__device__ void Warp_Reduce(volatile Real *buff, size_t tid) { if (TPB_ANALYSIS >= 64) { buff[tid] += buff[tid + 32]; @@ -125,8 +125,8 @@ void __global__ Reduce_Tubulence_kernel_2(Real *input_m, Real *input_v, Real *ou } if (tid < 32) { - warpReduce(s_mass, tid); - warpReduce(s_vel, tid); + Warp_Reduce(s_mass, tid); + Warp_Reduce(s_vel, tid); } __syncthreads(); diff --git a/src/global/global.cpp b/src/global/global.cpp index a4c697d3c..ac0f20222 100644 --- a/src/global/global.cpp +++ b/src/global/global.cpp @@ -35,18 +35,18 @@ void Set_Gammas(Real gamma_in) gama = gamma_in; } -/*! \fn double get_time(void) +/*! \fn double Get_Time(void) * \brief Returns the current clock time. */ -double get_time(void) +double Get_Time(void) { struct timeval timer; gettimeofday(&timer, NULL); return timer.tv_sec + 1.0e-6 * timer.tv_usec; } -/*! \fn int sgn +/*! \fn int Sgn * \brief Mathematical sign function. Returns sign of x. */ -int sgn(Real x) +int Sgn(Real x) { if (x < 0) { return -1; @@ -58,7 +58,7 @@ int sgn(Real x) #ifndef CUDA /*! \fn Real calc_eta(Real cW[], Real gamma) * \brief Calculate the eta value for the H correction. */ -Real calc_eta(Real cW[], Real gamma) +Real Calc_Eta(Real cW[], Real gamma) { Real pl, pr, al, ar; @@ -74,9 +74,9 @@ Real calc_eta(Real cW[], Real gamma) } #endif // NO CUDA -/*! \fn char trim(char *s) +/*! \fn char Trim(char *s) * \brief Gets rid of trailing and leading whitespace. */ -char *trim(char *s) +char *Trim(char *s) { /* Initialize start, end pointers */ char *s1 = s, *s2 = &s[strlen(s) - 1]; @@ -103,10 +103,10 @@ const std::set optionalParams = { "delta", "nzr", "nxr", "H0", "Omega_M", "Omega_L", "Init_redshift", "End_redshift", "tile_length", "n_proc_x", "n_proc_y", "n_proc_z"}; -/*! \fn int is_param_valid(char *name); +/*! \fn int Is_Param_Valid(char *name); * \brief Verifies that a param is valid (even if not needed). Avoids * "warnings" in output. */ -int is_param_valid(const char *param_name) +int Is_Param_Valid(const char *param_name) { // for (auto optionalParam = optionalParams.begin(); optionalParam != optionalParams.end(); ++optionalParam) { for (const auto *optionalParam : optionalParams) { @@ -117,11 +117,11 @@ int is_param_valid(const char *param_name) return 0; } -void parse_param(char *name, char *value, struct parameters *parms); +void Parse_Param(char *name, char *value, struct parameters *parms); -/*! \fn void parse_params(char *param_file, struct parameters * parms); +/*! \fn void Parse_Params(char *param_file, struct parameters * parms); * \brief Reads the parameters in the given file into a structure. */ -void parse_params(char *param_file, struct parameters *parms, int argc, char **argv) +void Parse_Params(char *param_file, struct parameters *parms, int argc, char **argv) { int buf; char *s, buff[256]; @@ -174,8 +174,8 @@ void parse_params(char *param_file, struct parameters *parms, int argc, char **a } else { strncpy(value, s, MAXLEN); } - trim(value); - parse_param(name, value, parms); + Trim(value); + Parse_Param(name, value, parms); } /* Close file */ fclose(fp); @@ -195,14 +195,14 @@ void parse_params(char *param_file, struct parameters *parms, int argc, char **a } else { strncpy(value, s, MAXLEN); } - parse_param(name, value, parms); + Parse_Param(name, value, parms); chprintf("Override with %s=%s\n", name, value); } } -/*! \fn void parse_param(char *name,char *value, struct parameters *parms); +/*! \fn void Parse_Param(char *name,char *value, struct parameters *parms); * \brief Parses and sets a single param based on name and value. */ -void parse_param(char *name, char *value, struct parameters *parms) +void Parse_Param(char *name, char *value, struct parameters *parms) { /* Copy into correct entry in parameters struct */ if (strcmp(name, "nx") == 0) { @@ -451,7 +451,7 @@ void parse_param(char *name, char *value, struct parameters *parms) strncpy(parms->skewersdir, value, MAXLEN); #endif #endif - } else if (!is_param_valid(name)) { + } else if (!Is_Param_Valid(name)) { chprintf("WARNING: %s/%s: Unknown parameter/value pair!\n", name, value); } } diff --git a/src/global/global.h b/src/global/global.h index b037c931d..66fb78829 100644 --- a/src/global/global.h +++ b/src/global/global.h @@ -162,16 +162,16 @@ extern void Set_Gammas(Real gamma_in); /*! \fn double get_time(void) * \brief Returns the current clock time. */ -extern double get_time(void); +extern double Get_Time(void); /*! \fn int sgn * \brief Mathematical sign function. Returns sign of x. */ -extern int sgn(Real x); +extern int Sgn(Real x); #ifndef CUDA /*! \fn Real calc_eta(Real cW[], Real gamma) * \brief Calculate the eta value for the H correction. */ -extern Real calc_eta(Real cW[], Real gamma); +extern Real Calc_Eta(Real cW[], Real gamma); #endif struct parameters { @@ -326,11 +326,11 @@ struct parameters { /*! \fn void parse_params(char *param_file, struct parameters * parms); * \brief Reads the parameters in the given file into a structure. */ -extern void parse_params(char *param_file, struct parameters *parms, int argc, char **argv); +extern void Parse_Params(char *param_file, struct parameters *parms, int argc, char **argv); /*! \fn int is_param_valid(char *name); * \brief Verifies that a param is valid (even if not needed). Avoids * "warnings" in output. */ -extern int is_param_valid(const char *name); +extern int Is_Param_Valid(const char *name); #endif // GLOBAL_H diff --git a/src/gravity/paris/ParisPeriodic.cu b/src/gravity/paris/ParisPeriodic.cu index 0686626c6..0b2e5ef5a 100644 --- a/src/gravity/paris/ParisPeriodic.cu +++ b/src/gravity/paris/ParisPeriodic.cu @@ -4,7 +4,7 @@ #include "ParisPeriodic.hpp" -__host__ __device__ static inline double sqr(const double x) { return x * x; } +__host__ __device__ static inline double Sqr(const double x) { return x * x; } ParisPeriodic::ParisPeriodic(const int n[3], const double lo[3], const double hi[3], const int m[3], const int id[3]) : ni_(n[0]), @@ -16,9 +16,9 @@ ParisPeriodic::ParisPeriodic(const int n[3], const double lo[3], const double hi ddk_(2.0 * double(n[2] - 1) / (hi[2] - lo[2])), #elif defined PARIS_5PT nk_(n[2]), - ddi_(sqr(double(n[0] - 1) / (hi[0] - lo[0])) / 6.0), - ddj_(sqr(double(n[1] - 1) / (hi[1] - lo[1])) / 6.0), - ddk_(sqr(double(n[2] - 1) / (hi[2] - lo[2])) / 6.0), + ddi_(Sqr(double(n[0] - 1) / (hi[0] - lo[0])) / 6.0), + ddj_(Sqr(double(n[1] - 1) / (hi[1] - lo[1])) / 6.0), + ddk_(Sqr(double(n[2] - 1) / (hi[2] - lo[2])) / 6.0), #else ddi_{2.0 * M_PI * double(n[0] - 1) / (double(n[0]) * (hi[0] - lo[0]))}, ddj_{2.0 * M_PI * double(n[1] - 1) / (double(n[1]) * (hi[1] - lo[1]))}, @@ -52,9 +52,9 @@ void ParisPeriodic::solve(const size_t bytes, double *const density, double *con [=] __device__(const int i, const int j, const int k, const cufftDoubleComplex b) { if (i || j || k) { #ifdef PARIS_3PT - const double i2 = sqr(sin(double(min(i, ni - i)) * si) * ddi); - const double j2 = sqr(sin(double(min(j, nj - j)) * sj) * ddj); - const double k2 = sqr(sin(double(k) * sk) * ddk); + const double i2 = Sqr(sin(double(min(i, ni - i)) * si) * ddi); + const double j2 = Sqr(sin(double(min(j, nj - j)) * sj) * ddj); + const double k2 = Sqr(sin(double(k) * sk) * ddk); #elif defined PARIS_5PT const double ci = cos(double(min(i, ni - i)) * si); const double cj = cos(double(min(j, nj - j)) * sj); @@ -63,9 +63,9 @@ void ParisPeriodic::solve(const size_t bytes, double *const density, double *con const double j2 = ddj * (2.0 * cj * cj - 16.0 * cj + 14.0); const double k2 = ddk * (2.0 * ck * ck - 16.0 * ck + 14.0); #else - const double i2 = sqr(double(min(i, ni - i)) * ddi); - const double j2 = sqr(double(min(j, nj - j)) * ddj); - const double k2 = sqr(double(k) * ddk); + const double i2 = Sqr(double(min(i, ni - i)) * ddi); + const double j2 = Sqr(double(min(j, nj - j)) * ddj); + const double k2 = Sqr(double(k) * ddk); #endif const double d = -1.0 / (i2 + j2 + k2); return cufftDoubleComplex{d * b.x, d * b.y}; diff --git a/src/gravity/paris/PoissonZero3DBlockedGPU.cu b/src/gravity/paris/PoissonZero3DBlockedGPU.cu index 5ad31406e..e924ca30e 100644 --- a/src/gravity/paris/PoissonZero3DBlockedGPU.cu +++ b/src/gravity/paris/PoissonZero3DBlockedGPU.cu @@ -10,7 +10,7 @@ static constexpr double sqrt2 = 0.4142135623730950488016887242096980785696718753769480731766797379; -static inline __host__ __device__ double sqr(const double x) { return x * x; } +static inline __host__ __device__ double Sqr(const double x) { return x * x; } PoissonZero3DBlockedGPU::PoissonZero3DBlockedGPU(const int n[3], const double lo[3], const double hi[3], const int m[3], const int id[3]) @@ -20,9 +20,9 @@ PoissonZero3DBlockedGPU::PoissonZero3DBlockedGPU(const int n[3], const double lo ddj_(2.0 * double(n[1] - 1) / (hi[1] - lo[1])), ddk_(2.0 * double(n[2] - 1) / (hi[2] - lo[2])), #elif defined PARIS_GALACTIC_5PT - ddi_(sqr(double(n[0] - 1) / (hi[0] - lo[0])) / 6.0), - ddj_(sqr(double(n[1] - 1) / (hi[1] - lo[1])) / 6.0), - ddk_(sqr(double(n[2] - 1) / (hi[2] - lo[2])) / 6.0), + ddi_(Sqr(double(n[0] - 1) / (hi[0] - lo[0])) / 6.0), + ddj_(Sqr(double(n[1] - 1) / (hi[1] - lo[1])) / 6.0), + ddk_(Sqr(double(n[2] - 1) / (hi[2] - lo[2])) / 6.0), #else ddi_{M_PI * double(n[0] - 1) / (double(n[0]) * (hi[0] - lo[0]))}, ddj_{M_PI * double(n[1] - 1) / (double(n[1]) * (hi[1] - lo[1]))}, @@ -38,7 +38,7 @@ PoissonZero3DBlockedGPU::PoissonZero3DBlockedGPU(const int n[3], const double lo nj_(n[1]), nk_(n[2]) { - mq_ = int(round(sqrt(mk_))); + mq_ = int(round(Sqrt(mk_))); while (mk_ % mq_) { mq_--; } @@ -302,7 +302,7 @@ void PoissonZero3DBlockedGPU::solve(const long bytes, double *const density, dou const double si = M_PI / double(ni + ni); const double sj = M_PI / double(nj + nj); const double sk = M_PI / double(nk + nk); - const double iin = sqr(sin(double(ni) * si) * ddi); + const double iin = Sqr(sin(double(ni) * si) * ddi); #elif defined PARIS_GALACTIC_5PT const double si = M_PI / double(ni); const double sj = M_PI / double(nj); @@ -310,7 +310,7 @@ void PoissonZero3DBlockedGPU::solve(const long bytes, double *const density, dou const double cin = cos(double(ni) * si); const double iin = ddi * (2.0 * cin * cin - 16.0 * cin + 14.0); #else - const double iin = sqr(double(ni) * ddi); + const double iin = Sqr(double(ni) * ddi); #endif const int jLo = (idi * mp + idp) * djp; const int kLo = (idj * mq + idq) * dkq; @@ -319,7 +319,7 @@ void PoissonZero3DBlockedGPU::solve(const long bytes, double *const density, dou const int kj = (k * djp + j) * ni; const int kj2 = (k * djp + j) * ni2; #ifdef PARIS_GALACTIC_3PT - const double jjkk = sqr(sin(double(jLo + j + 1) * sj) * ddj) + sqr(sin(double(kLo + k + 1) * sk) * ddk); + const double jjkk = Sqr(sin(double(jLo + j + 1) * sj) * ddj) + Sqr(sin(double(kLo + k + 1) * sk) * ddk); #elif defined PARIS_GALACTIC_5PT const double cj = cos(double(jLo + j + 1) * sj); const double jj = ddj * (2.0 * cj * cj - 16.0 * cj + 14.0); @@ -328,18 +328,18 @@ void PoissonZero3DBlockedGPU::solve(const long bytes, double *const density, dou const double jjkk = jj + kk; #else const double jjkk = - sqr(double(jLo + j + 1) * ddj) + sqr(double(kLo + k + 1) * ddk); + Sqr(double(jLo + j + 1) * ddj) + Sqr(double(kLo + k + 1) * ddk); #endif if (i == 0) { ua[kj] = -2.0 * ub[kj2] / (iin + jjkk); } else { #ifdef PARIS_GALACTIC_3PT - const double ii = sqr(sin(double(i) * si) * ddi); + const double ii = Sqr(sin(double(i) * si) * ddi); #elif defined PARIS_GALACTIC_5PT const double ci = cos(double(i) * si); const double ii = ddi * (2.0 * ci * ci - 16.0 * ci + 14.0); #else - const double ii = sqr(double(i) * ddi); + const double ii = Sqr(double(i) * ddi); #endif if (i + i == ni) { ua[kj + ni / 2] = -2.0 * ub[kj2 + ni] / (ii + jjkk); @@ -349,12 +349,12 @@ void PoissonZero3DBlockedGPU::solve(const long bytes, double *const density, dou double wa, wb; sincospi(double(i) / double(ni + ni), &wb, &wa); #ifdef PARIS_GALACTIC_3PT - const double nii = sqr(sin(double(ni - i) * si) * ddi); + const double nii = Sqr(sin(double(ni - i) * si) * ddi); #elif defined PARIS_GALACTIC_5PT const double cni = cos(double(ni - i) * si); const double nii = ddi * (2.0 * cni * cni - 16.0 * cni + 14.0); #else - const double nii = sqr(double(ni - i) * ddi); + const double nii = Sqr(double(ni - i) * ddi); #endif const double aai = -(wa * ai + wb * bi) / (nii + jjkk); const double bbi = (wa * bi - wb * ai) / (ii + jjkk); diff --git a/src/gravity/potential_paris_3D.cu b/src/gravity/potential_paris_3D.cu index ab8bdc0b5..51d967a9d 100644 --- a/src/gravity/potential_paris_3D.cu +++ b/src/gravity/potential_paris_3D.cu @@ -9,7 +9,7 @@ #include "../utils/gpu.hpp" static void __attribute__((unused)) -printDiff(const Real *p, const Real *q, const int ng, const int nx, const int ny, const int nz, const bool plot = false) +Print_Diff(const Real *p, const Real *q, const int ng, const int nx, const int ny, const int nz, const bool plot = false) { Real dMax = 0, dSum = 0, dSum2 = 0; Real qMax = 0, qSum = 0, qSum2 = 0; diff --git a/src/hydro/hydro_cuda_tests.cu b/src/hydro/hydro_cuda_tests.cu index 482564462..48d11b0c3 100644 --- a/src/hydro/hydro_cuda_tests.cu +++ b/src/hydro/hydro_cuda_tests.cu @@ -106,7 +106,7 @@ TEST(tHYDROHydroInverseCrossingTime, CorrectInputExpectCorrectOutput) velocityZ, cellSizeX, cellSizeY, cellSizeZ, gamma); // Check results - testingUtilities::checkResults(fiducialInverseCrossingTime, testInverseCrossingTime, "inverse crossing time"); + testingUtilities::Check_Results(fiducialInverseCrossingTime, testInverseCrossingTime, "inverse crossing time"); } // ============================================================================= // End of tests for the hydroInverseCrossingTime function @@ -140,7 +140,7 @@ TEST(tMHDMhdInverseCrossingTime, CorrectInputExpectCorrectOutput) magneticZ, cellSizeX, cellSizeY, cellSizeZ, gamma); // Check results - testingUtilities::checkResults(fiducialInverseCrossingTime, testInverseCrossingTime, "inverse crossing time"); + testingUtilities::Check_Results(fiducialInverseCrossingTime, testInverseCrossingTime, "inverse crossing time"); } // ============================================================================= // End of tests for the mhdInverseCrossingTime function diff --git a/src/io/io.cpp b/src/io/io.cpp index 3335afda7..690f8d3fc 100644 --- a/src/io/io.cpp +++ b/src/io/io.cpp @@ -30,7 +30,7 @@ /* function used to rotate points about an axis in 3D for the rotated projection * output routine */ -void rotate_point(Real x, Real y, Real z, Real delta, Real phi, Real theta, Real *xp, Real *yp, Real *zp); +void Rotate_Point(Real x, Real y, Real z, Real delta, Real phi, Real theta, Real *xp, Real *yp, Real *zp); void Create_Log_File(struct parameters P) { @@ -78,7 +78,7 @@ void Write_Message_To_Log_File(const char *message) } /* Write Cholla Output Data */ -void WriteData(Grid3D &G, struct parameters P, int nfile) +void Write_Data(Grid3D &G, struct parameters P, int nfile) { cudaMemcpy(G.C.density, G.C.device, G.H.n_fields * G.H.n_cells * sizeof(Real), cudaMemcpyDeviceToHost); @@ -110,32 +110,32 @@ void WriteData(Grid3D &G, struct parameters P, int nfile) #ifndef ONLY_PARTICLES /*call the data output routine for Hydro data*/ if (nfile % P.n_hydro == 0) { - OutputData(G, P, nfile); + Output_Data(G, P, nfile); } #endif // This function does other checks to make sure it is valid (3D only) #ifdef HDF5 if (P.n_out_float32 && nfile % P.n_out_float32 == 0) { - OutputFloat32(G, P, nfile); + Output_Float32(G, P, nfile); } #endif #ifdef PROJECTION if (nfile % P.n_projection == 0) { - OutputProjectedData(G, P, nfile); + Output_Projected_Data(G, P, nfile); } #endif /*PROJECTION*/ #ifdef ROTATED_PROJECTION if (nfile % P.n_rotated_projection == 0) { - OutputRotatedProjectedData(G, P, nfile); + Output_Rotated_Projected_Data(G, P, nfile); } #endif /*ROTATED_PROJECTION*/ #ifdef SLICES if (nfile % P.n_slice == 0) { - OutputSlices(G, P, nfile); + Output_Slices(G, P, nfile); } #endif /*SLICES*/ @@ -179,7 +179,7 @@ void WriteData(Grid3D &G, struct parameters P, int nfile) } /* Output the grid data to file. */ -void OutputData(Grid3D &G, struct parameters P, int nfile) +void Output_Data(Grid3D &G, struct parameters P, int nfile) { // create the filename std::string filename(P.outdir); @@ -257,7 +257,7 @@ void OutputData(Grid3D &G, struct parameters P, int nfile) #endif } -void OutputFloat32(Grid3D &G, struct parameters P, int nfile) +void Output_Float32(Grid3D &G, struct parameters P, int nfile) { #ifdef HDF5 Header H = G.H; @@ -315,28 +315,28 @@ void OutputFloat32(Grid3D &G, struct parameters P, int nfile) auto *dataset_buffer = (float *)malloc(buffer_size * sizeof(float)); if (P.out_float32_density > 0) { - WriteHDF5Field3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, device_dataset_vector.data(), G.C.d_density, "/density"); } if (P.out_float32_momentum_x > 0) { - WriteHDF5Field3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, device_dataset_vector.data(), G.C.d_momentum_x, "/momentum_x"); } if (P.out_float32_momentum_y > 0) { - WriteHDF5Field3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, device_dataset_vector.data(), G.C.d_momentum_y, "/momentum_y"); } if (P.out_float32_momentum_z > 0) { - WriteHDF5Field3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, device_dataset_vector.data(), G.C.d_momentum_z, "/momentum_z"); } if (P.out_float32_Energy > 0) { - WriteHDF5Field3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, device_dataset_vector.data(), G.C.d_Energy, "/Energy"); } #ifdef DE if (P.out_float32_GasEnergy > 0) { - WriteHDF5Field3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, device_dataset_vector.data(), G.C.d_GasEnergy, "/GasEnergy"); } #endif // DE @@ -345,17 +345,17 @@ void OutputFloat32(Grid3D &G, struct parameters P, int nfile) // TODO (by Alwin, for anyone) : Repair output format if needed and remove these chprintfs when appropriate if (P.out_float32_magnetic_x > 0) { chprintf("WARNING: MHD float-32 output has a different output format than float-64\n"); - WriteHDF5Field3D(H.nx, H.ny, nx_dset + 1, ny_dset + 1, nz_dset + 1, H.n_ghost - 1, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, nx_dset + 1, ny_dset + 1, nz_dset + 1, H.n_ghost - 1, file_id, dataset_buffer, device_dataset_vector.data(), G.C.d_magnetic_x, "/magnetic_x"); } if (P.out_float32_magnetic_y > 0) { chprintf("WARNING: MHD float-32 output has a different output format than float-64\n"); - WriteHDF5Field3D(H.nx, H.ny, nx_dset + 1, ny_dset + 1, nz_dset + 1, H.n_ghost - 1, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, nx_dset + 1, ny_dset + 1, nz_dset + 1, H.n_ghost - 1, file_id, dataset_buffer, device_dataset_vector.data(), G.C.d_magnetic_y, "/magnetic_y"); } if (P.out_float32_magnetic_z > 0) { chprintf("WARNING: MHD float-32 output has a different output format than float-64\n"); - WriteHDF5Field3D(H.nx, H.ny, nx_dset + 1, ny_dset + 1, nz_dset + 1, H.n_ghost - 1, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, nx_dset + 1, ny_dset + 1, nz_dset + 1, H.n_ghost - 1, file_id, dataset_buffer, device_dataset_vector.data(), G.C.d_magnetic_z, "/magnetic_z"); } @@ -375,7 +375,7 @@ void OutputFloat32(Grid3D &G, struct parameters P, int nfile) } /* Output a projection of the grid data to file. */ -void OutputProjectedData(Grid3D &G, struct parameters P, int nfile) +void Output_Projected_Data(Grid3D &G, struct parameters P, int nfile) { #ifdef HDF5 hid_t file_id; @@ -404,23 +404,23 @@ void OutputProjectedData(Grid3D &G, struct parameters P, int nfile) #ifdef MPI_CHOLLA if (status < 0) { - printf("OutputProjectedData: File write failed. ProcID: %d\n", procID); + printf("Output_Projected_Data: File write failed. ProcID: %d\n", procID); chexit(-1); } #else if (status < 0) { - printf("OutputProjectedData: File write failed.\n"); + printf("Output_Projected_Data: File write failed.\n"); exit(-1); } #endif #else - printf("OutputProjected Data only defined for hdf5 writes.\n"); + printf("Output_Projected_Data only defined for hdf5 writes.\n"); #endif // HDF5 } /* Output a rotated projection of the grid data to file. */ -void OutputRotatedProjectedData(Grid3D &G, struct parameters P, int nfile) +void Output_Rotated_Projected_Data(Grid3D &G, struct parameters P, int nfile) { #ifdef HDF5 hid_t file_id; @@ -461,12 +461,12 @@ void OutputRotatedProjectedData(Grid3D &G, struct parameters P, int nfile) status = H5Fclose(file_id); #ifdef MPI_CHOLLA if (status < 0) { - printf("OutputRotatedProjectedData: File write failed. ProcID: %d\n", procID); + printf("Output_Rotated_Projected_Data: File write failed. ProcID: %d\n", procID); chexit(-1); } #else if (status < 0) { - printf("OutputRotatedProjectedData: File write failed.\n"); + printf("Output_Rotated_Projected_Data: File write failed.\n"); exit(-1); } #endif @@ -509,23 +509,23 @@ void OutputRotatedProjectedData(Grid3D &G, struct parameters P, int nfile) #ifdef MPI_CHOLLA if (status < 0) { - printf("OutputRotatedProjectedData: File write failed. ProcID: %d\n", procID); + printf("Output_Rotated_Projected_Data: File write failed. ProcID: %d\n", procID); chexit(-1); } #else if (status < 0) { - printf("OutputRotatedProjectedData: File write failed.\n"); + printf("Output_Rotated_Projected_Data: File write failed.\n"); exit(-1); } #endif #else - printf("OutputRotatedProjectedData only defined for HDF5 writes.\n"); + printf("Output_Rotated_Projected_Data only defined for HDF5 writes.\n"); #endif } /* Output xy, xz, and yz slices of the grid data. */ -void OutputSlices(Grid3D &G, struct parameters P, int nfile) +void Output_Slices(Grid3D &G, struct parameters P, int nfile) { #ifdef HDF5 hid_t file_id; @@ -554,17 +554,17 @@ void OutputSlices(Grid3D &G, struct parameters P, int nfile) #ifdef MPI_CHOLLA if (status < 0) { - printf("OutputSlices: File write failed. ProcID: %d\n", procID); + printf("Output_Slices: File write failed. ProcID: %d\n", procID); chexit(-1); } #else // MPI_CHOLLA is not defined if (status < 0) { - printf("OutputSlices: File write failed.\n"); + printf("Output_Slices: File write failed.\n"); exit(-1); } #endif // MPI_CHOLLA #else // HDF5 is not defined - printf("OutputSlices only defined for hdf5 writes.\n"); + printf("Output_Slices only defined for hdf5 writes.\n"); #endif // HDF5 } @@ -773,7 +773,7 @@ void Grid3D::Write_Header_Rotated_HDF5(hid_t file_id) Get_Position(H.n_ghost + i * (H.nx - 2 * H.n_ghost), H.n_ghost + j * (H.ny - 2 * H.n_ghost), H.n_ghost + k * (H.nz - 2 * H.n_ghost), &x, &y, &z); // rotate cell position - rotate_point(x, y, z, R.delta, R.phi, R.theta, &xp, &yp, &zp); + Rotate_Point(x, y, z, R.delta, R.phi, R.theta, &xp, &yp, &zp); // find projected location // assumes box centered at [0,0,0] alpha = (R.nx * (xp + 0.5 * R.Lx) / R.Lx); @@ -1491,11 +1491,11 @@ void Grid3D::Write_Grid_HDF5(hid_t file_id) #ifdef MHD if (H.Output_Complete_Data) { - WriteHDF5Field3D(H.nx, H.ny, H.nx_real + 1, H.ny_real, H.nz_real, H.n_ghost, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, H.nx_real + 1, H.ny_real, H.nz_real, H.n_ghost, file_id, dataset_buffer, device_dataset_vector.data(), C.d_magnetic_x, "/magnetic_x", 0); - WriteHDF5Field3D(H.nx, H.ny, H.nx_real, H.ny_real + 1, H.nz_real, H.n_ghost, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, H.nx_real, H.ny_real + 1, H.nz_real, H.n_ghost, file_id, dataset_buffer, device_dataset_vector.data(), C.d_magnetic_y, "/magnetic_y", 1); - WriteHDF5Field3D(H.nx, H.ny, H.nx_real, H.ny_real, H.nz_real + 1, H.n_ghost, file_id, dataset_buffer, + Write_HDF5_Field_3D(H.nx, H.ny, H.nx_real, H.ny_real, H.nz_real + 1, H.n_ghost, file_id, dataset_buffer, device_dataset_vector.data(), C.d_magnetic_z, "/magnetic_z", 2); } #endif // MHD @@ -1736,7 +1736,7 @@ void Grid3D::Write_Rotated_Projection_HDF5(hid_t file_id) z += eps * H.dz * (drand48() - 0.5); // rotate cell positions - rotate_point(x, y, z, R.delta, R.phi, R.theta, &xp, &yp, &zp); + Rotate_Point(x, y, z, R.delta, R.phi, R.theta, &xp, &yp, &zp); // find projected locations // assumes box centered at [0,0,0] @@ -2601,7 +2601,7 @@ int chprintf(const char *__restrict sdata, ...) // NOLINT(cert-dcl50-cpp) return code; } -void rotate_point(Real x, Real y, Real z, Real delta, Real phi, Real theta, Real *xp, Real *yp, Real *zp) +void Rotate_Point(Real x, Real y, Real z, Real delta, Real phi, Real theta, Real *xp, Real *yp, Real *zp) { Real cd, sd, cp, sp, ct, st; // sines and cosines Real a00, a01, a02; // rotation matrix elements @@ -2643,7 +2643,7 @@ void rotate_point(Real x, Real y, Real z, Real delta, Real phi, Real theta, Real *zp = a20 * x + a21 * y + a22 * z; } -void write_debug(Real *Value, const char *fname, int nValues, int iProc) +void Write_Debug(Real *Value, const char *fname, int nValues, int iProc) { char fn[1024]; int ret; diff --git a/src/io/io.h b/src/io/io.h index a24fe788c..26569d146 100644 --- a/src/io/io.h +++ b/src/io/io.h @@ -8,22 +8,22 @@ #include "../grid/grid3D.h" /* Write the data */ -void WriteData(Grid3D& G, struct parameters P, int nfile); +void Write_Data(Grid3D& G, struct parameters P, int nfile); /* Output the grid data to file. */ -void OutputData(Grid3D& G, struct parameters P, int nfile); +void Output_Data(Grid3D& G, struct parameters P, int nfile); /* Output the grid data to file as 32-bit floats. */ -void OutputFloat32(Grid3D& G, struct parameters P, int nfile); +void Output_Float32(Grid3D& G, struct parameters P, int nfile); /* Output a projection of the grid data to file. */ -void OutputProjectedData(Grid3D& G, struct parameters P, int nfile); +void Output_Projected_Data(Grid3D& G, struct parameters P, int nfile); /* Output a rotated projection of the grid data to file. */ -void OutputRotatedProjectedData(Grid3D& G, struct parameters P, int nfile); +void Output_Rotated_Projected_Data(Grid3D& G, struct parameters P, int nfile); /* Output xy, xz, and yz slices of the grid data to file. */ -void OutputSlices(Grid3D& G, struct parameters P, int nfile); +void Output_Slices(Grid3D& G, struct parameters P, int nfile); /* MPI-safe printf routine */ int chprintf(const char* __restrict sdata, ...); @@ -49,7 +49,7 @@ void Create_Log_File(struct parameters P); void Write_Message_To_Log_File(const char* message); -void write_debug(Real* Value, const char* fname, int nValues, int iProc); +void Write_Debug(Real* Value, const char* fname, int nValues, int iProc); #ifdef HDF5 // From io/io.cpp @@ -70,8 +70,8 @@ void Fill_Grid_From_HDF5_Buffer(int nx, int ny, int nz, int nx_real, int ny_real // From io/io_gpu.cu // Use GPU to pack source -> device_buffer, then copy device_buffer -> buffer, // then write HDF5 field -void WriteHDF5Field3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, float* buffer, +void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, float* buffer, float* device_buffer, Real* source, const char* name, int mhd_direction = -1); -void WriteHDF5Field3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, double* buffer, +void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, double* buffer, double* device_buffer, Real* source, const char* name, int mhd_direction = -1); #endif diff --git a/src/io/io_gpu.cu b/src/io/io_gpu.cu index 34da27ff2..9fa0b20e6 100644 --- a/src/io/io_gpu.cu +++ b/src/io/io_gpu.cu @@ -88,7 +88,7 @@ __global__ void CopyReal3D_GPU_Kernel(int nx, int ny, int nx_real, int ny_real, // When buffer is double, automatically use the double version of everything // using function overloading -void WriteHDF5Field3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, double* buffer, +void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, double* buffer, double* device_buffer, Real* device_source, const char* name, int mhd_direction) { herr_t status; @@ -116,7 +116,7 @@ void WriteHDF5Field3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int // When buffer is float, automatically use the float version of everything using // function overloading -void WriteHDF5Field3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, float* buffer, +void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, float* buffer, float* device_buffer, Real* device_source, const char* name, int mhd_direction) { herr_t status; diff --git a/src/main.cpp b/src/main.cpp index b33ee8eba..03b8ecaec 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) #endif // CPU_TIME // start the total time - start_total = get_time(); + start_total = Get_Time(); /* Initialize MPI communication */ #ifdef MPI_CHOLLA @@ -72,7 +72,7 @@ int main(int argc, char *argv[]) Grid3D G; // read in the parameters - parse_params(param_file, &P, argc, argv); + Parse_Params(param_file, &P, argc, argv); // and output to screen chprintf("Git Commit Hash = %s\n", GIT_HASH); chprintf("Macro Flags = %s\n", MACRO_FLAGS); @@ -204,7 +204,7 @@ int main(int argc, char *argv[]) if (!is_restart || G.H.Output_Now) { // write the initial conditions to file chprintf("Writing initial conditions to file...\n"); - WriteData(G, P, nfile); + Write_Data(G, P, nfile); } // add one to the output file count nfile++; @@ -219,7 +219,7 @@ int main(int argc, char *argv[]) outtime += P.outstep; #ifdef CPU_TIME - stop_init = get_time(); + stop_init = Get_Time(); init = stop_init - start_total; #ifdef MPI_CHOLLA init_min = ReduceRealMin(init); @@ -244,7 +244,7 @@ int main(int argc, char *argv[]) #ifdef CPU_TIME G.Timer.Total.Start(); #endif // CPU_TIME - start_step = get_time(); + start_step = Get_Time(); // calculate the timestep by calling MPI_Allreduce G.set_dt(dti); @@ -305,8 +305,8 @@ int main(int argc, char *argv[]) #endif // get the time to compute the total timestep - stop_step = get_time(); - stop_total = get_time(); + stop_step = Get_Time(); + stop_total = Get_Time(); G.H.t_wall = stop_total - start_total; #ifdef MPI_CHOLLA G.H.t_wall = ReduceRealMax(G.H.t_wall); @@ -335,7 +335,7 @@ int main(int argc, char *argv[]) if (G.H.t == outtime || G.H.Output_Now) { #ifdef OUTPUT /*output the grid data*/ - WriteData(G, P, nfile); + Write_Data(G, P, nfile); // add one to the output file count nfile++; #endif // OUTPUT @@ -350,7 +350,7 @@ int main(int argc, char *argv[]) #ifdef N_STEPS_LIMIT // Exit the loop when reached the limit number of steps (optional) if (G.H.n_step == N_STEPS_LIMIT) { - WriteData(G, P, nfile); + Write_Data(G, P, nfile); break; } #endif diff --git a/src/main_tests.cpp b/src/main_tests.cpp index ee58fbd06..1b51f0aea 100644 --- a/src/main_tests.cpp +++ b/src/main_tests.cpp @@ -41,10 +41,10 @@ class InputParser * \param option The string option to look for * \return const std::string& The option the follows a given flag */ - const std::string &getCmdOption(const std::string &option) const + const std::string &Get_Cmd_Option(const std::string &option) const { // First check that the option exists - if (not cmdOptionExists(option)) { + if (not Cmd_Option_Exists(option)) { std::string errMessage = "Error: argument '" + option + "' not found. "; throw std::invalid_argument(errMessage); } @@ -69,7 +69,7 @@ class InputParser * \return true The option flag exists in argv * \return false The option flage does not exist in argv */ - bool cmdOptionExists(const std::string &option) const + bool Cmd_Option_Exists(const std::string &option) const { return std::find(this->_tokens.begin(), this->_tokens.end(), option) != this->_tokens.end(); } @@ -119,17 +119,17 @@ int main(int argc, char **argv) // Initialize global variables InputParser input(argc, argv); - globalChollaRoot.init(input.getCmdOption("--cholla-root")); - globalChollaBuild.init(input.getCmdOption("--build-type")); - globalChollaMachine.init(input.getCmdOption("--machine")); - if (input.cmdOptionExists("--mpi-launcher")) { - globalMpiLauncher.init(input.getCmdOption("--mpi-launcher")); + globalChollaRoot.init(input.Get_Cmd_Option("--cholla-root")); + globalChollaBuild.init(input.Get_Cmd_Option("--build-type")); + globalChollaMachine.init(input.Get_Cmd_Option("--machine")); + if (input.Cmd_Option_Exists("--mpi-launcher")) { + globalMpiLauncher.init(input.Get_Cmd_Option("--mpi-launcher")); } else { globalMpiLauncher.init("mpirun -np"); } - globalRunCholla = not input.cmdOptionExists("--runCholla=false"); - globalCompareSystemTestResults = not input.cmdOptionExists("--compareSystemTestResults=false"); + globalRunCholla = not input.Cmd_Option_Exists("--runCholla=false"); + globalCompareSystemTestResults = not input.Cmd_Option_Exists("--compareSystemTestResults=false"); // Run test and return result return RUN_ALL_TESTS(); diff --git a/src/mhd/ct_electric_fields_tests.cu b/src/mhd/ct_electric_fields_tests.cu index afbaada66..2cbbac2e8 100644 --- a/src/mhd/ct_electric_fields_tests.cu +++ b/src/mhd/ct_electric_fields_tests.cu @@ -91,7 +91,7 @@ class tMHDCalculateCTElectricFields : public ::testing::Test * \brief Launch the kernel and check results * */ - void runTest() + void Run_Test() { // Copy values to GPU CudaSafeCall(cudaMemcpy(dev_fluxX, fluxX.data(), fluxX.size() * sizeof(Real), cudaMemcpyHostToDevice)); @@ -115,7 +115,7 @@ class tMHDCalculateCTElectricFields : public ::testing::Test for (size_t i = 0; i < fiducialData.size(); i++) { int xid, yid, zid; cuda_utilities::compute3DIndices(i, nx, ny, xid, yid, zid); - testingUtilities::checkResults(fiducialData.at(i), testCTElectricFields.at(i), + testingUtilities::Check_Results(fiducialData.at(i), testCTElectricFields.at(i), "value at i = " + std::to_string(i) + ", xid = " + std::to_string(xid) + ", yid = " + std::to_string(yid) + ", zid = " + std::to_string(zid)); } @@ -132,7 +132,7 @@ TEST_F(tMHDCalculateCTElectricFields, PositiveVelocityExpectCorrectOutput) fiducialData.at(23) = 61.768055665002557; // Launch kernel and check results - runTest(); + Run_Test(); } // ============================================================================= @@ -153,7 +153,7 @@ TEST_F(tMHDCalculateCTElectricFields, NegativeVelocityExpectCorrectOutput) } // Launch kernel and check results - runTest(); + Run_Test(); } // ============================================================================= @@ -174,7 +174,7 @@ TEST_F(tMHDCalculateCTElectricFields, ZeroVelocityExpectCorrectOutput) } // Launch kernel and check results - runTest(); + Run_Test(); } // ============================================================================= #endif // MHD diff --git a/src/mhd/magnetic_divergence_tests.cu b/src/mhd/magnetic_divergence_tests.cu index c1c44a9a7..a898ae650 100644 --- a/src/mhd/magnetic_divergence_tests.cu +++ b/src/mhd/magnetic_divergence_tests.cu @@ -61,7 +61,7 @@ TEST(tMHDGrid3DcheckMagneticDivergence, CorrectInputExpectCorrectOutput) MPI_Finalize(); // Perform Comparison Real const fiducialDivergence = 3.6318132783263106 / 1E15; - testingUtilities::checkResults(fiducialDivergence, max_magnetic_divergence, "maximum divergence"); + testingUtilities::Check_Results(fiducialDivergence, max_magnetic_divergence, "maximum divergence"); } // ============================================================================= // End of tests for the magnetic field divergence functions diff --git a/src/mhd/magnetic_update_tests.cu b/src/mhd/magnetic_update_tests.cu index 9b78a8f5d..5ac59060b 100644 --- a/src/mhd/magnetic_update_tests.cu +++ b/src/mhd/magnetic_update_tests.cu @@ -79,7 +79,7 @@ class tMHDUpdateMagneticField3D : public ::testing::Test * \brief Launch the kernel and check results * */ - void runTest() + void Run_Test() { // Copy values to GPU CudaSafeCall( @@ -103,7 +103,7 @@ class tMHDUpdateMagneticField3D : public ::testing::Test for (size_t i = 0; i < fiducialData.size(); i++) { int xid, yid, zid; cuda_utilities::compute3DIndices(i, nx, ny, xid, yid, zid); - testingUtilities::checkResults(fiducialData.at(i), destinationGrid.at(i), + testingUtilities::Check_Results(fiducialData.at(i), destinationGrid.at(i), "value at i = " + std::to_string(i) + ", xid = " + std::to_string(xid) + ", yid = " + std::to_string(yid) + ", zid = " + std::to_string(zid)); } @@ -120,7 +120,7 @@ TEST_F(tMHDUpdateMagneticField3D, CorrectInputExpectCorrectOutput) fiducialData.at(202) = 204.56; // Launch kernel and check results - runTest(); + Run_Test(); } // ============================================================================= #endif // MHD diff --git a/src/model/disk_ICs.cpp b/src/model/disk_ICs.cpp index 8e4bede3f..ab59e2805 100644 --- a/src/model/disk_ICs.cpp +++ b/src/model/disk_ICs.cpp @@ -21,10 +21,10 @@ // #define DISK_ICS // function with logarithms used in NFW definitions -Real log_func(Real y) { return log(1 + y) - y / (1 + y); } +Real Log_Func(Real y) { return log(1 + y) - y / (1 + y); } // vertical acceleration in NFW halo -Real gz_halo_D3D(Real R, Real z, Real *hdp) +Real Gz_Halo_D3D(Real R, Real z, Real *hdp) { Real M_h = hdp[2]; // halo mass Real R_h = hdp[5]; // halo scale length @@ -33,16 +33,16 @@ Real gz_halo_D3D(Real R, Real z, Real *hdp) Real x = r / R_h; Real z_comp = z / r; - Real A = log_func(x); + Real A = Log_Func(x); Real B = 1.0 / (r * r); - Real C = GN * M_h / log_func(c_vir); + Real C = GN * M_h / Log_Func(c_vir); // checked with wolfram alpha return -C * A * B * z_comp; } // radial acceleration in NFW halo -Real gr_halo_D3D(Real R, Real z, Real *hdp) +Real Gr_Halo_D3D(Real R, Real z, Real *hdp) { Real M_h = hdp[2]; // halo mass Real R_h = hdp[5]; // halo scale length @@ -51,16 +51,16 @@ Real gr_halo_D3D(Real R, Real z, Real *hdp) Real x = r / R_h; Real r_comp = R / r; - Real A = log_func(x); + Real A = Log_Func(x); Real B = 1.0 / (r * r); - Real C = GN * M_h / log_func(c_vir); + Real C = GN * M_h / Log_Func(c_vir); // checked with wolfram alpha return -C * A * B * r_comp; } // disk radial surface density profile -Real Sigma_disk_D3D(Real r, Real *hdp) +Real Sigma_Disk_D3D(Real r, Real *hdp) { // return the exponential surface density Real Sigma_0 = hdp[9]; @@ -80,7 +80,7 @@ Real Sigma_disk_D3D(Real r, Real *hdp) } // vertical acceleration in miyamoto nagai -Real gz_disk_D3D(Real R, Real z, Real *hdp) +Real Gz_Disk_D3D(Real R, Real z, Real *hdp) { Real M_d = hdp[1]; // disk mass Real R_d = hdp[6]; // MN disk length @@ -96,7 +96,7 @@ Real gz_disk_D3D(Real R, Real z, Real *hdp) } // radial acceleration in miyamoto nagai -Real gr_disk_D3D(Real R, Real z, Real *hdp) +Real Gr_Disk_D3D(Real R, Real z, Real *hdp) { Real M_d = hdp[1]; // disk mass Real R_d = hdp[6]; // MN disk length @@ -110,7 +110,7 @@ Real gr_disk_D3D(Real R, Real z, Real *hdp) } // NFW halo potential -Real phi_halo_D3D(Real R, Real z, Real *hdp) +Real Phi_Halo_D3D(Real R, Real z, Real *hdp) { Real M_h = hdp[2]; // halo mass Real R_h = hdp[5]; // halo scale length @@ -118,7 +118,7 @@ Real phi_halo_D3D(Real R, Real z, Real *hdp) Real r = sqrt(R * R + z * z); // spherical radius Real x = r / R_h; - Real C = GN * M_h / (R_h * log_func(c_vir)); + Real C = GN * M_h / (R_h * Log_Func(c_vir)); // limit x to non-zero value if (x < 1.0e-9) { @@ -130,7 +130,7 @@ Real phi_halo_D3D(Real R, Real z, Real *hdp) } // Miyamoto-Nagai potential -Real phi_disk_D3D(Real R, Real z, Real *hdp) +Real Phi_Disk_D3D(Real R, Real z, Real *hdp) { Real M_d = hdp[1]; // disk mass Real R_d = hdp[6]; // MN disk length @@ -144,17 +144,17 @@ Real phi_disk_D3D(Real R, Real z, Real *hdp) } // total potential -Real phi_total_D3D(Real R, Real z, Real *hdp) +Real Phi_Total_D3D(Real R, Real z, Real *hdp) { - Real Phi_A = phi_halo_D3D(R, z, hdp); - Real Phi_B = phi_disk_D3D(R, z, hdp); + Real Phi_A = Phi_Halo_D3D(R, z, hdp); + Real Phi_B = Phi_Disk_D3D(R, z, hdp); return Phi_A + Phi_B; } -Real phi_hot_halo_D3D(Real r, Real *hdp) +Real Phi_Hot_Halo_D3D(Real r, Real *hdp) { - Real Phi_A = phi_halo_D3D(0, r, hdp); - Real Phi_B = phi_disk_D3D(0, r, hdp); + Real Phi_A = Phi_Halo_D3D(0, r, hdp); + Real Phi_B = Phi_Disk_D3D(0, r, hdp); // return Phi_A; return Phi_A + Phi_B; } @@ -162,7 +162,7 @@ Real phi_hot_halo_D3D(Real r, Real *hdp) // returns the cell-centered vertical // location of the cell with index k // k is indexed at 0 at the lowest ghost cell -Real z_hc_D3D(int k, Real dz, int nz, int ng) +Real Z_Hc_D3D(int k, Real dz, int nz, int ng) { // checked that this works, such that the // if dz = L_z/nz for the real domain, then the z positions @@ -179,7 +179,7 @@ Real z_hc_D3D(int k, Real dz, int nz, int ng) // returns the cell-centered radial // location of the cell with index i -Real r_hc_D3D(int i, Real dr) +Real R_Hc_D3D(int i, Real dr) { // the zeroth cell is centered at 0.5*dr return 0.5 * dr + ((Real)i) * dr; @@ -190,7 +190,7 @@ Real r_hc_D3D(int i, Real dr) * \brief Calculate the density at spherical radius r due to a hydrostatic halo. Uses an analytic expression normalized by the value of the potential at the cooling radius. */ -void hydrostatic_ray_analytical_D3D(Real *rho, Real *r, Real *hdp, Real dr, int nr) +void Hydrostatic_Ray_Analytical_D3D(Real *rho, Real *r, Real *hdp, Real dr, int nr) { // Routine to determine the hydrostatic density profile // along a ray from the galaxy center @@ -208,7 +208,7 @@ void hydrostatic_ray_analytical_D3D(Real *rho, Real *r, Real *hdp, Real dr, int Real gmo = gamma - 1.0; // gamma-1 // compute the potential at the cooling radius - Phi_0 = phi_hot_halo_D3D(r_cool, hdp); + Phi_0 = Phi_Hot_Halo_D3D(r_cool, hdp); // We are normalizing to the central density // so D_rho == 1 @@ -216,8 +216,8 @@ void hydrostatic_ray_analytical_D3D(Real *rho, Real *r, Real *hdp, Real dr, int // store densities for (i = 0; i < nr; i++) { - r[i] = r_hc_D3D(i, dr); - rho[i] = rho_eos * pow(D_rho - gmo * (phi_hot_halo_D3D(r[i], hdp) - Phi_0) / (cs * cs), 1. / gmo); + r[i] = R_Hc_D3D(i, dr); + rho[i] = rho_eos * pow(D_rho - gmo * (Phi_Hot_Halo_D3D(r[i], hdp) - Phi_0) / (cs * cs), 1. / gmo); } } @@ -227,7 +227,7 @@ void hydrostatic_ray_analytical_D3D(Real *rho, Real *r, Real *hdp, Real dr, int assuming an isothermal gas. Uses an iterative to scheme to determine the density at (R, z=0) relative to (R=0,z=0), then sets the densities according to an analytic expression. */ -void hydrostatic_column_isothermal_D3D(Real *rho, Real R, Real *hdp, Real dz, int nz, int ng) +void Hydrostatic_Column_Isothermal_D3D(Real *rho, Real R, Real *hdp, Real dz, int nz, int ng) { // x is cell center in x direction // y is cell center in y direction @@ -284,13 +284,13 @@ void hydrostatic_column_isothermal_D3D(Real *rho, Real R, Real *hdp, Real dz, in // get the disk surface density // have verified that at this point, Sigma_r is correct - Sigma_r = Sigma_disk_D3D(R, hdp); + Sigma_r = Sigma_Disk_D3D(R, hdp); // set the z-column size, including ghost cells nzt = nz + 2 * ng; // compute the mid plane potential - Phi_0 = phi_total_D3D(R, 0, hdp); + Phi_0 = Phi_Total_D3D(R, 0, hdp); /* For an isothermal gas, we have @@ -307,21 +307,21 @@ void hydrostatic_column_isothermal_D3D(Real *rho, Real R, Real *hdp, Real dz, in // perform a simple check about the fraction of density within // a single cell - z_1 = z_hc_D3D(ks, dz, nz, ng) + 0.5 * dz; // cell ceiling - D_rho = (phi_total_D3D(R, z_1, hdp) - Phi_0) / (cs * cs); + z_1 = Z_Hc_D3D(ks, dz, nz, ng) + 0.5 * dz; // cell ceiling + D_rho = (Phi_Total_D3D(R, z_1, hdp) - Phi_0) / (cs * cs); if (exp(-1 * D_rho) < 0.1) { printf( "WARNING: >0.9 density in single cell R %e D_rho %e z_1 %e Phi(z) %e " "Phi_0 %E cs %e\n", - R, D_rho, z_1, phi_total_D3D(R, z_1, hdp), Phi_0, cs); + R, D_rho, z_1, Phi_Total_D3D(R, z_1, hdp), Phi_0, cs); } // let's find the cell above the disk where the // density falls by exp(-7) < 1.0e-3. for (k = ks; k < nzt; k++) { - z_1 = z_hc_D3D(k, dz, nz, ng) + 0.5 * dz; // cell ceiling - D_rho = (phi_total_D3D(R, z_1, hdp) - Phi_0) / (cs * cs); + z_1 = Z_Hc_D3D(k, dz, nz, ng) + 0.5 * dz; // cell ceiling + D_rho = (Phi_Total_D3D(R, z_1, hdp) - Phi_0) / (cs * cs); if (D_rho >= 7.0) { break; } @@ -340,7 +340,7 @@ void hydrostatic_column_isothermal_D3D(Real *rho, Real R, Real *hdp, Real dz, in phi_int = 0.0; for (k = 0; k < n_int; k++) { z_0 = 0.5 * dz_int + dz_int * ((Real)k); - Delta_phi = (phi_total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); + Delta_phi = (Phi_Total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); phi_int += exp(-1 * Delta_phi) * dz_int; } @@ -353,8 +353,8 @@ void hydrostatic_column_isothermal_D3D(Real *rho, Real R, Real *hdp, Real dz, in n_int = 10; // integrate over a 1/10 cell for (k = ks; k < nzt; k++) { // find cell center, bottom, and top - z_int_min = z_hc_D3D(k, dz, nz, ng) - 0.5 * dz; - z_int_max = z_hc_D3D(k, dz, nz, ng) + 0.5 * dz; + z_int_min = Z_Hc_D3D(k, dz, nz, ng) - 0.5 * dz; + z_int_max = Z_Hc_D3D(k, dz, nz, ng) + 0.5 * dz; if (z_int_max > z_disk_max) { z_int_max = z_disk_max; } @@ -363,7 +363,7 @@ void hydrostatic_column_isothermal_D3D(Real *rho, Real R, Real *hdp, Real dz, in phi_int = 0.0; for (i = 0; i < n_int; i++) { z_0 = 0.5 * dz_int + dz_int * ((Real)i) + z_int_min; - Delta_phi = (phi_total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); + Delta_phi = (Phi_Total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); phi_int += rho_0 * exp(-1 * Delta_phi) * dz_int; } @@ -404,7 +404,7 @@ void hydrostatic_column_isothermal_D3D(Real *rho, Real R, Real *hdp, Real dz, in * \brief Calculate the 1D density distribution in a hydrostatic column. Uses an iterative to scheme to determine the density at (R, z=0) relative to (R=0,z=0), then sets the densities according to an analytic expression. */ -void hydrostatic_column_analytical_D3D(Real *rho, Real R, Real *hdp, Real dz, int nz, int ng) +void Hydrostatic_Column_Analytical_D3D(Real *rho, Real R, Real *hdp, Real dz, int nz, int ng) { // x is cell center in x direction // y is cell center in y direction @@ -472,13 +472,13 @@ void hydrostatic_column_analytical_D3D(Real *rho, Real R, Real *hdp, Real dz, in // get the disk surface density // have verified that at this point, Sigma_r is correct - Sigma_r = Sigma_disk_D3D(R, hdp); + Sigma_r = Sigma_Disk_D3D(R, hdp); // set the z-column size, including ghost cells nzt = nz + 2 * ng; // compute the mid plane potential - Phi_0 = phi_total_D3D(R, 0, hdp); + Phi_0 = Phi_Total_D3D(R, 0, hdp); // pick a fiducial guess for density ratio D_rho = pow(Sigma_r / Sigma_0, gamma - 1.); @@ -504,8 +504,8 @@ void hydrostatic_column_analytical_D3D(Real *rho, Real R, Real *hdp, Real dz, in z_0 = 1.0e-3; z_1 = 1.0e-2; while (!flag_phi) { - A_0 = D_rho - (phi_total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); - A_1 = D_rho - (phi_total_D3D(R, z_1, hdp) - Phi_0) / (cs * cs); + A_0 = D_rho - (Phi_Total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); + A_1 = D_rho - (Phi_Total_D3D(R, z_1, hdp) - Phi_0) / (cs * cs); z_2 = z_1 - A_1 * (z_1 - z_0) / (A_1 - A_0); if (fabs(z_2 - z_1) / fabs(z_1) > 10.) { z_2 = 10. * z_1; @@ -516,8 +516,8 @@ void hydrostatic_column_analytical_D3D(Real *rho, Real R, Real *hdp, Real dz, in if (fabs(z_1 - z_0) < tol) { flag_phi = 1; - A_0 = D_rho - (phi_total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); - A_1 = D_rho - (phi_total_D3D(R, z_1, hdp) - Phi_0) / (cs * cs); + A_0 = D_rho - (Phi_Total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); + A_1 = D_rho - (Phi_Total_D3D(R, z_1, hdp) - Phi_0) / (cs * cs); // make sure we haven't crossed 0 if (A_1 < 0) { z_1 = z_0; @@ -528,14 +528,14 @@ void hydrostatic_column_analytical_D3D(Real *rho, Real R, Real *hdp, Real dz, in printf("Something wrong in determining central density...\n"); printf("iter_phi = %d\n", iter_phi); printf("z_0 %e z_1 %e z_2 %e A_0 %e A_1 %e phi_0 %e phi_1 %e\n", z_0, z_1, z_2, A_0, A_1, - phi_total_D3D(R, z_0, hdp), phi_total_D3D(R, z_1, hdp)); + Phi_Total_D3D(R, z_0, hdp), Phi_Total_D3D(R, z_1, hdp)); #ifdef MPI_CHOLLA MPI_Finalize(); #endif exit(0); } } - A_1 = D_rho - (phi_total_D3D(R, z_1, hdp) - Phi_0) / (cs * cs); + A_1 = D_rho - (Phi_Total_D3D(R, z_1, hdp) - Phi_0) / (cs * cs); z_disk_max = z_1; // Compute surface density @@ -545,7 +545,7 @@ void hydrostatic_column_analytical_D3D(Real *rho, Real R, Real *hdp, Real dz, in phi_int = 0.0; for (k = 0; k < n_int; k++) { z_0 = 0.5 * dz_int + dz_int * ((Real)k); - Delta_phi = (phi_total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); + Delta_phi = (Phi_Total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); A = D_rho - Delta_phi; phi_int += rho_eos * pow((gamma - 1) * A, 1. / (gamma - 1.)) * dz_int; } @@ -576,8 +576,8 @@ void hydrostatic_column_analytical_D3D(Real *rho, Real R, Real *hdp, Real dz, in n_int = 10; // integrate over a 1/10 cell for (k = ks; k < nzt; k++) { // find cell center, bottom, and top - z_int_min = z_hc_D3D(k, dz, nz, ng) - 0.5 * dz; - z_int_max = z_hc_D3D(k, dz, nz, ng) + 0.5 * dz; + z_int_min = Z_Hc_D3D(k, dz, nz, ng) - 0.5 * dz; + z_int_max = Z_Hc_D3D(k, dz, nz, ng) + 0.5 * dz; if (z_int_max > z_disk_max) { z_int_max = z_disk_max; } @@ -586,7 +586,7 @@ void hydrostatic_column_analytical_D3D(Real *rho, Real R, Real *hdp, Real dz, in phi_int = 0.0; for (i = 0; i < n_int; i++) { z_0 = 0.5 * dz_int + dz_int * ((Real)i) + z_int_min; - Delta_phi = (phi_total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); + Delta_phi = (Phi_Total_D3D(R, z_0, hdp) - Phi_0) / (cs * cs); A = D_rho - Delta_phi; phi_int += rho_eos * pow((gamma - 1) * A, 1. / (gamma - 1.)) * dz_int; } @@ -611,7 +611,7 @@ void hydrostatic_column_analytical_D3D(Real *rho, Real R, Real *hdp, Real dz, in km = ng + nz / 2 - (k - ks) - 1; } rho[km] = rho[k]; - Delta_phi = (phi_total_D3D(R, z_hc_D3D(k, dz, nz, ng), hdp) - Phi_0) / (cs * cs); + Delta_phi = (Phi_Total_D3D(R, Z_Hc_D3D(k, dz, nz, ng), hdp) - Phi_0) / (cs * cs); } // check the surface density @@ -621,13 +621,13 @@ void hydrostatic_column_analytical_D3D(Real *rho, Real R, Real *hdp, Real dz, in } } -Real determine_rho_eos_D3D(Real cs, Real Sigma_0, Real *hdp) +Real Determine_Rho_EOS_D3D(Real cs, Real Sigma_0, Real *hdp) { // OK, we need to set rho_eos based on the central surface density. // and the central potential int k; Real z_pos, rho_eos; - Real Phi_0 = phi_total_D3D(0, 0, hdp); + Real Phi_0 = Phi_Total_D3D(0, 0, hdp); Real gamma = hdp[13]; // Real gamma = 1.001; // CHANGED FOR ISOTHERMAL Real Delta_phi; @@ -645,8 +645,8 @@ Real determine_rho_eos_D3D(Real cs, Real Sigma_0, Real *hdp) z_0 = 1.0e-3; z_1 = 1.0e-2; while (!flag_phi) { - A_0 = 1.0 - (phi_total_D3D(0, z_0, hdp) - Phi_0) / (cs * cs); - A_1 = 1.0 - (phi_total_D3D(0, z_1, hdp) - Phi_0) / (cs * cs); + A_0 = 1.0 - (Phi_Total_D3D(0, z_0, hdp) - Phi_0) / (cs * cs); + A_1 = 1.0 - (Phi_Total_D3D(0, z_1, hdp) - Phi_0) / (cs * cs); z_2 = z_1 - A_1 * (z_1 - z_0) / (A_1 - A_0); if (fabs(z_2 - z_1) / fabs(z_1) > 10.) { @@ -660,8 +660,8 @@ Real determine_rho_eos_D3D(Real cs, Real Sigma_0, Real *hdp) // printf("z_0 %e z_1 %e\n",z_0,z_1); if (fabs(z_1 - z_0) < tol) { flag_phi = 1; - A_0 = 1.0 - (phi_total_D3D(0, z_0, hdp) - Phi_0) / (cs * cs); - A_1 = 1.0 - (phi_total_D3D(0, z_1, hdp) - Phi_0) / (cs * cs); + A_0 = 1.0 - (Phi_Total_D3D(0, z_0, hdp) - Phi_0) / (cs * cs); + A_1 = 1.0 - (Phi_Total_D3D(0, z_1, hdp) - Phi_0) / (cs * cs); // make sure we haven't crossed 0 if (A_1 < 0) { z_1 = z_0; @@ -672,7 +672,7 @@ Real determine_rho_eos_D3D(Real cs, Real Sigma_0, Real *hdp) printf("Something wrong in determining central density...\n"); printf("iter_phi = %d\n", iter_phi); printf("z_0 %e z_1 %e z_2 %e A_0 %e A_1 %e phi_0 %e phi_1 %e\n", z_0, z_1, z_2, A_0, A_1, - phi_total_D3D(0, z_0, hdp), phi_total_D3D(0, z_1, hdp)); + Phi_Total_D3D(0, z_0, hdp), Phi_Total_D3D(0, z_1, hdp)); #ifdef MPI_CHOLLA MPI_Finalize(); #endif @@ -690,7 +690,7 @@ Real determine_rho_eos_D3D(Real cs, Real Sigma_0, Real *hdp) // now integrate the density profile for (k = 0; k < n_int; k++) { z_pos = 0.5 * dz_int + dz_int * ((Real)k); - Delta_phi = phi_total_D3D(0, z_pos, hdp) - Phi_0; + Delta_phi = Phi_Total_D3D(0, z_pos, hdp) - Phi_0; A = 1.0 - Delta_phi / (cs * cs); phi_int += pow((gamma - 1) * A, 1. / (gamma - 1.)) * dz_int; } @@ -713,7 +713,7 @@ Real determine_rho_eos_D3D(Real cs, Real Sigma_0, Real *hdp) return rho_eos; } -Real halo_density_D3D(Real r, Real *r_halo, Real *rho_halo, Real dr, int nr) +Real Halo_Density_D3D(Real r, Real *r_halo, Real *rho_halo, Real dr, int nr) { // interpolate the halo density profile int i; @@ -798,7 +798,7 @@ void Grid3D::Disk_3D(parameters p) // determine rho_eos by setting central density of disk // based on central temperature - rho_eos = determine_rho_eos_D3D(cs, Sigma_0, hdp); + rho_eos = Determine_Rho_EOS_D3D(cs, Sigma_0, hdp); // set EOS parameters // K_eos = cs*cs*pow(rho_eos,1.0-p.gamma)/p.gamma; //P = K\rho^gamma @@ -834,7 +834,7 @@ void Grid3D::Disk_3D(parameters p) // Produce a look up table for a hydrostatic hot halo ////////////////////////////////////////////// ////////////////////////////////////////////// - hydrostatic_ray_analytical_D3D(rho_halo, r_halo, hdp, dr, nr); + Hydrostatic_Ray_Analytical_D3D(rho_halo, r_halo, hdp, dr, nr); chprintf("Hot halo lookup table generated...\n"); ////////////////////////////////////////////// @@ -859,7 +859,7 @@ void Grid3D::Disk_3D(parameters p) // Compute the hydrostatic density profile in this z column // owing to the disk // hydrostatic_column_analytical_D3D(rho, r, hdp, dz, nz, H.n_ghost); - hydrostatic_column_isothermal_D3D(rho, r, hdp, dz, nz, + Hydrostatic_Column_Isothermal_D3D(rho, r, hdp, dz, nz, H.n_ghost); // CHANGED_FOR_ISOTHERMAL // store densities @@ -919,9 +919,9 @@ void Grid3D::Disk_3D(parameters p) phi = atan2(y_pos, x_pos); // azimuthal angle (in x-y plane) // radial acceleration from disk - a_d = fabs(gr_disk_D3D(r, z_pos, hdp)); + a_d = fabs(Gr_Disk_D3D(r, z_pos, hdp)); // radial acceleration from halo - a_h = fabs(gr_halo_D3D(r, z_pos, hdp)); + a_h = fabs(Gr_Halo_D3D(r, z_pos, hdp)); // pressure gradient along x direction // gradient calc is first order at boundaries @@ -1025,7 +1025,7 @@ void Grid3D::Disk_3D(parameters p) r = sqrt(x_pos * x_pos + y_pos * y_pos + z_pos * z_pos); // interpolate the density at this position - d = halo_density_D3D(r, r_halo, rho_halo, dr, nr); + d = Halo_Density_D3D(r, r_halo, rho_halo, dr, nr); // set pressure adiabatically P = K_eos_h * pow(d, p.gamma); diff --git a/src/particles/feedback_CIC_gpu.cu b/src/particles/feedback_CIC_gpu.cu index 75bf1f5e8..f464e167e 100644 --- a/src/particles/feedback_CIC_gpu.cu +++ b/src/particles/feedback_CIC_gpu.cu @@ -36,7 +36,7 @@ int snr_n; } // namespace supernova #ifndef O_HIP -__device__ double atomicMax(double* address, double val) +__device__ double Atomic_Max(double* address, double val) { auto* address_as_ull = (unsigned long long int*)address; unsigned long long int old = *address_as_ull, assumed; @@ -48,7 +48,7 @@ __device__ double atomicMax(double* address, double val) } #endif // O_HIP -__global__ void initState_kernel(unsigned int seed, feedback_prng_t* states) +__global__ void Init_State_Kernel(unsigned int seed, feedback_prng_t* states) { int id = blockIdx.x * blockDim.x + threadIdx.x; curand_init(seed, id, 0, &states[id]); @@ -137,7 +137,7 @@ void supernova::initState(struct parameters* P, part_int_t n_local, Real allocat dim3 grid(ngrid); dim3 block(TPB_FEEDBACK); - hipLaunchKernelGGL(initState_kernel, grid, block, 0, 0, P->prng_seed, randStates); + hipLaunchKernelGGL(Init_State_Kernel, grid, block, 0, 0, P->prng_seed, randStates); CHECK(cudaDeviceSynchronize()); chprintf("supernova::initState end: n_states=%ld, ngrid=%d, threads=%d\n", n_states, ngrid, TPB_FEEDBACK); } @@ -175,9 +175,9 @@ __device__ Real Calc_Timestep(Real gamma, Real* density, Real* momentum_x, Real* should be dx*1/2. In the above the 1/2 factor is normalize over 2 cells/direction. */ -__device__ Real frac(int i, Real dx) { return (-0.5 * i * i - 0.5 * i + 1 + i * dx) * 0.5; } +__device__ Real Frac(int i, Real dx) { return (-0.5 * i * i - 0.5 * i + 1 + i * dx) * 0.5; } -__device__ Real d_fr(int i, Real dx) +__device__ Real D_Fr(int i, Real dx) { return (dx > 0.5) * i * (1 - 2 * dx) + ((i + 1) * dx + 0.5 * (i - 1)) - 3 * (i - 1) * (i + 1) * (0.5 - dx); } @@ -475,9 +475,9 @@ __global__ void Cluster_Feedback_Kernel(part_int_t n_local, part_int_t* id, Real // index in array of conserved quantities indx = (indx_x + i) + (indx_y + j) * nx_g + (indx_z + k) * nx_g * ny_g; - x_frac = d_fr(i, delta_x) * frac(j, delta_y) * frac(k, delta_z); - y_frac = frac(i, delta_x) * d_fr(j, delta_y) * frac(k, delta_z); - z_frac = frac(i, delta_x) * frac(j, delta_y) * d_fr(k, delta_z); + x_frac = D_Fr(i, delta_x) * Frac(j, delta_y) * Frac(k, delta_z); + y_frac = Frac(i, delta_x) * D_Fr(j, delta_y) * Frac(k, delta_z); + z_frac = Frac(i, delta_x) * Frac(j, delta_y) * D_Fr(k, delta_z); px = x_frac * feedback_momentum; py = y_frac * feedback_momentum; @@ -611,7 +611,7 @@ __global__ void Cluster_Feedback_Kernel(part_int_t n_local, part_int_t* id, Real } } if (direction > 0) { - atomicMax(dti, local_dti); + Atomic_Max(dti, local_dti); } } } diff --git a/src/reconstruction/plmc_cuda_tests.cu b/src/reconstruction/plmc_cuda_tests.cu index 88e9c3b34..34d8ab96b 100644 --- a/src/reconstruction/plmc_cuda_tests.cu +++ b/src/reconstruction/plmc_cuda_tests.cu @@ -138,7 +138,7 @@ TEST(tHYDROPlmcReconstructor, CorrectInputExpectCorrectOutput) ? 0.0 : fiducial_interface_left.at(direction)[i]; - testingUtilities::checkResults( + testingUtilities::Check_Results( fiducial_val, test_val, "left interface at i=" + std::to_string(i) + ", in direction " + std::to_string(direction)); @@ -148,7 +148,7 @@ TEST(tHYDROPlmcReconstructor, CorrectInputExpectCorrectOutput) ? 0.0 : fiducial_interface_right.at(direction)[i]; - testingUtilities::checkResults( + testingUtilities::Check_Results( fiducial_val, test_val, "right interface at i=" + std::to_string(i) + ", in direction " + std::to_string(direction)); } @@ -252,7 +252,7 @@ TEST(tMHDPlmcReconstructor, CorrectInputExpectCorrectOutput) ? 0.0 : fiducial_interface_left.at(direction)[i]; - testingUtilities::checkResults( + testingUtilities::Check_Results( fiducial_val, test_val, "left interface at i=" + std::to_string(i) + ", in direction " + std::to_string(direction)); @@ -262,7 +262,7 @@ TEST(tMHDPlmcReconstructor, CorrectInputExpectCorrectOutput) ? 0.0 : fiducial_interface_right.at(direction)[i]; - testingUtilities::checkResults( + testingUtilities::Check_Results( fiducial_val, test_val, "right interface at i=" + std::to_string(i) + ", in direction " + std::to_string(direction)); } diff --git a/src/reconstruction/reconstruction_tests.cu b/src/reconstruction/reconstruction_tests.cu index d75cbfd3c..adec39695 100644 --- a/src/reconstruction/reconstruction_tests.cu +++ b/src/reconstruction/reconstruction_tests.cu @@ -21,7 +21,7 @@ #include "../utils/testing_utilities.h" #ifdef MHD -__global__ void test_prim_2_char(reconstruction::Primitive const primitive, +__global__ void Test_Prim_2_Char(reconstruction::Primitive const primitive, reconstruction::Primitive const primitive_slope, Real const gamma, Real const sound_speed, Real const sound_speed_squared, reconstruction::Characteristic *characteristic_slope) @@ -30,7 +30,7 @@ __global__ void test_prim_2_char(reconstruction::Primitive const primitive, reconstruction::Primitive_To_Characteristic(primitive, primitive_slope, sound_speed, sound_speed_squared, gamma); } -__global__ void test_char_2_prim(reconstruction::Primitive const primitive, +__global__ void Test_Char_2_Prim(reconstruction::Primitive const primitive, reconstruction::Characteristic const characteristic_slope, Real const gamma, Real const sound_speed, Real const sound_speed_squared, reconstruction::Primitive *primitive_slope) @@ -50,7 +50,7 @@ TEST(tMHDReconstructionPrimitive2Characteristic, CorrectInputExpectCorrectOutput // Run test cuda_utilities::DeviceVector dev_results(1); - hipLaunchKernelGGL(test_prim_2_char, 1, 1, 0, 0, primitive, primitive_slope, gamma, sound_speed, sound_speed_squared, + hipLaunchKernelGGL(Test_Prim_2_Char, 1, 1, 0, 0, primitive, primitive_slope, gamma, sound_speed, sound_speed_squared, dev_results.data()); CudaCheckError(); cudaDeviceSynchronize(); @@ -60,13 +60,13 @@ TEST(tMHDReconstructionPrimitive2Characteristic, CorrectInputExpectCorrectOutput reconstruction::Characteristic const fiducial_results{ 3.67609032478613384e+00, -5.64432521030159506e-01, -3.31429408151064075e+00, 7.44000000000000039e+00, 3.29052143725318791e+00, -1.88144173676719539e-01, 4.07536568422372625e+00}; - testingUtilities::checkResults(fiducial_results.a0, host_results.a0, "a0"); - testingUtilities::checkResults(fiducial_results.a1, host_results.a1, "a1"); - testingUtilities::checkResults(fiducial_results.a2, host_results.a2, "a2"); - testingUtilities::checkResults(fiducial_results.a3, host_results.a3, "a3"); - testingUtilities::checkResults(fiducial_results.a4, host_results.a4, "a4"); - testingUtilities::checkResults(fiducial_results.a5, host_results.a5, "a5"); - testingUtilities::checkResults(fiducial_results.a6, host_results.a6, "a6"); + testingUtilities::Check_Results(fiducial_results.a0, host_results.a0, "a0"); + testingUtilities::Check_Results(fiducial_results.a1, host_results.a1, "a1"); + testingUtilities::Check_Results(fiducial_results.a2, host_results.a2, "a2"); + testingUtilities::Check_Results(fiducial_results.a3, host_results.a3, "a3"); + testingUtilities::Check_Results(fiducial_results.a4, host_results.a4, "a4"); + testingUtilities::Check_Results(fiducial_results.a5, host_results.a5, "a5"); + testingUtilities::Check_Results(fiducial_results.a6, host_results.a6, "a6"); } TEST(tMHDReconstructionCharacteristic2Primitive, CorrectInputExpectCorrectOutput) @@ -80,7 +80,7 @@ TEST(tMHDReconstructionCharacteristic2Primitive, CorrectInputExpectCorrectOutput // Run test cuda_utilities::DeviceVector dev_results(1); - hipLaunchKernelGGL(test_char_2_prim, 1, 1, 0, 0, primitive, characteristic_slope, gamma, sound_speed, + hipLaunchKernelGGL(Test_Char_2_Prim, 1, 1, 0, 0, primitive, characteristic_slope, gamma, sound_speed, sound_speed_squared, dev_results.data()); CudaCheckError(); cudaDeviceSynchronize(); @@ -90,13 +90,13 @@ TEST(tMHDReconstructionCharacteristic2Primitive, CorrectInputExpectCorrectOutput reconstruction::Primitive const fiducial_results{ 6.73268997307368267e+01, 1.79977606552837130e+01, 9.89872908629502835e-01, -4.94308571170036792e+00, 3.94390831089473579e+02, -9.99000000000000000e+02, 2.88004228079705342e+01, 9.36584592818786064e+01}; - testingUtilities::checkResults(fiducial_results.density, host_results.density, "density"); - testingUtilities::checkResults(fiducial_results.velocity_x, host_results.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_results.velocity_y, host_results.velocity_y, "velocity_y", 1.34E-14); - testingUtilities::checkResults(fiducial_results.velocity_z, host_results.velocity_z, "velocity_z", 1.6E-14); - testingUtilities::checkResults(fiducial_results.pressure, host_results.pressure, "pressure"); - testingUtilities::checkResults(fiducial_results.magnetic_y, host_results.magnetic_y, "magnetic_y"); - testingUtilities::checkResults(fiducial_results.magnetic_z, host_results.magnetic_z, "magnetic_z"); + testingUtilities::Check_Results(fiducial_results.density, host_results.density, "density"); + testingUtilities::Check_Results(fiducial_results.velocity_x, host_results.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_results.velocity_y, host_results.velocity_y, "velocity_y", 1.34E-14); + testingUtilities::Check_Results(fiducial_results.velocity_z, host_results.velocity_z, "velocity_z", 1.6E-14); + testingUtilities::Check_Results(fiducial_results.pressure, host_results.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_results.magnetic_y, host_results.magnetic_y, "magnetic_y"); + testingUtilities::Check_Results(fiducial_results.magnetic_z, host_results.magnetic_z, "magnetic_z"); } #endif // MHD @@ -124,25 +124,25 @@ TEST(tALLReconstructionLoadData, CorrectInputExpectCorrectOutput) #ifdef MHD reconstruction::Primitive const fiducial_data{ 13, 3.0769230769230771, 5.1538461538461542, 7.2307692307692308, 9662.3910256410272, 147.5, 173.5, 197.5}; - testingUtilities::checkResults(fiducial_data.density, test_data.density, "density"); - testingUtilities::checkResults(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data.pressure, test_data.pressure, "pressure"); - testingUtilities::checkResults(fiducial_data.magnetic_x, test_data.magnetic_x, "magnetic_x"); - testingUtilities::checkResults(fiducial_data.magnetic_y, test_data.magnetic_y, "magnetic_y"); - testingUtilities::checkResults(fiducial_data.magnetic_z, test_data.magnetic_z, "magnetic_z"); + testingUtilities::Check_Results(fiducial_data.density, test_data.density, "density"); + testingUtilities::Check_Results(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data.pressure, test_data.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data.magnetic_x, test_data.magnetic_x, "magnetic_x"); + testingUtilities::Check_Results(fiducial_data.magnetic_y, test_data.magnetic_y, "magnetic_y"); + testingUtilities::Check_Results(fiducial_data.magnetic_z, test_data.magnetic_z, "magnetic_z"); #else // MHD reconstruction::Primitive fiducial_data{13, 3.0769230769230771, 5.1538461538461542, 7.2307692307692308, 39950.641025641031}; #ifdef DE fiducial_data.pressure = 34274.282506448195; #endif // DE - testingUtilities::checkResults(fiducial_data.density, test_data.density, "density"); - testingUtilities::checkResults(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data.pressure, test_data.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data.density, test_data.density, "density"); + testingUtilities::Check_Results(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data.pressure, test_data.pressure, "pressure"); #endif // MHD } @@ -164,20 +164,20 @@ TEST(tALLReconstructionComputeSlope, CorrectInputExpectCorrectOutput) // Check results #ifdef MHD Real const fiducial_data = -2.5; - testingUtilities::checkResults(fiducial_data, test_data.density, "density"); - testingUtilities::checkResults(fiducial_data, test_data.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data, test_data.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data, test_data.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data, test_data.pressure, "pressure"); - testingUtilities::checkResults(fiducial_data, test_data.magnetic_y, "magnetic_y"); - testingUtilities::checkResults(fiducial_data, test_data.magnetic_z, "magnetic_z"); + testingUtilities::Check_Results(fiducial_data, test_data.density, "density"); + testingUtilities::Check_Results(fiducial_data, test_data.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data, test_data.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data, test_data.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data, test_data.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data, test_data.magnetic_y, "magnetic_y"); + testingUtilities::Check_Results(fiducial_data, test_data.magnetic_z, "magnetic_z"); #else // MHD Real const fiducial_data = -2.5; - testingUtilities::checkResults(fiducial_data, test_data.density, "density"); - testingUtilities::checkResults(fiducial_data, test_data.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data, test_data.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data, test_data.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data, test_data.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data, test_data.density, "density"); + testingUtilities::Check_Results(fiducial_data, test_data.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data, test_data.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data, test_data.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data, test_data.pressure, "pressure"); #endif // MHD } @@ -200,25 +200,25 @@ TEST(tALLReconstructionVanLeerSlope, CorrectInputExpectCorrectOutput) reconstruction::Primitive const fiducial_data{1.7142857142857142, 3.1111111111111112, 4.3636363636363633, 5.5384615384615383, 6.666666666666667, 0, 8.8421052631578956, 9.9047619047619051}; - testingUtilities::checkResults(fiducial_data.density, test_data.density, "density"); - testingUtilities::checkResults(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data.pressure, test_data.pressure, "pressure"); - testingUtilities::checkResults(fiducial_data.magnetic_y, test_data.magnetic_y, "magnetic_y"); - testingUtilities::checkResults(fiducial_data.magnetic_z, test_data.magnetic_z, "magnetic_z"); + testingUtilities::Check_Results(fiducial_data.density, test_data.density, "density"); + testingUtilities::Check_Results(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data.pressure, test_data.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data.magnetic_y, test_data.magnetic_y, "magnetic_y"); + testingUtilities::Check_Results(fiducial_data.magnetic_z, test_data.magnetic_z, "magnetic_z"); #else // MHD reconstruction::Primitive const fiducial_data{1.7142857142857142, 3.1111111111111112, 4.3636363636363633, 5.5384615384615383, 6.666666666666667}; - testingUtilities::checkResults(fiducial_data.density, test_data.density, "density"); - testingUtilities::checkResults(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data.pressure, test_data.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data.density, test_data.density, "density"); + testingUtilities::Check_Results(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data.pressure, test_data.pressure, "pressure"); #endif // MHD } -__global__ void test_monotize_characteristic_return_primitive( +__global__ void Test_Monotize_Characteristic_Return_Primitive( reconstruction::Primitive const primitive, reconstruction::Primitive const del_L, reconstruction::Primitive const del_R, reconstruction::Primitive const del_C, reconstruction::Primitive const del_G, reconstruction::Characteristic const del_a_L, reconstruction::Characteristic const del_a_R, @@ -258,7 +258,7 @@ TEST(tALLReconstructionMonotonizeCharacteristicReturnPrimitive, CorrectInputExpe // Get test data cuda_utilities::DeviceVector dev_results(1); - hipLaunchKernelGGL(test_monotize_characteristic_return_primitive, 1, 1, 0, 0, primitive, del_L, del_R, del_C, del_G, + hipLaunchKernelGGL(Test_Monotize_Characteristic_Return_Primitive, 1, 1, 0, 0, primitive, del_L, del_R, del_C, del_G, del_a_L, del_a_R, del_a_C, del_a_G, sound_speed, sound_speed_squared, gamma, dev_results.data()); CudaCheckError(); cudaDeviceSynchronize(); @@ -268,20 +268,20 @@ TEST(tALLReconstructionMonotonizeCharacteristicReturnPrimitive, CorrectInputExpe #ifdef MHD reconstruction::Primitive const fiducial_data{174, 74.796411763317991, 19.428234044886157, 16.129327015450095, 33524, 0, -1385.8699833027156, -1407.694707449215}; - testingUtilities::checkResults(fiducial_data.density, host_results.density, "density"); - testingUtilities::checkResults(fiducial_data.velocity_x, host_results.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data.velocity_y, host_results.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data.velocity_z, host_results.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data.pressure, host_results.pressure, "pressure"); - testingUtilities::checkResults(fiducial_data.magnetic_y, host_results.magnetic_y, "magnetic_y"); - testingUtilities::checkResults(fiducial_data.magnetic_z, host_results.magnetic_z, "magnetic_z"); + testingUtilities::Check_Results(fiducial_data.density, host_results.density, "density"); + testingUtilities::Check_Results(fiducial_data.velocity_x, host_results.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data.velocity_y, host_results.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data.velocity_z, host_results.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data.pressure, host_results.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data.magnetic_y, host_results.magnetic_y, "magnetic_y"); + testingUtilities::Check_Results(fiducial_data.magnetic_z, host_results.magnetic_z, "magnetic_z"); #else // MHD reconstruction::Primitive const fiducial_data{170, 68, 57, 58, 32946}; - testingUtilities::checkResults(fiducial_data.density, host_results.density, "density"); - testingUtilities::checkResults(fiducial_data.velocity_x, host_results.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data.velocity_y, host_results.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data.velocity_z, host_results.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data.pressure, host_results.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data.density, host_results.density, "density"); + testingUtilities::Check_Results(fiducial_data.velocity_x, host_results.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data.velocity_y, host_results.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data.velocity_z, host_results.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data.pressure, host_results.pressure, "pressure"); #endif // MHD } @@ -303,20 +303,20 @@ TEST(tALLReconstructionCalcInterface, CorrectInputExpectCorrectOutput) // Check results #ifdef MHD reconstruction::Primitive const fiducial_data{2.5, 3.75, 5, 6.25, 7.5, 0, 10, 11.25}; - testingUtilities::checkResults(fiducial_data.density, test_data.density, "density"); - testingUtilities::checkResults(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data.pressure, test_data.pressure, "pressure"); - testingUtilities::checkResults(fiducial_data.magnetic_y, test_data.magnetic_y, "magnetic_y"); - testingUtilities::checkResults(fiducial_data.magnetic_z, test_data.magnetic_z, "magnetic_z"); + testingUtilities::Check_Results(fiducial_data.density, test_data.density, "density"); + testingUtilities::Check_Results(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data.pressure, test_data.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data.magnetic_y, test_data.magnetic_y, "magnetic_y"); + testingUtilities::Check_Results(fiducial_data.magnetic_z, test_data.magnetic_z, "magnetic_z"); #else // MHD reconstruction::Primitive const fiducial_data{2.5, 3.75, 5, 6.25, 7.5}; - testingUtilities::checkResults(fiducial_data.density, test_data.density, "density"); - testingUtilities::checkResults(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data.pressure, test_data.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data.density, test_data.density, "density"); + testingUtilities::Check_Results(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data.pressure, test_data.pressure, "pressure"); #endif // MHD } @@ -359,6 +359,6 @@ TEST(tALLReconstructionWriteData, CorrectInputExpectCorrectOutput) double test_val = interface_arr.at(i); double fiducial_val = (fiducial_interface.find(i) == fiducial_interface.end()) ? 0.0 : fiducial_interface[i]; - testingUtilities::checkResults(fiducial_val, test_val, "Interface at i=" + std::to_string(i)); + testingUtilities::Check_Results(fiducial_val, test_val, "Interface at i=" + std::to_string(i)); } } diff --git a/src/riemann_solvers/hllc_cuda_tests.cu b/src/riemann_solvers/hllc_cuda_tests.cu index c3efe9d96..e8d000f6e 100644 --- a/src/riemann_solvers/hllc_cuda_tests.cu +++ b/src/riemann_solvers/hllc_cuda_tests.cu @@ -44,7 +44,7 @@ class tHYDROCalculateHLLCFluxesCUDA : public ::testing::Test * \param[in] gamma The adiabatic index * \return std::vector */ - std::vector computeFluxes(std::vector const &stateLeft, std::vector const &stateRight, + std::vector Compute_Fluxes(std::vector const &stateLeft, std::vector const &stateRight, Real const &gamma) { // Simulation Paramters @@ -105,7 +105,7 @@ class tHYDROCalculateHLLCFluxesCUDA : public ::testing::Test * print. It will print after the default GTest output but before the * values that failed are printed */ - void checkResults(std::vector const &fiducialFlux, std::vector const &testFlux, + void Check_Results(std::vector const &fiducialFlux, std::vector const &testFlux, std::string const &customOutput = "") { // Field names @@ -168,12 +168,12 @@ TEST_F(tHYDROCalculateHLLCFluxesCUDA, // Test suite name std::vector const fiducialFluxes{0, 1, 0, 0, 0}; // Compute the fluxes - std::vector const testFluxes = computeFluxes(state, // Left state + std::vector const testFluxes = Compute_Fluxes(state, // Left state state, // Right state gamma); // Adiabatic Index // Check for correctness - checkResults(fiducialFluxes, testFluxes); + Check_Results(fiducialFluxes, testFluxes); } // ========================================================================= diff --git a/src/riemann_solvers/hlld_cuda_tests.cu b/src/riemann_solvers/hlld_cuda_tests.cu index c39e091d1..b67e18227 100644 --- a/src/riemann_solvers/hlld_cuda_tests.cu +++ b/src/riemann_solvers/hlld_cuda_tests.cu @@ -56,7 +56,7 @@ class tMHDCalculateHLLDFluxesCUDA : public ::testing::Test * X, 1 = plane normal to Y, 2 = plane normal to Z. Defaults to 0. * \return std::vector */ - std::vector computeFluxes(std::vector stateLeft, std::vector stateRight, Real const &gamma, + std::vector Compute_Fluxes(std::vector stateLeft, std::vector stateRight, Real const &gamma, int const &direction = 0) { // Rearrange X, Y, and Z values for the chosen direction @@ -161,7 +161,7 @@ class tMHDCalculateHLLDFluxesCUDA : public ::testing::Test * \param[in] direction Which plane the interface is. 0 = plane normal to * X, 1 = plane normal to Y, 2 = plane normal to Z. Defaults to 0. */ - void checkResults(std::vector fiducialFlux, std::vector const &scalarFlux, Real thermalEnergyFlux, + void Check_Results(std::vector fiducialFlux, std::vector const &scalarFlux, Real thermalEnergyFlux, std::vector const &testFlux, std::string const &customOutput = "", int const &direction = 0) { // Field names @@ -227,7 +227,7 @@ class tMHDCalculateHLLDFluxesCUDA : public ::testing::Test * y-momentum, z-momentum, energy, passive scalars, x-magnetic field, * y-magnetic field, z-magnetic field. */ - std::vector primitive2Conserved(std::vector const &input, double const &gamma, + std::vector Primitive_2_Conserved(std::vector const &input, double const &gamma, std::vector const &primitiveScalars) { std::vector output(input.size()); @@ -299,30 +299,30 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO // Pressure | X-Magnetic Field | Y-Magnetic Field | // Z-Magnetic Field | Adiabatic Index | Passive // Scalars | - leftICs = primitive2Conserved({1.0, 0.0, 0.0, Vz, 1.0, Bx, 1.0, Bz}, gamma, primitiveScalar), + leftICs = Primitive_2_Conserved({1.0, 0.0, 0.0, Vz, 1.0, Bx, 1.0, Bz}, gamma, primitiveScalar), leftFastRareLeftSide = - primitive2Conserved({0.978576, 0.038603, -0.011074, Vz, 0.957621, Bx, 0.970288, Bz}, gamma, primitiveScalar), + Primitive_2_Conserved({0.978576, 0.038603, -0.011074, Vz, 0.957621, Bx, 0.970288, Bz}, gamma, primitiveScalar), leftFastRareRightSide = - primitive2Conserved({0.671655, 0.647082, -0.238291, Vz, 0.451115, Bx, 0.578240, Bz}, gamma, primitiveScalar), + Primitive_2_Conserved({0.671655, 0.647082, -0.238291, Vz, 0.451115, Bx, 0.578240, Bz}, gamma, primitiveScalar), compoundLeftSide = - primitive2Conserved({0.814306, 0.506792, -0.911794, Vz, 0.706578, Bx, -0.108819, Bz}, gamma, primitiveScalar), + Primitive_2_Conserved({0.814306, 0.506792, -0.911794, Vz, 0.706578, Bx, -0.108819, Bz}, gamma, primitiveScalar), compoundPeak = - primitive2Conserved({0.765841, 0.523701, -1.383720, Vz, 0.624742, Bx, -0.400787, Bz}, gamma, primitiveScalar), + Primitive_2_Conserved({0.765841, 0.523701, -1.383720, Vz, 0.624742, Bx, -0.400787, Bz}, gamma, primitiveScalar), compoundRightSide = - primitive2Conserved({0.695211, 0.601089, -1.583720, Vz, 0.515237, Bx, -0.537027, Bz}, gamma, primitiveScalar), + Primitive_2_Conserved({0.695211, 0.601089, -1.583720, Vz, 0.515237, Bx, -0.537027, Bz}, gamma, primitiveScalar), contactLeftSide = - primitive2Conserved({0.680453, 0.598922, -1.584490, Vz, 0.515856, Bx, -0.533616, Bz}, gamma, primitiveScalar), + Primitive_2_Conserved({0.680453, 0.598922, -1.584490, Vz, 0.515856, Bx, -0.533616, Bz}, gamma, primitiveScalar), contactRightSide = - primitive2Conserved({0.231160, 0.599261, -1.584820, Vz, 0.516212, Bx, -0.533327, Bz}, gamma, primitiveScalar), + Primitive_2_Conserved({0.231160, 0.599261, -1.584820, Vz, 0.516212, Bx, -0.533327, Bz}, gamma, primitiveScalar), slowShockLeftSide = - primitive2Conserved({0.153125, 0.086170, -0.683303, Vz, 0.191168, Bx, -0.850815, Bz}, gamma, primitiveScalar), - slowShockRightSide = primitive2Conserved({0.117046, -0.238196, -0.165561, Vz, 0.087684, Bx, -0.903407, Bz}, gamma, + Primitive_2_Conserved({0.153125, 0.086170, -0.683303, Vz, 0.191168, Bx, -0.850815, Bz}, gamma, primitiveScalar), + slowShockRightSide = Primitive_2_Conserved({0.117046, -0.238196, -0.165561, Vz, 0.087684, Bx, -0.903407, Bz}, gamma, primitiveScalar), - rightFastRareLeftSide = primitive2Conserved({0.117358, -0.228756, -0.158845, Vz, 0.088148, Bx, -0.908335, Bz}, + rightFastRareLeftSide = Primitive_2_Conserved({0.117358, -0.228756, -0.158845, Vz, 0.088148, Bx, -0.908335, Bz}, gamma, primitiveScalar), - rightFastRareRightSide = primitive2Conserved({0.124894, -0.003132, -0.002074, Vz, 0.099830, Bx, -0.999018, Bz}, + rightFastRareRightSide = Primitive_2_Conserved({0.124894, -0.003132, -0.002074, Vz, 0.099830, Bx, -0.999018, Bz}, gamma, primitiveScalar), - rightICs = primitive2Conserved({0.128, 0.0, 0.0, Vz, 0.1, Bx, -1.0, Bz}, gamma, primitiveScalar); + rightICs = Primitive_2_Conserved({0.128, 0.0, 0.0, Vz, 0.1, Bx, -1.0, Bz}, gamma, primitiveScalar); for (size_t direction = 0; direction < 3; direction++) { // Initial Condition Checks @@ -336,8 +336,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO std::vector const fiducialFlux{0, 1.21875, -0.75, 0, 0, 0.0, 0, 0}; std::vector const scalarFlux{0, 0, 0}; Real thermalEnergyFlux = 0.0; - std::vector const testFluxes = computeFluxes(leftICs, leftICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftICs, leftICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -349,8 +349,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO std::vector const fiducialFlux{0, 0.31874999999999998, 0.75, 0, 0, 0.0, 0, 0}; std::vector const scalarFlux{0, 0, 0}; Real thermalEnergyFlux = 0.0; - std::vector const testFluxes = computeFluxes(rightICs, rightICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightICs, rightICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -365,8 +365,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 1.0074980455427278, 0}; std::vector const scalarFlux{0.22885355953447648, 0.46073027567244362, 0.6854281091039145}; Real thermalEnergyFlux = 0.20673357746080046; - std::vector const testFluxes = computeFluxes(leftICs, rightICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftICs, rightICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -386,8 +386,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO leftICsNegBx[5] = -leftICsNegBx[5]; rightICsNegBx[5] = -rightICsNegBx[5]; - std::vector const testFluxes = computeFluxes(leftICsNegBx, rightICsNegBx, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftICsNegBx, rightICsNegBx, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -402,8 +402,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO -1.0074980455427278, 0}; std::vector const scalarFlux{-0.22885355953447648, -0.46073027567244362, -0.6854281091039145}; Real thermalEnergyFlux = -0.20673357746080046; - std::vector const testFluxes = computeFluxes(rightICs, leftICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightICs, leftICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } // Cross wave checks @@ -420,8 +420,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.53128887284876058, 0}; std::vector const scalarFlux{0.47083980954039228, 0.94789941519098619, 1.4101892974729979}; Real thermalEnergyFlux = 0.41622256825457099; - std::vector const testFluxes = computeFluxes(leftFastRareLeftSide, leftFastRareRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftFastRareLeftSide, leftFastRareRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -436,8 +436,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.058615131833681167, 0}; std::vector const scalarFlux{0.078034606921016325, 0.15710005136841393, 0.23371763662029341}; Real thermalEnergyFlux = 0.047345816580591255; - std::vector const testFluxes = computeFluxes(leftFastRareRightSide, leftFastRareLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftFastRareRightSide, leftFastRareLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -452,8 +452,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.76278089951123285, 0}; std::vector const scalarFlux{0.4948468279606959, 0.99623058485843297, 1.482091544807598}; Real thermalEnergyFlux = 0.38787931087981475; - std::vector const testFluxes = computeFluxes(compoundLeftSide, compoundRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(compoundLeftSide, compoundRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -468,8 +468,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.71658566275120927, 0}; std::vector const scalarFlux{0.42615918171426637, 0.85794792823389721, 1.2763685331959034}; Real thermalEnergyFlux = 0.28530908823756074; - std::vector const testFluxes = computeFluxes(compoundRightSide, compoundLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(compoundRightSide, compoundLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -484,8 +484,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.74058225030218761, 0}; std::vector const scalarFlux{0.46343639240225803, 0.93299478173931882, 1.388015684704111}; Real thermalEnergyFlux = 0.36325864563467081; - std::vector const testFluxes = computeFluxes(compoundLeftSide, compoundPeak, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(compoundLeftSide, compoundPeak, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -500,8 +500,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.71026545717401468, 0}; std::vector const scalarFlux{0.43749384947851333, 0.88076699477714815, 1.3103164425435772}; Real thermalEnergyFlux = 0.32239432669410983; - std::vector const testFluxes = computeFluxes(compoundPeak, compoundLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(compoundPeak, compoundLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -516,8 +516,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.85591904930227747, 0}; std::vector const scalarFlux{0.47444802592454061, 0.95516351251477749, 1.4209960899845735}; Real thermalEnergyFlux = 0.34962629086469987; - std::vector const testFluxes = computeFluxes(compoundPeak, compoundRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(compoundPeak, compoundRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -532,8 +532,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.83594460438033491, 0}; std::vector const scalarFlux{0.43286091709705776, 0.8714399289555731, 1.2964405732397004}; Real thermalEnergyFlux = 0.28979582956267347; - std::vector const testFluxes = computeFluxes(compoundRightSide, compoundPeak, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(compoundRightSide, compoundPeak, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -548,8 +548,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.8687394222350926, 0}; std::vector const scalarFlux{0.45114313616335622, 0.90824587528847567, 1.3511967538747176}; Real thermalEnergyFlux = 0.30895701155896288; - std::vector const testFluxes = computeFluxes(contactLeftSide, contactRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(contactLeftSide, contactRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -564,8 +564,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.86909622543144227, 0}; std::vector const scalarFlux{0.15331460335320088, 0.30865449334158279, 0.45918507401922254}; Real thermalEnergyFlux = 0.30928031735570188; - std::vector const testFluxes = computeFluxes(contactRightSide, contactLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(contactRightSide, contactLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -580,8 +580,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.40636483121437972, 0}; std::vector const scalarFlux{3.9048380136491711e-05, 7.8612589559210735e-05, 0.00011695189454326261}; Real thermalEnergyFlux = 4.4037784886918126e-05; - std::vector const testFluxes = computeFluxes(slowShockLeftSide, slowShockRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(slowShockLeftSide, slowShockRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -596,8 +596,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.37204015363322052, 0}; std::vector const scalarFlux{-0.018281297976332211, -0.036804091985367396, -0.054753421923485097}; Real thermalEnergyFlux = -0.020617189878790236; - std::vector const testFluxes = computeFluxes(slowShockRightSide, slowShockLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(slowShockRightSide, slowShockLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -613,8 +613,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO std::vector const scalarFlux{-0.029028601629558917, -0.058440671223894146, -0.086942145734385745}; Real thermalEnergyFlux = -0.020960370728633469; std::vector const testFluxes = - computeFluxes(rightFastRareLeftSide, rightFastRareRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(rightFastRareLeftSide, rightFastRareRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -630,8 +630,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO std::vector const scalarFlux{-0.0012053733294214947, -0.0024266696462237609, -0.0036101547366371614}; Real thermalEnergyFlux = -0.00081785194236053073; std::vector const testFluxes = - computeFluxes(rightFastRareRightSide, rightFastRareLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(rightFastRareRightSide, rightFastRareLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } } } @@ -655,36 +655,36 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor std::vector const // | Density | X-Velocity | Y-Velocity | Z-Velocity | // Pressure | X-Magnetic Field | Y-Magnetic Field | // Z-Magnetic Field | Adiabatic Index | Passive Scalars | - leftICs = primitive2Conserved({1.08, 0.0, 0.0, 0.0, 1.0, Bx, 3.6 * coef, 2 * coef}, gamma, primitiveScalar), - leftFastShockLeftSide = primitive2Conserved( + leftICs = Primitive_2_Conserved({1.08, 0.0, 0.0, 0.0, 1.0, Bx, 3.6 * coef, 2 * coef}, gamma, primitiveScalar), + leftFastShockLeftSide = Primitive_2_Conserved( {1.09406, 1.176560, 0.021003, 0.506113, 0.970815, 1.12838, 1.105355, 0.614087}, gamma, primitiveScalar), - leftFastShockRightSide = primitive2Conserved( + leftFastShockRightSide = Primitive_2_Conserved( {1.40577, 0.693255, 0.210562, 0.611423, 1.494290, 1.12838, 1.457700, 0.809831}, gamma, primitiveScalar), - leftRotationLeftSide = primitive2Conserved( + leftRotationLeftSide = Primitive_2_Conserved( {1.40086, 0.687774, 0.215124, 0.609161, 1.485660, 1.12838, 1.458735, 0.789960}, gamma, primitiveScalar), - leftRotationRightSide = primitive2Conserved( + leftRotationRightSide = Primitive_2_Conserved( {1.40119, 0.687504, 0.330268, 0.334140, 1.486570, 1.12838, 1.588975, 0.475782}, gamma, primitiveScalar), - leftSlowShockLeftSide = primitive2Conserved( + leftSlowShockLeftSide = Primitive_2_Conserved( {1.40519, 0.685492, 0.326265, 0.333664, 1.493710, 1.12838, 1.575785, 0.472390}, gamma, primitiveScalar), - leftSlowShockRightSide = primitive2Conserved( + leftSlowShockRightSide = Primitive_2_Conserved( {1.66488, 0.578545, 0.050746, 0.250260, 1.984720, 1.12838, 1.344490, 0.402407}, gamma, primitiveScalar), - contactLeftSide = primitive2Conserved( + contactLeftSide = Primitive_2_Conserved( {1.65220, 0.578296, 0.049683, 0.249962, 1.981250, 1.12838, 1.346155, 0.402868}, gamma, primitiveScalar), - contactRightSide = primitive2Conserved( + contactRightSide = Primitive_2_Conserved( {1.49279, 0.578276, 0.049650, 0.249924, 1.981160, 1.12838, 1.346180, 0.402897}, gamma, primitiveScalar), - rightSlowShockLeftSide = primitive2Conserved( + rightSlowShockLeftSide = Primitive_2_Conserved( {1.48581, 0.573195, 0.035338, 0.245592, 1.956320, 1.12838, 1.370395, 0.410220}, gamma, primitiveScalar), - rightSlowShockRightSide = primitive2Conserved( + rightSlowShockRightSide = Primitive_2_Conserved( {1.23813, 0.450361, -0.275532, 0.151746, 1.439000, 1.12838, 1.609775, 0.482762}, gamma, primitiveScalar), - rightRotationLeftSide = primitive2Conserved( + rightRotationLeftSide = Primitive_2_Conserved( {1.23762, 0.450102, -0.274410, 0.145585, 1.437950, 1.12838, 1.606945, 0.493879}, gamma, primitiveScalar), - rightRotationRightSide = primitive2Conserved( + rightRotationRightSide = Primitive_2_Conserved( {1.23747, 0.449993, -0.180766, -0.090238, 1.437350, 1.12838, 1.503855, 0.752090}, gamma, primitiveScalar), - rightFastShockLeftSide = primitive2Conserved( + rightFastShockLeftSide = Primitive_2_Conserved( {1.22305, 0.424403, -0.171402, -0.085701, 1.409660, 1.12838, 1.447730, 0.723864}, gamma, primitiveScalar), - rightFastShockRightSide = primitive2Conserved( + rightFastShockRightSide = Primitive_2_Conserved( {1.00006, 0.000121, -0.000057, -0.000028, 1.000100, 1.12838, 1.128435, 0.564217}, gamma, primitiveScalar), - rightICs = primitive2Conserved({1.0, 0.0, 0.0, 1.0, 0.2, Bx, 4 * coef, 2 * coef}, gamma, primitiveScalar); + rightICs = Primitive_2_Conserved({1.0, 0.0, 0.0, 1.0, 0.2, Bx, 4 * coef, 2 * coef}, gamma, primitiveScalar); for (size_t direction = 0; direction < 3; direction++) { // Initial Condition Checks @@ -699,8 +699,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor 0, -1.1102230246251565e-16}; std::vector const scalarFlux{0, 0, 0}; Real thermalEnergyFlux = 0.0; - std::vector const testFluxes = computeFluxes(leftICs, leftICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftICs, leftICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -714,8 +714,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor 0.0, 2.2204460492503131e-16, -1.1283791670955123}; std::vector const scalarFlux{0, 0, 0}; Real thermalEnergyFlux = 0.0; - std::vector const testFluxes = computeFluxes(rightICs, rightICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightICs, rightICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -729,8 +729,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor 0.056156000248263505, -0.42800560867873094}; std::vector const scalarFlux{0.19211858644420357, 0.38677506032368902, 0.57540498691841158}; Real thermalEnergyFlux = 0.24104061926661174; - std::vector const testFluxes = computeFluxes(leftICs, rightICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftICs, rightICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -744,8 +744,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor -0.056156000248263505, -0.55262526758377528}; std::vector const scalarFlux{-0.19211858644420357, -0.38677506032368902, -0.57540498691841158}; Real thermalEnergyFlux = -0.24104061926661174; - std::vector const testFluxes = computeFluxes(rightICs, leftICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightICs, leftICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } // Cross wave checks @@ -762,8 +762,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor std::vector const scalarFlux{1.0717251365527865, 2.157607767226648, 3.2098715673061045}; Real thermalEnergyFlux = 1.2886155333980993; std::vector const testFluxes = - computeFluxes(leftFastShockLeftSide, leftFastShockRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(leftFastShockLeftSide, leftFastShockRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -778,8 +778,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor std::vector const scalarFlux{1.4450678072086958, 2.9092249669830292, 4.3280519500627666}; Real thermalEnergyFlux = 2.081389946702628; std::vector const testFluxes = - computeFluxes(leftFastShockRightSide, leftFastShockLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(leftFastShockRightSide, leftFastShockLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -793,8 +793,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor 0.7248753989305099, -0.059178137562467162}; std::vector const scalarFlux{1.0663278606879119, 2.1467419174572049, 3.1937064501984724}; Real thermalEnergyFlux = 1.5323573637968553; - std::vector const testFluxes = computeFluxes(leftRotationLeftSide, leftRotationRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftRotationLeftSide, leftRotationRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -808,8 +808,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor 0.75541746728406312, -0.13479771672887678}; std::vector const scalarFlux{1.0666336820367937, 2.1473576000564334, 3.1946224007710313}; Real thermalEnergyFlux = 1.5333744977458499; - std::vector const testFluxes = computeFluxes(leftRotationRightSide, leftRotationLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftRotationRightSide, leftRotationLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -824,8 +824,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor std::vector const scalarFlux{0.98208498809672407, 1.9771433235295921, 2.9413947405483505}; Real thermalEnergyFlux = 1.4145715457049737; std::vector const testFluxes = - computeFluxes(leftSlowShockLeftSide, leftSlowShockRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(leftSlowShockLeftSide, leftSlowShockRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -840,8 +840,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor std::vector const scalarFlux{1.1539181074575644, 2.323079478570472, 3.4560437166206879}; Real thermalEnergyFlux = 1.8639570701934713; std::vector const testFluxes = - computeFluxes(leftSlowShockRightSide, leftSlowShockLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(leftSlowShockRightSide, leftSlowShockLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -855,8 +855,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor 0.72241353110189066, -0.049073560388753337}; std::vector const scalarFlux{1.0576895969443709, 2.1293512784652289, 3.1678344087247892}; Real thermalEnergyFlux = 1.7186185770667382; - std::vector const testFluxes = computeFluxes(contactLeftSide, contactRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(contactLeftSide, contactRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -870,8 +870,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor 0.72244123046603836, -0.049025527032060034}; std::vector const scalarFlux{0.95561355347926669, 1.9238507665182214, 2.8621114407298114}; Real thermalEnergyFlux = 1.7184928987481187; - std::vector const testFluxes = computeFluxes(contactRightSide, contactLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(contactRightSide, contactLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -886,8 +886,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor std::vector const scalarFlux{0.89805755065482806, 1.8079784457999033, 2.6897282701827465}; Real thermalEnergyFlux = 1.6022319728249694; std::vector const testFluxes = - computeFluxes(rightSlowShockLeftSide, rightSlowShockRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(rightSlowShockLeftSide, rightSlowShockRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -902,8 +902,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor std::vector const scalarFlux{0.66594699332331575, 1.3406911495770899, 1.994545286188885}; Real thermalEnergyFlux = 1.0487665253534804; std::vector const testFluxes = - computeFluxes(rightSlowShockRightSide, rightSlowShockLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(rightSlowShockRightSide, rightSlowShockLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -918,8 +918,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor std::vector const scalarFlux{0.61661634650230224, 1.2413781978573175, 1.8467974773272691}; Real thermalEnergyFlux = 0.9707694646266285; std::vector const testFluxes = - computeFluxes(rightRotationLeftSide, rightRotationRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(rightRotationLeftSide, rightRotationRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -934,8 +934,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor std::vector const scalarFlux{0.61647714248450702, 1.2410979509359938, 1.8463805541782863}; Real thermalEnergyFlux = 0.9702629326292449; std::vector const testFluxes = - computeFluxes(rightRotationRightSide, rightRotationLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(rightRotationRightSide, rightRotationLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -950,8 +950,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor std::vector const scalarFlux{0.53996724117661621, 1.0870674521621893, 1.6172294888076189}; Real thermalEnergyFlux = 0.84330016382608752; std::vector const testFluxes = - computeFluxes(rightFastShockLeftSide, rightFastShockRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(rightFastShockLeftSide, rightFastShockRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -966,8 +966,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor std::vector const scalarFlux{0.044987744655527385, 0.090569777630660403, 0.13474059488003065}; Real thermalEnergyFlux = 0.060961577855018087; std::vector const testFluxes = - computeFluxes(rightFastShockRightSide, rightFastShockLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(rightFastShockRightSide, rightFastShockLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } } } @@ -990,44 +990,44 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr std::vector const // | Density | X-Velocity | Y-Velocity | Z-Velocity | // Pressure | X-Magnetic Field | Y-Magnetic Field | // Z-Magnetic Field | Adiabatic Index | Passive Scalars | - leftICs = primitive2Conserved({1.0, 0.0, 0.0, 0.0, 1.0, Bx, 0.0, 0.0}, gamma, primitiveScalar), - hydroRareLeftSide = primitive2Conserved( + leftICs = Primitive_2_Conserved({1.0, 0.0, 0.0, 0.0, 1.0, Bx, 0.0, 0.0}, gamma, primitiveScalar), + hydroRareLeftSide = Primitive_2_Conserved( {0.990414, 0.012415, 1.458910e-58, 6.294360e-59, 0.984076, Bx, 1.252355e-57, 5.366795e-58}, gamma, primitiveScalar), - hydroRareRightSide = primitive2Conserved( + hydroRareRightSide = Primitive_2_Conserved( {0.939477, 0.079800, 1.557120e-41, 7.505190e-42, 0.901182, Bx, 1.823624e-40, 8.712177e-41}, gamma, primitiveScalar), - switchOnSlowShockLeftSide = primitive2Conserved( + switchOnSlowShockLeftSide = Primitive_2_Conserved( {0.939863, 0.079142, 1.415730e-02, 7.134030e-03, 0.901820, Bx, 2.519650e-02, 1.290082e-02}, gamma, primitiveScalar), - switchOnSlowShockRightSide = primitive2Conserved( + switchOnSlowShockRightSide = Primitive_2_Conserved( {0.651753, 0.322362, 8.070540e-01, 4.425110e-01, 0.490103, Bx, 6.598380e-01, 3.618000e-01}, gamma, primitiveScalar), - contactLeftSide = primitive2Conserved( + contactLeftSide = Primitive_2_Conserved( {0.648553, 0.322525, 8.072970e-01, 4.426950e-01, 0.489951, Bx, 6.599295e-01, 3.618910e-01}, gamma, primitiveScalar), - contactRightSide = primitive2Conserved( + contactRightSide = Primitive_2_Conserved( {0.489933, 0.322518, 8.073090e-01, 4.426960e-01, 0.489980, Bx, 6.599195e-01, 3.618850e-01}, gamma, primitiveScalar), - slowShockLeftSide = primitive2Conserved( + slowShockLeftSide = Primitive_2_Conserved( {0.496478, 0.308418, 8.060830e-01, 4.420150e-01, 0.489823, Bx, 6.686695e-01, 3.666915e-01}, gamma, primitiveScalar), - slowShockRightSide = primitive2Conserved( + slowShockRightSide = Primitive_2_Conserved( {0.298260, -0.016740, 2.372870e-01, 1.287780e-01, 0.198864, Bx, 8.662095e-01, 4.757390e-01}, gamma, primitiveScalar), - rotationLeftSide = primitive2Conserved( + rotationLeftSide = Primitive_2_Conserved( {0.298001, -0.017358, 2.364790e-01, 1.278540e-01, 0.198448, Bx, 8.669425e-01, 4.750845e-01}, gamma, primitiveScalar), - rotationRightSide = primitive2Conserved( + rotationRightSide = Primitive_2_Conserved( {0.297673, -0.018657, 1.059540e-02, 9.996860e-01, 0.197421, Bx, 9.891580e-01, 1.024949e-04}, gamma, primitiveScalar), - fastRareLeftSide = primitive2Conserved( + fastRareLeftSide = Primitive_2_Conserved( {0.297504, -0.020018, 1.137420e-02, 1.000000e+00, 0.197234, Bx, 9.883860e-01, -4.981931e-17}, gamma, primitiveScalar), - fastRareRightSide = primitive2Conserved( + fastRareRightSide = Primitive_2_Conserved( {0.299996, -0.000033, 1.855120e-05, 1.000000e+00, 0.199995, Bx, 9.999865e-01, 1.737190e-16}, gamma, primitiveScalar), - rightICs = primitive2Conserved({0.3, 0.0, 0.0, 1.0, 0.2, Bx, 1.0, 0.0}, gamma, primitiveScalar); + rightICs = Primitive_2_Conserved({0.3, 0.0, 0.0, 1.0, 0.2, Bx, 1.0, 0.0}, gamma, primitiveScalar); for (size_t direction = 0; direction < 3; direction++) { // Initial Condition Checks @@ -1041,8 +1041,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr std::vector const fiducialFlux{0, 0.75499999999999989, 0, 0, 2.2204460492503131e-16, 0.0, 0, 0}; std::vector const scalarFlux{0, 0, 0}; Real thermalEnergyFlux = 0.0; - std::vector const testFluxes = computeFluxes(leftICs, leftICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftICs, leftICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1056,8 +1056,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr -0.69999999999999996}; std::vector const scalarFlux{-6.1450707278254418e-17, -1.2371317869019906e-16, -1.8404800947169341e-16}; Real thermalEnergyFlux = 0.0; - std::vector const testFluxes = computeFluxes(rightICs, rightICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightICs, rightICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1071,8 +1071,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr -0.40407579574102892, -0.21994567048141428}; std::vector const scalarFlux{0.10231837561464294, 0.20598837745492582, 0.30644876517012837}; Real thermalEnergyFlux = 0.13864309478397996; - std::vector const testFluxes = computeFluxes(leftICs, rightICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftICs, rightICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1086,8 +1086,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr 0.40407579574102892, -0.21994567048141428}; std::vector const scalarFlux{-0.10231837561464294, -0.20598837745492582, -0.30644876517012837}; Real thermalEnergyFlux = -0.13864309478397996; - std::vector const testFluxes = computeFluxes(rightICs, leftICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightICs, leftICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } // Cross wave checks @@ -1103,8 +1103,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr -6.3466063324344113e-41, -3.0340891384335242e-41}; std::vector const scalarFlux{0.081956845911157775, 0.16499634214430131, 0.24546494288869905}; Real thermalEnergyFlux = 0.11034221894046368; - std::vector const testFluxes = computeFluxes(hydroRareLeftSide, hydroRareRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(hydroRareLeftSide, hydroRareRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1118,8 +1118,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr 6.2022392844946449e-41, 2.9606965476795895e-41}; std::vector const scalarFlux{0.014763904657692993, 0.029722840565719184, 0.044218649135708464}; Real thermalEnergyFlux = 0.019189877201961154; - std::vector const testFluxes = computeFluxes(hydroRareRightSide, hydroRareLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(hydroRareRightSide, hydroRareLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1134,8 +1134,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr std::vector const scalarFlux{0.21846177846784187, 0.43980943806215089, 0.65430419361309078}; Real thermalEnergyFlux = 0.2840373040888583; std::vector const testFluxes = - computeFluxes(switchOnSlowShockLeftSide, switchOnSlowShockRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(switchOnSlowShockLeftSide, switchOnSlowShockRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1150,8 +1150,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr std::vector const scalarFlux{0.10803549193474633, 0.21749813322875222, 0.32357182079044206}; Real thermalEnergyFlux = 0.1100817647375162; std::vector const testFluxes = - computeFluxes(switchOnSlowShockRightSide, switchOnSlowShockLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(switchOnSlowShockRightSide, switchOnSlowShockLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1165,8 +1165,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr -0.35226977371803297, -0.19316940226499904}; std::vector const scalarFlux{0.23154817591476573, 0.46615510432814616, 0.69349862290347741}; Real thermalEnergyFlux = 0.23702444986592192; - std::vector const testFluxes = computeFluxes(contactLeftSide, contactRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(contactLeftSide, contactRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1180,8 +1180,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr -0.3522739911439669, -0.19317084712861482}; std::vector const scalarFlux{0.17492525964231936, 0.35216128279157616, 0.52391009427617696}; Real thermalEnergyFlux = 0.23704936434506069; - std::vector const testFluxes = computeFluxes(contactRightSide, contactLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(contactRightSide, contactLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1195,8 +1195,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr -0.37198011453582402, -0.20397277844271294}; std::vector const scalarFlux{0.13001118457092631, 0.26173981750473918, 0.38939014356639379}; Real thermalEnergyFlux = 0.1738058891582446; - std::vector const testFluxes = computeFluxes(slowShockLeftSide, slowShockRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(slowShockLeftSide, slowShockRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1210,8 +1210,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr -0.15165427985881363, -0.082233932588833825}; std::vector const scalarFlux{0.042554081172858457, 0.085670301959209896, 0.12745164834795927}; Real thermalEnergyFlux = 0.038445630017261548; - std::vector const testFluxes = computeFluxes(slowShockRightSide, slowShockLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(slowShockRightSide, slowShockLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1225,8 +1225,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr -0.18030635192654354, -0.098381113757603278}; std::vector const scalarFlux{-0.0058303751166299484, -0.011737769516117116, -0.017462271505355991}; Real thermalEnergyFlux = -0.0052395622905745485; - std::vector const testFluxes = computeFluxes(rotationLeftSide, rotationRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rotationLeftSide, rotationRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1240,8 +1240,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr -0.026148289294373184, -0.69914753968916865}; std::vector const scalarFlux{-0.0060437957583491572, -0.012167430087241717, -0.018101477236719343}; Real thermalEnergyFlux = -0.0054536013916442853; - std::vector const testFluxes = computeFluxes(rotationRightSide, rotationLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rotationRightSide, rotationLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1255,8 +1255,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr -0.027710302430178135, -0.70000000000000007}; std::vector const scalarFlux{-0.0065705619215052757, -0.013227920997059845, -0.019679168822056604}; Real thermalEnergyFlux = -0.0059354109546219782; - std::vector const testFluxes = computeFluxes(fastRareLeftSide, fastRareRightSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(fastRareLeftSide, fastRareRightSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1270,8 +1270,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, RyuAndJones4dShockTubeCorrectInputExpectCorr -8.2898844654399895e-05, -0.69999999999999984}; std::vector const scalarFlux{-3.340017317660794e-05, -6.7241562798797897e-05, -0.00010003522597924373}; Real thermalEnergyFlux = -3.000421709818028e-05; - std::vector const testFluxes = computeFluxes(fastRareRightSide, fastRareLeftSide, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(fastRareRightSide, fastRareLeftSide, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } } } @@ -1299,17 +1299,17 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC std::vector const // | Density | X-Velocity | Y-Velocity | Z-Velocity | // Pressure | X-Magnetic Field | Y-Magnetic Field | // Z-Magnetic Field | Adiabatic Index | Passive Scalars | - leftICs = primitive2Conserved({1.0, -V0, Vy, Vz, 0.45, Bx, 0.5, Bz}, gamma, primitiveScalar), + leftICs = Primitive_2_Conserved({1.0, -V0, Vy, Vz, 0.45, Bx, 0.5, Bz}, gamma, primitiveScalar), leftRarefactionCenter = - primitive2Conserved({0.368580, -1.180830, Vy, Vz, 0.111253, Bx, 0.183044, Bz}, gamma, primitiveScalar), + Primitive_2_Conserved({0.368580, -1.180830, Vy, Vz, 0.111253, Bx, 0.183044, Bz}, gamma, primitiveScalar), leftVxTurnOver = - primitive2Conserved({0.058814, -0.125475, Vy, Vz, 0.008819, Bx, 0.029215, Bz}, gamma, primitiveScalar), - midPoint = primitive2Conserved({0.034658, 0.000778, Vy, Vz, 0.006776, Bx, 0.017333, Bz}, gamma, primitiveScalar), + Primitive_2_Conserved({0.058814, -0.125475, Vy, Vz, 0.008819, Bx, 0.029215, Bz}, gamma, primitiveScalar), + midPoint = Primitive_2_Conserved({0.034658, 0.000778, Vy, Vz, 0.006776, Bx, 0.017333, Bz}, gamma, primitiveScalar), rightVxTurnOver = - primitive2Conserved({0.062587, 0.152160, Vy, Vz, 0.009521, Bx, 0.031576, Bz}, gamma, primitiveScalar), + Primitive_2_Conserved({0.062587, 0.152160, Vy, Vz, 0.009521, Bx, 0.031576, Bz}, gamma, primitiveScalar), rightRarefactionCenter = - primitive2Conserved({0.316485, 1.073560, Vy, Vz, 0.089875, Bx, 0.159366, Bz}, gamma, primitiveScalar), - rightICs = primitive2Conserved({1.0, V0, Vy, Vz, 0.45, Bx, 0.5, Bz}, gamma, primitiveScalar); + Primitive_2_Conserved({0.316485, 1.073560, Vy, Vz, 0.089875, Bx, 0.159366, Bz}, gamma, primitiveScalar), + rightICs = Primitive_2_Conserved({1.0, V0, Vy, Vz, 0.45, Bx, 0.5, Bz}, gamma, primitiveScalar); for (size_t direction = 0; direction < 3; direction++) { // Initial Condition Checks @@ -1323,8 +1323,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC std::vector const fiducialFlux{-2, 4.5750000000000002, -0, -0, -6.75, 0.0, -1, -0}; std::vector const scalarFlux{-2.2139950592000002, -4.4572370036000004, -6.6310283749999996}; Real thermalEnergyFlux = -1.3499999999999996; - std::vector const testFluxes = computeFluxes(leftICs, leftICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftICs, leftICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1336,8 +1336,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC std::vector const fiducialFlux{2, 4.5750000000000002, 0, 0, 6.75, 0.0, 1, 0}; std::vector const scalarFlux{2.2139950592000002, 4.4572370036000004, 6.6310283749999996}; Real thermalEnergyFlux = 1.3499999999999996; - std::vector const testFluxes = computeFluxes(rightICs, rightICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightICs, rightICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1349,8 +1349,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC std::vector const fiducialFlux{0, -1.4249999999999998, -0, -0, 0, 0.0, 0, -0}; std::vector const scalarFlux{0, 0, 0}; Real thermalEnergyFlux = 0.0; - std::vector const testFluxes = computeFluxes(leftICs, rightICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftICs, rightICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1362,8 +1362,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC std::vector const fiducialFlux{0, 10.574999999999999, 0, 0, 0, 0.0, 0, 0}; std::vector const scalarFlux{0, 0, 0}; Real thermalEnergyFlux = 0.0; - std::vector const testFluxes = computeFluxes(rightICs, leftICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightICs, leftICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } // Intermediate state checks @@ -1378,8 +1378,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC -0.43523032140000006, 0.64193857338676208, -0, -0, -0.67142479846795033, 0.0, -0.21614384652000002, -0}; std::vector const scalarFlux{-0.48179889059681413, -0.9699623468164007, -1.4430123054318851}; Real thermalEnergyFlux = -0.19705631998499995; - std::vector const testFluxes = computeFluxes(leftICs, leftRarefactionCenter, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftICs, leftRarefactionCenter, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1391,8 +1391,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC std::vector const fiducialFlux{-2, 4.5750000000000002, -0, -0, -6.75, 0.0, -1, -0}; std::vector const scalarFlux{-2.2139950592000002, -4.4572370036000004, -6.6310283749999996}; Real thermalEnergyFlux = -1.3499999999999996; - std::vector const testFluxes = computeFluxes(leftRarefactionCenter, leftICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftRarefactionCenter, leftICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1405,8 +1405,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC -0.023176056428381629, -2.0437812714100764e-05, 0, 0, -0.00098843768795337005, 0.0, -0.011512369309265979, 0}; std::vector const scalarFlux{-0.025655837212088663, -0.051650588155052128, -0.076840543898599858}; Real thermalEnergyFlux = -0.0052127803322822184; - std::vector const testFluxes = computeFluxes(leftRarefactionCenter, leftVxTurnOver, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftRarefactionCenter, leftVxTurnOver, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1419,8 +1419,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC -0.43613091609689758, 0.64135749005731213, 0, 0, -0.67086080671260462, 0.0, -0.21659109937066717, 0}; std::vector const scalarFlux{-0.48279584670145054, -0.9719694288205295, -1.445998239926636}; Real thermalEnergyFlux = -0.19746407621898149; - std::vector const testFluxes = computeFluxes(leftVxTurnOver, leftRarefactionCenter, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftVxTurnOver, leftRarefactionCenter, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1433,8 +1433,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC -0.0011656375857387598, 0.0062355370788444902, 0, 0, -0.00055517615333601446, 0.0, -0.0005829533231464588, 0}; std::vector const scalarFlux{-0.0012903579278217153, -0.0025977614899708843, -0.0038646879530001054}; Real thermalEnergyFlux = -0.00034184143405415065; - std::vector const testFluxes = computeFluxes(leftVxTurnOver, midPoint, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(leftVxTurnOver, midPoint, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1447,8 +1447,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC -0.0068097924351817191, 0.010501781004354172, 0, 0, -0.0027509360975397175, 0.0, -0.0033826654536986789, 0}; std::vector const scalarFlux{-0.0075384234028349319, -0.015176429414463658, -0.022577963432775162}; Real thermalEnergyFlux = -0.001531664896602873; - std::vector const testFluxes = computeFluxes(midPoint, leftVxTurnOver, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(midPoint, leftVxTurnOver, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1461,8 +1461,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC 0.0013952100758668729, 0.0061359407125797273, 0, 0, 0.00065984543596031629, 0.0, 0.00069776606396793105, 0}; std::vector const scalarFlux{0.001544494107257657, 0.0031093909889746947, 0.0046258388010795683}; Real thermalEnergyFlux = 0.00040916715364737997; - std::vector const testFluxes = computeFluxes(midPoint, rightVxTurnOver, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(midPoint, rightVxTurnOver, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1475,8 +1475,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC 0.0090024688079190333, 0.011769373146023688, 0, 0, 0.003725251767222792, 0.0, 0.0045418689996141555, 0}; std::vector const scalarFlux{0.0099657107306674268, 0.020063068547205749, 0.029847813055181766}; Real thermalEnergyFlux = 0.0020542406295284269; - std::vector const testFluxes = computeFluxes(rightVxTurnOver, midPoint, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightVxTurnOver, midPoint, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1489,8 +1489,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC 0.023310393229073981, 0.0033086897645311728, 0, 0, 0.0034208520409618887, 0.0, 0.011760413130542123, 0}; std::vector const scalarFlux{0.025804547718589466, 0.051949973634547723, 0.077285939467198722}; Real thermalEnergyFlux = 0.0053191138878843835; - std::vector const testFluxes = computeFluxes(rightVxTurnOver, rightRarefactionCenter, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightVxTurnOver, rightRarefactionCenter, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1503,8 +1503,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC 0.33914253809565298, 0.46770133685446141, 0, 0, 0.46453338019960133, 0.0, 0.17077520175095764, 0}; std::vector const scalarFlux{0.37542995185416178, 0.75581933514738364, 1.1244318966408966}; Real thermalEnergyFlux = 0.1444638874418068; - std::vector const testFluxes = computeFluxes(rightRarefactionCenter, rightVxTurnOver, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightRarefactionCenter, rightVxTurnOver, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1517,8 +1517,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC 0.33976563660000003, 0.46733255780629601, 0, 0, 0.46427650313257612, 0.0, 0.17108896296000001, 0}; std::vector const scalarFlux{0.37611972035917141, 0.75720798400261535, 1.1264977885722693}; Real thermalEnergyFlux = 0.14472930749999999; - std::vector const testFluxes = computeFluxes(rightRarefactionCenter, rightICs, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightRarefactionCenter, rightICs, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1530,8 +1530,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC std::vector const fiducialFlux{2, 4.5750000000000002, 0, 0, 6.75, 0.0, 1, 0}; std::vector const scalarFlux{2.2139950592000002, 4.4572370036000004, 6.6310283749999996}; Real thermalEnergyFlux = 1.3499999999999996; - std::vector const testFluxes = computeFluxes(rightICs, rightRarefactionCenter, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(rightICs, rightRarefactionCenter, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } } } @@ -1554,8 +1554,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, ConstantStatesExpectCorrectFlux) std::vector const // | Density | X-Velocity | Y-Velocity | Z-Velocity | // Pressure | X-Magnetic Field | Y-Magnetic Field | // Z-Magnetic Field | Adiabatic Index | Passive Scalars | - zeroMagneticField = primitive2Conserved({1e4, 0.0, 0.0, 0.0, 1.380658E-5, 0.0, 0.0, 0.0}, gamma, primitiveScalar), - onesMagneticField = primitive2Conserved({1e4, 0.0, 0.0, 0.0, 1.380658E-5, 1.0, 1.0, 1.0}, gamma, primitiveScalar); + zeroMagneticField = Primitive_2_Conserved({1e4, 0.0, 0.0, 0.0, 1.380658E-5, 0.0, 0.0, 0.0}, gamma, primitiveScalar), + onesMagneticField = Primitive_2_Conserved({1e4, 0.0, 0.0, 0.0, 1.380658E-5, 1.0, 1.0, 1.0}, gamma, primitiveScalar); for (size_t direction = 0; direction < 3; direction++) { { @@ -1568,8 +1568,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, ConstantStatesExpectCorrectFlux) std::vector const fiducialFlux{0, 1.380658e-05, 0, 0, 0, 0, 0, 0}; std::vector const scalarFlux{0, 0, 0}; Real thermalEnergyFlux = 0.; - std::vector const testFluxes = computeFluxes(zeroMagneticField, zeroMagneticField, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(zeroMagneticField, zeroMagneticField, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1583,8 +1583,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, ConstantStatesExpectCorrectFlux) 3.4694469519536142e-18, 3.4694469519536142e-18}; std::vector const scalarFlux{1.5731381063233131e-14, 3.1670573744690958e-14, 4.7116290424753513e-14}; Real thermalEnergyFlux = 0.; - std::vector const testFluxes = computeFluxes(onesMagneticField, onesMagneticField, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(onesMagneticField, onesMagneticField, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } } } @@ -1606,7 +1606,7 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DegenerateStateCorrectInputExpectCorrectOutp // Pressure | X-Magnetic Field | Y-Magnetic Field | // Z-Magnetic Field | Adiabatic Index | Passive // Scalars | - state = primitive2Conserved({1.0, 1.0, 1.0, 1.0, 1.0, 3.0E4, 1.0, 1.0}, gamma, primitiveScalar); + state = Primitive_2_Conserved({1.0, 1.0, 1.0, 1.0, 1.0, 3.0E4, 1.0, 1.0}, gamma, primitiveScalar); std::vector const fiducialFlux{1, -449999997, -29999, -29999, -59994, 0.0, -29999, -29999}; std::vector const scalarFlux{1.1069975296000001, 2.2286185018000002, 3.3155141874999998}; @@ -1623,8 +1623,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DegenerateStateCorrectInputExpectCorrectOutp // the Athena solver with theses tests gave me -0.00080700946455175148 // though for (size_t direction = 0; direction < 3; direction++) { - std::vector const testFluxes = computeFluxes(state, state, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(state, state, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } } // ========================================================================= @@ -1658,8 +1658,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, AllZeroesExpectAllZeroes) for (size_t direction = 0; direction < 3; direction++) { // Compute the fluxes and check for correctness // Order of Fluxes is rho, vec(V), E, vec(B) - std::vector const testFluxes = computeFluxes(state, state, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(state, state, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } } // ========================================================================= @@ -1733,8 +1733,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, UnphysicalValuesExpectAutomaticFix) std::vector const fiducialFlux{1, 1.5, 0, 0, -1.6254793235168146e-16, 0, 0, 0}; std::vector const scalarFlux{1.1069975296000001, 2.2286185018000002, 3.3155141874999998}; Real thermalEnergyFlux = -1.5; - std::vector const testFluxes = computeFluxes(negativePressure, negativePressure, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(negativePressure, negativePressure, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1746,8 +1746,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, UnphysicalValuesExpectAutomaticFix) std::vector const fiducialFlux{1, 1.5, 0, 0, -1.5, 0, 0, 0}; std::vector const scalarFlux{1.1069975296000001, 2.2286185018000002, 3.3155141874999998}; Real thermalEnergyFlux = -6.333333333333333; - std::vector const testFluxes = computeFluxes(negativeEnergy, negativeEnergy, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(negativeEnergy, negativeEnergy, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1759,8 +1759,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, UnphysicalValuesExpectAutomaticFix) std::vector const fiducialFlux{1, 1E+20, 1e+20, 1e+20, -5e+19, 0, 0, 0}; std::vector const scalarFlux{1.1069975296000002e+20, 2.2286185018000002e+20, 3.3155141874999997e+20}; Real thermalEnergyFlux = -1.5000000000000001e+40; - std::vector const testFluxes = computeFluxes(negativeDensity, negativeDensity, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + std::vector const testFluxes = Compute_Fluxes(negativeDensity, negativeDensity, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1773,8 +1773,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, UnphysicalValuesExpectAutomaticFix) std::vector const scalarFlux{-1.1069975296000002e+20, -2.2286185018000002e+20, -3.3155141874999997e+20}; Real thermalEnergyFlux = 1.5000000000000001e+40; std::vector const testFluxes = - computeFluxes(negativeDensityEnergyPressure, negativeDensityEnergyPressure, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(negativeDensityEnergyPressure, negativeDensityEnergyPressure, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { std::string const outputString{ @@ -1787,8 +1787,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, UnphysicalValuesExpectAutomaticFix) std::vector const scalarFlux{1.1069975296000002e+20, 2.2286185018000002e+20, 3.3155141874999997e+20}; Real thermalEnergyFlux = -1.5000000000000001e+40; std::vector const testFluxes = - computeFluxes(negativeDensityPressure, negativeDensityPressure, gamma, direction); - checkResults(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); + Compute_Fluxes(negativeDensityPressure, negativeDensityPressure, gamma, direction); + Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } } } @@ -1878,8 +1878,8 @@ TEST(tMHDHlldInternalApproximateLRWaveSpeeds, CorrectInputExpectCorrectOutput) parameters.stateLVec.at(i), parameters.stateRVec.at(i), parameters.magneticX.at(i), parameters.gamma); // Now check results - testingUtilities::checkResults(fiducialSpeedL[i], testSpeed.L, parameters.names.at(i) + ", SpeedL"); - testingUtilities::checkResults(fiducialSpeedR.at(i), testSpeed.R, parameters.names.at(i) + ", SpeedR"); + testingUtilities::Check_Results(fiducialSpeedL[i], testSpeed.L, parameters.names.at(i) + ", SpeedL"); + testingUtilities::Check_Results(fiducialSpeedR.at(i), testSpeed.R, parameters.names.at(i) + ", SpeedR"); } } // ========================================================================= @@ -1902,7 +1902,7 @@ TEST(tMHDHlldInternalApproximateMiddleWaveSpeed, CorrectInputExpectCorrectOutput parameters.speed.at(i)); // Now check results - testingUtilities::checkResults(fiducialSpeedM.at(i), testSpeed.M, parameters.names.at(i) + ", SpeedM"); + testingUtilities::Check_Results(fiducialSpeedM.at(i), testSpeed.M, parameters.names.at(i) + ", SpeedM"); } } // ========================================================================= @@ -1927,8 +1927,8 @@ TEST(tMHDHlldInternalApproximateStarWaveSpeed, CorrectInputExpectCorrectOutput) parameters.magneticX.at(i), 1); // Now check results - testingUtilities::checkResults(fiducialSpeedStarL.at(i), testSpeed.LStar, parameters.names.at(i) + ", SpeedStarL"); - testingUtilities::checkResults(fiducialSpeedStarR.at(i), testSpeed.RStar, parameters.names.at(i) + ", SpeedStarR"); + testingUtilities::Check_Results(fiducialSpeedStarL.at(i), testSpeed.LStar, parameters.names.at(i) + ", SpeedStarL"); + testingUtilities::Check_Results(fiducialSpeedStarR.at(i), testSpeed.RStar, parameters.names.at(i) + ", SpeedStarR"); } } // ========================================================================= @@ -1953,18 +1953,18 @@ TEST(tMHDHlldInternalNonStarFluxes, CorrectInputExpectCorrectOutput) mhd::_internal::nonStarFluxes(parameters.stateLVec.at(i), parameters.magneticX.at(i)); // Now check results - testingUtilities::checkResults(fiducialFlux[i].density, testFlux.density, parameters.names.at(i) + ", DensityFlux"); - testingUtilities::checkResults(fiducialFlux[i].momentumX, testFlux.momentumX, + testingUtilities::Check_Results(fiducialFlux[i].density, testFlux.density, parameters.names.at(i) + ", DensityFlux"); + testingUtilities::Check_Results(fiducialFlux[i].momentumX, testFlux.momentumX, parameters.names.at(i) + ", MomentumFluxX"); - testingUtilities::checkResults(fiducialFlux[i].momentumY, testFlux.momentumY, + testingUtilities::Check_Results(fiducialFlux[i].momentumY, testFlux.momentumY, parameters.names.at(i) + ", MomentumFluxY"); - testingUtilities::checkResults(fiducialFlux[i].momentumZ, testFlux.momentumZ, + testingUtilities::Check_Results(fiducialFlux[i].momentumZ, testFlux.momentumZ, parameters.names.at(i) + ", MomentumFluxZ"); - testingUtilities::checkResults(fiducialFlux[i].magneticY, testFlux.magneticY, + testingUtilities::Check_Results(fiducialFlux[i].magneticY, testFlux.magneticY, parameters.names.at(i) + ", MagneticFluxY"); - testingUtilities::checkResults(fiducialFlux[i].magneticZ, testFlux.magneticZ, + testingUtilities::Check_Results(fiducialFlux[i].magneticZ, testFlux.magneticZ, parameters.names.at(i) + ", MagneticFluxZ"); - testingUtilities::checkResults(fiducialFlux[i].energy, testFlux.energy, parameters.names.at(i) + ", EnergyFlux"); + testingUtilities::Check_Results(fiducialFlux[i].energy, testFlux.energy, parameters.names.at(i) + ", EnergyFlux"); } } // ========================================================================= @@ -1991,15 +1991,15 @@ TEST(tMHDHlldInternalComputeStarState, CorrectInputNonDegenerateExpectCorrectOut parameters.magneticX.at(i), parameters.totalPressureStar.at(i)); // Now check results - testingUtilities::checkResults(fiducialStarState.at(i).velocityY, testStarState.velocityY, + testingUtilities::Check_Results(fiducialStarState.at(i).velocityY, testStarState.velocityY, parameters.names.at(i) + ", VelocityStarY"); - testingUtilities::checkResults(fiducialStarState.at(i).velocityZ, testStarState.velocityZ, + testingUtilities::Check_Results(fiducialStarState.at(i).velocityZ, testStarState.velocityZ, parameters.names.at(i) + ", VelocityStarZ"); - testingUtilities::checkResults(fiducialStarState.at(i).energy, testStarState.energy, + testingUtilities::Check_Results(fiducialStarState.at(i).energy, testStarState.energy, parameters.names.at(i) + ", EnergyStar"); - testingUtilities::checkResults(fiducialStarState.at(i).magneticY, testStarState.magneticY, + testingUtilities::Check_Results(fiducialStarState.at(i).magneticY, testStarState.magneticY, parameters.names.at(i) + ", MagneticStarY"); - testingUtilities::checkResults(fiducialStarState.at(i).magneticZ, testStarState.magneticZ, + testingUtilities::Check_Results(fiducialStarState.at(i).magneticZ, testStarState.magneticZ, parameters.names.at(i) + ", MagneticStarZ"); } } @@ -2029,19 +2029,19 @@ TEST(tMHDHlldInternalStarFluxes, CorrectInputNonDegenerateExpectCorrectOutput) parameters.speed.at(i), parameters.speed.at(i).L); // Now check results - testingUtilities::checkResults(fiducialFlux[i].density, testFlux.density, + testingUtilities::Check_Results(fiducialFlux[i].density, testFlux.density, parameters.names.at(i) + ", DensityStarFlux"); - testingUtilities::checkResults(fiducialFlux[i].momentumX, testFlux.momentumX, + testingUtilities::Check_Results(fiducialFlux[i].momentumX, testFlux.momentumX, parameters.names.at(i) + ", MomentumStarFluxX"); - testingUtilities::checkResults(fiducialFlux[i].momentumY, testFlux.momentumY, + testingUtilities::Check_Results(fiducialFlux[i].momentumY, testFlux.momentumY, parameters.names.at(i) + ", MomentumStarFluxY"); - testingUtilities::checkResults(fiducialFlux[i].momentumZ, testFlux.momentumZ, + testingUtilities::Check_Results(fiducialFlux[i].momentumZ, testFlux.momentumZ, parameters.names.at(i) + ", MomentumStarFluxZ"); - testingUtilities::checkResults(fiducialFlux[i].energy, testFlux.energy, + testingUtilities::Check_Results(fiducialFlux[i].energy, testFlux.energy, parameters.names.at(i) + ", EnergyStarFlux"); - testingUtilities::checkResults(fiducialFlux[i].magneticY, testFlux.magneticY, + testingUtilities::Check_Results(fiducialFlux[i].magneticY, testFlux.magneticY, parameters.names.at(i) + ", MagneticStarFluxY", 1.0E-13); - testingUtilities::checkResults(fiducialFlux[i].magneticZ, testFlux.magneticZ, + testingUtilities::Check_Results(fiducialFlux[i].magneticZ, testFlux.magneticZ, parameters.names.at(i) + ", MagneticStarFluxZ", 7.0E-13); } } @@ -2071,15 +2071,15 @@ TEST(tMHDHlldInternalComputeStarState, CorrectInputDegenerateExpectCorrectOutput parameters.magneticX.at(i), parameters.totalPressureStar.at(i)); // Now check results - testingUtilities::checkResults(fiducialStarState.at(i).velocityY, testStarState.velocityY, + testingUtilities::Check_Results(fiducialStarState.at(i).velocityY, testStarState.velocityY, parameters.names.at(i) + ", VelocityStarY"); - testingUtilities::checkResults(fiducialStarState.at(i).velocityZ, testStarState.velocityZ, + testingUtilities::Check_Results(fiducialStarState.at(i).velocityZ, testStarState.velocityZ, parameters.names.at(i) + ", VelocityStarZ"); - testingUtilities::checkResults(fiducialStarState.at(i).energy, testStarState.energy, + testingUtilities::Check_Results(fiducialStarState.at(i).energy, testStarState.energy, parameters.names.at(i) + ", EnergyStar"); - testingUtilities::checkResults(fiducialStarState.at(i).magneticY, testStarState.magneticY, + testingUtilities::Check_Results(fiducialStarState.at(i).magneticY, testStarState.magneticY, parameters.names.at(i) + ", MagneticStarY"); - testingUtilities::checkResults(fiducialStarState.at(i).magneticZ, testStarState.magneticZ, + testingUtilities::Check_Results(fiducialStarState.at(i).magneticZ, testStarState.magneticZ, parameters.names.at(i) + ", MagneticStarZ"); } } @@ -2106,19 +2106,19 @@ TEST(tMHDHlldInternalStarFluxes, CorrectInputDegenerateExpectCorrectOutput) parameters.speed.at(i), parameters.speed.at(i).L); // Now check results - testingUtilities::checkResults(fiducialFlux[i].density, testFlux.density, + testingUtilities::Check_Results(fiducialFlux[i].density, testFlux.density, parameters.names.at(i) + ", DensityStarFlux"); - testingUtilities::checkResults(fiducialFlux[i].momentumX, testFlux.momentumX, + testingUtilities::Check_Results(fiducialFlux[i].momentumX, testFlux.momentumX, parameters.names.at(i) + ", MomentumStarFluxX"); - testingUtilities::checkResults(fiducialFlux[i].momentumY, testFlux.momentumY, + testingUtilities::Check_Results(fiducialFlux[i].momentumY, testFlux.momentumY, parameters.names.at(i) + ", MomentumStarFluxY"); - testingUtilities::checkResults(fiducialFlux[i].momentumZ, testFlux.momentumZ, + testingUtilities::Check_Results(fiducialFlux[i].momentumZ, testFlux.momentumZ, parameters.names.at(i) + ", MomentumStarFluxZ"); - testingUtilities::checkResults(fiducialFlux[i].energy, testFlux.energy, + testingUtilities::Check_Results(fiducialFlux[i].energy, testFlux.energy, parameters.names.at(i) + ", EnergyStarFlux"); - testingUtilities::checkResults(fiducialFlux[i].magneticY, testFlux.magneticY, + testingUtilities::Check_Results(fiducialFlux[i].magneticY, testFlux.magneticY, parameters.names.at(i) + ", MagneticStarFluxY"); - testingUtilities::checkResults(fiducialFlux[i].magneticZ, testFlux.magneticZ, + testingUtilities::Check_Results(fiducialFlux[i].magneticZ, testFlux.magneticZ, parameters.names.at(i) + ", MagneticStarFluxZ"); } } @@ -2146,17 +2146,17 @@ TEST(tMHDHlldInternalDoubleStarState, CorrectInputNonDegenerateExpectCorrectOutp parameters.totalPressureStar.at(i), parameters.speed.at(i)); // Now check results - testingUtilities::checkResults(fiducialState.at(i).velocityY, testState.velocityY, + testingUtilities::Check_Results(fiducialState.at(i).velocityY, testState.velocityY, parameters.names.at(i) + ", VelocityDoubleStarY"); - testingUtilities::checkResults(fiducialState.at(i).velocityZ, testState.velocityZ, + testingUtilities::Check_Results(fiducialState.at(i).velocityZ, testState.velocityZ, parameters.names.at(i) + ", VelocityDoubleStarZ"); - testingUtilities::checkResults(fiducialState.at(i).magneticY, testState.magneticY, + testingUtilities::Check_Results(fiducialState.at(i).magneticY, testState.magneticY, parameters.names.at(i) + ", MagneticDoubleStarY"); - testingUtilities::checkResults(fiducialState.at(i).magneticZ, testState.magneticZ, + testingUtilities::Check_Results(fiducialState.at(i).magneticZ, testState.magneticZ, parameters.names.at(i) + ", MagneticDoubleStarZ"); - testingUtilities::checkResults(fiducialState.at(i).energyL, testState.energyL, + testingUtilities::Check_Results(fiducialState.at(i).energyL, testState.energyL, parameters.names.at(i) + ", EnergyDoubleStarL"); - testingUtilities::checkResults(fiducialState.at(i).energyR, testState.energyR, + testingUtilities::Check_Results(fiducialState.at(i).energyR, testState.energyR, parameters.names.at(i) + ", EnergyDoubleStarR"); } } @@ -2180,17 +2180,17 @@ TEST(tMHDHlldInternalDoubleStarState, CorrectInputDegenerateExpectCorrectOutput) parameters.totalPressureStar.at(i), parameters.speed.at(i)); // Now check results - testingUtilities::checkResults(fiducialState.at(i).velocityY, testState.velocityY, + testingUtilities::Check_Results(fiducialState.at(i).velocityY, testState.velocityY, parameters.names.at(i) + ", VelocityDoubleStarY"); - testingUtilities::checkResults(fiducialState.at(i).velocityZ, testState.velocityZ, + testingUtilities::Check_Results(fiducialState.at(i).velocityZ, testState.velocityZ, parameters.names.at(i) + ", VelocityDoubleStarZ"); - testingUtilities::checkResults(fiducialState.at(i).magneticY, testState.magneticY, + testingUtilities::Check_Results(fiducialState.at(i).magneticY, testState.magneticY, parameters.names.at(i) + ", MagneticDoubleStarY"); - testingUtilities::checkResults(fiducialState.at(i).magneticZ, testState.magneticZ, + testingUtilities::Check_Results(fiducialState.at(i).magneticZ, testState.magneticZ, parameters.names.at(i) + ", MagneticDoubleStarZ"); - testingUtilities::checkResults(fiducialState.at(i).energyL, testState.energyL, + testingUtilities::Check_Results(fiducialState.at(i).energyL, testState.energyL, parameters.names.at(i) + ", EnergyDoubleStarL"); - testingUtilities::checkResults(fiducialState.at(i).energyR, testState.energyR, + testingUtilities::Check_Results(fiducialState.at(i).energyR, testState.energyR, parameters.names.at(i) + ", EnergyDoubleStarR"); } } @@ -2218,19 +2218,19 @@ TEST(tMHDHlldInternalDoubleStarFluxes, CorrectInputExpectCorrectOutput) parameters.speed.at(i).L, parameters.speed.at(i).LStar); // Now check results - testingUtilities::checkResults(fiducialFlux[i].density, testFlux.density, + testingUtilities::Check_Results(fiducialFlux[i].density, testFlux.density, parameters.names.at(i) + ", DensityStarFlux", 5.0E-14); - testingUtilities::checkResults(fiducialFlux[i].momentumX, testFlux.momentumX, + testingUtilities::Check_Results(fiducialFlux[i].momentumX, testFlux.momentumX, parameters.names.at(i) + ", MomentumStarFluxX"); - testingUtilities::checkResults(fiducialFlux[i].momentumY, testFlux.momentumY, + testingUtilities::Check_Results(fiducialFlux[i].momentumY, testFlux.momentumY, parameters.names.at(i) + ", MomentumStarFluxY"); - testingUtilities::checkResults(fiducialFlux[i].momentumZ, testFlux.momentumZ, + testingUtilities::Check_Results(fiducialFlux[i].momentumZ, testFlux.momentumZ, parameters.names.at(i) + ", MomentumStarFluxZ"); - testingUtilities::checkResults(fiducialFlux[i].energy, testFlux.energy, + testingUtilities::Check_Results(fiducialFlux[i].energy, testFlux.energy, parameters.names.at(i) + ", EnergyStarFlux"); - testingUtilities::checkResults(fiducialFlux[i].magneticY, testFlux.magneticY, + testingUtilities::Check_Results(fiducialFlux[i].magneticY, testFlux.magneticY, parameters.names.at(i) + ", MagneticStarFluxY"); - testingUtilities::checkResults(fiducialFlux[i].magneticZ, testFlux.magneticZ, + testingUtilities::Check_Results(fiducialFlux[i].magneticZ, testFlux.magneticZ, parameters.names.at(i) + ", MagneticStarFluxZ"); } } @@ -2338,7 +2338,7 @@ TEST(tMHDHlldInternalStarTotalPressure, CorrectInputExpectCorrectOutput) parameters.speed.at(i)); // Now check results - testingUtilities::checkResults(fiducialPressure.at(i), testPressure, + testingUtilities::Check_Results(fiducialPressure.at(i), testPressure, parameters.names.at(i) + ", total pressure in the star states"); } } @@ -2387,15 +2387,15 @@ TEST(tMHDHlldInternalLoadState, CorrectInputExpectCorrectOutput) parameters.gamma, threadId, n_cells, o1, o2, o3); // Now check results - testingUtilities::checkResults(fiducialState.at(direction).density, testState.density, ", Density"); - testingUtilities::checkResults(fiducialState.at(direction).velocityX, testState.velocityX, ", velocityX"); - testingUtilities::checkResults(fiducialState.at(direction).velocityY, testState.velocityY, ", velocityY"); - testingUtilities::checkResults(fiducialState.at(direction).velocityZ, testState.velocityZ, ", velocityZ"); - testingUtilities::checkResults(fiducialState.at(direction).energy, testState.energy, ", energy"); - testingUtilities::checkResults(fiducialState.at(direction).magneticY, testState.magneticY, ", magneticY"); - testingUtilities::checkResults(fiducialState.at(direction).magneticZ, testState.magneticZ, ", magneticZ"); - testingUtilities::checkResults(fiducialState.at(direction).gasPressure, testState.gasPressure, ", gasPressure"); - testingUtilities::checkResults(fiducialState.at(direction).totalPressure, testState.totalPressure, + testingUtilities::Check_Results(fiducialState.at(direction).density, testState.density, ", Density"); + testingUtilities::Check_Results(fiducialState.at(direction).velocityX, testState.velocityX, ", velocityX"); + testingUtilities::Check_Results(fiducialState.at(direction).velocityY, testState.velocityY, ", velocityY"); + testingUtilities::Check_Results(fiducialState.at(direction).velocityZ, testState.velocityZ, ", velocityZ"); + testingUtilities::Check_Results(fiducialState.at(direction).energy, testState.energy, ", energy"); + testingUtilities::Check_Results(fiducialState.at(direction).magneticY, testState.magneticY, ", magneticY"); + testingUtilities::Check_Results(fiducialState.at(direction).magneticZ, testState.magneticZ, ", magneticZ"); + testingUtilities::Check_Results(fiducialState.at(direction).gasPressure, testState.gasPressure, ", gasPressure"); + testingUtilities::Check_Results(fiducialState.at(direction).totalPressure, testState.totalPressure, ", totalPressure"); } } diff --git a/src/system_tests/hydro_system_tests.cpp b/src/system_tests/hydro_system_tests.cpp index dd92fbddc..be59ffba6 100644 --- a/src/system_tests/hydro_system_tests.cpp +++ b/src/system_tests/hydro_system_tests.cpp @@ -148,9 +148,9 @@ class tHYDROtMHDSYSTEMLinearWavesParameterizedMpi : public ::testing::TestWithPa double const allowedError = 1E-7; #endif // PCM - void setLaunchParams(double const &waveSpeed, double const &rEigenVec_rho, double const &rEigenVec_MomentumX, - double const &rEigenVec_MomentumY, double const &rEigenVec_MomentumZ, double const &rEigenVec_E, - double const &vx = 0.0) + void Set_Launch_Params(double const &waveSpeed, double const &rEigenVec_rho, double const &rEigenVec_MomentumX, + double const &rEigenVec_MomentumY, double const &rEigenVec_MomentumZ, double const &rEigenVec_E, + double const &vx = 0.0) { // Constant for all tests size_t const N = 32; @@ -213,7 +213,7 @@ TEST_P(tHYDROtMHDSYSTEMLinearWavesParameterizedMpi, SoundWaveRightMovingCorrectI double const rEigenVec_E = 1.5; // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E); // Set the number of MPI ranks waveTest.numMpiRanks = GetParam(); @@ -238,7 +238,7 @@ TEST_P(tHYDROtMHDSYSTEMLinearWavesParameterizedMpi, SoundWaveLeftMovingCorrectIn double const rEigenVec_E = 1.5; // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E); // Set the number of MPI ranks waveTest.numMpiRanks = GetParam(); @@ -266,7 +266,7 @@ TEST_P(tHYDROtMHDSYSTEMLinearWavesParameterizedMpi, HydroContactWaveCorrectInput double const velocityX = waveSpeed; // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, velocityX); // Set the number of MPI ranks diff --git a/src/system_tests/mhd_system_tests.cpp b/src/system_tests/mhd_system_tests.cpp index 622f0aa69..50235d71b 100644 --- a/src/system_tests/mhd_system_tests.cpp +++ b/src/system_tests/mhd_system_tests.cpp @@ -33,7 +33,7 @@ class tMHDSYSTEMLinearWavesParameterizedAngle : public ::testing::TestWithParam< protected: systemTest::SystemTestRunner waveTest; - void setLaunchParams(double const &waveSpeed, double const &rEigenVec_rho, double const &rEigenVec_MomentumX, + void Set_Launch_Params(double const &waveSpeed, double const &rEigenVec_rho, double const &rEigenVec_MomentumX, double const &rEigenVec_MomentumY, double const &rEigenVec_MomentumZ, double const &rEigenVec_E, double const &rEigenVec_Bx, double const &rEigenVec_By, double const &rEigenVec_Bz, double const &pitch, double const &yaw, double const &domain, int const &domain_direction, @@ -80,7 +80,7 @@ class tMHDSYSTEMLinearWavesParameterizedAngle : public ::testing::TestWithParam< std::swap(rEigenVec_MomentumX_rot, rEigenVec_MomentumZ_rot); break; default: - throw std::invalid_argument("Invalid value of domain_direction given to setLaunchParams"); + throw std::invalid_argument("Invalid value of domain_direction given to Set_Launch_Params"); break; } @@ -148,7 +148,7 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, FastMagnetosonicWaveRightMovingC auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps @@ -184,7 +184,7 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, FastMagnetosonicWaveLeftMovingCo auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps @@ -222,7 +222,7 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, SlowMagnetosonicWaveRightMovingC auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps @@ -258,7 +258,7 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, SlowMagnetosonicWaveLeftMovingCo auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps @@ -295,7 +295,7 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, AlfvenWaveRightMovingCorrectInpu auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps @@ -330,7 +330,7 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, AlfvenWaveLeftMovingCorrectInput auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps @@ -368,7 +368,7 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, MHDContactWaveCorrectInputExpect auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, velocityX); // Set the number of timesteps @@ -413,7 +413,7 @@ class tMHDSYSTEMLinearWavesParameterizedMpi : public ::testing::TestWithParam -void checkPointerAttributes(cuda_utilities::DeviceVector &devVector) +void Check_Pointer_Attributes(cuda_utilities::DeviceVector &devVector) { // Get the pointer information cudaPointerAttributes ptrAttributes; @@ -67,7 +67,7 @@ TEST(tALLDeviceVectorConstructor, CheckConstructorDataAndSizeExpectProperAllocat EXPECT_EQ(vectorSize, devVector.size()); // Check the pointer information - checkPointerAttributes(devVector); + Check_Pointer_Attributes(devVector); } TEST(tALLDeviceVectorDestructor, CheckDestructorExpectProperDeallocation) @@ -229,7 +229,7 @@ TEST(tALLDeviceVectorReset, SetNewSizeExpectCorrectSize) EXPECT_EQ(newSize, devVector.size()); // Check the pointer - checkPointerAttributes(devVector); + Check_Pointer_Attributes(devVector); // Copy the new values into device memory devVector.cpyHostToDevice(newVec); @@ -259,7 +259,7 @@ TEST(tALLDeviceVectorResize, SetLargerSizeExpectCorrectSize) EXPECT_EQ(newSize, devVector.size()); // Check the pointer - checkPointerAttributes(devVector); + Check_Pointer_Attributes(devVector); // Check the values for (size_t i = 0; i < originalSize; i++) { @@ -287,7 +287,7 @@ TEST(tALLDeviceVectorResize, SetSmallerSizeExpectCorrectSize) EXPECT_EQ(newSize, devVector.size()); // Check the pointer - checkPointerAttributes(devVector); + Check_Pointer_Attributes(devVector); // Check the values for (size_t i = 0; i < newSize; i++) { diff --git a/src/utils/cuda_utilities_tests.cpp b/src/utils/cuda_utilities_tests.cpp index 08c1004b2..d86af03ae 100644 --- a/src/utils/cuda_utilities_tests.cpp +++ b/src/utils/cuda_utilities_tests.cpp @@ -62,7 +62,7 @@ TEST(tHYDROCudaUtilsGetRealIndices, CorrectInputExpectCorrectOutput) std::vector test_indices{is, ie, js, je, ks, ke}; for (size_t j = 0; j < test_indices.size(); j++) { - testingUtilities::checkResults(fiducial_indices[i][j], test_indices[j], + testingUtilities::Check_Results(fiducial_indices[i][j], test_indices[j], index_names[j] + " " + parameters.names[i]); } } diff --git a/src/utils/hydro_utilities_tests.cpp b/src/utils/hydro_utilities_tests.cpp index 7bab43b69..000fb23dc 100644 --- a/src/utils/hydro_utilities_tests.cpp +++ b/src/utils/hydro_utilities_tests.cpp @@ -72,7 +72,7 @@ TEST(tHYDROtMHDHydroUtilsCalcPressurePrimitive, CorrectInputExpectCorrectOutput) parameters.E.at(i), parameters.d.at(i), parameters.vx.at(i), parameters.vy.at(i), parameters.vz.at(i), parameters.gamma, parameters.magnetic_x.at(i), parameters.magnetic_y.at(i), parameters.magnetic_z.at(i)); - testingUtilities::checkResults(fiducial_pressure.at(i), test_Ps, parameters.names.at(i)); + testingUtilities::Check_Results(fiducial_pressure.at(i), test_Ps, parameters.names.at(i)); } } @@ -90,7 +90,7 @@ TEST(tHYDROtMHDHydroUtilsCalcPressureConserved, CorrectInputExpectCorrectOutput) parameters.E.at(i), parameters.d.at(i), parameters.mx.at(i), parameters.my.at(i), parameters.mz.at(i), parameters.gamma, parameters.magnetic_x.at(i), parameters.magnetic_y.at(i), parameters.magnetic_z.at(i)); - testingUtilities::checkResults(fiducial_pressure.at(i), test_pressure, parameters.names.at(i)); + testingUtilities::Check_Results(fiducial_pressure.at(i), test_pressure, parameters.names.at(i)); } } @@ -133,7 +133,7 @@ TEST(tHYDROHydroUtilsCalcTemp, CorrectInputExpectCorrectOutput) for (size_t i = 0; i < parameters.names.size(); i++) { Real test_Ts = hydro_utilities::Calc_Temp(parameters.P.at(i), parameters.n.at(i)); - testingUtilities::checkResults(fiducial_Ts.at(i), test_Ts, parameters.names.at(i)); + testingUtilities::Check_Results(fiducial_Ts.at(i), test_Ts, parameters.names.at(i)); } } @@ -147,7 +147,7 @@ TEST(tHYDROHydroUtilsCalcTempDE, CorrectInputExpectCorrectOutput) Real test_Ts = hydro_utilities::Calc_Temp_DE(parameters.d.at(i), parameters.ge.at(i), parameters.gamma, parameters.n.at(i)); - testingUtilities::checkResults(fiducial_Ts.at(i), test_Ts, parameters.names.at(i)); + testingUtilities::Check_Results(fiducial_Ts.at(i), test_Ts, parameters.names.at(i)); } } #endif // DE @@ -166,7 +166,7 @@ TEST(tHYDROtMHDHydroUtilsCalcEnergyPrimitive, CorrectInputExpectCorrectOutput) parameters.P.at(i), parameters.d.at(i), parameters.vx.at(i), parameters.vy.at(i), parameters.vz.at(i), parameters.gamma, parameters.magnetic_x.at(i), parameters.magnetic_y.at(i), parameters.magnetic_z.at(i)); - testingUtilities::checkResults(fiducial_energy.at(i), test_Es, parameters.names.at(i)); + testingUtilities::Check_Results(fiducial_energy.at(i), test_Es, parameters.names.at(i)); } } @@ -184,7 +184,7 @@ TEST(tHYDROtMHDHydroUtilsCalcEnergyConserved, CorrectInputExpectCorrectOutput) parameters.P.at(i), parameters.d.at(i), parameters.mx.at(i), parameters.my.at(i), parameters.mz.at(i), parameters.gamma, parameters.magnetic_x.at(i), parameters.magnetic_y.at(i), parameters.magnetic_z.at(i)); - testingUtilities::checkResults(fiducial_energy.at(i), test_Es, parameters.names.at(i)); + testingUtilities::Check_Results(fiducial_energy.at(i), test_Es, parameters.names.at(i)); } } @@ -201,7 +201,7 @@ TEST(tHYDROtMHDHydroUtilsCalcEnergyPrimitive, NegativePressureExpectAutomaticFix -parameters.P.at(i), parameters.d.at(i), parameters.vx.at(i), parameters.vy.at(i), parameters.vz.at(i), parameters.gamma, parameters.magnetic_x.at(i), parameters.magnetic_y.at(i), parameters.magnetic_z.at(i)); - testingUtilities::checkResults(fiducial_energy.at(i), test_Es, parameters.names.at(i)); + testingUtilities::Check_Results(fiducial_energy.at(i), test_Es, parameters.names.at(i)); } } @@ -218,7 +218,7 @@ TEST(tHYDROtMHDHydroUtilsCalcEnergyConserved, NegativePressureExpectAutomaticFix -parameters.P.at(i), parameters.d.at(i), parameters.mx.at(i), parameters.my.at(i), parameters.mz.at(i), parameters.gamma, parameters.magnetic_x.at(i), parameters.magnetic_y.at(i), parameters.magnetic_z.at(i)); - testingUtilities::checkResults(fiducial_energy.at(i), test_Es, parameters.names.at(i)); + testingUtilities::Check_Results(fiducial_energy.at(i), test_Es, parameters.names.at(i)); } } @@ -231,7 +231,7 @@ TEST(tHYDROHydroUtilsGetPressureFromDE, CorrectInputExpectCorrectOutput) Real test_Ps = hydro_utilities::Get_Pressure_From_DE(parameters.E.at(i), parameters.U_total.at(i), parameters.U_advected.at(i), parameters.gamma); - testingUtilities::checkResults(fiducial_Ps.at(i), test_Ps, parameters.names.at(i)); + testingUtilities::Check_Results(fiducial_Ps.at(i), test_Ps, parameters.names.at(i)); } } @@ -245,7 +245,7 @@ TEST(tHYDROtMHDCalcKineticEnergyFromVelocity, CorrectInputExpectCorrectOutput) Real testEnergy = hydro_utilities::Calc_Kinetic_Energy_From_Velocity( coef * parameters.d.at(i), coef * parameters.vx.at(i), coef * parameters.vy.at(i), coef * parameters.vz.at(i)); - testingUtilities::checkResults(fiducialEnergies.at(i), testEnergy, parameters.names.at(i)); + testingUtilities::Check_Results(fiducialEnergies.at(i), testEnergy, parameters.names.at(i)); } } @@ -259,6 +259,6 @@ TEST(tHYDROtMHDCalcKineticEnergyFromMomentum, CorrectInputExpectCorrectOutput) Real testEnergy = hydro_utilities::Calc_Kinetic_Energy_From_Momentum( coef * parameters.d.at(i), coef * parameters.mx.at(i), coef * parameters.my.at(i), coef * parameters.mz.at(i)); - testingUtilities::checkResults(fiducialEnergies.at(i), testEnergy, parameters.names.at(i)); + testingUtilities::Check_Results(fiducialEnergies.at(i), testEnergy, parameters.names.at(i)); } } \ No newline at end of file diff --git a/src/utils/math_utilities_tests.cpp b/src/utils/math_utilities_tests.cpp index 665a5981c..889cb7546 100644 --- a/src/utils/math_utilities_tests.cpp +++ b/src/utils/math_utilities_tests.cpp @@ -31,9 +31,9 @@ TEST(tALLRotateCoords, CorrectInputExpectCorrectOutput) auto [x_1_rot, x_2_rot, x_3_rot] = math_utils::rotateCoords(x_1, x_2, x_3, pitch, yaw); - testingUtilities::checkResults<0>(x_1_rot_fid, x_1_rot, "x_1 rotated values"); - testingUtilities::checkResults<0>(x_2_rot_fid, x_2_rot, "x_2 rotated values"); - testingUtilities::checkResults<0>(x_3_rot_fid, x_3_rot, "x_3 rotated values"); + testingUtilities::Check_Results<0>(x_1_rot_fid, x_1_rot, "x_1 rotated values"); + testingUtilities::Check_Results<0>(x_2_rot_fid, x_2_rot, "x_2 rotated values"); + testingUtilities::Check_Results<0>(x_3_rot_fid, x_3_rot, "x_3 rotated values"); } // ============================================================================= @@ -54,6 +54,6 @@ TEST(tALLDotProduct, CorrectInputExpectCorrectOutput) testDotProduct = math_utils::dotProduct(a.at(0), a.at(1), a.at(2), b.at(0), b.at(1), b.at(2)); // Now check results - testingUtilities::checkResults(fiducialDotProduct, testDotProduct, "dot product"); + testingUtilities::Check_Results(fiducialDotProduct, testDotProduct, "dot product"); } // ========================================================================= \ No newline at end of file diff --git a/src/utils/mhd_utilities_tests.cu b/src/utils/mhd_utilities_tests.cu index 980259d28..044e74c29 100644 --- a/src/utils/mhd_utilities_tests.cu +++ b/src/utils/mhd_utilities_tests.cu @@ -66,7 +66,7 @@ TEST(tMHDComputeThermalEnergy, CorrectInputExpectCorrectOutput) parameters.momentumY.at(i), parameters.momentumZ.at(i), parameters.magneticX.at(i), parameters.magneticY.at(i), parameters.magneticZ.at(i), parameters.gamma); - testingUtilities::checkResults(fiducialGasPressures.at(i), testGasPressure, parameters.names.at(i)); + testingUtilities::Check_Results(fiducialGasPressures.at(i), testGasPressure, parameters.names.at(i)); } } // ============================================================================= @@ -91,7 +91,7 @@ TEST(tMHDcomputeMagneticEnergy, CorrectInputExpectCorrectOutput) Real testMagneticEnergy = mhd::utils::computeMagneticEnergy(parameters.magneticX.at(i), parameters.magneticY.at(i), parameters.magneticZ.at(i)); - testingUtilities::checkResults(fiducialEnergy.at(i), testMagneticEnergy, parameters.names.at(i)); + testingUtilities::Check_Results(fiducialEnergy.at(i), testMagneticEnergy, parameters.names.at(i)); } } // ============================================================================= @@ -115,7 +115,7 @@ TEST(tMHDComputeTotalPressure, CorrectInputExpectCorrectOutput) Real testTotalPressure = mhd::utils::computeTotalPressure(parameters.pressureGas.at(i), parameters.magneticX.at(i), parameters.magneticY.at(i), parameters.magneticZ.at(i)); - testingUtilities::checkResults(fiducialTotalPressures.at(i), testTotalPressure, parameters.names.at(i)); + testingUtilities::Check_Results(fiducialTotalPressures.at(i), testTotalPressure, parameters.names.at(i)); } } @@ -165,7 +165,7 @@ TEST(tMHDFastMagnetosonicSpeed, CorrectInputExpectCorrectOutput) coef.at(i) * parameters.magneticX.at(i), coef.at(i) * parameters.magneticY.at(i), coef.at(i) * parameters.magneticZ.at(i), parameters.gamma); - testingUtilities::checkResults(fiducialFastMagnetosonicSpeed.at(i), testFastMagnetosonicSpeed, + testingUtilities::Check_Results(fiducialFastMagnetosonicSpeed.at(i), testFastMagnetosonicSpeed, parameters.names.at(i)); } } @@ -188,7 +188,7 @@ TEST(tMHDFastMagnetosonicSpeed, NegativeDensityExpectAutomaticFix) coef.at(i) * parameters.magneticX.at(i), coef.at(i) * parameters.magneticY.at(i), coef.at(i) * parameters.magneticZ.at(i), parameters.gamma); - testingUtilities::checkResults(fiducialFastMagnetosonicSpeed.at(i), testFastMagnetosonicSpeed, + testingUtilities::Check_Results(fiducialFastMagnetosonicSpeed.at(i), testFastMagnetosonicSpeed, parameters.names.at(i)); } } @@ -217,7 +217,7 @@ TEST(tMHDSlowMagnetosonicSpeed, CorrectInputExpectCorrectOutput) parameters.density.at(i) * coef, parameters.pressureGas.at(i) * coef, parameters.magneticX.at(i) * coef, parameters.magneticY.at(i) * coef, parameters.magneticZ.at(i) * coef, parameters.gamma); - testingUtilities::checkResults(fiducialSlowMagnetosonicSpeed.at(i), testSlowMagnetosonicSpeed, + testingUtilities::Check_Results(fiducialSlowMagnetosonicSpeed.at(i), testSlowMagnetosonicSpeed, parameters.names.at(i)); } } @@ -240,7 +240,7 @@ TEST(tMHDSlowMagnetosonicSpeed, NegativeDensityExpectAutomaticFix) -parameters.density.at(i) * coef, parameters.pressureGas.at(i) * coef, parameters.magneticX.at(i) * coef, parameters.magneticY.at(i) * coef, parameters.magneticZ.at(i) * coef, parameters.gamma); - testingUtilities::checkResults(fiducialSlowMagnetosonicSpeed.at(i), testSlowMagnetosonicSpeed, + testingUtilities::Check_Results(fiducialSlowMagnetosonicSpeed.at(i), testSlowMagnetosonicSpeed, parameters.names.at(i)); } } @@ -264,7 +264,7 @@ TEST(tMHDAlfvenSpeed, CorrectInputExpectCorrectOutput) for (size_t i = 0; i < parameters.names.size(); i++) { Real testAlfvenSpeed = mhd::utils::alfvenSpeed(parameters.magneticX.at(i), parameters.density.at(i)); - testingUtilities::checkResults(fiducialAlfvenSpeed.at(i), testAlfvenSpeed, parameters.names.at(i)); + testingUtilities::Check_Results(fiducialAlfvenSpeed.at(i), testAlfvenSpeed, parameters.names.at(i)); } } @@ -281,7 +281,7 @@ TEST(tMHDAlfvenSpeed, NegativeDensityExpectAutomaticFix) for (size_t i = 0; i < parameters.names.size(); i++) { Real testAlfvenSpeed = mhd::utils::alfvenSpeed(parameters.magneticX.at(i), -parameters.density.at(i)); - testingUtilities::checkResults(fiducialAlfvenSpeed.at(i), testAlfvenSpeed, parameters.names.at(i)); + testingUtilities::Check_Results(fiducialAlfvenSpeed.at(i), testAlfvenSpeed, parameters.names.at(i)); } } // ============================================================================= @@ -316,9 +316,9 @@ TEST(tMHDCellCenteredMagneticFields, CorrectInputExpectCorrectOutput) mhd::utils::cellCenteredMagneticFields(testGrid.data(), id, xid, yid, zid, n_cells, nx, ny); // Check the results - testingUtilities::checkResults(fiducialAvgBx, testAvgBx, "cell centered Bx value"); - testingUtilities::checkResults(fiducialAvgBy, testAvgBy, "cell centered By value"); - testingUtilities::checkResults(fiducialAvgBz, testAvgBz, "cell centered Bz value"); + testingUtilities::Check_Results(fiducialAvgBx, testAvgBx, "cell centered Bx value"); + testingUtilities::Check_Results(fiducialAvgBy, testAvgBy, "cell centered By value"); + testingUtilities::Check_Results(fiducialAvgBz, testAvgBz, "cell centered Bz value"); } #endif // MHD // ============================================================================= @@ -369,13 +369,13 @@ TEST(tMHDInitMagneticFieldWithVectorPotential, CorrectInputExpectCorrectOutput) for (size_t i = 0; i < conserved_vector.size(); i++) { if (i == 47) { - testingUtilities::checkResults(bx_fiducial, conserved_vector.at(i), "value at i = " + std::to_string(i)); + testingUtilities::Check_Results(bx_fiducial, conserved_vector.at(i), "value at i = " + std::to_string(i)); } else if (i == 55) { - testingUtilities::checkResults(by_fiducial, conserved_vector.at(i), "value at i = " + std::to_string(i)); + testingUtilities::Check_Results(by_fiducial, conserved_vector.at(i), "value at i = " + std::to_string(i)); } else if (i == 63) { - testingUtilities::checkResults(bz_fiducial, conserved_vector.at(i), "value at i = " + std::to_string(i)); + testingUtilities::Check_Results(bz_fiducial, conserved_vector.at(i), "value at i = " + std::to_string(i)); } else { - testingUtilities::checkResults(default_fiducial, conserved_vector.at(i), "value at i = " + std::to_string(i)); + testingUtilities::Check_Results(default_fiducial, conserved_vector.at(i), "value at i = " + std::to_string(i)); } } } diff --git a/src/utils/reduction_utilities_tests.cu b/src/utils/reduction_utilities_tests.cu index e689e2a5f..a1226a910 100644 --- a/src/utils/reduction_utilities_tests.cu +++ b/src/utils/reduction_utilities_tests.cu @@ -63,7 +63,7 @@ TEST(tALLKernelReduceMax, CorrectInputExpectCorrectOutput) CudaCheckError(); // Perform comparison - testingUtilities::checkResults(maxValue, dev_max.at(0), "maximum value found"); + testingUtilities::Check_Results(maxValue, dev_max.at(0), "maximum value found"); } // ============================================================================= // Tests for divergence max reduction diff --git a/src/utils/testing_utilities.cpp b/src/utils/testing_utilities.cpp index 02aaadd68..b08892824 100644 --- a/src/utils/testing_utilities.cpp +++ b/src/utils/testing_utilities.cpp @@ -88,7 +88,7 @@ void wrapperEqual(int i, int j, int k, std::string const &dataSetName, double te outString += std::to_string(k); outString += "]"; - ASSERT_NO_FATAL_FAILURE(checkResults<1>(fid_value, test_value, outString, fixedEpsilon)); + ASSERT_NO_FATAL_FAILURE(Check_Results<1>(fid_value, test_value, outString, fixedEpsilon)); } void analyticConstant(systemTest::SystemTestRunner testObject, std::string const &dataSetName, double value) diff --git a/src/utils/testing_utilities.h b/src/utils/testing_utilities.h index 7057e01e9..55f6b6f1c 100644 --- a/src/utils/testing_utilities.h +++ b/src/utils/testing_utilities.h @@ -120,7 +120,7 @@ void analyticSine(systemTest::SystemTestRunner testObject, std::string const &da * values are ignored and default behaviour is used */ template -void checkResults(double fiducialNumber, double testNumber, std::string const &outString, double fixedEpsilon = -999, +void Check_Results(double fiducialNumber, double testNumber, std::string const &outString, double fixedEpsilon = -999, int64_t ulpsEpsilon = -999) { // Check for equality and if not equal return difference @@ -152,7 +152,7 @@ void checkResults(double fiducialNumber, double testNumber, std::string const &o } else { throw std::runtime_error( "Incorrect template argument passed to " - "checkResults. Options are 0 and 1 but " + + "Check_Results. Options are 0 and 1 but " + std::to_string(checkType) + " was passed"); } } diff --git a/src/utils/timing_functions.cpp b/src/utils/timing_functions.cpp index 133971b68..7d1dc8b5e 100644 --- a/src/utils/timing_functions.cpp +++ b/src/utils/timing_functions.cpp @@ -18,7 +18,7 @@ void OneTime::Start() if (inactive) { return; } - time_start = get_time(); + time_start = Get_Time(); } void OneTime::Subtract(Real time_to_subtract) @@ -34,7 +34,7 @@ void OneTime::End() if (inactive) { return; } - Real time_end = get_time(); + Real time_end = Get_Time(); Real time = (time_end - time_start) * 1000; #ifdef MPI_CHOLLA @@ -219,14 +219,14 @@ ScopedTimer::ScopedTimer(const char* input_name) { #ifdef CPU_TIME name = input_name; - time_start = get_time(); + time_start = Get_Time(); #endif } ScopedTimer::~ScopedTimer(void) { #ifdef CPU_TIME - double time_elapsed_ms = (get_time() - time_start) * 1000; + double time_elapsed_ms = (Get_Time() - time_start) * 1000; #ifdef MPI_CHOLLA double t_min = ReduceRealMin(time_elapsed_ms); From 4715bec382b1ad0ea4e13f8cce2bdc5910b6c01d Mon Sep 17 00:00:00 2001 From: helenarichie Date: Mon, 10 Jul 2023 18:14:41 -0400 Subject: [PATCH 02/13] change function names to conform to Cholla naming standards and turn on readability-identifier-naming check --- run_check.sh | 11 -- src/gravity/potential_paris_3D.cu | 4 +- src/io/io.cpp | 24 ++-- src/io/io.h | 8 +- src/io/io_gpu.cu | 9 +- src/mhd/ct_electric_fields_tests.cu | 4 +- src/mhd/magnetic_update_tests.cu | 4 +- src/riemann_solvers/hllc_cuda_tests.cu | 8 +- src/riemann_solvers/hlld_cuda_tests.cu | 180 +++++++++++++----------- src/system_tests/hydro_system_tests.cpp | 14 +- src/system_tests/mhd_system_tests.cpp | 50 +++---- src/utils/cuda_utilities_tests.cpp | 2 +- src/utils/mhd_utilities_tests.cu | 8 +- src/utils/testing_utilities.h | 2 +- 14 files changed, 165 insertions(+), 163 deletions(-) delete mode 100644 run_check.sh diff --git a/run_check.sh b/run_check.sh deleted file mode 100644 index 01168bf12..000000000 --- a/run_check.sh +++ /dev/null @@ -1,11 +0,0 @@ -cd /ix/eschneider/helena/code/cholla - -make tidy TYPE=hydro & -make tidy TYPE=gravity & -make tidy TYPE=disk & -make tidy TYPE=particles & -make tidy TYPE=cosmology & -make tidy TYPE=mhd & -make tidy TYPE=dust & - -wait diff --git a/src/gravity/potential_paris_3D.cu b/src/gravity/potential_paris_3D.cu index 51d967a9d..011906d14 100644 --- a/src/gravity/potential_paris_3D.cu +++ b/src/gravity/potential_paris_3D.cu @@ -8,8 +8,8 @@ #include "../io/io.h" #include "../utils/gpu.hpp" -static void __attribute__((unused)) -Print_Diff(const Real *p, const Real *q, const int ng, const int nx, const int ny, const int nz, const bool plot = false) +static void __attribute__((unused)) Print_Diff(const Real *p, const Real *q, const int ng, const int nx, const int ny, + const int nz, const bool plot = false) { Real dMax = 0, dSum = 0, dSum2 = 0; Real qMax = 0, qSum = 0, qSum2 = 0; diff --git a/src/io/io.cpp b/src/io/io.cpp index 690f8d3fc..2f01928e1 100644 --- a/src/io/io.cpp +++ b/src/io/io.cpp @@ -316,28 +316,28 @@ void Output_Float32(Grid3D &G, struct parameters P, int nfile) if (P.out_float32_density > 0) { Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, - device_dataset_vector.data(), G.C.d_density, "/density"); + device_dataset_vector.data(), G.C.d_density, "/density"); } if (P.out_float32_momentum_x > 0) { Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, - device_dataset_vector.data(), G.C.d_momentum_x, "/momentum_x"); + device_dataset_vector.data(), G.C.d_momentum_x, "/momentum_x"); } if (P.out_float32_momentum_y > 0) { Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, - device_dataset_vector.data(), G.C.d_momentum_y, "/momentum_y"); + device_dataset_vector.data(), G.C.d_momentum_y, "/momentum_y"); } if (P.out_float32_momentum_z > 0) { Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, - device_dataset_vector.data(), G.C.d_momentum_z, "/momentum_z"); + device_dataset_vector.data(), G.C.d_momentum_z, "/momentum_z"); } if (P.out_float32_Energy > 0) { Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, - device_dataset_vector.data(), G.C.d_Energy, "/Energy"); + device_dataset_vector.data(), G.C.d_Energy, "/Energy"); } #ifdef DE if (P.out_float32_GasEnergy > 0) { Write_HDF5_Field_3D(H.nx, H.ny, nx_dset, ny_dset, nz_dset, H.n_ghost, file_id, dataset_buffer, - device_dataset_vector.data(), G.C.d_GasEnergy, "/GasEnergy"); + device_dataset_vector.data(), G.C.d_GasEnergy, "/GasEnergy"); } #endif // DE #ifdef MHD @@ -346,17 +346,17 @@ void Output_Float32(Grid3D &G, struct parameters P, int nfile) if (P.out_float32_magnetic_x > 0) { chprintf("WARNING: MHD float-32 output has a different output format than float-64\n"); Write_HDF5_Field_3D(H.nx, H.ny, nx_dset + 1, ny_dset + 1, nz_dset + 1, H.n_ghost - 1, file_id, dataset_buffer, - device_dataset_vector.data(), G.C.d_magnetic_x, "/magnetic_x"); + device_dataset_vector.data(), G.C.d_magnetic_x, "/magnetic_x"); } if (P.out_float32_magnetic_y > 0) { chprintf("WARNING: MHD float-32 output has a different output format than float-64\n"); Write_HDF5_Field_3D(H.nx, H.ny, nx_dset + 1, ny_dset + 1, nz_dset + 1, H.n_ghost - 1, file_id, dataset_buffer, - device_dataset_vector.data(), G.C.d_magnetic_y, "/magnetic_y"); + device_dataset_vector.data(), G.C.d_magnetic_y, "/magnetic_y"); } if (P.out_float32_magnetic_z > 0) { chprintf("WARNING: MHD float-32 output has a different output format than float-64\n"); Write_HDF5_Field_3D(H.nx, H.ny, nx_dset + 1, ny_dset + 1, nz_dset + 1, H.n_ghost - 1, file_id, dataset_buffer, - device_dataset_vector.data(), G.C.d_magnetic_z, "/magnetic_z"); + device_dataset_vector.data(), G.C.d_magnetic_z, "/magnetic_z"); } #endif // MHD @@ -1492,11 +1492,11 @@ void Grid3D::Write_Grid_HDF5(hid_t file_id) #ifdef MHD if (H.Output_Complete_Data) { Write_HDF5_Field_3D(H.nx, H.ny, H.nx_real + 1, H.ny_real, H.nz_real, H.n_ghost, file_id, dataset_buffer, - device_dataset_vector.data(), C.d_magnetic_x, "/magnetic_x", 0); + device_dataset_vector.data(), C.d_magnetic_x, "/magnetic_x", 0); Write_HDF5_Field_3D(H.nx, H.ny, H.nx_real, H.ny_real + 1, H.nz_real, H.n_ghost, file_id, dataset_buffer, - device_dataset_vector.data(), C.d_magnetic_y, "/magnetic_y", 1); + device_dataset_vector.data(), C.d_magnetic_y, "/magnetic_y", 1); Write_HDF5_Field_3D(H.nx, H.ny, H.nx_real, H.ny_real, H.nz_real + 1, H.n_ghost, file_id, dataset_buffer, - device_dataset_vector.data(), C.d_magnetic_z, "/magnetic_z", 2); + device_dataset_vector.data(), C.d_magnetic_z, "/magnetic_z", 2); } #endif // MHD } diff --git a/src/io/io.h b/src/io/io.h index 26569d146..1f14f6fb8 100644 --- a/src/io/io.h +++ b/src/io/io.h @@ -70,8 +70,8 @@ void Fill_Grid_From_HDF5_Buffer(int nx, int ny, int nz, int nx_real, int ny_real // From io/io_gpu.cu // Use GPU to pack source -> device_buffer, then copy device_buffer -> buffer, // then write HDF5 field -void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, float* buffer, - float* device_buffer, Real* source, const char* name, int mhd_direction = -1); -void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, double* buffer, - double* device_buffer, Real* source, const char* name, int mhd_direction = -1); +void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, + float* buffer, float* device_buffer, Real* source, const char* name, int mhd_direction = -1); +void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, + double* buffer, double* device_buffer, Real* source, const char* name, int mhd_direction = -1); #endif diff --git a/src/io/io_gpu.cu b/src/io/io_gpu.cu index 9fa0b20e6..495b0bd19 100644 --- a/src/io/io_gpu.cu +++ b/src/io/io_gpu.cu @@ -88,8 +88,9 @@ __global__ void CopyReal3D_GPU_Kernel(int nx, int ny, int nx_real, int ny_real, // When buffer is double, automatically use the double version of everything // using function overloading -void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, double* buffer, - double* device_buffer, Real* device_source, const char* name, int mhd_direction) +void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, + double* buffer, double* device_buffer, Real* device_source, const char* name, + int mhd_direction) { herr_t status; hsize_t dims[3]; @@ -116,8 +117,8 @@ void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, // When buffer is float, automatically use the float version of everything using // function overloading -void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, float* buffer, - float* device_buffer, Real* device_source, const char* name, int mhd_direction) +void Write_HDF5_Field_3D(int nx, int ny, int nx_real, int ny_real, int nz_real, int n_ghost, hid_t file_id, + float* buffer, float* device_buffer, Real* device_source, const char* name, int mhd_direction) { herr_t status; hsize_t dims[3]; diff --git a/src/mhd/ct_electric_fields_tests.cu b/src/mhd/ct_electric_fields_tests.cu index 2cbbac2e8..98d46e8da 100644 --- a/src/mhd/ct_electric_fields_tests.cu +++ b/src/mhd/ct_electric_fields_tests.cu @@ -116,8 +116,8 @@ class tMHDCalculateCTElectricFields : public ::testing::Test int xid, yid, zid; cuda_utilities::compute3DIndices(i, nx, ny, xid, yid, zid); testingUtilities::Check_Results(fiducialData.at(i), testCTElectricFields.at(i), - "value at i = " + std::to_string(i) + ", xid = " + std::to_string(xid) + - ", yid = " + std::to_string(yid) + ", zid = " + std::to_string(zid)); + "value at i = " + std::to_string(i) + ", xid = " + std::to_string(xid) + + ", yid = " + std::to_string(yid) + ", zid = " + std::to_string(zid)); } } }; diff --git a/src/mhd/magnetic_update_tests.cu b/src/mhd/magnetic_update_tests.cu index 5ac59060b..b71381134 100644 --- a/src/mhd/magnetic_update_tests.cu +++ b/src/mhd/magnetic_update_tests.cu @@ -104,8 +104,8 @@ class tMHDUpdateMagneticField3D : public ::testing::Test int xid, yid, zid; cuda_utilities::compute3DIndices(i, nx, ny, xid, yid, zid); testingUtilities::Check_Results(fiducialData.at(i), destinationGrid.at(i), - "value at i = " + std::to_string(i) + ", xid = " + std::to_string(xid) + - ", yid = " + std::to_string(yid) + ", zid = " + std::to_string(zid)); + "value at i = " + std::to_string(i) + ", xid = " + std::to_string(xid) + + ", yid = " + std::to_string(yid) + ", zid = " + std::to_string(zid)); } } }; diff --git a/src/riemann_solvers/hllc_cuda_tests.cu b/src/riemann_solvers/hllc_cuda_tests.cu index e8d000f6e..39616772b 100644 --- a/src/riemann_solvers/hllc_cuda_tests.cu +++ b/src/riemann_solvers/hllc_cuda_tests.cu @@ -45,7 +45,7 @@ class tHYDROCalculateHLLCFluxesCUDA : public ::testing::Test * \return std::vector */ std::vector Compute_Fluxes(std::vector const &stateLeft, std::vector const &stateRight, - Real const &gamma) + Real const &gamma) { // Simulation Paramters int const nx = 1; // Number of cells in the x-direction? @@ -106,7 +106,7 @@ class tHYDROCalculateHLLCFluxesCUDA : public ::testing::Test * values that failed are printed */ void Check_Results(std::vector const &fiducialFlux, std::vector const &testFlux, - std::string const &customOutput = "") + std::string const &customOutput = "") { // Field names std::vector const fieldNames{"Densities", "X Momentum", "Y Momentum", "Z Momentum", "Energies"}; @@ -169,8 +169,8 @@ TEST_F(tHYDROCalculateHLLCFluxesCUDA, // Test suite name // Compute the fluxes std::vector const testFluxes = Compute_Fluxes(state, // Left state - state, // Right state - gamma); // Adiabatic Index + state, // Right state + gamma); // Adiabatic Index // Check for correctness Check_Results(fiducialFluxes, testFluxes); diff --git a/src/riemann_solvers/hlld_cuda_tests.cu b/src/riemann_solvers/hlld_cuda_tests.cu index b67e18227..500ef3538 100644 --- a/src/riemann_solvers/hlld_cuda_tests.cu +++ b/src/riemann_solvers/hlld_cuda_tests.cu @@ -57,7 +57,7 @@ class tMHDCalculateHLLDFluxesCUDA : public ::testing::Test * \return std::vector */ std::vector Compute_Fluxes(std::vector stateLeft, std::vector stateRight, Real const &gamma, - int const &direction = 0) + int const &direction = 0) { // Rearrange X, Y, and Z values for the chosen direction std::rotate(stateLeft.begin() + 1, stateLeft.begin() + 4 - direction, stateLeft.begin() + 4); @@ -162,7 +162,7 @@ class tMHDCalculateHLLDFluxesCUDA : public ::testing::Test * X, 1 = plane normal to Y, 2 = plane normal to Z. Defaults to 0. */ void Check_Results(std::vector fiducialFlux, std::vector const &scalarFlux, Real thermalEnergyFlux, - std::vector const &testFlux, std::string const &customOutput = "", int const &direction = 0) + std::vector const &testFlux, std::string const &customOutput = "", int const &direction = 0) { // Field names std::vector fieldNames{"Densities", "X Momentum", "Y Momentum", "Z Momentum", @@ -228,7 +228,7 @@ class tMHDCalculateHLLDFluxesCUDA : public ::testing::Test * y-magnetic field, z-magnetic field. */ std::vector Primitive_2_Conserved(std::vector const &input, double const &gamma, - std::vector const &primitiveScalars) + std::vector const &primitiveScalars) { std::vector output(input.size()); output.at(0) = input.at(0); // Density @@ -299,29 +299,29 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO // Pressure | X-Magnetic Field | Y-Magnetic Field | // Z-Magnetic Field | Adiabatic Index | Passive // Scalars | - leftICs = Primitive_2_Conserved({1.0, 0.0, 0.0, Vz, 1.0, Bx, 1.0, Bz}, gamma, primitiveScalar), - leftFastRareLeftSide = - Primitive_2_Conserved({0.978576, 0.038603, -0.011074, Vz, 0.957621, Bx, 0.970288, Bz}, gamma, primitiveScalar), - leftFastRareRightSide = - Primitive_2_Conserved({0.671655, 0.647082, -0.238291, Vz, 0.451115, Bx, 0.578240, Bz}, gamma, primitiveScalar), - compoundLeftSide = - Primitive_2_Conserved({0.814306, 0.506792, -0.911794, Vz, 0.706578, Bx, -0.108819, Bz}, gamma, primitiveScalar), - compoundPeak = - Primitive_2_Conserved({0.765841, 0.523701, -1.383720, Vz, 0.624742, Bx, -0.400787, Bz}, gamma, primitiveScalar), - compoundRightSide = - Primitive_2_Conserved({0.695211, 0.601089, -1.583720, Vz, 0.515237, Bx, -0.537027, Bz}, gamma, primitiveScalar), - contactLeftSide = - Primitive_2_Conserved({0.680453, 0.598922, -1.584490, Vz, 0.515856, Bx, -0.533616, Bz}, gamma, primitiveScalar), - contactRightSide = - Primitive_2_Conserved({0.231160, 0.599261, -1.584820, Vz, 0.516212, Bx, -0.533327, Bz}, gamma, primitiveScalar), - slowShockLeftSide = - Primitive_2_Conserved({0.153125, 0.086170, -0.683303, Vz, 0.191168, Bx, -0.850815, Bz}, gamma, primitiveScalar), - slowShockRightSide = Primitive_2_Conserved({0.117046, -0.238196, -0.165561, Vz, 0.087684, Bx, -0.903407, Bz}, gamma, - primitiveScalar), + leftICs = Primitive_2_Conserved({1.0, 0.0, 0.0, Vz, 1.0, Bx, 1.0, Bz}, gamma, primitiveScalar), + leftFastRareLeftSide = Primitive_2_Conserved({0.978576, 0.038603, -0.011074, Vz, 0.957621, Bx, 0.970288, Bz}, + gamma, primitiveScalar), + leftFastRareRightSide = Primitive_2_Conserved({0.671655, 0.647082, -0.238291, Vz, 0.451115, Bx, 0.578240, Bz}, + gamma, primitiveScalar), + compoundLeftSide = Primitive_2_Conserved({0.814306, 0.506792, -0.911794, Vz, 0.706578, Bx, -0.108819, Bz}, gamma, + primitiveScalar), + compoundPeak = Primitive_2_Conserved({0.765841, 0.523701, -1.383720, Vz, 0.624742, Bx, -0.400787, Bz}, gamma, + primitiveScalar), + compoundRightSide = Primitive_2_Conserved({0.695211, 0.601089, -1.583720, Vz, 0.515237, Bx, -0.537027, Bz}, gamma, + primitiveScalar), + contactLeftSide = Primitive_2_Conserved({0.680453, 0.598922, -1.584490, Vz, 0.515856, Bx, -0.533616, Bz}, gamma, + primitiveScalar), + contactRightSide = Primitive_2_Conserved({0.231160, 0.599261, -1.584820, Vz, 0.516212, Bx, -0.533327, Bz}, gamma, + primitiveScalar), + slowShockLeftSide = Primitive_2_Conserved({0.153125, 0.086170, -0.683303, Vz, 0.191168, Bx, -0.850815, Bz}, gamma, + primitiveScalar), + slowShockRightSide = Primitive_2_Conserved({0.117046, -0.238196, -0.165561, Vz, 0.087684, Bx, -0.903407, Bz}, + gamma, primitiveScalar), rightFastRareLeftSide = Primitive_2_Conserved({0.117358, -0.228756, -0.158845, Vz, 0.088148, Bx, -0.908335, Bz}, - gamma, primitiveScalar), + gamma, primitiveScalar), rightFastRareRightSide = Primitive_2_Conserved({0.124894, -0.003132, -0.002074, Vz, 0.099830, Bx, -0.999018, Bz}, - gamma, primitiveScalar), + gamma, primitiveScalar), rightICs = Primitive_2_Conserved({0.128, 0.0, 0.0, Vz, 0.1, Bx, -1.0, Bz}, gamma, primitiveScalar); for (size_t direction = 0; direction < 3; direction++) { @@ -419,8 +419,9 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.92496835095531071, 0.0, 0.53128887284876058, 0}; std::vector const scalarFlux{0.47083980954039228, 0.94789941519098619, 1.4101892974729979}; - Real thermalEnergyFlux = 0.41622256825457099; - std::vector const testFluxes = Compute_Fluxes(leftFastRareLeftSide, leftFastRareRightSide, gamma, direction); + Real thermalEnergyFlux = 0.41622256825457099; + std::vector const testFluxes = + Compute_Fluxes(leftFastRareLeftSide, leftFastRareRightSide, gamma, direction); Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { @@ -435,8 +436,9 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, BrioAndWuShockTubeCorrectInputExpectCorrectO 0.21008080091470105, 0.0, 0.058615131833681167, 0}; std::vector const scalarFlux{0.078034606921016325, 0.15710005136841393, 0.23371763662029341}; - Real thermalEnergyFlux = 0.047345816580591255; - std::vector const testFluxes = Compute_Fluxes(leftFastRareRightSide, leftFastRareLeftSide, gamma, direction); + Real thermalEnergyFlux = 0.047345816580591255; + std::vector const testFluxes = + Compute_Fluxes(leftFastRareRightSide, leftFastRareLeftSide, gamma, direction); Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { @@ -792,8 +794,9 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor -0.20403672861184916, 4.014027751838869, 0.0, 0.7248753989305099, -0.059178137562467162}; std::vector const scalarFlux{1.0663278606879119, 2.1467419174572049, 3.1937064501984724}; - Real thermalEnergyFlux = 1.5323573637968553; - std::vector const testFluxes = Compute_Fluxes(leftRotationLeftSide, leftRotationRightSide, gamma, direction); + Real thermalEnergyFlux = 1.5323573637968553; + std::vector const testFluxes = + Compute_Fluxes(leftRotationLeftSide, leftRotationRightSide, gamma, direction); Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { @@ -807,8 +810,9 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, DaiAndWoodwardShockTubeCorrectInputExpectCor -0.31541343522923493, 3.9739842521208342, 0.0, 0.75541746728406312, -0.13479771672887678}; std::vector const scalarFlux{1.0666336820367937, 2.1473576000564334, 3.1946224007710313}; - Real thermalEnergyFlux = 1.5333744977458499; - std::vector const testFluxes = Compute_Fluxes(leftRotationRightSide, leftRotationLeftSide, gamma, direction); + Real thermalEnergyFlux = 1.5333744977458499; + std::vector const testFluxes = + Compute_Fluxes(leftRotationRightSide, leftRotationLeftSide, gamma, direction); Check_Results(fiducialFlux, scalarFlux, thermalEnergyFlux, testFluxes, outputString, direction); } { @@ -1304,7 +1308,8 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, EinfeldtStrongRarefactionCorrectInputExpectC Primitive_2_Conserved({0.368580, -1.180830, Vy, Vz, 0.111253, Bx, 0.183044, Bz}, gamma, primitiveScalar), leftVxTurnOver = Primitive_2_Conserved({0.058814, -0.125475, Vy, Vz, 0.008819, Bx, 0.029215, Bz}, gamma, primitiveScalar), - midPoint = Primitive_2_Conserved({0.034658, 0.000778, Vy, Vz, 0.006776, Bx, 0.017333, Bz}, gamma, primitiveScalar), + midPoint = + Primitive_2_Conserved({0.034658, 0.000778, Vy, Vz, 0.006776, Bx, 0.017333, Bz}, gamma, primitiveScalar), rightVxTurnOver = Primitive_2_Conserved({0.062587, 0.152160, Vy, Vz, 0.009521, Bx, 0.031576, Bz}, gamma, primitiveScalar), rightRarefactionCenter = @@ -1554,8 +1559,10 @@ TEST_F(tMHDCalculateHLLDFluxesCUDA, ConstantStatesExpectCorrectFlux) std::vector const // | Density | X-Velocity | Y-Velocity | Z-Velocity | // Pressure | X-Magnetic Field | Y-Magnetic Field | // Z-Magnetic Field | Adiabatic Index | Passive Scalars | - zeroMagneticField = Primitive_2_Conserved({1e4, 0.0, 0.0, 0.0, 1.380658E-5, 0.0, 0.0, 0.0}, gamma, primitiveScalar), - onesMagneticField = Primitive_2_Conserved({1e4, 0.0, 0.0, 0.0, 1.380658E-5, 1.0, 1.0, 1.0}, gamma, primitiveScalar); + zeroMagneticField = + Primitive_2_Conserved({1e4, 0.0, 0.0, 0.0, 1.380658E-5, 0.0, 0.0, 0.0}, gamma, primitiveScalar), + onesMagneticField = + Primitive_2_Conserved({1e4, 0.0, 0.0, 0.0, 1.380658E-5, 1.0, 1.0, 1.0}, gamma, primitiveScalar); for (size_t direction = 0; direction < 3; direction++) { { @@ -1953,17 +1960,18 @@ TEST(tMHDHlldInternalNonStarFluxes, CorrectInputExpectCorrectOutput) mhd::_internal::nonStarFluxes(parameters.stateLVec.at(i), parameters.magneticX.at(i)); // Now check results - testingUtilities::Check_Results(fiducialFlux[i].density, testFlux.density, parameters.names.at(i) + ", DensityFlux"); + testingUtilities::Check_Results(fiducialFlux[i].density, testFlux.density, + parameters.names.at(i) + ", DensityFlux"); testingUtilities::Check_Results(fiducialFlux[i].momentumX, testFlux.momentumX, - parameters.names.at(i) + ", MomentumFluxX"); + parameters.names.at(i) + ", MomentumFluxX"); testingUtilities::Check_Results(fiducialFlux[i].momentumY, testFlux.momentumY, - parameters.names.at(i) + ", MomentumFluxY"); + parameters.names.at(i) + ", MomentumFluxY"); testingUtilities::Check_Results(fiducialFlux[i].momentumZ, testFlux.momentumZ, - parameters.names.at(i) + ", MomentumFluxZ"); + parameters.names.at(i) + ", MomentumFluxZ"); testingUtilities::Check_Results(fiducialFlux[i].magneticY, testFlux.magneticY, - parameters.names.at(i) + ", MagneticFluxY"); + parameters.names.at(i) + ", MagneticFluxY"); testingUtilities::Check_Results(fiducialFlux[i].magneticZ, testFlux.magneticZ, - parameters.names.at(i) + ", MagneticFluxZ"); + parameters.names.at(i) + ", MagneticFluxZ"); testingUtilities::Check_Results(fiducialFlux[i].energy, testFlux.energy, parameters.names.at(i) + ", EnergyFlux"); } } @@ -1992,15 +2000,15 @@ TEST(tMHDHlldInternalComputeStarState, CorrectInputNonDegenerateExpectCorrectOut // Now check results testingUtilities::Check_Results(fiducialStarState.at(i).velocityY, testStarState.velocityY, - parameters.names.at(i) + ", VelocityStarY"); + parameters.names.at(i) + ", VelocityStarY"); testingUtilities::Check_Results(fiducialStarState.at(i).velocityZ, testStarState.velocityZ, - parameters.names.at(i) + ", VelocityStarZ"); + parameters.names.at(i) + ", VelocityStarZ"); testingUtilities::Check_Results(fiducialStarState.at(i).energy, testStarState.energy, - parameters.names.at(i) + ", EnergyStar"); + parameters.names.at(i) + ", EnergyStar"); testingUtilities::Check_Results(fiducialStarState.at(i).magneticY, testStarState.magneticY, - parameters.names.at(i) + ", MagneticStarY"); + parameters.names.at(i) + ", MagneticStarY"); testingUtilities::Check_Results(fiducialStarState.at(i).magneticZ, testStarState.magneticZ, - parameters.names.at(i) + ", MagneticStarZ"); + parameters.names.at(i) + ", MagneticStarZ"); } } @@ -2030,19 +2038,19 @@ TEST(tMHDHlldInternalStarFluxes, CorrectInputNonDegenerateExpectCorrectOutput) // Now check results testingUtilities::Check_Results(fiducialFlux[i].density, testFlux.density, - parameters.names.at(i) + ", DensityStarFlux"); + parameters.names.at(i) + ", DensityStarFlux"); testingUtilities::Check_Results(fiducialFlux[i].momentumX, testFlux.momentumX, - parameters.names.at(i) + ", MomentumStarFluxX"); + parameters.names.at(i) + ", MomentumStarFluxX"); testingUtilities::Check_Results(fiducialFlux[i].momentumY, testFlux.momentumY, - parameters.names.at(i) + ", MomentumStarFluxY"); + parameters.names.at(i) + ", MomentumStarFluxY"); testingUtilities::Check_Results(fiducialFlux[i].momentumZ, testFlux.momentumZ, - parameters.names.at(i) + ", MomentumStarFluxZ"); + parameters.names.at(i) + ", MomentumStarFluxZ"); testingUtilities::Check_Results(fiducialFlux[i].energy, testFlux.energy, - parameters.names.at(i) + ", EnergyStarFlux"); + parameters.names.at(i) + ", EnergyStarFlux"); testingUtilities::Check_Results(fiducialFlux[i].magneticY, testFlux.magneticY, - parameters.names.at(i) + ", MagneticStarFluxY", 1.0E-13); + parameters.names.at(i) + ", MagneticStarFluxY", 1.0E-13); testingUtilities::Check_Results(fiducialFlux[i].magneticZ, testFlux.magneticZ, - parameters.names.at(i) + ", MagneticStarFluxZ", 7.0E-13); + parameters.names.at(i) + ", MagneticStarFluxZ", 7.0E-13); } } @@ -2072,15 +2080,15 @@ TEST(tMHDHlldInternalComputeStarState, CorrectInputDegenerateExpectCorrectOutput // Now check results testingUtilities::Check_Results(fiducialStarState.at(i).velocityY, testStarState.velocityY, - parameters.names.at(i) + ", VelocityStarY"); + parameters.names.at(i) + ", VelocityStarY"); testingUtilities::Check_Results(fiducialStarState.at(i).velocityZ, testStarState.velocityZ, - parameters.names.at(i) + ", VelocityStarZ"); + parameters.names.at(i) + ", VelocityStarZ"); testingUtilities::Check_Results(fiducialStarState.at(i).energy, testStarState.energy, - parameters.names.at(i) + ", EnergyStar"); + parameters.names.at(i) + ", EnergyStar"); testingUtilities::Check_Results(fiducialStarState.at(i).magneticY, testStarState.magneticY, - parameters.names.at(i) + ", MagneticStarY"); + parameters.names.at(i) + ", MagneticStarY"); testingUtilities::Check_Results(fiducialStarState.at(i).magneticZ, testStarState.magneticZ, - parameters.names.at(i) + ", MagneticStarZ"); + parameters.names.at(i) + ", MagneticStarZ"); } } @@ -2107,19 +2115,19 @@ TEST(tMHDHlldInternalStarFluxes, CorrectInputDegenerateExpectCorrectOutput) // Now check results testingUtilities::Check_Results(fiducialFlux[i].density, testFlux.density, - parameters.names.at(i) + ", DensityStarFlux"); + parameters.names.at(i) + ", DensityStarFlux"); testingUtilities::Check_Results(fiducialFlux[i].momentumX, testFlux.momentumX, - parameters.names.at(i) + ", MomentumStarFluxX"); + parameters.names.at(i) + ", MomentumStarFluxX"); testingUtilities::Check_Results(fiducialFlux[i].momentumY, testFlux.momentumY, - parameters.names.at(i) + ", MomentumStarFluxY"); + parameters.names.at(i) + ", MomentumStarFluxY"); testingUtilities::Check_Results(fiducialFlux[i].momentumZ, testFlux.momentumZ, - parameters.names.at(i) + ", MomentumStarFluxZ"); + parameters.names.at(i) + ", MomentumStarFluxZ"); testingUtilities::Check_Results(fiducialFlux[i].energy, testFlux.energy, - parameters.names.at(i) + ", EnergyStarFlux"); + parameters.names.at(i) + ", EnergyStarFlux"); testingUtilities::Check_Results(fiducialFlux[i].magneticY, testFlux.magneticY, - parameters.names.at(i) + ", MagneticStarFluxY"); + parameters.names.at(i) + ", MagneticStarFluxY"); testingUtilities::Check_Results(fiducialFlux[i].magneticZ, testFlux.magneticZ, - parameters.names.at(i) + ", MagneticStarFluxZ"); + parameters.names.at(i) + ", MagneticStarFluxZ"); } } // ========================================================================= @@ -2147,17 +2155,17 @@ TEST(tMHDHlldInternalDoubleStarState, CorrectInputNonDegenerateExpectCorrectOutp // Now check results testingUtilities::Check_Results(fiducialState.at(i).velocityY, testState.velocityY, - parameters.names.at(i) + ", VelocityDoubleStarY"); + parameters.names.at(i) + ", VelocityDoubleStarY"); testingUtilities::Check_Results(fiducialState.at(i).velocityZ, testState.velocityZ, - parameters.names.at(i) + ", VelocityDoubleStarZ"); + parameters.names.at(i) + ", VelocityDoubleStarZ"); testingUtilities::Check_Results(fiducialState.at(i).magneticY, testState.magneticY, - parameters.names.at(i) + ", MagneticDoubleStarY"); + parameters.names.at(i) + ", MagneticDoubleStarY"); testingUtilities::Check_Results(fiducialState.at(i).magneticZ, testState.magneticZ, - parameters.names.at(i) + ", MagneticDoubleStarZ"); + parameters.names.at(i) + ", MagneticDoubleStarZ"); testingUtilities::Check_Results(fiducialState.at(i).energyL, testState.energyL, - parameters.names.at(i) + ", EnergyDoubleStarL"); + parameters.names.at(i) + ", EnergyDoubleStarL"); testingUtilities::Check_Results(fiducialState.at(i).energyR, testState.energyR, - parameters.names.at(i) + ", EnergyDoubleStarR"); + parameters.names.at(i) + ", EnergyDoubleStarR"); } } @@ -2181,17 +2189,17 @@ TEST(tMHDHlldInternalDoubleStarState, CorrectInputDegenerateExpectCorrectOutput) // Now check results testingUtilities::Check_Results(fiducialState.at(i).velocityY, testState.velocityY, - parameters.names.at(i) + ", VelocityDoubleStarY"); + parameters.names.at(i) + ", VelocityDoubleStarY"); testingUtilities::Check_Results(fiducialState.at(i).velocityZ, testState.velocityZ, - parameters.names.at(i) + ", VelocityDoubleStarZ"); + parameters.names.at(i) + ", VelocityDoubleStarZ"); testingUtilities::Check_Results(fiducialState.at(i).magneticY, testState.magneticY, - parameters.names.at(i) + ", MagneticDoubleStarY"); + parameters.names.at(i) + ", MagneticDoubleStarY"); testingUtilities::Check_Results(fiducialState.at(i).magneticZ, testState.magneticZ, - parameters.names.at(i) + ", MagneticDoubleStarZ"); + parameters.names.at(i) + ", MagneticDoubleStarZ"); testingUtilities::Check_Results(fiducialState.at(i).energyL, testState.energyL, - parameters.names.at(i) + ", EnergyDoubleStarL"); + parameters.names.at(i) + ", EnergyDoubleStarL"); testingUtilities::Check_Results(fiducialState.at(i).energyR, testState.energyR, - parameters.names.at(i) + ", EnergyDoubleStarR"); + parameters.names.at(i) + ", EnergyDoubleStarR"); } } // ========================================================================= @@ -2219,19 +2227,19 @@ TEST(tMHDHlldInternalDoubleStarFluxes, CorrectInputExpectCorrectOutput) // Now check results testingUtilities::Check_Results(fiducialFlux[i].density, testFlux.density, - parameters.names.at(i) + ", DensityStarFlux", 5.0E-14); + parameters.names.at(i) + ", DensityStarFlux", 5.0E-14); testingUtilities::Check_Results(fiducialFlux[i].momentumX, testFlux.momentumX, - parameters.names.at(i) + ", MomentumStarFluxX"); + parameters.names.at(i) + ", MomentumStarFluxX"); testingUtilities::Check_Results(fiducialFlux[i].momentumY, testFlux.momentumY, - parameters.names.at(i) + ", MomentumStarFluxY"); + parameters.names.at(i) + ", MomentumStarFluxY"); testingUtilities::Check_Results(fiducialFlux[i].momentumZ, testFlux.momentumZ, - parameters.names.at(i) + ", MomentumStarFluxZ"); + parameters.names.at(i) + ", MomentumStarFluxZ"); testingUtilities::Check_Results(fiducialFlux[i].energy, testFlux.energy, - parameters.names.at(i) + ", EnergyStarFlux"); + parameters.names.at(i) + ", EnergyStarFlux"); testingUtilities::Check_Results(fiducialFlux[i].magneticY, testFlux.magneticY, - parameters.names.at(i) + ", MagneticStarFluxY"); + parameters.names.at(i) + ", MagneticStarFluxY"); testingUtilities::Check_Results(fiducialFlux[i].magneticZ, testFlux.magneticZ, - parameters.names.at(i) + ", MagneticStarFluxZ"); + parameters.names.at(i) + ", MagneticStarFluxZ"); } } // ========================================================================= @@ -2339,7 +2347,7 @@ TEST(tMHDHlldInternalStarTotalPressure, CorrectInputExpectCorrectOutput) // Now check results testingUtilities::Check_Results(fiducialPressure.at(i), testPressure, - parameters.names.at(i) + ", total pressure in the star states"); + parameters.names.at(i) + ", total pressure in the star states"); } } // ========================================================================= @@ -2396,7 +2404,7 @@ TEST(tMHDHlldInternalLoadState, CorrectInputExpectCorrectOutput) testingUtilities::Check_Results(fiducialState.at(direction).magneticZ, testState.magneticZ, ", magneticZ"); testingUtilities::Check_Results(fiducialState.at(direction).gasPressure, testState.gasPressure, ", gasPressure"); testingUtilities::Check_Results(fiducialState.at(direction).totalPressure, testState.totalPressure, - ", totalPressure"); + ", totalPressure"); } } // ========================================================================= diff --git a/src/system_tests/hydro_system_tests.cpp b/src/system_tests/hydro_system_tests.cpp index be59ffba6..5366a2f9a 100644 --- a/src/system_tests/hydro_system_tests.cpp +++ b/src/system_tests/hydro_system_tests.cpp @@ -149,8 +149,8 @@ class tHYDROtMHDSYSTEMLinearWavesParameterizedMpi : public ::testing::TestWithPa #endif // PCM void Set_Launch_Params(double const &waveSpeed, double const &rEigenVec_rho, double const &rEigenVec_MomentumX, - double const &rEigenVec_MomentumY, double const &rEigenVec_MomentumZ, double const &rEigenVec_E, - double const &vx = 0.0) + double const &rEigenVec_MomentumY, double const &rEigenVec_MomentumZ, + double const &rEigenVec_E, double const &vx = 0.0) { // Constant for all tests size_t const N = 32; @@ -213,7 +213,8 @@ TEST_P(tHYDROtMHDSYSTEMLinearWavesParameterizedMpi, SoundWaveRightMovingCorrectI double const rEigenVec_E = 1.5; // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E); // Set the number of MPI ranks waveTest.numMpiRanks = GetParam(); @@ -238,7 +239,8 @@ TEST_P(tHYDROtMHDSYSTEMLinearWavesParameterizedMpi, SoundWaveLeftMovingCorrectIn double const rEigenVec_E = 1.5; // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E); // Set the number of MPI ranks waveTest.numMpiRanks = GetParam(); @@ -266,8 +268,8 @@ TEST_P(tHYDROtMHDSYSTEMLinearWavesParameterizedMpi, HydroContactWaveCorrectInput double const velocityX = waveSpeed; // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - velocityX); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, velocityX); // Set the number of MPI ranks waveTest.numMpiRanks = GetParam(); diff --git a/src/system_tests/mhd_system_tests.cpp b/src/system_tests/mhd_system_tests.cpp index 50235d71b..570b74c16 100644 --- a/src/system_tests/mhd_system_tests.cpp +++ b/src/system_tests/mhd_system_tests.cpp @@ -34,10 +34,10 @@ class tMHDSYSTEMLinearWavesParameterizedAngle : public ::testing::TestWithParam< systemTest::SystemTestRunner waveTest; void Set_Launch_Params(double const &waveSpeed, double const &rEigenVec_rho, double const &rEigenVec_MomentumX, - double const &rEigenVec_MomentumY, double const &rEigenVec_MomentumZ, double const &rEigenVec_E, - double const &rEigenVec_Bx, double const &rEigenVec_By, double const &rEigenVec_Bz, - double const &pitch, double const &yaw, double const &domain, int const &domain_direction, - double const &vx = 0.0) + double const &rEigenVec_MomentumY, double const &rEigenVec_MomentumZ, + double const &rEigenVec_E, double const &rEigenVec_Bx, double const &rEigenVec_By, + double const &rEigenVec_Bz, double const &pitch, double const &yaw, double const &domain, + int const &domain_direction, double const &vx = 0.0) { // Constant for all tests size_t const N = 32; @@ -148,8 +148,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, FastMagnetosonicWaveRightMovingC auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -184,8 +184,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, FastMagnetosonicWaveLeftMovingCo auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -222,8 +222,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, SlowMagnetosonicWaveRightMovingC auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -258,8 +258,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, SlowMagnetosonicWaveLeftMovingCo auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -295,8 +295,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, AlfvenWaveRightMovingCorrectInpu auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -330,8 +330,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, AlfvenWaveLeftMovingCorrectInput auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -368,8 +368,9 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, MHDContactWaveCorrectInputExpect auto [pitch, yaw, domain, domain_direction] = GetParam(); // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, velocityX); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, + velocityX); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -414,8 +415,9 @@ class tMHDSYSTEMLinearWavesParameterizedMpi : public ::testing::TestWithParam void Check_Results(double fiducialNumber, double testNumber, std::string const &outString, double fixedEpsilon = -999, - int64_t ulpsEpsilon = -999) + int64_t ulpsEpsilon = -999) { // Check for equality and if not equal return difference double absoluteDiff; From 750c69c821b684b5b1d34a6e4460467227e9c38b Mon Sep 17 00:00:00 2001 From: helenarichie Date: Tue, 11 Jul 2023 08:36:44 -0400 Subject: [PATCH 03/13] fix function name --- src/gravity/paris/PoissonZero3DBlockedGPU.cu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gravity/paris/PoissonZero3DBlockedGPU.cu b/src/gravity/paris/PoissonZero3DBlockedGPU.cu index e924ca30e..08ac30df8 100644 --- a/src/gravity/paris/PoissonZero3DBlockedGPU.cu +++ b/src/gravity/paris/PoissonZero3DBlockedGPU.cu @@ -38,7 +38,7 @@ PoissonZero3DBlockedGPU::PoissonZero3DBlockedGPU(const int n[3], const double lo nj_(n[1]), nk_(n[2]) { - mq_ = int(round(Sqrt(mk_))); + mq_ = int(round(Sqr(mk_))); while (mk_ % mq_) { mq_--; } @@ -349,7 +349,7 @@ void PoissonZero3DBlockedGPU::solve(const long bytes, double *const density, dou double wa, wb; sincospi(double(i) / double(ni + ni), &wb, &wa); #ifdef PARIS_GALACTIC_3PT - const double nii = Sqr(sin(double(ni - i) * si) * ddi); + const double nii = t(sin(double(ni - i) * si) * ddi); #elif defined PARIS_GALACTIC_5PT const double cni = cos(double(ni - i) * si); const double nii = ddi * (2.0 * cni * cni - 16.0 * cni + 14.0); From 146589509a5250e3280c3212889c52a31ed513c1 Mon Sep 17 00:00:00 2001 From: helenarichie Date: Tue, 11 Jul 2023 10:44:26 -0400 Subject: [PATCH 04/13] remove accidental renaming of hip function --- src/particles/feedback_CIC_gpu.cu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/particles/feedback_CIC_gpu.cu b/src/particles/feedback_CIC_gpu.cu index f464e167e..a7ce87866 100644 --- a/src/particles/feedback_CIC_gpu.cu +++ b/src/particles/feedback_CIC_gpu.cu @@ -36,7 +36,7 @@ int snr_n; } // namespace supernova #ifndef O_HIP -__device__ double Atomic_Max(double* address, double val) +__device__ double atomicMax(double* address, double val) { auto* address_as_ull = (unsigned long long int*)address; unsigned long long int old = *address_as_ull, assumed; @@ -611,7 +611,7 @@ __global__ void Cluster_Feedback_Kernel(part_int_t n_local, part_int_t* id, Real } } if (direction > 0) { - Atomic_Max(dti, local_dti); + atomicMax(dti, local_dti); } } } From 17528eb446cdb799803a550ff29eb1a7b06f9f75 Mon Sep 17 00:00:00 2001 From: helenarichie Date: Tue, 11 Jul 2023 15:51:42 -0400 Subject: [PATCH 05/13] changes for disk build to pass naming clang-tidy check --- .clang-tidy | 3 +++ src/gravity/paris/PoissonZero3DBlockedGPU.cu | 2 +- src/particles/feedback_CIC_gpu.cu | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/.clang-tidy b/.clang-tidy index af3796ff8..f3798efb6 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -38,6 +38,9 @@ Checks: "*, google-readability-avoid-underscore-in-googletest-name, google-upgrade-googletest-case, + -*, + readability-identifier-naming, + -bugprone-implicit-widening-of-multiplication-result, -bugprone-narrowing-conversions, -cert-env33-c, diff --git a/src/gravity/paris/PoissonZero3DBlockedGPU.cu b/src/gravity/paris/PoissonZero3DBlockedGPU.cu index 08ac30df8..7d94c8ca3 100644 --- a/src/gravity/paris/PoissonZero3DBlockedGPU.cu +++ b/src/gravity/paris/PoissonZero3DBlockedGPU.cu @@ -110,7 +110,7 @@ PoissonZero3DBlockedGPU::~PoissonZero3DBlockedGPU() MPI_Comm_free(&commK_); } -void print(const char *const title, const int ni, const int nj, const int nk, const double *const v) +void Print(const char *const title, const int ni, const int nj, const int nk, const double *const v) { printf("%s:\n", title); for (int i = 0; i < ni; i++) { diff --git a/src/particles/feedback_CIC_gpu.cu b/src/particles/feedback_CIC_gpu.cu index a7ce87866..0e535c91f 100644 --- a/src/particles/feedback_CIC_gpu.cu +++ b/src/particles/feedback_CIC_gpu.cu @@ -36,6 +36,7 @@ int snr_n; } // namespace supernova #ifndef O_HIP +// NOLINTNEXTLINE(readability-identifier-naming) __device__ double atomicMax(double* address, double val) { auto* address_as_ull = (unsigned long long int*)address; From 254a7958f8eccc28b21070cea13df35d0ad78c0c Mon Sep 17 00:00:00 2001 From: helenarichie Date: Mon, 17 Jul 2023 14:32:30 -0400 Subject: [PATCH 06/13] update formatting from PRs 300 and 311 --- clang-tidy-runner.sh | 23 ++++++++++ src/reconstruction/ppmc_cuda_tests.cu | 8 ++-- src/reconstruction/reconstruction_tests.cu | 50 +++++++++++----------- 3 files changed, 52 insertions(+), 29 deletions(-) create mode 100644 clang-tidy-runner.sh diff --git a/clang-tidy-runner.sh b/clang-tidy-runner.sh new file mode 100644 index 000000000..b8f0e4888 --- /dev/null +++ b/clang-tidy-runner.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +# Description: +# Run clang-tidy on all build types in parallel. Note that this spawns 2x the +# number of build types threads since each type has a thread for the CPU code +# and a thread for the GPU code + +# If ctrl-c is sent trap it and kill all clang-tidy processes +trap "kill -- -$$" EXIT + +# cd into the Cholla directory. Default to ${HOME}/Code/cholla +cholla_path=${1:-${HOME}/Code/cholla} +cd ${cholla_path} + +# Run all clang-tidy build types in parallel +builds=( hydro gravity disk particles cosmology mhd dust) +for build in "${builds[@]}" +do + make tidy TYPE=$build & +done + +# Wait for clang-tidy to finish +wait diff --git a/src/reconstruction/ppmc_cuda_tests.cu b/src/reconstruction/ppmc_cuda_tests.cu index 7dd9b49e3..1a56bbcbc 100644 --- a/src/reconstruction/ppmc_cuda_tests.cu +++ b/src/reconstruction/ppmc_cuda_tests.cu @@ -101,7 +101,7 @@ TEST(tHYDROPpmcCTUReconstructor, CorrectInputExpectCorrectOutput) ? 0.0 : fiducial_interface_left.at(direction)[i]; - testingUtilities::checkResults( + testingUtilities::Check_Results( fiducial_val, test_val, "left interface at i=" + std::to_string(i) + ", in direction " + std::to_string(direction)); @@ -111,7 +111,7 @@ TEST(tHYDROPpmcCTUReconstructor, CorrectInputExpectCorrectOutput) ? 0.0 : fiducial_interface_right.at(direction)[i]; - testingUtilities::checkResults( + testingUtilities::Check_Results( fiducial_val, test_val, "right interface at i=" + std::to_string(i) + ", in direction " + std::to_string(direction)); } @@ -241,7 +241,7 @@ TEST(tALLPpmcVLReconstructor, CorrectInputExpectCorrectOutput) ? 0.0 : fiducial_interface_left.at(direction)[i]; - testingUtilities::checkResults( + testingUtilities::Check_Results( fiducial_val, test_val, "left interface at i=" + std::to_string(i) + ", in direction " + std::to_string(direction)); @@ -251,7 +251,7 @@ TEST(tALLPpmcVLReconstructor, CorrectInputExpectCorrectOutput) ? 0.0 : fiducial_interface_right.at(direction)[i]; - testingUtilities::checkResults( + testingUtilities::Check_Results( fiducial_val, test_val, "right interface at i=" + std::to_string(i) + ", in direction " + std::to_string(direction)); } diff --git a/src/reconstruction/reconstruction_tests.cu b/src/reconstruction/reconstruction_tests.cu index 6084a0b78..3c4ba9b04 100644 --- a/src/reconstruction/reconstruction_tests.cu +++ b/src/reconstruction/reconstruction_tests.cu @@ -304,17 +304,17 @@ TEST(tHYDROReconstructionMonotizeParabolicInterface, CorrectInputExpectCorrectOu 4.6476103465999996, 3.7096802847000001}; reconstruction::Primitive const fiducial_interface_R{1.4708046700999999, 9.428341982700001, 3.7123503441999999, 4.6476103465999996, 3.7096802847000001}; - testingUtilities::checkResults(fiducial_interface_L.density, interface_L_iph.density, "density"); - testingUtilities::checkResults(fiducial_interface_L.velocity_x, interface_L_iph.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_interface_L.velocity_y, interface_L_iph.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_interface_L.velocity_z, interface_L_iph.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_interface_L.pressure, interface_L_iph.pressure, "pressure"); - - testingUtilities::checkResults(fiducial_interface_R.density, interface_R_imh.density, "density"); - testingUtilities::checkResults(fiducial_interface_R.velocity_x, interface_R_imh.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_interface_R.velocity_y, interface_R_imh.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_interface_R.velocity_z, interface_R_imh.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_interface_R.pressure, interface_R_imh.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_interface_L.density, interface_L_iph.density, "density"); + testingUtilities::Check_Results(fiducial_interface_L.velocity_x, interface_L_iph.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_interface_L.velocity_y, interface_L_iph.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_interface_L.velocity_z, interface_L_iph.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_interface_L.pressure, interface_L_iph.pressure, "pressure"); + + testingUtilities::Check_Results(fiducial_interface_R.density, interface_R_imh.density, "density"); + testingUtilities::Check_Results(fiducial_interface_R.velocity_x, interface_R_imh.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_interface_R.velocity_y, interface_R_imh.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_interface_R.velocity_z, interface_R_imh.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_interface_R.pressure, interface_R_imh.pressure, "pressure"); } TEST(tALLReconstructionCalcInterfaceLinear, CorrectInputExpectCorrectOutput) @@ -375,21 +375,21 @@ TEST(tALLReconstructionCalcInterfaceParabolic, CorrectInputExpectCorrectOutput) reconstruction::Primitive const fiducial_data{4.833333333333333, 5.833333333333333, 6.833333333333333, 7.833333333333333, 8.8333333333333339, 0.0, 10.833333333333334, 11.833333333333334}; - testingUtilities::checkResults(fiducial_data.density, test_data.density, "density"); - testingUtilities::checkResults(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data.pressure, test_data.pressure, "pressure"); - testingUtilities::checkResults(fiducial_data.magnetic_y, test_data.magnetic_y, "magnetic_y"); - testingUtilities::checkResults(fiducial_data.magnetic_z, test_data.magnetic_z, "magnetic_z"); + testingUtilities::Check_Results(fiducial_data.density, test_data.density, "density"); + testingUtilities::Check_Results(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data.pressure, test_data.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data.magnetic_y, test_data.magnetic_y, "magnetic_y"); + testingUtilities::Check_Results(fiducial_data.magnetic_z, test_data.magnetic_z, "magnetic_z"); #else // MHD reconstruction::Primitive const fiducial_data{4.833333333333333, 5.833333333333333, 6.833333333333333, 7.833333333333333, 8.8333333333333339}; - testingUtilities::checkResults(fiducial_data.density, test_data.density, "density"); - testingUtilities::checkResults(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); - testingUtilities::checkResults(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); - testingUtilities::checkResults(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); - testingUtilities::checkResults(fiducial_data.pressure, test_data.pressure, "pressure"); + testingUtilities::Check_Results(fiducial_data.density, test_data.density, "density"); + testingUtilities::Check_Results(fiducial_data.velocity_x, test_data.velocity_x, "velocity_x"); + testingUtilities::Check_Results(fiducial_data.velocity_y, test_data.velocity_y, "velocity_y"); + testingUtilities::Check_Results(fiducial_data.velocity_z, test_data.velocity_z, "velocity_z"); + testingUtilities::Check_Results(fiducial_data.pressure, test_data.pressure, "pressure"); #endif // MHD } @@ -461,8 +461,8 @@ TEST(tALLReconstructionPPMSingleVariable, CorrectInputExpectCorrectOutput) input_data[idx + 4], test_left_interface, test_right_interface); // Compare results - testingUtilities::checkResults(fiducial_left_interface.at(i), test_left_interface, "left i+1/2 interface"); - testingUtilities::checkResults(fiducial_right_interface.at(i), test_right_interface, "right i-1/2 interface"); + testingUtilities::Check_Results(fiducial_left_interface.at(i), test_left_interface, "left i+1/2 interface"); + testingUtilities::Check_Results(fiducial_right_interface.at(i), test_right_interface, "right i-1/2 interface"); } } From 758ac381667526e008e921116053940f6f3bcf77 Mon Sep 17 00:00:00 2001 From: helenarichie Date: Tue, 15 Aug 2023 10:56:08 -0400 Subject: [PATCH 07/13] run clang format --- cholla-tests-data | 2 +- src/system_tests/mhd_system_tests.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cholla-tests-data b/cholla-tests-data index dcd73ff52..321416680 160000 --- a/cholla-tests-data +++ b/cholla-tests-data @@ -1 +1 @@ -Subproject commit dcd73ff52b9027627b247c6d888bcdb56840c85e +Subproject commit 321416680f95d97b5d4ccc6f0b83a8b9ecafdaf0 diff --git a/src/system_tests/mhd_system_tests.cpp b/src/system_tests/mhd_system_tests.cpp index 214a05541..94274dfc0 100644 --- a/src/system_tests/mhd_system_tests.cpp +++ b/src/system_tests/mhd_system_tests.cpp @@ -36,10 +36,10 @@ class tMHDSYSTEMLinearWavesParameterizedAngle : public ::testing::TestWithParam< inline static std::unordered_map high_res_l2norms; void Set_Launch_Params(double const &waveSpeed, double const &rEigenVec_rho, double const &rEigenVec_MomentumX, - double const &rEigenVec_MomentumY, double const &rEigenVec_MomentumZ, double const &rEigenVec_E, - double const &rEigenVec_Bx, double const &rEigenVec_By, double const &rEigenVec_Bz, - double const &pitch, double const &yaw, double const &domain, int const &domain_direction, - double const &vx = 0.0, size_t const &N = 32) + double const &rEigenVec_MomentumY, double const &rEigenVec_MomentumZ, + double const &rEigenVec_E, double const &rEigenVec_Bx, double const &rEigenVec_By, + double const &rEigenVec_Bz, double const &pitch, double const &yaw, double const &domain, + int const &domain_direction, double const &vx = 0.0, size_t const &N = 32) { // Constant for all tests double const gamma = 5. / 3.; From 2c0b6e2cb3d45af1557b6d2ffb4a45703e6d8ea3 Mon Sep 17 00:00:00 2001 From: helenarichie Date: Tue, 15 Aug 2023 11:45:44 -0400 Subject: [PATCH 08/13] implement naming convention to recent commits --- src/reconstruction/reconstruction_tests.cu | 48 +++++++++++----------- src/system_tests/mhd_system_tests.cpp | 32 +++++++-------- 2 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/reconstruction/reconstruction_tests.cu b/src/reconstruction/reconstruction_tests.cu index f69655c41..35ea2297f 100644 --- a/src/reconstruction/reconstruction_tests.cu +++ b/src/reconstruction/reconstruction_tests.cu @@ -41,7 +41,7 @@ __global__ void Test_Char_2_Prim(reconstruction::Primitive const primitive, sound_speed, sound_speed_squared, gamma); } -__global__ void test_compute_eigenvectors(reconstruction::Primitive const primitive, Real const sound_speed, +__global__ void Test_Compute_Eigenvectors(reconstruction::Primitive const primitive, Real const sound_speed, Real const sound_speed_squared, Real const gamma, reconstruction::EigenVecs *eigenvectors) { @@ -121,7 +121,7 @@ TEST(tMHDReconstructionComputeEigenvectors, CorrectInputExpectCorrectOutput) // Run test cuda_utilities::DeviceVector dev_results(1); - hipLaunchKernelGGL(test_compute_eigenvectors, 1, 1, 0, 0, primitive, sound_speed, sound_speed_squared, gamma, + hipLaunchKernelGGL(Test_Compute_Eigenvectors, 1, 1, 0, 0, primitive, sound_speed, sound_speed_squared, gamma, dev_results.data()); CudaCheckError(); cudaDeviceSynchronize(); @@ -150,28 +150,28 @@ TEST(tMHDReconstructionComputeEigenvectors, CorrectInputExpectCorrectOutput) 0.97891777490585408, 0.65850460786851805, 0.75257669470687782, 0.059999999999999984, 1, 2.546253336541183, 1.3601203180183106, 0.58963258314939582, 2.825892204282022, 0.15277520019247093, 0.081607219081098623, 0.03537795498896374, 0.1695535322569213}; - testingUtilities::checkResults(fiducial_results.magnetosonic_speed_fast, host_results.magnetosonic_speed_fast, - "magnetosonic_speed_fast"); - testingUtilities::checkResults(fiducial_results.magnetosonic_speed_slow, host_results.magnetosonic_speed_slow, - "magnetosonic_speed_slow"); - testingUtilities::checkResults(fiducial_results.magnetosonic_speed_fast_squared, - host_results.magnetosonic_speed_fast_squared, "magnetosonic_speed_fast_squared"); - testingUtilities::checkResults(fiducial_results.magnetosonic_speed_slow_squared, - host_results.magnetosonic_speed_slow_squared, "magnetosonic_speed_slow_squared"); - testingUtilities::checkResults(fiducial_results.alpha_fast, host_results.alpha_fast, "alpha_fast"); - testingUtilities::checkResults(fiducial_results.alpha_slow, host_results.alpha_slow, "alpha_slow"); - testingUtilities::checkResults(fiducial_results.beta_y, host_results.beta_y, "beta_y"); - testingUtilities::checkResults(fiducial_results.beta_z, host_results.beta_z, "beta_z"); - testingUtilities::checkResults(fiducial_results.n_fs, host_results.n_fs, "n_fs"); - testingUtilities::checkResults(fiducial_results.sign, host_results.sign, "sign"); - testingUtilities::checkResults(fiducial_results.q_fast, host_results.q_fast, "q_fast"); - testingUtilities::checkResults(fiducial_results.q_slow, host_results.q_slow, "q_slow"); - testingUtilities::checkResults(fiducial_results.a_fast, host_results.a_fast, "a_fast"); - testingUtilities::checkResults(fiducial_results.a_slow, host_results.a_slow, "a_slow"); - testingUtilities::checkResults(fiducial_results.q_prime_fast, host_results.q_prime_fast, "q_prime_fast"); - testingUtilities::checkResults(fiducial_results.q_prime_slow, host_results.q_prime_slow, "q_prime_slow"); - testingUtilities::checkResults(fiducial_results.a_prime_fast, host_results.a_prime_fast, "a_prime_fast"); - testingUtilities::checkResults(fiducial_results.a_prime_slow, host_results.a_prime_slow, "a_prime_slow"); + testingUtilities::Check_Results(fiducial_results.magnetosonic_speed_fast, host_results.magnetosonic_speed_fast, + "magnetosonic_speed_fast"); + testingUtilities::Check_Results(fiducial_results.magnetosonic_speed_slow, host_results.magnetosonic_speed_slow, + "magnetosonic_speed_slow"); + testingUtilities::Check_Results(fiducial_results.magnetosonic_speed_fast_squared, + host_results.magnetosonic_speed_fast_squared, "magnetosonic_speed_fast_squared"); + testingUtilities::Check_Results(fiducial_results.magnetosonic_speed_slow_squared, + host_results.magnetosonic_speed_slow_squared, "magnetosonic_speed_slow_squared"); + testingUtilities::Check_Results(fiducial_results.alpha_fast, host_results.alpha_fast, "alpha_fast"); + testingUtilities::Check_Results(fiducial_results.alpha_slow, host_results.alpha_slow, "alpha_slow"); + testingUtilities::Check_Results(fiducial_results.beta_y, host_results.beta_y, "beta_y"); + testingUtilities::Check_Results(fiducial_results.beta_z, host_results.beta_z, "beta_z"); + testingUtilities::Check_Results(fiducial_results.n_fs, host_results.n_fs, "n_fs"); + testingUtilities::Check_Results(fiducial_results.sign, host_results.sign, "sign"); + testingUtilities::Check_Results(fiducial_results.q_fast, host_results.q_fast, "q_fast"); + testingUtilities::Check_Results(fiducial_results.q_slow, host_results.q_slow, "q_slow"); + testingUtilities::Check_Results(fiducial_results.a_fast, host_results.a_fast, "a_fast"); + testingUtilities::Check_Results(fiducial_results.a_slow, host_results.a_slow, "a_slow"); + testingUtilities::Check_Results(fiducial_results.q_prime_fast, host_results.q_prime_fast, "q_prime_fast"); + testingUtilities::Check_Results(fiducial_results.q_prime_slow, host_results.q_prime_slow, "q_prime_slow"); + testingUtilities::Check_Results(fiducial_results.a_prime_fast, host_results.a_prime_fast, "a_prime_fast"); + testingUtilities::Check_Results(fiducial_results.a_prime_slow, host_results.a_prime_slow, "a_prime_slow"); } #endif // MHD diff --git a/src/system_tests/mhd_system_tests.cpp b/src/system_tests/mhd_system_tests.cpp index 94274dfc0..a9aced3fd 100644 --- a/src/system_tests/mhd_system_tests.cpp +++ b/src/system_tests/mhd_system_tests.cpp @@ -407,8 +407,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, FastMagnetosonicWaveExpectSecond double const rEigenVec_E = prefix * 9; // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, 16); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, 16); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -418,8 +418,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, FastMagnetosonicWaveExpectSecond // Check the scaling double const low_res_l2norm = waveTest.getL2Norm(); - testingUtilities::checkResults(4.0, low_res_l2norm / high_res_l2norms["fast_" + std::to_string(domain_direction)], "", - 0.17); + testingUtilities::Check_Results(4.0, low_res_l2norm / high_res_l2norms["fast_" + std::to_string(domain_direction)], "", + 0.17); } TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, SlowMagnetosonicWaveExpectSecondOrderConvergence) @@ -442,8 +442,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, SlowMagnetosonicWaveExpectSecond double const rEigenVec_E = prefix * 3; // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, 16); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, 16); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -453,8 +453,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, SlowMagnetosonicWaveExpectSecond // Check the scaling double const low_res_l2norm = waveTest.getL2Norm(); - testingUtilities::checkResults(4.0, low_res_l2norm / high_res_l2norms["slow_" + std::to_string(domain_direction)], "", - 0.17); + testingUtilities::Check_Results(4.0, low_res_l2norm / high_res_l2norms["slow_" + std::to_string(domain_direction)], "", + 0.17); } TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, AlfvenWaveExpectSecondOrderConvergence) @@ -476,8 +476,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, AlfvenWaveExpectSecondOrderConve double const rEigenVec_E = 0; // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, 16); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, 16); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -487,8 +487,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, AlfvenWaveExpectSecondOrderConve // Check the scaling double const low_res_l2norm = waveTest.getL2Norm(); - testingUtilities::checkResults(4.0, low_res_l2norm / high_res_l2norms["alfven_" + std::to_string(domain_direction)], - "", 0.17); + testingUtilities::Check_Results(4.0, low_res_l2norm / high_res_l2norms["alfven_" + std::to_string(domain_direction)], + "", 0.17); } TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, MHDContactWaveExpectSecondOrderConvergence) @@ -511,8 +511,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, MHDContactWaveExpectSecondOrderC double const velocityX = waveSpeed; // Set the launch parameters - setLaunchParams(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, velocityX, 16); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, + rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, velocityX, 16); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -522,8 +522,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, MHDContactWaveExpectSecondOrderC // Check the scaling double const low_res_l2norm = waveTest.getL2Norm(); - testingUtilities::checkResults(4.0, low_res_l2norm / high_res_l2norms["contact_" + std::to_string(domain_direction)], - "", 0.17); + testingUtilities::Check_Results(4.0, low_res_l2norm / high_res_l2norms["contact_" + std::to_string(domain_direction)], + "", 0.17); } INSTANTIATE_TEST_SUITE_P(, tMHDSYSTEMLinearWavesParameterizedAngle, From a28041480f179404bc86abe624981bd5ea890dd9 Mon Sep 17 00:00:00 2001 From: helenarichie Date: Tue, 15 Aug 2023 11:46:57 -0400 Subject: [PATCH 09/13] run clang format --- src/system_tests/mhd_system_tests.cpp | 28 +++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/system_tests/mhd_system_tests.cpp b/src/system_tests/mhd_system_tests.cpp index a9aced3fd..f05bd9bbb 100644 --- a/src/system_tests/mhd_system_tests.cpp +++ b/src/system_tests/mhd_system_tests.cpp @@ -407,8 +407,9 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, FastMagnetosonicWaveExpectSecond double const rEigenVec_E = prefix * 9; // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, 16); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, + 16); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -418,8 +419,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, FastMagnetosonicWaveExpectSecond // Check the scaling double const low_res_l2norm = waveTest.getL2Norm(); - testingUtilities::Check_Results(4.0, low_res_l2norm / high_res_l2norms["fast_" + std::to_string(domain_direction)], "", - 0.17); + testingUtilities::Check_Results(4.0, low_res_l2norm / high_res_l2norms["fast_" + std::to_string(domain_direction)], + "", 0.17); } TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, SlowMagnetosonicWaveExpectSecondOrderConvergence) @@ -442,8 +443,9 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, SlowMagnetosonicWaveExpectSecond double const rEigenVec_E = prefix * 3; // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, 16); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, + 16); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -453,8 +455,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, SlowMagnetosonicWaveExpectSecond // Check the scaling double const low_res_l2norm = waveTest.getL2Norm(); - testingUtilities::Check_Results(4.0, low_res_l2norm / high_res_l2norms["slow_" + std::to_string(domain_direction)], "", - 0.17); + testingUtilities::Check_Results(4.0, low_res_l2norm / high_res_l2norms["slow_" + std::to_string(domain_direction)], + "", 0.17); } TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, AlfvenWaveExpectSecondOrderConvergence) @@ -476,8 +478,9 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, AlfvenWaveExpectSecondOrderConve double const rEigenVec_E = 0; // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, 16); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, 0.0, + 16); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); @@ -511,8 +514,9 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, MHDContactWaveExpectSecondOrderC double const velocityX = waveSpeed; // Set the launch parameters - Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, rEigenVec_E, - rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, velocityX, 16); + Set_Launch_Params(waveSpeed, rEigenVec_rho, rEigenVec_MomentumX, rEigenVec_MomentumY, rEigenVec_MomentumZ, + rEigenVec_E, rEigenVec_Bx, rEigenVec_By, rEigenVec_Bz, pitch, yaw, domain, domain_direction, + velocityX, 16); // Set the number of timesteps waveTest.setFiducialNumTimeSteps(numTimeSteps[domain_direction - 1]); From 59df1a59fc05018600e4a06763e13e8aa9e69f5f Mon Sep 17 00:00:00 2001 From: helenarichie Date: Tue, 15 Aug 2023 12:11:36 -0400 Subject: [PATCH 10/13] fix test data --- cholla-tests-data | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cholla-tests-data b/cholla-tests-data index 321416680..dcd73ff52 160000 --- a/cholla-tests-data +++ b/cholla-tests-data @@ -1 +1 @@ -Subproject commit 321416680f95d97b5d4ccc6f0b83a8b9ecafdaf0 +Subproject commit dcd73ff52b9027627b247c6d888bcdb56840c85e From 229438df32369e9569cd50956dd039eb6c35ad9f Mon Sep 17 00:00:00 2001 From: helenarichie Date: Fri, 22 Sep 2023 13:44:40 -0400 Subject: [PATCH 11/13] fix naming --- src/mhd/ct_electric_fields_tests.cu | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mhd/ct_electric_fields_tests.cu b/src/mhd/ct_electric_fields_tests.cu index 61e7e5002..4c94b57fc 100644 --- a/src/mhd/ct_electric_fields_tests.cu +++ b/src/mhd/ct_electric_fields_tests.cu @@ -267,7 +267,7 @@ TEST(tMHDCTSlope, CorrectInputExpectCorrectOutput) ASSERT_EQ(test_data.size(), fiducial_data.size()); for (size_t i = 0; i < test_data.size(); i++) { - testingUtilities::checkResults(fiducial_data.at(i), test_data.at(i), ""); + testingUtilities::Check_Results(fiducial_data.at(i), test_data.at(i), ""); } } // ============================================================================= From 9a1b6a9f713abd05579c77a5fc25258b862eecf9 Mon Sep 17 00:00:00 2001 From: helenarichie Date: Fri, 22 Sep 2023 15:53:03 -0400 Subject: [PATCH 12/13] run clang format --- src/mhd/ct_electric_fields_tests.cu | 4 ++-- src/mhd/magnetic_update_tests.cu | 4 ++-- src/riemann_solvers/hlld_cuda_tests.cu | 6 ++++-- src/system_tests/mhd_system_tests.cpp | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/mhd/ct_electric_fields_tests.cu b/src/mhd/ct_electric_fields_tests.cu index d461878f6..3c8dc479a 100644 --- a/src/mhd/ct_electric_fields_tests.cu +++ b/src/mhd/ct_electric_fields_tests.cu @@ -117,8 +117,8 @@ class tMHDCalculateCTElectricFields : public ::testing::Test for (size_t i = 0; i < fiducialData.size(); i++) { int xid, yid, zid; testing_utilities::Check_Results(fiducialData.at(i), testCTElectricFields.at(i), - "value at i = " + std::to_string(i) + ", xid = " + std::to_string(xid) + - ", yid = " + std::to_string(yid) + ", zid = " + std::to_string(zid)); + "value at i = " + std::to_string(i) + ", xid = " + std::to_string(xid) + + ", yid = " + std::to_string(yid) + ", zid = " + std::to_string(zid)); } } }; diff --git a/src/mhd/magnetic_update_tests.cu b/src/mhd/magnetic_update_tests.cu index 7579919bb..db47d658e 100644 --- a/src/mhd/magnetic_update_tests.cu +++ b/src/mhd/magnetic_update_tests.cu @@ -105,8 +105,8 @@ class tMHDUpdateMagneticField3D : public ::testing::Test int xid, yid, zid; cuda_utilities::compute3DIndices(i, nx, ny, xid, yid, zid); testing_utilities::Check_Results(fiducialData.at(i), destinationGrid.at(i), - "value at i = " + std::to_string(i) + ", xid = " + std::to_string(xid) + - ", yid = " + std::to_string(yid) + ", zid = " + std::to_string(zid)); + "value at i = " + std::to_string(i) + ", xid = " + std::to_string(xid) + + ", yid = " + std::to_string(yid) + ", zid = " + std::to_string(zid)); } } }; diff --git a/src/riemann_solvers/hlld_cuda_tests.cu b/src/riemann_solvers/hlld_cuda_tests.cu index 397116100..219f74739 100644 --- a/src/riemann_solvers/hlld_cuda_tests.cu +++ b/src/riemann_solvers/hlld_cuda_tests.cu @@ -1935,8 +1935,10 @@ TEST(tMHDHlldInternalApproximateStarWaveSpeed, CorrectInputExpectCorrectOutput) parameters.magneticX.at(i), 1); // Now check results - testing_utilities::Check_Results(fiducialSpeedStarL.at(i), testSpeed.LStar, parameters.names.at(i) + ", SpeedStarL"); - testing_utilities::Check_Results(fiducialSpeedStarR.at(i), testSpeed.RStar, parameters.names.at(i) + ", SpeedStarR"); + testing_utilities::Check_Results(fiducialSpeedStarL.at(i), testSpeed.LStar, + parameters.names.at(i) + ", SpeedStarL"); + testing_utilities::Check_Results(fiducialSpeedStarR.at(i), testSpeed.RStar, + parameters.names.at(i) + ", SpeedStarR"); } } // ========================================================================= diff --git a/src/system_tests/mhd_system_tests.cpp b/src/system_tests/mhd_system_tests.cpp index e2779a499..08225db4b 100644 --- a/src/system_tests/mhd_system_tests.cpp +++ b/src/system_tests/mhd_system_tests.cpp @@ -527,8 +527,8 @@ TEST_P(tMHDSYSTEMLinearWavesParameterizedAngle, MHDContactWaveExpectSecondOrderC // Check the scaling double const low_res_l2norm = waveTest.getL2Norm(); - testing_utilities::Check_Results(4.0, low_res_l2norm / high_res_l2norms["contact_" + std::to_string(domain_direction)], - "", 0.17); + testing_utilities::Check_Results( + 4.0, low_res_l2norm / high_res_l2norms["contact_" + std::to_string(domain_direction)], "", 0.17); } INSTANTIATE_TEST_SUITE_P(, tMHDSYSTEMLinearWavesParameterizedAngle, From 1c2fb8513b5f6011814014383fefb834018d3160 Mon Sep 17 00:00:00 2001 From: helenarichie Date: Fri, 22 Sep 2023 16:02:20 -0400 Subject: [PATCH 13/13] remove accidental commit --- src/reconstruction/reconstruction_tests.cu | 1 - 1 file changed, 1 deletion(-) diff --git a/src/reconstruction/reconstruction_tests.cu b/src/reconstruction/reconstruction_tests.cu index 135b40e86..8db7c5fc4 100644 --- a/src/reconstruction/reconstruction_tests.cu +++ b/src/reconstruction/reconstruction_tests.cu @@ -374,7 +374,6 @@ TEST(tALLReconstructionMonotonizeCharacteristicReturnPrimitive, CorrectInputExpe // Check results #ifdef MHD reconstruction::Primitive const fiducial_data{5046, 2934, -2526, -2828, 1441532, 0.0, -69716, 72152}; -======= testing_utilities::Check_Results(fiducial_data.density, host_results.density, "density"); testing_utilities::Check_Results(fiducial_data.velocity_x, host_results.velocity_x, "velocity_x"); testing_utilities::Check_Results(fiducial_data.velocity_y, host_results.velocity_y, "velocity_y");