Skip to content

Numerical model setups ​

In order to generate numerical simulations from setups created with GeophysicalModelGenerator.jl, we provide a few routines that directly create setups.

The routines provided here have the following functionality:

  • Add lithospheric boxes to a setup, that may have a layered structure and various thermal structures

  • Add various geometries (spheres, cuylinders, ellipsoids)

  • Add lithospheric structure

  • Add various 1D thermal structures (and possibilities to combine them)

Map-view outlines of plates, weak zones, faults and trenches can be drawn in any vector graphics program, such as Inkscape, Affinity or Illustrator, exported as SVG and read with read_outlines, which returns them in drawing order: closed ones as polygons for add_plate!, open ones as Trace of add_fault! and Trench. Name each shape (or its layer) after the outline it represents, and draw a reference line whose end points have known model coordinates, or let the page span the model domain. write_outlines stores outlines as a CSV file.

Layers with curved or perturbed interfaces, listric faults, faults with a curved trace and Gaussian thermal anomalies are shown in the tutorial Curved layers, curved faults and thermal anomalies.

Functions ​

GeophysicalModelGenerator.add_box! Function
julia
add_box!(Phase, Temp, Grid::AbstractGeneralGrid; xlim::Tuple = (20,100), [ylim::Tuple = (1,10)], zlim::Tuple = (10,80),
        Origin=nothing, StrikeAngle=0, DipAngle=0,
        phase = ConstantPhase(1),
        T=nothing,
        segments=nothing,
        cell=false )

Adds a box with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models

Parameters

  • Phase - Phase array (consistent with Grid)

  • Temp - Temperature array (consistent with Grid)

  • Grid - grid structure (can be any of the grid types in GMG)

  • xlim - left/right coordinates of box

  • ylim - front/back coordinates of box [optional; if not specified we use the whole box]

  • zlim - bottom/top coordinates of box

  • Origin - the origin, used to rotate the box around. Default is the left-front-top corner. Depths of the phase and temperature structures are measured from the top of the box, wherever Origin lies

  • StrikeAngle - strike angle of slab

  • DipAngle - dip angle of slab

  • phase - specifies the phase of the box. See ConstantPhase(),LithosphericPhases(); nothing keeps the phases

  • T - specifies the temperature of the box. See ConstantTemp(),LinearTemp(),HalfspaceCoolingTemp(),SpreadingRateTemp(),LithosphericTemp()

  • segments - optional parameter to define multiple ridge segments within the box, for T = SpreadingRateTemp()

  • cell - if true, Phase and Temp are defined on centers

Examples

Example 1) Box with constant phase and temperature & a dip angle of 10 degrees:

julia
julia> Grid = read_LaMEM_inputfile("test_files/SaltModels.dat")
LaMEM Grid:
  nel         : (32, 32, 32)
  marker/cell : (3, 3, 3)
  markers     : (96, 96, 96)
  x           ϵ [-3.0 : 3.0]
  y           ϵ [-2.0 : 2.0]
  z           ϵ [-2.0 : 0.0]
julia> Phases = zeros(Int32,   size(Grid.X));
julia> Temp   = zeros(Float64, size(Grid.X));
julia> add_box!(Phases,Temp,Grid, xlim=(0,500), zlim=(-50,0), phase=ConstantPhase(3), DipAngle=10, T=ConstantTemp(1000))
julia> Model3D = ParaviewData(Grid, (Phases=Phases,Temp=Temp)); # Create Cartesian model
julia> write_paraview(Model3D,"LaMEM_ModelSetup")           # Save model to paraview
1-element Vector{String}:
 "LaMEM_ModelSetup.vts"

Example 2) Box with halfspace cooling profile

julia
julia> Grid = CartData(xyz_grid(-1000:10:1000,0,-660:10:0))
julia> Phases = zeros(Int32,   size(Grid));
julia> Temp   = zeros(Float64, size(Grid));
julia> add_box!(Phases,Temp,Grid, xlim=(0,500), zlim=(-50,0), phase=ConstantPhase(3), DipAngle=10, T=HalfspaceCoolingTemp(Age=30))
julia> Grid = addfield(Grid, (;Phases,Temp));       # Add to Cartesian model
julia> write_paraview(Grid,"LaMEM_ModelSetup")  # Save model to paraview
1-element Vector{String}:
 "LaMEM_ModelSetup.vts"

