Skip to content

Commit 7bd1999

Browse files
committed
clean-up
1 parent 93eeb5a commit 7bd1999

File tree

8 files changed

+125
-225
lines changed

8 files changed

+125
-225
lines changed

README.md

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,26 @@
33

44
# Overview
55

6-
This project aims to use realizations of heterogeneous hydraulic conductivity with a binary inclusion structures for numerical subsurface flow and transport simulations.
7-
Code is available to (i) generate and (ii) visualize random conductivity structures of binary inclusions. Furthermore, routines are provided (iii) to perform flow and transport simulations making use of the FEM-solver OpenGeoSys and (iv) to post-process results.
6+
This project aims to use realizations of heterogeneous hydraulic conductivity with a binary inclusion structures for numerical subsurface flow and transport simulations.
7+
Code is available to (i) generate and (ii) visualize random conductivity structures of binary inclusions. Furthermore, routines are provided (iii) to perform flow and transport simulations making use of the FEM-solver OpenGeoSys and (iv) to post-process results.
88

99
## Structure
1010

11-
The project is organized as follows
12-
• README.md - description of the project
13-
• data/ - folder for data used in the project
14-
• results/
15-
• src/ - folder containing the Python scripts of the project:
16-
17-
Please try to organize your example in the given Structure
18-
- `README.md` - description of the project
19-
- `data/` - folder for data used in the project
20-
- `results/` - folder with simulation results and plots
21-
- `src/` - folder containing the Python scripts of the project:
22-
+ 01_plot_binary_inclusions.py
23-
+ 02_run_sim.py
24-
+ 03_run_ensemble.py
25-
+ binary_inclusions.py
26-
+ sim_processing.py
11+
The project is organized as follows:
12+
13+
- `README.md` - description of the project
14+
- `results/` - folder with simulation results and plots
15+
- `src/` - folder containing the Python scripts of the project:
16+
+ `01_plot_binary_inclusions.py` - generate and visualize inclusion structures
17+
+ `02_run_sim.py` - run OGS 5 simulation on inclusion structures according to MADE setting
18+
+ `03_run_ensemble.py` - run OGS 5 ensemble of transport simulations
19+
+ `binary_inclusions.py` - package containing inclusing structure classes
20+
+ `sim_processing.py` - package containing post-processing routines
2721

2822
## Python environment
2923

