53 #if defined(HAVE_CUDA) && defined(CUDA_VAR_ORDERDING_AOS) 55 int gpuNavierStokes2DFlux (
double*,
double*,
int,
void*,
double);
56 int gpuNavierStokes2DSource (
double*,
double*,
void*,
void*,
double);
57 int gpuNavierStokes2DUpwindRusanov (
double*,
double*,
double*,
double*,
58 double*,
double*,
int,
void*,
double);
59 int gpuNavierStokes2DModifiedSolution (
double*,
double*,
int,
void*,
void*,
double);
60 int gpuNavierStokes2DParabolicFunction (
double*,
double*,
void*,
void*,
double);
113 static int count = 0;
116 fprintf(stderr,
"Error in NavierStokes2DInitialize(): nvars has to be %d.\n",
_MODEL_NVARS_);
120 fprintf(stderr,
"Error in NavierStokes2DInitialize(): ndims has to be %d.\n",
_MODEL_NDIMS_);
125 physics->
gamma = 1.4;
129 physics->
C1 = 1.458e-6;
143 if (!count) printf(
"Reading physical model inputs from file \"physics.inp\".\n");
144 in = fopen(
"physics.inp",
"r");
145 if (!in) printf(
"Warning: File \"physics.inp\" not found. Using default values.\n");
148 ferr = fscanf(in,
"%s",word);
if (ferr != 1)
return(1);
149 if (!strcmp(word,
"begin")){
150 while (strcmp(word,
"end")){
151 ferr = fscanf(in,
"%s",word);
if (ferr != 1)
return(1);
152 if (!strcmp(word,
"gamma")) {
153 ferr = fscanf(in,
"%lf",&physics->
gamma);
if (ferr != 1)
return(1);
154 }
else if (!strcmp(word,
"upwinding")) {
155 ferr = fscanf(in,
"%s",physics->
upw_choice);
if (ferr != 1)
return(1);
156 }
else if (!strcmp(word,
"Pr")) {
157 ferr = fscanf(in,
"%lf",&physics->
Pr);
if (ferr != 1)
return(1);
158 }
else if (!strcmp(word,
"Re")) {
159 ferr = fscanf(in,
"%lf",&physics->
Re);
if (ferr != 1)
return(1);
160 }
else if (!strcmp(word,
"Minf")) {
161 ferr = fscanf(in,
"%lf",&physics->
Minf);
if (ferr != 1)
return(1);
162 }
else if (!strcmp(word,
"gravity")) {
163 ferr = fscanf(in,
"%lf",&physics->
grav_x);
if (ferr != 1)
return(1);
164 ferr = fscanf(in,
"%lf",&physics->
grav_y);
if (ferr != 1)
return(1);
165 }
else if (!strcmp(word,
"rho_ref")) {
166 ferr = fscanf(in,
"%lf",&physics->
rho0);
if (ferr != 1)
return(1);
167 }
else if (!strcmp(word,
"p_ref")) {
168 ferr = fscanf(in,
"%lf",&physics->
p0);
if (ferr != 1)
return(1);
169 }
else if (!strcmp(word,
"HB")) {
170 ferr = fscanf(in,
"%d",&physics->
HB);
if (ferr != 1)
return(1);
171 if (physics->
HB==3) {
172 ferr = fscanf(in,
"%lf",&physics->
N_bv);
if (ferr != 1)
return(1);
174 }
else if (!strcmp(word,
"R")) {
175 ferr = fscanf(in,
"%lf",&physics->
R);
if (ferr != 1)
return(1);
176 }
else if (strcmp(word,
"end")) {
178 ferr = fscanf(in,
"%s",useless);
if (ferr != 1)
return(ferr);
179 printf(
"Warning: keyword %s in file \"physics.inp\" with value %s not ",word,useless);
180 printf(
"recognized or extraneous. Ignoring.\n");
184 fprintf(stderr,
"Error: Illegal format in file \"physics.inp\".\n");
205 physics->
Re /= physics->
Minf;
208 if ( ((physics->
grav_x != 0.0) || (physics->
grav_y != 0.0))
213 fprintf(stderr,
"Error in NavierStokes2DInitialize: %s, %s or %s upwinding is needed for flows ",
_LLF_,
_ROE_,
_RUSANOV_);
214 fprintf(stderr,
"with gravitational forces.\n");
221 fprintf(stderr,
"Error in NavierStokes2DInitialize(): Parabolic term spatial discretization must be \"%s\"\n",
_NC_2STAGE_);
226 #if defined(HAVE_CUDA) && defined(CUDA_VAR_ORDERDING_AOS) 228 solver->
FFunction = gpuNavierStokes2DFlux;
229 solver->
SFunction = gpuNavierStokes2DSource;
230 solver->
UFunction = gpuNavierStokes2DModifiedSolution;
241 #if defined(HAVE_CUDA) && defined(CUDA_VAR_ORDERDING_AOS) 245 #if defined(HAVE_CUDA) && defined(CUDA_VAR_ORDERDING_AOS) 249 fprintf(stderr,
"Error in NavierStokes2DInitialize(): Not yet implemented on GPU!");
257 fprintf(stderr,
"Error in NavierStokes2DInitialize(): %s is not implemented on GPU. ",
259 fprintf(stderr,
"Only choice is %s.\n",
_RUSANOV_);
288 fprintf(stderr,
"Error in NavierStokes2DInitialize(): %s is not a valid upwinding scheme ",
290 fprintf(stderr,
"for use with split hyperbolic flux form. Use %s, %s, %s, or %s.\n",
304 fprintf(stderr,
"Error in NavierStokes2DInitialize(): %s is not a valid upwinding scheme. ",
306 fprintf(stderr,
"Choices are %s, %s, %s, %s, and %s.\n",
_ROE_,
_RF_,
_LLF_,
_SWFS_,
_RUSANOV_);
311 #if defined(HAVE_CUDA) && defined(CUDA_VAR_ORDERDING_AOS) 323 #
if defined(HAVE_CUDA) && defined(CUDA_VAR_ORDERDING_AOS)
329 #if defined(HAVE_CUDA) && defined(CUDA_VAR_ORDERDING_AOS) 335 int ghosts = solver->
ghosts;
336 int d, size = 1;
for (d=0; d<
_MODEL_NDIMS_; d++) size *= (dim[d] + 2*ghosts);
337 physics->
grav_field_f = (
double*) calloc (size,
sizeof(
double));
338 physics->
grav_field_g = (
double*) calloc (size,
sizeof(
double));
345 #if defined(HAVE_CUDA) && defined(CUDA_VAR_ORDERDING_AOS)
int NavierStokes2DUpwinddFRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
Containts the structures and definitions for boundary condition implementation.
MPI related function definitions.
int(* ParabolicFunction)(double *, double *, void *, void *, double)
char SplitHyperbolicFlux[_MAX_STRING_SIZE_]
int NavierStokes2DUpwindFdFRusanov(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DUpwinddFLLF(double *, double *, double *, double *, double *, double *, int, void *, double)
int MPIBroadcast_integer(int *, int, int, void *)
int NavierStokes2DModifiedSolution(double *, double *, int, void *, void *, double)
int NavierStokes2DStiffJacobian(double *, double *, void *, int, int, int)
int(* AveragingFunction)(double *, double *, double *, void *)
Some basic definitions and macros.
int NavierStokes2DUpwinddFRF(double *, double *, double *, double *, double *, double *, int, void *, double)
int(* FdFFunction)(double *, double *, int, void *, double)
int(* SFunction)(double *, double *, void *, void *, double)
int NavierStokes2DRightEigenvectors(double *, double *, void *, int)
int(* Upwind)(double *, double *, double *, double *, double *, double *, int, void *, double)
Structure containing the variables and function pointers defining a boundary.
int NavierStokes2DJacobian(double *, double *, void *, int, int, int)
int MPIBroadcast_character(char *, int, int, void *)
int(* FFunction)(double *, double *, int, void *, double)
int NavierStokes2DStiffFlux(double *, double *, int, void *, double)
int MPIBroadcast_double(double *, int, int, void *)
double(* ComputeCFL)(void *, void *, double, double)
Structure containing all solver-specific variables and functions.
int NavierStokes2DSource(double *, double *, void *, void *, double)
#define _MAX_STRING_SIZE_
int NavierStokes2DUpwindFdFRF(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DUpwindRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DGravityField(void *, void *)
int NavierStokes2DUpwindFdFLLF(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DUpwindRusanov(double *, double *, double *, double *, double *, double *, int, void *, double)
Contains structure definition for hypar.
2D Navier Stokes equations (compressible flows)
int NavierStokes2DPreStep(double *, void *, void *, double)
double NavierStokes2DComputeCFL(void *, void *, double, double)
int(* PreStep)(double *, void *, void *, double)
int NavierStokes2DLeftEigenvectors(double *, double *, void *, int)
char upw_choice[_MAX_STRING_SIZE_]
int(* UpwindFdF)(double *, double *, double *, double *, double *, double *, int, void *, double)
char spatial_type_par[_MAX_STRING_SIZE_]
Structure containing variables and parameters specific to the 2D Navier Stokes equations. This structure contains the physical parameters, variables, and function pointers specific to the 2D Navier-Stokes equations.
int NavierStokes2DUpwindSWFS(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DUpwindLLF(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DUpwinddFRusanov(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DUpwindFdFRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DNonStiffFlux(double *, double *, int, void *, double)
int NavierStokes2DUpwindRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
int(* dFFunction)(double *, double *, int, void *, double)
int(* JFunction)(double *, double *, void *, int, int, int)
int NavierStokes2DUpwindRF(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DParabolicFunction(double *, double *, void *, void *, double)
int(* UpwinddF)(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DFlux(double *, double *, int, void *, double)
Structure of MPI-related variables.
int gpuNavierStokes2DInitialize(void *s, void *m)
int NavierStokes2DUpwindFdFRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes2DRoeAverage(double *, double *, double *, void *)
int NavierStokes2DUpwinddFRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
Contains macros and function definitions for common array operations.
int(* GetRightEigenvectors)(double *, double *, void *, int)
int(* GetLeftEigenvectors)(double *, double *, void *, int)
int(* UFunction)(double *, double *, int, void *, void *, double)
int NavierStokes2DInitialize(void *s, void *m)