29 for (n = 0; n < nsims; n++) {
37 int stat, d, ndims = solver->
ndims;
48 fprintf(stderr,
"Error in InitializeImmersedBoundaries(): Unable to ");
49 fprintf(stderr,
"read immersed body from file %s.\n",solver->
ib_filename);
65 int offset_global, offset_local,
69 size = dim_global[0] + dim_global[1] + dim_global[2],
71 double *Xg = (
double*) calloc(size,
sizeof(
double));
74 offset_global = offset_local = 0;
75 for (d=0; d<ndims; d++) {
77 &solver->
x[offset_local+ghosts],
79 offset_global += dim_global[d];
80 offset_local += dim_local [d] + 2*ghosts;
89 int count_inside_body = 0;
98 int indexb[ndims], indexi[ndims], bounds[ndims], offset[ndims];
99 for (d = 0; d < ndims; d++) {
106 _ArrayCopy1D_(indexb,indexi,ndims); indexi[d] = ghosts-1-indexb[d];
114 if (mpi->
ip[d] == mpi->
iproc[d]-1) {
119 _ArrayCopy1D_(indexb,indexi,ndims); indexi[d] = dim_local[d]-1-indexb[d];
130 int count_boundary_points = 0;
135 double ld = 0, xmin, xmax, ymin, ymax, zmin, zmax;
142 double xlen = xmax - xmin;
143 double ylen = ymax - ymin;
144 double zlen = zmax - zmin;
145 ld =
max3(xlen,ylen,zlen);
148 fprintf(stderr,
"Error in InitializeImmersedBoundaries():\n");
149 fprintf(stderr,
" IBNearestFacetNormal() returned with error code %d on rank %d.\n",
158 fprintf(stderr,
"Error in InitializeImmersedBoundaries():\n");
159 fprintf(stderr,
" IBInterpCoeffs() returned with error code %d on rank %d.\n",
167 fprintf(stderr,
"Error in InitializeImmersedBoundaries():\n");
168 fprintf(stderr,
" IBCreateFacetMapping() returned with error code %d on rank %d.\n",
176 printf(
"Immersed body read from %s:\n",solver->
ib_filename);
177 if (nsims > 1) printf(
"For domain %d,\n", n);
178 printf(
" Number of facets: %d\n Bounding box: [%3.1f,%3.1lf] X [%3.1f,%3.1lf] X [%3.1f,%3.1lf]\n",
180 percentage = ((double)count_inside_body)/((double)solver->
npoints_global)*100.0;
181 printf(
" Number of grid points inside immersed body: %d (%4.1f%%).\n",count_inside_body,percentage);
182 percentage = ((double)count_boundary_points)/((double)solver->
npoints_global)*100.0;
183 printf(
" Number of immersed boundary points : %d (%4.1f%%).\n",count_boundary_points,percentage);
184 printf(
" Immersed body simulation mode : %s.\n", ib->
mode);
int IBIdentifyMode(double *, int *, void *)
char ib_filename[_MAX_STRING_SIZE_]
Structure defining a body.
Structure containing variables for immersed boundary implementation.
MPI related function definitions.
Contains function definitions for common mathematical functions.
Structure defining a simulation.
int IBNearestFacetNormal(void *, void *, double *, double, int *, int)
int MPIExchangeBoundariesnD(int, int, int *, int, void *, double *)
int IBCreateFacetMapping(void *, void *, double *, int *, int)
int MPISum_integer(int *, int *, int, void *)
int MPIBroadcast_double(double *, int, int, void *)
Structure containing all solver-specific variables and functions.
int MPIGatherArray1D(void *, double *, double *, int, int, int, int)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArraySetValue_(x, size, value)
int IBReadBodySTL(Body3D **, char *, void *, int *)
int IBIdentifyBody(void *, int *, int *, int, void *, double *, double *)
#define _ArrayIncrementIndex_(N, imax, i, done)
int IBComputeBoundingBox(Body3D *)
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Structures and function definitions for immersed boundaries.
int InitializeImmersedBoundaries(void *s, int nsims)
Structure of MPI-related variables.
char mode[_MAX_STRING_SIZE_]
int IBInterpCoeffs(void *, void *, double *, int *, int, double *)
Function declarations for file I/O functions.
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.
int IBIdentifyBoundary(void *, void *, int *, int, double *)