JuliaGeodynamics / GeophysicalModelGenerator.jl

Import, process and interpret geophysical data sets to be used in numerical models.
MIT License
66 stars 29 forks source link

pTatin input generation #111

Closed boriskaus closed 7 months ago

boriskaus commented 7 months ago

This adds functionality to use GMG structures as input for pTatin simulations. For this we add two new data structures.

Q1Data is a hexahedral mesh with cell and vertex data info. It is in many ways similar to the CartData structure but also has space to hold cellfields.

julia> q1_data = Q1Data(xyz_grid(1:10,1:10,1:8))
Q1Data 
      size    : (9, 9, 7)
      x       ϵ [ 1.0 : 10.0]
      y       ϵ [ 1.0 : 10.0]
      z       ϵ [ 1.0 : 8.0]
      fields  : (:Z,)
  cellfields  : 

FEData is a general finite element data structure that holds the coordinates of the vertices and the connectivity of the mesh, along with cell and vertex field data. It can be generated from Q1Data:

julia> fe_data = convert2FEData(q1_data)
FEData{3,8} 
    elements : 567
    vertices : 800
     x       ϵ [ 1.0 : 10.0]
     y       ϵ [ 1.0 : 10.0]
     z       ϵ [ 1.0 : 10.0]
      fields : (:Z,)
  cellfields : 

You can use the addfield function to add either cell or vertex fields to FEData or Q1Data structures.

A FEData structure can be saved to disk in a format that can be read with pTatin:

julia> write_pTatin_mesh(fe_data)
Wrote pTatin mesh  : md.bin
Wrote pTatin field : Z_vertex.bin

cc: @anthony-jourdon, @laetitialp