36 *z = X+dim_g[0]+dim_g[1],
41 double xmax = body->
xmax,
54 xc = 0.5 * (xmin + xmax);
55 yc = 0.5 * (ymin + ymax);
56 zc = 0.5 * (zmin + zmax);
57 xmax = xc + fac * Lx/2;
58 xmin = xc - fac * Lx/2;
59 ymax = yc + fac * Ly/2;
60 ymin = yc - fac * Ly/2;
61 zmax = zc + fac * Lz/2;
62 zmin = zc - fac * Lz/2;
64 int imin, imax, jmin, jmax, kmin, kmax;
65 imin = dim_g[0]-1; imax = 0;
66 jmin = dim_g[1]-1; jmax = 0;
67 kmin = dim_g[2]-1; kmax = 0;
68 for (i = 0; i < dim_g[0]; i++) {
69 for (j = 0; j < dim_g[1]; j++) {
70 for (k = 0; k < dim_g[2]; k++) {
71 if ( ((x[i]-xmin)*(x[i]-xmax) < 0)
72 && ((y[j]-ymin)*(y[j]-ymax) < 0)
73 && ((z[k]-zmin)*(z[k]-zmax) < 0)) {
85 double *cof[5], *xd, *dist;
86 xd = (
double*) calloc (itr_max,
sizeof(
double));
87 dist = (
double*) calloc (itr_max,
sizeof(
double));
88 for (v = 0; v < 5; v++) cof[v] = (
double*) calloc(body->
nfacets,
sizeof(
double));
90 for (n = 0; n < body->
nfacets; n++) {
95 double den = cof[0][n]*cof[3][n] - cof[1][n]*cof[2][n];
96 if (
absolute(den) > eps) cof[4][n] = 1.0 / den;
101 for (j = jmin; j <= jmax; j++) {
102 for (k = kmin; k <= kmax; k++) {
104 for (n = 0; n < body->
nfacets; n++) {
105 if (cof[4][n] != 0) {
110 l1 = (cof[1][n]*zz - cof[3][n]*yy) * cof[4][n];
111 l2 = (cof[2][n]*yy - cof[0][n]*zz) * cof[4][n];
113 if ((l1 > -eps) && (l2 > -eps) && (l3 > -eps)){
115 dist[itr] =
absolute(x[imin]-xd[itr]);
122 fprintf(stderr,
"Error: In IBIdentyBody() - itr > %d. Recompilation of code needed.\n",itr_max);
123 fprintf(stderr,
"Increase the value of \"itr_max\" in IBIdentyBody().\n");
131 for (ii = 0; ii < itr; ii++) {
132 for (jj = ii+1; jj < itr; jj++) {
133 if (dist[jj] < dist[ii]) {
145 for (ii = 1; ii < itr-1; ii++) {
146 if (
absolute(xd[ii]-xd[ii-1]) < eps) {
147 for (jj = ii+1; jj < itr; jj++) {
149 dist[jj-1] = dist[jj];
158 for (i = imin; i <= imax; i++) {
159 if ((x[i]-xd[ii])*(x[i]-xd[ii+1]) < eps) {
164 if ( ((i-mpi->
is[0])*(i-mpi->
ie[0]) <= 0)
165 && ((j-mpi->
is[1])*(j-mpi->
ie[1]) <= 0)
166 && ((k-mpi->
is[2])*(k-mpi->
ie[2]) <= 0)) {
169 index[0] = i-mpi->
is[0];
170 index[1] = j-mpi->
is[1];
171 index[2] = k-mpi->
is[2];
178 if (ii+2 < itr-1) ii += 2;
Structure defining a body.
Structure containing variables for immersed boundary implementation.
MPI related function definitions.
Contains function definitions for common mathematical functions.
#define _ArrayIndex1D_(N, imax, i, ghost, index)
Structures and function definitions for immersed boundaries.
Structure of MPI-related variables.
int IBIdentifyBody(void *ib, int *dim_g, int *dim_l, int ghosts, void *m, double *X, double *blank)
Contains macros and function definitions for common array operations.