Example 3) Box with ridge thermal structure ```julia-repl julia> Grid = CartData(xyz_grid(-1000:10:1000, -1000:10:1000, -660:5:0)) julia> Phases = fill(2, size(Grid)); julia> Temp = fill(1350.0, size(Grid)); julia> segments = [((-500.0, -1000.0), (-500.0, 0.0)), ((-250.0, 0.0), (-250.0, 200.0)), ((-750.0, 200.0), (-750.0, 1000.0))]; julia> lith = LithosphericPhases(Layers=[15 55], Phases=[1 2], Tlab=1250); julia> add_box!(Phases, Temp, Grid; xlim=(-1000.0, 0.0), ylim=(-500.0, 500.0), zlim=(-80.0, 0.0), phase=lith, T=SpreadingRateTemp(SpreadingVel=3), segments=segments) julia> Grid = addfield(Grid, (; Phases, Temp)); # Add to Cartesian model julia> write_paraview(Grid, "Ridge_Thermal_Structure") # Save model to Paraview 1-element Vector{String}: "Ridge_Thermal_Structure.vts"

source
julia
add_box!(Phase, Temp, Grid::AbstractGeneralGrid,
bounds::AbstractVector{<:AbstractVector{<:Real}};
Origin = nothing, StrikeAngle = 0, DipAngle = 0,
phase = ConstantPhase(1),
T = nothing,
segments = nothing,
cell = false     )

Add box function but getting bounds as a vector bounds in a way of [[xmin,xmax],[ymin,ymax],[zmin,zmax]]. If bounds is empty return nothing

source
GeophysicalModelGenerator.add_layer! Function
julia
add_layer!(Phase, Temp, Grid::AbstractGeneralGrid; xlim::Tuple = (1,100), [ylim::Tuple = (0,20)], zlim::Tuple = (0,-100),
        phase = ConstantPhase(1),
        T=nothing, cell=false )

Adds a layer with phase & temperature structure to a 3D model setup. The most common use would be to add a lithospheric layer to a model setup. This simplifies creating model geometries in geodynamic models

Parameters

  • Phase - Phase array (consistent with Grid)

  • Temp - Temperature array (consistent with Grid)

  • Grid - grid structure (usually obtained with read_LaMEM_inputfile, but can also be other grid types)

  • xlim - left/right coordinates of box

  • ylim - front/back coordinates of box

  • zlim - bottom/top coordinates of box. Each bound is either a number, a function z(x, y), or a surface CartData (e.g. imported topography or a Moho map), which gives a layer with a curved or perturbed bottom or top surface. A surface must cover xlim and ylim.

  • phase - specifies the phase of the box. See ConstantPhase(),LithosphericPhases(); nothing keeps the phases

  • T - specifies the temperature of the box. See ConstantTemp(),LinearTemp(),HalfspaceCoolingTemp(),SpreadingRateTemp()

Numeric limits may be given in either order. Thermal and phase structures see the vertical coordinate z - top(x, y), the (negative) depth below the top of the layer, so that the layers of LithosphericPhases and the profile of HalfspaceCoolingTemp start at the top of the layer, whether it is a number or a curved surface. LinearTemp goes from Ttop at the top to Tbot at the bottom of the layer at every (x, y).

Examples

Example 1) Layer with constant phase and temperature

julia
julia> Grid = read_LaMEM_inputfile("test_files/SaltModels.dat")
LaMEM Grid:
  nel         : (32, 32, 32)
  marker/cell : (3, 3, 3)
  markers     : (96, 96, 96)
  x           ϵ [-3.0 : 3.0]
  y           ϵ [-2.0 : 2.0]
  z           ϵ [-2.0 : 0.0]
julia> Phases = zeros(Int32,   size(Grid.X));
julia> Temp   = zeros(Float64, size(Grid.X));
julia> add_layer!(Phases,Temp,Grid, zlim=(-50,0), phase=ConstantPhase(3), T=ConstantTemp(1000))
julia> Model3D = ParaviewData(Grid, (Phases=Phases,Temp=Temp)); # Create Cartesian model
julia> write_paraview(Model3D,"LaMEM_ModelSetup")           # Save model to paraview
1-element Vector{String}:
 "LaMEM_ModelSetup.vts"

Example 2) Box with halfspace cooling profile

julia
julia> Grid = read_LaMEM_inputfile("test_files/SaltModels.dat")
julia> Phases = zeros(Int32,   size(Grid.X));
julia> Temp   = zeros(Float64, size(Grid.X));
julia> add_layer!(Phases,Temp,Grid, zlim=(-50,0), phase=ConstantPhase(3), T=HalfspaceCoolingTemp())
julia> Model3D = ParaviewData(Grid, (Phases=Phases,Temp=Temp)); # Create Cartesian model
julia> write_paraview(Model3D,"LaMEM_ModelSetup")           # Save model to paraview
1-element Vector{String}:
 "LaMEM_ModelSetup.vts"

Example 3) Layer with a sinusoidal bottom surface, as for a Rayleigh-Taylor instability

julia
julia> Grid = CartData(xyz_grid(-3:0.05:3, 0, -2:0.05:0))
julia> Phases = zeros(Int32,   size(Grid));
julia> Temp   = zeros(Float64, size(Grid));
julia> add_layer!(Phases, Temp, Grid, zlim=((x, y) -> -0.5 + 0.05cospi(x), 0), phase=ConstantPhase(1))
source
GeophysicalModelGenerator.add_sphere! Function
julia
add_sphere!(Phase, Temp, Grid::AbstractGeneralGrid; cen::Tuple = (0,0,-1), radius::Number,
        phase = ConstantPhase(1).
        T=nothing, cell=false )

Adds a sphere with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models. Depths in phase and T are measured below the top of the sphere.

Parameters

  • Phase - Phase array (consistent with Grid)

  • Temp - Temperature array (consistent with Grid)

  • Grid - LaMEM grid structure (usually obtained with read_LaMEM_inputfile)

  • cen - center coordinates of sphere

  • radius - radius of sphere

  • phase - specifies the phase of the box. See ConstantPhase(),LithosphericPhases(); nothing keeps the phases

  • T - specifies the temperature of the box. See ConstantTemp(),LinearTemp(),HalfspaceCoolingTemp(),SpreadingRateTemp()

  • cell - if true, Phase and Temp are defined on cell centers

Example

Sphere with constant phase and temperature:

julia
julia> Grid = read_LaMEM_inputfile("test_files/SaltModels.dat")
LaMEM Grid:
  nel         : (32, 32, 32)
  marker/cell : (3, 3, 3)
  markers     : (96, 96, 96)
  x           ϵ [-3.0 : 3.0]
  y           ϵ [-2.0 : 2.0]
  z           ϵ [-2.0 : 0.0]
julia> Phases = zeros(Int32,   size(Grid.X));
julia> Temp   = zeros(Float64, size(Grid.X));
julia> add_sphere!(Phases,Temp,Grid, cen=(0,0,-1), radius=0.5, phase=ConstantPhase(2), T=ConstantTemp(800))
julia> Model3D = ParaviewData(Grid, (Phases=Phases,Temp=Temp)); # Create Cartesian model
julia> write_paraview(Model3D,"LaMEM_ModelSetup")           # Save model to paraview
1-element Vector{String}:
 "LaMEM_ModelSetup.vts"
source
GeophysicalModelGenerator.add_ellipsoid! Function
julia
add_ellipsoid!(Phase, Temp, Grid::AbstractGeneralGrid; cen::Tuple = (-1,-1,-1), axes::Tuple = (0.2,0.1,0.5),
        Origin=nothing, StrikeAngle=0, DipAngle=0,
        phase = ConstantPhase(1).
        T=nothing, cell=false )

Adds an Ellipsoid with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models. Depths in phase and T are measured below the top of the ellipsoid.

Parameters

  • Phase - Phase array (consistent with Grid)

  • Temp - Temperature array (consistent with Grid)

  • Grid - LaMEM grid structure (usually obtained with read_LaMEM_inputfile)

  • cen - center coordinates of sphere

  • axes - semi-axes of ellipsoid in X,Y,Z

  • Origin - the origin, used to rotate the box around. Default is the left-front-top corner

  • StrikeAngle - strike angle of slab

  • DipAngle - dip angle of slab

  • phase - specifies the phase of the box. See ConstantPhase(),LithosphericPhases(); nothing keeps the phases

  • T - specifies the temperature of the box. See ConstantTemp(),LinearTemp(),HalfspaceCoolingTemp(),SpreadingRateTemp()

  • cell - if true, Phase and Temp are defined on cell centers

Example

Ellipsoid with constant phase and temperature, rotated 90 degrees and tilted by 45 degrees:

julia
julia> Grid = read_LaMEM_inputfile("test_files/SaltModels.dat")
LaMEM Grid:
  nel         : (32, 32, 32)
  marker/cell : (3, 3, 3)
  markers     : (96, 96, 96)
  x           ϵ [-3.0 : 3.0]
  y           ϵ [-2.0 : 2.0]
  z           ϵ [-2.0 : 0.0]
julia> Phases = zeros(Int32,   size(Grid.X));
julia> Temp   = zeros(Float64, size(Grid.X));
julia> add_ellipsoid!(Phases,Temp,Grid, cen=(-1,-1,-1), axes=(0.2,0.1,0.5), StrikeAngle=90, DipAngle=45, phase=ConstantPhase(3), T=ConstantTemp(600))
julia> Model3D = ParaviewData(Grid, (Phases=Phases,Temp=Temp)); # Create Cartesian model
julia> write_paraview(Model3D,"LaMEM_ModelSetup")           # Save model to paraview
1-element Vector{String}:
 "LaMEM_ModelSetup.vts"
source
GeophysicalModelGenerator.add_cylinder! Function
julia
add_cylinder!(Phase, Temp, Grid::AbstractGeneralGrid; base::Tuple = (-1,-1,-1.5), cap::Tuple = (-1,-1,-0.5), radius::Number,
        phase = ConstantPhase(1),
        T=nothing, cell=false )

Adds a cylinder with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models. Depths in phase and T are measured below the top of the cylinder.

Parameters

  • Phase - Phase array (consistent with Grid)

  • Temp - Temperature array (consistent with Grid)

  • Grid - Grid structure (usually obtained with read_LaMEM_inputfile)

  • base - center coordinate of bottom of cylinder

  • cap - center coordinate of top of cylinder

  • radius - radius of the cylinder

  • phase - specifies the phase of the box. See ConstantPhase(),LithosphericPhases(); nothing keeps the phases

  • T - specifies the temperature of the box. See ConstantTemp(),LinearTemp(),HalfspaceCoolingTemp(),SpreadingRateTemp()

  • cell - if true, Phase and Temp are defined on cell centers

Example

Cylinder with constant phase and temperature:

julia
julia> Grid = read_LaMEM_inputfile("test_files/SaltModels.dat")
LaMEM Grid:
  nel         : (32, 32, 32)
  marker/cell : (3, 3, 3)
  markers     : (96, 96, 96)
  x           ϵ [-3.0 : 3.0]
  y           ϵ [-2.0 : 2.0]
  z           ϵ [-2.0 : 0.0]
julia> Phases = zeros(Int32,   size(Grid.X));
julia> Temp   = zeros(Float64, size(Grid.X));
julia> add_cylinder!(Phases,Temp,Grid, base=(-1,-1,-1.5), cap=(1,1,-0.5), radius=0.25, phase=ConstantPhase(4), T=ConstantTemp(400))
julia> Model3D = ParaviewData(Grid, (Phases=Phases,Temp=Temp)); # Create Cartesian model
julia> write_paraview(Model3D,"LaMEM_ModelSetup")           # Save model to paraview
1-element Vector{String}:
 "LaMEM_ModelSetup.vts"
source
GeophysicalModelGenerator.add_stripes! Function
julia
add_stripes!(Phase, Grid::AbstractGeneralGrid;
    stripAxes       = (1,1,0),
    stripeWidth     =  0.2,
    stripeSpacing   =  1,
    Origin          =  nothing,
    StrikeAngle     =  0,
    DipAngle        =  0,
    phase           =  ConstantPhase(3),
    stripePhase     =  ConstantPhase(4),
    cell            = false)

Adds stripes to a pre-defined phase (e.g. added using add_box!)

Parameters

  • Phase - Phase array (consistent with Grid)

  • Grid - grid structure (usually obtained with read_LaMEM_inputfile, but can also be other grid types)

  • stripAxes - sets the axis for which we want the stripes. Default is (1,1,0) i.e. X, Y and not Z

  • stripeWidth - width of the stripe

  • stripeSpacing - space between two stripes

  • Origin - the origin, used to rotate the stripes around. Default is the corner of the grid with the maximum x, y and z

  • StrikeAngle - strike angle

  • DipAngle - dip angle

  • phase - specifies the phase we want to apply stripes to

  • stripePhase - specifies the stripe phase

  • cell - if true, Phase and Temp are defined on centers

Example

Example: Box with striped phase and constant temperature & a dip angle of 10 degrees:

julia
julia> Grid = read_LaMEM_inputfile("test_files/SaltModels.dat")
LaMEM Grid:
  nel         : (32, 32, 32)
  marker/cell : (3, 3, 3)
  markers     : (96, 96, 96)
  x           ϵ [-3.0 : 3.0]
  y           ϵ [-2.0 : 2.0]
  z           ϵ [-2.0 : 0.0]
julia> Phases = zeros(Int32,   size(Grid.X));
julia> Temp   = zeros(Float64, size(Grid.X));
julia> add_box!(Phases,Temp,Grid, xlim=(0,500), zlim=(-50,0), phase=ConstantPhase(3), DipAngle=10, T=ConstantTemp(1000))
julia> add_stripes!(Phases, Grid, stripAxes=(1,1,1), stripeWidth=0.2, stripeSpacing=1, Origin=nothing, StrikeAngle=0, DipAngle=10, phase=ConstantPhase(3), stripePhase=ConstantPhase(4))
julia> Model3D = ParaviewData(Grid, (Phases=Phases,Temp=Temp)); # Create Cartesian model
julia> write_paraview(Model3D,"LaMEM_ModelSetup")           # Save model to paraview
1-element Vector{String}:
 "LaMEM_ModelSetup.vts"
source
GeophysicalModelGenerator.add_slab! Function
julia
add_slab!(Phase, Temp, Grid::AbstractGeneralGrid,  trench::Trench; phase = ConstantPhase(1), T = nothing, cell=false)

Adds a curved slab with phase & temperature structure to a 3D model setup.

Parameters

  • Phase - Phase array (consistent with Grid)

  • Temp - Temperature array (consistent with Grid)

  • Grid - grid structure (can be any of the grid types in GMG)

  • trench - Trench structure

  • phase - specifies the phase of the box. See ConstantPhase(),LithosphericPhases(); nothing keeps the phases

  • T - specifies the temperature of the box. See ConstantTemp(),LinearTemp(),HalfspaceCoolingTemp(),SpreadingRateTemp(),LithosphericTemp()

  • cell - if true, Phase and Temp are defined on cells

Examples

Example 1) Slab

julia
julia> x     = LinRange(0.0,1200.0,128);
julia> y     = LinRange(0.0,1200.0,128);
julia> z     = LinRange(-660,50,128);
julia> Cart  = CartData(xyz_grid(x, y, z));
julia> Phase = ones(Int64,size(Cart));
julia> Temp  = fill(1350.0,size(Cart));
# Define the trench:
julia> trench= Trench(Start = (400.0,400.0), End = (800.0,800.0), θ_max = 45.0, direction = 1.0, n_seg = 50, Length = 600.0, Thickness = 80.0, Lb = 500.0, d_decoupling = 100.0, type_bending =:Ribe)
julia> phase = LithosphericPhases(Layers=[5 7 88], Phases = [2 3 4], Tlab=nothing)
julia> TsHC  = HalfspaceCoolingTemp(Tsurface=20.0, Tmantle=1350, Age=30, Adiabat=0.4)
julia> add_slab!(Phase, Temp, Cart, trench, phase = phase, T = TsHC)
source
julia
add_slab!(Phase, Temp, Grid::AbstractGeneralGrid, slab::BezierSlab; phase = ConstantPhase(1), T = nothing, cell = false)

Adds a slab whose top is a Bézier surface, see BezierSlab.

source
GeophysicalModelGenerator.add_fault! Function
julia
add_fault!(Phase, Temp, Grid::AbstractGeneralGrid;
    Start=(20,100), End=(10,80),
    Trace=nothing,
    Fault_thickness=10.0,
    Depth_extent=nothing,
    DipAngle=0e0,
    DetachmentDepth=nothing,
    phase=ConstantPhase(1),
    T=nothing,
    cell=false)

Adds a fault to the given 3D grid by modifying the Phase and Temp arrays. For a 2D grid, use add_box instead. Depths in phase and T are measured below the top of the fault's Depth_extent.

Arguments

  • Phase: Phase array

  • Temp: Temp array

  • Grid: The grid on which the fault is to be added.

  • Start: Tuple representing the starting coordinates of the fault (X, Y).

  • End: Tuple representing the ending coordinates of the fault (X, Y).

  • Trace: If not nothing, the surface trace of the fault as a polyline of two or more points (X, Y), which replaces Start and End. The fault follows the curved trace, and its dip is perpendicular to it.

  • Fault_thickness: Thickness of the fault.

  • Depth_extent: Depth extent of the fault. If nothing, the fault extends through the entire domain.

  • DipAngle: Dip angle of the fault, measured from the vertical. A positive angle dips to the right of the direction from Start to End (or along Trace).

  • DetachmentDepth: If nothing, the fault is planar. Otherwise, the fault is listric: it starts with DipAngle at z = 0 and flattens with depth into a horizontal detachment at z = -DetachmentDepth, following z = -DetachmentDepth * (1 - exp(-h / (DetachmentDepth * tand(DipAngle)))) at a horizontal distance h from the trace. The thickness is accurate where the curvature radius exceeds Fault_thickness.

  • phase: Phase to be assigned to the fault; nothing keeps the phases

  • T: Temperature to be assigned to the fault. If nothing, the temperature is not modified.

Example

julia
add_fault!(Phase, Temp, Grid;
        Start=(20,100), End=(10,80),
        Fault_thickness=10.0,
        Depth_extent=(-25.0, 0.0),
        DipAngle=-10.0,
        phase=ConstantPhase(1)
        )

Listric normal fault that flattens into a detachment at 15 km depth:

julia
add_fault!(Phase, Temp, Grid;
        Start=(50,0), End=(50,100),
        Fault_thickness=2.0,
        DipAngle=30.0,
        DetachmentDepth=15.0,
        phase=ConstantPhase(1)
        )

Fault with a curved surface trace, dipping towards the center of the arc:

julia
add_fault!(Phase, Temp, Grid;
        Trace=[(50 + 40cosd(a), 50 + 40sind(a)) for a in 0:10:180],
        Fault_thickness=2.0,
        DipAngle=-30.0,
        phase=ConstantPhase(1)
        )
source
GeophysicalModelGenerator.make_volc_topo Function

make_volc_topo(Grid::Union{LaMEM_grid, CartData}; center, height, radius, crater=0.0, base=0.0, background=nothing)

Creates a generic volcano topography (cones and truncated cones). For a LaMEM_grid it returns a CartData with the topography as field Topography; for a CartData it returns the topography as a Matrix.

Parameters

  • Grid - LaMEM grid (created by read_LaMEM_inputfile)

  • center - x- and -coordinates of center of volcano

  • height - height of volcano

  • radius - radius of volcano

Optional Parameters

  • crater - this will create a truncated cone and the option defines the radius of the flat top

  • base - this sets the flat topography around the volcano

  • background - this allows loading in a topography and only adding the volcano on top (also allows stacking of several cones to get a volcano with different slopes)

Example

Cylinder with constant phase and temperature:

julia
julia> Grid = read_LaMEM_inputfile("test_files/SaltModels.dat")
LaMEM Grid:
  nel         : (32, 32, 32)
  marker/cell : (3, 3, 3)
  markers     : (96, 96, 96)
  x           ϵ [-3.0 : 3.0]
  y           ϵ [-2.0 : 2.0]
  z           ϵ [-2.0 : 0.0]
julia> Topo = make_volc_topo(Grid, center=[0.0,0.0], height=0.4, radius=1.5, crater=0.5, base=0.1)
CartData
    size    : (33, 33, 1)
    x       ϵ [ -3.0 : 3.0]
    y       ϵ [ -2.0 : 2.0]
    z       ϵ [ 0.1 : 0.4]
    fields  : (:Topography,)
  attributes: ["note"]
julia> Topo = make_volc_topo(Grid, center=[0.0,0.0], height=0.8, radius=0.5, crater=0.0, base=0.4, background=Topo.fields.Topography)
CartData
    size    : (33, 33, 1)
    x       ϵ [ -3.0 : 3.0]
    y       ϵ [ -2.0 : 2.0]
    z       ϵ [ 0.1 : 0.8]
    fields  : (:Topography,)
  attributes: ["note"]
julia> write_paraview(Topo,"VolcanoTopo")           # Save topography to paraview
Saved file: VolcanoTopo.vts
source
GeophysicalModelGenerator.ConstantTemp Type
julia
ConstantTemp(T=1000)

Sets a constant temperature inside the box

Parameters

  • T : the value
source
GeophysicalModelGenerator.LinearTemp Type
julia
LinearTemp(Ttop=0, Tbot=1350)

Set a linear temperature structure from top to bottom.

Ttop is applied at the top of the region the structure is added to (e.g. the top of the box or polygon) and Tbot at its bottom, wherever these are located; the temperature varies linearly in between.

Parameters

  • Ttop : the value @ the top

  • Tbot : the value @ the bottom

source
GeophysicalModelGenerator.HalfspaceCoolingTemp Type
julia
HalfspaceCoolingTemp(Tsurface=0, Tmantle=1350, Age=60, Adiabat=0)

Sets a halfspace temperature structure in plate.

Tsurface is applied at the top of the region the structure is added to (e.g. the top of the box or polygon), and the depth used in the cooling model is measured from there.

Parameters

  • Tsurface : surface temperature [C]

  • Tmantle : mantle temperature [C]

  • Age : Thermal Age of plate [Myrs]

  • Adiabat : Mantle Adiabat [K/km]

source
GeophysicalModelGenerator.SpreadingRateTemp Type
julia
SpreadingRateTemp(Tsurface=0, Tmantle=1350, Adiabat=0, MORside="left",SpreadingVel=3, AgeRidge=0, maxAge=60)

Sets a halfspace temperature structure within the box, combined with a spreading rate (which implies that the plate age varies)

Parameters

  • Tsurface : surface temperature [C]

  • Tmantle : mantle temperature [C]

  • Adiabat : Mantle Adiabat [K/km]

  • MORside : side of the box where the MOR is located ["left","right","front","back"]

  • SpreadingVel : spreading velocity [cm/yr]

  • AgeRidge : thermal age of the ridge [Myrs]

  • maxAge : maximum thermal Age of plate [Myrs]

Note: a thermal age of zero, at a ridge with AgeRidge = 0, is taken as 1e-6 s to avoid division by zero

source
GeophysicalModelGenerator.LithosphericTemp Type
julia
LithosphericTemp(Tsurface=0.0, Tpot=1350.0, dTadi=0.5,
                    ubound="const", lbound="const, utbf = 50.0e-3, ltbf = 10.0e-3,
                    age = 120.0, dtfac = 0.9, nz = 201,
                    rheology = example_CLrheology()
                )

Calculates a 1D temperature profile [C] for variable thermal parameters including radiogenic heat source and linearly interpolates the temperature profile onto the box. The thermal parameters are defined in rheology and the structure of the lithosphere is define by LithosphericPhases().

Parameters

  • Tsurface : surface temperature [C]

  • Tpot : potential mantle temperature [C]

  • dTadi : adiabatic gradient [K/km]

  • ubound : Upper thermal boundary condition ["const","flux"]

  • lbound : Lower thermal boundary condition ["const","flux"]

  • utbf : Upper thermal heat flux [W/m]; if ubound == "flux"

  • ltbf : Lower thermal heat flux [W/m]; if lbound == "flux"

  • age : age of the lithosphere [Ma]

  • dtfac : Diffusion stability criterion to calculate T_age

  • nz : Grid spacing for the 1D profile within the box

  • rheology : Structure containing the thermal parameters for each phase [default example_CLrheology]

source
GeophysicalModelGenerator.ConstantPhase Type
julia
ConstantPhase(phase=1)

Sets a constant phase inside the box

Parameters

  • phase : the value
source
GeophysicalModelGenerator.compute_phase Function
julia
Phase = compute_phase(Phase, Temp, X, Y, Z, s::LithosphericPhases; Ztop = 0)

or

julia
Phase = compute_phase(Phase, Temp, Grid::LaMEM_grid, s::LithosphericPhases)

This copies the layered lithosphere onto the Phase matrix.

Parameters

  • Phase - Phase array

  • Temp - Temperature array

  • X - x-coordinate array (consistent with Phase and Temp)

  • Y - y-coordinate array (consistent with Phase and Temp)

  • Z - Vertical coordinate array (consistent with Phase and Temp)

  • s - LithosphericPhases

  • Ztop - Vertical coordinate of top of model box

  • Grid - LaMEM grid (usually obtained with read_LaMEM_inputfile); Ztop is the top of the grid

source
GeophysicalModelGenerator.LithosphericPhases Type
julia
LithosphericPhases(Layers=[10 20 15], Phases=[1 2 3 4], Tlab=nothing )

This allows defining a layered lithosphere. Layering is defined from the top downwards.

Parameters

  • Layers : The thickness of each layer, ordered from top to bottom. The thickness of the last layer does not have to be specified.

  • Phases : The phases of the layers, ordered from top to bottom.

  • Tlab : Temperature of the lithosphere asthenosphere boundary. If specified, the phases at locations with T>Tlab are set to Phases[end].

source
GeophysicalModelGenerator.McKenzie_subducting_slab Type
julia
McKenzie_subducting_slab

Thermal structure by McKenzie for a subducted slab that is fully embedded in the mantle.

Parameters

  • Tsurface: Top T [C]

  • Tmantle: Bottom T [C]

  • Adiabat: Adiabatic gradient in K/km

  • v_cm_yr: Subduction velocity [cm/yr]

  • κ: Thermal diffusivity [m2/s]

  • it: Number iterations employed in the harmonic summation

source
GeophysicalModelGenerator.LinearWeightedTemperature Type
julia
LinearWeightedTemperature

Structure that defined a linear average temperature between two temperature fields as a function of distance

Parameters

  • w_min: Minimum weight

  • w_max: Maximum weight

  • crit_dist: Critical distance; in add_slab!with aTrenchanddir = :X, the length along the slab down tod_decoupling

  • dir: Direction of the averaging (:X, :Y or :Z)

  • F1: First temperature field

  • F2: Second temperature field

source
GeophysicalModelGenerator.GaussianTemp Type
julia
GaussianTemp(Amplitude=200, Width=50)

Adds a Gaussian temperature anomaly to the current temperature (e.g. a geotherm set before), centered in the region it is added to (e.g. the center of a sphere or box), as for a plume head or a thermal seed:

T = T + Amplitude * exp(-((x - x0)² / Wx² + (y - y0)² / Wy² + (z - z0)² / Wz²) / 2)

Parameters

  • Amplitude : temperature anomaly at the center [C]; negative for a cold anomaly

  • Width : standard deviation of the Gaussian [km], either one value or a tuple (Wx, Wy, Wz). A width of Inf gives a temperature that is constant along that axis, e.g. (50, 50, Inf) for a vertical plume conduit.

Choose a region that extends to about three widths from its center, so that the anomaly fades out at its edge.

source
GeophysicalModelGenerator.Trench Type
julia
Trench structure

Structure that defines the geometry of the trench and the slab.

Parameters

  • Start - Start of the trench (x,y) coordinates

  • End - End of the trench (x,y) coordinates

  • Trace - If not nothing, the trench as a polyline of two or more (x,y) points, which replaces Start and End; see bezier_curve for smooth curves. The slab bends perpendicular to the curved trench, to its left for direction = 1 and to its right for direction = -1, and ends at the ends of the trench.

  • n_seg - The number of segment through which the slab is discretize along the dip

  • Length - The length of the slab

  • Thickness - The thickness of the slab

  • Lb - Critical distance through which apply the bending angle functions Lb ∈ [0,Length];

  • θ_max - maximum angle of bending ∈ [0°,90°].

  • direction - the direction of the dip The rotation of the coordinate system is done as such that the new X is parallel to the segment. Since the rotation is anticlockwise the coordinate y has specific values: direction tells if the subduction is directed along the positive or negative direction of the new y coordinate system. In practice, it apply an additional transformation to y by multiplying it with -1 or +1;

  • d_decoupling - depth at which the slab is fully submerged into the mantle. A LinearWeightedTemperature of the slab with dir = :X blends its two structures over the length along the slab down to this depth; with another dir, its crit_dist is kept.

  • type_bending - is the type of bending angle of the slab [:Linear, :Ribe]. The angle of slab changes as a function of l (∈ [0,Length]). l is the actual distance along the slab length from the trench. In case: - :Linear math θ(l) = ((θ_max - 0.0)/(Lb-0))*l; - :Ribe math θ(l) = θ_max*l^2*((3*Lb-2*l))/(Lb^3); which is taken from Ribe 2010 [Bending mechanics and mode selection in free subduction: a thin-sheet analysis] For l>Lb, θ(l) = θ_max;

  • WeakzoneThickness - Thickness of the weakzone [km]

  • WeakzonePhase - Phase of the weakzone

  • Bending - If not nothing, the dip profile as (angle, length) pairs, e.g. [(20, 150), (80, 250)]: starting at 0° where the slab starts, the dip changes linearly to each angle (in degrees) over each length (in km) along the top of the slab. It replaces Length, Lb, θ_max and type_bending.

  • Behind - Length [km] of the slab behind the trench, where the slab starts, e.g. to bend the plate before the trench.

  • ThermalThickness - If not nothing, the thickness [km] below the top of the slab within which add_slab! sets the temperature, with the phases set within Thickness; e.g. to reach the mantle temperature at the base of the thermal structure of the slab.

  • Tear - If not nothing, a Tear that thins the slab towards a slab break-off. Start and Tip of the tear are distances along the trench from Start of the trench (along Trace for a curved trench), or map points. ThermalThickness thins by the same factor as Thickness, and the weak zone thins by it with its base on the slab surface, so that both vanish where the slab is torn.

source
GeophysicalModelGenerator.Tear Type
julia
Tear(; Depth, Width, Start, Tip)

Tear of a slab towards a slab break-off, for the Tear of a BezierSlab or a Trench. The slab necks around the depth Depth [km, positive downwards]: the neck starts at Start along the trench, where the slab has its full thickness, and deepens towards Tip, where the slab is torn through at Depth; beyond Tip the torn gap widens, with a detached slab below it. Width [km] is the vertical width of the neck. The tear runs in either direction along the trench.

Start and Tip are each a distance [km] along the trench (see BezierSlab and Trench), or a map point (x, y) whose nearest point on the trench in map view sets that distance; a map point beyond the ends of the trench is an error.

At a point of the slab surface at distance a along the trench and depth z, the slab thickness is multiplied by

julia
φ = clamp(1 - A exp(-((z - Depth) / Width)²), 0, 1),   A = max(0, (a - Start) / (Tip - Start))

The thickness is thus continuous and full before Start; beyond Tip (A > 1) the slab is torn over the depth interval |z - Depth| ≤ Width √(log A). Thermal and phase structures see the distance below the surface stretched by 1 / φ, so that crust and thermal boundary layer thin with the slab. The temperature is then blended with the temperature T₀ before the slab is added, T₀ + φ (T_slab - T₀), so that the neck warms as it thins, and the torn gap keeps T₀.

Example

julia
julia> tear = Tear(; Depth = 180, Width = 50, Start = 550, Tip = 770);
julia> add_slab!(Phases, Temp, Grid, BezierSlab(; Points, Thickness = 80, Tear = tear); phase = ConstantPhase(1))
source
GeophysicalModelGenerator.BezierSlab Type
julia
BezierSlab(; Points, Thickness = 100.0, Tear = nothing)

Slab whose top is a tensor-product Bézier surface, for add_slab!. Points[i, j] = (x, y, z) are the control points: i runs along the trench and j down the dip, such that the slab dips to the right of the trench seen in the direction of increasing i. The sections Points[i, :] may differ along the trench, and a slab whose sections start horizontally joins smoothly to a plate added with add_plate! along bezier_curve(Points[:, 1]).

The slab extends Thickness below the surface, measured perpendicular to it, so the surface must bend with radii larger than Thickness. Thickness is a number or a function (x, y, z) -> thickness of the point of the surface, e.g. to thin the slab towards a slab break-off, where the thickness reaches 0. Where a function thins the slab, it is compressed: thermal and phase structures see the distance below the surface stretched to the largest thickness, so that crust and thermal boundary layer thin with the slab and the temperature stays continuous.

Tear is nothing or a Tear, which thins the slab towards a slab break-off; it multiplies Thickness, also if that is a function. The distances Start and Tip of the tear are measured in map view along the edge bezier_curve(Points[:, 1]) of the surface, the trench, from its first point; a point of the surface is as far along the trench as the point of the edge with the same parameter along the trench.

Thermal and phase structures see the slab in its own coordinates: x is an estimate of the distance along the dip (from the mean length of the control polygons in j), which McKenzie_subducting_slab uses; y is the depth of the surface above the point; and z is the distance below the surface. A LinearWeightedTemperature with dir = :Y thus blends two thermal structures with the depth of the slab surface, e.g. from half-space cooling at the trench to McKenzie_subducting_slab at the base of the overriding plate.

Example

A trench that bends in map view, with sections that steepen along it:

julia
julia> trench = [(300.0, 0.0), (300.0, 400.0), (600.0, 600.0), (600.0, 1000.0)];   # control points along the trench
julia> section(dip) = [(0.0, 0.0), (120.0, 0.0), (220.0, -60.0), (220 + 250cosd(dip), -60 - 250sind(dip))];   # (distance, depth)
julia> dips = (30, 40, 50, 60);
julia> Points = [(trench[i][1] + section(dips[i])[j][1], trench[i][2], section(dips[i])[j][2]) for i in 1:4, j in 1:4];
julia> Grid = CartData(xyz_grid(0:20:1000, 0:20:1000, -400:20:0));
julia> Phases = zeros(Int32, size(Grid));
julia> Temp = zeros(Float64, size(Grid));
julia> add_slab!(Phases, Temp, Grid, BezierSlab(; Points, Thickness = 80.0); phase = ConstantPhase(1))
source
GeophysicalModelGenerator.add_plate! Function
julia
    add_plate!(Phase, Temp, Grid::AbstractGeneralGrid; xlim=(), ylim=(), zlim::Tuple = (0.0,0.8), phase = ConstantPhase(1), T=nothing, segments=nothing, cell=false )

Adds a tectonic plate with phase and temperature structure to a 3D model setup. Depths in phase and T are measured below the top of the plate (the maximum of zlim). This function enables the definition of tectonic plates in the xy plane and projects them along the z-axis, providing a flexible approach to model complex plate geometries. Parameters ==========

  • Phase - Phase array (consistent with Grid)

  • Temp - Temperature array (consistent with Grid)

  • Grid - Grid structure (usually obtained with read_LaMEM_inputfile)

  • xlim - x-coordinate of the polygon points, same ordering as ylim, number of points unlimited

  • ylim - y-coordinate of the polygon points, same ordering as xlim, number of points unlimited

  • zlim - z-coordinate range for projecting the polygon (start and stop, two values)

  • phase - Specifies the phase of the plate. See ConstantPhase(); nothing keeps the phases

  • T - Specifies the temperature of the plate. See ConstantTemp(), LinearTemp(), HalfspaceCoolingTemp(), SpreadingRateTemp()

  • segments - Optional. Ridge segments for T = SpreadingRateTemp(), from which the plate age is measured.

  • cell - If true, Phase and Temp are defined on cell centers

Example

Tectonic plate in the xy plane with phase and temperature structure: ```julia-repl julia> x, y, z = -1000.0:4:0.0, -1000.0:4:1000.0, -660.0:5:0.0; julia> Grid = CartData(xyz_grid(x, y, z)) Grid: nel : (512, 512, 128) marker/cell : (1, 1, 1) markers : (512, 512, 128) x ϵ [-1000.0 : 0.0] y ϵ [-1000.0 : 1000.0] z ϵ [-660.0 : 0.0] julia> Phases = zeros(Int32, size(Grid.X)) julia> Temp = zeros(Float64, size(Grid.X)) julia> segments = [ ((-500.0, -1000.0), (-500.0, 0.0)), # Segment 1 ((-250.0, 0.0), (-250.0, 200.0)), # Segment 2 ((-750.0, 200.0), (-750.0, 1000.0)) # Segment 3 ] julia> lith = LithosphericPhases(Layers=[15 55], Phases=[1 2], Tlab=1250) julia> add_plate!(Phases, Temp, Grid; xlim=(-1000.0, -750.0, -250.0, 0.0, -250.0, -750.0), ylim=(0.0, 500.0, 500.0, 0.0, -500.0, -500.0), zlim=(-150.0, 0.0), phase=lith, T=SpreadingRateTemp(SpreadingVel=3), segments=segments) julia> Grid = addfield(Grid, (; Phases, Temp)) # Add fields julia> write_paraview(Grid, "Plate") # Save model to Paraview 1-element Vector{String}: "Plate.vts"

source
julia
add_plate!(Phase, Temp, Grid::AbstractGeneralGrid,
bounds::AbstractVector{<:AbstractVector{<:Real}};
phase = ConstantPhase(1),
T = nothing,
segments = nothing,
cell = false     )

Add plate function but getting bounds as a vector bounds in a way of [[xmin,xmax],[ymin,ymax],[zmin,zmax]]. If bounds is empty return nothing

source
GeophysicalModelGenerator.add_polygon! Function
julia
    add_polygon!(Phase, Temp, Grid::AbstractGeneralGrid; xlim=(), ylim=(0.0,0.8), zlim=(), phase = ConstantPhase(1), T=nothing, cell=false )

Adds a polygon with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models. Depths in phase and T are measured below the top of the polygon (the maximum of zlim).

Parameters

  • Phase - Phase array (consistent with Grid)

  • Temp - Temperature array (consistent with Grid)

  • Grid - Grid structure (usually obtained with read_LaMEM_inputfile)

  • xlim - x-coordinate of the polygon points, same ordering as zlim, number of points unlimited

  • ylim - y-coordinate, limitation in length possible (two values (start and stop))

  • zlim - z-coordinate of the polygon points, same ordering as xlim, number of points unlimited

  • phase - specifies the phase of the box. See ConstantPhase(); nothing keeps the phases

  • T - specifies the temperature of the box. See ConstantTemp(),LinearTemp(),HalfspaceCoolingTemp(),SpreadingRateTemp()

  • cell - if true, Phase and Temp are defined on cell centers

Example

Polygon with constant phase and temperature:

julia
julia> Grid = read_LaMEM_inputfile("test_files/SaltModels.dat")
LaMEM Grid:
  nel         : (32, 32, 32)
  marker/cell : (3, 3, 3)
  markers     : (96, 96, 96)
  x           ϵ [-3.0 : 3.0]
  y           ϵ [-2.0 : 2.0]
  z           ϵ [-2.0 : 0.0]
julia> Phases = zeros(Int32,   size(Grid.X));
julia> Temp   = zeros(Float64, size(Grid.X));
julia> add_polygon!(Phase, Temp, Cart; xlim=(0,0, 1.6, 2.0),ylim=(0,0.8), zlim=(0,-1,-2,0), phase = ConstantPhase(8), T=ConstantTemp(30))
julia> Model3D = ParaviewData(Grid, (Phases=Phases,Temp=Temp)); # Create Cartesian model
julia> write_paraview(Model3D,"LaMEM_ModelSetup")           # Save model to paraview
1-element Vector{String}:
 "LaMEM_ModelSetup.vts"
source
julia
add_polygon!(Phase, Temp, Grid::AbstractGeneralGrid,
bounds::AbstractVector{<:AbstractVector{<:Real}};
phase = ConstantPhase(1),
T = nothing,
cell = false     )

Add polygon function but getting bounds as a vector bounds in a way of [[xmin,xmax],[ymin,ymax],[zmin,zmax]]. If bounds is empty return nothing

source
GeophysicalModelGenerator.add_volcano! Function

add_volcano!( Phases, Temp, Grid::CartData; volcanic_phase, center, height, radius, crater, base, background, T, )

Adds a volcano topography (cones and truncated cones)

Parameters

  • Phases - Phase array (consistent with Grid)

  • Temp - Temperature array (consistent with Grid)

  • Grid - CartData

Optional Parameters

  • volcanic_phase - phase number of the volcano,

  • center - x- and -coordinates of center of volcano

  • height - height of volcano

  • radius - radius of volcano

  • T - temperature structure, applied to every point with a phase > 0 (all rock, not only the volcano; phase 0 is taken as air), with depth measured from the new topography, so that isotherms follow the volcano surface

  • crater - this will create a truncated cone and the option defines the radius of the flat top

  • base - this sets the flat topography around the volcano

  • background - this allows loading in a topography and only adding the volcano on top (also allows stacking of several cones to get a volcano with different slopes)

source
GeophysicalModelGenerator.compute_slab_surface Function
julia
Top, Bot = compute_slab_surface(trench::Trench)

Computes the (x,z) coordinates of the slab top, bottom surface using the mid surface of the slab as reference.

Parameters

  • trench - Trench structure that contains the relevant parameters

Method

It computes it by discretizing the slab surface in n_seg segments, and computing the average bending angle (which is a function of the current length of the slab). Next, it compute the coordinates assuming that the trench is at 0.0, and assuming a positive θ_max angle.

source
GeophysicalModelGenerator.compute_thermal_structure Function
julia
compute_thermal_structure(Temp, X, Y, Z, Phase, s::SpreadingRateTemp, segments)

Calculates the temperature distribution across the plate considering multiple ridge segments.

This function computes the thermal structure based on the perpendicular distance from each point to its corresponding ridge segment, and applies a thermal model using a spreading velocity and thermal age.

Parameters

  • Temp : Temperature field to be updated (array)

  • X, Y, Z : Coordinates of the points (arrays)

  • Phase : Phase of the material (unused)

  • s : SpreadingRateTemp object containing the thermal and spreading parameters

  • segments : List of ridge segments, where each segment is defined by two tuples representing the start and end coordinates (x1, y1) and (x2, y2) for each segment.

Note

The temperature at each point is calculated using the thermal age, which is determined by the spreading velocity and the distance from the point to the ridge segment that produced it. Consecutive segments are joined by transform faults, from the end of one segment to the start of the next; the fracture zones continue the transform faults as straight lines and separate the regions of the segments. The segments are therefore ordered along the ridge, and each pair of consecutive segments must lie on opposite sides of their transform fault.

The function works with one or more segments, and the ridge can be placed at any position within the box, not only at its boundary.

The thermal age is capped at maxAge years, and the temperature is adjusted based on the distance to the ridge and the corresponding thermal gradient.

source
julia
compute_thermal_structure(Temp, X, Y, Z, Phase, s::McKenzie_subducting_slab)

Compute the temperature field of a McKenzie_subducting_slab. Uses the analytical solution of McKenzie (1969) ["Speculations on the consequences and causes of plate motions"]. Depth is measured from the top of the region, and the slab thickness is the height of the region.

Parameters

=============================

  • Temp: Temperature array

  • X: X Array

  • Y: Y Array

  • Z: Z Array

  • Phase: Phase array

  • s: McKenzie_subducting_slab

source
julia
compute_thermal_structure(Temp, X, Y, Z, Phase, s::LinearWeightedTemperature)

Weight average along distance

Do a weight average between two field along a specified direction

Given a distance (could be any array, from X,Y) -> the weight of F1 increase from the origin, while F2 decreases.

This function has been conceived for averaging the solution of McKenzie and half space cooling models, but it can be used to smooth the temperature field from continent ocean:

  • Select the boundary to apply;

  • transform the coordinate such that dist represent the perpendicular direction along which you want to apply this smoothening and in a such way that 0.0 is the point in which the weight of F1 is equal to 0.0;

  • Select the points that belongs to this area

  • compute the thermal fields

  • then modify F.

source
GeophysicalModelGenerator.bezier_curve Function
julia
bezier_curve(points, n = 100)

Returns n points along the Bézier curve with control points points, such as [(x1, y1), (x2, y2), ...]. The curve starts at the first and ends at the last control point; its degree is one less than the number of control points. The result can be used wherever a polyline is expected, e.g. as Trace of a Trench or of add_fault!, or as polygon of add_plate!. Curves joined end to end form a path; drop the first point of every following curve, as consecutive points of a trace must differ.

Example

julia
julia> trace = bezier_curve([(400.0, 0.0), (400.0, 500.0), (700.0, 500.0), (700.0, 1000.0)], 50);
julia> trench = Trench(Trace = trace, Thickness = 80.0, θ_max = 45.0, Length = 400, Lb = 200);
source
GeophysicalModelGenerator.read_outlines Function
julia
outlines = read_outlines(filename; tolerance = 1.0, bounds = nothing, reference = nothing)

Reads named map-view outlines, such as plate boundaries, weak zones and trenches, from a file. Returns a vector of named tuples (; name, closed, x, y) in the order of the file, which is the drawing order of an SVG file, so that later outlines can be painted over earlier ones. A closed outline is a polygon, e.g. for add_plate!(Phase, Temp, Grid; xlim = o.x, ylim = o.y, ...); only an open outline is valid as Trace of add_fault! or of a Trench, which also reject traces that turn by more than 90° between consecutive segments.

The format follows from the extension of filename:

  • .csv: one row per vertex with the columns id,name,closed,x,y, as written by write_outlines; the rows of an outline share its id, and closed is 0 or 1. Lines starting with # are comments.

  • .svg: every visible shape (path, rect, circle, ellipse, line, polyline, polygon) outside defs, clip paths, masks, patterns, symbols and markers is an outline, so that drawings from any vector graphics program (Inkscape, Affinity, Illustrator, ...) can be read. Elements hidden by display: none, such as hidden Inkscape layers, give no outlines, though they may hold the reference shape, and shapes exported as images, e.g. because they are semi-transparent, are not read. An outline is named by its attribute label (geomIO, or Inkscape's inkscape:label) or data-name (Illustrator), else by the label of its closest labeled group or Inkscape layer (or the layer's id), else by its own id, else by the id of its closest group (the layer name in Affinity). A <use> with a label names its copy. A path with several subpaths, e.g. a polygon with holes, gives one outline of the same name per subpath. A subpath that ends at its start is closed. Curves and arcs are flattened into polylines that deviate less than tolerance from them, in model units. Drawing coordinates are mapped to model coordinates by one of

    • reference = name => ((X0, Y0), (X1, Y1)): the shape name, typically a straight line, starts at the model coordinates (X0, Y0) and ends at (X1, Y1);

    • bounds = (xmin, xmax, ymin, ymax): the model coordinates of the viewBox of the drawing (its page);

    • a shape with an attribute CoordRef = "X0,Y0 X1,Y1", as in geomIO, used if neither keyword is given.

    The reference shape is not returned as an outline and must span a nonzero extent in x and y. Lengths with units (e.g. width="10mm" of a rect), arc flags written without a separator before the next number (a 5 5 0 0110 0) and <use> of a <symbol> with a viewBox are not supported and throw an error.

Example

julia
julia> outlines = read_outlines("MapviewSetup.svg"; tolerance = 4.0);
julia> adria = only(filter(o -> o.name == "Adria", outlines));
julia> add_plate!(Phases, Temp, Grid; xlim = adria.x, ylim = adria.y, zlim = (-110, 0), phase = LithosphericPhases(Layers = [30, 80], Phases = [10, 3, 1]))
source
GeophysicalModelGenerator.write_outlines Function
julia
write_outlines(filename, outlines; comment = nothing)

Writes outlines, a vector of named tuples (; name, closed, x, y) as returned by read_outlines, to the CSV file filename, with one row per vertex and the columns id,name,closed,x,y. comment is written as # lines at the top, e.g. to record the source and units of the outlines.

source