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);
char ib_filename[_MAX_STRING_SIZE_]
int MPISum_integer(int *, int *, int, void *)
#define _ArraySetValue_(x, size, value)
int IBInterpCoeffs(void *, void *, double *, int *, int, double *)
int IBComputeBoundingBox(Body3D *)
int IBCreateFacetMapping(void *, void *, double *, int *, int)
int IBIdentifyBoundary(void *, void *, int *, int, double *)
Structure containing variables for immersed boundary implementation.
Structure defining a body.
int MPIBroadcast_double(double *, int, int, void *)
Structures and function definitions for immersed boundaries.
int IBIdentifyBody(void *, int *, int *, int, void *, double *, double *)
#define _ArrayIncrementIndex_(N, imax, i, done)
int MPIGatherArray1D(void *, double *, double *, int, int, int, int)
int InitializeImmersedBoundaries(void *, int)
MPI related function definitions.
char mode[_MAX_STRING_SIZE_]
#define _GetCoordinate_(dir, i, dim, ghosts, x, coord)
Function declarations for file I/O functions.
#define _ArrayIndex1D_(N, imax, i, ghost, index)
int IBReadBodySTL(Body3D **, char *, void *, int *)
Contains function definitions for common mathematical functions.
#define _ArrayIndex1DWO_(N, imax, i, offset, ghost, index)
#define _ArrayCopy1D_(x, y, size)
int IBNearestFacetNormal(void *, void *, double *, double, int *, int)
Structure defining a simulation.
Contains macros and function definitions for common array operations.
int MPIExchangeBoundariesnD(int, int, int *, int, void *, double *)
Structure of MPI-related variables.
Structure containing all solver-specific variables and functions.
int IBIdentifyMode(double *, int *, void *)