Skip to content

Commit 0e7c745

Browse files
docs draft
1 parent baf7a70 commit 0e7c745

File tree

2 files changed

+80
-0
lines changed

2 files changed

+80
-0
lines changed
356 KB
Loading
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
```@meta
2+
EditURL = "../../../tutorials/Tutorial_NumericalModel_3D.jl"
3+
```
4+
5+
# Simple model of a magmatic chamber with a volcano on top
6+
7+
### Aim
8+
The aim of this tutorial is to show you how to create 3D numerical model setups that can be used as initial setups for other codes.
9+
10+
### Generating the model
11+
12+
Lets start with creating a 3D model setup in cartesian coordinates, which uses the `CartData` data structure, with a resolution of $ 128 \times 128 \times 128 $ inside the domain $\Omega \in [-100,100] \times [-100,100] \times [-110,50]$ km
13+
14+
```julia
15+
using GeophysicalModelGenerator
16+
17+
nx,ny,nz = 128, 128, 128
18+
x = range(-100, 100, nx);
19+
y = range(-100, 100, ny);
20+
z = range(-110, 50, nz);
21+
Grid = CartData(xyz_grid(x,y,z));
22+
```
23+
24+
Now we create an integer array that will hold the `Phases` information (which usually refers to the material or rock type in the simulation)
25+
26+
```julia
27+
Phases = fill(0, nx, ny, nz);
28+
```
29+
30+
And as in the previous tutorials we initialize the temperature field:
31+
```julia
32+
Temp = fill(1350.0, nx,ny,nz);
33+
```
34+
35+
For simplicity, we will asume a model with thee horizontal layers with different rheology where later we add the volcano and the magmatic chamber. We use `add_box!` to generate the initial horizontally layered model:
36+
37+
```julia
38+
lith = LithosphericPhases(Layers=[15 45 100], Phases=[1 2 3])
39+
add_box!(Phases, Temp, Grid;
40+
xlim=(-100, 100),
41+
ylim=(-400, 400.0),
42+
zlim=(-110.0, 0.0),
43+
phase = lith,
44+
T = HalfspaceCoolingTemp(Age=20)
45+
)
46+
```
47+
48+
Then we can add the volcanic shape using `add_volcano!` function. In this case the base of the volcano will be centered at $x_i = (0,0,0)$, with a height of 10 km and a 15 km radius:
49+
```julia
50+
add_volcano!(Phases, Temp, Grid;
51+
volcanic_phase = 1,
52+
center = (0, 0, 0),
53+
height = 10,
54+
radius = 15,
55+
base = 0.0,
56+
background = nothing,
57+
T = HalfspaceCoolingTemp(Age=20)
58+
)
59+
```
60+
61+
```julia
62+
add_ellipsoid!(Phases, Temp, Grid;
63+
cen = (0, 0, -40),
64+
axes = (10, 10, 10),
65+
phase = ConstantPhase(4),
66+
)
67+
```
68+
69+
```julia
70+
@. Temp[Phases == 4] = 1400
71+
@. Temp[Phases == 0] = 0
72+
Grid = addfield(Grid, (;Phases, Temp))
73+
```
74+
75+
```julia
76+
write_paraview(Grid,"VolcanoModel3D");
77+
```
78+
79+
And the resulting image looks like
80+
![Mechanical3D_Tutorial_2](../assets/img/VolcanoModel3D.png)

0 commit comments

Comments
 (0)