3024
To make the example reproducible, we provide the following files:
3125
- `requirements.txt` - requirements for [pip](https://pip.pypa.io/en/stable/user_guide/#requirements-files) to install all needed packages
32-
- `spec-file.txt` - specification file to create the original [conda environment](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#building-identical-conda-environments)
3326

3427
## Contact
3528

requirements.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
numpy
2-
matplotlib
1+
ogs5py==1.1.1
32
scipy
4-
copy
5-
gstools==1.2.1
6-
ogs5py
3+
matplotlib

spec-file.txt

Lines changed: 0 additions & 78 deletions
This file was deleted.

src/01_plot_binary_inclusions.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
#!/usr/bin/env python3
21
# -*- coding: utf-8 -*-
32
"""
43
Script to create and visualize random binary inclusion structures:
54
- simple inclusion structure
65
- block inclusion structure
7-
Fields are by default in 2D for visualization.
6+
Fields are by default in 2D for visualization.
87
98
Structures in 3D and different block arrangement can be created by modifying
109
setting parameters, particular dim and/or axis
@@ -23,10 +22,10 @@
2322
### Simple binary inclusion structure ###
2423
#########################################
2524

26-
### initialize simple binary inclusion structure with specified settings
27-
### as instance of the class Simple_Binary_Inclusions
25+
### initialize simple binary inclusion structure with specified settings
26+
### as instance of the class Simple_Binary_Inclusions
2827
BI = bi.Simple_Binary_Inclusions(
29-
dim=2, # dimesionality of structure
28+
dim=2, # dimesionality of structure
3029
k_bulk=1e-5, # bulk conductivity value
3130
k_incl=1e-3, # conductivity value of inclusions
3231
nx=8, # number of units in x-direction
@@ -54,12 +53,12 @@
5453
### Two block binary inclusion structure ###
5554
############################################
5655

57-
### initialize block binary inclusion structure with specified settings
56+
### initialize block binary inclusion structure with specified settings
5857
### as instance of the class Block_Binary_Inclusions
5958
BIB = bi.Block_Binary_Inclusions(
60-
dim=2, # dimesionality of structure
59+
dim=2, # dimesionality of structure
6160
axis=0, # direction of multiple blocks (0=x, 1=z, 2=y)
62-
k_bulk=[1e-5, 1e-3], # bulk-conductivity value in each block
61+
k_bulk=[1e-5, 1e-3], # bulk-conductivity value in each block
6362
k_incl=[1e-3, 1e-5], # conductivity values of inclusions in each block
6463
nn=[4, 18], # number of units within each block (now x-dir)
6564
ll=[10, 10], # unit lengths within blocks (now x-dir)

src/02_run_sim.py

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
1-
#!/usr/bin/env python3
21
# -*- coding: utf-8 -*-
32
"""
43
Subsurface flow and tranport simulation in a random binary inclusion structure
54
with the FEM solver of the groundwater flow equation and advection-dispersion-
65
equation OpenGeoSys.
76
8-
This script allows to perform a 2D simulation according to the flow and transport
9-
situation of the MADE-1 tracer tests (Columbus, Mississippi) in a 2D setting
10-
with a binary inclusion structure of hydraulic conductivity.
7+
This script allows to perform a 2D simulation according to the flow and transport
8+
situation of the MADE-1 tracer tests (Columbus, Mississippi) in a 2D setting
9+
with a binary inclusion structure of hydraulic conductivity.
1110
12-
Simulation are performed with the FEM solver OpenGeoSys (OGS5) for subsurface
13-
flow and transport controlled via the API ogs5py: Initialization of the project,
14-
writing files, simulation run and reading of simulation results. Setting-addapted
11+
Simulation are performed with the FEM solver OpenGeoSys (OGS5) for subsurface
12+
flow and transport controlled via the API ogs5py: Initialization of the project,
13+
writing files, simulation run and reading of simulation results. Setting-addapted
1514
conductivity fields are generated with the script binary_inclusions.
16-
15+
1716
@author: A. Zech
1817
Licence MIT, A.Zech, 2020
1918
"""
@@ -115,21 +114,21 @@
115114
sim.gli.add_polyline(points=[2, 3], name="top")
116115
sim.gli.add_polyline(points=[1, 2], name="right")
117116
sim.gli.add_polyline(
118-
points=[[0, domain["z_0"] + 5.2, 0], [0, domain["z_0"] + 5.8, 0]],
117+
points=[[0, domain["z_0"] + 5.2, 0], [0, domain["z_0"] + 5.8, 0]],
119118
name="source"
120119
)
121120
sim.gli.swap_axis("y", "z")
122121

123122
### ----------------------- properties------------------------------------- #
124123
sim.mfp.add_block( # FLUID_PROPERTIES
125-
FLUID_TYPE="LIQUID",
126-
PCS_TYPE="HEAD",
127-
DENSITY=[1, 1000.0],
124+
FLUID_TYPE="LIQUID",
125+
PCS_TYPE="HEAD",
126+
DENSITY=[1, 1000.0],
128127
VISCOSITY=[1, 0.001]
129128
)
130129
sim.mcp.add_block(
131-
NAME="CONCENTRATION1",
132-
MOBILE=1,
130+
NAME="CONCENTRATION1",
131+
MOBILE=1,
133132
DIFFUSION=[1, 1.0e-08]
134133
)
135134
sim.msp.add_block(DENSITY=[1, 2000])
@@ -142,14 +141,13 @@
142141
STORAGE="1 {}".format(storage),
143142
MASS_DISPERSION=[1, dispersivity_long, dispersivity_trans],
144143
)
145-
# sim.mmp.update_block(PERMEABILITY_TENSOR=['ISOTROPIC', '1e-6']) # for homogeneous K-distribution
146144

147145
### --------------------heterogeneous K: binary structure ------------------ #
148146

149147
sim.mpd.add(name="conductivity")
150148
sim.mpd.add_block(
151-
MSH_TYPE="GROUNDWATER_FLOW",
152-
MMP_TYPE="PERMEABILITY",
149+
MSH_TYPE="GROUNDWATER_FLOW",
150+
MMP_TYPE="PERMEABILITY",
153151
DIS_TYPE="ELEMENT"
154152
)
155153

@@ -269,7 +267,7 @@
269267
print("Write Tranport Simulation files to directory: {}".format(sim.task_root))
270268
sim.write_input()
271269

272-
sim.msh.export_mesh(# export binary conductivity structure for vtk-visualization
270+
sim.msh.export_mesh( # export binary conductivity structure for vtk-visualization
273271
filepath="{}/conductivity.vtu".format(sim.task_root),
274272
file_format="vtk",
275273
cell_data_by_id={"transmissivity": BI.kk_mesh},
@@ -284,7 +282,7 @@
284282
if success:
285283
print("Simulation finished successfully.")
286284
it_out = -1
287-
285+
288286
out = sim.readvtk()
289287
times = out[""]["TIME"]
290288
points = out[""]["DATA"][1]["points"]
@@ -301,8 +299,7 @@
301299
ax = fig.add_subplot(1, 1, 1)
302300
colormap = plt.get_cmap("bone_r")
303301

304-
# ixmax = int(100 / domain["dx"]) # limit plot in x-direction to 80m
305-
ixmax = int(200 / domain["dx"]) # limit plot in x-direction to 80m
302+
ixmax = int(200 / domain["dx"])
306303
ax.contourf(
307304
xmesh[:, :ixmax],
308305
zmesh[:, :ixmax],

src/03_run_ensemble.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#!/usr/bin/env python3
21
# -*- coding: utf-8 -*-
32
"""
4-
Script to run an ensemble of subsurface flow and transport simulations with
5-
OpenGeoSys (via the API ogs5py) on random binary inclusion structures of
3+
Script to run an ensemble of subsurface flow and transport simulations with
4+
OpenGeoSys (via the API ogs5py) on random binary inclusion structures of
65
hydraulic conductivity.
76
87
@author: A. Zech
@@ -111,37 +110,37 @@
111110
sim.gli.add_polyline(points=[2, 3], name="top")
112111
sim.gli.add_polyline(points=[1, 2], name="right")
113112
sim.gli.add_polyline(
114-
points=[[0, domain["z_0"] + 5.2, 0], [0, domain["z_0"] + 5.8, 0]],
113+
points=[[0, domain["z_0"] + 5.2, 0], [0, domain["z_0"] + 5.8, 0]],
115114
name="source"
116115
)
117116
sim.gli.swap_axis("y", "z")
118117

119118
### ----------------------- properties------------------------------------- #
120119
sim.mfp.add_block( # FLUID_PROPERTIES
121-
FLUID_TYPE="LIQUID",
122-
PCS_TYPE="HEAD",
123-
DENSITY=[1, 1000.0],
120+
FLUID_TYPE="LIQUID",
121+
PCS_TYPE="HEAD",
122+
DENSITY=[1, 1000.0],
124123
VISCOSITY=[1, 0.001]
125124
)
126125
sim.mcp.add_block(
127-
NAME="CONCENTRATION1",
128-
MOBILE=1,
126+
NAME="CONCENTRATION1",
127+
MOBILE=1,
129128
DIFFUSION=[1, 1.0e-08]
130129
)
131130
sim.msp.add_block(DENSITY=[1, 2000])
132131

133132
### --------------------heterogeneous K: binary structure ------------------ #
134133
BI.structure(seed=20201012 + sim_id)
135134
BI.structure2mesh(
136-
sim.msh.centroids_flat,
137-
x0=domain["x_0"],
135+
sim.msh.centroids_flat,
136+
x0=domain["x_0"],
138137
z0=domain["z_0"]
139138
)
140139

141140
sim.mpd.add(name="conductivity")
142141
sim.mpd.add_block(
143-
MSH_TYPE="GROUNDWATER_FLOW",
144-
MMP_TYPE="PERMEABILITY",
142+
MSH_TYPE="GROUNDWATER_FLOW",
143+
MMP_TYPE="PERMEABILITY",
145144
DIS_TYPE="ELEMENT"
146145
)
147146
sim.mpd.update_block(DATA=zip(range(len(BI.kk_mesh)), BI.kk_mesh))

0 commit comments

Comments
 (0)