Skip to content

Commit 8a2c630

Browse files
committed
First post-processing functions
Some functions to post-process LaMEM models. Plotting functions are in progress.
1 parent 6c597cf commit 8a2c630

File tree

10 files changed

+794
-0
lines changed

10 files changed

+794
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Post processing of numerical models
2+
3+
To evaluate and analyse numerical simulations, we provide a few routines to make it easier to extract the dataset information.
4+
5+
6+
```@docs
7+
get_phase
8+
get_phase_bool
9+
search_for_phase_properties
10+
get_data_timestep
11+
split_at__to_type
12+
search_for_model_constrains
13+
track_point_over_time
14+
deserialize_file
15+
```
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Post processing of LaMEM files
2+
3+
## Goal
4+
This tutorial visualizes how to do comparative analysis and quantitative evaluation of LaMEM models. The post-processing is julia based and extracts the information directly from the .pvtr-file.
5+
6+
7+
## Steps
8+
9+
## 1. Get general information
10+
Before beginning the post-processing, it is useful to extract some general information about the model. This includes material properties of the different phases, time of the time step, ascii-file stored information and the model data.
11+
12+
13+
```julia
14+
using GeophysicalModelGenerator, LaMEM, Serialization
15+
16+
#### set path and variables
17+
dat_path = ("../test/test_files/Subduction_VEP.dat")
18+
model_path = ("../test/test_files/timestep/")
19+
model_name = "VEP"
20+
timestep = "Timestep_00000000_0.00000000e+00"
21+
FileName_pvtr = "output.pvtr"
22+
p_fields = ["phase", "temperature"]
23+
output_dir = model_path
24+
25+
# extract data information from ascii file
26+
surface_level = search_for_model_constrains(dat_path, "surf_level")
27+
28+
# read output file
29+
material_block = Dict{String, Dict{String, Dict{String, String}}}() # Dictionary to store material properties
30+
material_block = search_for_phase_properties(dat_path, model_name, "<MaterialStart>", "<MaterialEnd>")
31+
32+
# get the time as a float number
33+
time = split_at__to_type([timestep],3,"Float")
34+
35+
36+
# extract data information for selected fields
37+
data = get_data_timestep(model_path,timestep,FileName_pvtr,p_fields,surface_level,false)
38+
```
39+
40+
## 2. Start post-processing
41+
To analyse the differences between models and its evolution, coordinates of specific phases can be obtained either as a vector or as a matrix. Additionally, a point can be tracked over time for specific fields.
42+
43+
44+
```julia
45+
# get information about where the phase is located
46+
processing_folder = joinpath(model_path,timestep)
47+
path = replace(processing_folder,"\\" => "/")*"/"
48+
indices = get_phase(path,FileName_pvtr,[2],false)
49+
matrix = get_phase_bool(path,FileName_pvtr,indices)
50+
51+
# track one point over time
52+
name = "track"*string(indices[1])
53+
track_point = track_point_over_time(indices[1],p_fields,model_name,model_path,surface_level,name,output_dir,false)
54+
55+
tracked_point = deserialize_file(output_dir,name)
56+
```
57+
58+
59+
60+
61+
If you want to run the entire example, you can find the .jl code [here](https://github.com/JuliaGeodynamics/GeophysicalModelGenerator.jl/blob/main/tutorial/Tutorial_post_processing.jl)

0 commit comments

Comments
 (0)