20 printf(
" \n Converting 3d nodes coordinates to 2d xy parallel plane \n");
24 float nve[3] = {0, 0, 0};
25 float angle, anglecos, anglesin;
28 for (j = 0; j <
nfract; j++) {
31 for (l = 0; l < 3; l++) {
41 anglecos = cos(angle);
42 anglesin = sin(angle);
47 norm = sqrt(nve[0] * nve[0] + nve[1] * nve[1] + nve[2] * nve[2]);
48 nve[0] = nve[0] / norm;
49 nve[1] = nve[1] / norm;
50 nve[2] = nve[2] / norm;
53 fracture[j].
rot2mat[0][0] = nve[0] * nve[0] * (1 - anglecos) + anglecos;
54 fracture[j].
rot2mat[0][1] = nve[0] * nve[1] * (1 - anglecos) - nve[2] * anglesin;
55 fracture[j].
rot2mat[0][2] = nve[0] * nve[2] * (1 - anglecos) + nve[1] * anglesin;
56 fracture[j].
rot2mat[1][0] = nve[0] * nve[1] * (1 - anglecos) + nve[2] * anglesin;
57 fracture[j].
rot2mat[1][1] = nve[1] * nve[1] * (1 - anglecos) + anglecos;
58 fracture[j].
rot2mat[1][2] = nve[1] * nve[2] * (1 - anglecos) - nve[0] * anglesin;
59 fracture[j].
rot2mat[2][0] = nve[0] * nve[2] * (1 - anglecos) - nve[1] * anglesin;
60 fracture[j].
rot2mat[2][1] = nve[1] * nve[2] * (1 - anglecos) + nve[0] * anglesin;
61 fracture[j].
rot2mat[2][2] = nve[2] * nve[2] * (1 - anglecos) + anglecos;
66 for (i = 0; i <
nnodes; i++) {
105 float nve[3] = {0, 0, 0};
106 float angle, anglecos, anglesin;
108 for (j = 0; j <
nfract; j++) {
112 anglecos = cos(angle);
113 anglesin = sin(angle);
118 norm = sqrt(nve[0] * nve[0] + nve[1] * nve[1] + nve[2] * nve[2]);
119 nve[0] = nve[0] / norm;
120 nve[1] = nve[1] / norm;
121 nve[2] = nve[2] / norm;
123 fracture[j].
rot3mat[0][0] = nve[0] * nve[0] * (1 - anglecos) + anglecos;
124 fracture[j].
rot3mat[0][1] = nve[0] * nve[1] * (1 - anglecos) - nve[2] * anglesin;
125 fracture[j].
rot3mat[0][2] = nve[0] * nve[2] * (1 - anglecos) + nve[1] * anglesin;
126 fracture[j].
rot3mat[1][0] = nve[0] * nve[1] * (1 - anglecos) + nve[2] * anglesin;
127 fracture[j].
rot3mat[1][1] = nve[1] * nve[1] * (1 - anglecos) + anglecos;
128 fracture[j].
rot3mat[1][2] = nve[1] * nve[2] * (1 - anglecos) - nve[0] * anglesin;
129 fracture[j].
rot3mat[2][0] = nve[0] * nve[2] * (1 - anglecos) - nve[1] * anglesin;
130 fracture[j].
rot3mat[2][1] = nve[1] * nve[2] * (1 - anglecos) + nve[0] * anglesin;
131 fracture[j].
rot3mat[2][2] = nve[2] * nve[2] * (1 - anglecos) + anglecos;
142 struct posit3d particle3dposit;
165 double thirdcoord = 0.0;
166 struct posit3d particle3dposit;
185 return particle3dposit;
194 sprintf(filename,
"%s/Velocity3D",
maindir);
195 FILE *w3 =
OpenFile (filename,
"w");
196 printf(
"\n Output flow field: Darcy velocities on nodes in 3D \n");
197 fprintf(w3,
" node ID number; X-, Y-, Z- node's location; Vx, Vy, Vz of velocity, control cell volume, fracture number \n");
198 double cord3[3] = {0, 0, 0};
199 unsigned int i, j, v;
202 for (i = 0; i <
nnodes; i++) {
205 if ((
node[i].typeN != 2) && (
node[i].typeN != 12)) {
217 fprintf(w3,
" %05d %5.8e %5.8e %5.8e %5.8e %5.8e %5.8e %5.8e %d\n", i + 1,
node[i].coord[0],
node[i].coord[1],
node[i].coord[2],
cord3[0],
cord3[1],
cord3[2],
node[i].pvolume,
node[i].
fracture[0]);
219 for (v = 0; v < 2; v++) {
231 fprintf(w3,
" %05d %5.8e %5.8e %5.8e %5.8e %5.8e %5.8e %5.8e %d\n", i + 1,
node[i].coord[0],
node[i].coord[1],
node[i].coord[2],
cord3[0],
cord3[1],
cord3[2],
node[i].pvolume,
node[i].
fracture[0] );
238 for (v = 2; v < 4; v++) {
250 fprintf(w3,
" %05d %5.8e %5.8e %5.8e %5.8e %5.8e %5.8e %5.8e %d\n", i + 1,
node[i].coord[0],
node[i].coord[1],
node[i].coord[2],
cord3[0],
cord3[1],
cord3[2],
node[i].pvolume,
node[i].
fracture[1] );
263 struct posit3d particle3dvelocity;
274 particle3dvelocity.cord3[2] = 0;
277 return particle3dvelocity;
284 printf(
" \n Output 2D coordinates of nodes into files \n");
285 unsigned int inode, ifract;
289 for (ifract = 0; ifract <
nfract; ifract++) {
290 mincx[ifract] = 100000;
291 maxcx[ifract] = -100000;
292 mincy[ifract] = 100000;
293 maxcy[ifract] = -100000;
295 for (inode = 0; inode <
nnodes; inode++) {
297 if (
node[inode].coord_xy[0] < mincx[ifract]) {
301 if (
node[inode].coord_xy[1] < mincy[ifract]) {
305 if (
node[inode].coord_xy[0] > maxcx[ifract]) {
309 if (
node[inode].coord_xy[1] > maxcy[ifract]) {
314 if (
node[inode].coord_xy[3] < mincx[ifract]) {
318 if (
node[inode].coord_xy[4] < mincy[ifract]) {
322 if (
node[inode].coord_xy[3] > maxcx[ifract]) {
326 if (
node[inode].coord_xy[4] > maxcy[ifract]) {
335 double lengthx, lengthy;
337 mkdir(
"Coord2D", 0777);
339 for (ifract = 0; ifract <
nfract; ifract++) {
340 sprintf(filename,
"Coord2D/coord_%d.dat", ifract + 1);
342 lengthx = fabs(maxcx[ifract] - mincx[ifract]);
343 lengthy = fabs(maxcy[ifract] - mincy[ifract]);
345 for (inode = 0; inode <
nnodes; inode++) {
347 fprintf(fr,
"%d %5.8e %5.8e %5.8e %5.8e %5.8e\n", inode + 1,
node[inode].coord_xy[0],
node[inode].coord_xy[1], (
node[inode].coord_xy[0] - mincx[ifract]) / lengthx, (
node[inode].coord_xy[1] - mincy[ifract]) / lengthy,
node[inode].aperture);
349 fprintf(fr,
"%d %5.8e %5.8e %5.8e %5.8e %5.8e\n", inode + 1,
node[inode].coord_xy[3],
node[inode].coord_xy[4], (
node[inode].coord_xy[3] - mincx[ifract]) / lengthx, (
node[inode].coord_xy[4] - mincy[ifract]) / lengthy,
node[inode].aperture);
FILE * OpenFile(char filen[120], char fileopt[2])
struct material * fracture
void ChangeFracture(int cell_win)
struct posit3d CalculateVelocity3D()
struct posit3d CalculatePosition3D()