Skip to content

Commit

Permalink
update docs and project version
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskaus committed Jul 20, 2023
1 parent e853fe5 commit fc0eb27
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LaMEM"
uuid = "2e889f3d-35ce-4a77-8ea2-858aecb630f7"
authors = ["Boris Kaus <kaus@uni-mainz.de>"]
version = "0.1.15"
version = "0.2.0"

[deps]
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Expand Down
37 changes: 18 additions & 19 deletions docs/src/man/juliasetup_LaPalma.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ julia> using LaMEM, GeophysicalModelGenerator, GMT, Plots
Loading GMT routines within GMG
WARNING: using GMT.meshgrid in module GeophysicalModelGenerator conflicts with an existing identifier.
adding Plots.jl plotting extensions for LaMEM
```
```

Load the topography, choose a projection point & project the topography to cartesian coordinates:
```julia
Expand All @@ -23,7 +23,7 @@ CartData
z ϵ [ -4.38352685546875 : 2.414]
fields : (:Topography,)
attributes: ["note"]
```
```
This shows the dimensions of our domain in kilometers. The issue is that this projected topography is not an orthogonal grid, but (slightly) distorted. In any case, we see the approximate dimensions of the grid (in horizontal directions), so we can create an orthogonal grid on which to project this:

```julia
Expand Down Expand Up @@ -80,37 +80,37 @@ LaMEM grid with constant Δ:
z ϵ [-80.0 : 15.0]
Phases : range ϵ [0 - 0]
Temp : range ϵ [20.0 - 1350.0]
```
```

Set `Phases` to two everywhere:
```julia
julia> model.Grid.Phases .= 2;
```
```

Now set points above the topography to zero (will be air later), the ones above the topography but below zero to 'water` and below 40 km to mantle (if we had a Moho surface we could use that):
```julia
julia> AboveSurface!(model, Topo_LaMEM, phase=0, T=0)
julia> model.Grid.Phases[Z.<-0 .&& model.Grid.Phases .== 0] .= 1;
julia> model.Grid.Phases[Z.<-40] .= 3;
```
```

Finally, we define some magma chambers:
```julia
julia> AddSphere!(model, cen=(0,0,-35), radius=5, phase=ConstantPhase(5), T=ConstantTemp(1200));
julia> AddEllipsoid!(model, cen=(-1,0,-11), axes=(3,3,8), StrikeAngle=225, DipAngle=45, phase=ConstantPhase(5), T=ConstantTemp(1200));
julia> AddEllipsoid!(model, cen=(-0,0,-23), axes=(8,8,2), StrikeAngle=0, DipAngle=0, phase=ConstantPhase(5), T=ConstantTemp(1200));
```
```

We can plot a cross-section through the model:
```julia
```julia
julia> heatmap(model, x=0, field=:phase)
```
```
![LaPalma_CrossSection](LaPalma_CrossSection.png)


##### Set material properties

