-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #315 from alwinm/2023-july-21
Revert minor changes so 1-D examples can run and add debug functions
- Loading branch information
Showing
14 changed files
with
630 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
...ts/input_files/tHYDROSYSTEMSodShockTube_OneDimensionalCorrectInputExpectCorrectOutput.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# | ||
# Parameter File for 1D Sod Shock tube | ||
# | ||
|
||
################################################ | ||
# number of grid cells in the x dimension | ||
nx=64 | ||
# number of grid cells in the y dimension | ||
ny=1 | ||
# number of grid cells in the z dimension | ||
nz=1 | ||
# final output time | ||
tout=0.2 | ||
# time interval for output | ||
outstep=0.2 | ||
# name of initial conditions | ||
init=Riemann | ||
# domain properties | ||
xmin=0.0 | ||
ymin=0.0 | ||
zmin=0.0 | ||
xlen=1.0 | ||
ylen=1.0 | ||
zlen=1.0 | ||
# type of boundary conditions | ||
xl_bcnd=3 | ||
xu_bcnd=3 | ||
yl_bcnd=3 | ||
yu_bcnd=3 | ||
zl_bcnd=3 | ||
zu_bcnd=3 | ||
# path to output directory | ||
outdir=./ | ||
|
||
################################################# | ||
# Parameters for 1D Riemann problems | ||
# density of left state | ||
rho_l=1.0 | ||
# velocity of left state | ||
vx_l=0.0 | ||
vy_l=0.0 | ||
vz_l=0.0 | ||
# pressure of left state | ||
P_l=1.0 | ||
# density of right state | ||
rho_r=0.1 | ||
# velocity of right state | ||
vx_r=0.0 | ||
vy_r=0.0 | ||
vz_r=0.0 | ||
# pressure of right state | ||
P_r=0.1 | ||
# location of initial discontinuity | ||
diaph=0.5 | ||
# value of gamma | ||
gamma=1.4 |
56 changes: 56 additions & 0 deletions
56
...ts/input_files/tHYDROSYSTEMSodShockTube_TwoDimensionalCorrectInputExpectCorrectOutput.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# | ||
# Parameter File for 1D Sod Shock tube | ||
# | ||
|
||
################################################ | ||
# number of grid cells in the x dimension | ||
nx=64 | ||
# number of grid cells in the y dimension | ||
ny=64 | ||
# number of grid cells in the z dimension | ||
nz=1 | ||
# final output time | ||
tout=0.2 | ||
# time interval for output | ||
outstep=0.2 | ||
# name of initial conditions | ||
init=Riemann | ||
# domain properties | ||
xmin=0.0 | ||
ymin=0.0 | ||
zmin=0.0 | ||
xlen=1.0 | ||
ylen=1.0 | ||
zlen=1.0 | ||
# type of boundary conditions | ||
xl_bcnd=3 | ||
xu_bcnd=3 | ||
yl_bcnd=3 | ||
yu_bcnd=3 | ||
zl_bcnd=3 | ||
zu_bcnd=3 | ||
# path to output directory | ||
outdir=./ | ||
|
||
################################################# | ||
# Parameters for 1D Riemann problems | ||
# density of left state | ||
rho_l=1.0 | ||
# velocity of left state | ||
vx_l=0.0 | ||
vy_l=0.0 | ||
vz_l=0.0 | ||
# pressure of left state | ||
P_l=1.0 | ||
# density of right state | ||
rho_r=0.1 | ||
# velocity of right state | ||
vx_r=0.0 | ||
vy_r=0.0 | ||
vz_r=0.0 | ||
# pressure of right state | ||
P_r=0.1 | ||
# location of initial discontinuity | ||
diaph=0.5 | ||
# value of gamma | ||
gamma=1.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#include <math.h> | ||
|
||
#include "../global/global.h" | ||
#include "../global/global_cuda.h" | ||
#include "../io/io.h" // provides chprintf | ||
#include "../utils/error_handling.h" // provides chexit | ||
|
||
__global__ void Dump_Values_Kernel(Real* device_array, int array_size, int marker) | ||
{ | ||
int tid = threadIdx.x + blockIdx.x * blockDim.x; | ||
if (tid >= array_size) { | ||
return; | ||
} | ||
kernel_printf("Dump Values: marker %d tid %d value %g \n", marker, tid, device_array[tid]); | ||
} | ||
|
||
/* | ||
Prints out all values of a device_array | ||
*/ | ||
void Dump_Values(Real* device_array, int array_size, int marker) | ||
{ | ||
int ngrid = (array_size + TPB - 1) / TPB; | ||
dim3 dim1dGrid(ngrid, 1, 1); | ||
dim3 dim1dBlock(TPB, 1, 1); | ||
hipLaunchKernelGGL(Dump_Values_Kernel, dim1dGrid, dim1dBlock, 0, 0, device_array, array_size, marker); | ||
} | ||
|
||
__global__ void Check_For_Nan_Kernel(Real* device_array, int array_size, int check_num, bool* out_bool) | ||
{ | ||
int tid = threadIdx.x + blockIdx.x * blockDim.x; | ||
if (tid >= array_size) { | ||
return; | ||
} | ||
if (device_array[tid] == device_array[tid]) { | ||
return; | ||
} | ||
out_bool[0] = true; | ||
kernel_printf("Check_For_Nan_Kernel found Nan Checknum: %d Thread: %d\n", check_num, tid); | ||
} | ||
|
||
/* | ||
Checks a device_array for NaN and prints/exits if found | ||
*/ | ||
void Check_For_Nan(Real* device_array, int array_size, int check_num) | ||
{ | ||
bool host_out_bool[1] = {false}; | ||
bool* out_bool; | ||
cudaMalloc((void**)&out_bool, sizeof(bool)); | ||
cudaMemcpy(out_bool, host_out_bool, sizeof(bool), cudaMemcpyHostToDevice); | ||
int ngrid = (array_size + TPB - 1) / TPB; | ||
dim3 dim1dGrid(ngrid, 1, 1); | ||
dim3 dim1dBlock(TPB, 1, 1); | ||
hipLaunchKernelGGL(Check_For_Nan_Kernel, dim1dGrid, dim1dBlock, 0, 0, device_array, array_size, check_num, out_bool); | ||
cudaMemcpy(host_out_bool, out_bool, sizeof(bool), cudaMemcpyDeviceToHost); | ||
cudaFree(out_bool); | ||
|
||
if (host_out_bool[0]) { | ||
chexit(-1); | ||
} | ||
} |
Oops, something went wrong.