HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
BCInitialize.c
Go to the documentation of this file.
1 
5 #include <stdio.h>
6 #include <stdlib.h>
7 #include <string.h>
8 #include <boundaryconditions.h>
9 
12 int BCInitialize( void *b,
13  int flag_gpu )
14 {
15  DomainBoundary *boundary = (DomainBoundary*) b;
16 
17 #if defined(HAVE_CUDA)
18  if (flag_gpu) {
19 
20  if (!strcmp(boundary->bctype,_PERIODIC_)) {
21  boundary->BCFunctionU = gpuBCPeriodicU;
22  } else if (!strcmp(boundary->bctype,_SLIP_WALL_)) {
23  boundary->BCFunctionU = gpuBCSlipWallU;
24  } else {
25  fprintf(stderr,"[GPU] Error in BCInitialize(): \"%s\" is not a supported boundary condition.\n",
26  boundary->bctype);
27  return 1;
28  }
29 
30  } else {
31 #endif
32 
33  if (!strcmp(boundary->bctype,_PERIODIC_ )) boundary->BCFunctionU = BCPeriodicU;
34  else if (!strcmp(boundary->bctype,_EXTRAPOLATE_ )) boundary->BCFunctionU = BCExtrapolateU;
35  else if (!strcmp(boundary->bctype,_DIRICHLET_ )) boundary->BCFunctionU = BCDirichletU;
36  else if (!strcmp(boundary->bctype,_REFLECT_ )) boundary->BCFunctionU = BCReflectU;
37  else if (!strcmp(boundary->bctype,_SPONGE_ )) boundary->BCFunctionU = BCSpongeUDummy;
38  else if (!strcmp(boundary->bctype,_NOSLIP_WALL_ )) boundary->BCFunctionU = BCNoslipWallU;
39  else if (!strcmp(boundary->bctype,_SLIP_WALL_ )) boundary->BCFunctionU = BCSlipWallU;
40  else if (!strcmp(boundary->bctype,_THERMAL_SLIP_WALL_ )) boundary->BCFunctionU = BCThermalSlipWallU;
41  else if (!strcmp(boundary->bctype,_THERMAL_NOSLIP_WALL_ )) boundary->BCFunctionU = BCThermalNoslipWallU;
42  else if (!strcmp(boundary->bctype,_SW_SLIP_WALL_ )) boundary->BCFunctionU = BCSWSlipWallU;
43  else if (!strcmp(boundary->bctype,_SUBSONIC_OUTFLOW_ )) boundary->BCFunctionU = BCSubsonicOutflowU;
44  else if (!strcmp(boundary->bctype,_SUBSONIC_INFLOW_ )) boundary->BCFunctionU = BCSubsonicInflowU;
45  else if (!strcmp(boundary->bctype,_SUBSONIC_AMBIVALENT_ )) boundary->BCFunctionU = BCSubsonicAmbivalentU;
46  else if (!strcmp(boundary->bctype,_SUPERSONIC_OUTFLOW_ )) boundary->BCFunctionU = BCSupersonicOutflowU;
47  else if (!strcmp(boundary->bctype,_SUPERSONIC_INFLOW_ )) boundary->BCFunctionU = BCSupersonicInflowU;
48  else if (!strcmp(boundary->bctype,_TURBULENT_SUPERSONIC_INFLOW_ )) boundary->BCFunctionU = BCTurbulentSupersonicInflowU;
49  else if (!strcmp(boundary->bctype,_NO_FLUX_BC_ )) boundary->BCFunctionU = BCNoFluxU;
50  else {
51  fprintf(stderr,"Error in BCInitialize(): \"%s\" is not a supported boundary condition.\n",
52  boundary->bctype);
53  return(1);
54  }
55 
56 #if defined(HAVE_CUDA)
57  }
58 #endif
59 
60  return 0;
61 }
#define _EXTRAPOLATE_
int BCExtrapolateU(void *, void *, int, int, int *, int, double *, double)
Definition: BCExtrapolate.c:13
#define _NOSLIP_WALL_
int BCSubsonicAmbivalentU(void *, void *, int, int, int *, int, double *, double)
#define _THERMAL_SLIP_WALL_
int BCThermalSlipWallU(void *, void *, int, int, int *, int, double *, double)
int BCThermalNoslipWallU(void *, void *, int, int, int *, int, double *, double)
int BCTurbulentSupersonicInflowU(void *, void *, int, int, int *, int, double *, double)
#define _TURBULENT_SUPERSONIC_INFLOW_
int BCDirichletU(void *, void *, int, int, int *, int, double *, double)
Definition: BCDirichlet.c:13
int gpuBCSlipWallU(void *, void *, int, int, int *, int, double *, double)
int BCNoslipWallU(void *, void *, int, int, int *, int, double *, double)
Definition: BCNoslipWall.c:20
Containts the structures and definitions for boundary condition implementation.
int gpuBCPeriodicU(void *, void *, int, int, int *, int, double *, double)
#define _SLIP_WALL_
#define _REFLECT_
int(* BCFunctionU)(void *, void *, int, int, int *, int, double *, double)
int BCNoFluxU(void *, void *, int, int, int *, int, double *, double)
Definition: BCNoFlux.c:22
int BCSupersonicInflowU(void *, void *, int, int, int *, int, double *, double)
#define _SUBSONIC_OUTFLOW_
int BCSpongeUDummy(void *, void *, int, int, int *, int, double *, double)
Definition: BCSponge.c:73
int BCSubsonicInflowU(void *, void *, int, int, int *, int, double *, double)
#define _SW_SLIP_WALL_
int BCSlipWallU(void *, void *, int, int, int *, int, double *, double)
Definition: BCSlipWall.c:22
Structure containing the variables and function pointers defining a boundary.
#define _SPONGE_
char bctype[_MAX_STRING_SIZE_]
#define _SUPERSONIC_INFLOW_
#define _DIRICHLET_
int BCReflectU(void *, void *, int, int, int *, int, double *, double)
Definition: BCReflect.c:14
#define _NO_FLUX_BC_
int BCSWSlipWallU(void *, void *, int, int, int *, int, double *, double)
Definition: BCSWSlipWall.c:21
#define _SUBSONIC_INFLOW_
#define _SUBSONIC_AMBIVALENT_
int BCInitialize(void *, int)
Definition: BCInitialize.c:12
int BCSupersonicOutflowU(void *, void *, int, int, int *, int, double *, double)
int BCSubsonicOutflowU(void *, void *, int, int, int *, int, double *, double)
int BCPeriodicU(void *, void *, int, int, int *, int, double *, double)
Definition: BCPeriodic.c:19
#define _THERMAL_NOSLIP_WALL_
#define _PERIODIC_
#define _SUPERSONIC_OUTFLOW_