dfnTrans
Code for Particle Tracking simulations in 3D DFN
FuncDef.h
Go to the documentation of this file.
1 
2 #define pi 3.14159265359
4 extern char maindir[125];
5 
7 extern double porosity;
8 
10 extern double density;
11 
13 extern unsigned long int timesteps;
14 
16 extern double thickness;
17 
19 extern double saturation;
20 
22 extern double timeunit;
23 
25 extern char controlfile[120];
26 
28 extern double totalFluxIn;
29 
30 /* parts_fracture: initial number of particles per fracture */
31 /* Global variables: nnodes - number of nodes */
32 /* ncells - number of triangles */
33 /* nfract - number of fractures */
34 /* max_neighb - maximum number of edges in Voronoi polygon, node connections */
35 
37 extern unsigned int pflotran;
38 
40 extern unsigned int fehm;
41 
43 extern unsigned int nnodes;
44 
46 extern unsigned int ncells;
47 
49 extern unsigned int nfract;
50 
52 extern unsigned int max_neighb;
53 
55 extern unsigned int npart;
56 
58 extern unsigned int np;
59 
61 extern unsigned int nzone_in;
62 
64 extern unsigned int *nodezonein;
65 
67 extern unsigned int *nodezoneout;
68 
69 extern unsigned int flag_w;
70 
71 
72 
74 struct material {
75 
77  float theta;
78 
80  float nvect_xy[2];
81 
83  float nvect_z[2];
84 
86  unsigned int firstnode;
87 
89  unsigned int lastnode;
90 
92  unsigned int firstcell;
93 
95  unsigned int numbcells;
96 
98  double rot2mat[3][3];
99 
101  double rot3mat[3][3];
102 };
103 
104 
106 struct vertex {
107 
109  unsigned int typeN;
110 
112  unsigned int fracture[2];
113 
115  double coord[3];
116 
118  double coord_xy[6];
119 
121  double pvolume; // volume of Voronoi polygon
122 
124  double pressure; //pressure
125 
127  unsigned int numneighb; //number of neighboring nodes
128 
130  double velocity[4][2]; //Darcy's velocity
131 
133  double timestep[4]; // time step
134 
136  unsigned int* indnodes; //array of neighboring node's indices
137 
139  unsigned int** cells; //array of neighboring cells's indices
140 
142  unsigned int** fracts;//array of fracture's numbers
143 
145  unsigned int* type; //array of node's type
146 
148  double* flux;//array of fluxes
149 
151  double* area;//area of Voronoi facea
152 
154  double residtime; //residential time of particles
155 
157  double aperture; //aperture of the cell
158 };
159 
160 
161 /* element structure contains the information about trianglar cells in DFN mesh */
162 struct element {
164  unsigned int fracture;
165 
167  unsigned int node_ind[3];// three nodes indices
168 
170  unsigned int veloc_ind[3]; // index of velocity of each node
171 
172 
173 };
174 
175 
177 struct contam {
178 
180  double velocity[2];
181 
183  double position[2];
184 
186  double prev_pos[2];
187 
189  unsigned int fracture;
190 
192  unsigned int cell;
193 
195  unsigned int intcell;
196 
198  double weight[3];
199 
201  double time;
202 
204  double fl_weight;
205 
207  double pressure; //fluid pressure
208 
210  double t_adv_diff; //in case of TDRW - total travel time
211 
213  double t_diff; // in case of TDRW - accumulative diffusion time
214 };
215 
217 extern struct material *fracture;
218 
220 extern struct vertex *node;
221 
223 extern struct contam *particle;
224 
226 extern struct element *cell;
227 
228 
229 void ReadInit();
230 void ReadDataFiles();
231 void AdjacentCells(int ln, int i, int j, int k);
232 void Convertto2d();
233 void Convertto3d();
234 void DarcyVelocity();
235 struct matr MatrixProducts (double normxarea[][2], int number);
236 struct lb DefineBoundaryAngle(int i, unsigned int edge_1, unsigned int edge_2, int f1, int coorf);
237 void VelocityInteriorNode (double normxarea[][2], int i, int number, unsigned int indj[max_neighb], int vi);
238 void VelocityExteriorNode (double normxarea[][2], int i, int number, unsigned int indj[max_neighb], struct lb lbound, int vi) ;
239 void CheckNewCell();
240 void ParticleTrack();
241 struct intcoef CalculateWeights(int nn1, int nn2, int nn3);
242 void SearchNeighborCells(int nn1, int nn2, int nn3);
243 int InsideCell (unsigned int numc);
244 void NeighborCells (int k);
245 void PredictorStep();
246 void CorrectorStep();
247 void DefineTimeStep();
248 int CheckDistance();
249 void AcrossIntersection (int prevcell, int int1, int int2, int mixing_rule);
250 void ChangeFracture(int cell_win);
252 int InitCell ();
253 int InitPos();
254 void Moving2Center(int nnp, int cellnumber);
255 int Moving2NextCell(int stuck, int k);
256 void BoundaryCells();
257 int InitParticles_np (int k_current, int firstn, int lastn, int parts_fracture, int first_ind, int last_ind);
258 int InitParticles_eq (int k_current, int firstn, int lastn, double parts_dist, int first_ind, int last_ind);
259 int CornerVelocity(int i, int m1, int m2, int m3, int s1, int s2, int s3);
260 void ReadBoundaryNodes();
261 FILE *OpenFile(char filen[120], char fileopt[2]);
262 void ReadFEHMfile(int nedges);
263 void ReadPFLOTRANfile(int nedges);
264 void WritingInit();
265 void Velocity3D();
266 double CalculateCurrentDT();
267 int Yindex(int nodenum, int np);
268 int Xindex(int nodenum, int np);
269 int CompleteMixingRandomSampling(double products[4], double speedsq[4], int indj, int int1, int indk);
270 int StreamlineRandomSampling(double products[4], double speedsq[4], int indj, int int1, int indk, int neighborcellind[4], int neighborfracind[4], int prevfrac, int prevcell);
271 void OutputVelocities();
272 int XindexC(int nodenum, int ii);
273 int YindexC(int nodenum, int ii);
274 double DefineAngle(double u1, double u2, double v1, double v2);
275 void HalfPolygonVelocity(int i, int k, int fractn, int indc, unsigned int fractj[max_neighb]);
277 void BoundaryLine(int n1, int n2, int n3);
278 void CheckGrid();
279 int BVelocityDirection(int b1, int b2);
280 double InOutFlowCell(int indcell, int int1, double nposx, double nposy);
281 void Moving2NextCellBound(int prevcell);
282 struct inpfile Control_File(char fileobject[], int ctr);
283 struct inpfile Control_Data(char fileobject[], int ctr);
284 void ParticleOutput (int currentt, int frac_p);
285 struct inpfile Control_Param(char fileobject[], int ctr);
286 void FlowInWeight(int numbpart);
287 int InitParticles_ones (int k_current, double inter_p[][4], int fracture, int parts_fracture, int ii, double thirdcoor, int zonenumb_in, int first_ind, int last_ind);
288 void Coordinations2D ();
289 void ReadAperture();
290 void InitInMatrix();
291 double TimeFromMatrix(double pdist);
292 void FinalPosition();
293 struct lagrangian CalculateLagrangian(double xcurrent, double ycurrent, double zcurrent, double xprev, double yprev, double zprev);
294 void OutputMarPlumDisp (int currentnum, char path[125]);
295 int String_Compare(char string1[], char string2[]);
296 struct inpfile Control_File_Optional(char fileobject[], int ctr);
297 double TimeDomainRW (double time_advect);
298 int InitParticles_flux (int k_current, int firstn, int lastn, double weight_p);
299 int InitInWell(int nodepart);
300 
unsigned int nnodes
Definition: main.c:29
int InitParticles_eq(int k_current, int firstn, int lastn, double parts_dist, int first_ind, int last_ind)
void HalfPolygonVelocity(int i, int k, int fractn, int indc, unsigned int fractj[max_neighb])
void InitInMatrix()
double TimeFromMatrix(double pdist)
int InitInWell(int nodepart)
int String_Compare(char string1[], char string2[])
int YindexC(int nodenum, int ii)
unsigned long int timesteps
Definition: main.c:48
int InitParticles_ones(int k_current, double inter_p[][4], int fracture, int parts_fracture, int ii, double thirdcoor, int zonenumb_in, int first_ind, int last_ind)
double CalculateCurrentDT()
void Coordinations2D()
int Xindex(int nodenum, int np)
int StreamlineRandomSampling(double products[4], double speedsq[4], int indj, int int1, int indk, int neighborcellind[4], int neighborfracind[4], int prevfrac, int prevcell)
double thickness
Definition: main.c:49
FILE * OpenFile(char filen[120], char fileopt[2])
Definition: ReadGridInit.c:664
struct element * cell
Definition: main.c:42
struct intcoef CalculateWeights(int nn1, int nn2, int nn3)
struct inpfile Control_File(char fileobject[], int ctr)
Definition: ReadGridInit.c:998
void VelocityExteriorNode(double normxarea[][2], int i, int number, unsigned int indj[max_neighb], struct lb lbound, int vi)
void CorrectorStep()
void SearchNeighborCells(int nn1, int nn2, int nn3)
void ReadPFLOTRANfile(int nedges)
Definition: ReadGridInit.c:677
void ReadInit()
Definition: ReadGridInit.c:16
void Moving2NextCellBound(int prevcell)
double DefineAngle(double u1, double u2, double v1, double v2)
double porosity
Definition: main.c:46
char maindir[125]
Definition: main.c:43
void VelocityInteriorNode(double normxarea[][2], int i, int number, unsigned int indj[max_neighb], int vi)
int InitParticles_np(int k_current, int firstn, int lastn, int parts_fracture, int first_ind, int last_ind)
void FlowInWeight(int numbpart)
int InitCell()
struct inpfile Control_File_Optional(char fileobject[], int ctr)
int BVelocityDirection(int b1, int b2)
void AdjacentCells(int ln, int i, int j, int k)
Definition: ReadGridInit.c:485
unsigned int ncells
Definition: main.c:30
void Convertto2d()
int XindexC(int nodenum, int ii)
int CornerVelocity(int i, int m1, int m2, int m3, int s1, int s2, int s3)
double timeunit
Definition: main.c:51
int InsideCell(unsigned int numc)
void OutputMarPlumDisp(int currentnum, char path[125])
Definition: output.c:19
void AcrossIntersection(int prevcell, int int1, int int2, int mixing_rule)
void ReadDataFiles()
Definition: ReadGridInit.c:155
void BoundaryCells()
unsigned int np
Definition: main.c:34
void Moving2Center(int nnp, int cellnumber)
void ChangeFracture(int cell_win)
void DarcyVelocity()
unsigned int nzone_in
Definition: main.c:35
double InOutFlowCell(int indcell, int int1, double nposx, double nposy)
double density
Definition: main.c:47
void ParticleTrack()
Definition: TrackingPart.c:66
int Yindex(int nodenum, int np)
unsigned int pflotran
Definition: main.c:27
int CompleteMixingRandomSampling(double products[4], double speedsq[4], int indj, int int1, int indk)
struct contam * particle
Definition: main.c:41
int InitParticles_flux(int k_current, int firstn, int lastn, double weight_p)
void BoundaryLine(int n1, int n2, int n3)
unsigned int fehm
Definition: main.c:28
struct posit3d CalculateVelocity3D()
unsigned int * nodezoneout
Definition: main.c:37
struct inpfile Control_Param(char fileobject[], int ctr)
int CheckDistance()
int Moving2NextCell(int stuck, int k)
void ReadAperture()
struct matr MatrixProducts(double normxarea[][2], int number)
struct inpfile Control_Data(char fileobject[], int ctr)
unsigned int max_neighb
Definition: main.c:32
void ReadFEHMfile(int nedges)
Definition: ReadGridInit.c:796
unsigned int npart
Definition: main.c:33
struct vertex * node
Definition: main.c:40
void ParticleOutput(int currentt, int frac_p)
struct lagrangian CalculateLagrangian(double xcurrent, double ycurrent, double zcurrent, double xprev, double yprev, double zprev)
double totalFluxIn
Definition: main.c:52
void Velocity3D()
char controlfile[120]
Definition: main.c:44
struct posit3d CalculatePosition3D()
void CheckGrid()
Definition: ReadGridInit.c:965
struct material * fracture
Definition: main.c:39
void CheckNewCell()
double TimeDomainRW(double time_advect)
void Convertto3d()
struct lb DefineBoundaryAngle(int i, unsigned int edge_1, unsigned int edge_2, int f1, int coorf)
unsigned int nfract
Definition: main.c:31
void NeighborCells(int k)
unsigned int flag_w
Definition: main.c:38
void ReadBoundaryNodes()
Definition: ReadGridInit.c:526
unsigned int * nodezonein
Definition: main.c:36
void DefineTimeStep()
int InitPos()
void OutputVelocities()
void PredictorStep()
void WritingInit()
Definition: ReadGridInit.c:898
double saturation
Definition: main.c:50
void FinalPosition()
unsigned int mixing_rule
Definition: TrackingPart.c:30
unsigned int fracture
Definition: FuncDef.h:189
double time
Definition: FuncDef.h:201
unsigned int intcell
Definition: FuncDef.h:195
double pressure
Definition: FuncDef.h:207
double weight[3]
Definition: FuncDef.h:198
double velocity[2]
Definition: FuncDef.h:180
unsigned int cell
Definition: FuncDef.h:192
double t_adv_diff
Definition: FuncDef.h:210
double prev_pos[2]
Definition: FuncDef.h:186
double t_diff
Definition: FuncDef.h:213
double fl_weight
Definition: FuncDef.h:204
double position[2]
Definition: FuncDef.h:183
unsigned int node_ind[3]
Definition: FuncDef.h:167
unsigned int veloc_ind[3]
Definition: FuncDef.h:170
unsigned int fracture
Definition: FuncDef.h:164
unsigned int firstcell
Definition: FuncDef.h:92
double rot2mat[3][3]
Definition: FuncDef.h:98
float nvect_xy[2]
Definition: FuncDef.h:80
unsigned int firstnode
Definition: FuncDef.h:86
unsigned int numbcells
Definition: FuncDef.h:95
double rot3mat[3][3]
Definition: FuncDef.h:101
unsigned int lastnode
Definition: FuncDef.h:89
float nvect_z[2]
Definition: FuncDef.h:83
float theta
Definition: FuncDef.h:77
double coord[3]
Definition: FuncDef.h:115
double coord_xy[6]
Definition: FuncDef.h:118
double pressure
Definition: FuncDef.h:124
unsigned int ** cells
Definition: FuncDef.h:139
double timestep[4]
Definition: FuncDef.h:133
double residtime
Definition: FuncDef.h:154
double aperture
Definition: FuncDef.h:157
double pvolume
Definition: FuncDef.h:121
unsigned int * indnodes
Definition: FuncDef.h:136
double velocity[4][2]
Definition: FuncDef.h:130
double * flux
Definition: FuncDef.h:148
unsigned int fracture[2]
Definition: FuncDef.h:112
unsigned int typeN
Definition: FuncDef.h:109
unsigned int numneighb
Definition: FuncDef.h:127
unsigned int ** fracts
Definition: FuncDef.h:142
unsigned int * type
Definition: FuncDef.h:145
double * area
Definition: FuncDef.h:151