🇨🇳中文README请点击这里🇨🇳
V1.0.0
- Basic pore-network model seepage simulation and dispersion simulation.
- Change calculation of unit size from multi-attemption method to equation-solving method, and accelerate the construction speed.
The main problem to solve in this project is: to simulate the gas transportation in porous media according to Effective Pore Network Model.
The effective pore network is a model to describe soil media. It consists of grid-arranged pores to represent pores in real media, and pore throat to connect pores with each other. Differents parameters like pore size, throat size and coordination number can stand for the soil media accordingly.
This project is transferred and reconstructed from Matlab to Python.
1. parameterization network
This project describes the effective pore network according to parameters like pore size, throat size, throat curvature, coordination number etc., and the specific parameterization network is generated.
2. Randomly construction
Each parameter will acquire randomness due to the deviation in settings, and various network can be constructed.
3. Seperating task and data
Seperate network status and solver from each other, which will bring convinience for recovery of calculation status, and provide basis for multi-thread and distributed calculation.
4. Improvement of iteration
Add Jacobi / Gauss-Sedial iteration apart from time step iteration. Without providing time step parameters, the newly added iteration method will converge easier and faster.
5.Using config file
Set the parameters in specific config file, rather than change in code.
PoreNetworkSimulation ── Project Directory
│
├─ src ── Source Code
│ │
│ ├─ config ── Config
│ │ ├─ config.ini.sample ── Config Sample
│ │ └─ config.ini ── Your Config File
│ │
│ ├─ data ── Data
│ │ ├─ seepage_<name>_cache.obj ── Data of Seepage Caching
│ │ ├─ seepage_<name>_status.obj ── Data of Network Status
│ │ ├─ dispersion_<name>_massflux.obj ── Data of Mass Flux
│ │ ├─ dispersion_<name>_velocity.obj ── Data of Velocity
│ │ └─ dispersion_<name>_paths.txt ── Data of Dispersion Paths
│ │
│ ├─ log ── Log
│ │ ├─ seepage_<name>.log ── Seepage Simulation Log
│ │ └─ dispersion_<name>_massflux.obj ── Dispersion Simulation Log
│ │
│ ├─ entity ── Entity
│ │ ├─ GasConstant.py ── Gas Parameters Class
│ │ ├─ NetworkStatus.py ── Network Status Class
│ │ ├─ NetworkStructure.py ── Network Structure Class
│ │ ├─ Simulator.py ── Simulator Class
│ │ └─ StatusCache.py ── Status Cache Class
│ │
│ ├─ model ── Simulation Model
│ │ ├─ CalculatePermeability.py ── Seepage Simulation Model
│ │ └─ Dispersion.py ── Dispersion Simulation Model
│ │
│ └─ utils ── Utilization
│ └─ Tools.py ── Tools Class
│
├─ .idea ── Project Config
│
└─ requirements.txt ── Project Requirements
This model is created to simulate stable flow in peameability test (two opposite boundary is fixed pressure).
Input:
- network parameters (config:
[network]
) - gas parameters (config:
[gas]
) - boundary condition and initial condition (config:
[status]
) - solver type and settings (config:
[solver]
) - iteration setting and finish condition (config:
[iteration]
) - (optional) intermediate result (if you want to recover)
Output:
- Peameability result (if you set
iteration.showPermeability
> 0) - Network pressure status (save in
src/data/seepage_<name>_status.obj
)
Structure of src/data/seepage_<name>_status.obj
:
seepage_<name>_status.obj ── (object) Network Status
├─ sc ── (object) Network Status Config
│ ├─ boundary_type ── (array[6]) Boundary Type
│ ├─ boundary_value ── (array[6]) Boundary Value
│ ├─ initial_type ── (int) Initial Type
│ └─ initial_value ── (array[6]) Initial Value
├─ ns ── (object) Network Structure
│ ├─ nc ── (object) Network Structure Config
│ │ ├─ model_size ── (array[3]) Model Size
│ │ ├─ character_length ── (float) Character Length
│ │ ├─ unit_size ── (float) Unit Size
│ │ ├─ radius_params ── (array[2]) Radius Size Ave & Std
│ │ ├─ curvature ── (float) Throat Curvature
│ │ ├─ throat_params ── (array[2]) Throat Size Ave & Std
│ │ ├─ coor_params ── (array[2]) Coordination Number Size Ave & Std
│ │ ├─ porosity ── (float) Porosity
│ │ └─ anisotropy ── (array[3]) Anisotropy
│ ├─ model_size ── (array[3]) Model Size
│ ├─ character_length ── (float) Character Length
│ ├─ radii ── (array[x,y,z]) Pore Radii
│ ├─ throatR ── (array[x,y,z,26]) Throat Radii
│ ├─ weight ── (array[x,y,z,26]) Throat Weight
│ ├─ unit_size ── (float) Unit Size
│ └─ porosity ── (float) True Porosity
├─ gc ── (object) Gas parameters
│ ├─ M ── (float) Molar Mass
│ ├─ R ── (float) Ideal Gas Constant
│ ├─ T ── (float) Temperature
│ └─ u ── (float) Viscosity
├─ model_size ── (array[3]) Model Size
└─ pressure ── (array[x,y,z]) Pore Pressure
This model is created to calculate dispersion in network according to simulate each particles random movement. It will produce the paths for each particles.
Input:
- dispersion parameters (config:
[dispersion]
) - network status calculted by 4.1. (
src/data/seepage_<name>_status.obj
)
Output:
- Particles position in each time step (save in
src/data/dispersion_<name>_paths.txt
).
Structure of src/data/dispersion_<name>_paths.txt
:
Linear store of paths (array[particles, total-time-steps, 4]). So it is arranged by:
particle1_time1
particle1_x1
particle1_y1
particle1_z1
particle1_time2
particle1_x2
particle1_y2
particle1_z2
...
particle2_time1
particle2_x1
particle2_y1
particle2_z1
...
Use reshape(path-data, particles, total-time-steps, 4)
will be useful when analyzing.
This project runs under Python 2.7.
- Install Python 2.7 from official website.
- Remember to add your python into PATH.
- Enter the project directory. Use
pip install -r requirements.txt
to install project requirements.
- Switch to directory
src/config
, set parameters for simulation in fileconfig.ini
. - Switch to directory
src/model
, run fileCalculatePermeability.py
or use commandpython -u CalculatePermeability.py
. - The running log will show in screen and store in directory
src/log/seepage_<name>.log
. If you choose to save intermediate results in config file, the data will temperately store insrc/data/seepage_<name>_status_<step>.obj
. - When the pressure change in one step is less than your setting, the program will stop, and network status data will store in
src/data/seepage_<name>_status.obj
.
- Switch to directory
src/config
, set parameters for simulation in fileconfig.ini
. - Switch to directory
src/model
, run fileDispersion.py
or use commandpython -u Dispersion.py
. - The running log will show in screen and store in directory
src/log/dispersion_<name>.log
. - The final path result will store in
src/data/dispersion_<name>_paths.txt
.
When running permeability simulation, you can choose to save the intermediate and final result, and it is mainly for recover from stop or continue the unfinished calculation. However, there will be a situation like this:
When you run permeability simulation, if you set the parameter iteration.save != 0
, there will be intermediate results and final results saved in directory. And when you run the program at the second time, the program will automatically find the data file like pattern src/data/seepage_<name>_status.obj
. As the result, your network will rebuild from the existing file (the same as the earlier one), and the simulation will continue. So if you want to build a new network and restart the simulation, please choose the following tips:
- Delete the file
src/data/seepage_<name>_status.obj
- Change your file name
iteration.fileName
- Set parameter
iteration.save = 0
when first simulation, and it will not save any result.