First we set air and water properties:
First, we set air and water properties:
```julia
julia> air = set_air(alpha=3e-5, G=1e10, nu=0.2, ch=10e6, fr=30)
Phase 0 (air):
Expand All @@ -124,7 +124,7 @@ Phase 0 (air):
Cp = 1000.0
k = 30.0
julia> water=deepcopy(air); water.Name="water"; water.ID=1
```
```
Next, we set the crust:
```julia
julia> crust = Phase(Name="Crust", ID=2, rho=2900, alpha=3e-5, disl_prof="Mafic_Granulite-Ranalli_1995",
Expand All @@ -139,22 +139,22 @@ Phase 2 (Crust):
alpha = 3.0e-5
Cp = 1000.0
k = 3.0
```
```
The mantle is done as a copy of that, while changing a few parameters:
```julia
julia> mantle = copy_phase(crust, Name="Mantle", ID=3, rho=3320.0, disl_prof="Dry_Olivine-Ranalli_1995", G=6.5e10, k=3.3);
```
```
And we define two different types of magma:
```julia
julia> andesite = Phase(Name="andesitic_magma",ID=4,rho=2700, alpha=3e-5, eta=1e18, G=1.5e10, nu=0.2, k=3, Cp=1000, T=980, ch=1e7, fr=30);
julia> dacite = copy_phase(andesite,Name="dacite_magma", ID=5, rho=2575.0, eta=1e19, T=800.0)
```
```

Now we add all of this to the model:
```julia
julia> rm_phase!(model)
julia> add_phase!(model, air, water, crust, mantle, andesite, dacite)
```
```
And check that we indeed have 6 phases:
```julia
julia> model
Expand All @@ -169,21 +169,20 @@ LaMEM Model setup
|-- Model setup options : Type=files;
|-- Output options : filename=output; pvd=1; avd=0; surf=0
|-- Materials : 0 phases;
```
```

##### Add topography to model
We can add the topography grid that we created earlier to the model with:
```julia
julia> add_topography!(model, Topo_LaMEM)
```
```

##### Set solver options

You will want to use a multigrid solver in this case:
```julia
julia> model.Solver = Solver(SolverType="multigrid", MGLevels=4)
```
```

### 3. Run LaMEM
Running LaMEM is simple; here on 4 processors:
Expand Down Expand Up @@ -211,4 +210,4 @@ Scaling parameters:
Viscosity : 1e+20 [Pa*s]
Stress : 1e+09 [Pa]
--------------------------------------------------------------------------
```
```
10 changes: 5 additions & 5 deletions notebooks/FallingSphere_1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ begin
import Pkg
Pkg.activate(mktempdir())
Pkg.add(Pkg.PackageSpec(name="LaMEM", rev="bk-julia-model-setup"))
using LaMEM, GeophysicalModelGenerator, Plots, PlutoUI
using LaMEM, GeophysicalModelGenerator, Plots, PlutoUI, GMT
end

# ╔═╡ 78136b07-5d33-407a-afcf-e0a656181043
Expand All @@ -33,7 +33,7 @@ We start with loading a few packages.
"""

# ╔═╡ 4cd42d73-d63d-4149-9062-037a82f54255

Topo = ImportTopo(lon = [-18.7, -17.1], lat=[28.0, 29.2], file="@earth_relief_03s.grd");

# ╔═╡ 03abfcd4-b3bb-44eb-ba97-c03d64126195
md"""
Expand All @@ -43,7 +43,7 @@ Next, we define a general model setup, in which we specify the units with which
"""

# ╔═╡ 4a533c45-2ad6-4970-963b-abbbc798275b
model = Model(Grid(nel=(16,16,16), x=[-1,1], y=[-1,1], z=[-1,1]),
model = Model(Grid(nel=(32,16,16), x=[-1,1], y=[-1,1], z=[-1,1]),
Time(nstep_max=20, dt_min=1e-3, dt=1, dt_max=10, time_end=100),
Solver(SolverType="multigrid", MGLevels=2),
Output(out_dir="example_1"))
Expand Down Expand Up @@ -108,7 +108,7 @@ It is often useful to plot the initial model setup. You can do this with the `he
"""

# ╔═╡ fb23a0a3-1485-4726-8b6e-1a810e50ce7a
heatmap(model, field=:phase, y=0)
heatmap(model, field=:phase, y=0.1)

# ╔═╡ 4e5cb7d3-f6c0-4dd9-b508-643e38335297
md"""
Expand Down Expand Up @@ -154,7 +154,7 @@ And use that to slice through time
"""

# ╔═╡ 66d66323-71a4-455a-9a7b-bd1ec3d5ae1c
heatmap(model, y=0, timestep=t, field=:phase, dim=3)
heatmap(model, y=0.2, timestep=t, field=:phase, dim=3)

# ╔═╡ 2cb9ffa5-48da-4d48-8381-51c5d8f65da5
md"""
Expand Down

0 comments on commit fc0eb27

Please sign in to comment.