52 #if defined(HAVE_CUDA) 125 static int count = 0;
128 fprintf(stderr,
"Error in NavierStokes3DInitialize(): nvars has to be %d.\n",
_MODEL_NVARS_);
132 fprintf(stderr,
"Error in NavierStokes3DInitialize(): ndims has to be %d.\n",
_MODEL_NDIMS_);
137 physics->
gamma = 1.4;
141 physics->
C1 = 1.458e-6;
163 if (!count) printf(
"Reading physical model inputs from file \"physics.inp\".\n");
164 in = fopen(
"physics.inp",
"r");
165 if (!in) printf(
"Warning: File \"physics.inp\" not found. Using default values.\n");
168 ferr = fscanf(in,
"%s",word);
170 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
173 if (!strcmp(word,
"begin")){
174 while (strcmp(word,
"end")){
175 ferr = fscanf(in,
"%s",word);
177 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
180 if (!strcmp(word,
"gamma")) {
181 ferr = fscanf(in,
"%lf",&physics->
gamma);
183 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
186 }
else if (!strcmp(word,
"upwinding")) {
189 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
192 }
else if (!strcmp(word,
"Pr")) {
193 ferr = fscanf(in,
"%lf",&physics->
Pr);
195 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
198 }
else if (!strcmp(word,
"Re")) {
199 ferr = fscanf(in,
"%lf",&physics->
Re);
201 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
204 }
else if (!strcmp(word,
"Minf")) {
205 ferr = fscanf(in,
"%lf",&physics->
Minf);
207 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
210 }
else if (!strcmp(word,
"gravity")) {
211 ferr = fscanf(in,
"%lf",&physics->
grav_x);
213 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
216 ferr = fscanf(in,
"%lf",&physics->
grav_y);
218 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
221 ferr = fscanf(in,
"%lf",&physics->
grav_z);
223 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
226 }
else if (!strcmp(word,
"rho_ref")) {
227 ferr = fscanf(in,
"%lf",&physics->
rho0);
229 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
232 }
else if (!strcmp(word,
"p_ref")) {
233 ferr = fscanf(in,
"%lf",&physics->
p0);
235 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
238 }
else if (!strcmp(word,
"HB")) {
239 ferr = fscanf(in,
"%d",&physics->
HB);
241 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
244 if (physics->
HB==3) {
245 ferr = fscanf(in,
"%lf",&physics->
N_bv);
247 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
251 }
else if (!strcmp(word,
"R")) {
252 ferr = fscanf(in,
"%lf",&physics->
R);
254 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
257 }
else if (!strcmp(word,
"ib_surface_data")) {
260 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
263 }
else if (!strcmp(word,
"ib_wall_type")) {
266 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
270 ferr = fscanf(in,
"%lf",&physics->
T_ib_wall);
272 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
277 printf(
"Warning: in NavierStokes3DInitialize().\n");
278 printf(
"Warning: no immersed body present; specification of ib_wall_type unnecessary.\n");
280 }
else if (!strcmp(word,
"ib_ramp_time")) {
281 ferr = fscanf(in,
"%lf",&physics->
t_ib_ramp);
283 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
287 printf(
"Warning: in NavierStokes3DInitialize().\n");
288 printf(
"Warning: no immersed body present; specification of ib_ramp_time unnecessary.\n");
290 }
else if (!strcmp(word,
"ib_ramp_width")) {
293 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
297 printf(
"Warning: in NavierStokes3DInitialize().\n");
298 printf(
"Warning: no immersed body present; specification of ib_ramp_width unnecessary.\n");
300 }
else if (!strcmp(word,
"ib_ramp_type")) {
303 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
307 printf(
"Warning: in NavierStokes3DInitialize().\n");
308 printf(
"Warning: no immersed body present; specification of ib_ramp_type unnecessary.\n");
310 }
else if (!strcmp(word,
"ib_T_tolerance")) {
311 ferr = fscanf(in,
"%lf",&physics->
ib_T_tol);
313 fprintf(stderr,
"Read error while reading physics.inp in NavierStokes3DInitialize().\n");
317 printf(
"Warning: in NavierStokes3DInitialize().\n");
318 printf(
"Warning: no immersed body present; specification of ib_T_tolerance unnecessary.\n");
320 }
else if (strcmp(word,
"end")) {
322 ferr = fscanf(in,
"%s",useless);
if (ferr != 1)
return(ferr);
323 printf(
"Warning: keyword %s in file \"physics.inp\" with value %s not ",word,useless);
324 printf(
"recognized or extraneous. Ignoring.\n");
328 fprintf(stderr,
"Error: Illegal format in file \"physics.inp\".\n");
360 printf(
"Warning from NavierStokes3DInitialize(): solver->op_file_format is set to \"none\", thus ");
361 printf(
"setting physics->ib_write_surface_data to \"no\" (no solution files will be written).\n");
368 physics->
Re /= physics->
Minf;
371 if ( ((physics->
grav_x != 0.0) || (physics->
grav_y != 0.0) || (physics->
grav_z != 0.0) )
374 fprintf(stderr,
"Error in NavierStokes3DInitialize: %s upwinding is needed for flows ",
_RUSANOV_);
375 fprintf(stderr,
"with gravitational forces.\n");
382 fprintf(stderr,
"Error in NavierStokes3DInitialize(): Parabolic term spatial discretization must be \"%s\"\n",
_NC_2STAGE_);
388 #if defined(HAVE_CUDA) 404 #if defined(HAVE_CUDA) 414 fprintf(stderr,
"Error in NavierStokes3DInitialize()\n");
415 fprintf(stderr,
" invalid value for IB wall type (%s).\n",
423 #if defined(HAVE_CUDA) 428 fprintf(stderr,
"Error in NavierStokes3DInitialize(): Not available on GPU!");
439 fprintf(stderr,
"Error in NavierStokes3DInitialize(): %s is not a valid upwinding scheme on GPU. ",
464 fprintf(stderr,
"Error in NavierStokes3DInitialize(): %s is not a valid upwinding scheme ",
466 fprintf(stderr,
"for use with split hyperbolic flux form. Use %s or %s.\n",
479 fprintf(stderr,
"Error in NavierStokes3DInitialize(): %s is not a valid upwinding scheme. ",
487 #if defined(HAVE_CUDA) 499 #
if defined(HAVE_CUDA)
505 #if defined(HAVE_CUDA) 511 int ghosts = solver->
ghosts;
512 int d, size = 1;
for (d=0; d<
_MODEL_NDIMS_; d++) size *= (dim[d] + 2*ghosts);
513 physics->
grav_field_f = (
double*) calloc (size,
sizeof(
double));
514 physics->
grav_field_g = (
double*) calloc (size,
sizeof(
double));
521 #if defined(HAVE_CUDA) int NavierStokes3DGravityField(void *, void *)
int gpuNavierStokes3DUpwindRusanov(double *, double *, double *, double *, double *, double *, int, void *, double)
int(* PhysicsOutput)(void *, void *, double)
int NavierStokes3DRightEigenvectors(double *, double *, void *, int)
Containts the structures and definitions for boundary condition implementation.
int gpuNavierStokes3DParabolicFunction(double *, double *, void *, void *, double)
MPI related function definitions.
int(* ParabolicFunction)(double *, double *, void *, void *, double)
char SplitHyperbolicFlux[_MAX_STRING_SIZE_]
int gpuNavierStokes3DInitialize(void *, void *)
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.
int NavierStokes3DUpwinddFRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
int MPIBroadcast_integer(int *, int, int, void *)
int NavierStokes3DRoeAverage(double *, double *, double *, void *)
int gpuNavierStokes3DUpwindRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes3DUpwinddFRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
int(* AveragingFunction)(double *, double *, double *, void *)
Some basic definitions and macros.
int NavierStokes3DStiffFlux(double *, double *, int, void *, double)
char ib_ramp_type[_MAX_STRING_SIZE_]
int(* FdFFunction)(double *, double *, int, void *, double)
int(* SFunction)(double *, double *, void *, void *, double)
int(* IBFunction)(void *, void *, double *, double)
int(* Upwind)(double *, double *, double *, double *, double *, double *, int, void *, double)
Structure containing the variables and function pointers defining a boundary.
3D Navier Stokes equations (compressible flows)
int NavierStokes3DUpwindFdFRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes3DJacobian(double *, double *, void *, int, int, int)
int MPIBroadcast_character(char *, int, int, void *)
int NavierStokes3DUpwindFdFRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
int gpuNavierStokes3DPreStep(double *, void *, void *, double)
int NavierStokes3DIBForces(void *, void *, double)
int(* FFunction)(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 NavierStokes3DLeftEigenvectors(double *, double *, void *, int)
#define _MAX_STRING_SIZE_
double NavierStokes3DComputeCFL(void *, void *, double, double)
int gpuNavierStokes3DFlux(double *, double *, int, void *, double)
int NavierStokes3DUpwindRoe(double *, double *, double *, double *, double *, double *, int, void *, double)
int NavierStokes3DNonStiffFlux(double *, double *, int, void *, double)
int NavierStokes3DStiffJacobian(double *, double *, void *, int, int, int)
int NavierStokes3DPreStep(double *, void *, void *, double)
int NavierStokes3DFlux(double *, double *, int, void *, double)
Contains structure definition for hypar.
int NavierStokes3DParabolicFunction(double *, double *, void *, void *, double)
int NavierStokes3DSource(double *, double *, void *, void *, double)
char upw_choice[_MAX_STRING_SIZE_]
int NavierStokes3DInitialize(void *s, void *m)
int(* PreStep)(double *, void *, void *, double)
int NavierStokes3DUpwindRusanovModified(double *, double *, double *, double *, double *, double *, int, void *, double)
int(* UpwindFdF)(double *, double *, double *, double *, double *, double *, int, void *, double)
char spatial_type_par[_MAX_STRING_SIZE_]
int NavierStokes3DIBIsothermal(void *, void *, double *, double)
int(* dFFunction)(double *, double *, int, void *, double)
char ib_write_surface_data[_MAX_STRING_SIZE_]
int NavierStokes3DUpwindRF(double *, double *, double *, double *, double *, double *, int, void *, double)
int(* JFunction)(double *, double *, void *, int, int, int)
int NavierStokes3DModifiedSolution(double *, double *, int, void *, void *, double)
int(* UpwinddF)(double *, double *, double *, double *, double *, double *, int, void *, double)
Structure of MPI-related variables.
char ib_wall_type[_MAX_STRING_SIZE_]
int NavierStokes3DUpwindRusanov(double *, double *, double *, double *, double *, double *, int, void *, double)
char op_file_format[_MAX_STRING_SIZE_]
Contains macros and function definitions for common array operations.
int NavierStokes3DIBAdiabatic(void *, void *, double *, double)
int(* GetRightEigenvectors)(double *, double *, void *, int)
int gpuNavierStokes3DModifiedSolution(double *, double *, int, void *, void *, double)
int(* GetLeftEigenvectors)(double *, double *, void *, int)
int gpuNavierStokes3DSource(double *, double *, void *, void *, double)
int NavierStokes3DUpwindLLF(double *, double *, double *, double *, double *, double *, int, void *, double)
int(* UFunction)(double *, double *, int, void *, void *, double)