dfnTrans
Code for Particle Tracking simulations in 3D DFN
InitialPartPositions.c File Reference
#include <stdio.h>
#include <search.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "FuncDef.h"
#include <unistd.h>
#include <time.h>
Include dependency graph for InitialPartPositions.c:

Go to the source code of this file.

Data Structures

struct  inpfile
 
struct  posit3d
 

Functions

int InitPos ()
 
int InitCell ()
 
int InitParticles_np (int k_current, int firstnd, int lastnd, int parts_fracture, int first_ind, int last_ind)
 
int InitParticles_eq (int k_current, int firstn, int lastn, double parts_dist, int first_ind, int last_ind)
 
int InitParticles_ones (int k_current, double inter_p[][4], int fracture_n, int parts_fracture, int ii, double thirdcoor, int zonenumb_in, int first_ind, int last_ind)
 
void FlowInWeight (int numberpart)
 
void InitInMatrix ()
 
double TimeFromMatrix (double pdist)
 
int InitParticles_flux (int k_current, int first_ind, int last_ind, double weight_p)
 
int InitInWell (int node_part)
 

Function Documentation

◆ FlowInWeight()

void FlowInWeight ( int  numberpart)

Function calculates particle's in-flow flux weight. Used in option #1, #2, #3.

Definition at line 747 of file InitialPartPositions.c.

References contam::cell, cell, contam::fl_weight, InitCell(), node, element::node_ind, np, vertex::numneighb, particle, and contam::weight.

Referenced by ParticleTrack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitCell()

int InitCell ( )

Function performs a search to find cell Id where the particle was initially placed.

Definition at line 542 of file InitialPartPositions.c.

References vertex::cells, InsideCell(), node, nodezonein, vertex::numneighb, and nzone_in.

Referenced by FlowInWeight(), and ParticleTrack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitInMatrix()

void InitInMatrix ( )

Function performs data reading from files for Option #5, init_matrix. In this option particles are placed at random positions in matrix, the time to move from initial position to nearest fracture is calculated in function TimeFromMatrix.

Input files ParticleInitCoordR.dat and ClosestNodeR.inp provide particles initial positions at matrix and te closes node ID at DFN mesh, respectively.

Definition at line 832 of file InitialPartPositions.c.

References contam::cell, Control_File(), vertex::coord, vertex::coord_xy, inpfile::filename, contam::fl_weight, vertex::fracture, contam::fracture, contam::intcell, node, npart, OpenFile(), particle, contam::position, contam::pressure, contam::prev_pos, contam::time, TimeFromMatrix(), contam::velocity, and contam::weight.

Referenced by InitPos().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitInWell()

int InitInWell ( int  node_part)

◆ InitParticles_eq()

int InitParticles_eq ( int  k_current,
int  firstn,
int  lastn,
double  parts_dist,
int  first_ind,
int  last_ind 
)

Function defines particles initial positions at a single fracture edge, using calculated before distance between particles. Option #2, init_eqd.

Definition at line 623 of file InitialPartPositions.c.

References vertex::coord_xy, contam::fl_weight, vertex::fracture, contam::fracture, contam::intcell, node, npart, particle, contam::position, contam::pressure, contam::time, and contam::velocity.

Referenced by InitPos().

Here is the caller graph for this function:

◆ InitParticles_flux()

int InitParticles_flux ( int  k_current,
int  first_ind,
int  last_ind,
double  weight_p 
)

Function defines particle's initial positions at single fracture edge in Option #6. Particles are placed according to input flux weights. In this case, all the particles have the same flux weight, but number of particles per fracture edge depends on in-flow flux of this fracture.

Definition at line 939 of file InitialPartPositions.c.

References contam::cell, vertex::coord_xy, density, contam::fl_weight, vertex::flux, vertex::fracture, contam::fracture, contam::intcell, node, nodezonein, np, npart, vertex::numneighb, particle, contam::position, contam::pressure, contam::time, and contam::velocity.

Referenced by InitPos().

Here is the caller graph for this function:

◆ InitParticles_np()

int InitParticles_np ( int  k_current,
int  firstnd,
int  lastnd,
int  parts_fracture,
int  first_ind,
int  last_ind 
)

Function defines particle's initial positions on a single fracture edge. Option #1, init_nf

Definition at line 578 of file InitialPartPositions.c.

References vertex::coord_xy, contam::fl_weight, vertex::fracture, contam::fracture, contam::intcell, node, nodezonein, npart, particle, contam::position, contam::pressure, contam::time, and contam::velocity.

Referenced by InitPos().

Here is the caller graph for this function:

◆ InitParticles_ones()

int InitParticles_ones ( int  k_current,
double  inter_p[][4],
int  fracture_n,
int  parts_fracture,
int  ii,
double  thirdcoor,
int  zonenumb_in,
int  first_ind,
int  last_ind 
)

Function defines particles initial positions in option #3, where user defines region at in-flow boundary face for particles.

Definition at line 668 of file InitialPartPositions.c.

References contam::fl_weight, contam::fracture, fracture, contam::intcell, npart, particle, contam::position, contam::pressure, material::rot2mat, contam::time, and contam::velocity.

Referenced by InitPos().

Here is the caller graph for this function:

◆ InitPos()

int InitPos ( )

Function defines the required option of particles initial positions defined at input control file; calculates number of particles, allocates memory.

First option init_nf: equal number of particles on every boundary edge regardless of edge length

Second option init_eqd: calculate total length of boundary edges; define the distance between particles and place particles equidistant from each other on all edges

Third option init_oneregion: user specifies a region and all particles start from the fracture edges that located inside the region

Fourth option init_random: particles will be set randomly over all fractures surfaces; in this case the particles are weighted acoording to the aperture

5th option init_matrix: particles are set randomly in rock matrix, their time from initial positions is calculated, then particles move through fractures to out-flow boundary. This option requires preprocessing; the script RandomPositGener.py will provide necessary input files

Sixth option init_flux: place particles according to input fluxes. Each particle has the same flux weight. The number of particles are placed propportionally to inflow flux on each cell and fracture edge.

Definition at line 21 of file InitialPartPositions.c.

References vertex::aperture, contam::cell, cell, Control_Data(), Control_File(), Control_File_Optional(), Control_Param(), vertex::coord, inpfile::filename, contam::fl_weight, inpfile::flag, flag_w, vertex::fracture, element::fracture, contam::fracture, fracture, InitInMatrix(), InitInWell(), InitParticles_eq(), InitParticles_flux(), InitParticles_np(), InitParticles_ones(), InsideCell(), Moving2Center(), ncells, node, element::node_ind, nodezonein, npart, nzone_in, inpfile::param, particle, contam::pressure, contam::time, totalFluxIn, and contam::velocity.

Referenced by ParticleTrack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TimeFromMatrix()

double TimeFromMatrix ( double  pdist)

Option #5. Estimation of travel time of particles moving from matrix to the closest fracture.

Definition at line 913 of file InitialPartPositions.c.

References Control_Param(), inpfile::param, pi, and timeunit.

Referenced by InitInMatrix().

Here is the call graph for this function:
Here is the caller graph for this function: