lanl / dfnWorks

dfnWorks is a parallelized computational suite to generate three-dimensional discrete fracture networks (DFN) and simulate flow and transport. If you download the software please fill out our interest form to stay up to date on releases https://goo.gl/forms/VE39oKsyp4LVC6Gj2 and join our google group https://groups.google.com/d/forum/dfnworks-users . Precompiled Docker Container https://hub.docker.com/r/ees16/dfnworks
https://dfnworks.lanl.gov/
Other
74 stars 42 forks source link

Question for particle tracking #72

Open l20000719 opened 9 months ago

l20000719 commented 9 months ago

Dear dfnWorks developers,

Greetings. I have successfully utilized dfnWorks to create a simulation domain with dimensions of 100m x 100m x 100m, generating five sets of fracture networks. Additionally, I've placed a vertical well parallel to the z-axis at the coordinates (0m, 40m, 0m) with a length of 50m and a radius of 4m.

To ensure fractures can cross the well, I've implemented a Python while loop iterating through different seed values. I conducted a fluid flow simulation based on specified boundary conditions in dfn_pressure.in. The pressure is set to 5.001MPa at the y=50m plane and 5MPa at the y=-50m plane.

For particle tracking, I used Python to write data from well_inject.zone into allboundaries.zone, modifying the index to 7. This setup treats the well zone as an inflow boundary in PTDFN_control.dat, with the outflow boundary set as 6 (back_n). Please refer to the attached file (my_DFNcase.zip) for more details.

My question concerns PTDFN_control.dat, which provides 7 options. Although I chose "Option 7. Particles start from in-flow zone nodes positions," I aim for functionality similar to "Option 3." Specifically, I want to release a total of n particles in a specific region (e.g., releasing 3000 particles from the injection well).

I tried "Option 3" and set the region (-4 < x < 4, -36 < y < 44, 0 < z < 50), but result showed no fractures crossed the region and dfnTran wasn't complete, and the code exited. Is there a method to fulfill this requirement, or have I made any mistakes in my configuration?

Best regards,

my_DFNcase.zip

hymanjd commented 9 months ago

Hi Wei,

Can you send us your dfnTrans input file?

Thanks, Jeffrey

From: Wei @.> Reply-To: lanl/dfnWorks @.> Date: Monday, January 8, 2024 at 2:46 AM To: lanl/dfnWorks @.> Cc: Subscribed @.> Subject: [EXTERNAL] [lanl/dfnWorks] Question for particle tracking (Issue #72)

Dear dfnWorks developers,

Greetings. I have used dfnWorks to create a simulation domain of dimensions 100m100m100m, generating five sets of fracture networks within . Additionally, a vertical well parallel to the z-axis has been placed at the coordinates (0m, 40m, 0m) with a length of 50m and a radius of 4m (To ensure that fractures can cross the well, in my Python file, I am using a while loop to iterate through different seed values). I have conducted a fluid flow simulation based on the boundary conditions specified in dfn_pressure.inhttps://urldefense.com/v3/__http:/dfn_pressure.in__;!!Bt8fGhp8LhKGRg!EenlCFY2eow3IxKAGqkQAfIZJPnsOIb1sDIVMglqYueRcd0tK18qUr2H7onIWRrRrBcPHk2seRyBp59_VIMhu18p$, where the pressure is set to 5.001MPa at the y=50m plane and 5MPa at the y=-50m plane.

During particle tracking, I utilized Python to write the data from well_inject.zonehttps://urldefense.com/v3/__http:/well_inject.zone__;!!Bt8fGhp8LhKGRg!EenlCFY2eow3IxKAGqkQAfIZJPnsOIb1sDIVMglqYueRcd0tK18qUr2H7onIWRrRrBcPHk2seRyBp59_VEKHOxKt$ into allboundaries.zonehttps://urldefense.com/v3/__http:/allboundaries.zone__;!!Bt8fGhp8LhKGRg!EenlCFY2eow3IxKAGqkQAfIZJPnsOIb1sDIVMglqYueRcd0tK18qUr2H7onIWRrRrBcPHk2seRyBp59_VPN5KMcq$, modifying the index to 7. This allows me to treat the well zone as an inflow-boundary in PTDFN_control.dat, while setting the outflow-boundary as 6 (back_n). (Please refer to the attached file(my_DFNcase.ziphttps://urldefense.com/v3/__http:/my_DFNcase.zip__;!!Bt8fGhp8LhKGRg!EenlCFY2eow3IxKAGqkQAfIZJPnsOIb1sDIVMglqYueRcd0tK18qUr2H7onIWRrRrBcPHk2seRyBp59_VDEFClYz$) for more details.)

My question pertains to PTDFN_control.dat, which offers 7 options. I have chosen "Option #7https://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/issues/7__;!!Bt8fGhp8LhKGRg!EenlCFY2eow3IxKAGqkQAfIZJPnsOIb1sDIVMglqYueRcd0tK18qUr2H7onIWRrRrBcPHk2seRyBp59_VO2V1397$. Particles start from in-flow zone nodes positions," but I wish to achieve functionality similar to "Option #3https://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/issues/3__;!!Bt8fGhp8LhKGRg!EenlCFY2eow3IxKAGqkQAfIZJPnsOIb1sDIVMglqYueRcd0tK18qUr2H7onIWRrRrBcPHk2seRyBp59_VNaU4pY-$." Specifically, I want to release a total of n particles in a specific region (in my case, around the injection well). Is there a method to fulfill this requirement, or have I made any mistakes in my configuration?

my_DFNcase.ziphttps://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/files/13858359/my_DFNcase.zip__;!!Bt8fGhp8LhKGRg!EenlCFY2eow3IxKAGqkQAfIZJPnsOIb1sDIVMglqYueRcd0tK18qUr2H7onIWRrRrBcPHk2seRyBp59_VNp1pjHh$

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/issues/72__;!!Bt8fGhp8LhKGRg!EenlCFY2eow3IxKAGqkQAfIZJPnsOIb1sDIVMglqYueRcd0tK18qUr2H7onIWRrRrBcPHk2seRyBp59_VAy93Abn$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AEKOGDDL4R5Q43NRDA3LEC3YNO56VAVCNFSM6AAAAABBRFEHLCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGA3TAMBXGY2TAMA__;!!Bt8fGhp8LhKGRg!EenlCFY2eow3IxKAGqkQAfIZJPnsOIb1sDIVMglqYueRcd0tK18qUr2H7onIWRrRrBcPHk2seRyBp59_VKpLkA1F$. You are receiving this because you are subscribed to this thread.Message ID: @.***>

l20000719 commented 9 months ago

Thank you for your prompt reply. The "PTDFN_control.dat" file in the "dfnTrans_input.zip" is my dfnTrans input. It utilizes option 3 to release 3000 particles from the region (-4 < x < 4, -36 < y < 44, 0 < z < 50). dfnTrans_input.zip

hymanjd commented 9 months ago

Please send only that file as a text file. Thank you.

From: Wei @.> Reply-To: lanl/dfnWorks @.> Date: Monday, January 8, 2024 at 9:19 AM To: lanl/dfnWorks @.> Cc: Jeffrey Hyman @.>, Comment @.***> Subject: [EXTERNAL] Re: [lanl/dfnWorks] Question for particle tracking (Issue #72)

Thank you for your prompt reply. The "PTDFN_control.dat" file in the "dfnTrans_input.ziphttps://urldefense.com/v3/__http:/dfnTrans_input.zip__;!!Bt8fGhp8LhKGRg!Go-4Umf6B9tLPse4mY6csE_9BVL9ACkwMpjTVR-rd68XUTj5aggzr-jmidO7Y0sUrXZDqAKiu_rpXRIh8Ftx1PYa$" is my dfnTrans input. It utilizes option #3https://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/issues/3__;!!Bt8fGhp8LhKGRg!Go-4Umf6B9tLPse4mY6csE_9BVL9ACkwMpjTVR-rd68XUTj5aggzr-jmidO7Y0sUrXZDqAKiu_rpXRIh8M4-UpVJ$ to release 3000 particles from the region (-4 < x < 4, -36 < y < 44, 0 < z < 50). dfnTrans_input.ziphttps://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/files/13863537/dfnTrans_input.zip__;!!Bt8fGhp8LhKGRg!Go-4Umf6B9tLPse4mY6csE_9BVL9ACkwMpjTVR-rd68XUTj5aggzr-jmidO7Y0sUrXZDqAKiu_rpXRIh8NIpW2md$

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/issues/72*issuecomment-1881396049__;Iw!!Bt8fGhp8LhKGRg!Go-4Umf6B9tLPse4mY6csE_9BVL9ACkwMpjTVR-rd68XUTj5aggzr-jmidO7Y0sUrXZDqAKiu_rpXRIh8DvmeD5I$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AEKOGDCVOYP7IFYID5HWOD3YNQL7JAVCNFSM6AAAAABBRFEHLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGM4TMMBUHE__;!!Bt8fGhp8LhKGRg!Go-4Umf6B9tLPse4mY6csE_9BVL9ACkwMpjTVR-rd68XUTj5aggzr-jmidO7Y0sUrXZDqAKiu_rpXRIh8PVDK2qY$. You are receiving this because you commented.Message ID: @.***>

l20000719 commented 9 months ago

Sorry about that, here is the input file as a text file PTDFN_control.txt

hymanjd commented 9 months ago

Please send as an attachment, not embedded

From: Wei @.> Reply-To: lanl/dfnWorks @.> Date: Monday, January 8, 2024 at 9:26 AM To: lanl/dfnWorks @.> Cc: Jeffrey Hyman @.>, Comment @.***> Subject: [EXTERNAL] Re: [lanl/dfnWorks] Question for particle tracking (Issue #72)

Sorry about that, here is the input file as a text file PTDFN_control.txthttps://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/files/13863658/PTDFN_control.txt__;!!Bt8fGhp8LhKGRg!AiP4g5MAQ7fkcDLtcaVBFs-ICLEzjs0XJgl0uRhAKsYhRDDRkQDIapUkRFJCyGDE9d9bUdQInhblILRycKdXnVCT$

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/issues/72*issuecomment-1881411712__;Iw!!Bt8fGhp8LhKGRg!AiP4g5MAQ7fkcDLtcaVBFs-ICLEzjs0XJgl0uRhAKsYhRDDRkQDIapUkRFJCyGDE9d9bUdQInhblILRycESg5pv1$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AEKOGDDRI6C2GKRWJIKL4BDYNQM27AVCNFSM6AAAAABBRFEHLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGQYTCNZRGI__;!!Bt8fGhp8LhKGRg!AiP4g5MAQ7fkcDLtcaVBFs-ICLEzjs0XJgl0uRhAKsYhRDDRkQDIapUkRFJCyGDE9d9bUdQInhblILRycJSKFzLn$. You are receiving this because you commented.Message ID: @.***>

l20000719 commented 9 months ago

Alternatively,the dfnTrans input file content is as follows.Sorry for the trouble.

/**********************  INPUT FILES: grid *****************************/
/**** input files with grid of DFN, mainly it's output of DFNGen ******/
param: params.txt
poly: poly_info.dat
inp: full_mesh.inp
stor: full_mesh.stor
boundary: allboundaries.zone
in-flow-boundary: 7
out-flow-boundary: 6

/**************** INPUT FILES: PFLOTRAN flow solution *******************/
PFLOTRAN: yes
PFLOTRAN_vel: darcyvel.dat
PFLOTRAN_cell: cellinfo.dat
PFLOTRAN_uge: full_mesh_vol_area.uge

/**************** INPUT FILES: FEHM flow solution ***********************/
FEHM: no
FEHM_fin: tri_frac.fin

/************************  OUTPUT FILES  ********************************/
out_grid: no
out_3dflow: no
out_init: no
out_tort: no

/*************** output options for particles trajectories ****************/
out_curv: no
out_avs: no
out_traj: no
out_fract: no
out_filetemp: no
allparticles_output: yes

/************* output directories *************************************/
out_dir: dfnTrans_output
out_path: trajectories
out_time: partime.dat

/*************** Intersection Mixing Rule **********************************/
streamline_routing: no

/************************************************************************/
/**************** PARTICLES INITIAL POSITIONS ***************************/
/************************************************************************/

/*Option #1.init_nf: if yes - the same number of particles (init_partn) will be placed 
     on every boundary fracture edge at in-flow boundary, 
     equidistant from each other */
init_nf: no 
init_partn: 10

/*Option #2.init_eqd: if yes - particles will be placed on the same distance from
     each other on all over in-flow boundary edges */  
init_eqd: no  //maximum number of particles that user expects on one fracture edge
init_npart: 10

/*Option #3.all particles start from the same region at in-flow boundary, in a range  
    {in_xmin, in_xmax,in_ymin, in_ymax, in_zmin, in_zmax} */
init_oneregion: yes
in_partn: 3000
in_xmin: -4
in_xmax: 4
in_ymin: 36
in_ymax: 44
in_zmin: 0
in_zmax: 50

/* Option #4.all particles are placed randomly over all fracture surface 
     (not only on boundary edges!) */
init_random: no 
// total number of particles
in_randpart: 50    

/*Option #5.all particles are seed randomly over matrix, 
     they will start travel in DFN from the node/cell that is closest to
     their initial position in rock matrix */     
init_matrix: no
// to obtain these files, run python script RandomPositGener.py
inm_coord: ParticleInitCoordR.dat
inm_nodeID: ClosestNodeR.inp
inm_porosity: 0.02
inm_diffcoeff: 1.0e-12

/* Option #6. particles positions according to in-flow flux weight */
init_fluxw: no
/* Initial number of particles can not be less than 
number of nodes in in-flow boundary. If it is less, 
the number of particles will be increased. */
init_totalnumber: 200 

/* Option #7. Particles start from in-flow zone nodes positions*/
/* for example, nodes defined at well zone/ex file are the position of injection well and fracture intersection */ 
init_well: no
/* Initial number of particles seeded at each node at in-flow zone */ 
init_nodepart: 1

/****************** FLOW AND FRACTURE PARAMETERS **********************/
porosity: 1.0
density: 997.73
satur: 1.0
thickness: 1.0

/************************ APERTURE *********************************/
aperture: yes
aperture_type: frac
aperture_file: aperture.dat

/************* TIME DOMAIN RANDOM WALK ******************************/
tdrw: no
tdrw_porosity: 0.01
tdrw_diffcoeff: 1.0e-9

/********************  TIME ********************************************/
timesteps: 2000000
time_units: years

/**** flux weighted particles*/
flux_weight: yes
seed: 125793

/*********************  Control Plane/Cylinder Output ********************/
ControlPlane: no
control_out: outcontroldir
delta_Control: 10
flowdir: 1

/**************************************************************************/
/endendend/
END
hymanjd commented 9 months ago

I’m not sure that inflow/outflow can look for values greater than 6. Can you post your screenoutput?

From: Wei @.> Reply-To: lanl/dfnWorks @.> Date: Monday, January 8, 2024 at 9:54 AM To: lanl/dfnWorks @.> Cc: Jeffrey Hyman @.>, Comment @.***> Subject: [EXTERNAL] Re: [lanl/dfnWorks] Question for particle tracking (Issue #72)

/** INPUT FILES: grid *****/

/ input files with grid of DFN, mainly it's output of DFNGen **/

param: params.txt

poly: poly_info.dat

inp: full_mesh.inp

stor: full_mesh.stor

boundary: allboundaries.zonehttps://urldefense.com/v3/__http:/allboundaries.zone__;!!Bt8fGhp8LhKGRg!EsDDd0Le2iIYq7A4-WnBZu_ctL7WCDzNK1B_LTrbkisGEOmGIiLDQd9B4DxhmuFQf0mVj8AcydWWSFA7GSWaXack$

in-flow-boundary: 7

out-flow-boundary: 6

/**** INPUT FILES: PFLOTRAN flow solution ***/

PFLOTRAN: yes

PFLOTRAN_vel: darcyvel.dat

PFLOTRAN_cell: cellinfo.dat

PFLOTRAN_uge: full_mesh_vol_area.uge

/**** INPUT FILES: FEHM flow solution ***/

FEHM: no

FEHM_fin: tri_frac.fin

/**** OUTPUT FILES ****/

out_grid: no

out_3dflow: no

out_init: no

out_tort: no

/*** output options for particles trajectories ****/

out_curv: no

out_avs: no

out_traj: no

out_fract: no

out_filetemp: no

allparticles_output: yes

/* output directories *****/

out_dir: dfnTrans_output

out_path: trajectories

out_time: partime.dat

/*** Intersection Mixing Rule **/

streamline_routing: no

/****/

/**** PARTICLES INITIAL POSITIONS ***/

/****/

/*Option #1.init_nf: if yes - the same number of particles (init_partn) will be placed

 on every boundary fracture edge at in-flow boundary,

 equidistant from each other */

init_nf: no

init_partn: 10

/*Option #2.init_eqd: if yes - particles will be placed on the same distance from

 each other on all over in-flow boundary edges */

init_eqd: no //maximum number of particles that user expects on one fracture edge

init_npart: 10

/*Option #3.all particles start from the same region at in-flow boundary, in a range

{in_xmin, in_xmax,in_ymin, in_ymax, in_zmin, in_zmax} */

init_oneregion: yes

in_partn: 3000

in_xmin: -4

in_xmax: 4

in_ymin: 36

in_ymax: 44

in_zmin: 0

in_zmax: 50

/* Option #4.all particles are placed randomly over all fracture surface

 (not only on boundary edges!) */

init_random: no

// total number of particles

in_randpart: 50

/*Option #5.all particles are seed randomly over matrix,

 they will start travel in DFN from the node/cell that is closest to

 their initial position in rock matrix */

init_matrix: no

// to obtain these files, run python script RandomPositGener.pyhttps://urldefense.com/v3/__http:/RandomPositGener.py__;!!Bt8fGhp8LhKGRg!EsDDd0Le2iIYq7A4-WnBZu_ctL7WCDzNK1B_LTrbkisGEOmGIiLDQd9B4DxhmuFQf0mVj8AcydWWSFA7GVPdfFeP$

inm_coord: ParticleInitCoordR.dat

inm_nodeID: ClosestNodeR.inp

inm_porosity: 0.02

inm_diffcoeff: 1.0e-12

/ Option #6. particles positions according to in-flow flux weight /

init_fluxw: no

/* Initial number of particles can not be less than

number of nodes in in-flow boundary. If it is less,

the number of particles will be increased. */

init_totalnumber: 200

/ Option #7. Particles start from in-flow zone nodes positions/

/ for example, nodes defined at well zone/ex file are the position of injection well and fracture intersection /

init_well: yes

/ Initial number of particles seeded at each node at in-flow zone /

init_nodepart: 1

/** FLOW AND FRACTURE PARAMETERS **/

porosity: 1.0

density: 997.73

satur: 1.0

thickness: 1.0

/**** APERTURE *****/

aperture: yes

aperture_type: frac

aperture_file: aperture.dat

/***** TIME DOMAIN RANDOM WALK **/

tdrw: no

tdrw_porosity: 0.01

tdrw_diffcoeff: 1.0e-9

/**** TIME ****/

timesteps: 2000000

time_units: years

/*** flux weighted particles/

flux_weight: yes

seed: 125793

/***** Control Plane/Cylinder Output ****/

ControlPlane: no

control_out: outcontroldir

delta_Control: 10

flowdir: 1

/**/

/endendend/

END

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/issues/72*issuecomment-1881465334__;Iw!!Bt8fGhp8LhKGRg!EsDDd0Le2iIYq7A4-WnBZu_ctL7WCDzNK1B_LTrbkisGEOmGIiLDQd9B4DxhmuFQf0mVj8AcydWWSFA7Gb9O6oko$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AEKOGDANNGLFS2RZE66XGFLYNQQCVAVCNFSM6AAAAABBRFEHLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGQ3DKMZTGQ__;!!Bt8fGhp8LhKGRg!EsDDd0Le2iIYq7A4-WnBZu_ctL7WCDzNK1B_LTrbkisGEOmGIiLDQd9B4DxhmuFQf0mVj8AcydWWSFA7GRUHIyj_$. You are receiving this because you commented.Message ID: @.***>

l20000719 commented 9 months ago

In my python code ,I write data from well_inject.zone into allboundaries.zone, modifying the index to 7. Here is a portion of the code.

fzone = open(jobname +"/allboundaries.zone", "r")
lines = fzone.readlines()
a = open(jobname +"/well_inject.zone", "r")
line = a.readlines()
line[1] = '000007     well_inject\n'
writeline = []
for i in lines[:-2]:
    writeline.append(i)
for j in line[1:]:
    writeline.append(j)
with open(jobname +"/allboundaries.zone", "w") as fall:
    fall.writelines(writeline)

This setup treats the well zone as an inflow boundary and set value 7 in PTDFN_control.dat, with the outflow boundary set as 6 (back_n). Here is a full code.

import random
from pydfnworks import *
import os
import numpy as np
example_path = os.getcwd()
jobname =  f"{example_path}/well_example_output"
dfnFlow_file = f"{example_path}/dfn_pressure.in"
dfnTrans_file = f"{example_path}/PTDFN_control.dat"
A = True
run = 1
while A == True:
    DFN = DFNWORKS(jobname,
               dfnFlow_file=dfnFlow_file,
               dfnTrans_file=dfnTrans_file,
               ncpu=20)
    DFN.params['h']['value'] = 0.1
    DFN.params['orientationOption']['value'] = 1
    DFN.params['boundaryFaces']['value'] = [1, 1, 1, 1, 1, 1]
    DFN.params['stopCondition']['value'] = 1
    DFN.params['domainSize']['value'] = [100, 100, 100]
    if run > 1:
        Seed = random.randint(1, 99999)

    else:
        Seed = 3625
    DFN.params['seed']['value'] = Seed

    # Generate the DFN
    rmin_FDMB = 4.5
    rmax_FDMB = 56.4
    FDMB_P32 = [0.15,0.24,0.3,0.1,0.21]
    FDMB_kappa = [20,18,17,16,19]
    FDMB_trend = [65, 344, 281, 174, 175]
    FDMB_plunge = [17, 38, 29, 22, 75]
    powerlaw_a = 1.6
    FDMB_a = 5.3E-11
    FDMB_b = 0.5
    FDMB_P32_total = 0.1 
    for i in range(len(FDMB_P32)):
        DFN.add_fracture_family(shape='rect',
                                distribution='tpl',
                                kappa=FDMB_kappa[i],
                                p32=FDMB_P32_total*FDMB_P32[i],
                                aspect=1.0,
                                trend=FDMB_trend[i],
                                plunge=FDMB_plunge[i],
                                alpha=powerlaw_a,
                                min_radius=rmin_FDMB,
                                max_radius=rmax_FDMB,
                                hy_variable='transmissivity',
                                hy_function='correlated',
                                hy_params={
                                    "alpha": FDMB_a,
                                    "beta": FDMB_b
                                })
    try:
        DFN.make_working_directory(delete=True)
        DFN.check_input()
        DFN.create_network()
    except:
        run += 1
        continue
    # give the region to make sure fracture crossing, if not change the Seed
    xmin, xmax = -10, 10
    ymin, ymax = 30, 50
    zmin, zmax = 0, 50
    data = np.loadtxt(jobname+'/dfnGen_output/intersection_list.dat',
                        skiprows=1, usecols=(2, 3, 4))
    point_in_range = any(xmin <= x <= xmax and
                        ymin <= y <= ymax and
                        zmin <= z <= zmax for x, y, z in data)
    if point_in_range == True:
        # set the well and meshing
        inject_well = {"name": 'inject', "filename": "well_inject.dat","r":4}
        wells = [inject_well]
        os.symlink(f"{example_path}/{inject_well['filename']}",f"{inject_well['filename']}")
        DFN.find_well_intersection_points(wells)
        DFN.mesh_network(well_flag=True)
        DFN.tag_well_in_mesh(wells)
        DFN.cleanup_wells(wells)
        os.chdir(DFN.jobname)
        DFN.combine_well_boundary_zones(wells)
        # combine the well_inject.zone to allboundaries.zone file (inflow zone index number 7)
        fzone = open(jobname +"/allboundaries.zone", "r")
        lines = fzone.readlines()
        a = open(jobname +"/well_inject.zone", "r")
        line = a.readlines()
        line[1] = '000007     well_inject\n'
        writeline = []
        for i in lines[:-2]:
            writeline.append(i)
        for j in line[1:]:
            writeline.append(j)
        with open(jobname +"/allboundaries.zone", "w") as fall:
            fall.writelines(writeline)
        # flow simulation
        DFN.dfn_flow()
        # particle tracking
        DFN.dfn_trans()
        A = False
    else:
        run += 1
        continue
print('Case complete')
hymanjd commented 9 months ago

That’s fine, but dfnTrans doesn’t know how to look for that

From: Wei @.> Reply-To: lanl/dfnWorks @.> Date: Monday, January 8, 2024 at 10:11 AM To: lanl/dfnWorks @.> Cc: Jeffrey Hyman @.>, Comment @.***> Subject: [EXTERNAL] Re: [lanl/dfnWorks] Question for particle tracking (Issue #72)

In my python code ,I write data from well_inject.zonehttps://urldefense.com/v3/__http:/well_inject.zone__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCGLYvwi9$ into allboundaries.zonehttps://urldefense.com/v3/__http:/allboundaries.zone__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCI0mU9rH$, modifying the index to 7. Here is a portion of the code.

fzone = open(jobname +"/allboundaries.zonehttps://urldefense.com/v3/__http:/allboundaries.zone__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCI0mU9rH$", "r")

lines = fzone.readlines()

a = open(jobname +"/well_inject.zonehttps://urldefense.com/v3/__http:/well_inject.zone__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCGLYvwi9$", "r")

line = a.readlines()

line[1] = '000007 well_inject\n'

writeline = []

for i in lines[:-2]:

writeline.append(i)

for j in line[1:]:

writeline.append(j)

with open(jobname +"/allboundaries.zonehttps://urldefense.com/v3/__http:/allboundaries.zone__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCI0mU9rH$", "w") as fall:

fall.writelines(writeline)

This setup treats the well zone as an inflow boundary and set value 7 in PTDFN_control.dat, with the outflow boundary set as 6 (back_n). Here is a full code.

import random

from pydfnworks import *

import os

import numpy as np

example_path = os.getcwd()

jobname = f"{example_path}/well_example_output"

dfnFlow_file = f"{example_path}/dfn_pressure.inhttps://urldefense.com/v3/__http:/dfn_pressure.in__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCABPfVU1$"

dfnTrans_file = f"{example_path}/PTDFN_control.dat"

A = True

run = 1

while A == True:

DFN = DFNWORKS(jobname,

           dfnFlow_file=dfnFlow_file,

           dfnTrans_file=dfnTrans_file,

           ncpu=20)

DFN.params['h']['value'] = 0.1

DFN.params['orientationOption']['value'] = 1

DFN.params['boundaryFaces']['value'] = [1, 1, 1, 1, 1, 1]

DFN.params['stopCondition']['value'] = 1

DFN.params['domainSize']['value'] = [100, 100, 100]

if run > 1:

    Seed = random.randint(1, 99999)

else:

    Seed = 3625

DFN.params['seed']['value'] = Seed

# Generate the DFN

rmin_FDMB = 4.5

rmax_FDMB = 56.4

FDMB_P32 = [0.15,0.24,0.3,0.1,0.21]

FDMB_kappa = [20,18,17,16,19]

FDMB_trend = [65, 344, 281, 174, 175]

FDMB_plunge = [17, 38, 29, 22, 75]

powerlaw_a = 1.6

FDMB_a = 5.3E-11

FDMB_b = 0.5

FDMB_P32_total = 0.1

for i in range(len(FDMB_P32)):

    DFN.add_fracture_family(shape='rect',

                            distribution='tpl',

                            kappa=FDMB_kappa[i],

                            p32=FDMB_P32_total*FDMB_P32[i],

                            aspect=1.0,

                            trend=FDMB_trend[i],

                            plunge=FDMB_plunge[i],

                            alpha=powerlaw_a,

                            min_radius=rmin_FDMB,

                            max_radius=rmax_FDMB,

                            hy_variable='transmissivity',

                            hy_function='correlated',

                            hy_params={

                                "alpha": FDMB_a,

                                "beta": FDMB_b

                            })

try:

    DFN.make_working_directory(delete=True)

    DFN.check_input()

    DFN.create_network()

except:

    run += 1

    continue

# give the region to make sure fracture crossing, if not change the Seed

xmin, xmax = -10, 10

ymin, ymax = 30, 50

zmin, zmax = 0, 50

data = np.loadtxt(jobname+'/dfnGen_output/intersection_list.dat',

                    skiprows=1, usecols=(2, 3, 4))

point_in_range = any(xmin <= x <= xmax and

                    ymin <= y <= ymax and

                    zmin <= z <= zmax for x, y, z in data)

if point_in_range == True:

    # set the well and meshing

    inject_well = {"name": 'inject', "filename": "well_inject.dat","r":4}

    wells = [inject_well]

    os.symlink(f"{example_path}/{inject_well['filename']}",f"{inject_well['filename']}")

    DFN.find_well_intersection_points(wells)

    DFN.mesh_network(well_flag=True)

    DFN.tag_well_in_mesh(wells)

    DFN.cleanup_wells(wells)

    os.chdir(DFN.jobname)

    DFN.combine_well_boundary_zones(wells)

    # combine the well_inject.zone<https://urldefense.com/v3/__http:/well_inject.zone__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCGLYvwi9$> to allboundaries.zone<https://urldefense.com/v3/__http:/allboundaries.zone__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCI0mU9rH$> file (inflow zone index number 7)

    fzone = open(jobname +"/allboundaries.zone<https://urldefense.com/v3/__http:/allboundaries.zone__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCI0mU9rH$>", "r")

    lines = fzone.readlines()

    a = open(jobname +"/well_inject.zone<https://urldefense.com/v3/__http:/well_inject.zone__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCGLYvwi9$>", "r")

    line = a.readlines()

    line[1] = '000007     well_inject\n'

    writeline = []

    for i in lines[:-2]:

        writeline.append(i)

    for j in line[1:]:

        writeline.append(j)

    with open(jobname +"/allboundaries.zone<https://urldefense.com/v3/__http:/allboundaries.zone__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCI0mU9rH$>", "w") as fall:

        fall.writelines(writeline)

    # flow simulation

    DFN.dfn_flow()

    # particle tracking

    DFN.dfn_trans()

    A = False

else:

    run += 1

    continue

print('Case complete')

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/issues/72*issuecomment-1881497135__;Iw!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCCFrGERU$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AEKOGDC27242BCHKTWEWEUTYNQSDTAVCNFSM6AAAAABBRFEHLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGQ4TOMJTGU__;!!Bt8fGhp8LhKGRg!ETYwD3fX6SXODJoM1ZfCa8_4IOfxHy1fs3H158i82DyKrQAJKS6zCJxojtuqUHTjYtGfYMqHIVAjhH6FCFzcws9a$. You are receiving this because you commented.Message ID: @.***>

l20000719 commented 9 months ago

But when I use the particle tracking option 7 and 1 particles start from in-flow zone for each node , it works! Here is the ouput console

---------------------BOUNDARY CONDITIONS----------------------

 OPEN AND READ FILE: allboundaries.zone 

 Read the number and indices of nodes defined in flow in and flow out zones  

 Number of nodes 10903 in flow-in zone.  

 Number of nodes 122 in flow-out  zone.  
Total in-flow volumetric flux =  1.96817e-19 [m^3/s] 
Total out-flow volumetric flux = -1.77831e-11 [m^3/s]
  GRID CHECK starts 
  GRID CHECK is done 

 Converting 3d nodes coordinates to 2d xy parallel plane 

----------------VELOCITY RECONSTRUCTION-----------------------

 Darcy's velocities reconstruction 
 Velocities on nodes are calculated 

------------------PARTICLE TRACKING---------------------------

Fracture Intersection Rule: Complete Mixing 
Number of fractures in the in-flow boundary zone: 6

***************************************************
Seeding 10903 particles
There are 2000000 time steps in the current run
***************************************************

***************************************************
Starting Main Loop on Particles
***************************************************
1091 particles out of 10903 have completed (10.01%)
1091 particles out of 1091 have exited successfully.

2181 particles out of 10903 have completed (20.00%)
2181 particles out of 2181 have exited successfully.

3271 particles out of 10903 have completed (30.00%)
3271 particles out of 3271 have exited successfully.

4362 particles out of 10903 have completed (40.01%)
4362 particles out of 4362 have exited successfully.

5452 particles out of 10903 have completed (50.00%)
5452 particles out of 5452 have exited successfully.

6542 particles out of 10903 have completed (60.00%)
6542 particles out of 6542 have exited successfully.

7633 particles out of 10903 have completed (70.01%)
7633 particles out of 7633 have exited successfully.

8723 particles out of 10903 have completed (80.01%)
8723 particles out of 8723 have exited successfully.

9813 particles out of 10903 have completed (90.00%)
9813 particles out of 9813 have exited successfully.

***************************************************
Main Loop on Particles Complete
***************************************************

Number of particles completed 10903, number of particles that went out through out-flow boundary: 5844 

***************************************************
DFNTrans completed successfully.
Finish Time: Mon Jan  8 17:08:48 2024
***************************************************

================================================================================

dfnTrans Complete

Time Required for dfnTrans: 80.66 Seconds

================================================================================

and my allboundary.zone is:

zone
000001     top
nnum
       330
    ...
000002     bottom
nnum
       447
     ...
000003     left_w
nnum
       269
    ...
000004     front_n
nnum
       491
    ...
000005     right_e
nnum
       849
     ...
000006     back_s
nnum
       122
     ...
    396415     396541
000007     well_inject
nnum
     10903
    ...

stop

As you can see that the optput console show that the number of nodes in in-flow zone is 10903, and the number of nodes in my rewrited allboudary zone 7 "well_inject" also 10903.

hymanjd commented 9 months ago

Interesting. Not sure why the box option isn't working then. Can you send me your full_mesh.inp file over transfer.lanl.gov? @jhyman

hymanjd commented 9 months ago

Please send it over transfer.lanl.gov. Thank you

From: Wei @.> Reply-To: lanl/dfnWorks @.> Date: Monday, January 8, 2024 at 10:34 AM To: lanl/dfnWorks @.> Cc: Jeffrey Hyman @.>, Comment @.***> Subject: [EXTERNAL] Re: [lanl/dfnWorks] Question for particle tracking (Issue #72)

I concur, the subject matter is indeed intriguing. I have also forwarded the file to your gmail.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/issues/72*issuecomment-1881535606__;Iw!!Bt8fGhp8LhKGRg!DQRbdFcU6Y7LWCYbkv8odlKQjBRBtR529ETA06CLFGjkKAcXADN9QqECpjQ08fgbx4vJgw8-o0fHMxArnDPCO_nL$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AEKOGDFONH5QG66ZXYNJLU3YNQU2RAVCNFSM6AAAAABBRFEHLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRGUZTKNRQGY__;!!Bt8fGhp8LhKGRg!DQRbdFcU6Y7LWCYbkv8odlKQjBRBtR529ETA06CLFGjkKAcXADN9QqECpjQ08fgbx4vJgw8-o0fHMxArnG4sEP--$. You are receiving this because you commented.Message ID: @.***>

l20000719 commented 9 months ago

Okay, I have sent it via transfer.lanl.gov, using my email address (l20000719@gmail.com) as the name.

l20000719 commented 9 months ago

image

hymanjd commented 9 months ago

thanks. I'll look into why option 7 isn't working.

l20000719 commented 9 months ago

Apologies for the correction: I intend to release particles in the box region, specifically in the well injection zone, which is option 3, not 7(option 7 works fine).Also thanks for your reply!

hymanjd commented 9 months ago

ah, you cannot use option 3 on anything but an domain edge. Sorry.

l20000719 commented 9 months ago

Okay, so is there any way or other option to let me release the n number of particles from well ? This is the apprch I can think of: Place the well at the boundary of the domain edge, allowing the release of n particles using option 3 ?

hymanjd commented 9 months ago

There was once on a branch. I’ll check if it made it into the master / release

From: Wei @.> Reply-To: lanl/dfnWorks @.> Date: Monday, January 8, 2024 at 2:09 PM To: lanl/dfnWorks @.> Cc: Jeffrey Hyman @.>, Comment @.***> Subject: [EXTERNAL] Re: [lanl/dfnWorks] Question for particle tracking (Issue #72)

Okay, so is there any way or other option to let me release the n number of particles from well ? This is the approach I can think of: Place the well at the boundary of the domain edge, allowing the release of n particles using option 3.

— Reply to this email directly, view it on GitHubhttps://urldefense.com/v3/__https:/github.com/lanl/dfnWorks/issues/72*issuecomment-1881823129__;Iw!!Bt8fGhp8LhKGRg!CxA7LtFzZ75satkZMUgUZ2wf8fsEW7RWcbUNTeySl02X32kgSW7lgvAMiITzWJW34rbNWEWTavAmkoEoFR59_toj$, or unsubscribehttps://urldefense.com/v3/__https:/github.com/notifications/unsubscribe-auth/AEKOGDEE3ELDMJ5YYZBXZ2TYNRN4TAVCNFSM6AAAAABBRFEHLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBRHAZDGMJSHE__;!!Bt8fGhp8LhKGRg!CxA7LtFzZ75satkZMUgUZ2wf8fsEW7RWcbUNTeySl02X32kgSW7lgvAMiITzWJW34rbNWEWTavAmkoEoFb53Clq7$. You are receiving this because you commented.Message ID: @.***>

l20000719 commented 9 months ago

Thanks a lot!

l20000719 commented 9 months ago

I apologize for the interruption again. I have another question. When I mesh the network , I noticed that the mesh around the wells and intersecting fractures does not seem to be refined. (as the figure below).

image

As you can see, the mesh is refined at the intersections of fractures, but there is no refinement between the wells and fractures. Here is the code when I mesh the network.

...
inject_well = {"name": 'inject', "filename": "well_inject.dat","r":4}
wells = [inject_well]
os.symlink(f"{example_path}/{inject_well['filename']}",f"{inject_well['filename']}")
DFN.find_well_intersection_points(wells)
DFN.mesh_network(well_flag=True)
DFN.tag_well_in_mesh(wells)
DFN.cleanup_wells(wells)
os.chdir(DFN.jobname)
DFN.combine_well_boundary_zones(wells)
...