Skip to content

Commit

Permalink
Merge branch 'main' into adm/powerlaw
Browse files Browse the repository at this point in the history
  • Loading branch information
albert-de-montserrat committed Oct 19, 2024
2 parents 9917eca + 2b4f474 commit aa97968
Show file tree
Hide file tree
Showing 15 changed files with 548 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling
uses: crate-ci/typos@v1.24.3
uses: crate-ci/typos@v1.25.0
23 changes: 20 additions & 3 deletions .github/workflows/blank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ on:
tags: '*'
pull_request:

# Cancel redundant CI tests automatically
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run_tests:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
Expand All @@ -15,17 +20,29 @@ jobs:
fail-fast: false
matrix:
version:
- '1.7'
- '1.8'
- '1.9'
- '1.10'
- '1.11'
- 'nightly'
os:
- ubuntu-latest
- macOS-latest
- macOS-13
- windows-latest
arch:
- x64
include:
- os: macOS-latest
arch: aarch64
version: '1.9'
- os: macOS-latest
arch: aarch64
version: '1.10'
- os: macOS-latest
arch: aarch64
version: '1.11'
- os: macOS-latest
arch: aarch64
version: 'nightly'
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
Expand Down
8 changes: 5 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "GeoParams"
uuid = "e018b62d-d9de-4a26-8697-af89c310ae38"
authors = ["Boris Kaus <kaus@uni-mainz.de>, Albert De Montserrat <albertdemontserratnavarro@erdw.ethz.ch>"]
version = "0.6.4"
version = "0.6.5"

[deps]
BibTeX = "7b0aa2c9-049f-5cec-894a-2b6b781bb25e"
Expand All @@ -15,7 +15,6 @@ LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Loess = "4345ca2d-374a-55d4-8d30-97f9976e7612"
MuladdMacro = "46d2c3a1-f734-5fdb-9937-b9b9aeba4221"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
Roots = "f2b01f46-fcfa-551c-844a-d8ac1e96c665"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
Expand Down Expand Up @@ -46,7 +45,6 @@ LinearAlgebra = "1.0"
Loess = "0.5,0.6"
MuladdMacro = "0.2.4"
Parameters = "0.12"
Requires = "0.5.0, 0.6, 0.7, 0.8, 1.0 - 1.3"
Roots = "1.0, 2.0"
Setfield = "0.5.1, 0.6, 0.7, 0.8, 1.0"
SpecialFunctions = "2.0"
Expand All @@ -62,3 +60,7 @@ julia = "1.7"
[extras]
GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Statistics"]
61 changes: 37 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@ We also implement some typically used creep law parameters, together with tools
NOTE: The package remains under development and the API is not yet fully fixed. Therefore feel free to look at it, but be aware that things may still change when you incorporate it into your codes. Comments/ideas/suggestions are highly apprecciated!

### Contents
* [1. Nondimensionalization](#1-nondimensionalization)
* [2. Material parameters](#2-material-parameters)
* [3. Plotting and output](#3-plotting-and-output)
* [4. Computational engine](#4-computational-engine)
* [5. Installation](#5-installation)
* [6. Documentation](#6-documentation)
* [7. Dependencies](#7-dependencies)
* [8. Contributing](#8-contributing)
* [9. Funding](#9-funding)
- [Contents](#contents)
- [1. Nondimensionalization](#1-nondimensionalization)
- [2. Material parameters](#2-material-parameters)
- [2.1 Constant density, constant linear viscosity](#21-constant-density-constant-linear-viscosity)
- [2.2 Nonlinear creep laws](#22-nonlinear-creep-laws)
- [3. Plotting and output](#3-plotting-and-output)
- [3.1 Plotting](#31-plotting)
- [3.2 Automatically create data tables](#32-automatically-create-data-tables)
- [4. Computational engine](#4-computational-engine)
- [5. Installation](#5-installation)
- [6. Documentation](#6-documentation)
- [7. Dependencies](#7-dependencies)
- [8. Contributing](#8-contributing)
- [9. Funding](#9-funding)

### 1. Nondimensionalization
Typical geodynamic simulations involve dimensions on the order of 10's-1000's of kilometers, and viscosities on the order of ~1e20 Pas. If such values are directly employed in numerical solvers, they may result in roundoff errors. It is therefore common practice to nondimensionalize the input parameters by dividing them by typical values such that the result gives numbers that are closer to one.
Expand Down Expand Up @@ -126,23 +131,30 @@ Phase 2 : Viscous Sinker
You can add pre-defined non-linear creep laws as:
```julia
julia> Phase = SetMaterialParams(Name="Viscous Matrix", Phase=2,
Density = ConstantDensity(),
CreepLaws = (SetDislocationCreep("Wet Olivine | Hirth & Kohlstedt (2003)"),
LinearViscous=1e23Pa*s)) )
Density = ConstantDensity(),
CompositeRheology = CompositeRheology(
SetDislocationCreep(Dislocation.wet_olivine_Hirth_2003),
LinearViscous=1e23Pa*s))
)
Phase 2 : Viscous Matrix
| [dimensional units]
|
|-- Density : Constant density: ρ=2900.0 kg m⁻³·
|-- Gravity : Gravitational acceleration: g=9.81 m s⁻²·
|-- CreepLaws : DislocationCreep: Name = Wet Olivine | Hirth & Kohlstedt (2003), n=3.5, r=1.2, A=90.0, E=480.0, V=1.1e-5, Apparatus=1
| Linear viscosity: η=1.0e23
|
|-- Name : Viscous Matrix
|-- Density : Constant density: ρ=2900.0 kg m⁻³·
|-- Gravity : Gravitational acceleration: g=9.81 m s⁻²·
|-- CompositeRheology : --⟦▪̲̅▫̲̅▫̲̅▫̲̅----⟦▪̲̅▫̲̅▫̲̅▫̲̅--
```
Note that the dictionary `DislocationCreep_info` has all pre-defined creep laws, so for an overview type:
Note that the functions `dislocation_law_list()` and `diffusion_law_list()` list all pre-defined creep laws, so for an overview type:
```julia
julia> DislocationCreep_info
Dict{String, DislocationCreep} with 2 entries:
"Dry Olivine | Hirth & Kohlstedt (2003)" => DislocationCreep: n=3.05, r=0, A=110000.0 MPa⁻³·⁰⁵ s⁻¹, E
"Wet Olivine | Hirth & Kohlstedt (2003)" => DislocationCreep: n=3.5, r=1.2, A=90 MPa⁻³·⁵ s⁻¹, E=480 k
julia> dislocation_law_list()
40-element Vector{Function}:
dry_anorthite_Rybacki_2000 (generic function with 1 method)
dry_olivine_Hirth_2003 (generic function with 1 method)
dry_olivine_Karato_2003 (generic function with 1 method)
dry_quartzite_Jaoul_1984 (generic function with 1 method)
wet_omphacite_Zhang_2006 (generic function with 1 method)
wet_quartzite_Hirth_2001 (generic function with 1 method)
```

### 3. Plotting and output
Expand All @@ -164,9 +176,10 @@ When writing scientific papers that describes numerical modelling results, it is
That is why we provide routines that fully automatize this process:
First, we need to define a phase.
```julia
julia> MatParam = (SetMaterialParams(Name="Viscous Matrix", Phase=1, Density=ConstantDensity(),CreepLaws = SetDislocationCreep("Quartz Diorite | Hansen & Carter (1982)")),
julia> import GeoParams.Dislocation
julia> MatParam = (SetMaterialParams(Name="Viscous Matrix", Phase=1, Density=ConstantDensity(),CreepLaws = SetDislocationCreep(Dislocation.quartz_diorite_HansenCarter_1982)),
SetMaterialParams(Name="Viscous Sinker", Phase=2, Density= PT_Density(),CreepLaws = LinearViscous=1e21Pa*s)),
SetMaterialParams(Name="Viscous Bottom", Phase=3, Density= PT_Density(),CreepLaws = SetDislocationCreep("Diabase | Caristan (1982)")))
SetMaterialParams(Name="Viscous Bottom", Phase=3, Density= PT_Density(),CreepLaws = SetDislocationCreep(Dislocation.diabase_Caristan_1982)))
```
Next, you can create a LaTeX table for the defined phase ...
```julia
Expand Down
2 changes: 2 additions & 0 deletions ext/GeoParamsGLMakieExt.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Package extension for adding GLMakie-based features to GeoParams.jl
module GeoParamsGLMakieExt

using GeoParams

# We do not check `isdefined(Base, :get_extension)` as recommended since
# Julia v1.9.0 does not load package extensions when their dependency is
# loaded from the main environment.
Expand Down
2 changes: 1 addition & 1 deletion src/Energy/Shearheating.jl
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ end

function compute_shearheating(s::AbstractMaterialParamsStruct, args::Vararg{Any,N}) where N
if isempty(s.ShearHeat)
return 0.0 # return zero if not specified
return 0e0 # return zero if not specified
else
return compute_shearheating(s.ShearHeat[1], args...)
end
Expand Down
37 changes: 18 additions & 19 deletions src/GeoParams.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ module GeoParams
using Parameters # helps setting default parameters in structures
using Unitful # Units
using BibTeX # references of creep laws
using Requires: @require # To only add plotting routines if GLMakie is loaded
using StaticArrays
using LinearAlgebra
using ForwardDiff
Expand Down Expand Up @@ -335,6 +334,18 @@ export compute_meltfraction,
Vector_MeltingParam,
SmoothMelting


using .MaterialParameters.Permeability
export compute_permeability,
compute_permeability!,
compute_permeability_ratio,
param_info,
AbstractPermeability,
ConstantPermeability,
HazenPermeability,
PowerLawPermeability,
CarmanKozenyPermeability

include("Traits/rheology.jl")
export RheologyTrait
export islinear, LinearRheologyTrait, NonLinearRheologyTrait
Expand Down Expand Up @@ -363,18 +374,18 @@ function creeplaw_list(m::Module)
out = string.(names(m; all=true, imported=true))
filter!(x -> !startswith(x, "#"), out)
return [getfield(m, Symbol(x)) for x in out if !isnothing(tryparse(Int, string(x[end]))) || endswith(x, "a") || endswith(x, "b")]
end
end

diffusion_law_list() = creeplaw_list(Diffusion)
dislocation_law_list() = creeplaw_list(Dislocation)
grainboundarysliding_law_list() = creeplaw_list(GBS)
nonlinearpeierls_law_list() = creeplaw_list(NonLinearPeierls)
peierls_law_list() = creeplaw_list(Peierls)

export diffusion_law_list,
dislocation_law_list,
grainboundarysliding_law_list,
nonlinearpeierls_law_list,
export diffusion_law_list,
dislocation_law_list,
grainboundarysliding_law_list,
nonlinearpeierls_law_list,
peierls_law_list

# Define Table output functions
Expand Down Expand Up @@ -420,18 +431,6 @@ export PlotStrainrateStress,
PlotPressureStressTime_0D,
StrengthEnvelopePlot

# We do not check `isdefined(Base, :get_extension)` as recommended since
# Julia v1.9.0 does not load package extensions when their dependency is
# loaded from the main environment.
function __init__()
@static if !(VERSION >= v"1.9.1")
@require GLMakie = "e9467ef8-e4e7-5192-8a1a-b1aee30e663a" begin
print("Adding plotting routines of GeoParams through GLMakie \n")
@eval include("../ext/GeoParamsGLMakieExt.jl")
end
end
end

#Set functions aliases using @use
include("aliases.jl")
export ntuple_idx
Expand All @@ -454,4 +453,4 @@ export get_G, get_Kb
const get_shearmodulus = get_G
const get_bulkmodulus = get_Kb

end # module GeoParams
end # module GeoParams
Loading

0 comments on commit aa97968

Please sign in to comment.