Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Revert minor changes so 1-D examples can run and add debug functions #315

Merged
merged 16 commits into from
Aug 8, 2023
Merged
Prev Previous commit
Next Next commit
Move check for boundary conditions type
This previously was checked on every single time step. Now it is checked
once at the beginning in the `Check_Configuration` function.
bcaddy committed Aug 8, 2023
commit 297225bd5c6d786d278ac652adf14a8c5901a5bd
9 changes: 0 additions & 9 deletions src/grid/boundary_conditions.cpp
Original file line number Diff line number Diff line change
@@ -151,15 +151,6 @@ int Grid3D::Check_Custom_Boundary(int *flags, struct parameters P)
}

for (int i = 0; i < 6; i++) {
/* Alwin: I am disabling this check because it is needlessly occurring every timestep.
if (flags[i] < 1 or flags[i] > 5) {
chprintf(
"WARNING: Possibly invalid boundary conditions for direction: %d flag: %d. Must select between 1 (periodic), "
"2 "
"(reflective), 3 (transmissive), 4 (custom), 5 (mpi).\n",
i, flags[i]);
}
*/
if (flags[i] == 4) {
/*custom boundaries*/
return 1;
14 changes: 14 additions & 0 deletions src/utils/error_handling.cpp
Original file line number Diff line number Diff line change
@@ -54,6 +54,20 @@ void Check_Configuration(parameters const &P)
#error "Only one integrator can be enabled at a time."
#endif // Only one integrator check

// Check the boundary conditions
auto Check_Boundary = [](int const &boundary) {
bool is_allowed_bc = boundary >= 0 and boundary <= 4;
assert(is_allowed_bc &&
"WARNING: Possibly invalid boundary conditions for direction: %d flag: %d. Must select between (periodic), "
"2 (reflective), 3 (transmissive), 4 (custom), 5 (mpi).\n");
};
Check_Boundary(P.xl_bcnd);
Check_Boundary(P.xu_bcnd);
Check_Boundary(P.yl_bcnd);
Check_Boundary(P.yu_bcnd);
Check_Boundary(P.zl_bcnd);
Check_Boundary(P.zu_bcnd);

// warn if error checking is disabled
#ifndef CUDA_ERROR_CHECK
#warning "CUDA error checking is disabled. Enable it with the CUDA_ERROR_CHECK macro"