HyPar  1.0
Finite-Difference Hyperbolic-Parabolic PDE Solver on Cartesian Grids
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
IBIdentifyMode.c File Reference

Identify 2D/3D mode for immersed body simulations. More...

#include <string.h>
#include <immersedboundaries.h>

Go to the source code of this file.

Functions

int IBIdentifyMode (double *X, int *dim, void *ib)
 

Detailed Description

Identify 2D/3D mode for immersed body simulations.

Author
Debojyoti Ghosh

Definition in file IBIdentifyMode.c.

Function Documentation

int IBIdentifyMode ( double *  X,
int *  dim,
void *  ib 
)

Identify the "mode", i.e., whether the simulation is a true 3D simulation, or a 2D simulation being run in 3D. If extent of the immersed body is larger than the grid along a particular axis (say, x), then we assume that the intention is to simulate a 2D case around a 2D body in the plane normal to that axis ( y-z plane ).

For example, to simulate a 2D cylinder in the x-y plane, we consider a cylinder whose extent along z is larger than the extent of the grid along z, i.e., it sticks out of the computational domain at both ends.

If the immersed body is completely contained within the computational domain, or sticks out only on one end along a particular dimension, we assume it's a 3D simulation.

Parameters
XArray of global spatial coordinates
dimglobal dimensions
ibImmersed boundary object of type ImmersedBoundary

Definition at line 24 of file IBIdentifyMode.c.

29 {
31  Body3D *body = IB->body;
32 
33  double *x = X, *y = x + dim[0], *z = y + dim[1];
34 
35  double grid_xmin = x[0],
36  grid_xmax = x[dim[0]-1],
37  grid_ymin = y[0],
38  grid_ymax = y[dim[1]-1],
39  grid_zmin = z[0],
40  grid_zmax = z[dim[2]-1];
41 
42  if ( (grid_xmin > body->xmin) && (grid_xmax < body->xmax) ) strcpy(IB->mode,_IB_YZ_);
43  else if ( (grid_ymin > body->ymin) && (grid_ymax < body->ymax) ) strcpy(IB->mode,_IB_XZ_);
44  else if ( (grid_zmin > body->zmin) && (grid_zmax < body->zmax) ) strcpy(IB->mode,_IB_XY_);
45  else strcpy(IB->mode,_IB_3D_);
46 
47  return(0);
48 }
Structure containing variables for immersed boundary implementation.
Structure defining a body.
#define _IB_YZ_
char mode[_MAX_STRING_SIZE_]
#define _IB_3D_
#define _IB_XZ_
#define _IB_XY_