Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
boriskaus authored Oct 9, 2024
2 parents c82028d + cd70ed7 commit 6c597cf
Show file tree
Hide file tree
Showing 42 changed files with 68,572 additions and 147 deletions.
1 change: 1 addition & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
version:
- '1.9'
- '1.10'
- '~1.11.0-0'
- 'nightly'
os:
- ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
with:
version: '1.9'
show-versioninfo: true
- uses: julia-actions/cache@v1
- uses: julia-actions/cache@v2
- uses: julia-actions/julia-buildpkg@v1
env:
PYTHON: ""
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/SpellCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ jobs:
- name: Checkout Actions Repository
uses: actions/checkout@v4
- name: Check spelling
uses: crate-ci/typos@v1.18.2
uses: crate-ci/typos@v1.25.0
with:
args: --exclude **/*.txt --exclude **/*.pvsm
1 change: 1 addition & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dum = "dum"
Shepard = "Shepard"
arange = "arange"
iy = "iy"
nin = "nin"

[files]
extend-exclude = ["tutorials/*.pvsm"]
13 changes: 9 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name = "GeophysicalModelGenerator"
uuid = "3700c31b-fa53-48a6-808a-ef22d5a84742"
authors = ["Boris Kaus", "Marcel Thielmann"]
version = "0.7.2"
version = "0.7.7"

[deps]
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
FFMPEG = "c87230d0-a227-11e9-1b43-d7ebe4e7570a"
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
GDAL_jll = "a7073274-a066-55f0-b90d-d619367d196c"
GeoParams = "e018b62d-d9de-4a26-8697-af89c310ae38"
Geodesy = "0ef565a4-170c-5f04-8de2-149903a85f3d"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Expand All @@ -19,13 +20,15 @@ JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
LightXML = "9c8b4983-aa76-5018-a973-4c85ecc9e179"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
MeshIO = "7269a6da-0436-5bbc-96c2-40638cbb6118"
NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab"
NearestNeighbors = "b8a86587-4115-5ab1-83bc-aa920d37bbce"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
WhereTheWaterFlows = "ea906314-1493-4d22-a0af-f886a20c9fba"
WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"

[weakdeps]
Expand All @@ -43,7 +46,8 @@ Colors = "0.9 - 0.12"
Downloads = "1"
FFMPEG = "0.4"
FileIO = "1"
GLMakie = "0.8, 0.9"
GDAL_jll = "300.900.0 - 301.900.0"
GLMakie = "0.10"
GMT = "1"
GeoParams = "0.2 - 0.6"
Geodesy = "1"
Expand All @@ -52,13 +56,14 @@ Glob = "1.2 - 1.3"
GridapGmsh = "0.5 - 0.7"
ImageIO = "0.1 - 0.6"
Interpolations = "0.14, 0.15"
JLD2 = "0.4"
JLD2 = "0.4, 0.5"
LightXML = "0.8, 0.9"
MeshIO = "0.1 - 0.4"
NearestNeighbors = "0.2 - 0.4"
Parameters = "0.9 - 0.12"
SpecialFunctions = "1.0, 2"
StaticArrays = "1"
WhereTheWaterFlows = "0.10"
WriteVTK = "1"
julia = "1.9"

