HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
NavierStokes3DInitialize_GPU.c
Go to the documentation of this file.
1 
5 #include <arrayfunctions_gpu.h>
7 #include <hypar.h>
8 
11  void *s,
12  void *m
13 )
14 {
15  HyPar *solver = (HyPar*) s;
16  NavierStokes3D *physics = (NavierStokes3D*) solver->physics;
17 
18  int *dim = solver->dim_local;
19  int ghosts = solver->ghosts;
20  int d, size = 1; for (d = 0; d <_MODEL_NDIMS_; d++) size *= (dim[d] + 2*ghosts);
21 
22  gpuMalloc((void**)&physics->gpu_Q, size*_MODEL_NVARS_*sizeof(double));
23  gpuMalloc((void**)&physics->gpu_QDerivX, size*_MODEL_NVARS_*sizeof(double));
24  gpuMalloc((void**)&physics->gpu_QDerivY, size*_MODEL_NVARS_*sizeof(double));
25  gpuMalloc((void**)&physics->gpu_QDerivZ, size*_MODEL_NVARS_*sizeof(double));
26  gpuMalloc((void**)&physics->gpu_FViscous, size*_MODEL_NVARS_*sizeof(double));
27  gpuMalloc((void**)&physics->gpu_FDeriv, size*_MODEL_NVARS_*sizeof(double));
28  gpuMalloc((void**)&physics->gpu_grav_field_f, size*sizeof(double));
29  gpuMalloc((void**)&physics->gpu_grav_field_g, size*sizeof(double));
30  gpuMalloc((void**)&physics->gpu_fast_jac, _MODEL_NDIMS_*size*_MODEL_NVARS_*_MODEL_NVARS_*sizeof(double));
31  gpuMalloc((void**)&physics->gpu_solution, size*_MODEL_NVARS_*sizeof(double));
32  gpuMemset(physics->gpu_Q, 0, size*_MODEL_NVARS_*sizeof(double));
33  gpuMemset(physics->gpu_QDerivX, 0, size*_MODEL_NVARS_*sizeof(double));
34  gpuMemset(physics->gpu_QDerivY, 0, size*_MODEL_NVARS_*sizeof(double));
35  gpuMemset(physics->gpu_QDerivZ, 0, size*_MODEL_NVARS_*sizeof(double));
36  gpuMemset(physics->gpu_FViscous, 0, size*_MODEL_NVARS_*sizeof(double));
37  gpuMemset(physics->gpu_FDeriv, 0, size*_MODEL_NVARS_*sizeof(double));
38  gpuMemcpy(physics->gpu_grav_field_f, physics->grav_field_f, size*sizeof(double), gpuMemcpyHostToDevice);
39  gpuMemcpy(physics->gpu_grav_field_g, physics->grav_field_g, size*sizeof(double), gpuMemcpyHostToDevice);
40  gpuMemset(physics->gpu_fast_jac, 0, _MODEL_NDIMS_*size*_MODEL_NVARS_*_MODEL_NVARS_*sizeof(double));
41  gpuMemset(physics->gpu_solution, 0, size*_MODEL_NVARS_*sizeof(double));
42 
43  return (0);
44 }
double * gpu_QDerivX
void gpuMemset(void *, int, size_t)
Contains function definitions for common array operations on GPU.
double * gpu_QDerivY
int gpuNavierStokes3DInitialize(void *s, void *m)
double * gpu_grav_field_f
double * gpu_solution
Structure containing variables and parameters specific to the 3D Navier Stokes equations. This structure contains the physical parameters, variables, and function pointers specific to the 3D Navier-Stokes equations.
double * grav_field_g
3D Navier Stokes equations (compressible flows)
Structure containing all solver-specific variables and functions.
Definition: hypar.h:23
void gpuMalloc(void **, size_t)
#define _MODEL_NDIMS_
Definition: euler1d.h:56
Contains structure definition for hypar.
double * gpu_fast_jac
int * dim_local
Definition: hypar.h:37
void gpuMemcpy(void *, const void *, size_t, enum gpuMemcpyKind)
double * gpu_grav_field_g
void * physics
Definition: hypar.h:266
double * gpu_FViscous
int ghosts
Definition: hypar.h:52
#define _MODEL_NVARS_
Definition: euler1d.h:58
double * gpu_QDerivZ
double * gpu_FDeriv
double * grav_field_f