Skip to content

Commit 07cce80

Browse files
authored
Refactor code (#12)
2 parents 5c01896 + 2a3de7a commit 07cce80

30 files changed

+646
-3579
lines changed

Project.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,9 @@ authors = ["Stefan Schmalholz, Ludovic Raess and contributors"]
44
version = "0.2.0"
55

66
[deps]
7-
BSON = "fbb218c0-5317-5bc6-957e-2ee96dd4b1f0"
87
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"
9-
Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59"
108
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
119
MAT = "23992714-dd62-5051-b70f-ba57cb901cac"
12-
ParallelRandomFields = "5519cec6-2252-4828-b89b-d1114f8bfbc2"
1310
ParallelStencil = "94395366-693c-11ea-3b26-d9b7aac5d958"
14-
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
1511
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
16-
ReferenceTests = "324d217c-45ce-50fc-942e-d289b448e8cf"
1712
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
18-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

README.md

Lines changed: 16 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,21 @@
33
[![Build Status](https://github.com/PTsolvers/PseudoTransientHMC.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/PTsolvers/PseudoTransientHMC.jl/actions/workflows/CI.yml?query=branch%3Amain)
44
[![DOI](https://zenodo.org/badge/299357364.svg)](https://zenodo.org/badge/latestdoi/299357364)
55

6-
This repository contains Pseudo-Transient (PT) routines resolving chemical reactions coupled to fluid flow in viscously defroming solid pourous matrix, so-called Hydro-Mechanical-Chemical (HMC) coupling. Example of such multi-physical processes relate to, e.g, the brucite-periclase reactions [(Schmalholz et al., 2020)](https://doi.org/10.1029/2020GC009351) and could explain the formation of olivine veins by dehydration of ductile serpentinite ([Schmalholz et al., 2023 - submitted](), [Schmalholz et al., 2022](https://doi.org/10.1002/essoar.10512291.2)).
76

8-
Pseudo-Transient approach relies in using physics-inspired transient terms within differential equations in order to iteratively converge to an accurate solution. The PT HMC routines are written using the [Julia programming language](https://julialang.org) and build upon the high-performance [ParallelStencil.jl](https://github.com/omlins/ParallelStencil.jl) package to enable for optimal execution on graphical processing units (GPUs) and multi-threaded CPUs.
7+
This repository contains Pseudo-Transient (PT) routines resolving chemical reactions coupled to fluid flow in viscously defroming solid pourous matrix, so-called Hydro-Mechanical-Chemical (HMC) coupling. Example of such multi-physical processes to understand, e.g, the formation of olivine veins by dehydration of ductile serpentinite ([Schmalholz et al., 2023 - submitted](), [Schmalholz et al., 2022](https://doi.org/10.1002/essoar.10512291.2)), or the brucite-periclase reactions [(Schmalholz et al., 2020)](https://doi.org/10.1029/2020GC009351).
98

10-
## Content
11-
* [Script list](#script-list)
12-
* [Usage](#usage)
13-
* [Output](#output)
14-
* [References](#references)
9+
![Serpentinite dehydration and olivine vein formation during ductile shearing](docs/viz_dehy.png)
10+
> Serpentinite dehydration and olivine vein formation during ductile shearing
1511
16-
## Script list
17-
The scripts are located in two distinct folders. The folders contain the Julia (and early Matlab) routines and the `.mat` file with the corresponding thermodynamic data to be loaded as look-up tables.
18-
19-
- The [scripts_2020](scripts_2020) folder relates to the [(Schmalholz et al., 2020)](https://doi.org/10.1029/2020GC009351) study. The "analytical" [`PT_HMC_bru_analytical.jl`](scripts_2020/PT_HMC_bru_analytical.jl) script includes a paramtetrisation of the solid and fluid densities and composition as function of fluid pressure to circumvent costly interpolation operations.
20-
21-
- The [scripts_2022](scripts_2022) folder contains the routines for the [(Schmalholz et al., 2022)](https://doi.org/10.1002/essoar.10512291.2) "preprint" study. The main scipt is [`PT_HMC_atg.jl`](scripts_2022/PT_HMC_atg.jl). _The "rand" version implements resolving HMC coupling given a random initial porosity distribution._
12+
Pseudo-Transient approach relies in using physics-motivated transient terms within differential equations in order to iteratively converge to an accurate solution. The PT HMC routines are written using the [Julia programming language](https://julialang.org) and build upon the high-performance [ParallelStencil.jl](https://github.com/omlins/ParallelStencil.jl) package to enable for optimal execution on graphics processing units (GPUs) and multi-threaded CPUs.
2213

23-
- The [scripts_2023](scripts_2023) folder contains the routines for the [(Schmalholz et al., _submitted_)]() study. The main scipt is [`DeHy.jl`](scripts_2023/DeHy.jl).
14+
## Script list
15+
The Julia scripts are located in the [scripts](scripts) folder which contains the routines for the [(Schmalholz et al., _submitted_)]() study.
16+
- The main script is [`DeHy.jl`](scripts/DeHy.jl);
17+
- The visualisation script is [`vizme_DeHy.jl`](scripts/vizme_DeHy.jl).
2418

2519
## Usage
26-
If not stated otherwise, all the routines are written in Julia and can be executed from the [Julia REPL], or from the terminal for improved performance. Output is produced using the [Julia Plots package].
20+
All the routines are written in Julia and can be executed from the [Julia REPL], or from the terminal for improved performance. Output is produced using [Makie.jl] (using the `CairoMakie` backend).
2721

2822
The either multi-threaded CPU or GPU backend can be selected by adding the appropriate flag to the `USE_GPU` constant, modifying either the default behaviour in the top-most lines of the codes
2923
```julia
@@ -46,40 +40,27 @@ julia> ]
4640
4741
(PseudoTransientHMC) pkg> activate .
4842
49-
(PseudoTransientHMC) pkg> add https://github.com/luraess/ParallelRandomFields.jl
50-
5143
(PseudoTransientHMC) pkg> instantiate
5244
```
5345
3. Run the script
5446
```julia-repl
55-
julia> include("PT_HMC_atg.jl")
47+
julia> include("DeHy.jl")
5648
```
5749

5850
### Example running the routine from the terminal
5951

60-
1. Launch the Julia executable using the project's dependencies `--project`, disabling array bound checking for enhanced performance `--check-bounds=no`, and using optimization level 3 `-O3`.
52+
Launch the Julia executable using the project's dependencies `--project`:
6153
```sh
62-
julia --project --check-bounds=no -O3 PT_HMC_atg.jl
54+
julia --project DeHy.jl
6355
```
64-
Additional startup flag infos can be found [here](https://docs.julialang.org/en/v1/manual/getting-started/#man-getting-started)
65-
66-
## Output
67-
The output of running the [`PT_HMC_bru_analytical.jl`](scripts_2020/PT_HMC_bru_analytical.jl) script on an Nvidia TitanXp GPU with `nx=1023, ny=1023`:
68-
69-
![PT-HMC code predicting brucite-periclase reaction](docs/PT_HMC_bru_1023x1023.png)
70-
71-
The output of running the [`PT_HMC_atg.jl`](scripts_2022/PT_HMC_atg.jl) script on an Nvidia Tesla V100 GPU with `nx=1023, ny=1023` (to be updated):
72-
73-
![PT-HMC code predicting olivine vein formation](docs/PT_HMC_atg_1023x1023.png)
74-
7556

7657
## References
77-
[Schmalholz, S. M., Moulas, E., Plümper, O., Myasnikov, A. V., & Podladchikov, Y. Y. (2020). 2D hydro‐mechanical‐chemical modeling of (De)hydration reactions in deforming heterogeneous rock: The periclase‐brucite model reaction. Geochemistry, Geophysics, Geosystems, 21, 2020GC009351. https://doi.org/10.1029/2020GC009351](https://doi.org/10.1029/2020GC009351)
58+
Schmalholz, S. M., Moulas, E., Plümper, O., Myasnikov, A. V., & Podladchikov, Y. Y. (2020). **2D hydro‐mechanical‐chemical modeling of (De)hydration reactions in deforming heterogeneous rock: The periclase‐brucite model reaction**. Geochemistry, Geophysics, Geosystems, 21, 2020GC009351. [https://doi.org/10.1029/2020GC009351](https://doi.org/10.1029/2020GC009351)
7859

79-
[Schmalholz, S. M., Moulas, E., Räss, L., & Müntener, O. (2022). Shear-driven formation of olivine veins by dehydration of ductile serpentinite: a numerical study with implications for transient weakening. ESS Open Archive. https://doi.org/10.1002/essoar.10512291.2](https://doi.org/10.1002/essoar.10512291.2)
60+
Schmalholz, S. M., Moulas, E., Räss, L., & Müntener, O. (2022). **Shear-driven formation of olivine veins by dehydration of ductile serpentinite: a numerical study with implications for transient weakening.** ESS Open Archive. [https://doi.org/10.1002/essoar.10512291.2](https://doi.org/10.1002/essoar.10512291.2)
8061

81-
[Schmalholz, S. M., Moulas, E., Räss, L., & Müntener, O. (submitted). Shear-driven formation of olivine veins by dehydration of ductile serpentinite: a numerical study with implications for porosity production and transient weakening. _Submitted to JGR_]()
62+
Schmalholz, S. M., Moulas, E., Räss, L., & Müntener, O. (submitted). **Shear-driven formation of olivine veins by dehydration of ductile serpentinite: a numerical study with implications for porosity production and transient weakening.** [_Submitted to JGR_]()
8263

8364
[CUDA.jl]: https://github.com/JuliaGPU/CUDA.jl
84-
[Julia Plots package]: https://github.com/JuliaPlots/Plots.jl
65+
[Makie.jl]: https://docs.makie.org/stable/
8566
[Julia REPL]: https://docs.julialang.org/en/v1/stdlib/REPL/

docs/PT_HMC_atg_1023x1023.png

-283 KB
Binary file not shown.

docs/PT_HMC_bru_1023x1023.png

-190 KB
Binary file not shown.

docs/viz_dehy.png

248 KB
Loading

0 commit comments

Comments
 (0)