20 return ((x >= a) && (x <= b));
51 int i, j, k, ic, jc, kc;
54 double xmin = 0.5 * (x[ghosts-1] + x[ghosts]),
55 xmax = 0.5 * (x[dim[0]+ghosts-1] + x[dim[0]+ghosts]),
56 ymin = 0.5 * (y[ghosts-1] + y[ghosts]),
57 ymax = 0.5 * (y[dim[1]+ghosts-1] + y[dim[1]+ghosts]),
58 zmin = 0.5 * (z[ghosts-1] + z[ghosts]),
59 zmax = 0.5 * (z[dim[2]+ghosts-1] + z[dim[2]+ghosts]);
61 for (i = 0; i < dim[0]+2*ghosts-1; i++) {
67 if (ic <= ghosts-1) ic = ghosts;
68 else if (ic >= dim[0]+ghosts-1) ic = dim[0]+ghosts-2;
70 for (j = 0; j < dim[1]+2*ghosts-1; j++) {
76 if (jc <= ghosts-1) jc = ghosts;
77 else if (jc >= dim[1]+ghosts-1) jc = dim[1]+ghosts-2;
79 for (k = 0; k < dim[2]+2*ghosts-1; k++) {
85 if (kc <= ghosts-1) kc = ghosts;
86 else if (kc >= dim[2]+ghosts-1) kc = dim[2]+ghosts-2;
88 if (!strcmp(mode,
_IB_XY_)) { kc = ghosts; zc = 0.5*(zmin+zmax); }
89 else if (!strcmp(mode,
_IB_XZ_)) { jc = ghosts; yc = 0.5*(ymin+ymax); }
90 else if (!strcmp(mode,
_IB_YZ_)) { ic = ghosts; xc = 0.5*(xmin+xmax); }
93 fprintf(stderr,
"Error in interpNodesCoeffs() (in ImmersedBoundaries/IBCreateFacetMapping.c) on rank %d: ic = -1.\n", mpi->
rank);
97 fprintf(stderr,
"Error in interpNodesCoeffs() (in ImmersedBoundaries/IBCreateFacetMapping.c) on rank %d: jc = -1.\n", mpi->
rank);
101 fprintf(stderr,
"Error in interpNodesCoeffs() (in ImmersedBoundaries/IBCreateFacetMapping.c) on rank %d: kc = -1.\n", mpi->
rank);
113 index[0]=ic-1-ghosts; index[1]=jc-1-ghosts; index[2]=kc-1-ghosts;
_ArrayIndex1D_(
_IB_NDIMS_,dim,index,ghosts,pc[0]);
154 int nfacets = body->
nfacets, n, count, ierr;
158 *y = (x + dim[0] + 2*ghosts),
159 *z = (y + dim[1] + 2*ghosts);
161 double xmin = 0.5 * (x[ghosts-1] + x[ghosts]),
162 xmax = 0.5 * (x[dim[0]+ghosts-1] + x[dim[0]+ghosts]),
163 ymin = 0.5 * (y[ghosts-1] + y[ghosts]),
164 ymax = 0.5 * (y[dim[1]+ghosts-1] + y[dim[1]+ghosts]),
165 zmin = 0.5 * (z[ghosts-1] + z[ghosts]),
166 zmax = 0.5 * (z[dim[2]+ghosts-1] + z[dim[2]+ghosts]);
169 for (n = 0; n < nfacets; n++) {
173 xc = (facets[n].
x1 + facets[n].
x2 + facets[n].
x3) / 3.0;
174 yc = (facets[n].
y1 + facets[n].
y2 + facets[n].
y3) / 3.0;
175 zc = (facets[n].
z1 + facets[n].
z2 + facets[n].
z3) / 3.0;
188 int nfacets_local = count;
189 if (nfacets_local > 0) {
194 for (n = 0; n < nfacets; n++) {
197 xc = (facets[n].
x1 + facets[n].
x2 + facets[n].
x3) / 3.0;
198 yc = (facets[n].
y1 + facets[n].
y2 + facets[n].
y3) / 3.0;
199 zc = (facets[n].
z1 + facets[n].
z2 + facets[n].
z3) / 3.0;
213 fmap[count].
facet = facets + n;
214 fmap[count].
index = n;
232 fprintf(stderr,
"Error in IBCreateFacetMapping(): \n");
233 fprintf(stderr,
" interpNodesCoeffs() returned with error code %d on rank %d.\n",
238 double dx = x[ic] - x[ic-1];
239 double dy = y[jc] - y[jc-1];
240 double dz = z[kc] - z[kc-1];
245 else ds =
min3(dx,dy,dz);
247 double nx = fmap[count].
facet->
nx;
248 double ny = fmap[count].
facet->
ny;
249 double nz = fmap[count].
facet->
nz;
251 if (nx == 0.0) nx += IB->
delta*ds;
252 if (ny == 0.0) ny += IB->
delta*ds;
253 if (nz == 0.0) nz += IB->
delta*ds;
255 double xns = xc +
sign(nx)*ds;
256 double yns = yc +
sign(ny)*ds;
257 double zns = zc +
sign(nz)*ds;
259 fmap[count].
dx = xns - xc;
260 fmap[count].
dy = yns - yc;
261 fmap[count].
dz = zns - zc;
273 fprintf(stderr,
"Error in IBCreateFacetMapping(): \n");
274 fprintf(stderr,
" interpNodesCoeffs() returned with error code %d on rank %d.\n",
double interp_coeffs[_IB_NNODES_]
static int isInside(double x, double a, double b)
Structure defining a facet.
Structure defining a facet map.
Structure defining a body.
Structure containing variables for immersed boundary implementation.
MPI related function definitions.
Contains function definitions for common mathematical functions.
double interp_coeffs_ns[_IB_NNODES_]
int interp_nodes[_IB_NNODES_]
void TrilinearInterpCoeffs(double, double, double, double, double, double, double, double, double, double *)
#define _ArrayIndex1D_(N, imax, i, ghost, index)
Structures and function definitions for immersed boundaries.
static int interpNodesCoeffs(void *m, double xc, double yc, double zc, double *x, double *y, double *z, int *dim, int ghosts, char *mode, int *ii, int *jj, int *kk, int *inodes, double *icoeffs)
int interp_nodes_ns[_IB_NNODES_]
Structure of MPI-related variables.
char mode[_MAX_STRING_SIZE_]
#define _ArrayCopy1D_(x, y, size)
Contains macros and function definitions for common array operations.
int IBCreateFacetMapping(void *ib, void *m, double *X, int *dim, int ghosts)