-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #121 from albert-de-montserrat/adm/volcano
Adds volcano topography with corresponding temperature field
- Loading branch information
Showing
5 changed files
with
280 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# Simple model of a magmatic chamber with a volcano on top | ||
|
||
### Aim | ||
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. | ||
|
||
### Generating the model | ||
|
||
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 $ grid points, inside the domain $\Omega \in [-100,100] \times [-100,100] \times [-110,50]$ km | ||
|
||
```julia | ||
using GeophysicalModelGenerator | ||
|
||
nx,ny,nz = 128, 128, 128 | ||
x = range(-100, 100, nx); | ||
y = range(-100, 100, ny); | ||
z = range(-110, 50, nz); | ||
Grid = CartData(xyz_grid(x,y,z)); | ||
``` | ||
|
||
Now we create an integer array that will hold the `Phases` information (which usually refers to the material or rock type in the simulation) | ||
|
||
```julia | ||
Phases = fill(0, nx, ny, nz); | ||
``` | ||
|
||
And as in the previous tutorials we initialize the temperature field: | ||
```julia | ||
Temp = fill(1350.0, nx,ny,nz); | ||
``` | ||
|
||
For simplicity, we will assume 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: | ||
|
||
```julia | ||
lith = LithosphericPhases(Layers=[15 45 100], Phases=[1 2 3]) | ||
add_box!(Phases, Temp, Grid; | ||
xlim=(-100, 100), | ||
ylim=(-400, 400.0), | ||
zlim=(-110.0, 0.0), | ||
phase = lith, | ||
T = HalfspaceCoolingTemp(Age=20) | ||
) | ||
``` | ||
|
||
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: | ||
```julia | ||
add_volcano!(Phases, Temp, Grid; | ||
volcanic_phase = 1, | ||
center = (0, 0, 0), | ||
height = 10, | ||
radius = 15, | ||
base = 0.0, | ||
background = nothing, | ||
T = HalfspaceCoolingTemp(Age=20) | ||
) | ||
``` | ||
We can also add a magmatic chamber located below the volcano | ||
```julia | ||
add_ellipsoid!(Phases, Temp, Grid; | ||
cen = (0, 0, -40), | ||
axes = (10, 10, 10), | ||
phase = ConstantPhase(4), | ||
) | ||
``` | ||
|
||
where we prescribe a constant temperature of $T=1400^{\circ}C$ | ||
```julia | ||
@. Temp[Phases == 4] = 1400 | ||
Grid = addfield(Grid, (;Phases, Temp)) | ||
``` | ||
|
||
Finally we setup the temperature of the air to $T^{\text{air}}=0^{\circ}C$ | ||
```julia | ||
@. Temp[Phases == 0] = 0 | ||
``` | ||
|
||
```julia | ||
write_paraview(Grid,"VolcanoModel3D"); | ||
``` | ||
|
||
And the resulting image looks like | ||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using GeophysicalModelGenerator | ||
|
||
nx,ny,nz = 128, 128, 128 | ||
x = range(-100, 100, nx); | ||
y = range(-100, 100, ny); | ||
z = range(-110, 50, nz); | ||
Grid = CartData(xyz_grid(x,y,z)); | ||
|
||
# Now we create an integer array that will hold the `Phases` information (which usually refers to the material or rock type in the simulation) | ||
Phases = fill(0, nx, ny, nz); | ||
|
||
# In many (geodynamic) models, one also has to define the temperature, so lets define it as well | ||
Temp = fill(1350.0, nx, ny, nz); | ||
|
||
lith = LithosphericPhases(Layers=[15 45 100], Phases=[1 2 3]) | ||
|
||
# And an an inclined part: | ||
add_box!(Phases, Temp, Grid; | ||
xlim=(-100, 100), | ||
ylim=(-400, 400.0), | ||
zlim=(-110.0, 0.0), | ||
phase = lith, | ||
Origin = (0,0,0), | ||
T = HalfspaceCoolingTemp(Age=20)); | ||
|
||
|
||
# # Add them to the `CartData` dataset: | ||
Grid = addfield(Grid,(;Phases, Temp)) | ||
# heatmap(x, z, Grid.fields.Temp[:,64,:]) | ||
|
||
# Which looks like | ||
# write_paraview(Grid,"Grid3D_FreeSubduction"); | ||
|
||
center = (0, 0, 0) | ||
height = 10 # [kmm] | ||
radius = 15 # [km] | ||
crater = 0.0 | ||
base = 0.0 | ||
background = nothing | ||
|
||
|
||
add_volcano!(Phases, Temp, Grid; | ||
volcanic_phase = 1, | ||
center = (0, 0, 0), | ||
height = 10, | ||
radius = 15, | ||
crater = 0.0, | ||
base = 0.0, | ||
background = nothing, | ||
T = HalfspaceCoolingTemp(Age=20) | ||
) | ||
|
||
Grid = addfield(Grid,(;Phases, Temp)) | ||
|
||
write_paraview(Grid,"Grid3D_FreeSubduction"); | ||
|
||
Grid.fields.Temp[Grid.fields.Temp.==0] .= NaN | ||
heatmap(x, z, Grid.fields.Temp[:,64,:]) | ||
heatmap(x, z, Grid.fields.Phases[:,64,:]) | ||
|
||
# heatmap(x, z, Grid.z.val[:,64,:]) | ||
# heatmap(x, z, depth[:,64,:]) | ||
# heatmap(x, z, ind[:,64,:]) | ||
|
||
# Grid.fields.Temp[:,:,1] | ||
# lines(Grid.fields.Temp[64,64,:], depth[64,64,:]) |