Expand All @@ -69,4 +74,4 @@ StableRNGs = "860ef19b-820b-49d6-a774-d7a799459cd3"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "GMT", "StableRNGs","GridapGmsh"]
test = ["Test", "GMT", "StableRNGs", "GridapGmsh"]
4 changes: 3 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,15 @@ makedocs(;
"19 - Jura tutorial" => "man/Tutorial_Jura.md",
"20 - 2D model setups" => "man/Tutorial_NumericalModel_2D.md",
"21 - 3D model setups" => "man/Tutorial_NumericalModel_3D.md",
"22 - Build geometry from polygons" => "man/tutorial_Polygon_structures.md"
"22 - 3D model setups" => "man/Tutorial_VolcanoModel_3D.md",
"23 - Build geometry from polygons" => "man/tutorial_Polygon_structures.md"
],
"User Guide" => Any[
"Installation" => "man/installation.md",
"Data Structures" => "man/datastructures.md",
"Data Import" => "man/dataimport.md",
"Projection" => "man/projection.md",
"ASAGI" => "man/asagi_io.md",
"Paraview output" => "man/paraview_output.md",
"Paraview collection" => "man/paraview_collection.md",
"Surfaces" => "man/surfaces.md",
Expand Down
Binary file added docs/src/assets/img/VolcanoModel3D.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/src/man/Tutorial_AlpineData.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ using GeophysicalModelGenerator, GMT
When loading both packages, several `GMT` routines within `GMG` will be loaded. One of these routines is the function `import_topo`, where one simply has to provide the region for which to download the topographic data and the data source.

```julia
Topo = import_topo([4,20,37,50], file="@earth_relief_01m.grd")
Topo = import_topo([4,20,37,50], file="@earth_relief_01m")
```

The data is available in different resolutions; see [here](http://gmt.soest.hawaii.edu/doc/latest/grdimage.html) for an overview. Generally, it is advisable to not use the largest resolution if you have a large area, as the files become very large.
Expand Down
2 changes: 1 addition & 1 deletion docs/src/man/Tutorial_Jura.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using GeophysicalModelGenerator, GMT
Download the topography with:

```julia
Topo = import_topo(lat=[45.5,47.7], lon=[5, 8.1], file="@earth_relief_03s.grd")
Topo = import_topo(lat=[45.5,47.7], lon=[5, 8.1], file="@earth_relief_03s")
```

Next, we drape the geological map on top of the geological map.
Expand Down
5 changes: 2 additions & 3 deletions docs/src/man/Tutorial_LaPalma.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ using GeophysicalModelGenerator, GMT, DelimitedFiles
We will use GMT to download the topography with:

```julia
Topo = import_topo(lon = [-18.2, -17.5], lat=[28.4, 29.0], file="@earth_relief_15s.grd")
Topo = import_topo(lon = [-18.2, -17.5], lat=[28.4, 29.0], file="@earth_relief_15s")
```

Next, lets load the seismicity. The earthquake data is available on [https://www.ign.es/web/ign/portal/vlc-catalogo](https://www.ign.es/web/ign/portal/vlc-catalogo).
We have filtered them and prepared a file with earthquake locations up to early November 2021 (from january 2021).
Download that:

```julia
#download_data("","EQ_events_all_info5_LaPalma_2021.dat")
#download_data("https://zenodo.org/records/10738510/files/EQ_events_all_info5_LaPalma_2021.dat","EQ_events_all_info5_LaPalma_2021.dat")
data_EQ = readdlm("EQ_events_all_info5_LaPalma_2021.dat")
```

Expand Down Expand Up @@ -155,4 +155,3 @@ The paraview statefile `/tutorials/LaPalma.pvsm` can be used to reproduce the fo
---

*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*

81 changes: 81 additions & 0 deletions docs/src/man/Tutorial_VolcanoModel_3D.md
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
![Mechanical3D_Tutorial_2](../assets/img/VolcanoModel3D.png)
10 changes: 10 additions & 0 deletions docs/src/man/asagi_io.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ASAGI I/O

[ASAGI](https://github.com/TUM-I5/ASAGI) is a fileformat that is used by codes such as SeisSol or ExaHype. It employs the NetCDF4 data format.

We can read ASAGI files into GMG, and write GMG datasets to ASAGI format, which makes it straightforward to use GMG to create a model setup or to couple the results of geodynamic simulations (e.g., produced by LaMEM) with codes that support ASAGI.

```@docs
read_ASAGI
write_ASAGI
```
6 changes: 4 additions & 2 deletions docs/src/man/tutorial_GMT_Topography.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ The nice thing about GMT is that it automatically downloads data for you for a c

```julia
julia> using GeophysicalModelGenerator, GMT
julia> Topo = import_topo([4,20,37,49], file="@earth_relief_01m.grd")
julia> Topo = import_topo([4,20,37,49], file="@earth_relief_01m")
GeoData
size : (960, 720, 1)
lon ϵ [ 4.0 : 19.983333333333334]
lat ϵ [ 37.0 : 48.983333333333334]
depth ϵ [ -3.8725 km : 4.2495 km]
fields: (:Topography,)
```

The data is available in different resolutions:

| Dataset | Resolution | Description |
|:---------------- | ------------ | ----------------------------------------------------------- |
| "@earth\_relief\_01s" | 1 arc sec | SRTM tiles (14297 tiles, land only, 60S-60N) [NASA/USGS] |
Expand Down Expand Up @@ -54,4 +56,4 @@ The result is shown here, together with Moho data

![Tutorial_GMT_topography](../assets/img/Tutorial_GMT_topography.png)

In case you are interested: we are employing the `oleron` scientific colormap [here](https://www.fabiocrameri.ch/colourmaps/).
In case you are interested: we are employing the `oleron` scientific colormap [here](https://www.fabiocrameri.ch/colourmaps/).
4 changes: 2 additions & 2 deletions docs/src/man/tutorial_GMT_Topography_GeologicalMap.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ In many cases, we want to add topographic data as well a information about tecto

#### 1. Download topographic data and tectonic maps of the Alpine region
The ETOPO1 data file used in this example can be downloaded here:
[https://ngdc.noaa.gov/mgg/global/global.html](https://ngdc.noaa.gov/mgg/global/global.html). For this example, we downloaded `ETOPO1_Ice_g_gmt4.grd` and stored it directly in the folder where we will be working. For the geological map, we download the data from the [SPP 4DMB repository](http://www.spp-mountainbuilding.de/data/Maps.zip) and extract the zip file (to the current folder). In this data set, a `gmt` file with the data for different tectonic units is given in `./tectonic_maps_4dmb_2020_09_17/GMT_example/alcapadi_polygons.gmt`.
[https://ngdc.noaa.gov/mgg/global/global.html](https://ngdc.noaa.gov/mgg/global/global.html). For this example, we downloaded `ETOPO1_Ice_g_gmt4` and stored it directly in the folder where we will be working. For the geological map, we download the data from the [SPP 4DMB repository](http://www.spp-mountainbuilding.de/data/Maps.zip) and extract the zip file (to the current folder). In this data set, a `gmt` file with the data for different tectonic units is given in `./tectonic_maps_4dmb_2020_09_17/GMT_example/alcapadi_polygons.gmt`.

#### 2. Create a tectonic map with orthogonal projection
To create a png with an orthogonal map projection (which we need for the png import), we do the following in julia:
Expand All @@ -28,7 +28,7 @@ julia> using GMT, NearestNeighbors, GeoParams, GeophysicalModelGenerator
```
First, define the filenames of the files you want to import:
```julia
julia> filename_topo = "./ETOPO1/ETOPO1_Ice_g_gmt4.grd"
julia> filename_topo = "./ETOPO1/ETOPO1_Ice_g_gmt4"
julia> filename_geo = "./tectonicmap_SPP.png"
```
Next, define the region that you want to visualize (note that we use the same coordinates here as we used previously for the generation of the geological map):
Expand Down
2 changes: 1 addition & 1 deletion docs/src/man/tutorial_GPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ using GMT, Interpolations
We use the `import_topo` function to read the topography from a file:

```julia
Elevation = import_topo([3,17,42,50], file="@earth_relief_01m.grd");
Elevation = import_topo([3,17,42,50], file="@earth_relief_01m");
nothing #hide
```

Expand Down
Loading

0 comments on commit 6c597cf

Please sign in to comment.