dfnTrans
Code for Particle Tracking simulations in 3D DFN
|
#include <stdio.h>
#include <search.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "FuncDef.h"
#include <unistd.h>
Go to the source code of this file.
Data Structures | |
struct | lb |
struct | matr |
struct | inpfile |
Functions | |
void | DarcyVelocity () |
void | OutputVelocities () |
struct matr | MatrixProducts (double normxarea[][2], int number) |
struct lb | DefineBoundaryAngle (int i, unsigned int edge_1, unsigned int edge_2, int f1, int coorf) |
double | DefineAngle (double u1, double u2, double v1, double v2) |
void | VelocityInteriorNode (double normx_area[][2], int i, int number, unsigned int indj[max_neighb], int vi) |
void | VelocityExteriorNode (double norm_xarea[][2], int i, int number, unsigned int indj[max_neighb], struct lb lbound, int vi) |
void | BoundaryCells () |
int | CornerVelocity (int i, int m1, int m2, int m3, int s1, int s2, int s3) |
int | XindexC (int nodenum, int ii) |
int | YindexC (int nodenum, int ii) |
void | HalfPolygonVelocity (int i, int k, int fractn, int indc, unsigned int fractj[max_neighb]) |
void BoundaryCells | ( | ) |
The function checks velocities at boundary nodes and fixes pathological cases.
In the rare event, when two velocity vectors are directed towards each other along the same cell edge, a particle will be stuck there. To avoid this situation, one of velocities is redirected along the edge with node associated with lower pressure value.
Definition at line 447 of file VelocityReconstruction.c.
References cell, vertex::cells, vertex::coord_xy, CornerVelocity(), DefineAngle(), fracture, vertex::indnodes, ncells, node, element::node_ind, vertex::numneighb, pi, vertex::pressure, element::veloc_ind, vertex::velocity, XindexC(), and YindexC().
Referenced by DarcyVelocity().
int CornerVelocity | ( | int | i, |
int | m1, | ||
int | m2, | ||
int | m3, | ||
int | s1, | ||
int | s2, | ||
int | s3 | ||
) |
The Function identifies pathologycal cases at corner of fracture boundary. The angle between velocity on corner node and velocities/edges on surrounding boundary nodes are calculated. Then, if velocity is pointing outside of fracture, turns the velocity direction along the fracture edge.
Definition at line 658 of file VelocityReconstruction.c.
References vertex::coord_xy, DefineAngle(), node, pi, vertex::velocity, XindexC(), and YindexC().
Referenced by BoundaryCells().
void DarcyVelocity | ( | ) |
Function performs Darcy's velocity reconstruction (main function of Darcy velocities reconstruction procedure) using linear least square algorithm. Flow solver provides flow fluxes on each edge of control volume cells. Velocity on each control volume cell center (each node) is reconstructed using flow fluxes.
Velocity of interior and interior-interface nodes is reconstructed according to Eq.5 (Painter,2011); exterior node' velocity according to Eq.7 (Painter, 2011)
Function makes a loop over all nodes and calls functions for velocity reconstruction depending of type of the node (external, internal, internal-interface, external interface)
Definition at line 29 of file VelocityReconstruction.c.
References BoundaryCells(), vertex::coord_xy, DefineBoundaryAngle(), fehm, vertex::fracture, fracture, HalfPolygonVelocity(), vertex::indnodes, max_neighb, nnodes, node, vertex::numneighb, pflotran, vertex::velocity, VelocityExteriorNode(), and VelocityInteriorNode().
Referenced by main().
double DefineAngle | ( | double | u1, |
double | u2, | ||
double | v1, | ||
double | v2 | ||
) |
Function defines an angle between two edges of voronoy cell
Definition at line 347 of file VelocityReconstruction.c.
References lb::angle.
Referenced by BoundaryCells(), CornerVelocity(), and ParticleOutput().
struct lb DefineBoundaryAngle | ( | int | i, |
unsigned int | edge_1, | ||
unsigned int | edge_2, | ||
int | f1, | ||
int | coorf | ||
) |
The function defines angle between two edges of a boundary cell and return the result. The angle is used in flow velocity reconstruction on fracture edge.
Definition at line 214 of file VelocityReconstruction.c.
References fracture, maindir, nfract, nnodes, node, and vertex::velocity.
Referenced by DarcyVelocity(), and HalfPolygonVelocity().
void HalfPolygonVelocity | ( | int | i, |
int | k, | ||
int | fractn, | ||
int | indc, | ||
unsigned int | fractj[max_neighb] | ||
) |
Velocity reconstruction on an intersection node. In this case, the control volume cell is devided onto two polygons by intersection line. The velocity reconstruction is performed on each part of control volume cell at intersection.
Definition at line 806 of file VelocityReconstruction.c.
References vertex::area, cell, vertex::cells, vertex::coord_xy, DefineBoundaryAngle(), fehm, fracture, vertex::indnodes, max_neighb, node, pflotran, vertex::type, vertex::typeN, element::veloc_ind, VelocityExteriorNode(), and VelocityInteriorNode().
Referenced by DarcyVelocity().
struct matr MatrixProducts | ( | double | normxarea[][2], |
int | number | ||
) |
Function performs matrix dot product (GTG)-1 and returns the result.
Definition at line 214 of file VelocityReconstruction.c.
Referenced by VelocityExteriorNode(), and VelocityInteriorNode().
void OutputVelocities | ( | ) |
This function is called to output velocities on nodes in the order of fractture IDs. The output can be used to visualise flow field of 2D reconstructed Darcy velocities in 3D simulation domain
Definition at line 214 of file VelocityReconstruction.c.
void VelocityExteriorNode | ( | double | norm_xarea[][2], |
int | i, | ||
int | number, | ||
unsigned int | indj[max_neighb], | ||
struct lb | lbound, | ||
int | vi | ||
) |
The function reconstructs Darcy velocity on exterior (boundary) node
Definition at line 391 of file VelocityReconstruction.c.
References density, vertex::flux, lb::length_b, matr::matinv, matr::matrinvG, MatrixProducts(), node, lb::norm, porosity, timeunit, and vertex::velocity.
Referenced by DarcyVelocity(), and HalfPolygonVelocity().
void VelocityInteriorNode | ( | double | normx_area[][2], |
int | i, | ||
int | number, | ||
unsigned int | indj[max_neighb], | ||
int | vi | ||
) |
The function reconstructs Darcy velocity on interior cell center, at interior node
Definition at line 356 of file VelocityReconstruction.c.
References density, vertex::flux, matr::matinv, matr::matrinvG, MatrixProducts(), node, porosity, timeunit, and vertex::velocity.
Referenced by DarcyVelocity(), and HalfPolygonVelocity().
int XindexC | ( | int | nodenum, |
int | ii | ||
) |
Functions returns the index of X coordination of intersection node (cells)
Definition at line 776 of file VelocityReconstruction.c.
References cell, fracture, and node.
Referenced by AcrossIntersection(), BoundaryCells(), CornerVelocity(), and InOutFlowCell().
int YindexC | ( | int | nodenum, |
int | ii | ||
) |
Functions returns the index of Y coordination of intersection node (cells)
Definition at line 791 of file VelocityReconstruction.c.
References cell, fracture, and node.
Referenced by AcrossIntersection(), BoundaryCells(), CornerVelocity(), and InOutFlowCell().