diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 5e213dc..4b730a0 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-09-05T07:13:07","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.9.4","generation_timestamp":"2024-09-12T07:35:56","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/dev/LaMEM_ModelFunctions/index.html b/dev/LaMEM_ModelFunctions/index.html index 359755c..ac59a47 100644 --- a/dev/LaMEM_ModelFunctions/index.html +++ b/dev/LaMEM_ModelFunctions/index.html @@ -1,5 +1,5 @@ -Available functions · LaMEM.jl

List functions

These are all the functions that are provided for the LaMEM Julia Setup interface

LaMEM.LaMEM_Model.BCBlockType
LaMEM boundary condition `BCBlock` object
  • npath::Int64: Number of path points of Bezier curve (path-points only!)

  • theta::Vector{Float64}: # Orientation angles at path points (counter-clockwise positive)

  • time::Vector{Float64}: Times at path points

  • path::Vector{Float64}: Path points x-y coordinates

  • npoly::Int64: Number of polygon vertices

  • poly::Vector{Float64}: Polygon x-y coordinates at initial time

  • bot::Float64: Polygon bottom coordinate

  • top::Float64: Polygon top coordinate

source
LaMEM.LaMEM_Model.BoundaryConditionsType
Structure that contains the LaMEM boundary conditions information.
  • noslip::Vector{Int64}: No-slip boundary flag mask (left right front back bottom top)

  • open_top_bound::Int64: Stress-free (free surface/infinitely fast erosion) top boundary flag

  • temp_top::Float64: Constant temperature on the top boundary

  • temp_bot::Float64: Constant temperature on the bottom boundary

  • exx_num_periods::Int64: number intervals of constant background strain rate (x-axis)

  • exx_time_delims::Vector{Float64}: time delimiters (one less than number of intervals, not required for one interval)

  • exx_strain_rates::Vector{Float64}: strain rates for each interval

  • eyy_num_periods::Int64: eyynumperiods

  • eyy_time_delims::Vector{Float64}: eyytimedelims

  • eyy_strain_rates::Vector{Float64}: eyystrainrates

  • exy_num_periods::Int64: exynumperiods

  • exy_time_delims::Vector{Float64}: exytimedelims

  • exy_strain_rates::Vector{Float64}: exystrainrates

  • exz_num_periods::Int64: exznumperiods

  • exz_time_delims::Vector{Float64}: exztimedelims

  • exz_strain_rates::Vector{Float64}: exzstrainrates

  • eyz_num_periods::Int64: eyznumperiods

  • eyz_time_delims::Vector{Float64}: eyztimedelims

  • eyz_strain_rates::Vector{Float64}: eyzstrainrates

  • bg_ref_point::Vector{Float64}: background strain rate reference point (fixed)

  • VelocityBoxes::Vector{VelocityBox}: List of added velocity boxes

  • BCBlocks::Vector{BCBlock}: List of added Bezier blocks

  • VelCylinders::Vector{VelCylinder}: List of added velocity cylinders

  • bvel_face::Union{Nothing, String}: Face identifier (Left; Right; Front; Back; CompensatingInflow)

  • bvel_face_out::Union{Nothing, Int64}: Velocity on opposite side: -1 for inverted velocity; 0 for no velocity; 1 for the same direction of velocity

  • bvel_bot::Union{Nothing, Float64}: Bottom coordinate of inflow window

  • bvel_top::Union{Nothing, Float64}: Top coordinate of inflow window

  • velin_num_periods::Union{Nothing, Int64}: Number of periods when velocity changes (Optional)

  • velin_time_delims::Union{Nothing, Vector}: Change velocity at 2 and 5 Myrs (one less than number of intervals, not required for one interval) (Optional)

  • bvel_velin::Union{Nothing, Vector}: inflow velocity for each time interval(Multiple values required if velinnumperiods>1)

  • bvel_velout::Union{Nothing, Float64}: outflow velocity (if not specified, computed from mass balance)

  • bvel_relax_d::Union{Nothing, Float64}: vert.distance from bvelbot and bveltop over which velocity is reduced linearly

  • bvel_velbot::Union{Nothing, Int64}: bottom inflow velocity for use with bvel_face=CompensatingInflow

  • bvel_veltop::Union{Nothing, Int64}: top inflow velocity for use with bvel_face=CompensatingInflow

  • bvel_temperature_inflow::Union{Nothing, String}: bveltemperatureinflow: Thermal age of the plate, which can be constant if set to Fixedthermalage or ConstantTinflow (Temperature of the inflow material is constant everywhere)

  • bvel_thermal_age::Union{Nothing, Float64}: In dimensional unit. If the user specify this value, he needs to specify the temperature of the mantle and top as well

  • bvel_temperature_mantle::Union{Nothing, Float64}: In dimensional unit. Temperature of the mantle

  • bvel_temperature_top::Union{Nothing, Float64}: In dimensional unit. temperature of the top

  • bvel_temperature_constant::Union{Nothing, Float64}: Constant temperature inflow.

  • bvel_num_phase::Union{Nothing, Int64}: Imposes a stratigraphy of phase injected in the inflow boundary [if undefined, it uses the phase close to the boundary]

  • bvel_phase::Union{Nothing, Vector{Int64}}: phase number of inflow material [if undefined, it uses the phase close to the boundary] from bottom to top

  • bvel_phase_interval::Union{Nothing, Vector{Float64}}: Depth interval of injection of the phase (the interval is defined by num_phase+1 coordinates). e.g. [-120 -100 -10 0 ]

  • open_bot_bound::Union{Nothing, Int64}: # Permeable lower boundary flag

  • permeable_phase_inflow::Union{Nothing, Int64}: Phase of the inflow material from the bottom (The temperature of the inflow phase it is the same of the bottom boundary) in case of openbotbound=1

  • fix_phase::Union{Nothing, Int64}: fixed phase (no-flow condition)

  • fix_cell::Union{Nothing, Int64}: fixed cells (no-flow condition)

  • fix_cell_file::Union{Nothing, String}: fixed cells input file (extension is .xxxxxxxx.dat)

  • temp_bot_num_periods::Union{Nothing, Int64}: How many periods with different temp_bot do we have?

  • temp_bot_time_delim::Union{Nothing, Vector{Float64}}: At which time do we switch from one to the next period?

  • Plume_InflowBoundary::Union{Nothing, Int64}: # have a plume-like inflow boundary @ bottom

  • Plume_Type::Union{Nothing, String}: Type of plume inflow boundary.

    • "Inflow_type" or
    • "Pressure_type" (circular) or
    • "Permeable_Type" which combines the open bot boundary with the plume boundary condition (the option herein listed overwrites open_bot, so do not activate that)
  • Plume_Dimension::Union{Nothing, String}: 2D or 3D (circular)

  • Plume_areaFrac::Union{Nothing, Float64}: how much of the plume is actually in the model. This usually 1 (default) but lower if the plume is in a corner of a symmetric setup and matters for the outflow

  • Plume_Phase::Union{Nothing, Int64}: phase of plume material

  • Plume_Depth::Union{Nothing, Float64}: # depth of provenience of the plume (i.e. how far from the bottom of the model the plume source is)

  • Plume_Mantle_Phase::Union{Nothing, Int64}: # Astenosphere phase (if the inflow occurs outside the plume radius)

  • Plume_Temperature::Union{Nothing, Float64}: # temperature of inflow plume

  • Plume_Inflow_Velocity::Union{Nothing, Float64}: # Inflow velocity (not required if Pressure_Type) in cm/year if using GEOunits

  • Plume_VelocityType::Union{Nothing, String}: "Gaussian" or "Poiseuille"

  • Plume_Center::Union{Nothing, Vector{Float64}}: # [X,Y] of center (2nd only in case of 3D plume)

  • Plume_Radius::Union{Nothing, Float64}: # Width/Radius of plume

  • Plume_Phase_Mantle::Union{Nothing, Int64}: # Inflow phase. If the velocity happens to be positive in the domain, the inflow material has a constant phase and the temperature of the bottom

  • pres_top::Union{Nothing, Float64}: Pressure on the top boundary

  • pres_bot::Union{Nothing, Float64}: Pressure on the bottom boundary

  • init_pres::Union{Nothing, Int64}: pressure initial guess flag; linear profile between prestop and presbot in the unconstrained cells

  • init_temp::Union{Nothing, Int64}: temperature initial guess flag; linear profile between temptop and tempbot

source
LaMEM.LaMEM_Model.DikeType
Defines the properties related to inserting dikes
  • ID::Int64: Material phase ID

  • Mf::Float64: value for dike/magma- accommodated extension, between 0 and 1, in the front of the box, for phase dike

  • Mc::Float64: [optional] value for dike/magma- accommodate extension, between 0 and 1, for dike phase; M is linearly interpolated between Mf & Mc and Mc & Mb, if not set, Mc default is set to -1 so it is not used

  • y_Mc::Union{Nothing, Float64}: [optional], location for Mc, must be between front and back boundaries of dike box, if not set, default value to 0.0, but not used

  • Mb::Union{Nothing, Float64}: value for dike/magma-accommodated extension, between 0 and 1, in the back of the box, for phase dike

  • PhaseID::Union{Nothing, Int64}: Phase ID

  • PhaseTransID::Union{Nothing, Int64}: Phase transition ID

source
LaMEM.LaMEM_Model.FreeSurfaceType
Structure that contains the LaMEM free surface information.
  • surf_use::Int64: Free surface activation flag

  • surf_corr_phase::Int64: air phase ratio correction flag (phases in an element that contains are modified based on the surface position)

  • surf_level::Union{Nothing, Float64}: initial level of the free surface

  • surf_air_phase::Union{Nothing, Int64}: phase ID of sticky air layer

  • surf_max_angle::Float64: maximum angle with horizon (smoothed if larger)

  • surf_topo_file::String: initial topography file (redundant)

  • erosion_model::Int64: erosion model [0-none (default), 1-infinitely fast, 2-prescribed rate with given level]

  • er_num_phases::Int64: number of erosion phases

  • er_time_delims::Vector{Float64}: erosion time delimiters (one less than number)

  • er_rates::Vector{Float64}: constant erosion rates in different time periods

  • er_levels::Vector{Int64}: levels above which we apply constant erosion rates in different time periods

  • sediment_model::Int64: sedimentation model [0-none (dafault), 1-prescribed rate with given level, 2-cont. margin]

  • sed_num_layers::Int64: number of sediment layers

  • sed_time_delims::Vector{Float64}: sediment layers time delimiters (one less than number)

  • sed_rates::Vector{Float64}: sediment rates in different time periods

  • sed_levels::Vector{Float64}: levels below which we apply constant sediment rates in different time periods

  • sed_phases::Vector{Int64}: sediment layers phase numbers in different time periods

  • marginO::Vector{Float64}: lateral coordinates of continental margin - origin

  • marginE::Vector{Float64}: lateral coordinates of continental margin - 2nd point

  • hUp::Float64: up dip thickness of sediment cover (onshore)

  • hDown::Float64: down dip thickness of sediment cover (off shore)

  • dTrans::Float64: half of transition zone

  • Topography::Union{Nothing, GeophysicalModelGenerator.CartData}: Topography grid

source
LaMEM.LaMEM_Model.GeomBoxType
LaMEM geometric primitive `Box` object
  • phase::Int64: phase

  • bounds::Vector{Float64}: box bound coordinates: left, right, front, back, bottom, top

  • Temperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant, linear, halfspace]

  • cstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]

  • topTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • botTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • thermalAge::Union{Nothing, Float64}: required in case of [halfspace]: thermal age of lithosphere [in Myrs if GEO units are used]

source
LaMEM.LaMEM_Model.GeomCylinderType
LaMEM geometric primitive `Cylinder` object
  • phase::Int64: phase

  • radius::Float64: radius of cylinder

  • base::Vector{Float64}: center of base of cylinder

  • cap::Vector{Float64}: center of cap of cylinder

  • Temperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant]

  • cstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]

source
LaMEM.LaMEM_Model.GeomEllipsoidType
LaMEM geometric primitive `Ellipsoid` object
  • phase::Int64: phase

  • axes::Vector{Float64}: semi-axes of ellipsoid in x, y and z

  • center::Vector{Float64}: center of sphere

  • Temperature::Union{Nothing, String}: optional: Temperature of the sphere. possibilities: [constant, or nothing]

  • cstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]

source
LaMEM.LaMEM_Model.GeomHexType
LaMEM geometric primitive `Hex` object to define hexahedral elements
  • phase::Int64: phase

  • coord::Vector{Float64}: x-y-z coordinates for each of 8 nodes (24 parameters) (counter)-clockwise for an arbitrary face, followed by the opposite face

source
LaMEM.LaMEM_Model.GeomLayerType
LaMEM geometric primitive `Layer` object
  • phase::Int64: phase

  • top::Float64: top of layer

  • bottom::Float64: bottom of layer

  • cosine::Union{Nothing, Int64}: optional: add a cosine perturbation on top of the interface (if 1)

  • wavelength::Union{Nothing, Float64}: required if cosine: wavelength in x-direction

  • amplitude::Union{Nothing, Float64}: required if cosine: amplitude of perturbation

  • Temperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant, linear, halfspace]

  • cstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]

  • topTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • botTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • thermalAge::Union{Nothing, Float64}: required in case of [halfspace]: thermal age of lithosphere [in Myrs if GEO units are used]

source
LaMEM.LaMEM_Model.GeomRidgeSegType
LaMEM geometric primitive `RidgeSeg` object
  • phase::Int64: phase

  • bounds::Vector{Float64}: box bound coordinates: left, right, front, back, bottom, top

  • ridgeseg_x::Vector{Float64}: coordinate order: left, right [can be different for oblique ridge]

  • ridgeseg_y::Vector{Float64}: coordinate order: front, back [can be different for oblique ridge]

  • Temperature::String: initial temperature structure [ridge must be set to halfspace_age –> setTemp=4]

  • topTemp::Float64: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • botTemp::Float64: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • age0::Float64: minimum age of seafloor at ridge [in Myr in case of GEO units]

  • maxAge::Union{Nothing, Float64}: [optional] parameter that indicates the maximum thermal age of a plate

  • v_spread::Union{Nothing, Float64}: [optional] parameter that indicates the spreading velocity of the plate; if not defined it uses bvel_velin specified elsewhere

source
LaMEM.LaMEM_Model.GeomSphereType
LaMEM geometric primitive `sphere` object
  • phase::Int64: phase

  • radius::Float64: radius of sphere

  • center::Vector{Float64}: center of sphere

  • Temperature::Union{Nothing, String}: optional: Temperature of the sphere. possibilities: [constant, or nothing]

  • cstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]

source
LaMEM.LaMEM_Model.GridType
Structure that contains the LaMEM grid information
  • nmark_x::Int64: number of markers/element in x-direction

  • nmark_y::Int64: number of markers/element in y-direction

  • nmark_z::Int64: number of markers/element in x-direction

  • nel_x::Vector{Int64}: number of elements in x-direction

  • nel_y::Vector{Int64}: number of elements in y-direction

  • nel_z::Vector{Int64}: number of elements in z-direction

  • coord_x::Vector{Float64}: coordinates in x-direction

  • coord_y::Vector{Float64}: coordinates in y-direction

  • coord_z::Vector{Float64}: coordinates in z-direction

  • nseg_x::Int64: number of segments in x-direction (if we employ variable grid spacing in x-direction)

  • nseg_y::Int64: number of segments in y-direction (if we employ variable grid spacing in y-direction)

  • nseg_z::Int64: number of segments in z-direction (if we employ variable grid spacing in z-direction)

  • bias_x::Vector{Float64}: bias in x-direction (if we employ variable grid spacing in x-direction)

  • bias_y::Vector{Float64}: bias in y-direction (if we employ variable grid spacing in y-direction)

  • bias_z::Vector{Float64}: bias in z-direction (if we employ variable grid spacing in z-direction)

  • Grid::GeophysicalModelGenerator.LaMEM_grid: Contains the LaMEM Grid object

  • Phases::Array{Int32}: Phases; 3D phase information

  • Temp::Array{Float64}: Temp; 3D phase information

Example 1

julia> d=LaMEM.Grid(coord_x=[0.0, 0.7, 0.8, 1.0], bias_x=[0.3,1.0,3.0], nel_x=[10,4,2])
+Available functions · LaMEM.jl

List functions

These are all the functions that are provided for the LaMEM Julia Setup interface

LaMEM.LaMEM_Model.BCBlockType
LaMEM boundary condition `BCBlock` object
  • npath::Int64: Number of path points of Bezier curve (path-points only!)

  • theta::Vector{Float64}: # Orientation angles at path points (counter-clockwise positive)

  • time::Vector{Float64}: Times at path points

  • path::Vector{Float64}: Path points x-y coordinates

  • npoly::Int64: Number of polygon vertices

  • poly::Vector{Float64}: Polygon x-y coordinates at initial time

  • bot::Float64: Polygon bottom coordinate

  • top::Float64: Polygon top coordinate

source
LaMEM.LaMEM_Model.BoundaryConditionsType
Structure that contains the LaMEM boundary conditions information.
  • noslip::Vector{Int64}: No-slip boundary flag mask (left right front back bottom top)

  • open_top_bound::Int64: Stress-free (free surface/infinitely fast erosion) top boundary flag

  • temp_top::Float64: Constant temperature on the top boundary

  • temp_bot::Float64: Constant temperature on the bottom boundary

  • exx_num_periods::Int64: number intervals of constant background strain rate (x-axis)

  • exx_time_delims::Vector{Float64}: time delimiters (one less than number of intervals, not required for one interval)

  • exx_strain_rates::Vector{Float64}: strain rates for each interval

  • eyy_num_periods::Int64: eyynumperiods

  • eyy_time_delims::Vector{Float64}: eyytimedelims

  • eyy_strain_rates::Vector{Float64}: eyystrainrates

  • exy_num_periods::Int64: exynumperiods

  • exy_time_delims::Vector{Float64}: exytimedelims

  • exy_strain_rates::Vector{Float64}: exystrainrates

  • exz_num_periods::Int64: exznumperiods

  • exz_time_delims::Vector{Float64}: exztimedelims

  • exz_strain_rates::Vector{Float64}: exzstrainrates

  • eyz_num_periods::Int64: eyznumperiods

  • eyz_time_delims::Vector{Float64}: eyztimedelims

  • eyz_strain_rates::Vector{Float64}: eyzstrainrates

  • bg_ref_point::Vector{Float64}: background strain rate reference point (fixed)

  • VelocityBoxes::Vector{VelocityBox}: List of added velocity boxes

  • BCBlocks::Vector{BCBlock}: List of added Bezier blocks

  • VelCylinders::Vector{VelCylinder}: List of added velocity cylinders

  • bvel_face::Union{Nothing, String}: Face identifier (Left; Right; Front; Back; CompensatingInflow)

  • bvel_face_out::Union{Nothing, Int64}: Velocity on opposite side: -1 for inverted velocity; 0 for no velocity; 1 for the same direction of velocity

  • bvel_bot::Union{Nothing, Float64}: Bottom coordinate of inflow window

  • bvel_top::Union{Nothing, Float64}: Top coordinate of inflow window

  • velin_num_periods::Union{Nothing, Int64}: Number of periods when velocity changes (Optional)

  • velin_time_delims::Union{Nothing, Vector}: Change velocity at 2 and 5 Myrs (one less than number of intervals, not required for one interval) (Optional)

  • bvel_velin::Union{Nothing, Vector}: inflow velocity for each time interval(Multiple values required if velinnumperiods>1)

  • bvel_velout::Union{Nothing, Float64}: outflow velocity (if not specified, computed from mass balance)

  • bvel_relax_d::Union{Nothing, Float64}: vert.distance from bvelbot and bveltop over which velocity is reduced linearly

  • bvel_velbot::Union{Nothing, Int64}: bottom inflow velocity for use with bvel_face=CompensatingInflow

  • bvel_veltop::Union{Nothing, Int64}: top inflow velocity for use with bvel_face=CompensatingInflow

  • bvel_temperature_inflow::Union{Nothing, String}: bveltemperatureinflow: Thermal age of the plate, which can be constant if set to Fixedthermalage or ConstantTinflow (Temperature of the inflow material is constant everywhere)

  • bvel_thermal_age::Union{Nothing, Float64}: In dimensional unit. If the user specify this value, he needs to specify the temperature of the mantle and top as well

  • bvel_temperature_mantle::Union{Nothing, Float64}: In dimensional unit. Temperature of the mantle

  • bvel_temperature_top::Union{Nothing, Float64}: In dimensional unit. temperature of the top

  • bvel_temperature_constant::Union{Nothing, Float64}: Constant temperature inflow.

  • bvel_num_phase::Union{Nothing, Int64}: Imposes a stratigraphy of phase injected in the inflow boundary [if undefined, it uses the phase close to the boundary]

  • bvel_phase::Union{Nothing, Vector{Int64}}: phase number of inflow material [if undefined, it uses the phase close to the boundary] from bottom to top

  • bvel_phase_interval::Union{Nothing, Vector{Float64}}: Depth interval of injection of the phase (the interval is defined by num_phase+1 coordinates). e.g. [-120 -100 -10 0 ]

  • open_bot_bound::Union{Nothing, Int64}: # Permeable lower boundary flag

  • permeable_phase_inflow::Union{Nothing, Int64}: Phase of the inflow material from the bottom (The temperature of the inflow phase it is the same of the bottom boundary) in case of openbotbound=1

  • fix_phase::Union{Nothing, Int64}: fixed phase (no-flow condition)

  • fix_cell::Union{Nothing, Int64}: fixed cells (no-flow condition)

  • fix_cell_file::Union{Nothing, String}: fixed cells input file (extension is .xxxxxxxx.dat)

  • temp_bot_num_periods::Union{Nothing, Int64}: How many periods with different temp_bot do we have?

  • temp_bot_time_delim::Union{Nothing, Vector{Float64}}: At which time do we switch from one to the next period?

  • Plume_InflowBoundary::Union{Nothing, Int64}: # have a plume-like inflow boundary @ bottom

  • Plume_Type::Union{Nothing, String}: Type of plume inflow boundary.

    • "Inflow_type" or
    • "Pressure_type" (circular) or
    • "Permeable_Type" which combines the open bot boundary with the plume boundary condition (the option herein listed overwrites open_bot, so do not activate that)
  • Plume_Dimension::Union{Nothing, String}: 2D or 3D (circular)

  • Plume_areaFrac::Union{Nothing, Float64}: how much of the plume is actually in the model. This usually 1 (default) but lower if the plume is in a corner of a symmetric setup and matters for the outflow

  • Plume_Phase::Union{Nothing, Int64}: phase of plume material

  • Plume_Depth::Union{Nothing, Float64}: # depth of provenience of the plume (i.e. how far from the bottom of the model the plume source is)

  • Plume_Mantle_Phase::Union{Nothing, Int64}: # Astenosphere phase (if the inflow occurs outside the plume radius)

  • Plume_Temperature::Union{Nothing, Float64}: # temperature of inflow plume

  • Plume_Inflow_Velocity::Union{Nothing, Float64}: # Inflow velocity (not required if Pressure_Type) in cm/year if using GEOunits

  • Plume_VelocityType::Union{Nothing, String}: "Gaussian" or "Poiseuille"

  • Plume_Center::Union{Nothing, Vector{Float64}}: # [X,Y] of center (2nd only in case of 3D plume)

  • Plume_Radius::Union{Nothing, Float64}: # Width/Radius of plume

  • Plume_Phase_Mantle::Union{Nothing, Int64}: # Inflow phase. If the velocity happens to be positive in the domain, the inflow material has a constant phase and the temperature of the bottom

  • pres_top::Union{Nothing, Float64}: Pressure on the top boundary

  • pres_bot::Union{Nothing, Float64}: Pressure on the bottom boundary

  • init_pres::Union{Nothing, Int64}: pressure initial guess flag; linear profile between prestop and presbot in the unconstrained cells

  • init_temp::Union{Nothing, Int64}: temperature initial guess flag; linear profile between temptop and tempbot

source
LaMEM.LaMEM_Model.DikeType
Defines the properties related to inserting dikes
  • ID::Int64: Material phase ID

  • Mf::Float64: value for dike/magma- accommodated extension, between 0 and 1, in the front of the box, for phase dike

  • Mc::Float64: [optional] value for dike/magma- accommodate extension, between 0 and 1, for dike phase; M is linearly interpolated between Mf & Mc and Mc & Mb, if not set, Mc default is set to -1 so it is not used

  • y_Mc::Union{Nothing, Float64}: [optional], location for Mc, must be between front and back boundaries of dike box, if not set, default value to 0.0, but not used

  • Mb::Union{Nothing, Float64}: value for dike/magma-accommodated extension, between 0 and 1, in the back of the box, for phase dike

  • PhaseID::Union{Nothing, Int64}: Phase ID

  • PhaseTransID::Union{Nothing, Int64}: Phase transition ID

source
LaMEM.LaMEM_Model.FreeSurfaceType
Structure that contains the LaMEM free surface information.
  • surf_use::Int64: Free surface activation flag

  • surf_corr_phase::Int64: air phase ratio correction flag (phases in an element that contains are modified based on the surface position)

  • surf_level::Union{Nothing, Float64}: initial level of the free surface

  • surf_air_phase::Union{Nothing, Int64}: phase ID of sticky air layer

  • surf_max_angle::Float64: maximum angle with horizon (smoothed if larger)

  • surf_topo_file::String: initial topography file (redundant)

  • erosion_model::Int64: erosion model [0-none (default), 1-infinitely fast, 2-prescribed rate with given level]

  • er_num_phases::Int64: number of erosion phases

  • er_time_delims::Vector{Float64}: erosion time delimiters (one less than number)

  • er_rates::Vector{Float64}: constant erosion rates in different time periods

  • er_levels::Vector{Int64}: levels above which we apply constant erosion rates in different time periods

  • sediment_model::Int64: sedimentation model [0-none (dafault), 1-prescribed rate with given level, 2-cont. margin]

  • sed_num_layers::Int64: number of sediment layers

  • sed_time_delims::Vector{Float64}: sediment layers time delimiters (one less than number)

  • sed_rates::Vector{Float64}: sediment rates in different time periods

  • sed_levels::Vector{Float64}: levels below which we apply constant sediment rates in different time periods

  • sed_phases::Vector{Int64}: sediment layers phase numbers in different time periods

  • marginO::Vector{Float64}: lateral coordinates of continental margin - origin

  • marginE::Vector{Float64}: lateral coordinates of continental margin - 2nd point

  • hUp::Float64: up dip thickness of sediment cover (onshore)

  • hDown::Float64: down dip thickness of sediment cover (off shore)

  • dTrans::Float64: half of transition zone

  • Topography::Union{Nothing, GeophysicalModelGenerator.CartData}: Topography grid

source
LaMEM.LaMEM_Model.GeomBoxType
LaMEM geometric primitive `Box` object
  • phase::Int64: phase

  • bounds::Vector{Float64}: box bound coordinates: left, right, front, back, bottom, top

  • Temperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant, linear, halfspace]

  • cstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]

  • topTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • botTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • thermalAge::Union{Nothing, Float64}: required in case of [halfspace]: thermal age of lithosphere [in Myrs if GEO units are used]

source
LaMEM.LaMEM_Model.GeomCylinderType
LaMEM geometric primitive `Cylinder` object
  • phase::Int64: phase

  • radius::Float64: radius of cylinder

  • base::Vector{Float64}: center of base of cylinder

  • cap::Vector{Float64}: center of cap of cylinder

  • Temperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant]

  • cstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]

source
LaMEM.LaMEM_Model.GeomEllipsoidType
LaMEM geometric primitive `Ellipsoid` object
  • phase::Int64: phase

  • axes::Vector{Float64}: semi-axes of ellipsoid in x, y and z

  • center::Vector{Float64}: center of sphere

  • Temperature::Union{Nothing, String}: optional: Temperature of the sphere. possibilities: [constant, or nothing]

  • cstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]

source
LaMEM.LaMEM_Model.GeomHexType
LaMEM geometric primitive `Hex` object to define hexahedral elements
  • phase::Int64: phase

  • coord::Vector{Float64}: x-y-z coordinates for each of 8 nodes (24 parameters) (counter)-clockwise for an arbitrary face, followed by the opposite face

source
LaMEM.LaMEM_Model.GeomLayerType
LaMEM geometric primitive `Layer` object
  • phase::Int64: phase

  • top::Float64: top of layer

  • bottom::Float64: bottom of layer

  • cosine::Union{Nothing, Int64}: optional: add a cosine perturbation on top of the interface (if 1)

  • wavelength::Union{Nothing, Float64}: required if cosine: wavelength in x-direction

  • amplitude::Union{Nothing, Float64}: required if cosine: amplitude of perturbation

  • Temperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant, linear, halfspace]

  • cstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]

  • topTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • botTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • thermalAge::Union{Nothing, Float64}: required in case of [halfspace]: thermal age of lithosphere [in Myrs if GEO units are used]

source
LaMEM.LaMEM_Model.GeomRidgeSegType
LaMEM geometric primitive `RidgeSeg` object
  • phase::Int64: phase

  • bounds::Vector{Float64}: box bound coordinates: left, right, front, back, bottom, top

  • ridgeseg_x::Vector{Float64}: coordinate order: left, right [can be different for oblique ridge]

  • ridgeseg_y::Vector{Float64}: coordinate order: front, back [can be different for oblique ridge]

  • Temperature::String: initial temperature structure [ridge must be set to halfspace_age –> setTemp=4]

  • topTemp::Float64: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • botTemp::Float64: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]

  • age0::Float64: minimum age of seafloor at ridge [in Myr in case of GEO units]

  • maxAge::Union{Nothing, Float64}: [optional] parameter that indicates the maximum thermal age of a plate

  • v_spread::Union{Nothing, Float64}: [optional] parameter that indicates the spreading velocity of the plate; if not defined it uses bvel_velin specified elsewhere

source
LaMEM.LaMEM_Model.GeomSphereType
LaMEM geometric primitive `sphere` object
  • phase::Int64: phase

  • radius::Float64: radius of sphere

  • center::Vector{Float64}: center of sphere

  • Temperature::Union{Nothing, String}: optional: Temperature of the sphere. possibilities: [constant, or nothing]

  • cstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]

source
LaMEM.LaMEM_Model.GridType
Structure that contains the LaMEM grid information
  • nmark_x::Int64: number of markers/element in x-direction

  • nmark_y::Int64: number of markers/element in y-direction

  • nmark_z::Int64: number of markers/element in x-direction

  • nel_x::Vector{Int64}: number of elements in x-direction

  • nel_y::Vector{Int64}: number of elements in y-direction

  • nel_z::Vector{Int64}: number of elements in z-direction

  • coord_x::Vector{Float64}: coordinates in x-direction

  • coord_y::Vector{Float64}: coordinates in y-direction

  • coord_z::Vector{Float64}: coordinates in z-direction

  • nseg_x::Int64: number of segments in x-direction (if we employ variable grid spacing in x-direction)

  • nseg_y::Int64: number of segments in y-direction (if we employ variable grid spacing in y-direction)

  • nseg_z::Int64: number of segments in z-direction (if we employ variable grid spacing in z-direction)

  • bias_x::Vector{Float64}: bias in x-direction (if we employ variable grid spacing in x-direction)

  • bias_y::Vector{Float64}: bias in y-direction (if we employ variable grid spacing in y-direction)

  • bias_z::Vector{Float64}: bias in z-direction (if we employ variable grid spacing in z-direction)

  • Grid::GeophysicalModelGenerator.LaMEM_grid: Contains the LaMEM Grid object

  • Phases::Array{Int32}: Phases; 3D phase information

  • Temp::Array{Float64}: Temp; 3D phase information

Example 1

julia> d=LaMEM.Grid(coord_x=[0.0, 0.7, 0.8, 1.0], bias_x=[0.3,1.0,3.0], nel_x=[10,4,2])
 LaMEM grid with 1D refinement: 
   nel         : ([10, 4, 2], [16], [16])
   marker/cell : (3, 3, 3)
@@ -11,7 +11,7 @@
   marker/cell : (3, 3, 3)
   x           ϵ [-10.0 : 10.0]
   y           ϵ [-10.0 : 0.0]
-  z           ϵ [-10.0 : 0.0]
source
LaMEM.LaMEM_Model.MaterialsType
Structure that contains the material properties in the current simulation
  • Phases::Vector{Phase}: Different Materials implemented

  • SofteningLaws::Vector{Softening}: Softening laws implemented

  • PhaseTransitions::Vector{PhaseTransition}: Internal Phase Transitions (that change the ID of markers) implemented

  • Dikes::Vector{Dike}: Dikes implemented (mostly for MOR simulations)

  • PhaseAggregates::Vector{PhaseAggregate}: Phase aggregates (combines different phases such as upper_lower crust into one for visualization purposes)

source
LaMEM.LaMEM_Model.ModelType
Model

Structure that holds all the information to create a LaMEM input file

  • Scaling::Scaling: Scaling parameters

  • Grid::Grid: LaMEM Grid

  • Time::Any: Time options

  • FreeSurface::Any: Free surface options

  • BoundaryConditions::Any: Boundary conditions

  • SolutionParams::Any: Global solution parameters

  • Solver::Any: Solver options and optional PETSc options

  • ModelSetup::Any: Model setup

  • Output::Any: Output options

  • PassiveTracers::Any: Passive tracers

  • Materials::Any: Material parameters for each of the phases

source
LaMEM.LaMEM_Model.ModelMethod
Model(args...)

Allow to define a model setup by specifying some of the basic objects

Example

julia> d = Model(Grid(nel=(10,1,20)), Scaling(NO_units()))
+  z           ϵ [-10.0 : 0.0]
source
LaMEM.LaMEM_Model.MaterialsType
Structure that contains the material properties in the current simulation
  • Phases::Vector{Phase}: Different Materials implemented

  • SofteningLaws::Vector{Softening}: Softening laws implemented

  • PhaseTransitions::Vector{PhaseTransition}: Internal Phase Transitions (that change the ID of markers) implemented

  • Dikes::Vector{Dike}: Dikes implemented (mostly for MOR simulations)

  • PhaseAggregates::Vector{PhaseAggregate}: Phase aggregates (combines different phases such as upper_lower crust into one for visualization purposes)

source
LaMEM.LaMEM_Model.ModelType
Model

Structure that holds all the information to create a LaMEM input file

  • Scaling::Scaling: Scaling parameters

  • Grid::Grid: LaMEM Grid

  • Time::Any: Time options

  • FreeSurface::Any: Free surface options

  • BoundaryConditions::Any: Boundary conditions

  • SolutionParams::Any: Global solution parameters

  • Solver::Any: Solver options and optional PETSc options

  • ModelSetup::Any: Model setup

  • Output::Any: Output options

  • PassiveTracers::Any: Passive tracers

  • Materials::Any: Material parameters for each of the phases

source
LaMEM.LaMEM_Model.ModelMethod
Model(args...)

Allow to define a model setup by specifying some of the basic objects

Example

julia> d = Model(Grid(nel=(10,1,20)), Scaling(NO_units()))
 LaMEM Model setup
 |
 |-- Scaling             :  GeoParams.Units.GeoUnits{GeoParams.Units.NONE}
@@ -23,7 +23,7 @@
 |-- Model setup options :  Type=geom; 
 |-- Output options      :  filename=output; pvd=1; avd=0; surf=0
 |-- Materials           :  1 phases;  
-
source
LaMEM.LaMEM_Model.ModelMethod
Model(;
     Scaling=Scaling(GEO_units()),
     Grid=Grid(), 
     Time=Time(),
@@ -35,29 +35,29 @@
     Output=Output(),
     PassiveTracers=PassiveTracers(),
     Materials=Materials()
-    )

Creates a LaMEM Model setup.

  • Scaling::Scaling

  • Grid::Grid

  • Time::Any

  • FreeSurface::Any

  • BoundaryConditions::Any

  • SolutionParams::Any

  • Solver::Any

  • ModelSetup::Any

  • Output::Any

  • PassiveTracers::Any

  • Materials::Any

source
LaMEM.LaMEM_Model.ModelSetupType
Structure that contains the LaMEM Model Setup and Advection options
  • msetup::String: Setup type - can be geom (phases are assigned from geometric primitives, using add_geom!(model, ...)), files (from julia input), polygons (from geomIO input, which requires poly_file to be specified)

  • rand_noise::Int64: add random noise to the particle location

  • rand_noiseGP::Int64: random noise flag, subsequently applied to geometric primitives

  • bg_phase::Int64: background phase ID

  • save_mark::Int64: save marker to disk flag

  • mark_load_file::String: marker input file (extension is .xxxxxxxx.dat), if using msetup=files

  • mark_save_file::String: marker output file (extension is .xxxxxxxx.dat)

  • poly_file::String: polygon geometry file (redundant), if using msetup=polygons

  • temp_file::String: initial temperature file (redundant), if not set on markers

  • advect::String: advection scheme; options=none (no advection); basic (Euler classical implementation [default]); Euler (Euler explicit in time); rk2 (Runge-Kutta 2nd order in space)

  • interp::String: velocity interpolation scheme; options = stag (trilinear interpolation from FDSTAG points), minmod ( MINMOD interpolation to nodes, trilinear interpolation to markers + correction), stagp ( STAG_P empirical approach by T. Gerya)

  • stagp_a::Float64: STAG_P velocity interpolation parameter

  • mark_ctrl::String: marker control type; options are subgrid (default; marker control enforced over fine scale grid), none (none), basic (AVD for cells + corner insertion), and avd (pure AVD for all control volumes)

  • nmark_lim::Vector{Int64}: min/max number per cell (marker control)

  • nmark_avd::Vector{Int64}: x-y-z AVD refinement factors (avd marker control)

  • nmark_sub::Int64: max number of same phase markers per subcell (subgrid marker control)

  • geom_primitives::Vector: Different geometric primitives that can be selected if we msetup=geom; seeGeomSphere`

source
LaMEM.LaMEM_Model.MultigridType
Structure that has info about setting up multigrid for LaMEM
  • nel::Tuple{Int64, Int64, Int64}: Number of elements at the fine level
  • levels::Int64: Number of levels
  • smooth::Int64: number of smoothening steps per level
  • smooth_jacobi_factor::Float64: factor for jacbi smoothener oer level
  • smoother::String: smoother used at every level
  • coarse_ksp::String: coarse grid ksp type preonly or fgmres
  • coarse_pc::String: coarse grid pc type ["superlu_dist", "mumps", "gamg", "telescope","redundant"]
  • coarse_coarse_pc::String: coarse coarse grid solver in case we use redundant or telescope coarse grid solves
  • coarse_coarse_ksp::String: coarse coarse grid solver in case we use redundant or telescope coarse grid solves
  • cores::Int64: number of cores used in the simulation
  • cores_coarse::Int64: number of cores used for coarse grid solver (in case we use pctelescope)
  • gamg_threshold::Float64: GAMG threshold
  • gamg_coarse_eq_limit::Int64: GAMG coarse grid equation limit
  • gamg_repartition::Bool: GAMG repartition coarse grids? (default=false)
  • gamg_parallel_coarse::Bool: GAMG parallel coarse grid solver? (default=false)
source
LaMEM.LaMEM_Model.OutputType
Structure that contains the LaMEM output options
  • out_file_name::Any: output file name

  • out_dir::Any: output directory

  • param_file_name::Any: parameter filename

  • write_VTK_setup::Any: write VTK initial model setup

  • out_pvd::Any: activate writing .pvd file

  • out_phase::Any: dominant phase

  • out_density::Any: density

  • out_visc_total::Any: total (viscoelastoplastic) viscosity

  • out_visc_creep::Any: creep viscosity

  • out_velocity::Any: velocity

  • out_pressure::Any: (dynamic) pressure

  • out_tot_press::Any: total pressure

  • out_eff_press::Any: effective pressure

  • out_over_press::Any: outoverpress

  • out_litho_press::Any: lithospheric pressure

  • out_pore_press::Any: pore pressure

  • out_temperature::Any: temperature

  • out_dev_stress::Any: deviatoric strain rate tensor

  • out_j2_dev_stress::Any: second invariant of deviatoric stress tensor

  • out_strain_rate::Any: deviatoric strain rate tensor

  • out_j2_strain_rate::Any: second invariant of strain rate tensor

  • out_shmax::Any: sh max

  • out_ehmax::Any: eh max

  • out_yield::Any: yield stress

  • out_rel_dif_rate::Any: relative proportion of diffusion creep strainrate

  • out_rel_dis_rate::Any: relative proportion of dislocation creep strainrate

  • out_rel_prl_rate::Any: relative proportion of peierls creep strainrate

  • out_rel_pl_rate::Any: relative proportion of plastic strainrate

  • out_plast_strain::Any: accumulated plastic strain

  • out_plast_dissip::Any: plastic dissipation

  • out_tot_displ::Any: total displacement

  • out_moment_res::Any: momentum residual

  • out_cont_res::Any: continuity residual

  • out_energ_res::Any: energy residual

  • out_melt_fraction::Any: Melt fraction

  • out_fluid_density::Any: fluid density

  • out_conductivity::Any: conductivity

  • out_vel_gr_tensor::Any: velocity gradient tensor

  • out_surf::Any: activate surface output

  • out_surf_pvd::Any: activate writing .pvd file

  • out_surf_velocity::Any: surface velocity

  • out_surf_topography::Any: surface topography

  • out_surf_amplitude::Any: amplitude of topography (=topo-average(topo))

  • out_mark::Any: activate marker output

  • out_mark_pvd::Any: activate writing .pvd file

  • out_avd::Any: activate AVD phase output

  • out_avd_pvd::Any: activate writing .pvd file

  • out_avd_ref::Any: AVD grid refinement factor

  • out_ptr::Any: activate

  • out_ptr_ID::Any: ID of the passive tracers

  • out_ptr_phase::Any: phase of the passive tracers

  • out_ptr_Pressure::Any: interpolated pressure

  • out_ptr_Temperature::Any: temperature

  • out_ptr_MeltFraction::Any: melt fraction computed using P-T of the marker

  • out_ptr_Active::Any: option that highlight the marker that are currently active

  • out_ptr_Grid_Mf::Any: option that allow to store the melt fraction seen within the cell

source
LaMEM.LaMEM_Model.PassiveTracersType
Structure that contains the LaMEM passive tracers parameters.
  • Passive_Tracer::Int64: activate passive tracers?"
  • PassiveTracer_Box::Union{Nothing, Vector{Float64}}: Dimensions of box in which we distribute passive tracers [Left, Right, Front, Back, Bottom, Top]
  • PassiveTracer_Resolution::Vector{Int64}: The number of passive tracers in every direction
  • PassiveTracer_ActiveType::Union{Nothing, String}: Under which condition are they activated? ["Always"], "Melt_Fraction", "Temperature", "Pressure", "Time"
  • PassiveTracer_ActiveValue::Union{Nothing, Float64}: The value to activate them
source
LaMEM.LaMEM_Model.PhaseType
Defines the material properties for each of the phases
  • ID::Union{Nothing, Int64}: Material phase ID

  • Name::Union{Nothing, String}: Description of the phase

  • rho::Union{Nothing, Float64}: Density [kg/m^3]

  • eta::Union{Nothing, Float64}: Linear viscosity [Pas]

  • visID::Union{Nothing, Int64}: material ID for phase visualization (default is ID)

  • diff_prof::Union{Nothing, String}: Build-in DIFFUSION creep profiles:

    Example: "Dry__Olivine_diff_creep-Hirth_Kohlstedt_2003"

    Available build-in diffusion creep rheologies are:

    1. From [Hirth, G. and Kohlstedt D. (2003), Rheology of the upper mantle and the mantle wedge: A view from the experimentalists]:
    • "Dry_Olivine_diff_creep-Hirth_Kohlstedt_2003"
    • "Wet_Olivine_diff_creep-Hirth_Kohlstedt_2003_constant_C_OH"
    • "Wet_Olivine_diff_creep-Hirth_Kohlstedt_2003"
    1. From [Rybacki and Dresen, 2000, JGR]:
    • "Dry_Plagioclase_RybackiDresen_2000"
    • "Wet_Plagioclase_RybackiDresen_2000"

    Note that you can always specify your own, by setting Bd, Ed, Vd accordingly.

  • disl_prof::Union{Nothing, String}: Build-in DISLOCATION creep profiles:

    Example: "Granite-Tirel_et_al_2008"

    Available build-in dislocation creep rheologies are:

    1. From [Ranalli 1995]:
    • "Dry_Olivine-Ranalli_1995"
    • "Wet_Olivine-Ranalli_1995"
    • "Wet_Quarzite-Ranalli_1995"
    • "Quarzite-Ranalli_1995"
    • "Mafic_Granulite-Ranalli_1995"
    • "Plagioclase_An75-Ranalli_1995"
    1. From [Carter and Tsenn (1986). Flow properties of continental lithosphere - page 18]:
    • "Quartz_Diorite-Hansen_Carter_1982"
    1. From [J. de Bremond d'Ars et al. Tectonophysics (1999). Hydrothermalism and Diapirism in the Archaean: gravitational instability constrains. - page 5]
    • "Diabase-Caristan_1982"
    • "Tumut_Pond_Serpentinite-Raleigh_Paterson_1965"
    1. From [Mackwell, Zimmerman & Kohlstedt (1998). High-temperature deformation]:
    • "Maryland_strong_diabase-Mackwell_et_al_1998"
    1. From [Ueda et al (PEPI 2008)]:
    • "Wet_Quarzite-Ueda_et_al_2008"
    1. From [Huismans et al 2001]:
    • "Diabase-Huismans_et_al_2001"
    • "Granite-Huismans_et_al_2001"
    1. From [Burg And Podladchikov (1999)]:
    • "Dry_Upper_Crust-Schmalholz_Kaus_Burg_2009"
    • "Weak_Lower_Crust-Schmalholz_Kaus_Burg_2009"
    • "Olivine-Burg_Podladchikov_1999"
    1. From [Rybacki and Dresen, 2000, JGR]:
    • "Dry_Plagioclase_RybackiDresen_2000"
    • "Wet_Plagioclase_RybackiDresen_2000"
    1. From [Hirth, G. & Kohlstedt (2003), D. Rheology of the upper mantle and the mantle wedge: A view from the experimentalists]:
    • "Wet_Olivine_disl_creep-Hirth_Kohlstedt_2003"
    • "Wet_Olivine_disl_creep-Hirth_Kohlstedt_2003_constant_C_OH"
    • "Dry_Olivine_disl_creep-Hirth_Kohlstedt_2003"
    1. From [SchmalholzKausBurg(2009), Geology (wet olivine)]:
    • "Wet_Upper_Mantle-Burg_Schmalholz_2008"
    • "Granite-Tirel_et_al_2008"
    1. From [Urai et al.(2008)]:
    • "Ara_rocksalt-Urai_et_al.(2008)"
    1. From [Bräuer et al. (2011) Description of the Gorleben site (PART 4): Geotechnical exploration of the Gorleben salt dome - page 126]:
    • "RockSaltReference_BGRa_class3-Braeumer_et_al_2011"
    1. From [Mueller and Briegel (1978)]:
    • "Polycrystalline_Anhydrite-Mueller_and_Briegel(1978)"

    Note that you can always specify your own, by setting Bn, En, Vn, and n accordingly.

  • peir_prof::Union{Nothing, String}: Build-in PEIERLS creep profiles:

    example: "Olivine_Peierls-Kameyama_1999"

    Available profiles:

    • "Olivine_Peierls-Kameyama_1999"
  • rho_n::Union{Nothing, Float64}: depth-dependent density model parameter

  • rho_c::Union{Nothing, Float64}: depth-dependent density model parameter

  • beta::Union{Nothing, Float64}: pressure-dependent density model parameter

  • G::Union{Nothing, Float64}: shear modulus

  • Kb::Union{Nothing, Float64}: bulk modulus

  • E::Union{Nothing, Float64}: Young's modulus

  • nu::Union{Nothing, Float64}: Poisson's ratio

  • Kp::Union{Nothing, Float64}: pressure dependence parameter

  • Bd::Union{Nothing, Float64}: DIFFUSION creep pre-exponential constant

  • Ed::Union{Nothing, Float64}: activation energy

  • Vd::Union{Nothing, Float64}: activation volume

  • eta0::Union{Nothing, Float64}: POWER LAW reference viscosity

  • e0::Union{Nothing, Float64}: reference strain rate

  • Bn::Union{Nothing, Float64}: DISLOCATION creep pre-exponential constant

  • En::Union{Nothing, Float64}: activation energy

  • Vn::Union{Nothing, Float64}: activation volume

  • n::Union{Nothing, Float64}: power law exponent

  • Bp::Union{Nothing, Float64}: PEIERLS creep pre-exponential constant

  • Ep::Union{Nothing, Float64}: activation energy

  • Vp::Union{Nothing, Float64}: activation volume

  • taup::Union{Nothing, Float64}: scaling stress

  • gamma::Union{Nothing, Float64}: approximation parameter

  • q::Union{Nothing, Float64}: stress-dependence parameter

  • eta_fk::Union{Nothing, Float64}: reference viscosity for Frank-Kamenetzky viscosity

  • gamma_fk::Union{Nothing, Float64}: gamma parameter for Frank-Kamenetzky viscosity

  • TRef_fk::Union{Nothing, Float64}: reference Temperature for Frank-Kamenetzky viscosity (if not set it is 0°C)

  • ch::Union{Nothing, Float64}: cohesion

  • fr::Union{Nothing, Float64}: friction angle

  • eta_st::Union{Nothing, Float64}: stabilization viscosity (default is eta_min)

  • eta_vp::Union{Nothing, Float64}: viscoplastic plasticity regularisation viscosity

  • rp::Union{Nothing, Float64}: pore-pressure ratio

  • chSoftID::Union{Nothing, Int64}: friction softening law ID

  • frSoftID::Union{Nothing, Int64}: cohesion softening law ID

  • healID::Union{Nothing, Int64}: healing ID, points to healTau in Softening

  • alpha::Union{Nothing, Float64}: thermal expansivity

  • Cp::Union{Nothing, Float64}: specific heat (capacity), J⋅K−1⋅kg−1

  • k::Union{Nothing, Float64}: thermal conductivity

  • A::Union{Nothing, Float64}: radiogenic heat production

  • T::Union{Nothing, Float64}: optional temperature to set within the phase

  • Latent_hx::Union{Nothing, Float64}: optional, used for dike heating, J/kg

  • T_liq::Union{Nothing, Float64}: optional, used for dike heating, liquidus temperature of material, celsius

  • T_sol::Union{Nothing, Float64}: optional, used for dike heating, solidus temperature of material, celsius

  • T_Nu::Union{Nothing, Float64}: default value for thermal conductivity boundary

  • nu_k::Union{Nothing, Float64}: optional parameter, Nusselt number for use with conductivity

  • rho_ph::Union{Nothing, String}: name of the phase diagram you want to use (still needs rho to be defined for the initial guess of pressure)

  • rho_ph_dir::Union{Nothing, String}: in case the phase diagram has a different path provide the path (without the name of the actual PD) here

  • mfc::Union{Nothing, Float64}: melt fraction viscosity correction factor (positive scalar)

  • GeoParams::Union{Nothing, Vector{GeoParams.MaterialParameters.ConstitutiveRelationships.AbstractCreepLaw}}: GeoParams creeplaws

    Set diffusion or dislocation creeplaws as provided by the GeoParams package:

    julia> using GeoParams
    +    )

    Creates a LaMEM Model setup.

    • Scaling::Scaling

    • Grid::Grid

    • Time::Any

    • FreeSurface::Any

    • BoundaryConditions::Any

    • SolutionParams::Any

    • Solver::Any

    • ModelSetup::Any

    • Output::Any

    • PassiveTracers::Any

    • Materials::Any

source
LaMEM.LaMEM_Model.ModelSetupType
Structure that contains the LaMEM Model Setup and Advection options
  • msetup::String: Setup type - can be geom (phases are assigned from geometric primitives, using add_geom!(model, ...)), files (from julia input), polygons (from geomIO input, which requires poly_file to be specified)

  • rand_noise::Int64: add random noise to the particle location

  • rand_noiseGP::Int64: random noise flag, subsequently applied to geometric primitives

  • bg_phase::Int64: background phase ID

  • save_mark::Int64: save marker to disk flag

  • mark_load_file::String: marker input file (extension is .xxxxxxxx.dat), if using msetup=files

  • mark_save_file::String: marker output file (extension is .xxxxxxxx.dat)

  • poly_file::String: polygon geometry file (redundant), if using msetup=polygons

  • temp_file::String: initial temperature file (redundant), if not set on markers

  • advect::String: advection scheme; options=none (no advection); basic (Euler classical implementation [default]); Euler (Euler explicit in time); rk2 (Runge-Kutta 2nd order in space)

  • interp::String: velocity interpolation scheme; options = stag (trilinear interpolation from FDSTAG points), minmod ( MINMOD interpolation to nodes, trilinear interpolation to markers + correction), stagp ( STAG_P empirical approach by T. Gerya)

  • stagp_a::Float64: STAG_P velocity interpolation parameter

  • mark_ctrl::String: marker control type; options are subgrid (default; marker control enforced over fine scale grid), none (none), basic (AVD for cells + corner insertion), and avd (pure AVD for all control volumes)

  • nmark_lim::Vector{Int64}: min/max number per cell (marker control)

  • nmark_avd::Vector{Int64}: x-y-z AVD refinement factors (avd marker control)

  • nmark_sub::Int64: max number of same phase markers per subcell (subgrid marker control)

  • geom_primitives::Vector: Different geometric primitives that can be selected if we msetup=geom; seeGeomSphere`

source
LaMEM.LaMEM_Model.MultigridType
Structure that has info about setting up multigrid for LaMEM
  • nel::Tuple{Int64, Int64, Int64}: Number of elements at the fine level
  • levels::Int64: Number of levels
  • smooth::Int64: number of smoothening steps per level
  • smooth_jacobi_factor::Float64: factor for jacbi smoothener oer level
  • smoother::String: smoother used at every level
  • coarse_ksp::String: coarse grid ksp type preonly or fgmres
  • coarse_pc::String: coarse grid pc type ["superlu_dist", "mumps", "gamg", "telescope","redundant"]
  • coarse_coarse_pc::String: coarse coarse grid solver in case we use redundant or telescope coarse grid solves
  • coarse_coarse_ksp::String: coarse coarse grid solver in case we use redundant or telescope coarse grid solves
  • cores::Int64: number of cores used in the simulation
  • cores_coarse::Int64: number of cores used for coarse grid solver (in case we use pctelescope)
  • gamg_threshold::Float64: GAMG threshold
  • gamg_coarse_eq_limit::Int64: GAMG coarse grid equation limit
  • gamg_repartition::Bool: GAMG repartition coarse grids? (default=false)
  • gamg_parallel_coarse::Bool: GAMG parallel coarse grid solver? (default=false)
source
LaMEM.LaMEM_Model.OutputType
Structure that contains the LaMEM output options
  • out_file_name::Any: output file name

  • out_dir::Any: output directory

  • param_file_name::Any: parameter filename

  • write_VTK_setup::Any: write VTK initial model setup

  • out_pvd::Any: activate writing .pvd file

  • out_phase::Any: dominant phase

  • out_density::Any: density

  • out_visc_total::Any: total (viscoelastoplastic) viscosity

  • out_visc_creep::Any: creep viscosity

  • out_velocity::Any: velocity

  • out_pressure::Any: (dynamic) pressure

  • out_tot_press::Any: total pressure

  • out_eff_press::Any: effective pressure

  • out_over_press::Any: outoverpress

  • out_litho_press::Any: lithospheric pressure

  • out_pore_press::Any: pore pressure

  • out_temperature::Any: temperature

  • out_dev_stress::Any: deviatoric strain rate tensor

  • out_j2_dev_stress::Any: second invariant of deviatoric stress tensor

  • out_strain_rate::Any: deviatoric strain rate tensor

  • out_j2_strain_rate::Any: second invariant of strain rate tensor

  • out_shmax::Any: sh max

  • out_ehmax::Any: eh max

  • out_yield::Any: yield stress

  • out_rel_dif_rate::Any: relative proportion of diffusion creep strainrate

  • out_rel_dis_rate::Any: relative proportion of dislocation creep strainrate

  • out_rel_prl_rate::Any: relative proportion of peierls creep strainrate

  • out_rel_pl_rate::Any: relative proportion of plastic strainrate

  • out_plast_strain::Any: accumulated plastic strain

  • out_plast_dissip::Any: plastic dissipation

  • out_tot_displ::Any: total displacement

  • out_moment_res::Any: momentum residual

  • out_cont_res::Any: continuity residual

  • out_energ_res::Any: energy residual

  • out_melt_fraction::Any: Melt fraction

  • out_fluid_density::Any: fluid density

  • out_conductivity::Any: conductivity

  • out_vel_gr_tensor::Any: velocity gradient tensor

  • out_surf::Any: activate surface output

  • out_surf_pvd::Any: activate writing .pvd file

  • out_surf_velocity::Any: surface velocity

  • out_surf_topography::Any: surface topography

  • out_surf_amplitude::Any: amplitude of topography (=topo-average(topo))

  • out_mark::Any: activate marker output

  • out_mark_pvd::Any: activate writing .pvd file

  • out_avd::Any: activate AVD phase output

  • out_avd_pvd::Any: activate writing .pvd file

  • out_avd_ref::Any: AVD grid refinement factor

  • out_ptr::Any: activate

  • out_ptr_ID::Any: ID of the passive tracers

  • out_ptr_phase::Any: phase of the passive tracers

  • out_ptr_Pressure::Any: interpolated pressure

  • out_ptr_Temperature::Any: temperature

  • out_ptr_MeltFraction::Any: melt fraction computed using P-T of the marker

  • out_ptr_Active::Any: option that highlight the marker that are currently active

  • out_ptr_Grid_Mf::Any: option that allow to store the melt fraction seen within the cell

source
LaMEM.LaMEM_Model.PassiveTracersType
Structure that contains the LaMEM passive tracers parameters.
  • Passive_Tracer::Int64: activate passive tracers?"
  • PassiveTracer_Box::Union{Nothing, Vector{Float64}}: Dimensions of box in which we distribute passive tracers [Left, Right, Front, Back, Bottom, Top]
  • PassiveTracer_Resolution::Vector{Int64}: The number of passive tracers in every direction
  • PassiveTracer_ActiveType::Union{Nothing, String}: Under which condition are they activated? ["Always"], "Melt_Fraction", "Temperature", "Pressure", "Time"
  • PassiveTracer_ActiveValue::Union{Nothing, Float64}: The value to activate them
source
LaMEM.LaMEM_Model.PhaseType
Defines the material properties for each of the phases
  • ID::Union{Nothing, Int64}: Material phase ID

  • Name::Union{Nothing, String}: Description of the phase

  • rho::Union{Nothing, Float64}: Density [kg/m^3]

  • eta::Union{Nothing, Float64}: Linear viscosity [Pas]

  • visID::Union{Nothing, Int64}: material ID for phase visualization (default is ID)

  • diff_prof::Union{Nothing, String}: Build-in DIFFUSION creep profiles:

    Example: "Dry__Olivine_diff_creep-Hirth_Kohlstedt_2003"

    Available build-in diffusion creep rheologies are:

    1. From [Hirth, G. and Kohlstedt D. (2003), Rheology of the upper mantle and the mantle wedge: A view from the experimentalists]:
    • "Dry_Olivine_diff_creep-Hirth_Kohlstedt_2003"
    • "Wet_Olivine_diff_creep-Hirth_Kohlstedt_2003_constant_C_OH"
    • "Wet_Olivine_diff_creep-Hirth_Kohlstedt_2003"
    1. From [Rybacki and Dresen, 2000, JGR]:
    • "Dry_Plagioclase_RybackiDresen_2000"
    • "Wet_Plagioclase_RybackiDresen_2000"

    Note that you can always specify your own, by setting Bd, Ed, Vd accordingly.

  • disl_prof::Union{Nothing, String}: Build-in DISLOCATION creep profiles:

    Example: "Granite-Tirel_et_al_2008"

    Available build-in dislocation creep rheologies are:

    1. From [Ranalli 1995]:
    • "Dry_Olivine-Ranalli_1995"
    • "Wet_Olivine-Ranalli_1995"
    • "Wet_Quarzite-Ranalli_1995"
    • "Quarzite-Ranalli_1995"
    • "Mafic_Granulite-Ranalli_1995"
    • "Plagioclase_An75-Ranalli_1995"
    1. From [Carter and Tsenn (1986). Flow properties of continental lithosphere - page 18]:
    • "Quartz_Diorite-Hansen_Carter_1982"
    1. From [J. de Bremond d'Ars et al. Tectonophysics (1999). Hydrothermalism and Diapirism in the Archaean: gravitational instability constrains. - page 5]
    • "Diabase-Caristan_1982"
    • "Tumut_Pond_Serpentinite-Raleigh_Paterson_1965"
    1. From [Mackwell, Zimmerman & Kohlstedt (1998). High-temperature deformation]:
    • "Maryland_strong_diabase-Mackwell_et_al_1998"
    1. From [Ueda et al (PEPI 2008)]:
    • "Wet_Quarzite-Ueda_et_al_2008"
    1. From [Huismans et al 2001]:
    • "Diabase-Huismans_et_al_2001"
    • "Granite-Huismans_et_al_2001"
    1. From [Burg And Podladchikov (1999)]:
    • "Dry_Upper_Crust-Schmalholz_Kaus_Burg_2009"
    • "Weak_Lower_Crust-Schmalholz_Kaus_Burg_2009"
    • "Olivine-Burg_Podladchikov_1999"
    1. From [Rybacki and Dresen, 2000, JGR]:
    • "Dry_Plagioclase_RybackiDresen_2000"
    • "Wet_Plagioclase_RybackiDresen_2000"
    1. From [Hirth, G. & Kohlstedt (2003), D. Rheology of the upper mantle and the mantle wedge: A view from the experimentalists]:
    • "Wet_Olivine_disl_creep-Hirth_Kohlstedt_2003"
    • "Wet_Olivine_disl_creep-Hirth_Kohlstedt_2003_constant_C_OH"
    • "Dry_Olivine_disl_creep-Hirth_Kohlstedt_2003"
    1. From [SchmalholzKausBurg(2009), Geology (wet olivine)]:
    • "Wet_Upper_Mantle-Burg_Schmalholz_2008"
    • "Granite-Tirel_et_al_2008"
    1. From [Urai et al.(2008)]:
    • "Ara_rocksalt-Urai_et_al.(2008)"
    1. From [Bräuer et al. (2011) Description of the Gorleben site (PART 4): Geotechnical exploration of the Gorleben salt dome - page 126]:
    • "RockSaltReference_BGRa_class3-Braeumer_et_al_2011"
    1. From [Mueller and Briegel (1978)]:
    • "Polycrystalline_Anhydrite-Mueller_and_Briegel(1978)"

    Note that you can always specify your own, by setting Bn, En, Vn, and n accordingly.

  • peir_prof::Union{Nothing, String}: Build-in PEIERLS creep profiles:

    example: "Olivine_Peierls-Kameyama_1999"

    Available profiles:

    • "Olivine_Peierls-Kameyama_1999"
  • rho_n::Union{Nothing, Float64}: depth-dependent density model parameter

  • rho_c::Union{Nothing, Float64}: depth-dependent density model parameter

  • beta::Union{Nothing, Float64}: pressure-dependent density model parameter

  • G::Union{Nothing, Float64}: shear modulus

  • Kb::Union{Nothing, Float64}: bulk modulus

  • E::Union{Nothing, Float64}: Young's modulus

  • nu::Union{Nothing, Float64}: Poisson's ratio

  • Kp::Union{Nothing, Float64}: pressure dependence parameter

  • Bd::Union{Nothing, Float64}: DIFFUSION creep pre-exponential constant

  • Ed::Union{Nothing, Float64}: activation energy

  • Vd::Union{Nothing, Float64}: activation volume

  • eta0::Union{Nothing, Float64}: POWER LAW reference viscosity

  • e0::Union{Nothing, Float64}: reference strain rate

  • Bn::Union{Nothing, Float64}: DISLOCATION creep pre-exponential constant

  • En::Union{Nothing, Float64}: activation energy

  • Vn::Union{Nothing, Float64}: activation volume

  • n::Union{Nothing, Float64}: power law exponent

  • Bp::Union{Nothing, Float64}: PEIERLS creep pre-exponential constant

  • Ep::Union{Nothing, Float64}: activation energy

  • Vp::Union{Nothing, Float64}: activation volume

  • taup::Union{Nothing, Float64}: scaling stress

  • gamma::Union{Nothing, Float64}: approximation parameter

  • q::Union{Nothing, Float64}: stress-dependence parameter

  • eta_fk::Union{Nothing, Float64}: reference viscosity for Frank-Kamenetzky viscosity

  • gamma_fk::Union{Nothing, Float64}: gamma parameter for Frank-Kamenetzky viscosity

  • TRef_fk::Union{Nothing, Float64}: reference Temperature for Frank-Kamenetzky viscosity (if not set it is 0°C)

  • ch::Union{Nothing, Float64}: cohesion

  • fr::Union{Nothing, Float64}: friction angle

  • eta_st::Union{Nothing, Float64}: stabilization viscosity (default is eta_min)

  • eta_vp::Union{Nothing, Float64}: viscoplastic plasticity regularisation viscosity

  • rp::Union{Nothing, Float64}: pore-pressure ratio

  • chSoftID::Union{Nothing, Int64}: friction softening law ID

  • frSoftID::Union{Nothing, Int64}: cohesion softening law ID

  • healID::Union{Nothing, Int64}: healing ID, points to healTau in Softening

  • alpha::Union{Nothing, Float64}: thermal expansivity

  • Cp::Union{Nothing, Float64}: specific heat (capacity), J⋅K−1⋅kg−1

  • k::Union{Nothing, Float64}: thermal conductivity

  • A::Union{Nothing, Float64}: radiogenic heat production

  • T::Union{Nothing, Float64}: optional temperature to set within the phase

  • Latent_hx::Union{Nothing, Float64}: optional, used for dike heating, J/kg

  • T_liq::Union{Nothing, Float64}: optional, used for dike heating, liquidus temperature of material, celsius

  • T_sol::Union{Nothing, Float64}: optional, used for dike heating, solidus temperature of material, celsius

  • T_Nu::Union{Nothing, Float64}: default value for thermal conductivity boundary

  • nu_k::Union{Nothing, Float64}: optional parameter, Nusselt number for use with conductivity

  • rho_ph::Union{Nothing, String}: name of the phase diagram you want to use (still needs rho to be defined for the initial guess of pressure)

  • rho_ph_dir::Union{Nothing, String}: in case the phase diagram has a different path provide the path (without the name of the actual PD) here

  • mfc::Union{Nothing, Float64}: melt fraction viscosity correction factor (positive scalar)

  • GeoParams::Union{Nothing, Vector{GeoParams.MaterialParameters.ConstitutiveRelationships.AbstractCreepLaw}}: GeoParams creeplaws

    Set diffusion or dislocation creeplaws as provided by the GeoParams package:

    julia> using GeoParams
     julia> a = SetDiffusionCreep(GeoParams.Diffusion.dry_anorthite_Rybacki_2006);
    -julia> p = Phase(ID=1,Name="test", GeoParams=[a]);

    Note that GeoParams should be a vector, as you could, for example, have diffusion and dislocation creep parameters

    Note also that this will overwrite any other creeplaws provided in the Phase struct.

  • grainsize::Union{Nothing, Float64}: grainsize m This is not actually used in LaMEM, but is required when setting diffusion creep parameters by using GeoParams
source
LaMEM.LaMEM_Model.PhaseAggregateType
Defines phase aggregates, which can be useful for visualization purposes
  • name::String: Name of the phase aggregate

  • phaseID::Union{Nothing, Vector{Int64}}: Phases to be combined

  • numPhase::Union{Nothing, Int64}: number of aggregated phases

source
LaMEM.LaMEM_Model.PhaseTransitionType
Defines phase transitions on markers (that change the Phase ID of a marker depending on some conditions)
  • ID::Int64: Phase_transition law ID

  • Type::String: [Constant, Clapeyron, Box]: Constant - the phase transition occurs only at a fixed value of the parameter; Clapeyron - clapeyron slope

  • Name_Clapeyron::Union{Nothing, String}: Type of predefined Clapeyron slope, such as MantleTransition660km

  • PTBox_Bounds::Union{Nothing, Vector{Float64}}: box bound coordinates: [left, right, front, back, bottom, top]

  • BoxVicinity::Union{Nothing, Int64}: 1: only check particles in the vicinity of the box boundaries (2: in all directions)

  • Parameter_transition::Union{Nothing, String}: [T = Temperature, P = Pressure, Depth = z-coord, X=x-coord, Y=y-coord, APS = accumulated plastic strain, MeltFraction, t = time] parameter that triggers the phase transition

  • ConstantValue::Union{Nothing, Float64}: Value of the parameter [unit of T,P,z, APS]

  • number_phases::Union{Nothing, Int64}: The number of involved phases [default=1]

  • PhaseAbove::Union{Nothing, Vector{Int64}}: Above the chosen value the phase is 1, below it, the value is PhaseBelow

  • PhaseBelow::Union{Nothing, Vector{Int64}}: Below the chosen value the phase is PhaseBelow, above it, the value is 1

  • PhaseInside::Union{Nothing, Vector{Int64}}: Phase within the box [use -1 if you don't want to change the phase inside the box]

  • PhaseOutside::Union{Nothing, Vector{Int64}}: Phase outside the box [use -1 if you don't want to change the phase outside the box. If combined with OutsideToInside, all phases that come in are set to PhaseInside]

  • PhaseDirection::Union{Nothing, String}: [BothWays=default; BelowToAbove; AboveToBelow] Direction in which transition works

  • ResetParam::Union{Nothing, String}: [APS] Parameter to reset on particles below PT or within box

  • PTBox_TempType::Union{Nothing, String}: # Temperature condition witin the box [none, constant, linear, halfspace]

  • PTBox_topTemp::Union{Nothing, Float64}: Temp @ top of box [for linear & halfspace]

  • PTBox_botTemp::Union{Nothing, Float64}: Temp @ bottom of box [for linear & halfspace]

  • PTBox_thermalAge::Union{Nothing, Float64}: Thermal age, usually in geo-units [Myrs] [only in case of halfspace]

  • PTBox_cstTemp::Union{Nothing, Float64}: Temp within box [only for constant T]

  • v_box::Union{Nothing, Float64}: [optional] only for NotInAirBox, velocity with which box moves in cm/yr

  • t0_box::Union{Nothing, Float64}: [optional] beginning time of movemen in Myr

  • t1_box::Union{Nothing, Float64}: [optional] end time of movement in Myr

  • clapeyron_slope::Union{Nothing, Float64}: [optional] clapeyron slope of phase transition [in K/MPa]; P = ( T - T0_clapeyron ) * clapeyron_slope + P0_clapeyron

  • P0_clapeyron::Union{Nothing, Float64}: [optional] P0_clapeyron [Pa]

  • T0_clapeyron::Union{Nothing, Float64}: [optional] T0_clapeyron [C]

source
LaMEM.LaMEM_Model.ScalingType
Scaling{T} is a structure that contains the scaling info, employed in the current simulation
  • Scaling::Any: Scaling object (as in GeoParams), which can be GEO_units(), NO_units(), or SI_units()
source
LaMEM.LaMEM_Model.SofteningType
Defines strain softening parameters
  • ID::Int64: softening law ID

  • APS1::Float64: Begin of softening, in units of accumulated plastic strain (APS)

  • APS2::Float64: End of softening, in units of accumulated plastic strain (APS)

  • A::Float64: Reduction ratio

  • Lm::Union{Nothing, Float64}: Material length scale (in selected units, e.g. km in geo)

  • APSheal2::Union{Nothing, Float64}: APS when healTau2 activates

  • healTau::Union{Nothing, Float64}: healing timescale parameter [Myr]

  • healTau2::Union{Nothing, Float64}: healing timescale parameter [Myr] starting at APS=APSheal2

source
LaMEM.LaMEM_Model.SolutionParamsType
Structure that contains the LaMEM global solution parameters.
  • gravity::Vector{Float64}: gravitational acceleration vector

  • FSSA::Float64: free surface stabilization parameter [0 - 1]; The value has to be between 0 and 1

  • FSSA_allVel::Int64: free surface stabilization parameter applied to all velocity components? Default is yes; if not it is only applied to the z-component
  • shear_heat_eff::Float64: shear heating efficiency parameter [0 - 1]

  • Adiabatic_Heat::Float64: Adiabatic Heating activation flag and efficiency. 0.0 - 1.0

  • act_temp_diff::Int64: temperature diffusion activation flag

  • act_therm_exp::Int64: thermal expansion activation flag

  • act_steady_temp::Int64: steady-state temperature initial guess activation flag

  • steady_temp_t::Float64: time for (quasi-)steady-state temperature initial guess

  • nstep_steady::Int64: number of steps for (quasi-)steady-state temperature initial guess (default = 1)

  • act_heat_rech::Int64: recharge heat in anomalous bodies after (quasi-)steady-state temperature initial guess (=2: recharge after every diffusion step of initial guess)

  • init_lith_pres::Int64: sets initial pressure to be the lithostatic pressure (stabilizes compressible setups in the first steps)

  • init_guess::Int64: create an initial guess step (using constant viscosity eta_ref before starting the simulation

  • p_litho_visc::Int64: use lithostatic instead of dynamic pressure for creep laws

  • p_litho_plast::Int64: use lithostatic pressure for plasticity

  • p_lim_plast::Int64: limit pressure at first iteration for plasticity

  • p_shift::Int64: add a constant value [MPa] to the total pressure field, before evaluating plasticity (e.g., when the domain is located @ some depth within the crust)

  • act_p_shift::Int64: pressure shift activation flag (enforce zero pressure on average in the top cell layer); note: this overwrites p_shift above!

  • eta_min::Float64: viscosity lower bound [Pas]

  • eta_max::Float64: viscosity upper limit [Pas]

  • eta_ref::Float64: Reference viscosity (used for the initial guess) [Pas]

  • T_ref::Float64: Reference temperature [C]

  • RUGC::Float64: universal gas constant (you need to change this only for non-dimensional setups)

  • min_cohes::Float64: cohesion lower bound [Pa]

  • min_fric::Float64: friction lower bound [degree]

  • tau_ult::Float64: ultimate yield stress [Pa]

  • rho_fluid::Float64: fluid density for depth-dependent density model

  • gw_level_type::String: ground water level type for pore pressure computation (see below)

  • gw_level::Float64: ground water level at the free surface (if defined)

  • biot::Float64: Biot pressure parameter

  • get_permea::Float64: effective permeability computation activation flag

  • rescal::Float64: stencil rescaling flag (for internal constraints, for example while computing permeability)

  • mfmax::Float64: maximum melt fraction affecting viscosity reduction

  • lmaxit::Int64: maximum number of local rheology iterations

  • lrtol::Float64: local rheology iterations relative tolerance

  • act_dike::Int64: dike activation flag (additonal term in divergence)

  • useTk::Int64: switch to use T-dependent conductivity, 0: not active

  • dikeHeat::Int64: switch to use Behn & Ito heat source in the dike

  • adiabatic_gradient::Float64: Adiabatic gradient in combination with Behn & Ito dike

  • Compute_velocity_gradient::Int64: compute the velocity gradient tensor 1: active, 0: not active. If active, it automatically activates the output in the .pvd file

  • Phasetrans::Int64: Activate Phase Transitions on Particles or not, 0: not.

  • Passive_Tracer::Int64: Activate Passive Tracers or not?

source
LaMEM.LaMEM_Model.SolverType
Structure that contains the LaMEM solver options
  • SolverType::String: solver employed ["direct" or "multigrid"]

  • DirectSolver::String: mumps/superlu_dist/pastix/umfpack (requires these external PETSc packages to be installed!)

  • DirectPenalty::Float64: penalty parameter [employed if we use a direct solver]

  • MGLevels::Int64: number of MG levels [default=3]

  • MGSweeps::Int64: number of MG smoothening steps per level [default=10]

  • MGSmoother::String: type of smoothener used [chebyshev or jacobi]

  • MGJacobiDamp::Float64: Dampening parameter [only employed for Jacobi smoothener; default=0.6]

  • MGCoarseSolver::String: coarse grid solver if using multigrid ["direct" / "mumps" / "superlu_dist" or "redundant" - more options specifiable through the command-line options -crs_ksp_type & -crs_pc_type]

  • MGRedundantNum::Int64: How many times do we copy the coarse grid? [only employed for redundant solver; default is 4]

  • MGRedundantSolver::String: The coarse grid solver for each of the redundant solves [only employed for redundant; options are "mumps"/"superlu_dist" with default "superlu_dist"]

  • PETSc_options::Vector{String}: List with (optional) PETSc options

source
LaMEM.LaMEM_Model.TimeType
Structure that contains the LaMEM timestepping information. An explanation of the paramneters is given in the struct `Time_info`
  • time_end::Float64: simulation end time

  • dt::Float64: initial time step

  • dt_min::Float64: minimum time step (declare divergence if lower value is attempted)

  • dt_max::Float64: maximum time step

  • dt_out::Float64: output step (output at least at fixed time intervals)

  • inc_dt::Float64: time step increment per time step (fraction of unit)

  • CFL::Float64: CFL (Courant-Friedrichs-Lewy) criterion

  • CFLMAX::Float64: CFL criterion for elasticity

  • nstep_max::Int64: maximum allowed number of steps (lower bound: timeend/dtmax)

  • nstep_out::Int64: save output every n steps; Set this to -1 to deactivate saving output

  • nstep_rdb::Int64: save restart database every n steps

  • num_dt_periods::Int64: number of time stepping periods

  • time_dt_periods::Vector{Int64}: timestamps where timestep should be fixed (first entry has to 0)

  • step_dt_periods::Vector{Float64}: target timesteps ar timestamps above

  • nstep_ini::Int64: save output for n initial steps

  • time_tol::Float64: relative tolerance for time comparisons

source
LaMEM.LaMEM_Model.VelCylinderType
LaMEM boundary condition internal velocty cylinder `VelCylinder` object
  • baseX::Float64: X-coordinate of base of cylinder

  • baseY::Float64: Y-coordinate of base of cylinder

  • baseZ::Float64: Z-coordinate of base of cylinder

  • capX::Float64: X-coordinate of cap of cylinder

  • capY::Float64: Y-coordinate of cap of cylinder

  • capZ::Float64: Z-coordinate of cap of cylinder

  • radius::Float64: radius of cylinder

  • vx::Union{Nothing, Float64}: Vx velocity of cylinder (default is unconstrained)

  • vy::Union{Nothing, Float64}: Vy velocity of cylinder (default is unconstrained)

  • vz::Union{Nothing, Float64}: Vz velocity of cylinder (default is unconstrained)

  • advect::Int64: cylinder advection flag

  • vmag::Float64: magnitude of velocity applied along the cylinder's axis of orientation

  • type::String: velocity profile [uniform or parabolic]

source
LaMEM.LaMEM_Model.VelocityBoxType
Define velocity regions within the modelling region, by specifying its center point and width along the three axis.
  • cenX::Float64: X-coordinate of center of box

  • cenY::Float64: Y-coordinate of center of box

  • cenZ::Float64: Z-coordinate of center of box

  • widthX::Float64: Width of box in x-direction

  • widthY::Float64: Width of box in y-direction

  • widthZ::Float64: Width of box in Z-direction

  • vx::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)

  • vy::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)

  • vz::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)

  • advect::Int64: box advection flag

source
GeophysicalModelGenerator.add_box!Method
add_box!(model::Model; xlim=Tuple{2}, [ylim=Tuple{2}], zlim=Tuple{2},
+julia> p = Phase(ID=1,Name="test", GeoParams=[a]);

Note that GeoParams should be a vector, as you could, for example, have diffusion and dislocation creep parameters

Note also that this will overwrite any other creeplaws provided in the Phase struct.

  • grainsize::Union{Nothing, Float64}: grainsize m This is not actually used in LaMEM, but is required when setting diffusion creep parameters by using GeoParams
source
LaMEM.LaMEM_Model.PhaseAggregateType
Defines phase aggregates, which can be useful for visualization purposes
  • name::String: Name of the phase aggregate

  • phaseID::Union{Nothing, Vector{Int64}}: Phases to be combined

  • numPhase::Union{Nothing, Int64}: number of aggregated phases

source
LaMEM.LaMEM_Model.PhaseTransitionType
Defines phase transitions on markers (that change the Phase ID of a marker depending on some conditions)
  • ID::Int64: Phase_transition law ID

  • Type::String: [Constant, Clapeyron, Box]: Constant - the phase transition occurs only at a fixed value of the parameter; Clapeyron - clapeyron slope

  • Name_Clapeyron::Union{Nothing, String}: Type of predefined Clapeyron slope, such as MantleTransition660km

  • PTBox_Bounds::Union{Nothing, Vector{Float64}}: box bound coordinates: [left, right, front, back, bottom, top]

  • BoxVicinity::Union{Nothing, Int64}: 1: only check particles in the vicinity of the box boundaries (2: in all directions)

  • Parameter_transition::Union{Nothing, String}: [T = Temperature, P = Pressure, Depth = z-coord, X=x-coord, Y=y-coord, APS = accumulated plastic strain, MeltFraction, t = time] parameter that triggers the phase transition

  • ConstantValue::Union{Nothing, Float64}: Value of the parameter [unit of T,P,z, APS]

  • number_phases::Union{Nothing, Int64}: The number of involved phases [default=1]

  • PhaseAbove::Union{Nothing, Vector{Int64}}: Above the chosen value the phase is 1, below it, the value is PhaseBelow

  • PhaseBelow::Union{Nothing, Vector{Int64}}: Below the chosen value the phase is PhaseBelow, above it, the value is 1

  • PhaseInside::Union{Nothing, Vector{Int64}}: Phase within the box [use -1 if you don't want to change the phase inside the box]

  • PhaseOutside::Union{Nothing, Vector{Int64}}: Phase outside the box [use -1 if you don't want to change the phase outside the box. If combined with OutsideToInside, all phases that come in are set to PhaseInside]

  • PhaseDirection::Union{Nothing, String}: [BothWays=default; BelowToAbove; AboveToBelow] Direction in which transition works

  • ResetParam::Union{Nothing, String}: [APS] Parameter to reset on particles below PT or within box

  • PTBox_TempType::Union{Nothing, String}: # Temperature condition witin the box [none, constant, linear, halfspace]

  • PTBox_topTemp::Union{Nothing, Float64}: Temp @ top of box [for linear & halfspace]

  • PTBox_botTemp::Union{Nothing, Float64}: Temp @ bottom of box [for linear & halfspace]

  • PTBox_thermalAge::Union{Nothing, Float64}: Thermal age, usually in geo-units [Myrs] [only in case of halfspace]

  • PTBox_cstTemp::Union{Nothing, Float64}: Temp within box [only for constant T]

  • v_box::Union{Nothing, Float64}: [optional] only for NotInAirBox, velocity with which box moves in cm/yr

  • t0_box::Union{Nothing, Float64}: [optional] beginning time of movemen in Myr

  • t1_box::Union{Nothing, Float64}: [optional] end time of movement in Myr

  • clapeyron_slope::Union{Nothing, Float64}: [optional] clapeyron slope of phase transition [in K/MPa]; P = ( T - T0_clapeyron ) * clapeyron_slope + P0_clapeyron

  • P0_clapeyron::Union{Nothing, Float64}: [optional] P0_clapeyron [Pa]

  • T0_clapeyron::Union{Nothing, Float64}: [optional] T0_clapeyron [C]

source
LaMEM.LaMEM_Model.ScalingType
Scaling{T} is a structure that contains the scaling info, employed in the current simulation
  • Scaling::Any: Scaling object (as in GeoParams), which can be GEO_units(), NO_units(), or SI_units()
source
LaMEM.LaMEM_Model.SofteningType
Defines strain softening parameters
  • ID::Int64: softening law ID

  • APS1::Float64: Begin of softening, in units of accumulated plastic strain (APS)

  • APS2::Float64: End of softening, in units of accumulated plastic strain (APS)

  • A::Float64: Reduction ratio

  • Lm::Union{Nothing, Float64}: Material length scale (in selected units, e.g. km in geo)

  • APSheal2::Union{Nothing, Float64}: APS when healTau2 activates

  • healTau::Union{Nothing, Float64}: healing timescale parameter [Myr]

  • healTau2::Union{Nothing, Float64}: healing timescale parameter [Myr] starting at APS=APSheal2

source
LaMEM.LaMEM_Model.SolutionParamsType
Structure that contains the LaMEM global solution parameters.
  • gravity::Vector{Float64}: gravitational acceleration vector

  • FSSA::Float64: free surface stabilization parameter [0 - 1]; The value has to be between 0 and 1

  • FSSA_allVel::Int64: free surface stabilization parameter applied to all velocity components? Default is yes; if not it is only applied to the z-component
  • shear_heat_eff::Float64: shear heating efficiency parameter [0 - 1]

  • Adiabatic_Heat::Float64: Adiabatic Heating activation flag and efficiency. 0.0 - 1.0

  • act_temp_diff::Int64: temperature diffusion activation flag

  • act_therm_exp::Int64: thermal expansion activation flag

  • act_steady_temp::Int64: steady-state temperature initial guess activation flag

  • steady_temp_t::Float64: time for (quasi-)steady-state temperature initial guess

  • nstep_steady::Int64: number of steps for (quasi-)steady-state temperature initial guess (default = 1)

  • act_heat_rech::Int64: recharge heat in anomalous bodies after (quasi-)steady-state temperature initial guess (=2: recharge after every diffusion step of initial guess)

  • init_lith_pres::Int64: sets initial pressure to be the lithostatic pressure (stabilizes compressible setups in the first steps)

  • init_guess::Int64: create an initial guess step (using constant viscosity eta_ref before starting the simulation

  • p_litho_visc::Int64: use lithostatic instead of dynamic pressure for creep laws

  • p_litho_plast::Int64: use lithostatic pressure for plasticity

  • p_lim_plast::Int64: limit pressure at first iteration for plasticity

  • p_shift::Int64: add a constant value [MPa] to the total pressure field, before evaluating plasticity (e.g., when the domain is located @ some depth within the crust)

  • act_p_shift::Int64: pressure shift activation flag (enforce zero pressure on average in the top cell layer); note: this overwrites p_shift above!

  • eta_min::Float64: viscosity lower bound [Pas]

  • eta_max::Float64: viscosity upper limit [Pas]

  • eta_ref::Float64: Reference viscosity (used for the initial guess) [Pas]

  • T_ref::Float64: Reference temperature [C]

  • RUGC::Float64: universal gas constant (you need to change this only for non-dimensional setups)

  • min_cohes::Float64: cohesion lower bound [Pa]

  • min_fric::Float64: friction lower bound [degree]

  • tau_ult::Float64: ultimate yield stress [Pa]

  • rho_fluid::Float64: fluid density for depth-dependent density model

  • gw_level_type::String: ground water level type for pore pressure computation (see below)

  • gw_level::Float64: ground water level at the free surface (if defined)

  • biot::Float64: Biot pressure parameter

  • get_permea::Float64: effective permeability computation activation flag

  • rescal::Float64: stencil rescaling flag (for internal constraints, for example while computing permeability)

  • mfmax::Float64: maximum melt fraction affecting viscosity reduction

  • lmaxit::Int64: maximum number of local rheology iterations

  • lrtol::Float64: local rheology iterations relative tolerance

  • act_dike::Int64: dike activation flag (additonal term in divergence)

  • useTk::Int64: switch to use T-dependent conductivity, 0: not active

  • dikeHeat::Int64: switch to use Behn & Ito heat source in the dike

  • adiabatic_gradient::Float64: Adiabatic gradient in combination with Behn & Ito dike

  • Compute_velocity_gradient::Int64: compute the velocity gradient tensor 1: active, 0: not active. If active, it automatically activates the output in the .pvd file

  • Phasetrans::Int64: Activate Phase Transitions on Particles or not, 0: not.

  • Passive_Tracer::Int64: Activate Passive Tracers or not?

source
LaMEM.LaMEM_Model.SolverType
Structure that contains the LaMEM solver options
  • SolverType::String: solver employed ["direct" or "multigrid"]

  • DirectSolver::String: mumps/superlu_dist/pastix/umfpack (requires these external PETSc packages to be installed!)

  • DirectPenalty::Float64: penalty parameter [employed if we use a direct solver]

  • MGLevels::Int64: number of MG levels [default=3]

  • MGSweeps::Int64: number of MG smoothening steps per level [default=10]

  • MGSmoother::String: type of smoothener used [chebyshev or jacobi]

  • MGJacobiDamp::Float64: Dampening parameter [only employed for Jacobi smoothener; default=0.6]

  • MGCoarseSolver::String: coarse grid solver if using multigrid ["direct" / "mumps" / "superlu_dist" or "redundant" - more options specifiable through the command-line options -crs_ksp_type & -crs_pc_type]

  • MGRedundantNum::Int64: How many times do we copy the coarse grid? [only employed for redundant solver; default is 4]

  • MGRedundantSolver::String: The coarse grid solver for each of the redundant solves [only employed for redundant; options are "mumps"/"superlu_dist" with default "superlu_dist"]

  • PETSc_options::Vector{String}: List with (optional) PETSc options

source
LaMEM.LaMEM_Model.TimeType
Structure that contains the LaMEM timestepping information. An explanation of the paramneters is given in the struct `Time_info`
  • time_end::Float64: simulation end time

  • dt::Float64: initial time step

  • dt_min::Float64: minimum time step (declare divergence if lower value is attempted)

  • dt_max::Float64: maximum time step

  • dt_out::Float64: output step (output at least at fixed time intervals)

  • inc_dt::Float64: time step increment per time step (fraction of unit)

  • CFL::Float64: CFL (Courant-Friedrichs-Lewy) criterion

  • CFLMAX::Float64: CFL criterion for elasticity

  • nstep_max::Int64: maximum allowed number of steps (lower bound: timeend/dtmax)

  • nstep_out::Int64: save output every n steps; Set this to -1 to deactivate saving output

  • nstep_rdb::Int64: save restart database every n steps

  • num_dt_periods::Int64: number of time stepping periods

  • time_dt_periods::Vector{Int64}: timestamps where timestep should be fixed (first entry has to 0)

  • step_dt_periods::Vector{Float64}: target timesteps ar timestamps above

  • nstep_ini::Int64: save output for n initial steps

  • time_tol::Float64: relative tolerance for time comparisons

source
LaMEM.LaMEM_Model.VelCylinderType
LaMEM boundary condition internal velocty cylinder `VelCylinder` object
  • baseX::Float64: X-coordinate of base of cylinder

  • baseY::Float64: Y-coordinate of base of cylinder

  • baseZ::Float64: Z-coordinate of base of cylinder

  • capX::Float64: X-coordinate of cap of cylinder

  • capY::Float64: Y-coordinate of cap of cylinder

  • capZ::Float64: Z-coordinate of cap of cylinder

  • radius::Float64: radius of cylinder

  • vx::Union{Nothing, Float64}: Vx velocity of cylinder (default is unconstrained)

  • vy::Union{Nothing, Float64}: Vy velocity of cylinder (default is unconstrained)

  • vz::Union{Nothing, Float64}: Vz velocity of cylinder (default is unconstrained)

  • advect::Int64: cylinder advection flag

  • vmag::Float64: magnitude of velocity applied along the cylinder's axis of orientation

  • type::String: velocity profile [uniform or parabolic]

source
LaMEM.LaMEM_Model.VelocityBoxType
Define velocity regions within the modelling region, by specifying its center point and width along the three axis.
  • cenX::Float64: X-coordinate of center of box

  • cenY::Float64: Y-coordinate of center of box

  • cenZ::Float64: Z-coordinate of center of box

  • widthX::Float64: Width of box in x-direction

  • widthY::Float64: Width of box in y-direction

  • widthZ::Float64: Width of box in Z-direction

  • vx::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)

  • vy::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)

  • vz::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)

  • advect::Int64: box advection flag

source
GeophysicalModelGenerator.add_box!Method
add_box!(model::Model; xlim=Tuple{2}, [ylim=Tuple{2}], zlim=Tuple{2},
         Origin=nothing, StrikeAngle=0, DipAngle=0,
         phase = ConstantPhase(1),
-        T=nothing )

Adds a box with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models See the documentation of the GMG routine for the full options.

source
GeophysicalModelGenerator.add_cylinder!Method
add_cylinder!(model::Model;                                      # required input
+        T=nothing )

Adds a box with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models See the documentation of the GMG routine for the full options.

source
GeophysicalModelGenerator.add_cylinder!Method
add_cylinder!(model::Model;                                      # required input
                 base=Tuple{3}, cap=Tuple{3}, radius=Tuple{1},   # center and radius of the sphere
                 phase = ConstantPhase(1),                       # Sets the phase number(s) in the sphere
-                T=nothing )                                     # Sets the thermal structure (various fucntions are available)

See the documentation of the GMG routine

source
GeophysicalModelGenerator.add_ellipsoid!Method
add_ellipsoid!(model::Model;                                 # required input
                 cen=Tuple{3}, axes=Tuple{3},                # center and semi-axes of the ellpsoid
                 Origin=nothing, StrikeAngle=0, DipAngle=0,  # origin & dip/strike
                 phase = ConstantPhase(1),                   # Sets the phase number(s) in the box
-                T=nothing )

See the documentation of the GMG routine

source
GeophysicalModelGenerator.add_layer!Method
add_layer!(model::Model; xlim, ylim, zlim=Tuple{2},
         phase = ConstantPhase(1),
-        T=nothing )

Adds a layer with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models See the documentation of the GMG routine for the full options.

source
GeophysicalModelGenerator.add_polygon!Method
add_polygon!(model::Model;                                 # required input
+        T=nothing )

Adds a layer with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models See the documentation of the GMG routine for the full options.

source
GeophysicalModelGenerator.add_polygon!Method
add_polygon!(model::Model;                                 # required input
                 xlim::Vector, 
                 ylim=Vector,
                 zlim=Vector(), 
                 phase = ConstantPhase(1),                 # Sets the phase number(s) in the box
-                T=nothing)

See the documentation of the GMG routine

source
GeophysicalModelGenerator.add_slab!Method
add_slab!(model::Model;                                 # required input
                 trench::Trench; 
                 phase = ConstantPhase(1),                 # Sets the phase number(s) in the box
-                T=nothing)

See the documentation of the GMG routine

source
GeophysicalModelGenerator.add_stripes!Method
add_stripes!(Phase, Grid::AbstractGeneralGrid;
             stripAxes       = (1,1,0),
             stripeWidth     =  0.2,
             stripeSpacing   =  1,
@@ -65,10 +65,10 @@
             StrikeAngle     =  0,
             DipAngle        =  10,
             phase           =  ConstantPhase(3),
-            stripePhase     =  ConstantPhase(4))

See the documentation of the GMG routine

source
LaMEM.IO_functions.passivetracer_timeMethod
PT = passivetracer_time(ID::Union{Vector{Int64},Int64}, model::Model)

This reads passive tracers with ID from a LaMEM simulation specified by model, and returns a named tuple with the temporal evolution of these passive tracers. We return x,y,z coordinates and all fields specified in FileName for particles number ID.

source
LaMEM.IO_functions.read_LaMEM_simulationMethod
Timestep, FileNames, Time = read_LaMEM_simulation(model::Model; phase=false, surf=false, passive_tracers=false)

Reads a LaMEM simulation as specified in model and returns the timesteps, times and filenames of that simulation once it is finished.

source
LaMEM.IO_functions.read_LaMEM_timestepFunction
data, time = read_LaMEM_timestep(model::Model, TimeStep::Int64=0; fields=nothing, phase=false, surf=false, last=true)

Reads a specific Timestep from a simulation specified in model

source
LaMEM.LaMEM_Model.UpdateDefaultParametersMethod
model = UpdateDefaultParameters(model::Model)

This updates the default parameters depending on some of the input parameters. If you activate passive tracers, for example, it will also activate output for that

source
LaMEM.LaMEM_Model.above_surface!Method
above_surface!(model::Model, DataSurface_Cart::CartData; phase::Int64=nothing, T::Number=nothing)

Sets the Temp or Phases above the surface DataSurface_Cart to a constant value.

source
LaMEM.LaMEM_Model.add_geom!Method
add_geom!(model::Model, geom_object)

This adds an internal geometric primitive object geom_object to the LaMEM Model Setup model.

Currently available primitive geom objects are:

  • GeomSphere
  • GeomEllipsoid
  • GeomBox
  • GeomLayer
  • GeomCylinder
  • GeomRidgeSeg
  • GeomHex
source
LaMEM.LaMEM_Model.add_petsc!Method
add_petsc!(model::Model, option::String)

Adds one or more PETSc options to the model

Example

julia> d = Model()
-julia> add_petsc!(d,"-snes_npicard 3")
source
LaMEM.LaMEM_Model.add_topography!Method
add_topography!(model::Model, topography::CartData; surf_air_phase=0, surf_topo_file="topography.txt", open_top_bound=1,  surf_level=0.0)

Adds the topography surface to the model

source
LaMEM.LaMEM_Model.adjust_for_platformsMethod
model, cores =  adjust_for_platforms(model, cores::Int64)

On certain platforms we have restrictions (MPI is broken on windows currently, so we need to adjust things accordingly)

source
LaMEM.LaMEM_Model.below_surface!Method
below_surface!(model::Model, DataSurface_Cart::CartData; phase::Union{Int64,Nothing}=nothing, T::Union{Number,Nothing}=nothing)

Sets the Temp or Phases below the surface DataSurface_Cart to a constant value.

source
LaMEM.LaMEM_Model.create_initialsetupFunction
create_initialsetup(model::Model, cores::Int64=1, args::String=""; verbose=verbose)

Creates the initial model setup of LaMEM from model, which includes:

  • Writing the LaMEM (*.dat) input file

and in case we do not employt geometric primitives to create the setup:

  • Write the VTK file (if requested when model.Output.write_VTK_setup=true)
  • Write the marker files to disk (if model.ModelSetup.msetup="files")
source
LaMEM.LaMEM_Model.cross_sectionFunction
data_tuple, axes_str = cross_section(model::LaMEM.Model, field=:phases; x=nothing, y=nothing, z=nothing)

This creates a cross-section through the initial model setup & returns a 2D array

source
LaMEM.LaMEM_Model.cross_sectionFunction
Cross = cross_section(cart::CartData, field::Symbol =:phase; x=nothing, y=nothing, z=nothing)

Creates a cross-section through the data and returns x,z coordinates

source
LaMEM.LaMEM_Model.digitsepMethod
digitsep(value::Integer; separator=",", per_separator=3)

Convert an integer to a string, separating each per_separator digits by separator.

digitsep(12345678)  # "12,345,678"
+            stripePhase     =  ConstantPhase(4))

See the documentation of the GMG routine

source
LaMEM.IO_functions.passivetracer_timeMethod
PT = passivetracer_time(ID::Union{Vector{Int64},Int64}, model::Model)

This reads passive tracers with ID from a LaMEM simulation specified by model, and returns a named tuple with the temporal evolution of these passive tracers. We return x,y,z coordinates and all fields specified in FileName for particles number ID.

source
LaMEM.IO_functions.read_LaMEM_simulationMethod
Timestep, FileNames, Time = read_LaMEM_simulation(model::Model; phase=false, surf=false, passive_tracers=false)

Reads a LaMEM simulation as specified in model and returns the timesteps, times and filenames of that simulation once it is finished.

source
LaMEM.IO_functions.read_LaMEM_timestepFunction
data, time = read_LaMEM_timestep(model::Model, TimeStep::Int64=0; fields=nothing, phase=false, surf=false, last=true)

Reads a specific Timestep from a simulation specified in model

source
LaMEM.LaMEM_Model.UpdateDefaultParametersMethod
model = UpdateDefaultParameters(model::Model)

This updates the default parameters depending on some of the input parameters. If you activate passive tracers, for example, it will also activate output for that

source
LaMEM.LaMEM_Model.above_surface!Method
above_surface!(model::Model, DataSurface_Cart::CartData; phase::Int64=nothing, T::Number=nothing)

Sets the Temp or Phases above the surface DataSurface_Cart to a constant value.

source
LaMEM.LaMEM_Model.add_geom!Method
add_geom!(model::Model, geom_object)

This adds an internal geometric primitive object geom_object to the LaMEM Model Setup model.

Currently available primitive geom objects are:

  • GeomSphere
  • GeomEllipsoid
  • GeomBox
  • GeomLayer
  • GeomCylinder
  • GeomRidgeSeg
  • GeomHex
source
LaMEM.LaMEM_Model.add_petsc!Method
add_petsc!(model::Model, option::String)

Adds one or more PETSc options to the model

Example

julia> d = Model()
+julia> add_petsc!(d,"-snes_npicard 3")
source
LaMEM.LaMEM_Model.add_topography!Method
add_topography!(model::Model, topography::CartData; surf_air_phase=0, surf_topo_file="topography.txt", open_top_bound=1,  surf_level=0.0)

Adds the topography surface to the model

source
LaMEM.LaMEM_Model.adjust_for_platformsMethod
model, cores =  adjust_for_platforms(model, cores::Int64)

On certain platforms we have restrictions (MPI is broken on windows currently, so we need to adjust things accordingly)

source
LaMEM.LaMEM_Model.below_surface!Method
below_surface!(model::Model, DataSurface_Cart::CartData; phase::Union{Int64,Nothing}=nothing, T::Union{Number,Nothing}=nothing)

Sets the Temp or Phases below the surface DataSurface_Cart to a constant value.

source
LaMEM.LaMEM_Model.create_initialsetupFunction
create_initialsetup(model::Model, cores::Int64=1, args::String=""; verbose=verbose)

Creates the initial model setup of LaMEM from model, which includes:

  • Writing the LaMEM (*.dat) input file

and in case we do not employt geometric primitives to create the setup:

  • Write the VTK file (if requested when model.Output.write_VTK_setup=true)
  • Write the marker files to disk (if model.ModelSetup.msetup="files")
source
LaMEM.LaMEM_Model.cross_sectionFunction
data_tuple, axes_str = cross_section(model::LaMEM.Model, field=:phases; x=nothing, y=nothing, z=nothing)

This creates a cross-section through the initial model setup & returns a 2D array

source
LaMEM.LaMEM_Model.cross_sectionFunction
Cross = cross_section(cart::CartData, field::Symbol =:phase; x=nothing, y=nothing, z=nothing)

Creates a cross-section through the data and returns x,z coordinates

source
LaMEM.LaMEM_Model.digitsepMethod
digitsep(value::Integer; separator=",", per_separator=3)

Convert an integer to a string, separating each per_separator digits by separator.

digitsep(12345678)  # "12,345,678"
 digitsep(12345678, seperator= "'")  # "12'345'678"
-digitsep(12345678, seperator= "-", per_separator=4)  # "1234-5678"
source
LaMEM.LaMEM_Model.prepare_lamemFunction
prepare_lamem(model::Model, cores::Int64=1, args:String=""; verbose=false)

Prepares a LaMEM run for the parameters that are specified in model, without running the simulation 1) Create the *.dat file 2) Write markers to disk in case we use a "files" setup

This is useful if you want to prepare a model on one machine but run it on another one (e.g. a cluster)

Set model.Output.write_VTK_setup to true if you want to write a VTK file of the model setup

source
LaMEM.LaMEM_Model.replace_phase!Method
replace_phase!(model::Model, phase_new::Phase; ID::Int64=nothing, Name::String=nothing)

This replaces a phase within a LaMEM Model Setup model with phase_new either based on its Name or ID. Note that it is expected that only one such phase is present in the current setup.

source
LaMEM.LaMEM_Model.set_airMethod
set_air(; Name="air", ID=0, rho=1, alpha=nothing, eta=1e17, G=nothing, nu=nothing, fr=nothing, ch=nothing, k=30,Cp=1000)

Sets an air phase, with high conductivity

source
LaMEM.LaMEM_Model.stress_strainrate_0DMethod
τ = stress_strainrate_0D(rheology, ε_vec::Vector; n=8, T=700, nstep_max=2, clean=true)

Computes the stress for a given strain rate and 0D rheology setup, for viscous creep rheologies. n is the resolution in x,z, T the temperature, nstep_max the number of time steps, ε_vec the strainrate vector (in 1/s).

source
LaMEM.LaMEM_Model.write_LaMEM_inputFileMethod
write_LaMEM_inputFile(io, d::Grid)

This writes grid info to a LaMEM input file

Example

julia> d=LaMEM.Grid(coord_x=[0.0, 0.7, 0.8, 1.0], bias_x=[0.3,1.0,3.0], nel_x=[10,4,2])
+digitsep(12345678, seperator= "-", per_separator=4)  # "1234-5678"
source
LaMEM.LaMEM_Model.prepare_lamemFunction
prepare_lamem(model::Model, cores::Int64=1, args:String=""; verbose=false)

Prepares a LaMEM run for the parameters that are specified in model, without running the simulation 1) Create the *.dat file 2) Write markers to disk in case we use a "files" setup

This is useful if you want to prepare a model on one machine but run it on another one (e.g. a cluster)

Set model.Output.write_VTK_setup to true if you want to write a VTK file of the model setup

source
LaMEM.LaMEM_Model.replace_phase!Method
replace_phase!(model::Model, phase_new::Phase; ID::Int64=nothing, Name::String=nothing)

This replaces a phase within a LaMEM Model Setup model with phase_new either based on its Name or ID. Note that it is expected that only one such phase is present in the current setup.

source
LaMEM.LaMEM_Model.set_airMethod
set_air(; Name="air", ID=0, rho=1, alpha=nothing, eta=1e17, G=nothing, nu=nothing, fr=nothing, ch=nothing, k=30,Cp=1000)

Sets an air phase, with high conductivity

source
LaMEM.LaMEM_Model.stress_strainrate_0DMethod
τ = stress_strainrate_0D(rheology, ε_vec::Vector; n=8, T=700, nstep_max=2, clean=true)

Computes the stress for a given strain rate and 0D rheology setup, for viscous creep rheologies. n is the resolution in x,z, T the temperature, nstep_max the number of time steps, ε_vec the strainrate vector (in 1/s).

source
LaMEM.LaMEM_Model.write_LaMEM_inputFileMethod
write_LaMEM_inputFile(io, d::Grid)

This writes grid info to a LaMEM input file

Example

julia> d=LaMEM.Grid(coord_x=[0.0, 0.7, 0.8, 1.0], bias_x=[0.3,1.0,3.0], nel_x=[10,4,2])
 julia> io = open("test.dat","w")
 julia> LaMEM.write_LaMEM_inputFile(io, d)
-julia> close(io)
source
LaMEM.Run.run_lamemFunction
run_lamem(model::Model, cores::Int64=1, args:String=""; wait=true)

Performs a LaMEM run for the parameters that are specified in model

source
+julia> close(io)
source
LaMEM.Run.run_lamemFunction
run_lamem(model::Model, cores::Int64=1, args:String=""; wait=true)

Performs a LaMEM run for the parameters that are specified in model

source
diff --git a/dev/Subduction3D/index.html b/dev/Subduction3D/index.html index 9a4c09f..77d1a87 100644 --- a/dev/Subduction3D/index.html +++ b/dev/Subduction3D/index.html @@ -40,4 +40,4 @@ catch run_lamem(model, 8) # run on 8 cores (if possible) end

The results looks like this with paraview: 3D subduction paraview Note that this is a significantly higher resolution than the original paper, which was run on an HPC system (admittedly, this was 20 years ago).

The file Subduction_3D.jl in /scripts reproduces this example

Markdown page generation

#This file was generated using Literate:
-#Literate.markdown("Subduction3D.jl","../docs/src/",keepcomments=true, execute=false, codefence = "```julia" => "```")

This page was generated using Literate.jl.

+#Literate.markdown("Subduction3D.jl","../docs/src/",keepcomments=true, execute=false, codefence = "```julia" => "```")

This page was generated using Literate.jl.

diff --git a/dev/index.html b/dev/index.html index 74a9a69..32f3bbe 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · LaMEM.jl

LaMEM.jl

This is the julia interface to LaMEM, which does a number of handy things:

  • It will automatically download a binary installation of LaMEM, along with the correct version of PETSc and mpiexec for your system. You can also use these binaries directly from your terminal, so you are not limited to julia. Gone are the days where you had to first spend hours or days to install PETSc on your system!
  • It provides the functionality to setup a model, run it and plot the results with a few lines of julia.
  • We provide many default options
  • You can do this with Jupyter or Pluto notebooks
  • We provide a simple function to run LaMEM from julia (also in parallel), using classical LaMEM *.dat files
  • We provide functions to read timesteps back into julia and compress out
+Home · LaMEM.jl

LaMEM.jl

This is the julia interface to LaMEM, which does a number of handy things:

  • It will automatically download a binary installation of LaMEM, along with the correct version of PETSc and mpiexec for your system. You can also use these binaries directly from your terminal, so you are not limited to julia. Gone are the days where you had to first spend hours or days to install PETSc on your system!
  • It provides the functionality to setup a model, run it and plot the results with a few lines of julia.
  • We provide many default options
  • You can do this with Jupyter or Pluto notebooks
  • We provide a simple function to run LaMEM from julia (also in parallel), using classical LaMEM *.dat files
  • We provide functions to read timesteps back into julia and compress out
diff --git a/dev/installation/index.html b/dev/installation/index.html index 0fa123e..55e54b1 100644 --- a/dev/installation/index.html +++ b/dev/installation/index.html @@ -3,4 +3,4 @@ pkg>add LaMEM

which will download the binaries along with PETSc and mpiexec for your system.

You can test if it works on your machine with

pkg> test LaMEM

Running LaMEM from the julia REPL

Running LaMEM from within julia can be done with the run_lamem function:

LaMEM.Run.run_lamemFunction
run_lamem(ParamFile::String, cores::Int64=1, args:String=""; wait=true, deactivate_multithreads=true)

This starts a LaMEM simulation, for using the parameter file ParamFile on cores number of cores. Optional additional command-line parameters can be specified with args.

Example:

You can call LaMEM with:

julia> using LaMEM
 julia> ParamFile="../../input_models/BuildInSetups/FallingBlock_Multigrid.dat";
 julia> run_lamem(ParamFile)

Do the same on 2 cores with a command-line argument as:

julia> ParamFile="../../input_models/BuildInSetups/FallingBlock_Multigrid.dat";
-julia> run_lamem(ParamFile, 2, "-nstep_max = 1")
source
run_lamem(model::Model, cores::Int64=1, args:String=""; wait=true)

Performs a LaMEM run for the parameters that are specified in model

source

Running LaMEM from outside julia

If you, for some reason, do not want to run LaMEM through julia but instead directly from the terminal or powershell, you will have to add the required dynamic libraries and executables. Do this with:

LaMEM.Run.show_paths_LaMEMFunction
show_paths_LaMEM()

The downloaded LaMEM binaries can also be called from outside julia (directly from the terminal). In that case, you will need to set load correct dynamic libraries (such as PETSc) and call the correct binaries.

This function shows this for your system.

source
+julia> run_lamem(ParamFile, 2, "-nstep_max = 1")source
run_lamem(model::Model, cores::Int64=1, args:String=""; wait=true)

Performs a LaMEM run for the parameters that are specified in model

source

Running LaMEM from outside julia

If you, for some reason, do not want to run LaMEM through julia but instead directly from the terminal or powershell, you will have to add the required dynamic libraries and executables. Do this with:

LaMEM.Run.show_paths_LaMEMFunction
show_paths_LaMEM()

The downloaded LaMEM binaries can also be called from outside julia (directly from the terminal). In that case, you will need to set load correct dynamic libraries (such as PETSc) and call the correct binaries.

This function shows this for your system.

source
diff --git a/dev/installation_HPC/index.html b/dev/installation_HPC/index.html index a5a4d68..3e13a48 100644 --- a/dev/installation_HPC/index.html +++ b/dev/installation_HPC/index.html @@ -1,13 +1,20 @@ -Installation on HPC systems · LaMEM.jl

Installation on HPC systems

Installing LaMEM on high performance computer (HPC) systems can be complicated, because you will have to compile PETSc with the correct dependencies for that system. The reason is that HPC systems use MPI versions that are specifically tailored/compiled for that system.

Warning: the explanation below is still somewhat experimental and may not work on your system The best approach of running LaMEM on large HPC systems remains to install the correct version of PETSc using the locally recommended MPI libraries and install the correct version of LaMEM with that. You can still save the input setup to file, for the correct number or processors using LaMEM.jl. The locally generated *.dat file will still work.

Luckily there is a solution thanks to the great work of @eschnett and colleagues, who developed MPITrampoline which is an intermediate layer between the HPC-system-specific MPI libraries and the precompiled LaMEM binaries.

It essentially consists of two steps: 1) compile a small package (MPIwrapper) 2) make sure that you download the version of LaMEM that was compiled versus MPItrampoline.

Here step-by-step instructions (for Linux, as that is what essentially all HPC systems use):

$git clone https://github.com/eschnett/MPIwrapper.git 
-$cd MPIwrapper
  • Install it after making sure that mpiexec points to the one you want (you may have to load some modules, depending on your system):
$cmake -S . -B build -DMPIEXEC_EXECUTABLE=mpiexec -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/mpiwrapper
-$cmake --build build
-$cmake --install build

At this stage, MPItrampoline is installed in $HOME/mpiwrapper

  • Set the correct wrapper:
$export MPITRAMPOLINE_LIB=$HOME/mpiwrapper/lib64/libmpiwrapper.so

Depending on the system it may be called lib instead of lib64 (check!).

  • Start julia and install the MPI and MPIPreferences packages:
$julia
+Installation on HPC systems · LaMEM.jl

Installation on HPC systems

Installing LaMEM on high performance computer (HPC) systems can be complicated, because you will have to compile PETSc with the correct dependencies for that system. The reason is that HPC systems use MPI versions that are specifically tailored/compiled for that system.

Warning: the explanation below is still somewhat experimental and may not work on your system The best approach of running LaMEM on large HPC systems remains to install the correct version of PETSc using the locally recommended MPI libraries and install the correct version of LaMEM with that. You can still save the input setup to file, for the correct number or processors using LaMEM.jl. The locally generated *.dat file will still work.

Luckily there is a solution thanks to the great work of @eschnett and colleagues, who developed MPITrampoline which is an intermediate layer between the HPC-system-specific MPI libraries and the precompiled LaMEM binaries.

It essentially consists of two steps: 1) compile a small package (MPIwrapper) 2) make sure that you download the version of LaMEM that was compiled versus MPItrampoline.

Here step-by-step instructions (for Linux, as that is what essentially all HPC systems use):

git clone https://github.com/eschnett/MPIwrapper.git 
+cd MPIwrapper
  • Install it after making sure that mpiexec points to the one you want (you may have to load some modules, depending on your system):
cmake -S . -B build -DMPIEXEC_EXECUTABLE=/full/path/to/mpiexec -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/mpiwrapper
+cmake --build build
+cmake --install build

[!IMPORTANT] You need to specify the full path to mpiexec (or equivalent) and not just the name. If you don't know that, you can determine this with which mpiexec

At this stage, MPItrampoline is installed in $HOME/mpiwrapper

  • Set the correct wrappers:
export MPITRAMPOLINE_LIB=$HOME/mpiwrapper/lib64/libmpiwrapper.so
+export MPITRAMPOLINE_MPIEXEC=$HOME/MPIwrapper/mpiwrapper/bin/mpiwrapperexec 

Depending on the system it may be called lib instead of lib64 (check!).

  • Start julia and install the correct versuion of MPItrampoline_jll

Since LaMEM_jll and PETSc_jll are compiled versus a specific version of MPItrampoline_jll, this step is important. You can see which one we currently use here. At the time of writting this was version 5.2.1:

julia
+julia> ]
+pkg>add MPItrampoline_jll@5.2.1
  • Install the MPI and MPIPreferences packages:
julia
 julia> ]
 pkg>add MPI, MPIPreferences
  • Set the preference to use MPItrampoline
julia> using MPIPreferences; MPIPreferences.use_jll_binary("MPItrampoline_jll")
 ┌ Info: MPIPreferences unchanged
 └   binary = "MPItrampoline_jll"
  • Load MPI and verify it is the correct one
julia> using MPI
 julia> MPI.Get_library_version()
-"MPIwrapper 2.10.3, using MPIABI 2.9.0, wrapping:\nOpen MPI v4.1.4, package: Open MPI boris@Pluton Distribution, ident: 4.1.4, repo rev: v4.1.4, May 26, 2022"

After this, restart julia (this only needs to be done once, next time all is fine).

  • Now load LaMEM and check that it uses the mpitrampoline version:
julia> using MPI,LaMEM
+"MPIwrapper 2.10.3, using MPIABI 2.9.0, wrapping:\nOpen MPI v4.1.4, package: Open MPI boris@Pluton Distribution, ident: 4.1.4, repo rev: v4.1.4, May 26, 2022"

After this, restart julia (this only needs to be done once, next time all is fine).

If you want you can run a test case with:

julia> using MPI
+julia> mpiexec(cmd -> run(`$cmd -n 3 echo hello world`));
+hello world
+hello world
+hello world
  • Now load LaMEM and check that it uses the mpitrampoline version:
julia> using MPI,LaMEM
 julia> LaMEM.LaMEM_jll.host_platform
-Linux x86_64 {cxxstring_abi=cxx11, julia_version=1.8.1, libc=glibc, libgfortran_version=5.0.0, mpi=mpitrampoline}

At this stage the precompiled version of LaMEM should be useable on that system.

+Linux x86_64 {cxxstring_abi=cxx11, julia_version=1.8.1, libc=glibc, libgfortran_version=5.0.0, mpi=mpitrampoline}

At this stage the precompiled version of LaMEM should be useable on that system.

diff --git a/dev/juliasetup_LaPalma/index.html b/dev/juliasetup_LaPalma/index.html index 132669a..0daf698 100644 --- a/dev/juliasetup_LaPalma/index.html +++ b/dev/juliasetup_LaPalma/index.html @@ -98,4 +98,4 @@ Length : 1000. [m] Viscosity : 1e+20 [Pa*s] Stress : 1e+09 [Pa] --------------------------------------------------------------------------- +-------------------------------------------------------------------------- diff --git a/dev/juliasetup_TMSubduction/index.html b/dev/juliasetup_TMSubduction/index.html index b0ac7d5..ceabce7 100644 --- a/dev/juliasetup_TMSubduction/index.html +++ b/dev/juliasetup_TMSubduction/index.html @@ -269,4 +269,4 @@ Temperature : 1000. [C/K] Length : 1000. [m] Viscosity : 1e+20 [Pa*s] - Stress : 1e+09 [Pa]

The results will be saved in the directory where you performed the simulation and can be visualized in Paraview by opening the file output.pvd: 2D thermomechanical subduction

Remark on performing parallel simulations

Using more processors or cores does not necessarily imply that the simulation will be faster. There is a tradeoff between the number of processors, the resolution, the number of multigrid levels, the machine you use and the speed of the simulation. At some stage it actually becomes slower!

Unfortunately, it is hard to predict when this happens as this is setup- and machine-dependent. We can thus not automatize this, and our recommendation is therefore that you experiment with this. Run the simulation for a limited number of timesteps (say 5 or so) and check its speed for different number of cores.

+ Stress : 1e+09 [Pa]

The results will be saved in the directory where you performed the simulation and can be visualized in Paraview by opening the file output.pvd: 2D thermomechanical subduction

Remark on performing parallel simulations

Using more processors or cores does not necessarily imply that the simulation will be faster. There is a tradeoff between the number of processors, the resolution, the number of multigrid levels, the machine you use and the speed of the simulation. At some stage it actually becomes slower!

Unfortunately, it is hard to predict when this happens as this is setup- and machine-dependent. We can thus not automatize this, and our recommendation is therefore that you experiment with this. Run the simulation for a limited number of timesteps (say 5 or so) and check its speed for different number of cores.

diff --git a/dev/juliasetup_example_sphere/index.html b/dev/juliasetup_example_sphere/index.html index dad1a7c..0ccd369 100644 --- a/dev/juliasetup_example_sphere/index.html +++ b/dev/juliasetup_example_sphere/index.html @@ -92,4 +92,4 @@ "markers" "output.dat" "output.pvd"

And you can open output.pvd with paraview. If your system recognizes that *.pvd files should be opened with paraview, you can do that with

julia> ;
-shell> open output.pvd

Otherwise, start paraview manually and open the file.

+shell> open output.pvd

Otherwise, start paraview manually and open the file.

diff --git a/dev/juliasetup_pluto/index.html b/dev/juliasetup_pluto/index.html index 6bc592f..8b75d46 100644 --- a/dev/juliasetup_pluto/index.html +++ b/dev/juliasetup_pluto/index.html @@ -1,4 +1,4 @@ Notebooks · LaMEM.jl

Using Pluto or Jupyter notebooks

Pluto

You can also run LaMEM directly using Pluto notebooks:

julia> using Pluto
 julia> Pluto.run()

we have provided examples in the notebooks directory of the LaMEM.jl package.

Jupyter

And for the ones of you that are more used to Jupyter notebooks, we also provide an example. Note that this will require you to install the required packages in julia first and use the IJulia package:

julia> using IJulia
-julia> notebook()
+julia> notebook() diff --git a/dev/juliasetups/index.html b/dev/juliasetups/index.html index e8e36aa..57906ba 100644 --- a/dev/juliasetups/index.html +++ b/dev/juliasetups/index.html @@ -77,4 +77,4 @@ y ϵ [-10.0 : 0.0] z ϵ [-10.0 : 0.0] Phases : range ϵ [0 - 1] - Temp : range ϵ [0.0 - 0.0]

Running a model is very simple:

julia> run_lamem(model,1)

More examples

More examples can be found on the left hand side menu.

+ Temp : range ϵ [0.0 - 0.0]

Running a model is very simple:

julia> run_lamem(model,1)

More examples

More examples can be found on the left hand side menu.

diff --git a/dev/listfunctions/index.html b/dev/listfunctions/index.html index e2841a0..b326a7b 100644 --- a/dev/listfunctions/index.html +++ b/dev/listfunctions/index.html @@ -1,9 +1,9 @@ -List of functions · LaMEM.jl

List of all functions

These are all functions that are available in the package, which can roughly be divided into two groups (running & reading LaMEM)

Julia interface to LaMEM

Running LaMEM

LaMEM.Run.extract_info_logfileMethod
value = extract_info_logfile(lines, keyword::String; entry=1, LaMEM=true)

Internal function to extract information from the logfile

Note that the LaMEM keywords should contain ":" at the end, while the PETSc keywords should not, but we have to indicate the entry number for the PETSc keywords. Example LaMEM keyword:

julia> val = extract_info_logfile(lines, "Fine grid cells [nx, ny, nz]         :")
+List of functions · LaMEM.jl

List of all functions

These are all functions that are available in the package, which can roughly be divided into two groups (running & reading LaMEM)

Julia interface to LaMEM

Running LaMEM

LaMEM.Run.extract_info_logfileMethod
value = extract_info_logfile(lines, keyword::String; entry=1, LaMEM=true)

Internal function to extract information from the logfile

Note that the LaMEM keywords should contain ":" at the end, while the PETSc keywords should not, but we have to indicate the entry number for the PETSc keywords. Example LaMEM keyword:

julia> val = extract_info_logfile(lines, "Fine grid cells [nx, ny, nz]         :")
 "[512, 256, 256]"

Example PETSc keyword:

julia> coarse_grid_solve = extract_info_logfile(lines, "MGSmooth Level 0", LaMEM=false, entry=3)
-9.9174
source
LaMEM.Run.read_LaMEM_logfileMethod

This reads a LaMEM logfile (provided it was run with "-log_view") and collects key results from it; mostly for scalability tests on HPC machines. It returns a markdown summary

source
LaMEM.Run.remove_popup_messages_macMethod
remove_popup_messages_mac()

On a Mac with firewall enabled, running LaMEM will result in a popup window that says: "Accept incoming connections" which you should Allow or Deny. This is a bit annoying, so this julia script fixes that. Note that you must have administrator rights on your machine as we need to run "sudo"

Run this script from the terminal with

julia> remove_popup_messages_mac()

You need to do this once (every time a new version is installed)

source
LaMEM.Run.run_lamemFunction
run_lamem(ParamFile::String, cores::Int64=1, args:String=""; wait=true, deactivate_multithreads=true)

This starts a LaMEM simulation, for using the parameter file ParamFile on cores number of cores. Optional additional command-line parameters can be specified with args.

Example:

You can call LaMEM with:

julia> using LaMEM
+9.9174
source
LaMEM.Run.read_LaMEM_logfileMethod

This reads a LaMEM logfile (provided it was run with "-log_view") and collects key results from it; mostly for scalability tests on HPC machines. It returns a markdown summary

source
LaMEM.Run.remove_popup_messages_macMethod
remove_popup_messages_mac()

On a Mac with firewall enabled, running LaMEM will result in a popup window that says: "Accept incoming connections" which you should Allow or Deny. This is a bit annoying, so this julia script fixes that. Note that you must have administrator rights on your machine as we need to run "sudo"

Run this script from the terminal with

julia> remove_popup_messages_mac()

You need to do this once (every time a new version is installed)

source
LaMEM.Run.run_lamemFunction
run_lamem(ParamFile::String, cores::Int64=1, args:String=""; wait=true, deactivate_multithreads=true)

This starts a LaMEM simulation, for using the parameter file ParamFile on cores number of cores. Optional additional command-line parameters can be specified with args.

Example:

You can call LaMEM with:

julia> using LaMEM
 julia> ParamFile="../../input_models/BuildInSetups/FallingBlock_Multigrid.dat";
 julia> run_lamem(ParamFile)

Do the same on 2 cores with a command-line argument as:

julia> ParamFile="../../input_models/BuildInSetups/FallingBlock_Multigrid.dat";
-julia> run_lamem(ParamFile, 2, "-nstep_max = 1")
source
LaMEM.Run.run_lamem_save_gridFunction
ProcessorPartFile = run_lamem_save_grid(ParamFile::String, cores::Int64=1; verbose=true, directory=pwd())

This calls LaMEM simulation, for using the parameter file ParamFile and creates processor partitioning file "ProcessorPartitioning_Xcpu_X.Y.Z.bin" for {X} number of cores.

Example:

julia> using LaMEM
+julia> run_lamem(ParamFile, 2, "-nstep_max = 1")
source
LaMEM.Run.run_lamem_save_gridFunction
ProcessorPartFile = run_lamem_save_grid(ParamFile::String, cores::Int64=1; verbose=true, directory=pwd())

This calls LaMEM simulation, for using the parameter file ParamFile and creates processor partitioning file "ProcessorPartitioning_Xcpu_X.Y.Z.bin" for {X} number of cores.

Example:

julia> using LaMEM
 julia> ParamFile="../../input_models/BuildInSetups/FallingBlock_Multigrid.dat";
-julia> ProcessorPartFile = run_lamem_save_grid(ParamFile, 2)
source
LaMEM.Run.show_paths_LaMEMMethod
show_paths_LaMEM()

The downloaded LaMEM binaries can also be called from outside julia (directly from the terminal). In that case, you will need to set load correct dynamic libraries (such as PETSc) and call the correct binaries.

This function shows this for your system.

source

Reading LaMEM output back into julia

LaMEM.IO_functions.ReadField_3D_pVTRMethod
output, isCell = ReadField_3D_pVTR(data, FieldName::String)

Extracts a 3D data field from a pVTR data structure data

Input:

  • data: Data structure obtained with ReadVTRFile
  • FieldName: Exact name of the field as specified in the *.vtr file

Output:

  • data_field, isCell: 3D field with data, and a flag that indicates whether it is Cell data (PointData otherwise) data_field is a tuple of size 1, or 3 depending on whether it is a scalar or vector field
source
LaMEM.IO_functions.ReadField_3D_pVTUMethod
output, isCell = ReadField_3D_pVTU(data, FieldName::String)

Extracts a 3D data field from a pVTU data structure data Input:

  • data: Data structure obtained with ReadVTRFile
  • FieldName: Exact name of the field as specified in the *.vtr file

Output:

  • data_field: Array with data, data_field is a tuple of size 1, 3 or 9 depending on whether it is a scalar, vector or tensor field
source
LaMEM.IO_functions.compress_vtr_fileMethod
filename_compressed::String =  compress_vtr_file(filename::String; Dir=pwd(), delete_original_files=false)

Compresses a LaMEM VTR file (loads parallel files & save them again )

source
LaMEM.IO_functions.passivetracer_timeFunction
PT = passivetracer_time(ID::Union{Vector{Int64},Int64}, FileName::String, DirName::String="")

This reads passive tracers with ID from a LaMEM simulation, and returns a named tuple with the temporal evolution of these passive tracers. We return x,y,z coordinates and all fields specified in the FileName for particles number ID.

source
LaMEM.IO_functions.readPVDMethod
FileNames, Time, Timestep = readPVD(FileName::String)

This reads a PVD file & returns the FileNames, Time and Timesteps

source
LaMEM.IO_functions.read_LaMEM_PVTR_fileMethod
data_output = read_LaMEM_PVTR_file(DirName, FileName; fields=nothing)

Reads a 3D LaMEM timestep from VTR file FileName, located in directory DirName. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.

It will return data_output which is a CartData output structure.

source
LaMEM.IO_functions.read_LaMEM_PVTS_fileMethod
data_output = read_LaMEM_PVTS_file(DirName, FileName; field=nothing)

Reads a 3D LaMEM timestep from VTS file FileName, located in directory DirName. Typically this is done to read passive tracers back into julia. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.

It will return data_output which is a CartData output structure.

source
LaMEM.IO_functions.read_LaMEM_PVTU_fileMethod
data_output = read_LaMEM_PVTU_file(DirName, FileName; fields=nothing)

Reads a 3D LaMEM timestep from VTU file FileName, located in directory DirName. Typically this is done to read passive tracers back into julia. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.

It will return data_output which is a CartData output structure.

source
LaMEM.IO_functions.read_LaMEM_simulationFunction
Timestep, FileNames, Time = read_LaMEM_simulation(FileName::String, DirName::String=""; phase=false, surf=false, passive_tracers=false)

Reads a LaMEM simulation FileName in directory DirName and returns the timesteps, times and filenames of that simulation.

source
LaMEM.IO_functions.read_LaMEM_timestepFunction
data, time = read_LaMEM_timestep(FileName::String, TimeStep::Int64=0, DirName::String=""; fields=nothing, phase=false, surf=false, last=false)

This reads a LaMEM timestep.

Input Arguments:

  • FileName: name of the simulation, w/out extension
  • Timestep: timestep to be read, unless last=true in which case we read the last one
  • DirName: name of the main directory (i.e. where the *.pvd files are located)
  • fields: Tuple with optional fields; if not specified all will be loaded
  • phase: Loads the phase information of LaMEM if true
  • surf: Loads the free surface of LaMEM if true
  • passive_tracers: Loads passive tracers if true
  • last: Loads the last timestep

Output:

  • data: Cartesian data struct with LaMEM output
  • time: The time of the timestep
source
LaMEM.IO_functions.read_phase_diagramMethod
out = read_phase_diagram(name::String)

Reads a phase diagram from a file name and returns a NamedTuple with temperature T, pressure P, melt density ρ_melt, solid density ρ_solid, density ρ and melt fraction ϕ

source
+julia> ProcessorPartFile = run_lamem_save_grid(ParamFile, 2)
source
LaMEM.Run.show_paths_LaMEMMethod
show_paths_LaMEM()

The downloaded LaMEM binaries can also be called from outside julia (directly from the terminal). In that case, you will need to set load correct dynamic libraries (such as PETSc) and call the correct binaries.

This function shows this for your system.

source

Reading LaMEM output back into julia

LaMEM.IO_functions.ReadField_3D_pVTRMethod
output, isCell = ReadField_3D_pVTR(data, FieldName::String)

Extracts a 3D data field from a pVTR data structure data

Input:

  • data: Data structure obtained with ReadVTRFile
  • FieldName: Exact name of the field as specified in the *.vtr file

Output:

  • data_field, isCell: 3D field with data, and a flag that indicates whether it is Cell data (PointData otherwise) data_field is a tuple of size 1, or 3 depending on whether it is a scalar or vector field
source
LaMEM.IO_functions.ReadField_3D_pVTUMethod
output, isCell = ReadField_3D_pVTU(data, FieldName::String)

Extracts a 3D data field from a pVTU data structure data Input:

  • data: Data structure obtained with ReadVTRFile
  • FieldName: Exact name of the field as specified in the *.vtr file

Output:

  • data_field: Array with data, data_field is a tuple of size 1, 3 or 9 depending on whether it is a scalar, vector or tensor field
source
LaMEM.IO_functions.compress_vtr_fileMethod
filename_compressed::String =  compress_vtr_file(filename::String; Dir=pwd(), delete_original_files=false)

Compresses a LaMEM VTR file (loads parallel files & save them again )

source
LaMEM.IO_functions.passivetracer_timeFunction
PT = passivetracer_time(ID::Union{Vector{Int64},Int64}, FileName::String, DirName::String="")

This reads passive tracers with ID from a LaMEM simulation, and returns a named tuple with the temporal evolution of these passive tracers. We return x,y,z coordinates and all fields specified in the FileName for particles number ID.

source
LaMEM.IO_functions.readPVDMethod
FileNames, Time, Timestep = readPVD(FileName::String)

This reads a PVD file & returns the FileNames, Time and Timesteps

source
LaMEM.IO_functions.read_LaMEM_PVTR_fileMethod
data_output = read_LaMEM_PVTR_file(DirName, FileName; fields=nothing)

Reads a 3D LaMEM timestep from VTR file FileName, located in directory DirName. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.

It will return data_output which is a CartData output structure.

source
LaMEM.IO_functions.read_LaMEM_PVTS_fileMethod
data_output = read_LaMEM_PVTS_file(DirName, FileName; field=nothing)

Reads a 3D LaMEM timestep from VTS file FileName, located in directory DirName. Typically this is done to read passive tracers back into julia. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.

It will return data_output which is a CartData output structure.

source
LaMEM.IO_functions.read_LaMEM_PVTU_fileMethod
data_output = read_LaMEM_PVTU_file(DirName, FileName; fields=nothing)

Reads a 3D LaMEM timestep from VTU file FileName, located in directory DirName. Typically this is done to read passive tracers back into julia. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.

It will return data_output which is a CartData output structure.

source
LaMEM.IO_functions.read_LaMEM_simulationFunction
Timestep, FileNames, Time = read_LaMEM_simulation(FileName::String, DirName::String=""; phase=false, surf=false, passive_tracers=false)

Reads a LaMEM simulation FileName in directory DirName and returns the timesteps, times and filenames of that simulation.

source
LaMEM.IO_functions.read_LaMEM_timestepFunction
data, time = read_LaMEM_timestep(FileName::String, TimeStep::Int64=0, DirName::String=""; fields=nothing, phase=false, surf=false, last=false)

This reads a LaMEM timestep.

Input Arguments:

  • FileName: name of the simulation, w/out extension
  • Timestep: timestep to be read, unless last=true in which case we read the last one
  • DirName: name of the main directory (i.e. where the *.pvd files are located)
  • fields: Tuple with optional fields; if not specified all will be loaded
  • phase: Loads the phase information of LaMEM if true
  • surf: Loads the free surface of LaMEM if true
  • passive_tracers: Loads passive tracers if true
  • last: Loads the last timestep

Output:

  • data: Cartesian data struct with LaMEM output
  • time: The time of the timestep
source
LaMEM.IO_functions.read_phase_diagramMethod
out = read_phase_diagram(name::String)

Reads a phase diagram from a file name and returns a NamedTuple with temperature T, pressure P, melt density ρ_melt, solid density ρ_solid, density ρ and melt fraction ϕ

source
diff --git a/dev/readpassivetracers/index.html b/dev/readpassivetracers/index.html index e40c832..211064a 100644 --- a/dev/readpassivetracers/index.html +++ b/dev/readpassivetracers/index.html @@ -27,4 +27,4 @@ Key: Temperature, Size: (489, 4) Key: Pressure, Size: (489, 4) Key: Time_Myrs, Size: (4,)

The passive_tracers contains spatial coordinates and P, T, Phase properties and also the associated temporal information for all 4 time steps in matrixes. Now let's plot the position of selected tracer at t=0.

using Plots
-scatter(passive_tracers.x[:,1], passive_tracers.z[:,1], title="Scatter Plot of Selected Passive Tracers", legend=false, aspect_ratio=:equal)

InitialSetupSphere

We can plot a temporal evolution of P-T of a specific tracer. In the following line, we only select one tracer whose ID==1 among the 489 tracers we selected.

plot( passive_tracers.Temperature[1,:], passive_tracers.Pressure[1,:])

Since the example "falling sphere" code does not contain much dynamics and it only runs for a few timesteps, the resulted P-T path contain little information.

It is also doable to plot the the average P, T properties of a small group of tracers of our selection.

+scatter(passive_tracers.x[:,1], passive_tracers.z[:,1], title="Scatter Plot of Selected Passive Tracers", legend=false, aspect_ratio=:equal)

InitialSetupSphere

We can plot a temporal evolution of P-T of a specific tracer. In the following line, we only select one tracer whose ID==1 among the 489 tracers we selected.

plot( passive_tracers.Temperature[1,:], passive_tracers.Pressure[1,:])

Since the example "falling sphere" code does not contain much dynamics and it only runs for a few timesteps, the resulted P-T path contain little information.

It is also doable to plot the the average P, T properties of a small group of tracers of our selection.

diff --git a/dev/readtimesteps/index.html b/dev/readtimesteps/index.html index 084543d..f25cb8e 100644 --- a/dev/readtimesteps/index.html +++ b/dev/readtimesteps/index.html @@ -27,4 +27,4 @@ z ϵ [ 0.0 : 1.0] fields : (:phase, :visc_total, :velocity) attributes: ["note"] -, [6.729703]) +, [6.729703]) diff --git a/dev/runlamem/index.html b/dev/runlamem/index.html index e2db57c..1cf0beb 100644 --- a/dev/runlamem/index.html +++ b/dev/runlamem/index.html @@ -27,4 +27,4 @@ Output every [n] steps : 1 Output [n] initial steps : 1 --------------------------------------------------------------------------

The last parameter are optional PETSc command-line options. By default it runs on one processor.

Please note that you will have to be in the correct directory or indicate where that directory is. If you are in a different directory, the easiest way to change to the correct one is by using the changefolder function (on Windows and Mac):

julia> changefolder()

Alternatively, you can use the build-in terminal/shell in julia, which you can access with:

julia>;
-shell>cd ~/LaMEM/input_models/BuildInSetups/

use the Backspace key to return to the julia REPL.

Once you have performed a simulation, you can look at the results by opening the *.pvd files with Paraview. In this example, that would be FB_multigrid.pvd and FB_multigrid_phase.pvd.

+shell>cd ~/LaMEM/input_models/BuildInSetups/

use the Backspace key to return to the julia REPL.

Once you have performed a simulation, you can look at the results by opening the *.pvd files with Paraview. In this example, that would be FB_multigrid.pvd and FB_multigrid_phase.pvd.

diff --git a/dev/search_index.js b/dev/search_index.js index 50b3d30..c6fe171 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"runlamem/#Run-LaMEM","page":"Run LaMEM","title":"Run LaMEM","text":"","category":"section"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"Go to the package manager & install it with:","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"julia>]\npkg>add LaMEM","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"It will automatically download a binary version of LaMEM which runs in parallel (along with the correct PETSc version). This will work on linux, mac and windows.","category":"page"},{"location":"runlamem/#Starting-a-simulation","page":"Run LaMEM","title":"Starting a simulation","text":"","category":"section"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"If you have a LaMEM (*.dat) input file, you can run in parallel (here on 4 cores) with:","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"julia> ParamFile=\"input_files/FallingBlock_Multigrid.dat\";\njulia> run_lamem(ParamFile, 4,\"-time_end 1\")\n-------------------------------------------------------------------------- \n Lithosphere and Mantle Evolution Model \n Compiled: Date: Sep 10 2022 - Time: 06:21:30 \n-------------------------------------------------------------------------- \n STAGGERED-GRID FINITE DIFFERENCE CANONICAL IMPLEMENTATION \n-------------------------------------------------------------------------- \nParsing input file : input_files/FallingBlock_Multigrid.dat \n Adding PETSc option: -snes_type ksponly\n Adding PETSc option: -js_ksp_monitor\n Adding PETSc option: -crs_pc_type bjacobi\nFinished parsing input file : input_files/FallingBlock_Multigrid.dat \n--------------------------------------------------------------------------\nTime stepping parameters:\n Simulation end time : 1. [ ] \n Maximum number of steps : 10 \n Time step : 10. [ ] \n Minimum time step : 1e-05 [ ] \n Maximum time step : 100. [ ] \n Time step increase factor : 0.1 \n CFL criterion : 0.5 \n CFLMAX (fixed time steps) : 0.5 \n Output time step : 0.2 [ ] \n Output every [n] steps : 1 \n Output [n] initial steps : 1 \n--------------------------------------------------------------------------","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"The last parameter are optional PETSc command-line options. By default it runs on one processor.","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"Please note that you will have to be in the correct directory or indicate where that directory is. If you are in a different directory, the easiest way to change to the correct one is by using the changefolder function (on Windows and Mac):","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"julia> changefolder()","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"Alternatively, you can use the build-in terminal/shell in julia, which you can access with:","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"julia>;\nshell>cd ~/LaMEM/input_models/BuildInSetups/","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"use the Backspace key to return to the julia REPL.","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"Once you have performed a simulation, you can look at the results by opening the *.pvd files with Paraview. In this example, that would be FB_multigrid.pvd and FB_multigrid_phase.pvd.","category":"page"},{"location":"readpassivetracers/#Initiate-passive-tracers-and-read-their-information","page":"Passive tracers","title":"Initiate passive tracers and read their information","text":"","category":"section"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Passive tracers are useful to track the evolutions of the temperature, pressure and their spatial positions of moving materials during the simulation. Passive tracers can be initiated when you start a new model, and they are the Lagrangian points that move with the materials. The initiation and extraction of information from passive tracers can be easily done using the following methods.","category":"page"},{"location":"readpassivetracers/#Initiate-passive-tracers-in-the-model","page":"Passive tracers","title":"Initiate passive tracers in the model","text":"","category":"section"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Let's use a simple model of a \"falling sphere\" as the example. We initiate the passive tracers by turning on the flag: Passive_Tracer=1 and assign a spatial range to populate tracers in the entire simulation box PassiveTracer_Box=[-1,1,-1,1,-1,1]). The default tracer density is 100 x 1 x 100 along x, y, z axes. ","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"using LaMEM, GeophysicalModelGenerator, Plots\n\nmodel = Model(Grid(nel=(16,16,16), x=[-1,1], y=[-1,1], z=[-1,1]), PassiveTracers(Passive_Tracer=1, PassiveTracer_Box=[-1,1,-1,1,-1,1]))\nmatrix = Phase(ID=0,Name=\"matrix\",eta=1e20,rho=3000)\nsphere = Phase(ID=1,Name=\"sphere\",eta=1e23,rho=3200)\nadd_phase!(model, sphere, matrix)\nadd_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5,))\n\nrun_lamem(model,1)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"The model output files should include a file called output_passive_tracers.pvd which you can visualize using ParaView. The image below shows the initial state (t=0) of all tracers. Different colors represent different phases of the tracers: Phase 0 is blue, Phase 1 is red.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"(Image: InitialSetupSphere)","category":"page"},{"location":"readpassivetracers/#Read-passive-tracers-information-back-to-Julia","page":"Passive tracers","title":"Read passive tracers information back to Julia","text":"","category":"section"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"We can check the overall passive tracers information at timestep = 0 using:","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"data,time = read_LaMEM_timestep(model, 0, passive_tracers=true)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"It returns:","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"(CartData \n size : (10000,)\n x ϵ [ -0.99 : 0.99]\n y ϵ [ 0.0 : 0.0]\n z ϵ [ -0.99 : 0.99]\n fields : (:Phase, :Temperature, :Pressure, :ID)\n, [0.0])","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"The data.x, data.y, and data.z are structures that contain spatial information of tracers while parameters such like data.fields.Phase contain the phase, temperature, pressure and index (ID) of tracers.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Sometimes we want to select tracers in a smaller region for further investigation. For example, to track the P-T-t evolution of a subducting slab, we can specify a region of interest (e.g., the upper crust portion of the slab) therefore select tracers within that region only.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"In the \"falling sphere\" example, let's find all the \"sphere phase\" tracers in the 1st quadrant (x>0, and z>0) of the sphere.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"ID = findall(data.x.val .> 0 .&& data.z.val .> 0 .&& data.fields.Phase .== 1)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"The ID parameter records the indices of these tracers. Note we need to do data.x.val to get the numerical value of the x-coordinate because data.x is a GeoUnit structure also containing unit, and isdimensional information. The dot in front of > and && implies that it is applied to every point the array data.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Once we select the tracers of interest (we now know the ID of these tracers), we can read their information.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"passive_tracers = passivetracer_time(ID,model)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Let's take a look at the passive_tracers, and see what information it contains:","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"# Retrieve the keys from the passive_tracers\nkeys_list = keys(passive_tracers)\n\n# Iterate over each key and print the size of the associated data\nfor key in keys_list\n data_size = size(passive_tracers[key])\n println(\"Key: $key, Size: $data_size\")\nend","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"It returns:","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Key: x, Size: (489, 4)\nKey: y, Size: (489, 4)\nKey: z, Size: (489, 4)\nKey: Phase, Size: (489, 4)\nKey: Temperature, Size: (489, 4)\nKey: Pressure, Size: (489, 4)\nKey: Time_Myrs, Size: (4,)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"The passive_tracers contains spatial coordinates and P, T, Phase properties and also the associated temporal information for all 4 time steps in matrixes. Now let's plot the position of selected tracer at t=0.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"using Plots\nscatter(passive_tracers.x[:,1], passive_tracers.z[:,1], title=\"Scatter Plot of Selected Passive Tracers\", legend=false, aspect_ratio=:equal)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"(Image: InitialSetupSphere)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"We can plot a temporal evolution of P-T of a specific tracer. In the following line, we only select one tracer whose ID==1 among the 489 tracers we selected.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"plot( passive_tracers.Temperature[1,:], passive_tracers.Pressure[1,:])","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Since the example \"falling sphere\" code does not contain much dynamics and it only runs for a few timesteps, the resulted P-T path contain little information. ","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"It is also doable to plot the the average P, T properties of a small group of tracers of our selection.","category":"page"},{"location":"installation/#Installation","page":"General instructions","title":"Installation","text":"","category":"section"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"Installing LaMEM can simply be done through the package manager:","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"julia>]\npkg>add LaMEM","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"which will download the binaries along with PETSc and mpiexec for your system.","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"You can test if it works on your machine with","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"pkg> test LaMEM","category":"page"},{"location":"installation/#Running-LaMEM-from-the-julia-REPL","page":"General instructions","title":"Running LaMEM from the julia REPL","text":"","category":"section"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"Running LaMEM from within julia can be done with the run_lamem function:","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"run_lamem","category":"page"},{"location":"installation/#LaMEM.Run.run_lamem","page":"General instructions","title":"LaMEM.Run.run_lamem","text":"run_lamem(ParamFile::String, cores::Int64=1, args:String=\"\"; wait=true, deactivate_multithreads=true)\n\nThis starts a LaMEM simulation, for using the parameter file ParamFile on cores number of cores. Optional additional command-line parameters can be specified with args.\n\nExample:\n\nYou can call LaMEM with:\n\njulia> using LaMEM\njulia> ParamFile=\"../../input_models/BuildInSetups/FallingBlock_Multigrid.dat\";\njulia> run_lamem(ParamFile)\n\nDo the same on 2 cores with a command-line argument as:\n\njulia> ParamFile=\"../../input_models/BuildInSetups/FallingBlock_Multigrid.dat\";\njulia> run_lamem(ParamFile, 2, \"-nstep_max = 1\")\n\n\n\n\n\nrun_lamem(model::Model, cores::Int64=1, args:String=\"\"; wait=true)\n\nPerforms a LaMEM run for the parameters that are specified in model\n\n\n\n\n\n","category":"function"},{"location":"installation/#Running-LaMEM-from-outside-julia","page":"General instructions","title":"Running LaMEM from outside julia","text":"","category":"section"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"If you, for some reason, do not want to run LaMEM through julia but instead directly from the terminal or powershell, you will have to add the required dynamic libraries and executables. Do this with:","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"show_paths_LaMEM","category":"page"},{"location":"installation/#LaMEM.Run.show_paths_LaMEM","page":"General instructions","title":"LaMEM.Run.show_paths_LaMEM","text":"show_paths_LaMEM()\n\nThe downloaded LaMEM binaries can also be called from outside julia (directly from the terminal). In that case, you will need to set load correct dynamic libraries (such as PETSc) and call the correct binaries.\n\nThis function shows this for your system. \n\n\n\n\n\n","category":"function"},{"location":"juliasetups/#Create-and-run-setups-from-julia","page":"Overview","title":"Create & run setups from julia","text":"","category":"section"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"It is also possible to construct a LaMEM setup directly in julia & run that. You can do the same from within a Pluto notebook. The advantage is that it is easier to use, has build-in plotting functions and extensive documentation. ","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"The main routine to do this is: ","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> using LaMEM\njulia> model = Model()\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(16, 16, 16); xϵ(-10.0, 10.0), yϵ(-10.0, 0.0), zϵ(-10.0, 0.0) \n|-- Time : nstep_max=50; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 0 phases;","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"Model is a structure that contains all the information about the LaMEM simulation and consists of the following sub-structures that can all be adjusted.","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"BoundaryConditions FreeSurface Grid \nMaterials ModelSetup Output \nScaling SolutionParams Solver \nTime","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"You can, for example, look at the current Grid:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> model.Grid\nLaMEM grid with constant Δ: \n nel : ([16], [16], [16])\n marker/cell : (3, 3, 3)\n x ϵ [-10.0 : 10.0]\n y ϵ [-10.0 : 0.0]\n z ϵ [-10.0 : 0.0]\n Phases : range ϵ [0 - 0]\n Temp : range ϵ [0.0 - 0.0]","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"and change the dimensions and number of grid-cells with:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> model.Grid = Grid(nel=[32,32,32], x=[-20,20])\nLaMEM grid with constant Δ: \n nel : ([32], [32], [32])\n marker/cell : (3, 3, 3)\n x ϵ [-20.0 : 20.0]\n y ϵ [-10.0 : 0.0]\n z ϵ [-10.0 : 0.0]\n Phases : range ϵ [0 - 0]\n Temp : range ϵ [0.0 - 0.0]","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"or do it by directly accessing the respectyive data field:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> model.Grid.nel_x = [32]\n1-element Vector{Int64}:\n 32","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"Every LaMEM model setup needs to specify material properties for the different materials. By default it has nothing:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> model.Materials\nLaMEM Material Properties: \n Softening = \n PhaseTransition =","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"yet, we can specify different materials using the Phase structure:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> sphere = Phase(Name=\"Sphere\", ID=1, eta=1e20, rho=2800)\nPhase 1 (Sphere): \n rho = 2800.0 \n eta = 1.0e20 ","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"and add that to the model with:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> add_phase!(model, sphere)\njulia> model\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(32, 32, 32); xϵ(-20.0, 20.0), yϵ(-10.0, 0.0), zϵ(-10.0, 0.0) \n|-- Time : nstep_max=50; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 1 phases; ","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"Note that the model now has 1 phase.","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"In order to run a simulation, we need to define at least 1 phase and heterogeneities in either the initial temperature field (model.Grid.Temp) or the Phases field (model.Grid.Phases). The easiest way to do that is to use routines from the GeophyicalModelGenerator package, for which we created simple interfaces to many of the relevant routines:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> using GeophysicalModelGenerator\njulia> add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, ))","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"For the sake of this example, lets add another phase:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> matrix = Phase(ID=0,Name=\"matrix\",eta=1e20,rho=3000)\nPhase 0 (matrix): \n rho = 3000.0 \n eta = 1.0e20 \njulia> add_phase!(model, matrix)","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"At this stage you have a model setup with 2 phases and heterogeneities in the Phases field, which you can check with:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> model\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(32, 32, 32); xϵ(-20.0, 20.0), yϵ(-10.0, 0.0), zϵ(-10.0, 0.0) \n|-- Time : nstep_max=50; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 2 phases; \n\n\njulia> model.Grid\nLaMEM grid with constant Δ: \n nel : ([32], [32], [32])\n marker/cell : (3, 3, 3)\n x ϵ [-20.0 : 20.0]\n y ϵ [-10.0 : 0.0]\n z ϵ [-10.0 : 0.0]\n Phases : range ϵ [0 - 1]\n Temp : range ϵ [0.0 - 0.0]","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"Running a model is very simple:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> run_lamem(model,1)","category":"page"},{"location":"juliasetups/#More-examples","page":"Overview","title":"More examples","text":"","category":"section"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"More examples can be found on the left hand side menu.","category":"page"},{"location":"LaMEM_ModelFunctions/#List-functions","page":"Available functions","title":"List functions","text":"","category":"section"},{"location":"LaMEM_ModelFunctions/","page":"Available functions","title":"Available functions","text":"These are all the functions that are provided for the LaMEM Julia Setup interface ","category":"page"},{"location":"LaMEM_ModelFunctions/","page":"Available functions","title":"Available functions","text":"Modules = [LaMEM.LaMEM_Model]","category":"page"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.BCBlock","page":"Available functions","title":"LaMEM.LaMEM_Model.BCBlock","text":"LaMEM boundary condition `BCBlock` object\n\nnpath::Int64: Number of path points of Bezier curve (path-points only!)\ntheta::Vector{Float64}: # Orientation angles at path points (counter-clockwise positive)\ntime::Vector{Float64}: Times at path points\npath::Vector{Float64}: Path points x-y coordinates\nnpoly::Int64: Number of polygon vertices\npoly::Vector{Float64}: Polygon x-y coordinates at initial time\nbot::Float64: Polygon bottom coordinate\ntop::Float64: Polygon top coordinate\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.BoundaryConditions","page":"Available functions","title":"LaMEM.LaMEM_Model.BoundaryConditions","text":"Structure that contains the LaMEM boundary conditions information.\n\nnoslip::Vector{Int64}: No-slip boundary flag mask (left right front back bottom top)\nopen_top_bound::Int64: Stress-free (free surface/infinitely fast erosion) top boundary flag\ntemp_top::Float64: Constant temperature on the top boundary\ntemp_bot::Float64: Constant temperature on the bottom boundary\nexx_num_periods::Int64: number intervals of constant background strain rate (x-axis)\nexx_time_delims::Vector{Float64}: time delimiters (one less than number of intervals, not required for one interval)\nexx_strain_rates::Vector{Float64}: strain rates for each interval\neyy_num_periods::Int64: eyynumperiods\neyy_time_delims::Vector{Float64}: eyytimedelims\neyy_strain_rates::Vector{Float64}: eyystrainrates\nexy_num_periods::Int64: exynumperiods\nexy_time_delims::Vector{Float64}: exytimedelims\nexy_strain_rates::Vector{Float64}: exystrainrates\nexz_num_periods::Int64: exznumperiods\nexz_time_delims::Vector{Float64}: exztimedelims\nexz_strain_rates::Vector{Float64}: exzstrainrates\neyz_num_periods::Int64: eyznumperiods\neyz_time_delims::Vector{Float64}: eyztimedelims\neyz_strain_rates::Vector{Float64}: eyzstrainrates\nbg_ref_point::Vector{Float64}: background strain rate reference point (fixed)\nVelocityBoxes::Vector{VelocityBox}: List of added velocity boxes\nBCBlocks::Vector{BCBlock}: List of added Bezier blocks\nVelCylinders::Vector{VelCylinder}: List of added velocity cylinders\nbvel_face::Union{Nothing, String}: Face identifier (Left; Right; Front; Back; CompensatingInflow)\nbvel_face_out::Union{Nothing, Int64}: Velocity on opposite side: -1 for inverted velocity; 0 for no velocity; 1 for the same direction of velocity\nbvel_bot::Union{Nothing, Float64}: Bottom coordinate of inflow window\nbvel_top::Union{Nothing, Float64}: Top coordinate of inflow window\nvelin_num_periods::Union{Nothing, Int64}: Number of periods when velocity changes (Optional)\nvelin_time_delims::Union{Nothing, Vector}: Change velocity at 2 and 5 Myrs (one less than number of intervals, not required for one interval) (Optional)\nbvel_velin::Union{Nothing, Vector}: inflow velocity for each time interval(Multiple values required if velinnumperiods>1)\nbvel_velout::Union{Nothing, Float64}: outflow velocity (if not specified, computed from mass balance)\nbvel_relax_d::Union{Nothing, Float64}: vert.distance from bvelbot and bveltop over which velocity is reduced linearly\nbvel_velbot::Union{Nothing, Int64}: bottom inflow velocity for use with bvel_face=CompensatingInflow\nbvel_veltop::Union{Nothing, Int64}: top inflow velocity for use with bvel_face=CompensatingInflow\nbvel_temperature_inflow::Union{Nothing, String}: bveltemperatureinflow: Thermal age of the plate, which can be constant if set to Fixedthermalage or ConstantTinflow (Temperature of the inflow material is constant everywhere)\nbvel_thermal_age::Union{Nothing, Float64}: In dimensional unit. If the user specify this value, he needs to specify the temperature of the mantle and top as well\nbvel_temperature_mantle::Union{Nothing, Float64}: In dimensional unit. Temperature of the mantle\nbvel_temperature_top::Union{Nothing, Float64}: In dimensional unit. temperature of the top\nbvel_temperature_constant::Union{Nothing, Float64}: Constant temperature inflow.\nbvel_num_phase::Union{Nothing, Int64}: Imposes a stratigraphy of phase injected in the inflow boundary [if undefined, it uses the phase close to the boundary]\nbvel_phase::Union{Nothing, Vector{Int64}}: phase number of inflow material [if undefined, it uses the phase close to the boundary] from bottom to top\nbvel_phase_interval::Union{Nothing, Vector{Float64}}: Depth interval of injection of the phase (the interval is defined by num_phase+1 coordinates). e.g. [-120 -100 -10 0 ]\nopen_bot_bound::Union{Nothing, Int64}: # Permeable lower boundary flag\npermeable_phase_inflow::Union{Nothing, Int64}: Phase of the inflow material from the bottom (The temperature of the inflow phase it is the same of the bottom boundary) in case of openbotbound=1\nfix_phase::Union{Nothing, Int64}: fixed phase (no-flow condition)\nfix_cell::Union{Nothing, Int64}: fixed cells (no-flow condition)\nfix_cell_file::Union{Nothing, String}: fixed cells input file (extension is .xxxxxxxx.dat)\ntemp_bot_num_periods::Union{Nothing, Int64}: How many periods with different temp_bot do we have?\ntemp_bot_time_delim::Union{Nothing, Vector{Float64}}: At which time do we switch from one to the next period?\nPlume_InflowBoundary::Union{Nothing, Int64}: # have a plume-like inflow boundary @ bottom\nPlume_Type::Union{Nothing, String}: Type of plume inflow boundary.\n\"Inflow_type\" or\n\"Pressure_type\" (circular)\tor\n\"Permeable_Type\" which combines the open bot boundary with the plume boundary condition (the option herein listed overwrites open_bot, so do not activate that)\n\nPlume_Dimension::Union{Nothing, String}: 2D or 3D (circular)\nPlume_areaFrac::Union{Nothing, Float64}: how much of the plume is actually in the model. This usually 1 (default) but lower if the plume is in a corner of a symmetric setup and matters for the outflow\nPlume_Phase::Union{Nothing, Int64}: phase of plume material\nPlume_Depth::Union{Nothing, Float64}: # depth of provenience of the plume (i.e. how far from the bottom of the model the plume source is)\nPlume_Mantle_Phase::Union{Nothing, Int64}: # Astenosphere phase (if the inflow occurs outside the plume radius)\nPlume_Temperature::Union{Nothing, Float64}: # temperature of inflow plume\nPlume_Inflow_Velocity::Union{Nothing, Float64}: # Inflow velocity\t(not required if Pressure_Type) in cm/year if using GEOunits\nPlume_VelocityType::Union{Nothing, String}: \"Gaussian\" or \"Poiseuille\"\nPlume_Center::Union{Nothing, Vector{Float64}}: # [X,Y] of center (2nd only in case of 3D plume)\nPlume_Radius::Union{Nothing, Float64}: # Width/Radius of plume\nPlume_Phase_Mantle::Union{Nothing, Int64}: # Inflow phase. If the velocity happens to be positive in the domain, the inflow material has a constant phase and the temperature of the bottom\npres_top::Union{Nothing, Float64}: Pressure on the top boundary\npres_bot::Union{Nothing, Float64}: Pressure on the bottom boundary\ninit_pres::Union{Nothing, Int64}: pressure initial guess flag; linear profile between prestop and presbot in the unconstrained cells\ninit_temp::Union{Nothing, Int64}: temperature initial guess flag; linear profile between temptop and tempbot\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Dike","page":"Available functions","title":"LaMEM.LaMEM_Model.Dike","text":"Defines the properties related to inserting dikes\n\nID::Int64: Material phase ID\nMf::Float64: value for dike/magma- accommodated extension, between 0 and 1, in the front of the box, for phase dike\nMc::Float64: [optional] value for dike/magma- accommodate extension, between 0 and 1, for dike phase; M is linearly interpolated between Mf & Mc and Mc & Mb, if not set, Mc default is set to -1 so it is not used\ny_Mc::Union{Nothing, Float64}: [optional], location for Mc, must be between front and back boundaries of dike box, if not set, default value to 0.0, but not used\nMb::Union{Nothing, Float64}: value for dike/magma-accommodated extension, between 0 and 1, in the back of the box, for phase dike\nPhaseID::Union{Nothing, Int64}: Phase ID\nPhaseTransID::Union{Nothing, Int64}: Phase transition ID\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.FreeSurface","page":"Available functions","title":"LaMEM.LaMEM_Model.FreeSurface","text":"Structure that contains the LaMEM free surface information.\n\nsurf_use::Int64: Free surface activation flag\nsurf_corr_phase::Int64: air phase ratio correction flag (phases in an element that contains are modified based on the surface position)\nsurf_level::Union{Nothing, Float64}: initial level of the free surface\nsurf_air_phase::Union{Nothing, Int64}: phase ID of sticky air layer\nsurf_max_angle::Float64: maximum angle with horizon (smoothed if larger)\nsurf_topo_file::String: initial topography file (redundant)\nerosion_model::Int64: erosion model [0-none (default), 1-infinitely fast, 2-prescribed rate with given level]\ner_num_phases::Int64: number of erosion phases\ner_time_delims::Vector{Float64}: erosion time delimiters (one less than number)\ner_rates::Vector{Float64}: constant erosion rates in different time periods\ner_levels::Vector{Int64}: levels above which we apply constant erosion rates in different time periods\nsediment_model::Int64: sedimentation model [0-none (dafault), 1-prescribed rate with given level, 2-cont. margin]\nsed_num_layers::Int64: number of sediment layers\nsed_time_delims::Vector{Float64}: sediment layers time delimiters (one less than number)\nsed_rates::Vector{Float64}: sediment rates in different time periods\nsed_levels::Vector{Float64}: levels below which we apply constant sediment rates in different time periods\nsed_phases::Vector{Int64}: sediment layers phase numbers in different time periods\nmarginO::Vector{Float64}: lateral coordinates of continental margin - origin\nmarginE::Vector{Float64}: lateral coordinates of continental margin - 2nd point\nhUp::Float64: up dip thickness of sediment cover (onshore)\nhDown::Float64: down dip thickness of sediment cover (off shore)\ndTrans::Float64: half of transition zone\nTopography::Union{Nothing, GeophysicalModelGenerator.CartData}: Topography grid\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomBox","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomBox","text":"LaMEM geometric primitive `Box` object\n\nphase::Int64: phase\nbounds::Vector{Float64}: box bound coordinates: left, right, front, back, bottom, top\nTemperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant, linear, halfspace]\ncstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]\ntopTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nbotTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nthermalAge::Union{Nothing, Float64}: required in case of [halfspace]: thermal age of lithosphere [in Myrs if GEO units are used]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomCylinder","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomCylinder","text":"LaMEM geometric primitive `Cylinder` object\n\nphase::Int64: phase\nradius::Float64: radius of cylinder\nbase::Vector{Float64}: center of base of cylinder\ncap::Vector{Float64}: center of cap of cylinder\nTemperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant]\ncstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomEllipsoid","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomEllipsoid","text":"LaMEM geometric primitive `Ellipsoid` object\n\nphase::Int64: phase\naxes::Vector{Float64}: semi-axes of ellipsoid in x, y and z\ncenter::Vector{Float64}: center of sphere\nTemperature::Union{Nothing, String}: optional: Temperature of the sphere. possibilities: [constant, or nothing]\ncstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomHex","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomHex","text":"LaMEM geometric primitive `Hex` object to define hexahedral elements\n\nphase::Int64: phase\ncoord::Vector{Float64}: x-y-z coordinates for each of 8 nodes (24 parameters) (counter)-clockwise for an arbitrary face, followed by the opposite face\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomLayer","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomLayer","text":"LaMEM geometric primitive `Layer` object\n\nphase::Int64: phase\ntop::Float64: top of layer\nbottom::Float64: bottom of layer\ncosine::Union{Nothing, Int64}: optional: add a cosine perturbation on top of the interface (if 1)\nwavelength::Union{Nothing, Float64}: required if cosine: wavelength in x-direction\namplitude::Union{Nothing, Float64}: required if cosine: amplitude of perturbation\nTemperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant, linear, halfspace]\ncstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]\ntopTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nbotTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nthermalAge::Union{Nothing, Float64}: required in case of [halfspace]: thermal age of lithosphere [in Myrs if GEO units are used]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomRidgeSeg","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomRidgeSeg","text":"LaMEM geometric primitive `RidgeSeg` object\n\nphase::Int64: phase\nbounds::Vector{Float64}: box bound coordinates: left, right, front, back, bottom, top\nridgeseg_x::Vector{Float64}: coordinate order: left, right [can be different for oblique ridge]\nridgeseg_y::Vector{Float64}: coordinate order: front, back [can be different for oblique ridge]\nTemperature::String: initial temperature structure [ridge must be set to halfspace_age –> setTemp=4]\ntopTemp::Float64: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nbotTemp::Float64: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nage0::Float64: minimum age of seafloor at ridge [in Myr in case of GEO units]\nmaxAge::Union{Nothing, Float64}: [optional] parameter that indicates the maximum thermal age of a plate\nv_spread::Union{Nothing, Float64}: [optional] parameter that indicates the spreading velocity of the plate; if not defined it uses bvel_velin specified elsewhere\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomSphere","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomSphere","text":"LaMEM geometric primitive `sphere` object\n\nphase::Int64: phase\nradius::Float64: radius of sphere\ncenter::Vector{Float64}: center of sphere\nTemperature::Union{Nothing, String}: optional: Temperature of the sphere. possibilities: [constant, or nothing]\ncstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Grid","page":"Available functions","title":"LaMEM.LaMEM_Model.Grid","text":"Structure that contains the LaMEM grid information\n\nnmark_x::Int64: number of markers/element in x-direction\nnmark_y::Int64: number of markers/element in y-direction\nnmark_z::Int64: number of markers/element in x-direction\nnel_x::Vector{Int64}: number of elements in x-direction\nnel_y::Vector{Int64}: number of elements in y-direction\nnel_z::Vector{Int64}: number of elements in z-direction\ncoord_x::Vector{Float64}: coordinates in x-direction\ncoord_y::Vector{Float64}: coordinates in y-direction\ncoord_z::Vector{Float64}: coordinates in z-direction\nnseg_x::Int64: number of segments in x-direction (if we employ variable grid spacing in x-direction)\nnseg_y::Int64: number of segments in y-direction (if we employ variable grid spacing in y-direction)\nnseg_z::Int64: number of segments in z-direction (if we employ variable grid spacing in z-direction)\nbias_x::Vector{Float64}: bias in x-direction (if we employ variable grid spacing in x-direction)\nbias_y::Vector{Float64}: bias in y-direction (if we employ variable grid spacing in y-direction)\nbias_z::Vector{Float64}: bias in z-direction (if we employ variable grid spacing in z-direction)\nGrid::GeophysicalModelGenerator.LaMEM_grid: Contains the LaMEM Grid object\nPhases::Array{Int32}: Phases; 3D phase information\nTemp::Array{Float64}: Temp; 3D phase information\n\nExample 1\n\njulia> d=LaMEM.Grid(coord_x=[0.0, 0.7, 0.8, 1.0], bias_x=[0.3,1.0,3.0], nel_x=[10,4,2])\nLaMEM grid with 1D refinement: \n nel : ([10, 4, 2], [16], [16])\n marker/cell : (3, 3, 3)\n x ϵ [0.0, 0.7, 0.8, 1.0], bias=[0.3, 1.0, 3.0], nseg=3, Δmin=0.025000000000000022, Δmax=0.1499999999999999\n y ϵ [-10.0 : 0.0]\n z ϵ [-10.0 : 0.0]\n\nExample 2\n\njulia> d=LaMEM.Grid(nel=(10,20))\nLaMEM grid with constant Δ: \n nel : ([10], [1], [20])\n marker/cell : (3, 3, 3)\n x ϵ [-10.0 : 10.0]\n y ϵ [-10.0 : 0.0]\n z ϵ [-10.0 : 0.0]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Materials","page":"Available functions","title":"LaMEM.LaMEM_Model.Materials","text":"Structure that contains the material properties in the current simulation\n\nPhases::Vector{Phase}: Different Materials implemented\nSofteningLaws::Vector{Softening}: Softening laws implemented\nPhaseTransitions::Vector{PhaseTransition}: Internal Phase Transitions (that change the ID of markers) implemented\nDikes::Vector{Dike}: Dikes implemented (mostly for MOR simulations)\nPhaseAggregates::Vector{PhaseAggregate}: Phase aggregates (combines different phases such as upper_lower crust into one for visualization purposes)\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Model","page":"Available functions","title":"LaMEM.LaMEM_Model.Model","text":"Model\n\nStructure that holds all the information to create a LaMEM input file\n\nScaling::Scaling: Scaling parameters\nGrid::Grid: LaMEM Grid\nTime::Any: Time options\nFreeSurface::Any: Free surface options\nBoundaryConditions::Any: Boundary conditions\nSolutionParams::Any: Global solution parameters\nSolver::Any: Solver options and optional PETSc options\nModelSetup::Any: Model setup\nOutput::Any: Output options\nPassiveTracers::Any: Passive tracers\nMaterials::Any: Material parameters for each of the phases\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Model-Tuple","page":"Available functions","title":"LaMEM.LaMEM_Model.Model","text":"Model(args...)\n\nAllow to define a model setup by specifying some of the basic objects\n\nExample\n\njulia> d = Model(Grid(nel=(10,1,20)), Scaling(NO_units()))\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GeoParams.Units.NONE}\n|-- Grid : nel=(10, 1, 20); xϵ(-10.0, 10.0), yϵ(-10.0, 0.0), zϵ(-10.0, 0.0) \n|-- Time : nstep_max=50; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : \n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=geom; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 1 phases; \n\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Model-Tuple{}","page":"Available functions","title":"LaMEM.LaMEM_Model.Model","text":"Model(;\n Scaling=Scaling(GEO_units()),\n Grid=Grid(), \n Time=Time(),\n FreeSurface=FreeSurface(),\n BoundaryConditions=BoundaryConditions(),\n SolutionParams=SolutionParams(),\n Solver=Solver(),\n ModelSetup=ModelSetup(),\n Output=Output(),\n PassiveTracers=PassiveTracers(),\n Materials=Materials()\n )\n\nCreates a LaMEM Model setup.\n\nScaling::Scaling\nGrid::Grid\nTime::Any\nFreeSurface::Any\nBoundaryConditions::Any\nSolutionParams::Any\nSolver::Any\nModelSetup::Any\nOutput::Any\nPassiveTracers::Any\nMaterials::Any\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.ModelSetup","page":"Available functions","title":"LaMEM.LaMEM_Model.ModelSetup","text":"Structure that contains the LaMEM Model Setup and Advection options\n\nmsetup::String: Setup type - can be geom (phases are assigned from geometric primitives, using add_geom!(model, ...)), files (from julia input), polygons (from geomIO input, which requires poly_file to be specified)\nrand_noise::Int64: add random noise to the particle location\nrand_noiseGP::Int64: random noise flag, subsequently applied to geometric primitives\nbg_phase::Int64: background phase ID\nsave_mark::Int64: save marker to disk flag\nmark_load_file::String: marker input file (extension is .xxxxxxxx.dat), if using msetup=files\nmark_save_file::String: marker output file (extension is .xxxxxxxx.dat)\npoly_file::String: polygon geometry file (redundant), if using msetup=polygons\ntemp_file::String: initial temperature file (redundant), if not set on markers\nadvect::String: advection scheme; options=none (no advection); basic (Euler classical implementation [default]); Euler (Euler explicit in time); rk2 (Runge-Kutta 2nd order in space)\ninterp::String: velocity interpolation scheme; options = stag (trilinear interpolation from FDSTAG points), minmod ( MINMOD interpolation to nodes, trilinear interpolation to markers + correction), stagp ( STAG_P empirical approach by T. Gerya)\nstagp_a::Float64: STAG_P velocity interpolation parameter\nmark_ctrl::String: marker control type; options are subgrid (default; marker control enforced over fine scale grid), none (none), basic (AVD for cells + corner insertion), and avd (pure AVD for all control volumes)\nnmark_lim::Vector{Int64}: min/max number per cell (marker control)\nnmark_avd::Vector{Int64}: x-y-z AVD refinement factors (avd marker control)\nnmark_sub::Int64: max number of same phase markers per subcell (subgrid marker control)\ngeom_primitives::Vector: Different geometric primitives that can be selected if we msetup=geom; seeGeomSphere`\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Multigrid","page":"Available functions","title":"LaMEM.LaMEM_Model.Multigrid","text":"Structure that has info about setting up multigrid for LaMEM\n\nnel::Tuple{Int64, Int64, Int64}: Number of elements at the fine level\n\nlevels::Int64: Number of levels\n\nsmooth::Int64: number of smoothening steps per level\n\nsmooth_jacobi_factor::Float64: factor for jacbi smoothener oer level\n\nsmoother::String: smoother used at every level\n\ncoarse_ksp::String: coarse grid ksp type preonly or fgmres\n\ncoarse_pc::String: coarse grid pc type [\"superlu_dist\", \"mumps\", \"gamg\", \"telescope\",\"redundant\"]\n\ncoarse_coarse_pc::String: coarse coarse grid solver in case we use redundant or telescope coarse grid solves\n\ncoarse_coarse_ksp::String: coarse coarse grid solver in case we use redundant or telescope coarse grid solves\n\ncores::Int64: number of cores used in the simulation\n\ncores_coarse::Int64: number of cores used for coarse grid solver (in case we use pctelescope)\n\ngamg_threshold::Float64: GAMG threshold\n\ngamg_coarse_eq_limit::Int64: GAMG coarse grid equation limit\n\ngamg_repartition::Bool: GAMG repartition coarse grids? (default=false)\n\ngamg_parallel_coarse::Bool: GAMG parallel coarse grid solver? (default=false)\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Output","page":"Available functions","title":"LaMEM.LaMEM_Model.Output","text":"Structure that contains the LaMEM output options\n\nout_file_name::Any: output file name\nout_dir::Any: output directory\nparam_file_name::Any: parameter filename\nwrite_VTK_setup::Any: write VTK initial model setup\nout_pvd::Any: activate writing .pvd file\nout_phase::Any: dominant phase\nout_density::Any: density\nout_visc_total::Any: total (viscoelastoplastic) viscosity\nout_visc_creep::Any: creep viscosity\nout_velocity::Any: velocity\nout_pressure::Any: (dynamic) pressure\nout_tot_press::Any: total pressure\nout_eff_press::Any: effective pressure\nout_over_press::Any: outoverpress\nout_litho_press::Any: lithospheric pressure\nout_pore_press::Any: pore pressure\nout_temperature::Any: temperature\nout_dev_stress::Any: deviatoric strain rate tensor\nout_j2_dev_stress::Any: second invariant of deviatoric stress tensor\nout_strain_rate::Any: deviatoric strain rate tensor\nout_j2_strain_rate::Any: second invariant of strain rate tensor\nout_shmax::Any: sh max\nout_ehmax::Any: eh max\nout_yield::Any: yield stress\nout_rel_dif_rate::Any: relative proportion of diffusion creep strainrate\nout_rel_dis_rate::Any: relative proportion of dislocation creep strainrate\nout_rel_prl_rate::Any: relative proportion of peierls creep strainrate\nout_rel_pl_rate::Any: relative proportion of plastic strainrate\nout_plast_strain::Any: accumulated plastic strain\nout_plast_dissip::Any: plastic dissipation\nout_tot_displ::Any: total displacement\nout_moment_res::Any: momentum residual\nout_cont_res::Any: continuity residual\nout_energ_res::Any: energy residual\nout_melt_fraction::Any: Melt fraction\nout_fluid_density::Any: fluid density\nout_conductivity::Any: conductivity\nout_vel_gr_tensor::Any: velocity gradient tensor\nout_surf::Any: activate surface output\nout_surf_pvd::Any: activate writing .pvd file\nout_surf_velocity::Any: surface velocity\nout_surf_topography::Any: surface topography\nout_surf_amplitude::Any: amplitude of topography (=topo-average(topo))\nout_mark::Any: activate marker output\nout_mark_pvd::Any: activate writing .pvd file\nout_avd::Any: activate AVD phase output\nout_avd_pvd::Any: activate writing .pvd file\nout_avd_ref::Any: AVD grid refinement factor\nout_ptr::Any: activate\nout_ptr_ID::Any: ID of the passive tracers\nout_ptr_phase::Any: phase of the passive tracers\nout_ptr_Pressure::Any: interpolated pressure\nout_ptr_Temperature::Any: temperature\nout_ptr_MeltFraction::Any: melt fraction computed using P-T of the marker\nout_ptr_Active::Any: option that highlight the marker that are currently active\nout_ptr_Grid_Mf::Any: option that allow to store the melt fraction seen within the cell\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.PassiveTracers","page":"Available functions","title":"LaMEM.LaMEM_Model.PassiveTracers","text":"Structure that contains the LaMEM passive tracers parameters.\n\nPassive_Tracer::Int64: activate passive tracers?\"\n\nPassiveTracer_Box::Union{Nothing, Vector{Float64}}: Dimensions of box in which we distribute passive tracers [Left, Right, Front, Back, Bottom, Top]\n\nPassiveTracer_Resolution::Vector{Int64}: The number of passive tracers in every direction\n\nPassiveTracer_ActiveType::Union{Nothing, String}: Under which condition are they activated? [\"Always\"], \"Melt_Fraction\", \"Temperature\", \"Pressure\", \"Time\"\n\nPassiveTracer_ActiveValue::Union{Nothing, Float64}: The value to activate them\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Phase","page":"Available functions","title":"LaMEM.LaMEM_Model.Phase","text":"Defines the material properties for each of the phases\n\nID::Union{Nothing, Int64}: Material phase ID\nName::Union{Nothing, String}: Description of the phase\nrho::Union{Nothing, Float64}: Density [kg/m^3]\neta::Union{Nothing, Float64}: Linear viscosity [Pas]\nvisID::Union{Nothing, Int64}: material ID for phase visualization (default is ID)\ndiff_prof::Union{Nothing, String}: Build-in DIFFUSION creep profiles:\nExample: \"Dry__Olivine_diff_creep-Hirth_Kohlstedt_2003\"\nAvailable build-in diffusion creep rheologies are:\nFrom [Hirth, G. and Kohlstedt D. (2003), Rheology of the upper mantle and the mantle wedge: A view from the experimentalists]:\n\"Dry_Olivine_diff_creep-Hirth_Kohlstedt_2003\"\n\"Wet_Olivine_diff_creep-Hirth_Kohlstedt_2003_constant_C_OH\"\n\"Wet_Olivine_diff_creep-Hirth_Kohlstedt_2003\"\nFrom [Rybacki and Dresen, 2000, JGR]:\n\"Dry_Plagioclase_RybackiDresen_2000\"\n\"Wet_Plagioclase_RybackiDresen_2000\"\nNote that you can always specify your own, by setting Bd, Ed, Vd accordingly.\n\ndisl_prof::Union{Nothing, String}: Build-in DISLOCATION creep profiles:\nExample: \"Granite-Tirel_et_al_2008\"\nAvailable build-in dislocation creep rheologies are:\nFrom [Ranalli 1995]:\n\"Dry_Olivine-Ranalli_1995\"\n\"Wet_Olivine-Ranalli_1995\"\n\"Wet_Quarzite-Ranalli_1995\"\n\"Quarzite-Ranalli_1995\"\n\"Mafic_Granulite-Ranalli_1995\"\n\"Plagioclase_An75-Ranalli_1995\"\nFrom [Carter and Tsenn (1986). Flow properties of continental lithosphere - page 18]:\n\"Quartz_Diorite-Hansen_Carter_1982\"\nFrom [J. de Bremond d'Ars et al. Tectonophysics (1999). Hydrothermalism and Diapirism in the Archaean: gravitational instability constrains. - page 5]\n\"Diabase-Caristan_1982\"\n\"Tumut_Pond_Serpentinite-Raleigh_Paterson_1965\"\nFrom [Mackwell, Zimmerman & Kohlstedt (1998). High-temperature deformation]:\n\"Maryland_strong_diabase-Mackwell_et_al_1998\"\nFrom [Ueda et al (PEPI 2008)]:\n\"Wet_Quarzite-Ueda_et_al_2008\"\nFrom [Huismans et al 2001]:\n\"Diabase-Huismans_et_al_2001\"\n\"Granite-Huismans_et_al_2001\"\nFrom [Burg And Podladchikov (1999)]:\n\"Dry_Upper_Crust-Schmalholz_Kaus_Burg_2009\"\n\"Weak_Lower_Crust-Schmalholz_Kaus_Burg_2009\"\n\"Olivine-Burg_Podladchikov_1999\"\nFrom [Rybacki and Dresen, 2000, JGR]:\n\"Dry_Plagioclase_RybackiDresen_2000\"\n\"Wet_Plagioclase_RybackiDresen_2000\"\nFrom [Hirth, G. & Kohlstedt (2003), D. Rheology of the upper mantle and the mantle wedge: A view from the experimentalists]:\n\"Wet_Olivine_disl_creep-Hirth_Kohlstedt_2003\"\n\"Wet_Olivine_disl_creep-Hirth_Kohlstedt_2003_constant_C_OH\"\n\"Dry_Olivine_disl_creep-Hirth_Kohlstedt_2003\"\nFrom [SchmalholzKausBurg(2009), Geology (wet olivine)]:\n\"Wet_Upper_Mantle-Burg_Schmalholz_2008\"\n\"Granite-Tirel_et_al_2008\"\nFrom [Urai et al.(2008)]:\n\"Ara_rocksalt-Urai_et_al.(2008)\"\nFrom [Bräuer et al. (2011) Description of the Gorleben site (PART 4): Geotechnical exploration of the Gorleben salt dome - page 126]:\n\"RockSaltReference_BGRa_class3-Braeumer_et_al_2011\"\nFrom [Mueller and Briegel (1978)]:\n\"Polycrystalline_Anhydrite-Mueller_and_Briegel(1978)\"\nNote that you can always specify your own, by setting Bn, En, Vn, and n accordingly.\n\npeir_prof::Union{Nothing, String}: Build-in PEIERLS creep profiles:\nexample: \"Olivine_Peierls-Kameyama_1999\"\nAvailable profiles:\n\"Olivine_Peierls-Kameyama_1999\"\n\nrho_n::Union{Nothing, Float64}: depth-dependent density model parameter\nrho_c::Union{Nothing, Float64}: depth-dependent density model parameter\nbeta::Union{Nothing, Float64}: pressure-dependent density model parameter\nG::Union{Nothing, Float64}: shear modulus\nKb::Union{Nothing, Float64}: bulk modulus\nE::Union{Nothing, Float64}: Young's modulus\nnu::Union{Nothing, Float64}: Poisson's ratio\nKp::Union{Nothing, Float64}: pressure dependence parameter\nBd::Union{Nothing, Float64}: DIFFUSION creep pre-exponential constant\nEd::Union{Nothing, Float64}: activation energy\nVd::Union{Nothing, Float64}: activation volume\neta0::Union{Nothing, Float64}: POWER LAW reference viscosity\ne0::Union{Nothing, Float64}: reference strain rate\nBn::Union{Nothing, Float64}: DISLOCATION creep pre-exponential constant\nEn::Union{Nothing, Float64}: activation energy\nVn::Union{Nothing, Float64}: activation volume\nn::Union{Nothing, Float64}: power law exponent\nBp::Union{Nothing, Float64}: PEIERLS creep pre-exponential constant\nEp::Union{Nothing, Float64}: activation energy\nVp::Union{Nothing, Float64}: activation volume\ntaup::Union{Nothing, Float64}: scaling stress\ngamma::Union{Nothing, Float64}: approximation parameter\nq::Union{Nothing, Float64}: stress-dependence parameter\neta_fk::Union{Nothing, Float64}: reference viscosity for Frank-Kamenetzky viscosity\ngamma_fk::Union{Nothing, Float64}: gamma parameter for Frank-Kamenetzky viscosity\nTRef_fk::Union{Nothing, Float64}: reference Temperature for Frank-Kamenetzky viscosity (if not set it is 0°C)\nch::Union{Nothing, Float64}: cohesion\nfr::Union{Nothing, Float64}: friction angle\neta_st::Union{Nothing, Float64}: stabilization viscosity (default is eta_min)\neta_vp::Union{Nothing, Float64}: viscoplastic plasticity regularisation viscosity\nrp::Union{Nothing, Float64}: pore-pressure ratio\nchSoftID::Union{Nothing, Int64}: friction softening law ID\nfrSoftID::Union{Nothing, Int64}: cohesion softening law ID\nhealID::Union{Nothing, Int64}: healing ID, points to healTau in Softening\nalpha::Union{Nothing, Float64}: thermal expansivity\nCp::Union{Nothing, Float64}: specific heat (capacity), J⋅K−1⋅kg−1\nk::Union{Nothing, Float64}: thermal conductivity\nA::Union{Nothing, Float64}: radiogenic heat production\nT::Union{Nothing, Float64}: optional temperature to set within the phase\nLatent_hx::Union{Nothing, Float64}: optional, used for dike heating, J/kg\nT_liq::Union{Nothing, Float64}: optional, used for dike heating, liquidus temperature of material, celsius\nT_sol::Union{Nothing, Float64}: optional, used for dike heating, solidus temperature of material, celsius\nT_Nu::Union{Nothing, Float64}: default value for thermal conductivity boundary\nnu_k::Union{Nothing, Float64}: optional parameter, Nusselt number for use with conductivity\nrho_ph::Union{Nothing, String}: name of the phase diagram you want to use (still needs rho to be defined for the initial guess of pressure)\nrho_ph_dir::Union{Nothing, String}: in case the phase diagram has a different path provide the path (without the name of the actual PD) here\nmfc::Union{Nothing, Float64}: melt fraction viscosity correction factor (positive scalar)\nGeoParams::Union{Nothing, Vector{GeoParams.MaterialParameters.ConstitutiveRelationships.AbstractCreepLaw}}: GeoParams creeplaws\nSet diffusion or dislocation creeplaws as provided by the GeoParams package:\njulia> using GeoParams\njulia> a = SetDiffusionCreep(GeoParams.Diffusion.dry_anorthite_Rybacki_2006);\njulia> p = Phase(ID=1,Name=\"test\", GeoParams=[a]);\nNote that GeoParams should be a vector, as you could, for example, have diffusion and dislocation creep parameters\nNote also that this will overwrite any other creeplaws provided in the Phase struct.\n\ngrainsize::Union{Nothing, Float64}: grainsize m This is not actually used in LaMEM, but is required when setting diffusion creep parameters by using GeoParams\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.PhaseAggregate","page":"Available functions","title":"LaMEM.LaMEM_Model.PhaseAggregate","text":"Defines phase aggregates, which can be useful for visualization purposes\n\nname::String: Name of the phase aggregate\nphaseID::Union{Nothing, Vector{Int64}}: Phases to be combined\nnumPhase::Union{Nothing, Int64}: number of aggregated phases\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.PhaseTransition","page":"Available functions","title":"LaMEM.LaMEM_Model.PhaseTransition","text":"Defines phase transitions on markers (that change the Phase ID of a marker depending on some conditions)\n\nID::Int64: Phase_transition law ID\nType::String: [Constant, Clapeyron, Box]: Constant - the phase transition occurs only at a fixed value of the parameter; Clapeyron - clapeyron slope\nName_Clapeyron::Union{Nothing, String}: Type of predefined Clapeyron slope, such as MantleTransition660km\nPTBox_Bounds::Union{Nothing, Vector{Float64}}: box bound coordinates: [left, right, front, back, bottom, top]\nBoxVicinity::Union{Nothing, Int64}: 1: only check particles in the vicinity of the box boundaries (2: in all directions)\nParameter_transition::Union{Nothing, String}: [T = Temperature, P = Pressure, Depth = z-coord, X=x-coord, Y=y-coord, APS = accumulated plastic strain, MeltFraction, t = time] parameter that triggers the phase transition\nConstantValue::Union{Nothing, Float64}: Value of the parameter [unit of T,P,z, APS]\nnumber_phases::Union{Nothing, Int64}: The number of involved phases [default=1]\nPhaseAbove::Union{Nothing, Vector{Int64}}: Above the chosen value the phase is 1, below it, the value is PhaseBelow\nPhaseBelow::Union{Nothing, Vector{Int64}}: Below the chosen value the phase is PhaseBelow, above it, the value is 1\nPhaseInside::Union{Nothing, Vector{Int64}}: Phase within the box [use -1 if you don't want to change the phase inside the box]\nPhaseOutside::Union{Nothing, Vector{Int64}}: Phase outside the box [use -1 if you don't want to change the phase outside the box. If combined with OutsideToInside, all phases that come in are set to PhaseInside]\nPhaseDirection::Union{Nothing, String}: [BothWays=default; BelowToAbove; AboveToBelow] Direction in which transition works\nResetParam::Union{Nothing, String}: [APS] Parameter to reset on particles below PT or within box\nPTBox_TempType::Union{Nothing, String}: # Temperature condition witin the box [none, constant, linear, halfspace]\nPTBox_topTemp::Union{Nothing, Float64}: Temp @ top of box [for linear & halfspace]\nPTBox_botTemp::Union{Nothing, Float64}: Temp @ bottom of box [for linear & halfspace]\nPTBox_thermalAge::Union{Nothing, Float64}: Thermal age, usually in geo-units [Myrs] [only in case of halfspace]\nPTBox_cstTemp::Union{Nothing, Float64}: Temp within box [only for constant T]\nv_box::Union{Nothing, Float64}: [optional] only for NotInAirBox, velocity with which box moves in cm/yr\nt0_box::Union{Nothing, Float64}: [optional] beginning time of movemen in Myr\nt1_box::Union{Nothing, Float64}: [optional] end time of movement in Myr\nclapeyron_slope::Union{Nothing, Float64}: [optional] clapeyron slope of phase transition [in K/MPa]; P = ( T - T0_clapeyron ) * clapeyron_slope + P0_clapeyron\nP0_clapeyron::Union{Nothing, Float64}: [optional] P0_clapeyron [Pa]\nT0_clapeyron::Union{Nothing, Float64}: [optional] T0_clapeyron [C]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Scaling","page":"Available functions","title":"LaMEM.LaMEM_Model.Scaling","text":"Scaling{T} is a structure that contains the scaling info, employed in the current simulation\n\nScaling::Any: Scaling object (as in GeoParams), which can be GEO_units(), NO_units(), or SI_units()\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Softening","page":"Available functions","title":"LaMEM.LaMEM_Model.Softening","text":"Defines strain softening parameters\n\nID::Int64: softening law ID\nAPS1::Float64: Begin of softening, in units of accumulated plastic strain (APS)\nAPS2::Float64: End of softening, in units of accumulated plastic strain (APS)\nA::Float64: Reduction ratio\nLm::Union{Nothing, Float64}: Material length scale (in selected units, e.g. km in geo)\nAPSheal2::Union{Nothing, Float64}: APS when healTau2 activates\nhealTau::Union{Nothing, Float64}: healing timescale parameter [Myr]\nhealTau2::Union{Nothing, Float64}: healing timescale parameter [Myr] starting at APS=APSheal2\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.SolutionParams","page":"Available functions","title":"LaMEM.LaMEM_Model.SolutionParams","text":"Structure that contains the LaMEM global solution parameters.\n\ngravity::Vector{Float64}: gravitational acceleration vector\nFSSA::Float64: free surface stabilization parameter [0 - 1]; The value has to be between 0 and 1\n\nFSSA_allVel::Int64: free surface stabilization parameter applied to all velocity components? Default is yes; if not it is only applied to the z-component\n\nshear_heat_eff::Float64: shear heating efficiency parameter [0 - 1]\nAdiabatic_Heat::Float64: Adiabatic Heating activation flag and efficiency. 0.0 - 1.0\nact_temp_diff::Int64: temperature diffusion activation flag\nact_therm_exp::Int64: thermal expansion activation flag\nact_steady_temp::Int64: steady-state temperature initial guess activation flag\nsteady_temp_t::Float64: time for (quasi-)steady-state temperature initial guess\nnstep_steady::Int64: number of steps for (quasi-)steady-state temperature initial guess (default = 1)\nact_heat_rech::Int64: recharge heat in anomalous bodies after (quasi-)steady-state temperature initial guess (=2: recharge after every diffusion step of initial guess)\ninit_lith_pres::Int64: sets initial pressure to be the lithostatic pressure (stabilizes compressible setups in the first steps)\ninit_guess::Int64: create an initial guess step (using constant viscosity eta_ref before starting the simulation\np_litho_visc::Int64: use lithostatic instead of dynamic pressure for creep laws\np_litho_plast::Int64: use lithostatic pressure for plasticity\np_lim_plast::Int64: limit pressure at first iteration for plasticity\np_shift::Int64: add a constant value [MPa] to the total pressure field, before evaluating plasticity (e.g., when the domain is located @ some depth within the crust)\nact_p_shift::Int64: pressure shift activation flag (enforce zero pressure on average in the top cell layer); note: this overwrites p_shift above!\neta_min::Float64: viscosity lower bound [Pas]\neta_max::Float64: viscosity upper limit [Pas]\neta_ref::Float64: Reference viscosity (used for the initial guess) [Pas]\nT_ref::Float64: Reference temperature [C]\nRUGC::Float64: universal gas constant (you need to change this only for non-dimensional setups)\nmin_cohes::Float64: cohesion lower bound [Pa]\nmin_fric::Float64: friction lower bound [degree]\ntau_ult::Float64: ultimate yield stress [Pa]\nrho_fluid::Float64: fluid density for depth-dependent density model\ngw_level_type::String: ground water level type for pore pressure computation (see below)\ngw_level::Float64: ground water level at the free surface (if defined)\nbiot::Float64: Biot pressure parameter\nget_permea::Float64: effective permeability computation activation flag\nrescal::Float64: stencil rescaling flag (for internal constraints, for example while computing permeability)\nmfmax::Float64: maximum melt fraction affecting viscosity reduction\nlmaxit::Int64: maximum number of local rheology iterations\nlrtol::Float64: local rheology iterations relative tolerance\nact_dike::Int64: dike activation flag (additonal term in divergence)\nuseTk::Int64: switch to use T-dependent conductivity, 0: not active\ndikeHeat::Int64: switch to use Behn & Ito heat source in the dike\nadiabatic_gradient::Float64: Adiabatic gradient in combination with Behn & Ito dike\nCompute_velocity_gradient::Int64: compute the velocity gradient tensor 1: active, 0: not active. If active, it automatically activates the output in the .pvd file\nPhasetrans::Int64: Activate Phase Transitions on Particles or not, 0: not.\nPassive_Tracer::Int64: Activate Passive Tracers or not?\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Solver","page":"Available functions","title":"LaMEM.LaMEM_Model.Solver","text":"Structure that contains the LaMEM solver options\n\nSolverType::String: solver employed [\"direct\" or \"multigrid\"]\nDirectSolver::String: mumps/superlu_dist/pastix/umfpack (requires these external PETSc packages to be installed!)\nDirectPenalty::Float64: penalty parameter [employed if we use a direct solver]\nMGLevels::Int64: number of MG levels [default=3]\nMGSweeps::Int64: number of MG smoothening steps per level [default=10]\nMGSmoother::String: type of smoothener used [chebyshev or jacobi]\nMGJacobiDamp::Float64: Dampening parameter [only employed for Jacobi smoothener; default=0.6]\nMGCoarseSolver::String: coarse grid solver if using multigrid [\"direct\" / \"mumps\" / \"superlu_dist\" or \"redundant\" - more options specifiable through the command-line options -crs_ksp_type & -crs_pc_type]\nMGRedundantNum::Int64: How many times do we copy the coarse grid? [only employed for redundant solver; default is 4]\nMGRedundantSolver::String: The coarse grid solver for each of the redundant solves [only employed for redundant; options are \"mumps\"/\"superlu_dist\" with default \"superlu_dist\"]\nPETSc_options::Vector{String}: List with (optional) PETSc options\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Time","page":"Available functions","title":"LaMEM.LaMEM_Model.Time","text":"Structure that contains the LaMEM timestepping information. An explanation of the paramneters is given in the struct `Time_info`\n\ntime_end::Float64: simulation end time\ndt::Float64: initial time step\ndt_min::Float64: minimum time step (declare divergence if lower value is attempted)\ndt_max::Float64: maximum time step\ndt_out::Float64: output step (output at least at fixed time intervals)\ninc_dt::Float64: time step increment per time step (fraction of unit)\nCFL::Float64: CFL (Courant-Friedrichs-Lewy) criterion\nCFLMAX::Float64: CFL criterion for elasticity\nnstep_max::Int64: maximum allowed number of steps (lower bound: timeend/dtmax)\nnstep_out::Int64: save output every n steps; Set this to -1 to deactivate saving output\nnstep_rdb::Int64: save restart database every n steps\nnum_dt_periods::Int64: number of time stepping periods\ntime_dt_periods::Vector{Int64}: timestamps where timestep should be fixed (first entry has to 0)\nstep_dt_periods::Vector{Float64}: target timesteps ar timestamps above\nnstep_ini::Int64: save output for n initial steps\ntime_tol::Float64: relative tolerance for time comparisons\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.VelCylinder","page":"Available functions","title":"LaMEM.LaMEM_Model.VelCylinder","text":"LaMEM boundary condition internal velocty cylinder `VelCylinder` object\n\nbaseX::Float64: X-coordinate of base of cylinder\nbaseY::Float64: Y-coordinate of base of cylinder\nbaseZ::Float64: Z-coordinate of base of cylinder\ncapX::Float64: X-coordinate of cap of cylinder\ncapY::Float64: Y-coordinate of cap of cylinder\ncapZ::Float64: Z-coordinate of cap of cylinder\nradius::Float64: radius of cylinder\nvx::Union{Nothing, Float64}: Vx velocity of cylinder (default is unconstrained)\nvy::Union{Nothing, Float64}: Vy velocity of cylinder (default is unconstrained)\nvz::Union{Nothing, Float64}: Vz velocity of cylinder (default is unconstrained)\nadvect::Int64: cylinder advection flag\nvmag::Float64: magnitude of velocity applied along the cylinder's axis of orientation\ntype::String: velocity profile [uniform or parabolic]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.VelocityBox","page":"Available functions","title":"LaMEM.LaMEM_Model.VelocityBox","text":"Define velocity regions within the modelling region, by specifying its center point and width along the three axis.\n\ncenX::Float64: X-coordinate of center of box\ncenY::Float64: Y-coordinate of center of box\ncenZ::Float64: Z-coordinate of center of box\nwidthX::Float64: Width of box in x-direction\nwidthY::Float64: Width of box in y-direction\nwidthZ::Float64: Width of box in Z-direction\nvx::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)\nvy::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)\nvz::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)\nadvect::Int64: box advection flag\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.above_surface-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"GeophysicalModelGenerator.above_surface","text":"above_surface(model::Model, DataSurface_Cart::CartData)\n\nReturns a boolean grid that is true if the Phases/Temp grid are above the surface\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_box!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_box!","text":"add_box!(model::Model; xlim=Tuple{2}, [ylim=Tuple{2}], zlim=Tuple{2},\n Origin=nothing, StrikeAngle=0, DipAngle=0,\n phase = ConstantPhase(1),\n T=nothing )\n\nAdds a box with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models See the documentation of the GMG routine for the full options.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_cylinder!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_cylinder!","text":"add_cylinder!(model::Model; # required input\n base=Tuple{3}, cap=Tuple{3}, radius=Tuple{1}, # center and radius of the sphere\n phase = ConstantPhase(1), # Sets the phase number(s) in the sphere\n T=nothing ) # Sets the thermal structure (various fucntions are available)\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_ellipsoid!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_ellipsoid!","text":"add_ellipsoid!(model::Model; # required input\n cen=Tuple{3}, axes=Tuple{3}, # center and semi-axes of the ellpsoid\n Origin=nothing, StrikeAngle=0, DipAngle=0, # origin & dip/strike\n phase = ConstantPhase(1), # Sets the phase number(s) in the box\n T=nothing )\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_layer!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_layer!","text":"add_layer!(model::Model; xlim, ylim, zlim=Tuple{2},\n phase = ConstantPhase(1),\n T=nothing )\n\nAdds a layer with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models See the documentation of the GMG routine for the full options.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_polygon!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_polygon!","text":"add_polygon!(model::Model; # required input\n xlim::Vector, \n ylim=Vector,\n zlim=Vector(), \n phase = ConstantPhase(1), # Sets the phase number(s) in the box\n T=nothing)\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_slab!-Tuple{Model, GeophysicalModelGenerator.Trench}","page":"Available functions","title":"GeophysicalModelGenerator.add_slab!","text":"add_slab!(model::Model; # required input\n trench::Trench; \n phase = ConstantPhase(1), # Sets the phase number(s) in the box\n T=nothing)\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_sphere!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_sphere!","text":"add_sphere!(model::Model; cen=Tuple{3}, radius=Tuple{1}, phase = ConstantPhase(1), T=nothing)\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_stripes!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_stripes!","text":"add_stripes!(Phase, Grid::AbstractGeneralGrid;\n stripAxes = (1,1,0),\n stripeWidth = 0.2,\n stripeSpacing = 1,\n Origin = nothing,\n StrikeAngle = 0,\n DipAngle = 10,\n phase = ConstantPhase(3),\n stripePhase = ConstantPhase(4))\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.below_surface-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"GeophysicalModelGenerator.below_surface","text":"below_surface(model::Model, DataSurface_Cart::CartData)\n\nReturns a boolean grid that is true if the Phases/Temp grid are below the surface\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.IO_functions.passivetracer_time","page":"Available functions","title":"LaMEM.IO_functions.passivetracer_time","text":"\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.IO_functions.passivetracer_time-Tuple{Union{Int64, Vector{Int64}}, Model}","page":"Available functions","title":"LaMEM.IO_functions.passivetracer_time","text":"PT = passivetracer_time(ID::Union{Vector{Int64},Int64}, model::Model)\n\nThis reads passive tracers with ID from a LaMEM simulation specified by model, and returns a named tuple with the temporal evolution of these passive tracers. We return x,y,z coordinates and all fields specified in FileName for particles number ID.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.IO_functions.read_LaMEM_simulation-Tuple{Model}","page":"Available functions","title":"LaMEM.IO_functions.read_LaMEM_simulation","text":"Timestep, FileNames, Time = read_LaMEM_simulation(model::Model; phase=false, surf=false, passive_tracers=false)\n\nReads a LaMEM simulation as specified in model and returns the timesteps, times and filenames of that simulation once it is finished.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.IO_functions.read_LaMEM_timestep","page":"Available functions","title":"LaMEM.IO_functions.read_LaMEM_timestep","text":"data, time = read_LaMEM_timestep(model::Model, TimeStep::Int64=0; fields=nothing, phase=false, surf=false, last=true)\n\nReads a specific Timestep from a simulation specified in model\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Check_LaMEM_Model-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.Check_LaMEM_Model","text":"Check_LaMEM_Model(m::Model)\n\nChecks the LaMEM Setup Model m for errors\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Create_Grid-NTuple{15, Any}","page":"Available functions","title":"LaMEM.LaMEM_Model.Create_Grid","text":"This creates a LaMEM grid\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.UpdateDefaultParameters-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.UpdateDefaultParameters","text":"model = UpdateDefaultParameters(model::Model)\n\nThis updates the default parameters depending on some of the input parameters. If you activate passive tracers, for example, it will also activate output for that \n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.above_surface!-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"LaMEM.LaMEM_Model.above_surface!","text":"above_surface!(model::Model, DataSurface_Cart::CartData; phase::Int64=nothing, T::Number=nothing)\n\nSets the Temp or Phases above the surface DataSurface_Cart to a constant value.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_dike!-Tuple{Model, Dike}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_dike!","text":"add_dike!(model::Model, dike::Dike)\n\nThis adds a phase transition phase_trans to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_geom!-Tuple{Model, Any}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_geom!","text":"add_geom!(model::Model, geom_object)\n\nThis adds an internal geometric primitive object geom_object to the LaMEM Model Setup model.\n\nCurrently available primitive geom objects are:\n\nGeomSphere\nGeomEllipsoid\nGeomBox\nGeomLayer\nGeomCylinder\nGeomRidgeSeg\nGeomHex\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_geom!-Tuple{Model, Vararg{Any}}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_geom!","text":"add_geom!(model::Model, geom_object)\n\nAdd several geometric objects @ once.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_petsc!-Tuple{Model, Vararg{Any}}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_petsc!","text":"add_petsc!(model::Model, option::String)\n\nAdds one or more PETSc options to the model \n\nExample\n\njulia> d = Model()\njulia> add_petsc!(d,\"-snes_npicard 3\")\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_phase!-Tuple{Model, Phase}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_phase!","text":"add_phase!(model::Model, phase::Phase)\n\nThis adds a phase (with material properties) to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_phase!-Tuple{Model, Vararg{Any}}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_phase!","text":"add_phase!(model::Model, phases...)\n\nAdd several phases @ once.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_phaseaggregate!-Tuple{Model, PhaseAggregate}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_phaseaggregate!","text":"add_phaseaggregate!(model::Model, phaseagg::PhaseAggregate)\n\nThis adds a phase aggregate law phaseagg to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_phasetransition!-Tuple{Model, PhaseTransition}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_phasetransition!","text":"add_phasetransition!(model::Model, phase_trans::PhaseTransition)\n\nThis adds a phase transition phase_trans to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_softening!-Tuple{Model, Softening}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_softening!","text":"add_softening!(model::Model, soft::Softening)\n\nThis adds a plastic softening law soft to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_topography!-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_topography!","text":"add_topography!(model::Model, topography::CartData; surf_air_phase=0, surf_topo_file=\"topography.txt\", open_top_bound=1, surf_level=0.0)\n\nAdds the topography surface to the model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_vbox!-Tuple{Model, Vararg{Any}}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_vbox!","text":"add_vbox!(model::Model, vboxes...)\n\nAdd several phases @ once.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_vbox!-Tuple{Model, VelocityBox}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_vbox!","text":"add_vbox!(model::Model, vbox::VelocityBox) This adds a vbox (with its properties) to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.adjust_for_platforms-Tuple{Any, Int64}","page":"Available functions","title":"LaMEM.LaMEM_Model.adjust_for_platforms","text":"model, cores = adjust_for_platforms(model, cores::Int64)\n\nOn certain platforms we have restrictions (MPI is broken on windows currently, so we need to adjust things accordingly)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.below_surface!-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"LaMEM.LaMEM_Model.below_surface!","text":"below_surface!(model::Model, DataSurface_Cart::CartData; phase::Union{Int64,Nothing}=nothing, T::Union{Number,Nothing}=nothing)\n\nSets the Temp or Phases below the surface DataSurface_Cart to a constant value.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.compute_dof-Tuple{Tuple{Int64, Int64, Int64}}","page":"Available functions","title":"LaMEM.LaMEM_Model.compute_dof","text":"Returns the total degrees of freedom for a LaMEM simulation\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.copy_phase-Tuple{Phase}","page":"Available functions","title":"LaMEM.LaMEM_Model.copy_phase","text":"copy_phase(phase::Phase; kwargs...)\n\nThis copies a phase with material properties, while allowing to change some parameters\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.create_initialsetup","page":"Available functions","title":"LaMEM.LaMEM_Model.create_initialsetup","text":"create_initialsetup(model::Model, cores::Int64=1, args::String=\"\"; verbose=verbose)\n\nCreates the initial model setup of LaMEM from model, which includes:\n\nWriting the LaMEM (*.dat) input file\n\nand in case we do not employt geometric primitives to create the setup:\n\nWrite the VTK file (if requested when model.Output.write_VTK_setup=true)\nWrite the marker files to disk (if model.ModelSetup.msetup=\"files\")\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.cross_section","page":"Available functions","title":"LaMEM.LaMEM_Model.cross_section","text":"data_tuple, axes_str = cross_section(model::LaMEM.Model, field=:phases; x=nothing, y=nothing, z=nothing)\n\nThis creates a cross-section through the initial model setup & returns a 2D array\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.cross_section-2","page":"Available functions","title":"LaMEM.LaMEM_Model.cross_section","text":"Cross = cross_section(cart::CartData, field::Symbol =:phase; x=nothing, y=nothing, z=nothing)\n\nCreates a cross-section through the data and returns x,z coordinates\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.digitsep-Tuple{Integer}","page":"Available functions","title":"LaMEM.LaMEM_Model.digitsep","text":"digitsep(value::Integer; separator=\",\", per_separator=3)\n\nConvert an integer to a string, separating each per_separator digits by separator.\n\ndigitsep(12345678) # \"12,345,678\"\ndigitsep(12345678, seperator= \"'\") # \"12'345'678\"\ndigitsep(12345678, seperator= \"-\", per_separator=4) # \"1234-5678\"\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.flatten-Tuple{GeophysicalModelGenerator.CartData, Symbol, Any, Any, Any}","page":"Available functions","title":"LaMEM.LaMEM_Model.flatten","text":"Creates a 2D array out of a cross-section and a specified data field\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.hasplasticity-Tuple{Phase}","page":"Available functions","title":"LaMEM.LaMEM_Model.hasplasticity","text":"hasplasticity(p::Phase)\n\ntrue if p contains plastic parameters (cohesion or friction angle)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.is_rectilinear-Tuple{GeophysicalModelGenerator.CartData}","page":"Available functions","title":"LaMEM.LaMEM_Model.is_rectilinear","text":"is_rectilinear(topography::CartData)\n\nChecks whether topography is rectilinear\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.isdefault-Tuple{Any, Any}","page":"Available functions","title":"LaMEM.LaMEM_Model.isdefault","text":"isdefault(s1::S, s_default::S)\n\nChecks whether a struct s1 has default parameters s_default\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.prepare_lamem","page":"Available functions","title":"LaMEM.LaMEM_Model.prepare_lamem","text":"prepare_lamem(model::Model, cores::Int64=1, args:String=\"\"; verbose=false)\n\nPrepares a LaMEM run for the parameters that are specified in model, without running the simulation 1) Create the *.dat file 2) Write markers to disk in case we use a \"files\" setup\n\nThis is useful if you want to prepare a model on one machine but run it on another one (e.g. a cluster)\n\nSet model.Output.write_VTK_setup to true if you want to write a VTK file of the model setup\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.print_short-Tuple{Multigrid}","page":"Available functions","title":"LaMEM.LaMEM_Model.print_short","text":"This creates a single string, so we can use it in the command line\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.replace_phase!-Tuple{Model, Phase}","page":"Available functions","title":"LaMEM.LaMEM_Model.replace_phase!","text":"replace_phase!(model::Model, phase_new::Phase; ID::Int64=nothing, Name::String=nothing)\n\nThis replaces a phase within a LaMEM Model Setup model with phase_new either based on its Name or ID. Note that it is expected that only one such phase is present in the current setup.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_geom!-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_geom!","text":"rm_geom!(model::Model)\n\nThis removes all existing geometric objects from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_last_phase!-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_last_phase!","text":"rm_last_phase!(model::Model, phase::Phase)\n\nThis removes the last added phase from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_last_vbox!-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_last_vbox!","text":"rmlastvbox!(model::Model) This removes the last added vbox from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_phase!-Tuple{Model, Int64}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_phase!","text":"rm_phase!(model::Model, ID::Int64)\n\nThis removes a phase with ID from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_phase!-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_phase!","text":"rm_phase!(model::Model)\n\nThis removes all existing phases from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_vbox!-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_vbox!","text":"rm_vbox!(model::Model)\n\nThis removes all existing velocity boxes from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.set_air-Tuple{}","page":"Available functions","title":"LaMEM.LaMEM_Model.set_air","text":"set_air(; Name=\"air\", ID=0, rho=1, alpha=nothing, eta=1e17, G=nothing, nu=nothing, fr=nothing, ch=nothing, k=30,Cp=1000)\n\nSets an air phase, with high conductivity \n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.set_geom!-Tuple{Model, GeomSphere}","page":"Available functions","title":"LaMEM.LaMEM_Model.set_geom!","text":"This sets the geometry \n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.stress_strainrate_0D-Tuple{Any, Vector}","page":"Available functions","title":"LaMEM.LaMEM_Model.stress_strainrate_0D","text":"τ = stress_strainrate_0D(rheology, ε_vec::Vector; n=8, T=700, nstep_max=2, clean=true)\n\nComputes the stress for a given strain rate and 0D rheology setup, for viscous creep rheologies. n is the resolution in x,z, T the temperature, nstep_max the number of time steps, ε_vec the strainrate vector (in 1/s). \n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.within_bounds-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"LaMEM.LaMEM_Model.within_bounds","text":"within_bounds(model::Model, topography::CartData)\n\nVerifies that the bounds of the topography grid are larger than that of the model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(d::Model,fname::String; dir=pwd())\n\nWrites a LaMEM input file based on the data stored in Model\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, BoundaryConditions}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::BoundaryConditions)\n\nWrites the boundary conditions related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, FreeSurface}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::FreeSurface)\n\nWrites the free surface related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomBox}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomBox)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomCylinder}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomCylinder)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomEllipsoid}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomEllipsoid)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomHex}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomHex)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomLayer}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomLayer)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomRidgeSeg}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomRidgeSeg)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomSphere}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomSphere)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, Grid}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::Grid)\n\nThis writes grid info to a LaMEM input file\n\nExample\n\njulia> d=LaMEM.Grid(coord_x=[0.0, 0.7, 0.8, 1.0], bias_x=[0.3,1.0,3.0], nel_x=[10,4,2])\njulia> io = open(\"test.dat\",\"w\")\njulia> LaMEM.write_LaMEM_inputFile(io, d)\njulia> close(io)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, Materials}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::Output)\n\nWrites the free surface related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, ModelSetup}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::ModelSetup)\n\nWrites options related to the Model Setup to disk\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, Output}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::Output)\n\nWrites the free surface related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, PassiveTracers}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::PassiveTracers)\n\nWrites the boundary conditions related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, SolutionParams}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::SolutionParams)\n\nWrites the boundary conditions related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, Solver}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::Solver)\n\nWrites the free surface related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, Time}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"Writes the Time related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, VelocityBox}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomSphere)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile_PETSc-Tuple{Any, Solver}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile_PETSc","text":"write_LaMEM_inputFile_PETSc(io, d::Solver)\n\nWrites the (optional) PETSc options to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.Run.run_lamem","page":"Available functions","title":"LaMEM.Run.run_lamem","text":"run_lamem(model::Model, cores::Int64=1, args:String=\"\"; wait=true)\n\nPerforms a LaMEM run for the parameters that are specified in model\n\n\n\n\n\n","category":"function"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"EditURL = \"../../example_scripts/Subduction3D.jl\"","category":"page"},{"location":"Subduction3D/#3D-Subduction-example","page":"Example 4: 3D Subduction","title":"3D Subduction example","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"This is a 3D subduction example for LaMEM.jl that illustrates how to use the julia interface. This is very similar to the setup described by Schellart and coworkers in a 2007 nature paper in which they demonstrate that toroidal flow changes the slab curvature during subduction as a function of slab width.","category":"page"},{"location":"Subduction3D/#1.-Generate-main-model-setup","page":"Example 4: 3D Subduction","title":"1. Generate main model setup","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"We first load the packages:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"using LaMEM, GeophysicalModelGenerator","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"Next, we generate the main model setup, specifying the resolution and grid dimensions. Note that a range of default values will be set, depending on the parameters you specify.","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"model = Model(\n # Define the grid\n Grid(nel=(128,32,64), x=[-3960, 500], y=[0,2640], z=[-660 ,0]),\n\n # No slip lower boundary; the rest is free slip\n BoundaryConditions(noslip = [0, 0, 0, 0, 1, 0]),\n\n # We use a multigrid solver with 4 levels:\n Solver(SolverType=\"multigrid\", MGLevels=4, MGCoarseSolver=\"mumps\",\n PETSc_options=[ \"-snes_type ksponly\",\n \"-js_ksp_rtol 1e-3\",\n \"-js_ksp_atol 1e-4\",\n \"-js_ksp_monitor\"]),\n\n # Output filename\n Output(out_file_name=\"Subduction_3D\", out_dir=\"Subduction_3D\"),\n\n # Timestepping etc\n Time(nstep_max=200, nstep_out=5, time_end=100, dt_min=1e-5),\n\n # Scaling:\n Scaling(GEO_units(length=1km, stress=1e9Pa) )\n )","category":"page"},{"location":"Subduction3D/#2.-Define-geometry","page":"Example 4: 3D Subduction","title":"2. Define geometry","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"Next, we specify the geometry of the model, using the AddBox! function from GeophysicalModelGenerator. We start with the horizontal part of the slab. The function AddBox! allows you to specify a layered lithosphere; here we have a crust and mantle. It also allows specifying a thermal structure. Since the current setup is only mechanical, we don't specify that here.","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"add_box!(model, xlim=(-3000,-1000), ylim=(0,1000), zlim=(-80,0), phase=LithosphericPhases(Layers=[20,60], Phases=[1,2]))","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"The inclined part of the slab is generate by giving it a dip:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"add_box!(model, xlim=(-1000,-810), ylim=(0,1000), zlim=(-80,0), phase=LithosphericPhases(Layers=[20,60], Phases=[1,2]), DipAngle=16)","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"There is a simple way to have a quick look at this setup by using the Plots.jl package:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"using Plots\nplot_cross_section(model, y=100, field=:phase)","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"Which will give the following plot: (Image: 2D cross section)","category":"page"},{"location":"Subduction3D/#3.-Add-material-properties:","page":"Example 4: 3D Subduction","title":"3. Add material properties:","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"We can specify material properties by using the Phase function","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"mantle = Phase(Name=\"mantle\",ID=0,eta=1e21,rho=3200)\ncrust = Phase(Name=\"crust\", ID=1,eta=1e21,rho=3280)\nslab = Phase(Name=\"slab\", ID=2,eta=2e23,rho=3280)","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"and we can add them to the model with:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"add_phase!(model, mantle, slab, crust)","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"You can check that this is set with:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"model","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"LaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(128, 32, 64); xϵ(-3960.0, 500.0), yϵ(0.0, 2640.0), zϵ(-660.0, 0.0)\n|-- Time : nstep_max=200; nstep_out=5; time_end=100.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 1, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : multigrid solver; coarse grid solver=mumps; 4 levels\n|-- Model setup options : Type=files;\n|-- Output options : filename=Subduction_3D; pvd=1; avd=0; surf=0\n|-- Materials : 3 phases;","category":"page"},{"location":"Subduction3D/#4.-Run-the-model","page":"Example 4: 3D Subduction","title":"4. Run the model","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"on windows MPI + mumps currently does not work","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"if Sys.iswindows()\n model.Solver.MGCoarseSolver = \"direct\"\nend","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"Add this stage, we are ready to run the simulation. On my machine it takes around 4 seconds per timestep on 8 cores:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"try testing == true","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"if we run this as part of the test suite, use fewer timesteps","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":" run_lamem(model, 8, \"-nstep_max 2 -nstep_out 1\")\ncatch\n run_lamem(model, 8) # run on 8 cores (if possible)\nend","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"The results looks like this with paraview: (Image: 3D subduction paraview) Note that this is a significantly higher resolution than the original paper, which was run on an HPC system (admittedly, this was 20 years ago).","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"The file Subduction_3D.jl in /scripts reproduces this example","category":"page"},{"location":"Subduction3D/#Markdown-page-generation","page":"Example 4: 3D Subduction","title":"Markdown page generation","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"#This file was generated using Literate:\n#Literate.markdown(\"Subduction3D.jl\",\"../docs/src/\",keepcomments=true, execute=false, codefence = \"```julia\" => \"```\")","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"This page was generated using Literate.jl.","category":"page"},{"location":"readtimesteps/#Read-timesteps-back-into-LaMEM","page":"Reading timesteps","title":"Read timesteps back into LaMEM","text":"","category":"section"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"If you want to quantitatively do something with the results, there is an easy way to read the output of a LaMEM timestep back into julia. All routines related to that are part of the LaMEM.IO module.","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> using LaMEM","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"You can first read the *.pvd file in the directory to see which timesteps are available:","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> FileName=\"FB_multigrid\"\njulia> DirName =\"test\"\njulia> Timestep, Filenames, Time = read_LaMEM_simulation(FileName, DirName)\n([0, 1], [\"Timestep_00000000_0.00000000e+00/FB_multigrid.pvtr\", \"Timestep_00000001_6.72970343e+00/FB_multigrid.pvtr\"], [0.0, 6.729703])","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"We can read a particular timestep (say 1) with:","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> data, time = read_LaMEM_timestep(FileName, 1, DirName)\n(CartData \n size : (33, 33, 33)\n x ϵ [ 0.0 : 1.0]\n y ϵ [ 0.0 : 1.0]\n z ϵ [ 0.0 : 1.0]\n fields : (:phase, :visc_total, :visc_creep, :velocity, :pressure, :strain_rate, :j2_dev_stress, :j2_strain_rate)\n attributes: [\"note\"]\n, [6.729703])","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"The output is in a CartData structure (as defined in GeophysicalModelGenerator).","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"If you do not indicate a directory name (DirName) it'll look in your current directory. The default above will load the main LaMEM simulation output. Alternatively, you can also load the phase information by specify the optional keyword phase=true:","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> data, time = read_LaMEM_timestep(FileName, 1, DirName, phase=true)\n(CartData \n size : (96, 96, 96)\n x ϵ [ 0.0052083334885537624 : 0.9947916269302368]\n y ϵ [ 0.0052083334885537624 : 0.9947916269302368]\n z ϵ [ 0.0052083334885537624 : 0.9947916269302368]\n fields : (:phase,)\n attributes: [\"note\"]\n, [6.729703])","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"In the same way, you can load the internal free surface with surf=true (if that was saved), or passive tracers (passive_tracers=true). If you don't want to load all the fields in the file back to julia, you can check which fields are available:","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> read_LaMEM_fieldnames(FileName, DirName)\n(\"phase [ ]\", \"visc_total [ ]\", \"visc_creep [ ]\", \"velocity [ ]\", \"pressure [ ]\", \"strain_rate [ ]\", \"j2_dev_stress [ ]\", \"j2_strain_rate [ ]\")","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"and load only part of those:","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> data, time = read_LaMEM_timestep(FileName, 1, DirName, fields=(\"phase [ ]\", \"visc_total [ ]\",\"velocity [ ]\"))\n(CartData \n size : (33, 33, 33)\n x ϵ [ 0.0 : 1.0]\n y ϵ [ 0.0 : 1.0]\n z ϵ [ 0.0 : 1.0]\n fields : (:phase, :visc_total, :velocity)\n attributes: [\"note\"]\n, [6.729703])","category":"page"},{"location":"juliasetup_pluto/#Using-Pluto-or-Jupyter-notebooks","page":"Notebooks","title":"Using Pluto or Jupyter notebooks","text":"","category":"section"},{"location":"juliasetup_pluto/#Pluto","page":"Notebooks","title":"Pluto","text":"","category":"section"},{"location":"juliasetup_pluto/","page":"Notebooks","title":"Notebooks","text":"You can also run LaMEM directly using Pluto notebooks:","category":"page"},{"location":"juliasetup_pluto/","page":"Notebooks","title":"Notebooks","text":"julia> using Pluto\njulia> Pluto.run()","category":"page"},{"location":"juliasetup_pluto/","page":"Notebooks","title":"Notebooks","text":"we have provided examples in the notebooks directory of the LaMEM.jl package.","category":"page"},{"location":"juliasetup_pluto/#Jupyter","page":"Notebooks","title":"Jupyter","text":"","category":"section"},{"location":"juliasetup_pluto/","page":"Notebooks","title":"Notebooks","text":"And for the ones of you that are more used to Jupyter notebooks, we also provide an example. Note that this will require you to install the required packages in julia first and use the IJulia package:","category":"page"},{"location":"juliasetup_pluto/","page":"Notebooks","title":"Notebooks","text":"julia> using IJulia\njulia> notebook()","category":"page"},{"location":"juliasetup_LaPalma/#La-Palma-Volcano-setup","page":"Example 2: Volcano","title":"La Palma Volcano setup","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"In this example, we will show how to create a 3D model setup for the 2020 La Palma eruption. We mainly focus on the LaMEM part; see the GeophysicalModelGenerator package for more details on how to plot earthquake data etc.","category":"page"},{"location":"juliasetup_LaPalma/#1.-Load-packages-and-topography","page":"Example 2: Volcano","title":"1. Load packages & topography","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Let's start with what we need:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> using LaMEM, GeophysicalModelGenerator, GMT, Plots\nLoading GMT routines within GMG\nWARNING: using GMT.meshgrid in module GeophysicalModelGenerator conflicts with an existing identifier.\nadding Plots.jl plotting extensions for LaMEM","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Load the topography, choose a projection point & project the topography to cartesian coordinates:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> Topo = import_topo(lon = [-18.7, -17.1], lat=[28.0, 29.2], file=\"@earth_relief_03s.grd\");\njulia> proj = ProjectionPoint(Lon=-17.84, Lat=28.56);\njulia> Topo_cart = convert2CartData(Topo, proj)\nCartData \n size : (1921, 1441, 1)\n x ϵ [ -86.09445705828863 : 73.67229892155609]\n y ϵ [ -63.5531883197492 : 73.28446155584604]\n z ϵ [ -4.38352685546875 : 2.414]\n fields : (:Topography,)","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"This shows the dimensions of our domain in kilometers. The issue is that this projected topography is not an orthogonal grid, but (slightly) distorted. In any case, we see the approximate dimensions of the grid (in horizontal directions), so we can create an orthogonal grid on which to project this:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> Topo_LaMEM = CartData(xyz_grid(-70:.2:70,-60:.2:70,0));\njulia> Topo_LaMEM = project_CartData(Topo_LaMEM, Topo, proj)","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"We can plot it with:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> plot_topo(Topo_LaMEM, clim=(-4,4))","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"(Image: LaPalma_topo)","category":"page"},{"location":"juliasetup_LaPalma/#2.-LaMEM-Model-setup","page":"Example 2: Volcano","title":"2. LaMEM Model setup","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Next, we generate a model setup for LaMEM with:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> model = Model(Grid(x=[-50.,50.], y=[-40.,40.], z=[-80,15] , nel=(64,64,32)),\n BoundaryConditions(temp_bot=1350, open_top_bound=1),\n Scaling(GEO_units(stress=1e9Pa, length=1km)),\n Time(nstep_max=20) )\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(64, 64, 32); xϵ(-50.0, 50.0), yϵ(-40.0, 40.0), zϵ(-80.0, 15.0) \n|-- Time : nstep_max=20; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 0 phases; ","category":"page"},{"location":"juliasetup_LaPalma/#Set-geotherm-and-phases","page":"Example 2: Volcano","title":"Set geotherm and phases","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"We can set an initial constant, linear, geotherm with:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> Z = model.Grid.Grid.Z;\njulia> Geotherm=30\njulia> model.Grid.Temp = -Z.*Geotherm;","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"We will cutoff extreme values with:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> model.Grid.Temp[model.Grid.Temp.<20] .= 20;\njulia> model.Grid.Temp[model.Grid.Temp.>1350] .= 1350;\njulia> model.Grid\nLaMEM grid with constant Δ: \n nel : ([64], [64], [32])\n marker/cell : (3, 3, 3)\n x ϵ [-50.0 : 50.0]\n y ϵ [-40.0 : 40.0]\n z ϵ [-80.0 : 15.0]\n Phases : range ϵ [0 - 0]\n Temp : range ϵ [20.0 - 1350.0]","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Set Phases to two everywhere:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> model.Grid.Phases .= 2;","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Now set points above the topography to zero (will be air later), the ones above the topography but below zero to 'water` and below 40 km to mantle (if we had a Moho surface we could use that):","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":" julia> above_surface!(model, Topo_LaMEM, phase=0, T=0)\n julia> model.Grid.Phases[Z.<-0 .&& model.Grid.Phases .== 0] .= 1;\n julia> model.Grid.Phases[Z.<-40] .= 3;","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Finally, we define some magma chambers:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> add_sphere!(model, cen=(0,0,-35), radius=5, phase=ConstantPhase(5), T=ConstantTemp(1200));\njulia> add_ellipsoid!(model, cen=(-1,0,-11), axes=(3,3,8), StrikeAngle=225, DipAngle=45, phase=ConstantPhase(5), T=ConstantTemp(1200));\njulia> add_ellipsoid!(model, cen=(-0,0,-23), axes=(8,8,2), StrikeAngle=0, DipAngle=0, phase=ConstantPhase(5), T=ConstantTemp(1200));","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"We can plot a cross-section through the model:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":" julia> plot_cross_section(model, x=0, field=:phase)","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"(Image: LaPalma_CrossSection)","category":"page"},{"location":"juliasetup_LaPalma/#Set-material-properties","page":"Example 2: Volcano","title":"Set material properties","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"First, we set air and water properties:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> air = set_air(alpha=3e-5, G=1e10, nu=0.2, ch=10e6, fr=30)\nPhase 0 (air): \n rho = 100.0 \n eta = 1.0e17 \n G = 1.0e10 \n nu = 0.2 \n ch = 1.0e7 \n fr = 30.0 \n alpha = 3.0e-5 \n Cp = 1000.0 \n k = 30.0 \njulia> water=deepcopy(air); water.Name=\"water\"; water.ID=1","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Next, we set the crust:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> crust = Phase(Name=\"Crust\", ID=2, rho=2900, alpha=3e-5, disl_prof=\"Mafic_Granulite-Ranalli_1995\",\n G=3e10, nu=0.2, k=3, Cp=1000, ch=10e6, fr=30)\nPhase 2 (Crust): \n rho = 2900.0 \n disl_prof = Mafic_Granulite-Ranalli_1995 \n G = 3.0e10 \n nu = 0.2 \n ch = 1.0e7 \n fr = 30.0 \n alpha = 3.0e-5 \n Cp = 1000.0 \n k = 3.0 ","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"The mantle is done as a copy of that, while changing a few parameters:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":" julia> mantle = copy_phase(crust, Name=\"Mantle\", ID=3, rho=3320.0, disl_prof=\"Dry_Olivine-Ranalli_1995\", G=6.5e10, k=3.3);","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"And we define two different types of magma:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> andesite = Phase(Name=\"andesitic_magma\",ID=4,rho=2700, alpha=3e-5, eta=1e18, G=1.5e10, nu=0.2, k=3, Cp=1000, T=980, ch=1e7, fr=30);\njulia> dacite = copy_phase(andesite,Name=\"dacite_magma\", ID=5, rho=2575.0, eta=1e19, T=800.0)","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Now we add all of this to the model:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> rm_phase!(model)\njulia> add_phase!(model, air, water, crust, mantle, andesite, dacite)","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"And check that we indeed have 6 phases:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> model\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(64, 64, 32); xϵ(-50.0, 50.0), yϵ(-40.0, 40.0), zϵ(-80.0, 15.0) \n|-- Time : nstep_max=50; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 0 phases; ","category":"page"},{"location":"juliasetup_LaPalma/#Add-topography-to-model","page":"Example 2: Volcano","title":"Add topography to model","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"We can add the topography grid that we created earlier to the model with:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> add_topography!(model, Topo_LaMEM)","category":"page"},{"location":"juliasetup_LaPalma/#Set-solver-options","page":"Example 2: Volcano","title":"Set solver options","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"You will want to use a multigrid solver in this case:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> model.Solver = Solver(SolverType=\"multigrid\", MGLevels=4)","category":"page"},{"location":"juliasetup_LaPalma/#3.-Run-LaMEM","page":"Example 2: Volcano","title":"3. Run LaMEM","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Running LaMEM is simple; here on 4 processors:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> run_lamem(model, 4)\nSaved file: Model3D.vts\nWritten LaMEM topography file: topography.txt\nWriting LaMEM marker file -> ./markers/mdb.00000000.dat\nWriting LaMEM marker file -> ./markers/mdb.00000001.dat\nWriting LaMEM marker file -> ./markers/mdb.00000002.dat\nWriting LaMEM marker file -> ./markers/mdb.00000003.dat\n-------------------------------------------------------------------------- \n Lithosphere and Mantle Evolution Model \n Compiled: Date: Apr 7 2023 - Time: 22:11:23 \n Version : 1.2.4 \n-------------------------------------------------------------------------- \n STAGGERED-GRID FINITE DIFFERENCE CANONICAL IMPLEMENTATION \n-------------------------------------------------------------------------- \nParsing input file : output.dat \nFinished parsing input file : output.dat \n--------------------------------------------------------------------------\nScaling parameters:\n Temperature : 1000. [C/K] \n Length : 1000. [m] \n Viscosity : 1e+20 [Pa*s] \n Stress : 1e+09 [Pa] \n--------------------------------------------------------------------------","category":"page"},{"location":"listfunctions/#List-of-all-functions","page":"List of functions","title":"List of all functions","text":"","category":"section"},{"location":"listfunctions/","page":"List of functions","title":"List of functions","text":"These are all functions that are available in the package, which can roughly be divided into two groups (running & reading LaMEM)","category":"page"},{"location":"listfunctions/#Julia-interface-to-LaMEM","page":"List of functions","title":"Julia interface to LaMEM","text":"","category":"section"},{"location":"listfunctions/","page":"List of functions","title":"List of functions","text":"Modules = [ LaMEM.LaMEM_Model]","category":"page"},{"location":"listfunctions/#Running-LaMEM","page":"List of functions","title":"Running LaMEM","text":"","category":"section"},{"location":"listfunctions/","page":"List of functions","title":"List of functions","text":"Modules = [LaMEM.Run]","category":"page"},{"location":"listfunctions/#LaMEM.Run.deactivate_multithreading-Tuple{Cmd}","page":"List of functions","title":"LaMEM.Run.deactivate_multithreading","text":"deactivate_multithreading(cmd)\n\nThis deactivates multithreading\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.Run.execute_command","page":"List of functions","title":"LaMEM.Run.execute_command","text":"str = execute_command(command=\"ls\")\n\nExecutes a command-line code and returns the output as a string\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.Run.extract_info_logfile-Tuple{Any, String}","page":"List of functions","title":"LaMEM.Run.extract_info_logfile","text":"value = extract_info_logfile(lines, keyword::String; entry=1, LaMEM=true)\n\nInternal function to extract information from the logfile\n\nNote that the LaMEM keywords should contain \":\" at the end, while the PETSc keywords should not, but we have to indicate the entry number for the PETSc keywords. Example LaMEM keyword:\n\njulia> val = extract_info_logfile(lines, \"Fine grid cells [nx, ny, nz] :\")\n\"[512, 256, 256]\"\n\nExample PETSc keyword:\n\njulia> coarse_grid_solve = extract_info_logfile(lines, \"MGSmooth Level 0\", LaMEM=false, entry=3)\n9.9174\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.Run.read_LaMEM_logfile-Tuple{String}","page":"List of functions","title":"LaMEM.Run.read_LaMEM_logfile","text":"This reads a LaMEM logfile (provided it was run with \"-log_view\") and collects key results from it; mostly for scalability tests on HPC machines. It returns a markdown summary\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.Run.remove_popup_messages_mac-Tuple{}","page":"List of functions","title":"LaMEM.Run.remove_popup_messages_mac","text":"remove_popup_messages_mac()\n\nOn a Mac with firewall enabled, running LaMEM will result in a popup window that says: \"Accept incoming connections\" which you should Allow or Deny. This is a bit annoying, so this julia script fixes that. Note that you must have administrator rights on your machine as we need to run \"sudo\"\n\nRun this script from the terminal with\n\njulia> remove_popup_messages_mac()\n\nYou need to do this once (every time a new version is installed)\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.Run.run_lamem","page":"List of functions","title":"LaMEM.Run.run_lamem","text":"run_lamem(ParamFile::String, cores::Int64=1, args:String=\"\"; wait=true, deactivate_multithreads=true)\n\nThis starts a LaMEM simulation, for using the parameter file ParamFile on cores number of cores. Optional additional command-line parameters can be specified with args.\n\nExample:\n\nYou can call LaMEM with:\n\njulia> using LaMEM\njulia> ParamFile=\"../../input_models/BuildInSetups/FallingBlock_Multigrid.dat\";\njulia> run_lamem(ParamFile)\n\nDo the same on 2 cores with a command-line argument as:\n\njulia> ParamFile=\"../../input_models/BuildInSetups/FallingBlock_Multigrid.dat\";\njulia> run_lamem(ParamFile, 2, \"-nstep_max = 1\")\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.Run.run_lamem_save_grid","page":"List of functions","title":"LaMEM.Run.run_lamem_save_grid","text":"ProcessorPartFile = run_lamem_save_grid(ParamFile::String, cores::Int64=1; verbose=true, directory=pwd())\n\nThis calls LaMEM simulation, for using the parameter file ParamFile and creates processor partitioning file \"ProcessorPartitioning_Xcpu_X.Y.Z.bin\" for {X} number of cores. \n\nExample:\n\njulia> using LaMEM\njulia> ParamFile=\"../../input_models/BuildInSetups/FallingBlock_Multigrid.dat\";\njulia> ProcessorPartFile = run_lamem_save_grid(ParamFile, 2)\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.Run.show_paths_LaMEM-Tuple{}","page":"List of functions","title":"LaMEM.Run.show_paths_LaMEM","text":"show_paths_LaMEM()\n\nThe downloaded LaMEM binaries can also be called from outside julia (directly from the terminal). In that case, you will need to set load correct dynamic libraries (such as PETSc) and call the correct binaries.\n\nThis function shows this for your system. \n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#Reading-LaMEM-output-back-into-julia","page":"List of functions","title":"Reading LaMEM output back into julia","text":"","category":"section"},{"location":"listfunctions/","page":"List of functions","title":"List of functions","text":"Modules = [LaMEM.IO_functions]","category":"page"},{"location":"listfunctions/#LaMEM.IO_functions.ArrayToTuple-Tuple{Any}","page":"List of functions","title":"LaMEM.IO_functions.ArrayToTuple","text":"data_Field = ArrayToTuple(data_Field)\n\nTransfers a 3D array (n>1) to a tuple of length n.\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.ReadField_3D_pVTR-Tuple{Any, Any}","page":"List of functions","title":"LaMEM.IO_functions.ReadField_3D_pVTR","text":"output, isCell = ReadField_3D_pVTR(data, FieldName::String)\n\nExtracts a 3D data field from a pVTR data structure data\n\nInput:\n\ndata: Data structure obtained with ReadVTRFile\nFieldName: Exact name of the field as specified in the *.vtr file\n\nOutput:\n\ndata_field, isCell: 3D field with data, and a flag that indicates whether it is Cell data (PointData otherwise) data_field is a tuple of size 1, or 3 depending on whether it is a scalar or vector field\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.ReadField_3D_pVTS-Tuple{Any, Any}","page":"List of functions","title":"LaMEM.IO_functions.ReadField_3D_pVTS","text":"data_out, isCell = ReadField_3D_pVTS(pvts, FieldName)\n\ninternal routine to read a 3D pvts file\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.ReadField_3D_pVTU-Tuple{Any, Any}","page":"List of functions","title":"LaMEM.IO_functions.ReadField_3D_pVTU","text":"output, isCell = ReadField_3D_pVTU(data, FieldName::String)\n\nExtracts a 3D data field from a pVTU data structure data Input:\n\ndata: Data structure obtained with ReadVTRFile\nFieldName: Exact name of the field as specified in the *.vtr file\n\nOutput:\n\ndata_field: Array with data, data_field is a tuple of size 1, 3 or 9 depending on whether it is a scalar, vector or tensor field\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.changefolder-Tuple{}","page":"List of functions","title":"LaMEM.IO_functions.changefolder","text":"changefolder()\n\nStarts a GUI on Windowss or Mac machines, which allows you to change our working directory\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.clean_directory","page":"List of functions","title":"LaMEM.IO_functions.clean_directory","text":"clean_directory(DirName)\n\nRemoves all LaMEM timesteps & *.pvd files from the directory DirName\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.IO_functions.compress_pvd-Tuple{String}","page":"List of functions","title":"LaMEM.IO_functions.compress_pvd","text":"compress_pvd(filename_pvd::String; Dir=pwd(), delete_original_files=false)\n\nThis compresses all LaMEM VTR files in a simulation.\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.compress_vtr_file-Tuple{String}","page":"List of functions","title":"LaMEM.IO_functions.compress_vtr_file","text":"filename_compressed::String = compress_vtr_file(filename::String; Dir=pwd(), delete_original_files=false)\n\nCompresses a LaMEM VTR file (loads parallel files & save them again )\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.passivetracer_time","page":"List of functions","title":"LaMEM.IO_functions.passivetracer_time","text":"PT = passivetracer_time(ID::Union{Vector{Int64},Int64}, FileName::String, DirName::String=\"\")\n\nThis reads passive tracers with ID from a LaMEM simulation, and returns a named tuple with the temporal evolution of these passive tracers. We return x,y,z coordinates and all fields specified in the FileName for particles number ID.\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.IO_functions.readPVD-Tuple{String}","page":"List of functions","title":"LaMEM.IO_functions.readPVD","text":"FileNames, Time, Timestep = readPVD(FileName::String)\n\nThis reads a PVD file & returns the FileNames, Time and Timesteps\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_PVTR_file-Tuple{String, String}","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_PVTR_file","text":"data_output = read_LaMEM_PVTR_file(DirName, FileName; fields=nothing)\n\nReads a 3D LaMEM timestep from VTR file FileName, located in directory DirName. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.\n\nIt will return data_output which is a CartData output structure.\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_PVTS_file-Tuple{String, String}","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_PVTS_file","text":"data_output = read_LaMEM_PVTS_file(DirName, FileName; field=nothing)\n\nReads a 3D LaMEM timestep from VTS file FileName, located in directory DirName. Typically this is done to read passive tracers back into julia. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.\n\nIt will return data_output which is a CartData output structure.\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_PVTU_file-Tuple{Any, Any}","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_PVTU_file","text":"data_output = read_LaMEM_PVTU_file(DirName, FileName; fields=nothing)\n\nReads a 3D LaMEM timestep from VTU file FileName, located in directory DirName. Typically this is done to read passive tracers back into julia. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.\n\nIt will return data_output which is a CartData output structure.\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_fieldnames","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_fieldnames","text":"read_LaMEM_fieldnames(FileName::String, DirName_base::String=\"\"; phase=false, surf=false, tracers=false)\n\nReturns the names of the datasets stored in FileName\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_simulation","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_simulation","text":"Timestep, FileNames, Time = read_LaMEM_simulation(FileName::String, DirName::String=\"\"; phase=false, surf=false, passive_tracers=false)\n\nReads a LaMEM simulation FileName in directory DirName and returns the timesteps, times and filenames of that simulation.\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_timestep","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_timestep","text":"data, time = read_LaMEM_timestep(FileName::String, TimeStep::Int64=0, DirName::String=\"\"; fields=nothing, phase=false, surf=false, last=false)\n\nThis reads a LaMEM timestep.\n\nInput Arguments:\n\nFileName: name of the simulation, w/out extension\nTimestep: timestep to be read, unless last=true in which case we read the last one\nDirName: name of the main directory (i.e. where the *.pvd files are located)\nfields: Tuple with optional fields; if not specified all will be loaded\nphase: Loads the phase information of LaMEM if true\nsurf: Loads the free surface of LaMEM if true\npassive_tracers: Loads passive tracers if true\nlast: Loads the last timestep\n\nOutput:\n\ndata: Cartesian data struct with LaMEM output\ntime: The time of the timestep\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.IO_functions.read_phase_diagram-Tuple{String}","page":"List of functions","title":"LaMEM.IO_functions.read_phase_diagram","text":"out = read_phase_diagram(name::String)\n\nReads a phase diagram from a file name and returns a NamedTuple with temperature T, pressure P, melt density ρ_melt, solid density ρ_solid, density ρ and melt fraction ϕ\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.split_path_name-Tuple{String, String}","page":"List of functions","title":"LaMEM.IO_functions.split_path_name","text":"dir, file = split_path_name(DirName_base::String, FileName::String)\n\nRoutine that splits the name in a directory DirName_base and a filename FileName\n\n\n\n\n\n","category":"method"},{"location":"juliasetup_TMSubduction/#2D-Thermomechanical-subduction-model","page":"Example 3: 2D Subduction","title":"2D Thermomechanical subduction model","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"In this example, we will show how to create a 2D thermomechanical model of subduction. Here the setup is saved into a julia script. First create a textfile called TM_Subduction_example.jl in your current directory. The easiest is to use Visual Studio Code for this, but you can in principle use any text editor.","category":"page"},{"location":"juliasetup_TMSubduction/#1.-Load-necessary-packages","page":"Example 3: 2D Subduction","title":"1. Load necessary packages","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Next start julia in the directory where you saved TM_Subduction_example.jl, or go to correct directory within julia ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Note that you can do the following steps directy from the julia REPL (command prompt), or you can write them in TM_Subduction_example.jl and run that file by typing","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> include(\"TM_Subduction_example.jl\")","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We get started by loading the required packages:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"using LaMEM, GeophysicalModelGenerator, Plots","category":"page"},{"location":"juliasetup_TMSubduction/#2.-LaMEM-model-setup","page":"Example 3: 2D Subduction","title":"2. LaMEM model setup","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"The setup will include 6 different materials with the following ID's:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"# material id's\n# 0: asthenosphere\n# 1: oceanic crust\n# 2: oceanic lithosphere\n# 3: continental crust\n# 4: continental lithosphere\n# 5: air layer","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model = Model(Grid( x = [-2000.,2000.],\n y = [-2.5,2.5], # <- model is 2D, size in y-direction is choosen to be close to a cube shape for the cell\n z = [-660,40] ,\n nel = (512,1,128) ),\n\n BoundaryConditions( temp_bot = 1565.0,\n temp_top = 20.0,\n open_top_bound = 1),\n Scaling(GEO_units( temperature = 1000,\n stress = 1e9Pa,\n length = 1km,\n viscosity = 1e20Pa*s) ),\n Time(nstep_max=20) ) ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"This initializes the initial LaMEM model setup with a number of default options. On the REPL it will show the following info","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"LaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(512, 1, 128); xϵ(-2000.0, 2000.0), yϵ(-8.0, 8.0), zϵ(-660.0, 40.0) \n|-- Time : nstep_max=20; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 0 phases; ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"In this case we assume that we have dimensions in kilometers and times in million years (the default).","category":"page"},{"location":"juliasetup_TMSubduction/#Inspecting/modifying-parameters","page":"Example 3: 2D Subduction","title":"Inspecting/modifying parameters","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Each of the parameters in this model setup can be modified. The easiest way to see what is available is by using the REPL. If you type ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> model.","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"and now use your TAB button, you will see all the fields within the model structure:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> model.\nBoundaryConditions FreeSurface Grid Materials ModelSetup Output Scaling SolutionParams\nSolver Time","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"If you want to see which timestepping parameters are set, you type:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> model.Time\nLaMEM Timestepping parameters: \n time_end = 1.0 \n dt = 0.05 \n dt_min = 0.01 \n dt_max = 0.2 \n dt_out = 0.2 \n inc_dt = 0.1 \n CFL = 0.5 \n CFLMAX = 0.8 \n nstep_max = 20 \n nstep_out = 1 \n nstep_rdb = 100 \n nstep_ini = 1 \n time_tol = 1.0e-8 ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"The parameters that are changed from the default settings are highlighted in blue (not visible on this markdown document, but visible in the REPL). ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"If you want to see what each of these parameters mean, you can get some basic help with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"help?> Time\nsearch: Time time Timer time_ns timedwait mtime ctime @time @timev @timed @time_imports @showtime optimize_ticks optimize_datetime_ticks read_LaMEM_timestep\n\n Structure that contains the LaMEM timestepping information. An explanation of the paramneters is given in the struct `Time_info`\n • time_end::Float64: simulation end time\n • dt::Float64: initial time step\n • dt_min::Float64: minimum time step (declare divergence if lower value is attempted)\n • dt_max::Float64: maximum time step\n • dt_out::Float64: output step (output at least at fixed time intervals)\n • inc_dt::Float64: time step increment per time step (fraction of unit)\n • CFL::Float64: CFL (Courant-Friedrichs-Lewy) criterion\n • CFLMAX::Float64: CFL criterion for elasticity\n • nstep_max::Int64: maximum allowed number of steps (lower bound: timeend/dtmax)\n • nstep_out::Int64: save output every n steps; Set this to -1 to deactivate saving output\n • nstep_rdb::Int64: save restart database every n steps\n • num_dt_periods::Int64: number of time stepping periods\n • time_dt_periods::Vector{Int64}: timestamps where timestep should be fixed (first entry has to 0)\n • step_dt_periods::Vector{Float64}: target timesteps ar timestamps above\n • nstep_ini::Int64: save output for n initial steps\n • time_tol::Float64: relative tolerance for time comparisons","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"If you want to change one of the parameters, say the maximum number of timesteps, you can do that with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> model.Time.nstep_max=100\n100","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"You can verify that this has been changed with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> model.Time\nLaMEM Timestepping parameters: \n time_end = 1.0 \n dt = 0.05 \n dt_min = 0.01 \n dt_max = 0.2 \n dt_out = 0.2 \n inc_dt = 0.1 \n CFL = 0.5 \n CFLMAX = 0.8 \n nstep_max = 100 \n nstep_out = 1 \n nstep_rdb = 100 \n nstep_ini = 1 \n time_tol = 1.0e-8 ","category":"page"},{"location":"juliasetup_TMSubduction/#Set-timestepping-parameters","page":"Example 3: 2D Subduction","title":"Set timestepping parameters","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Ok, lets change a few parameters at the same time. Here the maximum time (time_end) is set to a large value (2000 Myrs) as we want to limit the simulation using nstep_max = 400, which implies that we will perform 400 timesteps","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Time = Time( time_end = 2000.0,\n dt = 0.001,\n dt_min = 0.000001,\n dt_max = 0.1,\n nstep_max = 400,\n nstep_out = 10\n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Note that you can achieve the same results with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Time.time_end = 2000.0\nmodel.Time.dt = 0.001\nmodel.Time.dt_min = 0.000001\nmodel.Time.dt_max = 0.1\nmodel.Time.nstep_max = 400\nmodel.Time.nstep_out = 10","category":"page"},{"location":"juliasetup_TMSubduction/#Set-solution-parameters","page":"Example 3: 2D Subduction","title":"Set solution parameters","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We activate shear heating and adiabatic heating, as well as thermal diffusion, and set the minimum and maximum viscosities of the model as:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.SolutionParams = SolutionParams( shear_heat_eff = 1.0,\n Adiabatic_Heat = 1.0,\n act_temp_diff = 1,\n eta_min = 5e18,\n eta_ref = 1e21,\n eta_max = 1e25,\n min_cohes = 1e3\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Set-surface-topography","page":"Example 3: 2D Subduction","title":"Set surface topography","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"In our simulation, we want to take a free surface into account. In LaMEM that is done with a sticky air layer (phase 5 here), combined with a mesh that tracks the location of the free surface. You need to activate the free surface, tell LaMEM which phase is the sticky air phase and what the initial free surface level is at the beginning of the simulation (0 km). Do that with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.FreeSurface = FreeSurface( surf_use = 1, # free surface activation flag\n surf_corr_phase = 1, # air phase ratio correction flag (due to surface position)\n surf_level = 0.0, # initial level\n surf_air_phase = 5, # phase ID of sticky air layer\n surf_max_angle = 40.0 # maximum angle with horizon (smoothed if larger))\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Set-model-output","page":"Example 3: 2D Subduction","title":"Set model output","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We update the list of fields saved as output:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Output = Output( out_density = 1,\n out_j2_strain_rate = 1,\n out_surf = 1, \t\n out_surf_pvd = 1,\n out_surf_topography = 1,\n out_j2_dev_stress = 1,\n out_pressure = 1,\n out_temperature = 1, )","category":"page"},{"location":"juliasetup_TMSubduction/#Set-some-background-properties,-later-overwritten","page":"Example 3: 2D Subduction","title":"Set some background properties, later overwritten","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"The model geometry in LaMEM is defined by two arrays: model.Grid.Temp and model.Grid.Phase which sets the initial temperature and phase at every point. These are 3D arrays that can be modified; in the usual case temperatures are assumed to be in Celcius, and the phases are integers (0-5 here). ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Lets specify a few helpful parameters, such as the adiabatic temperature throughout the model (0.4°C/km) and the mantle potential temperature at the surface 1280°C:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Tair = 20.0;\nTmantle = 1280.0;\nAdiabat = 0.4","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Next, we set the temperature everwhere to (will be overwrittem later) and all phases to 0 with","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Grid.Temp .= Tmantle .+ 1.0; # set mantle temperature (without adiabat at first)\nmodel.Grid.Phases .= 0; # Set Phases to 0 everywhere (0 is/will be asthenosphere in this setup):","category":"page"},{"location":"juliasetup_TMSubduction/#Setup-temperature-of-the-air-to-be-20C","page":"Example 3: 2D Subduction","title":"Setup temperature of the air to be 20°C","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Next we set all \"air\" particles to Tair: ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Grid.Temp[model.Grid.Grid.Z .> 0] .= Tair;","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We can quickly verify that this has been done on the REPL with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia>julia> model.Grid\nLaMEM grid with constant Δ: \n nel : ([512], [1], [128])\n marker/cell : (3, 3, 3)\n x ϵ [-2000.0 : 2000.0]\n y ϵ [-8.0 : 8.0]\n z ϵ [-660.0 : 40.0]\n Phases : range ϵ [0 - 0]\n Temp : range ϵ [20.0 - 1281.0]","category":"page"},{"location":"juliasetup_TMSubduction/#Setup-the-air-layer-(id-5)-if-Z-0.0","page":"Example 3: 2D Subduction","title":"Setup the air layer (id = 5) if Z > 0.0","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Set the air particles to 5:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Grid.Phases[model.Grid.Grid.Z .> 0.0 ] .= 5;","category":"page"},{"location":"juliasetup_TMSubduction/#Add-left-oceanic-plate","page":"Example 3: 2D Subduction","title":"Add left oceanic plate","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"An oceanic plate can be added using the add_box!() function of the GeophysicalModelGenerator package (see ?GeophysicalModelGenerator.add_box! for more information, or check out the online help of the package). The lithosphere to asthenosphere temperature is set to 1250°C. If temperature of the plate is > 1250°C then the material is turned to asthenosphere. The temperature profile of the plate is set using a half space cooling temperature and a spreading rate velocity of 0.5 cm/yr with the ridge prescribed to be at the \"left\" of the box.","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_box!(model; xlim = (-2000.0, 0.0), \n ylim = (model.Grid.coord_y...,), \n zlim = (-660.0, 0.0),\n Origin = nothing, StrikeAngle=0, DipAngle=0,\n phase = LithosphericPhases(Layers=[20 80], Phases=[1 2 0] ),\n T = SpreadingRateTemp( Tsurface = Tair,\n Tmantle = Tmantle,\n MORside = \"left\",\n SpreadingVel= 0.5,\n AgeRidge = 0.01;\n maxAge = 80.0 ) )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-right-oceanic-plate","page":"Example 3: 2D Subduction","title":"Add right oceanic plate","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Same for the plate on the right:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_box!(model; xlim = (1500, 2000), \n ylim = (model.Grid.coord_y..., ), \n zlim = (-660.0, 0.0),\n Origin = nothing, StrikeAngle=0, DipAngle=0,\n phase = LithosphericPhases(Layers=[20 80], Phases=[1 2 0] ),\n T = SpreadingRateTemp( Tsurface = Tair,\n Tmantle = Tmantle,\n MORside = \"right\",\n SpreadingVel= 0.5,\n AgeRidge = 0.01;\n maxAge = 80.0 ) )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-overriding-plate-margin","page":"Example 3: 2D Subduction","title":"Add overriding plate margin","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"For the overriding plate margin the age is fixed to 90 Ma using HalfspaceCoolingTemp().","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_box!(model; xlim = (0.0, 400.0), \n ylim = (model.Grid.coord_y[1], model.Grid.coord_y[2]), \n zlim = (-660.0, 0.0),\n Origin = nothing, StrikeAngle=0, DipAngle=0,\n phase = LithosphericPhases(Layers=[25 90], Phases=[3 4 0] ),\n T = HalfspaceCoolingTemp( Tsurface = Tair,\n Tmantle = Tmantle,\n Age = 80 ) )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-overriding-plate-craton","page":"Example 3: 2D Subduction","title":"Add overriding plate craton","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_box!(model; xlim = (400.0, 1500.0), \n ylim = (model.Grid.coord_y...,), \n zlim = (-660.0, 0.0),\n Origin = nothing, StrikeAngle=0, DipAngle=0,\n phase = LithosphericPhases(Layers=[35 100], Phases=[3 4 0] ),\n T = HalfspaceCoolingTemp( Tsurface = Tair,\n Tmantle = Tmantle,\n Age = 120 ) )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-pre-subducted-slab","page":"Example 3: 2D Subduction","title":"Add pre-subducted slab","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Here we change the dip angle of the box to 30° to initiates subduction:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_box!(model; xlim = (0.0, 300), \n ylim = (model.Grid.coord_y...,), \n zlim = (-660.0, 0.0),\n Origin = nothing, StrikeAngle=0, DipAngle=30,\n phase = LithosphericPhases(Layers=[30 80], Phases=[1 2 0], Tlab=1250 ),\n T = HalfspaceCoolingTemp( Tsurface = Tair,\n Tmantle = Tmantle,\n Age = 80 ) )","category":"page"},{"location":"juliasetup_TMSubduction/#Impose-approximate-adiabat","page":"Example 3: 2D Subduction","title":"Impose approximate adiabat","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We can add a mantle adiabatic temperature to the model with","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Grid.Temp = model.Grid.Temp - model.Grid.Grid.Z.*Adiabat;","category":"page"},{"location":"juliasetup_TMSubduction/#Plot-preview-of-the-setup","page":"Example 3: 2D Subduction","title":"Plot preview of the setup","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Cross-sections of the model setup showing the temperature and the phase fields can be visualized as follows:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"plot_cross_section(model, y=0, field=:temperature)\nplot_cross_section(model, y=0, field=:phase)","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"which gives: (Image: Subduction_CrossSection_phase) (Image: Subduction_CrossSection_temp)","category":"page"},{"location":"juliasetup_TMSubduction/#3.-Define-material-parameters","page":"Example 3: 2D Subduction","title":"3. Define material parameters","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"At this stage, we defined the geometry and thermal structures of the model, but we did yet assign material properties to each of the rocktypes.","category":"page"},{"location":"juliasetup_TMSubduction/#Softening-law","page":"Example 3: 2D Subduction","title":"Softening law","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We assume that rocks weaken/soften when they becomes damaged, which can be defined by a softening law. Post-softening strength is defined as 0.05 the initial strength","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"softening = Softening( ID = 0, \t\t\t# softening law ID\n APS1 = 0.1, \t\t\t# begin of softening APS\n APS2 = 0.5, \t\t\t# end of softening APS\n A = 0.95, \t\t # reduction ratio\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Material-thermal-and-rheological-properties","page":"Example 3: 2D Subduction","title":"Material thermal and rheological properties","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Mantle For the mantle, we use a dry olivine rheology:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"dryPeridotite = Phase( Name = \"dryPeridotite\", \n ID = 0, # phase id [-]\n rho = 3300.0, # density [kg/m3]\n alpha = 3e-5, # coeff. of thermal expansion [1/K]\n disl_prof = \"Dry_Olivine_disl_creep-Hirth_Kohlstedt_2003\",\n Vn = 14.5e-6,\n diff_prof = \"Dry_Olivine_diff_creep-Hirth_Kohlstedt_2003\",\n Vd = 14.5e-6,\n G = 5e10, # elastic shear module [MPa]\n k = 3, # conductivity\n Cp = 1000.0, # heat capacity\n ch = 30e6, # cohesion [Pa]\n fr = 20.0, # friction angle\t\n A = 6.6667e-12, # radiogenic heat production [W/kg]\n chSoftID = 0, \t # cohesion softening law ID\n frSoftID = 0, \t # friction softening law ID\n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Oceanic crust For the oceanic crust we use a low cohesion and a frictional angle equal to 0. The goal is to make the oceanic crust weak enough to lubricate the interface with the overriding plate and allow for self-sustained subduction. Moreover, as density is not pressure and temperature dependent, it is set to be the same as the mantle (3300) in order to be neutrally buoyant with respect to the rest of the lithosphere.","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"oceanicCrust = Phase( Name = \"oceanCrust\", \n ID = 1, # phase id [-]\n rho = 3300.0, # density [kg/m3]\n alpha = 3e-5, # coeff. of thermal expansion [1/K]\n disl_prof = \"Plagioclase_An75-Ranalli_1995\",\n G = 5e10, # elastic shear module [MPa]\n k = 3, # conductivity\n Cp = 1000.0, # heat capacity\n ch = 5e6, # cohesion [Pa]\n fr = 0.0, # friction angle\t\n A = 2.333e-10, # radiogenic heat production [W/kg]\n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Oceanic mantle lithosphere The oceanic mantle lithosphere has the same properties as the mantle but a different name and different phase. To simplify your life, you can use the copy_phase function for that:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"oceanicLithosphere = copy_phase( dryPeridotite,\n Name = \"oceanicLithosphere\",\n ID = 2\n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Continental crust","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"continentalCrust = copy_phase( oceanicCrust,\n Name = \"continentalCrust\",\n ID = 3,\n disl_prof = \"Quarzite-Ranalli_1995\",\n rho = 2700.0, \n ch = 30e6,\n fr = 20.0,\n A \t = 5.3571e-10,\n chSoftID \t = 0, \t \n frSoftID \t = 0, \t \n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Continental lithosphere","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"continentalLithosphere = copy_phase( dryPeridotite,\n Name = \"continentalLithosphere\",\n ID = 4\n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Sticky air","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Finally, the \"air\" in our model is a layer with low density and low viscosity, such that it essentially gives very low stresses compared to those within the lithosphere. We cannot give it the viscosity of real air, as this results in a too large viscosity jump at the surface (geodynamic codes cannot handle that). We therefore also often call this \"sticky air\". Note that we also give it a very high thermal conductivity to ensure that the temperature within the air layer remains more or less constant throughout a simulation (and equal to the temperature at the upper boundary of the model):","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"air = Phase( Name = \"air\", \n ID = 5, # phase id [-]\n rho = 50.0, # density [kg/m3] # coeff. of thermal expansion [1/K]\n eta = 1e19,\n G = 5e10, # elastic shear module [MPa]\n k = 100, # conductivity\n Cp = 1e6, # heat capacity\n ch = 10e6, # cohesion [MPa]\n fr = 0.0, # friction angle\t\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-phases-to-the-model","page":"Example 3: 2D Subduction","title":"Add phases to the model","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Finally, we can add all these phases to the model with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"rm_phase!(model)\nadd_phase!( model, \n dryPeridotite,\n oceanicCrust,\n oceanicLithosphere,\n continentalCrust,\n continentalLithosphere,\n air\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-softening-law","page":"Example 3: 2D Subduction","title":"Add softening law","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Same with the softening law:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_softening!( model,\n softening\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Set-solver-options","page":"Example 3: 2D Subduction","title":"Set solver options","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"The PETSc command -da_refine_y 1 allow to run the model as 2D","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Solver = Solver( SolverType = \"multigrid\",\n MGLevels = 3,\n MGCoarseSolver \t= \"superlu_dist\",\n PETSc_options = [ \"-snes_ksp_ew\",\n \"-snes_ksp_ew_rtolmax 1e-4\",\n \"-snes_rtol 5e-3\",\t\t\t\n \"-snes_atol 1e-4\",\n \"-snes_max_it 200\",\n \"-snes_PicardSwitchToNewton_rtol 1e-3\", \n \"-snes_NewtonSwitchToPicard_it 20\",\n \"-js_ksp_type fgmres\",\n \"-js_ksp_max_it 20\",\n \"-js_ksp_atol 1e-8\",\n \"-js_ksp_rtol 1e-4\",\n \"-snes_linesearch_type l2\",\n \"-snes_linesearch_maxstep 10\",\n \"-da_refine_y 1\"\n ]\n )","category":"page"},{"location":"juliasetup_TMSubduction/#4.-Perform-the-simulation","page":"Example 3: 2D Subduction","title":"4. Perform the simulation","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Here we run LaMEM on 8 cores (if you have them; use less otherwise):","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> run_lamem(model, 8)\nSaved file: Model3D.vts\n(Nprocx, Nprocy, Nprocz, xc, yc, zc, nNodeX, nNodeY, nNodeZ) = (4, 1, 2, [-2000.0, -1000.0, 0.0, 1000.0, 2000.0], [-8.0, 8.0], [-660.0, -310.0, 40.0], 513, 2, 129)\nWriting LaMEM marker file -> ./markers/mdb.00000000.dat\nWriting LaMEM marker file -> ./markers/mdb.00000001.dat\nWriting LaMEM marker file -> ./markers/mdb.00000002.dat\nWriting LaMEM marker file -> ./markers/mdb.00000003.dat\nWriting LaMEM marker file -> ./markers/mdb.00000004.dat\nWriting LaMEM marker file -> ./markers/mdb.00000005.dat\nWriting LaMEM marker file -> ./markers/mdb.00000006.dat\nWriting LaMEM marker file -> ./markers/mdb.00000007.dat\n-------------------------------------------------------------------------- \n Lithosphere and Mantle Evolution Model \n Compiled: Date: Apr 7 2023 - Time: 22:11:23 \n Version : 1.2.4 \n-------------------------------------------------------------------------- \n STAGGERED-GRID FINITE DIFFERENCE CANONICAL IMPLEMENTATION \n-------------------------------------------------------------------------- \nParsing input file : output.dat \nFinished parsing input file : output.dat \n--------------------------------------------------------------------------\nScaling parameters:\n Temperature : 1000. [C/K] \n Length : 1000. [m] \n Viscosity : 1e+20 [Pa*s] \n Stress : 1e+09 [Pa] ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"The results will be saved in the directory where you performed the simulation and can be visualized in Paraview by opening the file output.pvd: (Image: 2D thermomechanical subduction)","category":"page"},{"location":"juliasetup_TMSubduction/#Remark-on-performing-parallel-simulations","page":"Example 3: 2D Subduction","title":"Remark on performing parallel simulations","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Using more processors or cores does not necessarily imply that the simulation will be faster. There is a tradeoff between the number of processors, the resolution, the number of multigrid levels, the machine you use and the speed of the simulation. At some stage it actually becomes slower! ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Unfortunately, it is hard to predict when this happens as this is setup- and machine-dependent. We can thus not automatize this, and our recommendation is therefore that you experiment with this. Run the simulation for a limited number of timesteps (say 5 or so) and check its speed for different number of cores.","category":"page"},{"location":"installation_HPC/#Installation-on-HPC-systems","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"","category":"section"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Installing LaMEM on high performance computer (HPC) systems can be complicated, because you will have to compile PETSc with the correct dependencies for that system. The reason is that HPC systems use MPI versions that are specifically tailored/compiled for that system. ","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Warning: the explanation below is still somewhat experimental and may not work on your system The best approach of running LaMEM on large HPC systems remains to install the correct version of PETSc using the locally recommended MPI libraries and install the correct version of LaMEM with that. You can still save the input setup to file, for the correct number or processors using LaMEM.jl. The locally generated *.dat file will still work.","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Luckily there is a solution thanks to the great work of @eschnett and colleagues, who developed MPITrampoline which is an intermediate layer between the HPC-system-specific MPI libraries and the precompiled LaMEM binaries. ","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"It essentially consists of two steps: 1) compile a small package (MPIwrapper) 2) make sure that you download the version of LaMEM that was compiled versus MPItrampoline.","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Here step-by-step instructions (for Linux, as that is what essentially all HPC systems use):","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Download MPIwrapper: ","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"$git clone https://github.com/eschnett/MPIwrapper.git \n$cd MPIwrapper","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Install it after making sure that mpiexec points to the one you want (you may have to load some modules, depending on your system):","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"$cmake -S . -B build -DMPIEXEC_EXECUTABLE=mpiexec -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/mpiwrapper\n$cmake --build build\n$cmake --install build","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"At this stage, MPItrampoline is installed in $HOME/mpiwrapper","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Set the correct wrapper:","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"$export MPITRAMPOLINE_LIB=$HOME/mpiwrapper/lib64/libmpiwrapper.so","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Depending on the system it may be called lib instead of lib64 (check!).","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Start julia and install the MPI and MPIPreferences packages:","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"$julia\njulia> ]\npkg>add MPI, MPIPreferences","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Set the preference to use MPItrampoline","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"julia> using MPIPreferences; MPIPreferences.use_jll_binary(\"MPItrampoline_jll\")\n┌ Info: MPIPreferences unchanged\n└ binary = \"MPItrampoline_jll\"","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Load MPI and verify it is the correct one","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"julia> using MPI\njulia> MPI.Get_library_version()\n\"MPIwrapper 2.10.3, using MPIABI 2.9.0, wrapping:\\nOpen MPI v4.1.4, package: Open MPI boris@Pluton Distribution, ident: 4.1.4, repo rev: v4.1.4, May 26, 2022\"","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"After this, restart julia (this only needs to be done once, next time all is fine).","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Now load LaMEM and check that it uses the mpitrampoline version:","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"julia> using MPI,LaMEM\njulia> LaMEM.LaMEM_jll.host_platform\nLinux x86_64 {cxxstring_abi=cxx11, julia_version=1.8.1, libc=glibc, libgfortran_version=5.0.0, mpi=mpitrampoline}","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"At this stage the precompiled version of LaMEM should be useable on that system.","category":"page"},{"location":"#LaMEM.jl","page":"Home","title":"LaMEM.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"This is the julia interface to LaMEM, which does a number of handy things:","category":"page"},{"location":"","page":"Home","title":"Home","text":"It will automatically download a binary installation of LaMEM, along with the correct version of PETSc and mpiexec for your system. You can also use these binaries directly from your terminal, so you are not limited to julia. Gone are the days where you had to first spend hours or days to install PETSc on your system!\nIt provides the functionality to setup a model, run it and plot the results with a few lines of julia.\nWe provide many default options\nYou can do this with Jupyter or Pluto notebooks\nWe provide a simple function to run LaMEM from julia (also in parallel), using classical LaMEM *.dat files\nWe provide functions to read timesteps back into julia and compress out ","category":"page"},{"location":"juliasetup_example_sphere/#1.-Example-1:-Falling-sphere","page":"Example 1: Sphere","title":"1. Example 1: Falling sphere","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"This is a first example that illustrates how to build a setup using the LaMEM.jl package, run it and visualize the results, all without leaving julia.","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"We start with loading the packages we need:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> using LaMEM, GeophysicalModelGenerator, Plots","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"The GeophysicalModelGenerator package can be used to generate model setups and Plots for plotting.","category":"page"},{"location":"juliasetup_example_sphere/#1.1-Define-model-setup","page":"Example 1: Sphere","title":"1.1 Define model setup","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Next, we define a general model setup, in which we specify the units with which we work (for most cases, you'll want to use the default GEO units), the size of the computational box and various timestepping parameters. In this case, we use a multigrid solver.","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> model = Model(Grid(nel=(16,16,16), x=[-1,1], y=[-1,1], z=[-1,1]), \n Time(nstep_max=20, dt_min=1e-3, dt=1, dt_max=10, time_end=100), \n Solver(SolverType=\"multigrid\", MGLevels=2),\n Output(out_dir=\"example_1\"))\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(16, 16, 16); xϵ(-1.0, 1.0), yϵ(-1.0, 1.0), zϵ(-1.0, 1.0) \n|-- Time : nstep_max=20; nstep_out=1; time_end=100.0; dt=1.0\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : multigrid solver; coarse grid solver=direct; 2 levels\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 0 phases; ","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Note that each of the fields within Model has many additional and adjustable parameters. You can view that by typing:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> model.Time\nLaMEM Timestepping parameters: \n time_end = 100.0 \n dt = 1.0 \n dt_min = 0.001 \n dt_max = 10.0 \n dt_out = 0.2 \n inc_dt = 0.1 \n CFL = 0.5 \n CFLMAX = 0.8 \n nstep_max = 20 \n nstep_out = 1 \n nstep_rdb = 100 \n nstep_ini = 1 \n time_tol = 1.0e-8 ","category":"page"},{"location":"juliasetup_example_sphere/#1.2-Specify-material-properties","page":"Example 1: Sphere","title":"1.2 Specify material properties","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Once this is specified, we need to set material properties for each of the Phases we will consider in the simulation. This can be done with the Phase structure. First, we define two phases","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> rm_phase!(model)\njulia> matrix = Phase(ID=0,Name=\"matrix\",eta=1e20,rho=3000)\nPhase 0 (matrix): \n rho = 3000.0 \n eta = 1.0e20 \njulia> sphere = Phase(ID=1,Name=\"sphere\",eta=1e23,rho=3200)\nPhase 1 (sphere): \n rho = 3200.0 \n eta = 1.0e23 ","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"and add them to the model with:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> add_phase!(model, sphere, matrix)","category":"page"},{"location":"juliasetup_example_sphere/#1.3-Set-initial-model-geometry","page":"Example 1: Sphere","title":"1.3 Set initial model geometry","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"We also need to specify an initial model geometry. The julia package GeophysicalModelGenerator has a number of functions for that, which can be used here. For the current setup, we just add a sphere: ","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, ))","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"It is often useful to plot the initial model setup. You can do this with the heatmap function from the Plots.jl package, for which we provide a LaMEM plugin that allows you to specify a cross-section through a 3D LaMEM setup:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> plot_cross_section(model, field=:phase, y=0)","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"(Image: InitialSetupSphere)","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"In the initial setup we define two fields: :phase which defines the rocktypes and :temperature which has the initial temperature. They are stored as 3D arrays in model.Grid.Phases and model.Grid.Temp:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> model.Grid\nLaMEM grid with constant Δ: \n nel : ([16], [16], [16])\n marker/cell : (3, 3, 3)\n x ϵ [-1.0 : 1.0]\n y ϵ [-1.0 : 1.0]\n z ϵ [-1.0 : 1.0]\n Phases : range ϵ [0 - 1]\n Temp : range ϵ [0.0 - 0.0]","category":"page"},{"location":"juliasetup_example_sphere/#1.4-Run-LaMEM","page":"Example 1: Sphere","title":"1.4 Run LaMEM","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"At this stage we are ready to run a LaMEM simulation which can simply be done with the run_lamem command. By default, it will run on one processor. If you want to run this in parallel, you can specify the number of cores you want to use. Please note that running things in parallel is only worth the effort for large resolutions; for smaller setups it will be faster on one processor:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> run_lamem(model,1)\nSaved file: Model3D.vts\nWriting LaMEM marker file -> ./markers/mdb.00000000.dat\n-------------------------------------------------------------------------- \n Lithosphere and Mantle Evolution Model \n Compiled: Date: Apr 7 2023 - Time: 22:11:23 \n Version : 1.2.4 \n-------------------------------------------------------------------------- \n STAGGERED-GRID FINITE DIFFERENCE CANONICAL IMPLEMENTATION \n-------------------------------------------------------------------------- \nParsing input file : output.dat \nFinished parsing input file : output.dat \n--------------------------------------------------------------------------\nScaling parameters:\n Temperature : 1000. [C/K] \n Length : 1e+06 [m] \n Viscosity : 1e+20 [Pa*s] \n Stress : 10. [Pa] \n--------------------------------------------------------------------------\nTime stepping parameters:\n Simulation end time : 100. [Myr] \n Maximum number of steps : 20 \n Time step : 1. [Myr] \n Minimum time step : 0.001 [Myr] \n Maximum time step : 10. [Myr] \n Time step increase factor : 0.1 \n CFL criterion : 0.5 \n CFLMAX (fixed time steps) : 0.8 \n Output every [n] steps : 1 \n Output [n] initial steps : 1 \n--------------------------------------------------------------------------\n--------------------------------------------------------------------------","category":"page"},{"location":"juliasetup_example_sphere/#1.5-Visualize-results","page":"Example 1: Sphere","title":"1.5 Visualize results","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Once the simulation is done, you can look at the results using the same heatmap function, but by specifying a timestep, which will read that timestep and plot a cross-section though it:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> plot_cross_section(model, y=0, timestep=20, field=:phase)\t","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"(Image: FallingSphere_t20)","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Alternatively, you can visualize the results with Paraview. Change to the directory where you did the simulation:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> cd(model.Output.out_dir)\njulia> readdir()\n25-element Vector{String}:\n \"Model3D.vts\"\n \"Timestep_00000000_0.00000000e+00\"\n \"Timestep_00000001_1.10000000e+00\"\n \"Timestep_00000002_2.31000000e+00\"\n \"Timestep_00000003_3.64100000e+00\"\n \"Timestep_00000004_5.10510000e+00\"\n \"Timestep_00000005_6.71561000e+00\"\n ⋮\n \"Timestep_00000017_4.45991731e+01\"\n \"Timestep_00000018_5.01590904e+01\"\n \"Timestep_00000019_5.62749995e+01\"\n \"Timestep_00000020_6.30024994e+01\"\n \"markers\"\n \"output.dat\"\n \"output.pvd\"","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"And you can open output.pvd with paraview. If your system recognizes that *.pvd files should be opened with paraview, you can do that with","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> ;\nshell> open output.pvd","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Otherwise, start paraview manually and open the file.","category":"page"}] +[{"location":"runlamem/#Run-LaMEM","page":"Run LaMEM","title":"Run LaMEM","text":"","category":"section"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"Go to the package manager & install it with:","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"julia>]\npkg>add LaMEM","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"It will automatically download a binary version of LaMEM which runs in parallel (along with the correct PETSc version). This will work on linux, mac and windows.","category":"page"},{"location":"runlamem/#Starting-a-simulation","page":"Run LaMEM","title":"Starting a simulation","text":"","category":"section"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"If you have a LaMEM (*.dat) input file, you can run in parallel (here on 4 cores) with:","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"julia> ParamFile=\"input_files/FallingBlock_Multigrid.dat\";\njulia> run_lamem(ParamFile, 4,\"-time_end 1\")\n-------------------------------------------------------------------------- \n Lithosphere and Mantle Evolution Model \n Compiled: Date: Sep 10 2022 - Time: 06:21:30 \n-------------------------------------------------------------------------- \n STAGGERED-GRID FINITE DIFFERENCE CANONICAL IMPLEMENTATION \n-------------------------------------------------------------------------- \nParsing input file : input_files/FallingBlock_Multigrid.dat \n Adding PETSc option: -snes_type ksponly\n Adding PETSc option: -js_ksp_monitor\n Adding PETSc option: -crs_pc_type bjacobi\nFinished parsing input file : input_files/FallingBlock_Multigrid.dat \n--------------------------------------------------------------------------\nTime stepping parameters:\n Simulation end time : 1. [ ] \n Maximum number of steps : 10 \n Time step : 10. [ ] \n Minimum time step : 1e-05 [ ] \n Maximum time step : 100. [ ] \n Time step increase factor : 0.1 \n CFL criterion : 0.5 \n CFLMAX (fixed time steps) : 0.5 \n Output time step : 0.2 [ ] \n Output every [n] steps : 1 \n Output [n] initial steps : 1 \n--------------------------------------------------------------------------","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"The last parameter are optional PETSc command-line options. By default it runs on one processor.","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"Please note that you will have to be in the correct directory or indicate where that directory is. If you are in a different directory, the easiest way to change to the correct one is by using the changefolder function (on Windows and Mac):","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"julia> changefolder()","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"Alternatively, you can use the build-in terminal/shell in julia, which you can access with:","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"julia>;\nshell>cd ~/LaMEM/input_models/BuildInSetups/","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"use the Backspace key to return to the julia REPL.","category":"page"},{"location":"runlamem/","page":"Run LaMEM","title":"Run LaMEM","text":"Once you have performed a simulation, you can look at the results by opening the *.pvd files with Paraview. In this example, that would be FB_multigrid.pvd and FB_multigrid_phase.pvd.","category":"page"},{"location":"readpassivetracers/#Initiate-passive-tracers-and-read-their-information","page":"Passive tracers","title":"Initiate passive tracers and read their information","text":"","category":"section"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Passive tracers are useful to track the evolutions of the temperature, pressure and their spatial positions of moving materials during the simulation. Passive tracers can be initiated when you start a new model, and they are the Lagrangian points that move with the materials. The initiation and extraction of information from passive tracers can be easily done using the following methods.","category":"page"},{"location":"readpassivetracers/#Initiate-passive-tracers-in-the-model","page":"Passive tracers","title":"Initiate passive tracers in the model","text":"","category":"section"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Let's use a simple model of a \"falling sphere\" as the example. We initiate the passive tracers by turning on the flag: Passive_Tracer=1 and assign a spatial range to populate tracers in the entire simulation box PassiveTracer_Box=[-1,1,-1,1,-1,1]). The default tracer density is 100 x 1 x 100 along x, y, z axes. ","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"using LaMEM, GeophysicalModelGenerator, Plots\n\nmodel = Model(Grid(nel=(16,16,16), x=[-1,1], y=[-1,1], z=[-1,1]), PassiveTracers(Passive_Tracer=1, PassiveTracer_Box=[-1,1,-1,1,-1,1]))\nmatrix = Phase(ID=0,Name=\"matrix\",eta=1e20,rho=3000)\nsphere = Phase(ID=1,Name=\"sphere\",eta=1e23,rho=3200)\nadd_phase!(model, sphere, matrix)\nadd_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5,))\n\nrun_lamem(model,1)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"The model output files should include a file called output_passive_tracers.pvd which you can visualize using ParaView. The image below shows the initial state (t=0) of all tracers. Different colors represent different phases of the tracers: Phase 0 is blue, Phase 1 is red.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"(Image: InitialSetupSphere)","category":"page"},{"location":"readpassivetracers/#Read-passive-tracers-information-back-to-Julia","page":"Passive tracers","title":"Read passive tracers information back to Julia","text":"","category":"section"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"We can check the overall passive tracers information at timestep = 0 using:","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"data,time = read_LaMEM_timestep(model, 0, passive_tracers=true)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"It returns:","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"(CartData \n size : (10000,)\n x ϵ [ -0.99 : 0.99]\n y ϵ [ 0.0 : 0.0]\n z ϵ [ -0.99 : 0.99]\n fields : (:Phase, :Temperature, :Pressure, :ID)\n, [0.0])","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"The data.x, data.y, and data.z are structures that contain spatial information of tracers while parameters such like data.fields.Phase contain the phase, temperature, pressure and index (ID) of tracers.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Sometimes we want to select tracers in a smaller region for further investigation. For example, to track the P-T-t evolution of a subducting slab, we can specify a region of interest (e.g., the upper crust portion of the slab) therefore select tracers within that region only.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"In the \"falling sphere\" example, let's find all the \"sphere phase\" tracers in the 1st quadrant (x>0, and z>0) of the sphere.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"ID = findall(data.x.val .> 0 .&& data.z.val .> 0 .&& data.fields.Phase .== 1)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"The ID parameter records the indices of these tracers. Note we need to do data.x.val to get the numerical value of the x-coordinate because data.x is a GeoUnit structure also containing unit, and isdimensional information. The dot in front of > and && implies that it is applied to every point the array data.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Once we select the tracers of interest (we now know the ID of these tracers), we can read their information.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"passive_tracers = passivetracer_time(ID,model)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Let's take a look at the passive_tracers, and see what information it contains:","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"# Retrieve the keys from the passive_tracers\nkeys_list = keys(passive_tracers)\n\n# Iterate over each key and print the size of the associated data\nfor key in keys_list\n data_size = size(passive_tracers[key])\n println(\"Key: $key, Size: $data_size\")\nend","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"It returns:","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Key: x, Size: (489, 4)\nKey: y, Size: (489, 4)\nKey: z, Size: (489, 4)\nKey: Phase, Size: (489, 4)\nKey: Temperature, Size: (489, 4)\nKey: Pressure, Size: (489, 4)\nKey: Time_Myrs, Size: (4,)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"The passive_tracers contains spatial coordinates and P, T, Phase properties and also the associated temporal information for all 4 time steps in matrixes. Now let's plot the position of selected tracer at t=0.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"using Plots\nscatter(passive_tracers.x[:,1], passive_tracers.z[:,1], title=\"Scatter Plot of Selected Passive Tracers\", legend=false, aspect_ratio=:equal)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"(Image: InitialSetupSphere)","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"We can plot a temporal evolution of P-T of a specific tracer. In the following line, we only select one tracer whose ID==1 among the 489 tracers we selected.","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"plot( passive_tracers.Temperature[1,:], passive_tracers.Pressure[1,:])","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"Since the example \"falling sphere\" code does not contain much dynamics and it only runs for a few timesteps, the resulted P-T path contain little information. ","category":"page"},{"location":"readpassivetracers/","page":"Passive tracers","title":"Passive tracers","text":"It is also doable to plot the the average P, T properties of a small group of tracers of our selection.","category":"page"},{"location":"installation/#Installation","page":"General instructions","title":"Installation","text":"","category":"section"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"Installing LaMEM can simply be done through the package manager:","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"julia>]\npkg>add LaMEM","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"which will download the binaries along with PETSc and mpiexec for your system.","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"You can test if it works on your machine with","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"pkg> test LaMEM","category":"page"},{"location":"installation/#Running-LaMEM-from-the-julia-REPL","page":"General instructions","title":"Running LaMEM from the julia REPL","text":"","category":"section"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"Running LaMEM from within julia can be done with the run_lamem function:","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"run_lamem","category":"page"},{"location":"installation/#LaMEM.Run.run_lamem","page":"General instructions","title":"LaMEM.Run.run_lamem","text":"run_lamem(ParamFile::String, cores::Int64=1, args:String=\"\"; wait=true, deactivate_multithreads=true)\n\nThis starts a LaMEM simulation, for using the parameter file ParamFile on cores number of cores. Optional additional command-line parameters can be specified with args.\n\nExample:\n\nYou can call LaMEM with:\n\njulia> using LaMEM\njulia> ParamFile=\"../../input_models/BuildInSetups/FallingBlock_Multigrid.dat\";\njulia> run_lamem(ParamFile)\n\nDo the same on 2 cores with a command-line argument as:\n\njulia> ParamFile=\"../../input_models/BuildInSetups/FallingBlock_Multigrid.dat\";\njulia> run_lamem(ParamFile, 2, \"-nstep_max = 1\")\n\n\n\n\n\nrun_lamem(model::Model, cores::Int64=1, args:String=\"\"; wait=true)\n\nPerforms a LaMEM run for the parameters that are specified in model\n\n\n\n\n\n","category":"function"},{"location":"installation/#Running-LaMEM-from-outside-julia","page":"General instructions","title":"Running LaMEM from outside julia","text":"","category":"section"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"If you, for some reason, do not want to run LaMEM through julia but instead directly from the terminal or powershell, you will have to add the required dynamic libraries and executables. Do this with:","category":"page"},{"location":"installation/","page":"General instructions","title":"General instructions","text":"show_paths_LaMEM","category":"page"},{"location":"installation/#LaMEM.Run.show_paths_LaMEM","page":"General instructions","title":"LaMEM.Run.show_paths_LaMEM","text":"show_paths_LaMEM()\n\nThe downloaded LaMEM binaries can also be called from outside julia (directly from the terminal). In that case, you will need to set load correct dynamic libraries (such as PETSc) and call the correct binaries.\n\nThis function shows this for your system. \n\n\n\n\n\n","category":"function"},{"location":"juliasetups/#Create-and-run-setups-from-julia","page":"Overview","title":"Create & run setups from julia","text":"","category":"section"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"It is also possible to construct a LaMEM setup directly in julia & run that. You can do the same from within a Pluto notebook. The advantage is that it is easier to use, has build-in plotting functions and extensive documentation. ","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"The main routine to do this is: ","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> using LaMEM\njulia> model = Model()\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(16, 16, 16); xϵ(-10.0, 10.0), yϵ(-10.0, 0.0), zϵ(-10.0, 0.0) \n|-- Time : nstep_max=50; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 0 phases;","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"Model is a structure that contains all the information about the LaMEM simulation and consists of the following sub-structures that can all be adjusted.","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"BoundaryConditions FreeSurface Grid \nMaterials ModelSetup Output \nScaling SolutionParams Solver \nTime","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"You can, for example, look at the current Grid:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> model.Grid\nLaMEM grid with constant Δ: \n nel : ([16], [16], [16])\n marker/cell : (3, 3, 3)\n x ϵ [-10.0 : 10.0]\n y ϵ [-10.0 : 0.0]\n z ϵ [-10.0 : 0.0]\n Phases : range ϵ [0 - 0]\n Temp : range ϵ [0.0 - 0.0]","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"and change the dimensions and number of grid-cells with:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> model.Grid = Grid(nel=[32,32,32], x=[-20,20])\nLaMEM grid with constant Δ: \n nel : ([32], [32], [32])\n marker/cell : (3, 3, 3)\n x ϵ [-20.0 : 20.0]\n y ϵ [-10.0 : 0.0]\n z ϵ [-10.0 : 0.0]\n Phases : range ϵ [0 - 0]\n Temp : range ϵ [0.0 - 0.0]","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"or do it by directly accessing the respectyive data field:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> model.Grid.nel_x = [32]\n1-element Vector{Int64}:\n 32","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"Every LaMEM model setup needs to specify material properties for the different materials. By default it has nothing:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> model.Materials\nLaMEM Material Properties: \n Softening = \n PhaseTransition =","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"yet, we can specify different materials using the Phase structure:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> sphere = Phase(Name=\"Sphere\", ID=1, eta=1e20, rho=2800)\nPhase 1 (Sphere): \n rho = 2800.0 \n eta = 1.0e20 ","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"and add that to the model with:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> add_phase!(model, sphere)\njulia> model\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(32, 32, 32); xϵ(-20.0, 20.0), yϵ(-10.0, 0.0), zϵ(-10.0, 0.0) \n|-- Time : nstep_max=50; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 1 phases; ","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"Note that the model now has 1 phase.","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"In order to run a simulation, we need to define at least 1 phase and heterogeneities in either the initial temperature field (model.Grid.Temp) or the Phases field (model.Grid.Phases). The easiest way to do that is to use routines from the GeophyicalModelGenerator package, for which we created simple interfaces to many of the relevant routines:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> using GeophysicalModelGenerator\njulia> add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, ))","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"For the sake of this example, lets add another phase:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> matrix = Phase(ID=0,Name=\"matrix\",eta=1e20,rho=3000)\nPhase 0 (matrix): \n rho = 3000.0 \n eta = 1.0e20 \njulia> add_phase!(model, matrix)","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"At this stage you have a model setup with 2 phases and heterogeneities in the Phases field, which you can check with:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> model\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(32, 32, 32); xϵ(-20.0, 20.0), yϵ(-10.0, 0.0), zϵ(-10.0, 0.0) \n|-- Time : nstep_max=50; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 2 phases; \n\n\njulia> model.Grid\nLaMEM grid with constant Δ: \n nel : ([32], [32], [32])\n marker/cell : (3, 3, 3)\n x ϵ [-20.0 : 20.0]\n y ϵ [-10.0 : 0.0]\n z ϵ [-10.0 : 0.0]\n Phases : range ϵ [0 - 1]\n Temp : range ϵ [0.0 - 0.0]","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"Running a model is very simple:","category":"page"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"julia> run_lamem(model,1)","category":"page"},{"location":"juliasetups/#More-examples","page":"Overview","title":"More examples","text":"","category":"section"},{"location":"juliasetups/","page":"Overview","title":"Overview","text":"More examples can be found on the left hand side menu.","category":"page"},{"location":"LaMEM_ModelFunctions/#List-functions","page":"Available functions","title":"List functions","text":"","category":"section"},{"location":"LaMEM_ModelFunctions/","page":"Available functions","title":"Available functions","text":"These are all the functions that are provided for the LaMEM Julia Setup interface ","category":"page"},{"location":"LaMEM_ModelFunctions/","page":"Available functions","title":"Available functions","text":"Modules = [LaMEM.LaMEM_Model]","category":"page"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.BCBlock","page":"Available functions","title":"LaMEM.LaMEM_Model.BCBlock","text":"LaMEM boundary condition `BCBlock` object\n\nnpath::Int64: Number of path points of Bezier curve (path-points only!)\ntheta::Vector{Float64}: # Orientation angles at path points (counter-clockwise positive)\ntime::Vector{Float64}: Times at path points\npath::Vector{Float64}: Path points x-y coordinates\nnpoly::Int64: Number of polygon vertices\npoly::Vector{Float64}: Polygon x-y coordinates at initial time\nbot::Float64: Polygon bottom coordinate\ntop::Float64: Polygon top coordinate\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.BoundaryConditions","page":"Available functions","title":"LaMEM.LaMEM_Model.BoundaryConditions","text":"Structure that contains the LaMEM boundary conditions information.\n\nnoslip::Vector{Int64}: No-slip boundary flag mask (left right front back bottom top)\nopen_top_bound::Int64: Stress-free (free surface/infinitely fast erosion) top boundary flag\ntemp_top::Float64: Constant temperature on the top boundary\ntemp_bot::Float64: Constant temperature on the bottom boundary\nexx_num_periods::Int64: number intervals of constant background strain rate (x-axis)\nexx_time_delims::Vector{Float64}: time delimiters (one less than number of intervals, not required for one interval)\nexx_strain_rates::Vector{Float64}: strain rates for each interval\neyy_num_periods::Int64: eyynumperiods\neyy_time_delims::Vector{Float64}: eyytimedelims\neyy_strain_rates::Vector{Float64}: eyystrainrates\nexy_num_periods::Int64: exynumperiods\nexy_time_delims::Vector{Float64}: exytimedelims\nexy_strain_rates::Vector{Float64}: exystrainrates\nexz_num_periods::Int64: exznumperiods\nexz_time_delims::Vector{Float64}: exztimedelims\nexz_strain_rates::Vector{Float64}: exzstrainrates\neyz_num_periods::Int64: eyznumperiods\neyz_time_delims::Vector{Float64}: eyztimedelims\neyz_strain_rates::Vector{Float64}: eyzstrainrates\nbg_ref_point::Vector{Float64}: background strain rate reference point (fixed)\nVelocityBoxes::Vector{VelocityBox}: List of added velocity boxes\nBCBlocks::Vector{BCBlock}: List of added Bezier blocks\nVelCylinders::Vector{VelCylinder}: List of added velocity cylinders\nbvel_face::Union{Nothing, String}: Face identifier (Left; Right; Front; Back; CompensatingInflow)\nbvel_face_out::Union{Nothing, Int64}: Velocity on opposite side: -1 for inverted velocity; 0 for no velocity; 1 for the same direction of velocity\nbvel_bot::Union{Nothing, Float64}: Bottom coordinate of inflow window\nbvel_top::Union{Nothing, Float64}: Top coordinate of inflow window\nvelin_num_periods::Union{Nothing, Int64}: Number of periods when velocity changes (Optional)\nvelin_time_delims::Union{Nothing, Vector}: Change velocity at 2 and 5 Myrs (one less than number of intervals, not required for one interval) (Optional)\nbvel_velin::Union{Nothing, Vector}: inflow velocity for each time interval(Multiple values required if velinnumperiods>1)\nbvel_velout::Union{Nothing, Float64}: outflow velocity (if not specified, computed from mass balance)\nbvel_relax_d::Union{Nothing, Float64}: vert.distance from bvelbot and bveltop over which velocity is reduced linearly\nbvel_velbot::Union{Nothing, Int64}: bottom inflow velocity for use with bvel_face=CompensatingInflow\nbvel_veltop::Union{Nothing, Int64}: top inflow velocity for use with bvel_face=CompensatingInflow\nbvel_temperature_inflow::Union{Nothing, String}: bveltemperatureinflow: Thermal age of the plate, which can be constant if set to Fixedthermalage or ConstantTinflow (Temperature of the inflow material is constant everywhere)\nbvel_thermal_age::Union{Nothing, Float64}: In dimensional unit. If the user specify this value, he needs to specify the temperature of the mantle and top as well\nbvel_temperature_mantle::Union{Nothing, Float64}: In dimensional unit. Temperature of the mantle\nbvel_temperature_top::Union{Nothing, Float64}: In dimensional unit. temperature of the top\nbvel_temperature_constant::Union{Nothing, Float64}: Constant temperature inflow.\nbvel_num_phase::Union{Nothing, Int64}: Imposes a stratigraphy of phase injected in the inflow boundary [if undefined, it uses the phase close to the boundary]\nbvel_phase::Union{Nothing, Vector{Int64}}: phase number of inflow material [if undefined, it uses the phase close to the boundary] from bottom to top\nbvel_phase_interval::Union{Nothing, Vector{Float64}}: Depth interval of injection of the phase (the interval is defined by num_phase+1 coordinates). e.g. [-120 -100 -10 0 ]\nopen_bot_bound::Union{Nothing, Int64}: # Permeable lower boundary flag\npermeable_phase_inflow::Union{Nothing, Int64}: Phase of the inflow material from the bottom (The temperature of the inflow phase it is the same of the bottom boundary) in case of openbotbound=1\nfix_phase::Union{Nothing, Int64}: fixed phase (no-flow condition)\nfix_cell::Union{Nothing, Int64}: fixed cells (no-flow condition)\nfix_cell_file::Union{Nothing, String}: fixed cells input file (extension is .xxxxxxxx.dat)\ntemp_bot_num_periods::Union{Nothing, Int64}: How many periods with different temp_bot do we have?\ntemp_bot_time_delim::Union{Nothing, Vector{Float64}}: At which time do we switch from one to the next period?\nPlume_InflowBoundary::Union{Nothing, Int64}: # have a plume-like inflow boundary @ bottom\nPlume_Type::Union{Nothing, String}: Type of plume inflow boundary.\n\"Inflow_type\" or\n\"Pressure_type\" (circular)\tor\n\"Permeable_Type\" which combines the open bot boundary with the plume boundary condition (the option herein listed overwrites open_bot, so do not activate that)\n\nPlume_Dimension::Union{Nothing, String}: 2D or 3D (circular)\nPlume_areaFrac::Union{Nothing, Float64}: how much of the plume is actually in the model. This usually 1 (default) but lower if the plume is in a corner of a symmetric setup and matters for the outflow\nPlume_Phase::Union{Nothing, Int64}: phase of plume material\nPlume_Depth::Union{Nothing, Float64}: # depth of provenience of the plume (i.e. how far from the bottom of the model the plume source is)\nPlume_Mantle_Phase::Union{Nothing, Int64}: # Astenosphere phase (if the inflow occurs outside the plume radius)\nPlume_Temperature::Union{Nothing, Float64}: # temperature of inflow plume\nPlume_Inflow_Velocity::Union{Nothing, Float64}: # Inflow velocity\t(not required if Pressure_Type) in cm/year if using GEOunits\nPlume_VelocityType::Union{Nothing, String}: \"Gaussian\" or \"Poiseuille\"\nPlume_Center::Union{Nothing, Vector{Float64}}: # [X,Y] of center (2nd only in case of 3D plume)\nPlume_Radius::Union{Nothing, Float64}: # Width/Radius of plume\nPlume_Phase_Mantle::Union{Nothing, Int64}: # Inflow phase. If the velocity happens to be positive in the domain, the inflow material has a constant phase and the temperature of the bottom\npres_top::Union{Nothing, Float64}: Pressure on the top boundary\npres_bot::Union{Nothing, Float64}: Pressure on the bottom boundary\ninit_pres::Union{Nothing, Int64}: pressure initial guess flag; linear profile between prestop and presbot in the unconstrained cells\ninit_temp::Union{Nothing, Int64}: temperature initial guess flag; linear profile between temptop and tempbot\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Dike","page":"Available functions","title":"LaMEM.LaMEM_Model.Dike","text":"Defines the properties related to inserting dikes\n\nID::Int64: Material phase ID\nMf::Float64: value for dike/magma- accommodated extension, between 0 and 1, in the front of the box, for phase dike\nMc::Float64: [optional] value for dike/magma- accommodate extension, between 0 and 1, for dike phase; M is linearly interpolated between Mf & Mc and Mc & Mb, if not set, Mc default is set to -1 so it is not used\ny_Mc::Union{Nothing, Float64}: [optional], location for Mc, must be between front and back boundaries of dike box, if not set, default value to 0.0, but not used\nMb::Union{Nothing, Float64}: value for dike/magma-accommodated extension, between 0 and 1, in the back of the box, for phase dike\nPhaseID::Union{Nothing, Int64}: Phase ID\nPhaseTransID::Union{Nothing, Int64}: Phase transition ID\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.FreeSurface","page":"Available functions","title":"LaMEM.LaMEM_Model.FreeSurface","text":"Structure that contains the LaMEM free surface information.\n\nsurf_use::Int64: Free surface activation flag\nsurf_corr_phase::Int64: air phase ratio correction flag (phases in an element that contains are modified based on the surface position)\nsurf_level::Union{Nothing, Float64}: initial level of the free surface\nsurf_air_phase::Union{Nothing, Int64}: phase ID of sticky air layer\nsurf_max_angle::Float64: maximum angle with horizon (smoothed if larger)\nsurf_topo_file::String: initial topography file (redundant)\nerosion_model::Int64: erosion model [0-none (default), 1-infinitely fast, 2-prescribed rate with given level]\ner_num_phases::Int64: number of erosion phases\ner_time_delims::Vector{Float64}: erosion time delimiters (one less than number)\ner_rates::Vector{Float64}: constant erosion rates in different time periods\ner_levels::Vector{Int64}: levels above which we apply constant erosion rates in different time periods\nsediment_model::Int64: sedimentation model [0-none (dafault), 1-prescribed rate with given level, 2-cont. margin]\nsed_num_layers::Int64: number of sediment layers\nsed_time_delims::Vector{Float64}: sediment layers time delimiters (one less than number)\nsed_rates::Vector{Float64}: sediment rates in different time periods\nsed_levels::Vector{Float64}: levels below which we apply constant sediment rates in different time periods\nsed_phases::Vector{Int64}: sediment layers phase numbers in different time periods\nmarginO::Vector{Float64}: lateral coordinates of continental margin - origin\nmarginE::Vector{Float64}: lateral coordinates of continental margin - 2nd point\nhUp::Float64: up dip thickness of sediment cover (onshore)\nhDown::Float64: down dip thickness of sediment cover (off shore)\ndTrans::Float64: half of transition zone\nTopography::Union{Nothing, GeophysicalModelGenerator.CartData}: Topography grid\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomBox","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomBox","text":"LaMEM geometric primitive `Box` object\n\nphase::Int64: phase\nbounds::Vector{Float64}: box bound coordinates: left, right, front, back, bottom, top\nTemperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant, linear, halfspace]\ncstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]\ntopTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nbotTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nthermalAge::Union{Nothing, Float64}: required in case of [halfspace]: thermal age of lithosphere [in Myrs if GEO units are used]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomCylinder","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomCylinder","text":"LaMEM geometric primitive `Cylinder` object\n\nphase::Int64: phase\nradius::Float64: radius of cylinder\nbase::Vector{Float64}: center of base of cylinder\ncap::Vector{Float64}: center of cap of cylinder\nTemperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant]\ncstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomEllipsoid","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomEllipsoid","text":"LaMEM geometric primitive `Ellipsoid` object\n\nphase::Int64: phase\naxes::Vector{Float64}: semi-axes of ellipsoid in x, y and z\ncenter::Vector{Float64}: center of sphere\nTemperature::Union{Nothing, String}: optional: Temperature of the sphere. possibilities: [constant, or nothing]\ncstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomHex","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomHex","text":"LaMEM geometric primitive `Hex` object to define hexahedral elements\n\nphase::Int64: phase\ncoord::Vector{Float64}: x-y-z coordinates for each of 8 nodes (24 parameters) (counter)-clockwise for an arbitrary face, followed by the opposite face\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomLayer","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomLayer","text":"LaMEM geometric primitive `Layer` object\n\nphase::Int64: phase\ntop::Float64: top of layer\nbottom::Float64: bottom of layer\ncosine::Union{Nothing, Int64}: optional: add a cosine perturbation on top of the interface (if 1)\nwavelength::Union{Nothing, Float64}: required if cosine: wavelength in x-direction\namplitude::Union{Nothing, Float64}: required if cosine: amplitude of perturbation\nTemperature::Union{Nothing, String}: optional: Temperature structure. possibilities: [constant, linear, halfspace]\ncstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]\ntopTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nbotTemp::Union{Nothing, Float64}: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nthermalAge::Union{Nothing, Float64}: required in case of [halfspace]: thermal age of lithosphere [in Myrs if GEO units are used]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomRidgeSeg","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomRidgeSeg","text":"LaMEM geometric primitive `RidgeSeg` object\n\nphase::Int64: phase\nbounds::Vector{Float64}: box bound coordinates: left, right, front, back, bottom, top\nridgeseg_x::Vector{Float64}: coordinate order: left, right [can be different for oblique ridge]\nridgeseg_y::Vector{Float64}: coordinate order: front, back [can be different for oblique ridge]\nTemperature::String: initial temperature structure [ridge must be set to halfspace_age –> setTemp=4]\ntopTemp::Float64: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nbotTemp::Float64: required in case of [linear,halfspace]: temperature @ top [in Celcius in case of GEO units]\nage0::Float64: minimum age of seafloor at ridge [in Myr in case of GEO units]\nmaxAge::Union{Nothing, Float64}: [optional] parameter that indicates the maximum thermal age of a plate\nv_spread::Union{Nothing, Float64}: [optional] parameter that indicates the spreading velocity of the plate; if not defined it uses bvel_velin specified elsewhere\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.GeomSphere","page":"Available functions","title":"LaMEM.LaMEM_Model.GeomSphere","text":"LaMEM geometric primitive `sphere` object\n\nphase::Int64: phase\nradius::Float64: radius of sphere\ncenter::Vector{Float64}: center of sphere\nTemperature::Union{Nothing, String}: optional: Temperature of the sphere. possibilities: [constant, or nothing]\ncstTemp::Union{Nothing, Float64}: required in case of [constant]: temperature value [in Celcius in case of GEO units]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Grid","page":"Available functions","title":"LaMEM.LaMEM_Model.Grid","text":"Structure that contains the LaMEM grid information\n\nnmark_x::Int64: number of markers/element in x-direction\nnmark_y::Int64: number of markers/element in y-direction\nnmark_z::Int64: number of markers/element in x-direction\nnel_x::Vector{Int64}: number of elements in x-direction\nnel_y::Vector{Int64}: number of elements in y-direction\nnel_z::Vector{Int64}: number of elements in z-direction\ncoord_x::Vector{Float64}: coordinates in x-direction\ncoord_y::Vector{Float64}: coordinates in y-direction\ncoord_z::Vector{Float64}: coordinates in z-direction\nnseg_x::Int64: number of segments in x-direction (if we employ variable grid spacing in x-direction)\nnseg_y::Int64: number of segments in y-direction (if we employ variable grid spacing in y-direction)\nnseg_z::Int64: number of segments in z-direction (if we employ variable grid spacing in z-direction)\nbias_x::Vector{Float64}: bias in x-direction (if we employ variable grid spacing in x-direction)\nbias_y::Vector{Float64}: bias in y-direction (if we employ variable grid spacing in y-direction)\nbias_z::Vector{Float64}: bias in z-direction (if we employ variable grid spacing in z-direction)\nGrid::GeophysicalModelGenerator.LaMEM_grid: Contains the LaMEM Grid object\nPhases::Array{Int32}: Phases; 3D phase information\nTemp::Array{Float64}: Temp; 3D phase information\n\nExample 1\n\njulia> d=LaMEM.Grid(coord_x=[0.0, 0.7, 0.8, 1.0], bias_x=[0.3,1.0,3.0], nel_x=[10,4,2])\nLaMEM grid with 1D refinement: \n nel : ([10, 4, 2], [16], [16])\n marker/cell : (3, 3, 3)\n x ϵ [0.0, 0.7, 0.8, 1.0], bias=[0.3, 1.0, 3.0], nseg=3, Δmin=0.025000000000000022, Δmax=0.1499999999999999\n y ϵ [-10.0 : 0.0]\n z ϵ [-10.0 : 0.0]\n\nExample 2\n\njulia> d=LaMEM.Grid(nel=(10,20))\nLaMEM grid with constant Δ: \n nel : ([10], [1], [20])\n marker/cell : (3, 3, 3)\n x ϵ [-10.0 : 10.0]\n y ϵ [-10.0 : 0.0]\n z ϵ [-10.0 : 0.0]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Materials","page":"Available functions","title":"LaMEM.LaMEM_Model.Materials","text":"Structure that contains the material properties in the current simulation\n\nPhases::Vector{Phase}: Different Materials implemented\nSofteningLaws::Vector{Softening}: Softening laws implemented\nPhaseTransitions::Vector{PhaseTransition}: Internal Phase Transitions (that change the ID of markers) implemented\nDikes::Vector{Dike}: Dikes implemented (mostly for MOR simulations)\nPhaseAggregates::Vector{PhaseAggregate}: Phase aggregates (combines different phases such as upper_lower crust into one for visualization purposes)\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Model","page":"Available functions","title":"LaMEM.LaMEM_Model.Model","text":"Model\n\nStructure that holds all the information to create a LaMEM input file\n\nScaling::Scaling: Scaling parameters\nGrid::Grid: LaMEM Grid\nTime::Any: Time options\nFreeSurface::Any: Free surface options\nBoundaryConditions::Any: Boundary conditions\nSolutionParams::Any: Global solution parameters\nSolver::Any: Solver options and optional PETSc options\nModelSetup::Any: Model setup\nOutput::Any: Output options\nPassiveTracers::Any: Passive tracers\nMaterials::Any: Material parameters for each of the phases\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Model-Tuple","page":"Available functions","title":"LaMEM.LaMEM_Model.Model","text":"Model(args...)\n\nAllow to define a model setup by specifying some of the basic objects\n\nExample\n\njulia> d = Model(Grid(nel=(10,1,20)), Scaling(NO_units()))\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GeoParams.Units.NONE}\n|-- Grid : nel=(10, 1, 20); xϵ(-10.0, 10.0), yϵ(-10.0, 0.0), zϵ(-10.0, 0.0) \n|-- Time : nstep_max=50; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : \n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=geom; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 1 phases; \n\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Model-Tuple{}","page":"Available functions","title":"LaMEM.LaMEM_Model.Model","text":"Model(;\n Scaling=Scaling(GEO_units()),\n Grid=Grid(), \n Time=Time(),\n FreeSurface=FreeSurface(),\n BoundaryConditions=BoundaryConditions(),\n SolutionParams=SolutionParams(),\n Solver=Solver(),\n ModelSetup=ModelSetup(),\n Output=Output(),\n PassiveTracers=PassiveTracers(),\n Materials=Materials()\n )\n\nCreates a LaMEM Model setup.\n\nScaling::Scaling\nGrid::Grid\nTime::Any\nFreeSurface::Any\nBoundaryConditions::Any\nSolutionParams::Any\nSolver::Any\nModelSetup::Any\nOutput::Any\nPassiveTracers::Any\nMaterials::Any\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.ModelSetup","page":"Available functions","title":"LaMEM.LaMEM_Model.ModelSetup","text":"Structure that contains the LaMEM Model Setup and Advection options\n\nmsetup::String: Setup type - can be geom (phases are assigned from geometric primitives, using add_geom!(model, ...)), files (from julia input), polygons (from geomIO input, which requires poly_file to be specified)\nrand_noise::Int64: add random noise to the particle location\nrand_noiseGP::Int64: random noise flag, subsequently applied to geometric primitives\nbg_phase::Int64: background phase ID\nsave_mark::Int64: save marker to disk flag\nmark_load_file::String: marker input file (extension is .xxxxxxxx.dat), if using msetup=files\nmark_save_file::String: marker output file (extension is .xxxxxxxx.dat)\npoly_file::String: polygon geometry file (redundant), if using msetup=polygons\ntemp_file::String: initial temperature file (redundant), if not set on markers\nadvect::String: advection scheme; options=none (no advection); basic (Euler classical implementation [default]); Euler (Euler explicit in time); rk2 (Runge-Kutta 2nd order in space)\ninterp::String: velocity interpolation scheme; options = stag (trilinear interpolation from FDSTAG points), minmod ( MINMOD interpolation to nodes, trilinear interpolation to markers + correction), stagp ( STAG_P empirical approach by T. Gerya)\nstagp_a::Float64: STAG_P velocity interpolation parameter\nmark_ctrl::String: marker control type; options are subgrid (default; marker control enforced over fine scale grid), none (none), basic (AVD for cells + corner insertion), and avd (pure AVD for all control volumes)\nnmark_lim::Vector{Int64}: min/max number per cell (marker control)\nnmark_avd::Vector{Int64}: x-y-z AVD refinement factors (avd marker control)\nnmark_sub::Int64: max number of same phase markers per subcell (subgrid marker control)\ngeom_primitives::Vector: Different geometric primitives that can be selected if we msetup=geom; seeGeomSphere`\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Multigrid","page":"Available functions","title":"LaMEM.LaMEM_Model.Multigrid","text":"Structure that has info about setting up multigrid for LaMEM\n\nnel::Tuple{Int64, Int64, Int64}: Number of elements at the fine level\n\nlevels::Int64: Number of levels\n\nsmooth::Int64: number of smoothening steps per level\n\nsmooth_jacobi_factor::Float64: factor for jacbi smoothener oer level\n\nsmoother::String: smoother used at every level\n\ncoarse_ksp::String: coarse grid ksp type preonly or fgmres\n\ncoarse_pc::String: coarse grid pc type [\"superlu_dist\", \"mumps\", \"gamg\", \"telescope\",\"redundant\"]\n\ncoarse_coarse_pc::String: coarse coarse grid solver in case we use redundant or telescope coarse grid solves\n\ncoarse_coarse_ksp::String: coarse coarse grid solver in case we use redundant or telescope coarse grid solves\n\ncores::Int64: number of cores used in the simulation\n\ncores_coarse::Int64: number of cores used for coarse grid solver (in case we use pctelescope)\n\ngamg_threshold::Float64: GAMG threshold\n\ngamg_coarse_eq_limit::Int64: GAMG coarse grid equation limit\n\ngamg_repartition::Bool: GAMG repartition coarse grids? (default=false)\n\ngamg_parallel_coarse::Bool: GAMG parallel coarse grid solver? (default=false)\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Output","page":"Available functions","title":"LaMEM.LaMEM_Model.Output","text":"Structure that contains the LaMEM output options\n\nout_file_name::Any: output file name\nout_dir::Any: output directory\nparam_file_name::Any: parameter filename\nwrite_VTK_setup::Any: write VTK initial model setup\nout_pvd::Any: activate writing .pvd file\nout_phase::Any: dominant phase\nout_density::Any: density\nout_visc_total::Any: total (viscoelastoplastic) viscosity\nout_visc_creep::Any: creep viscosity\nout_velocity::Any: velocity\nout_pressure::Any: (dynamic) pressure\nout_tot_press::Any: total pressure\nout_eff_press::Any: effective pressure\nout_over_press::Any: outoverpress\nout_litho_press::Any: lithospheric pressure\nout_pore_press::Any: pore pressure\nout_temperature::Any: temperature\nout_dev_stress::Any: deviatoric strain rate tensor\nout_j2_dev_stress::Any: second invariant of deviatoric stress tensor\nout_strain_rate::Any: deviatoric strain rate tensor\nout_j2_strain_rate::Any: second invariant of strain rate tensor\nout_shmax::Any: sh max\nout_ehmax::Any: eh max\nout_yield::Any: yield stress\nout_rel_dif_rate::Any: relative proportion of diffusion creep strainrate\nout_rel_dis_rate::Any: relative proportion of dislocation creep strainrate\nout_rel_prl_rate::Any: relative proportion of peierls creep strainrate\nout_rel_pl_rate::Any: relative proportion of plastic strainrate\nout_plast_strain::Any: accumulated plastic strain\nout_plast_dissip::Any: plastic dissipation\nout_tot_displ::Any: total displacement\nout_moment_res::Any: momentum residual\nout_cont_res::Any: continuity residual\nout_energ_res::Any: energy residual\nout_melt_fraction::Any: Melt fraction\nout_fluid_density::Any: fluid density\nout_conductivity::Any: conductivity\nout_vel_gr_tensor::Any: velocity gradient tensor\nout_surf::Any: activate surface output\nout_surf_pvd::Any: activate writing .pvd file\nout_surf_velocity::Any: surface velocity\nout_surf_topography::Any: surface topography\nout_surf_amplitude::Any: amplitude of topography (=topo-average(topo))\nout_mark::Any: activate marker output\nout_mark_pvd::Any: activate writing .pvd file\nout_avd::Any: activate AVD phase output\nout_avd_pvd::Any: activate writing .pvd file\nout_avd_ref::Any: AVD grid refinement factor\nout_ptr::Any: activate\nout_ptr_ID::Any: ID of the passive tracers\nout_ptr_phase::Any: phase of the passive tracers\nout_ptr_Pressure::Any: interpolated pressure\nout_ptr_Temperature::Any: temperature\nout_ptr_MeltFraction::Any: melt fraction computed using P-T of the marker\nout_ptr_Active::Any: option that highlight the marker that are currently active\nout_ptr_Grid_Mf::Any: option that allow to store the melt fraction seen within the cell\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.PassiveTracers","page":"Available functions","title":"LaMEM.LaMEM_Model.PassiveTracers","text":"Structure that contains the LaMEM passive tracers parameters.\n\nPassive_Tracer::Int64: activate passive tracers?\"\n\nPassiveTracer_Box::Union{Nothing, Vector{Float64}}: Dimensions of box in which we distribute passive tracers [Left, Right, Front, Back, Bottom, Top]\n\nPassiveTracer_Resolution::Vector{Int64}: The number of passive tracers in every direction\n\nPassiveTracer_ActiveType::Union{Nothing, String}: Under which condition are they activated? [\"Always\"], \"Melt_Fraction\", \"Temperature\", \"Pressure\", \"Time\"\n\nPassiveTracer_ActiveValue::Union{Nothing, Float64}: The value to activate them\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Phase","page":"Available functions","title":"LaMEM.LaMEM_Model.Phase","text":"Defines the material properties for each of the phases\n\nID::Union{Nothing, Int64}: Material phase ID\nName::Union{Nothing, String}: Description of the phase\nrho::Union{Nothing, Float64}: Density [kg/m^3]\neta::Union{Nothing, Float64}: Linear viscosity [Pas]\nvisID::Union{Nothing, Int64}: material ID for phase visualization (default is ID)\ndiff_prof::Union{Nothing, String}: Build-in DIFFUSION creep profiles:\nExample: \"Dry__Olivine_diff_creep-Hirth_Kohlstedt_2003\"\nAvailable build-in diffusion creep rheologies are:\nFrom [Hirth, G. and Kohlstedt D. (2003), Rheology of the upper mantle and the mantle wedge: A view from the experimentalists]:\n\"Dry_Olivine_diff_creep-Hirth_Kohlstedt_2003\"\n\"Wet_Olivine_diff_creep-Hirth_Kohlstedt_2003_constant_C_OH\"\n\"Wet_Olivine_diff_creep-Hirth_Kohlstedt_2003\"\nFrom [Rybacki and Dresen, 2000, JGR]:\n\"Dry_Plagioclase_RybackiDresen_2000\"\n\"Wet_Plagioclase_RybackiDresen_2000\"\nNote that you can always specify your own, by setting Bd, Ed, Vd accordingly.\n\ndisl_prof::Union{Nothing, String}: Build-in DISLOCATION creep profiles:\nExample: \"Granite-Tirel_et_al_2008\"\nAvailable build-in dislocation creep rheologies are:\nFrom [Ranalli 1995]:\n\"Dry_Olivine-Ranalli_1995\"\n\"Wet_Olivine-Ranalli_1995\"\n\"Wet_Quarzite-Ranalli_1995\"\n\"Quarzite-Ranalli_1995\"\n\"Mafic_Granulite-Ranalli_1995\"\n\"Plagioclase_An75-Ranalli_1995\"\nFrom [Carter and Tsenn (1986). Flow properties of continental lithosphere - page 18]:\n\"Quartz_Diorite-Hansen_Carter_1982\"\nFrom [J. de Bremond d'Ars et al. Tectonophysics (1999). Hydrothermalism and Diapirism in the Archaean: gravitational instability constrains. - page 5]\n\"Diabase-Caristan_1982\"\n\"Tumut_Pond_Serpentinite-Raleigh_Paterson_1965\"\nFrom [Mackwell, Zimmerman & Kohlstedt (1998). High-temperature deformation]:\n\"Maryland_strong_diabase-Mackwell_et_al_1998\"\nFrom [Ueda et al (PEPI 2008)]:\n\"Wet_Quarzite-Ueda_et_al_2008\"\nFrom [Huismans et al 2001]:\n\"Diabase-Huismans_et_al_2001\"\n\"Granite-Huismans_et_al_2001\"\nFrom [Burg And Podladchikov (1999)]:\n\"Dry_Upper_Crust-Schmalholz_Kaus_Burg_2009\"\n\"Weak_Lower_Crust-Schmalholz_Kaus_Burg_2009\"\n\"Olivine-Burg_Podladchikov_1999\"\nFrom [Rybacki and Dresen, 2000, JGR]:\n\"Dry_Plagioclase_RybackiDresen_2000\"\n\"Wet_Plagioclase_RybackiDresen_2000\"\nFrom [Hirth, G. & Kohlstedt (2003), D. Rheology of the upper mantle and the mantle wedge: A view from the experimentalists]:\n\"Wet_Olivine_disl_creep-Hirth_Kohlstedt_2003\"\n\"Wet_Olivine_disl_creep-Hirth_Kohlstedt_2003_constant_C_OH\"\n\"Dry_Olivine_disl_creep-Hirth_Kohlstedt_2003\"\nFrom [SchmalholzKausBurg(2009), Geology (wet olivine)]:\n\"Wet_Upper_Mantle-Burg_Schmalholz_2008\"\n\"Granite-Tirel_et_al_2008\"\nFrom [Urai et al.(2008)]:\n\"Ara_rocksalt-Urai_et_al.(2008)\"\nFrom [Bräuer et al. (2011) Description of the Gorleben site (PART 4): Geotechnical exploration of the Gorleben salt dome - page 126]:\n\"RockSaltReference_BGRa_class3-Braeumer_et_al_2011\"\nFrom [Mueller and Briegel (1978)]:\n\"Polycrystalline_Anhydrite-Mueller_and_Briegel(1978)\"\nNote that you can always specify your own, by setting Bn, En, Vn, and n accordingly.\n\npeir_prof::Union{Nothing, String}: Build-in PEIERLS creep profiles:\nexample: \"Olivine_Peierls-Kameyama_1999\"\nAvailable profiles:\n\"Olivine_Peierls-Kameyama_1999\"\n\nrho_n::Union{Nothing, Float64}: depth-dependent density model parameter\nrho_c::Union{Nothing, Float64}: depth-dependent density model parameter\nbeta::Union{Nothing, Float64}: pressure-dependent density model parameter\nG::Union{Nothing, Float64}: shear modulus\nKb::Union{Nothing, Float64}: bulk modulus\nE::Union{Nothing, Float64}: Young's modulus\nnu::Union{Nothing, Float64}: Poisson's ratio\nKp::Union{Nothing, Float64}: pressure dependence parameter\nBd::Union{Nothing, Float64}: DIFFUSION creep pre-exponential constant\nEd::Union{Nothing, Float64}: activation energy\nVd::Union{Nothing, Float64}: activation volume\neta0::Union{Nothing, Float64}: POWER LAW reference viscosity\ne0::Union{Nothing, Float64}: reference strain rate\nBn::Union{Nothing, Float64}: DISLOCATION creep pre-exponential constant\nEn::Union{Nothing, Float64}: activation energy\nVn::Union{Nothing, Float64}: activation volume\nn::Union{Nothing, Float64}: power law exponent\nBp::Union{Nothing, Float64}: PEIERLS creep pre-exponential constant\nEp::Union{Nothing, Float64}: activation energy\nVp::Union{Nothing, Float64}: activation volume\ntaup::Union{Nothing, Float64}: scaling stress\ngamma::Union{Nothing, Float64}: approximation parameter\nq::Union{Nothing, Float64}: stress-dependence parameter\neta_fk::Union{Nothing, Float64}: reference viscosity for Frank-Kamenetzky viscosity\ngamma_fk::Union{Nothing, Float64}: gamma parameter for Frank-Kamenetzky viscosity\nTRef_fk::Union{Nothing, Float64}: reference Temperature for Frank-Kamenetzky viscosity (if not set it is 0°C)\nch::Union{Nothing, Float64}: cohesion\nfr::Union{Nothing, Float64}: friction angle\neta_st::Union{Nothing, Float64}: stabilization viscosity (default is eta_min)\neta_vp::Union{Nothing, Float64}: viscoplastic plasticity regularisation viscosity\nrp::Union{Nothing, Float64}: pore-pressure ratio\nchSoftID::Union{Nothing, Int64}: friction softening law ID\nfrSoftID::Union{Nothing, Int64}: cohesion softening law ID\nhealID::Union{Nothing, Int64}: healing ID, points to healTau in Softening\nalpha::Union{Nothing, Float64}: thermal expansivity\nCp::Union{Nothing, Float64}: specific heat (capacity), J⋅K−1⋅kg−1\nk::Union{Nothing, Float64}: thermal conductivity\nA::Union{Nothing, Float64}: radiogenic heat production\nT::Union{Nothing, Float64}: optional temperature to set within the phase\nLatent_hx::Union{Nothing, Float64}: optional, used for dike heating, J/kg\nT_liq::Union{Nothing, Float64}: optional, used for dike heating, liquidus temperature of material, celsius\nT_sol::Union{Nothing, Float64}: optional, used for dike heating, solidus temperature of material, celsius\nT_Nu::Union{Nothing, Float64}: default value for thermal conductivity boundary\nnu_k::Union{Nothing, Float64}: optional parameter, Nusselt number for use with conductivity\nrho_ph::Union{Nothing, String}: name of the phase diagram you want to use (still needs rho to be defined for the initial guess of pressure)\nrho_ph_dir::Union{Nothing, String}: in case the phase diagram has a different path provide the path (without the name of the actual PD) here\nmfc::Union{Nothing, Float64}: melt fraction viscosity correction factor (positive scalar)\nGeoParams::Union{Nothing, Vector{GeoParams.MaterialParameters.ConstitutiveRelationships.AbstractCreepLaw}}: GeoParams creeplaws\nSet diffusion or dislocation creeplaws as provided by the GeoParams package:\njulia> using GeoParams\njulia> a = SetDiffusionCreep(GeoParams.Diffusion.dry_anorthite_Rybacki_2006);\njulia> p = Phase(ID=1,Name=\"test\", GeoParams=[a]);\nNote that GeoParams should be a vector, as you could, for example, have diffusion and dislocation creep parameters\nNote also that this will overwrite any other creeplaws provided in the Phase struct.\n\ngrainsize::Union{Nothing, Float64}: grainsize m This is not actually used in LaMEM, but is required when setting diffusion creep parameters by using GeoParams\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.PhaseAggregate","page":"Available functions","title":"LaMEM.LaMEM_Model.PhaseAggregate","text":"Defines phase aggregates, which can be useful for visualization purposes\n\nname::String: Name of the phase aggregate\nphaseID::Union{Nothing, Vector{Int64}}: Phases to be combined\nnumPhase::Union{Nothing, Int64}: number of aggregated phases\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.PhaseTransition","page":"Available functions","title":"LaMEM.LaMEM_Model.PhaseTransition","text":"Defines phase transitions on markers (that change the Phase ID of a marker depending on some conditions)\n\nID::Int64: Phase_transition law ID\nType::String: [Constant, Clapeyron, Box]: Constant - the phase transition occurs only at a fixed value of the parameter; Clapeyron - clapeyron slope\nName_Clapeyron::Union{Nothing, String}: Type of predefined Clapeyron slope, such as MantleTransition660km\nPTBox_Bounds::Union{Nothing, Vector{Float64}}: box bound coordinates: [left, right, front, back, bottom, top]\nBoxVicinity::Union{Nothing, Int64}: 1: only check particles in the vicinity of the box boundaries (2: in all directions)\nParameter_transition::Union{Nothing, String}: [T = Temperature, P = Pressure, Depth = z-coord, X=x-coord, Y=y-coord, APS = accumulated plastic strain, MeltFraction, t = time] parameter that triggers the phase transition\nConstantValue::Union{Nothing, Float64}: Value of the parameter [unit of T,P,z, APS]\nnumber_phases::Union{Nothing, Int64}: The number of involved phases [default=1]\nPhaseAbove::Union{Nothing, Vector{Int64}}: Above the chosen value the phase is 1, below it, the value is PhaseBelow\nPhaseBelow::Union{Nothing, Vector{Int64}}: Below the chosen value the phase is PhaseBelow, above it, the value is 1\nPhaseInside::Union{Nothing, Vector{Int64}}: Phase within the box [use -1 if you don't want to change the phase inside the box]\nPhaseOutside::Union{Nothing, Vector{Int64}}: Phase outside the box [use -1 if you don't want to change the phase outside the box. If combined with OutsideToInside, all phases that come in are set to PhaseInside]\nPhaseDirection::Union{Nothing, String}: [BothWays=default; BelowToAbove; AboveToBelow] Direction in which transition works\nResetParam::Union{Nothing, String}: [APS] Parameter to reset on particles below PT or within box\nPTBox_TempType::Union{Nothing, String}: # Temperature condition witin the box [none, constant, linear, halfspace]\nPTBox_topTemp::Union{Nothing, Float64}: Temp @ top of box [for linear & halfspace]\nPTBox_botTemp::Union{Nothing, Float64}: Temp @ bottom of box [for linear & halfspace]\nPTBox_thermalAge::Union{Nothing, Float64}: Thermal age, usually in geo-units [Myrs] [only in case of halfspace]\nPTBox_cstTemp::Union{Nothing, Float64}: Temp within box [only for constant T]\nv_box::Union{Nothing, Float64}: [optional] only for NotInAirBox, velocity with which box moves in cm/yr\nt0_box::Union{Nothing, Float64}: [optional] beginning time of movemen in Myr\nt1_box::Union{Nothing, Float64}: [optional] end time of movement in Myr\nclapeyron_slope::Union{Nothing, Float64}: [optional] clapeyron slope of phase transition [in K/MPa]; P = ( T - T0_clapeyron ) * clapeyron_slope + P0_clapeyron\nP0_clapeyron::Union{Nothing, Float64}: [optional] P0_clapeyron [Pa]\nT0_clapeyron::Union{Nothing, Float64}: [optional] T0_clapeyron [C]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Scaling","page":"Available functions","title":"LaMEM.LaMEM_Model.Scaling","text":"Scaling{T} is a structure that contains the scaling info, employed in the current simulation\n\nScaling::Any: Scaling object (as in GeoParams), which can be GEO_units(), NO_units(), or SI_units()\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Softening","page":"Available functions","title":"LaMEM.LaMEM_Model.Softening","text":"Defines strain softening parameters\n\nID::Int64: softening law ID\nAPS1::Float64: Begin of softening, in units of accumulated plastic strain (APS)\nAPS2::Float64: End of softening, in units of accumulated plastic strain (APS)\nA::Float64: Reduction ratio\nLm::Union{Nothing, Float64}: Material length scale (in selected units, e.g. km in geo)\nAPSheal2::Union{Nothing, Float64}: APS when healTau2 activates\nhealTau::Union{Nothing, Float64}: healing timescale parameter [Myr]\nhealTau2::Union{Nothing, Float64}: healing timescale parameter [Myr] starting at APS=APSheal2\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.SolutionParams","page":"Available functions","title":"LaMEM.LaMEM_Model.SolutionParams","text":"Structure that contains the LaMEM global solution parameters.\n\ngravity::Vector{Float64}: gravitational acceleration vector\nFSSA::Float64: free surface stabilization parameter [0 - 1]; The value has to be between 0 and 1\n\nFSSA_allVel::Int64: free surface stabilization parameter applied to all velocity components? Default is yes; if not it is only applied to the z-component\n\nshear_heat_eff::Float64: shear heating efficiency parameter [0 - 1]\nAdiabatic_Heat::Float64: Adiabatic Heating activation flag and efficiency. 0.0 - 1.0\nact_temp_diff::Int64: temperature diffusion activation flag\nact_therm_exp::Int64: thermal expansion activation flag\nact_steady_temp::Int64: steady-state temperature initial guess activation flag\nsteady_temp_t::Float64: time for (quasi-)steady-state temperature initial guess\nnstep_steady::Int64: number of steps for (quasi-)steady-state temperature initial guess (default = 1)\nact_heat_rech::Int64: recharge heat in anomalous bodies after (quasi-)steady-state temperature initial guess (=2: recharge after every diffusion step of initial guess)\ninit_lith_pres::Int64: sets initial pressure to be the lithostatic pressure (stabilizes compressible setups in the first steps)\ninit_guess::Int64: create an initial guess step (using constant viscosity eta_ref before starting the simulation\np_litho_visc::Int64: use lithostatic instead of dynamic pressure for creep laws\np_litho_plast::Int64: use lithostatic pressure for plasticity\np_lim_plast::Int64: limit pressure at first iteration for plasticity\np_shift::Int64: add a constant value [MPa] to the total pressure field, before evaluating plasticity (e.g., when the domain is located @ some depth within the crust)\nact_p_shift::Int64: pressure shift activation flag (enforce zero pressure on average in the top cell layer); note: this overwrites p_shift above!\neta_min::Float64: viscosity lower bound [Pas]\neta_max::Float64: viscosity upper limit [Pas]\neta_ref::Float64: Reference viscosity (used for the initial guess) [Pas]\nT_ref::Float64: Reference temperature [C]\nRUGC::Float64: universal gas constant (you need to change this only for non-dimensional setups)\nmin_cohes::Float64: cohesion lower bound [Pa]\nmin_fric::Float64: friction lower bound [degree]\ntau_ult::Float64: ultimate yield stress [Pa]\nrho_fluid::Float64: fluid density for depth-dependent density model\ngw_level_type::String: ground water level type for pore pressure computation (see below)\ngw_level::Float64: ground water level at the free surface (if defined)\nbiot::Float64: Biot pressure parameter\nget_permea::Float64: effective permeability computation activation flag\nrescal::Float64: stencil rescaling flag (for internal constraints, for example while computing permeability)\nmfmax::Float64: maximum melt fraction affecting viscosity reduction\nlmaxit::Int64: maximum number of local rheology iterations\nlrtol::Float64: local rheology iterations relative tolerance\nact_dike::Int64: dike activation flag (additonal term in divergence)\nuseTk::Int64: switch to use T-dependent conductivity, 0: not active\ndikeHeat::Int64: switch to use Behn & Ito heat source in the dike\nadiabatic_gradient::Float64: Adiabatic gradient in combination with Behn & Ito dike\nCompute_velocity_gradient::Int64: compute the velocity gradient tensor 1: active, 0: not active. If active, it automatically activates the output in the .pvd file\nPhasetrans::Int64: Activate Phase Transitions on Particles or not, 0: not.\nPassive_Tracer::Int64: Activate Passive Tracers or not?\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Solver","page":"Available functions","title":"LaMEM.LaMEM_Model.Solver","text":"Structure that contains the LaMEM solver options\n\nSolverType::String: solver employed [\"direct\" or \"multigrid\"]\nDirectSolver::String: mumps/superlu_dist/pastix/umfpack (requires these external PETSc packages to be installed!)\nDirectPenalty::Float64: penalty parameter [employed if we use a direct solver]\nMGLevels::Int64: number of MG levels [default=3]\nMGSweeps::Int64: number of MG smoothening steps per level [default=10]\nMGSmoother::String: type of smoothener used [chebyshev or jacobi]\nMGJacobiDamp::Float64: Dampening parameter [only employed for Jacobi smoothener; default=0.6]\nMGCoarseSolver::String: coarse grid solver if using multigrid [\"direct\" / \"mumps\" / \"superlu_dist\" or \"redundant\" - more options specifiable through the command-line options -crs_ksp_type & -crs_pc_type]\nMGRedundantNum::Int64: How many times do we copy the coarse grid? [only employed for redundant solver; default is 4]\nMGRedundantSolver::String: The coarse grid solver for each of the redundant solves [only employed for redundant; options are \"mumps\"/\"superlu_dist\" with default \"superlu_dist\"]\nPETSc_options::Vector{String}: List with (optional) PETSc options\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Time","page":"Available functions","title":"LaMEM.LaMEM_Model.Time","text":"Structure that contains the LaMEM timestepping information. An explanation of the paramneters is given in the struct `Time_info`\n\ntime_end::Float64: simulation end time\ndt::Float64: initial time step\ndt_min::Float64: minimum time step (declare divergence if lower value is attempted)\ndt_max::Float64: maximum time step\ndt_out::Float64: output step (output at least at fixed time intervals)\ninc_dt::Float64: time step increment per time step (fraction of unit)\nCFL::Float64: CFL (Courant-Friedrichs-Lewy) criterion\nCFLMAX::Float64: CFL criterion for elasticity\nnstep_max::Int64: maximum allowed number of steps (lower bound: timeend/dtmax)\nnstep_out::Int64: save output every n steps; Set this to -1 to deactivate saving output\nnstep_rdb::Int64: save restart database every n steps\nnum_dt_periods::Int64: number of time stepping periods\ntime_dt_periods::Vector{Int64}: timestamps where timestep should be fixed (first entry has to 0)\nstep_dt_periods::Vector{Float64}: target timesteps ar timestamps above\nnstep_ini::Int64: save output for n initial steps\ntime_tol::Float64: relative tolerance for time comparisons\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.VelCylinder","page":"Available functions","title":"LaMEM.LaMEM_Model.VelCylinder","text":"LaMEM boundary condition internal velocty cylinder `VelCylinder` object\n\nbaseX::Float64: X-coordinate of base of cylinder\nbaseY::Float64: Y-coordinate of base of cylinder\nbaseZ::Float64: Z-coordinate of base of cylinder\ncapX::Float64: X-coordinate of cap of cylinder\ncapY::Float64: Y-coordinate of cap of cylinder\ncapZ::Float64: Z-coordinate of cap of cylinder\nradius::Float64: radius of cylinder\nvx::Union{Nothing, Float64}: Vx velocity of cylinder (default is unconstrained)\nvy::Union{Nothing, Float64}: Vy velocity of cylinder (default is unconstrained)\nvz::Union{Nothing, Float64}: Vz velocity of cylinder (default is unconstrained)\nadvect::Int64: cylinder advection flag\nvmag::Float64: magnitude of velocity applied along the cylinder's axis of orientation\ntype::String: velocity profile [uniform or parabolic]\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.VelocityBox","page":"Available functions","title":"LaMEM.LaMEM_Model.VelocityBox","text":"Define velocity regions within the modelling region, by specifying its center point and width along the three axis.\n\ncenX::Float64: X-coordinate of center of box\ncenY::Float64: Y-coordinate of center of box\ncenZ::Float64: Z-coordinate of center of box\nwidthX::Float64: Width of box in x-direction\nwidthY::Float64: Width of box in y-direction\nwidthZ::Float64: Width of box in Z-direction\nvx::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)\nvy::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)\nvz::Union{Nothing, Float64}: Vx velocity of box (default is unconstrained)\nadvect::Int64: box advection flag\n\n\n\n\n\n","category":"type"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.above_surface-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"GeophysicalModelGenerator.above_surface","text":"above_surface(model::Model, DataSurface_Cart::CartData)\n\nReturns a boolean grid that is true if the Phases/Temp grid are above the surface\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_box!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_box!","text":"add_box!(model::Model; xlim=Tuple{2}, [ylim=Tuple{2}], zlim=Tuple{2},\n Origin=nothing, StrikeAngle=0, DipAngle=0,\n phase = ConstantPhase(1),\n T=nothing )\n\nAdds a box with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models See the documentation of the GMG routine for the full options.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_cylinder!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_cylinder!","text":"add_cylinder!(model::Model; # required input\n base=Tuple{3}, cap=Tuple{3}, radius=Tuple{1}, # center and radius of the sphere\n phase = ConstantPhase(1), # Sets the phase number(s) in the sphere\n T=nothing ) # Sets the thermal structure (various fucntions are available)\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_ellipsoid!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_ellipsoid!","text":"add_ellipsoid!(model::Model; # required input\n cen=Tuple{3}, axes=Tuple{3}, # center and semi-axes of the ellpsoid\n Origin=nothing, StrikeAngle=0, DipAngle=0, # origin & dip/strike\n phase = ConstantPhase(1), # Sets the phase number(s) in the box\n T=nothing )\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_layer!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_layer!","text":"add_layer!(model::Model; xlim, ylim, zlim=Tuple{2},\n phase = ConstantPhase(1),\n T=nothing )\n\nAdds a layer with phase & temperature structure to a 3D model setup. This simplifies creating model geometries in geodynamic models See the documentation of the GMG routine for the full options.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_polygon!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_polygon!","text":"add_polygon!(model::Model; # required input\n xlim::Vector, \n ylim=Vector,\n zlim=Vector(), \n phase = ConstantPhase(1), # Sets the phase number(s) in the box\n T=nothing)\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_slab!-Tuple{Model, GeophysicalModelGenerator.Trench}","page":"Available functions","title":"GeophysicalModelGenerator.add_slab!","text":"add_slab!(model::Model; # required input\n trench::Trench; \n phase = ConstantPhase(1), # Sets the phase number(s) in the box\n T=nothing)\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_sphere!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_sphere!","text":"add_sphere!(model::Model; cen=Tuple{3}, radius=Tuple{1}, phase = ConstantPhase(1), T=nothing)\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.add_stripes!-Tuple{Model}","page":"Available functions","title":"GeophysicalModelGenerator.add_stripes!","text":"add_stripes!(Phase, Grid::AbstractGeneralGrid;\n stripAxes = (1,1,0),\n stripeWidth = 0.2,\n stripeSpacing = 1,\n Origin = nothing,\n StrikeAngle = 0,\n DipAngle = 10,\n phase = ConstantPhase(3),\n stripePhase = ConstantPhase(4))\n\nSee the documentation of the GMG routine\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#GeophysicalModelGenerator.below_surface-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"GeophysicalModelGenerator.below_surface","text":"below_surface(model::Model, DataSurface_Cart::CartData)\n\nReturns a boolean grid that is true if the Phases/Temp grid are below the surface\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.IO_functions.passivetracer_time","page":"Available functions","title":"LaMEM.IO_functions.passivetracer_time","text":"\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.IO_functions.passivetracer_time-Tuple{Union{Int64, Vector{Int64}}, Model}","page":"Available functions","title":"LaMEM.IO_functions.passivetracer_time","text":"PT = passivetracer_time(ID::Union{Vector{Int64},Int64}, model::Model)\n\nThis reads passive tracers with ID from a LaMEM simulation specified by model, and returns a named tuple with the temporal evolution of these passive tracers. We return x,y,z coordinates and all fields specified in FileName for particles number ID.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.IO_functions.read_LaMEM_simulation-Tuple{Model}","page":"Available functions","title":"LaMEM.IO_functions.read_LaMEM_simulation","text":"Timestep, FileNames, Time = read_LaMEM_simulation(model::Model; phase=false, surf=false, passive_tracers=false)\n\nReads a LaMEM simulation as specified in model and returns the timesteps, times and filenames of that simulation once it is finished.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.IO_functions.read_LaMEM_timestep","page":"Available functions","title":"LaMEM.IO_functions.read_LaMEM_timestep","text":"data, time = read_LaMEM_timestep(model::Model, TimeStep::Int64=0; fields=nothing, phase=false, surf=false, last=true)\n\nReads a specific Timestep from a simulation specified in model\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Check_LaMEM_Model-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.Check_LaMEM_Model","text":"Check_LaMEM_Model(m::Model)\n\nChecks the LaMEM Setup Model m for errors\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.Create_Grid-NTuple{15, Any}","page":"Available functions","title":"LaMEM.LaMEM_Model.Create_Grid","text":"This creates a LaMEM grid\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.UpdateDefaultParameters-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.UpdateDefaultParameters","text":"model = UpdateDefaultParameters(model::Model)\n\nThis updates the default parameters depending on some of the input parameters. If you activate passive tracers, for example, it will also activate output for that \n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.above_surface!-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"LaMEM.LaMEM_Model.above_surface!","text":"above_surface!(model::Model, DataSurface_Cart::CartData; phase::Int64=nothing, T::Number=nothing)\n\nSets the Temp or Phases above the surface DataSurface_Cart to a constant value.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_dike!-Tuple{Model, Dike}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_dike!","text":"add_dike!(model::Model, dike::Dike)\n\nThis adds a phase transition phase_trans to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_geom!-Tuple{Model, Any}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_geom!","text":"add_geom!(model::Model, geom_object)\n\nThis adds an internal geometric primitive object geom_object to the LaMEM Model Setup model.\n\nCurrently available primitive geom objects are:\n\nGeomSphere\nGeomEllipsoid\nGeomBox\nGeomLayer\nGeomCylinder\nGeomRidgeSeg\nGeomHex\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_geom!-Tuple{Model, Vararg{Any}}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_geom!","text":"add_geom!(model::Model, geom_object)\n\nAdd several geometric objects @ once.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_petsc!-Tuple{Model, Vararg{Any}}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_petsc!","text":"add_petsc!(model::Model, option::String)\n\nAdds one or more PETSc options to the model \n\nExample\n\njulia> d = Model()\njulia> add_petsc!(d,\"-snes_npicard 3\")\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_phase!-Tuple{Model, Phase}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_phase!","text":"add_phase!(model::Model, phase::Phase)\n\nThis adds a phase (with material properties) to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_phase!-Tuple{Model, Vararg{Any}}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_phase!","text":"add_phase!(model::Model, phases...)\n\nAdd several phases @ once.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_phaseaggregate!-Tuple{Model, PhaseAggregate}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_phaseaggregate!","text":"add_phaseaggregate!(model::Model, phaseagg::PhaseAggregate)\n\nThis adds a phase aggregate law phaseagg to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_phasetransition!-Tuple{Model, PhaseTransition}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_phasetransition!","text":"add_phasetransition!(model::Model, phase_trans::PhaseTransition)\n\nThis adds a phase transition phase_trans to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_softening!-Tuple{Model, Softening}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_softening!","text":"add_softening!(model::Model, soft::Softening)\n\nThis adds a plastic softening law soft to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_topography!-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_topography!","text":"add_topography!(model::Model, topography::CartData; surf_air_phase=0, surf_topo_file=\"topography.txt\", open_top_bound=1, surf_level=0.0)\n\nAdds the topography surface to the model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_vbox!-Tuple{Model, Vararg{Any}}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_vbox!","text":"add_vbox!(model::Model, vboxes...)\n\nAdd several phases @ once.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.add_vbox!-Tuple{Model, VelocityBox}","page":"Available functions","title":"LaMEM.LaMEM_Model.add_vbox!","text":"add_vbox!(model::Model, vbox::VelocityBox) This adds a vbox (with its properties) to model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.adjust_for_platforms-Tuple{Any, Int64}","page":"Available functions","title":"LaMEM.LaMEM_Model.adjust_for_platforms","text":"model, cores = adjust_for_platforms(model, cores::Int64)\n\nOn certain platforms we have restrictions (MPI is broken on windows currently, so we need to adjust things accordingly)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.below_surface!-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"LaMEM.LaMEM_Model.below_surface!","text":"below_surface!(model::Model, DataSurface_Cart::CartData; phase::Union{Int64,Nothing}=nothing, T::Union{Number,Nothing}=nothing)\n\nSets the Temp or Phases below the surface DataSurface_Cart to a constant value.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.compute_dof-Tuple{Tuple{Int64, Int64, Int64}}","page":"Available functions","title":"LaMEM.LaMEM_Model.compute_dof","text":"Returns the total degrees of freedom for a LaMEM simulation\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.copy_phase-Tuple{Phase}","page":"Available functions","title":"LaMEM.LaMEM_Model.copy_phase","text":"copy_phase(phase::Phase; kwargs...)\n\nThis copies a phase with material properties, while allowing to change some parameters\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.create_initialsetup","page":"Available functions","title":"LaMEM.LaMEM_Model.create_initialsetup","text":"create_initialsetup(model::Model, cores::Int64=1, args::String=\"\"; verbose=verbose)\n\nCreates the initial model setup of LaMEM from model, which includes:\n\nWriting the LaMEM (*.dat) input file\n\nand in case we do not employt geometric primitives to create the setup:\n\nWrite the VTK file (if requested when model.Output.write_VTK_setup=true)\nWrite the marker files to disk (if model.ModelSetup.msetup=\"files\")\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.cross_section","page":"Available functions","title":"LaMEM.LaMEM_Model.cross_section","text":"data_tuple, axes_str = cross_section(model::LaMEM.Model, field=:phases; x=nothing, y=nothing, z=nothing)\n\nThis creates a cross-section through the initial model setup & returns a 2D array\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.cross_section-2","page":"Available functions","title":"LaMEM.LaMEM_Model.cross_section","text":"Cross = cross_section(cart::CartData, field::Symbol =:phase; x=nothing, y=nothing, z=nothing)\n\nCreates a cross-section through the data and returns x,z coordinates\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.digitsep-Tuple{Integer}","page":"Available functions","title":"LaMEM.LaMEM_Model.digitsep","text":"digitsep(value::Integer; separator=\",\", per_separator=3)\n\nConvert an integer to a string, separating each per_separator digits by separator.\n\ndigitsep(12345678) # \"12,345,678\"\ndigitsep(12345678, seperator= \"'\") # \"12'345'678\"\ndigitsep(12345678, seperator= \"-\", per_separator=4) # \"1234-5678\"\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.flatten-Tuple{GeophysicalModelGenerator.CartData, Symbol, Any, Any, Any}","page":"Available functions","title":"LaMEM.LaMEM_Model.flatten","text":"Creates a 2D array out of a cross-section and a specified data field\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.hasplasticity-Tuple{Phase}","page":"Available functions","title":"LaMEM.LaMEM_Model.hasplasticity","text":"hasplasticity(p::Phase)\n\ntrue if p contains plastic parameters (cohesion or friction angle)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.is_rectilinear-Tuple{GeophysicalModelGenerator.CartData}","page":"Available functions","title":"LaMEM.LaMEM_Model.is_rectilinear","text":"is_rectilinear(topography::CartData)\n\nChecks whether topography is rectilinear\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.isdefault-Tuple{Any, Any}","page":"Available functions","title":"LaMEM.LaMEM_Model.isdefault","text":"isdefault(s1::S, s_default::S)\n\nChecks whether a struct s1 has default parameters s_default\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.prepare_lamem","page":"Available functions","title":"LaMEM.LaMEM_Model.prepare_lamem","text":"prepare_lamem(model::Model, cores::Int64=1, args:String=\"\"; verbose=false)\n\nPrepares a LaMEM run for the parameters that are specified in model, without running the simulation 1) Create the *.dat file 2) Write markers to disk in case we use a \"files\" setup\n\nThis is useful if you want to prepare a model on one machine but run it on another one (e.g. a cluster)\n\nSet model.Output.write_VTK_setup to true if you want to write a VTK file of the model setup\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.print_short-Tuple{Multigrid}","page":"Available functions","title":"LaMEM.LaMEM_Model.print_short","text":"This creates a single string, so we can use it in the command line\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.replace_phase!-Tuple{Model, Phase}","page":"Available functions","title":"LaMEM.LaMEM_Model.replace_phase!","text":"replace_phase!(model::Model, phase_new::Phase; ID::Int64=nothing, Name::String=nothing)\n\nThis replaces a phase within a LaMEM Model Setup model with phase_new either based on its Name or ID. Note that it is expected that only one such phase is present in the current setup.\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_geom!-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_geom!","text":"rm_geom!(model::Model)\n\nThis removes all existing geometric objects from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_last_phase!-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_last_phase!","text":"rm_last_phase!(model::Model, phase::Phase)\n\nThis removes the last added phase from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_last_vbox!-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_last_vbox!","text":"rmlastvbox!(model::Model) This removes the last added vbox from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_phase!-Tuple{Model, Int64}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_phase!","text":"rm_phase!(model::Model, ID::Int64)\n\nThis removes a phase with ID from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_phase!-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_phase!","text":"rm_phase!(model::Model)\n\nThis removes all existing phases from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.rm_vbox!-Tuple{Model}","page":"Available functions","title":"LaMEM.LaMEM_Model.rm_vbox!","text":"rm_vbox!(model::Model)\n\nThis removes all existing velocity boxes from model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.set_air-Tuple{}","page":"Available functions","title":"LaMEM.LaMEM_Model.set_air","text":"set_air(; Name=\"air\", ID=0, rho=1, alpha=nothing, eta=1e17, G=nothing, nu=nothing, fr=nothing, ch=nothing, k=30,Cp=1000)\n\nSets an air phase, with high conductivity \n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.set_geom!-Tuple{Model, GeomSphere}","page":"Available functions","title":"LaMEM.LaMEM_Model.set_geom!","text":"This sets the geometry \n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.stress_strainrate_0D-Tuple{Any, Vector}","page":"Available functions","title":"LaMEM.LaMEM_Model.stress_strainrate_0D","text":"τ = stress_strainrate_0D(rheology, ε_vec::Vector; n=8, T=700, nstep_max=2, clean=true)\n\nComputes the stress for a given strain rate and 0D rheology setup, for viscous creep rheologies. n is the resolution in x,z, T the temperature, nstep_max the number of time steps, ε_vec the strainrate vector (in 1/s). \n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.within_bounds-Tuple{Model, GeophysicalModelGenerator.CartData}","page":"Available functions","title":"LaMEM.LaMEM_Model.within_bounds","text":"within_bounds(model::Model, topography::CartData)\n\nVerifies that the bounds of the topography grid are larger than that of the model\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(d::Model,fname::String; dir=pwd())\n\nWrites a LaMEM input file based on the data stored in Model\n\n\n\n\n\n","category":"function"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, BoundaryConditions}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::BoundaryConditions)\n\nWrites the boundary conditions related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, FreeSurface}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::FreeSurface)\n\nWrites the free surface related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomBox}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomBox)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomCylinder}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomCylinder)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomEllipsoid}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomEllipsoid)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomHex}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomHex)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomLayer}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomLayer)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomRidgeSeg}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomRidgeSeg)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, GeomSphere}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomSphere)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, Grid}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::Grid)\n\nThis writes grid info to a LaMEM input file\n\nExample\n\njulia> d=LaMEM.Grid(coord_x=[0.0, 0.7, 0.8, 1.0], bias_x=[0.3,1.0,3.0], nel_x=[10,4,2])\njulia> io = open(\"test.dat\",\"w\")\njulia> LaMEM.write_LaMEM_inputFile(io, d)\njulia> close(io)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, Materials}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::Output)\n\nWrites the free surface related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, ModelSetup}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::ModelSetup)\n\nWrites options related to the Model Setup to disk\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, Output}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::Output)\n\nWrites the free surface related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, PassiveTracers}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::PassiveTracers)\n\nWrites the boundary conditions related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, SolutionParams}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::SolutionParams)\n\nWrites the boundary conditions related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, Solver}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::Solver)\n\nWrites the free surface related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, Time}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"Writes the Time related parameters to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile-Tuple{Any, VelocityBox}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile","text":"write_LaMEM_inputFile(io, d::GeomSphere)\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.LaMEM_Model.write_LaMEM_inputFile_PETSc-Tuple{Any, Solver}","page":"Available functions","title":"LaMEM.LaMEM_Model.write_LaMEM_inputFile_PETSc","text":"write_LaMEM_inputFile_PETSc(io, d::Solver)\n\nWrites the (optional) PETSc options to file\n\n\n\n\n\n","category":"method"},{"location":"LaMEM_ModelFunctions/#LaMEM.Run.run_lamem","page":"Available functions","title":"LaMEM.Run.run_lamem","text":"run_lamem(model::Model, cores::Int64=1, args:String=\"\"; wait=true)\n\nPerforms a LaMEM run for the parameters that are specified in model\n\n\n\n\n\n","category":"function"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"EditURL = \"../../example_scripts/Subduction3D.jl\"","category":"page"},{"location":"Subduction3D/#3D-Subduction-example","page":"Example 4: 3D Subduction","title":"3D Subduction example","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"This is a 3D subduction example for LaMEM.jl that illustrates how to use the julia interface. This is very similar to the setup described by Schellart and coworkers in a 2007 nature paper in which they demonstrate that toroidal flow changes the slab curvature during subduction as a function of slab width.","category":"page"},{"location":"Subduction3D/#1.-Generate-main-model-setup","page":"Example 4: 3D Subduction","title":"1. Generate main model setup","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"We first load the packages:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"using LaMEM, GeophysicalModelGenerator","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"Next, we generate the main model setup, specifying the resolution and grid dimensions. Note that a range of default values will be set, depending on the parameters you specify.","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"model = Model(\n # Define the grid\n Grid(nel=(128,32,64), x=[-3960, 500], y=[0,2640], z=[-660 ,0]),\n\n # No slip lower boundary; the rest is free slip\n BoundaryConditions(noslip = [0, 0, 0, 0, 1, 0]),\n\n # We use a multigrid solver with 4 levels:\n Solver(SolverType=\"multigrid\", MGLevels=4, MGCoarseSolver=\"mumps\",\n PETSc_options=[ \"-snes_type ksponly\",\n \"-js_ksp_rtol 1e-3\",\n \"-js_ksp_atol 1e-4\",\n \"-js_ksp_monitor\"]),\n\n # Output filename\n Output(out_file_name=\"Subduction_3D\", out_dir=\"Subduction_3D\"),\n\n # Timestepping etc\n Time(nstep_max=200, nstep_out=5, time_end=100, dt_min=1e-5),\n\n # Scaling:\n Scaling(GEO_units(length=1km, stress=1e9Pa) )\n )","category":"page"},{"location":"Subduction3D/#2.-Define-geometry","page":"Example 4: 3D Subduction","title":"2. Define geometry","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"Next, we specify the geometry of the model, using the AddBox! function from GeophysicalModelGenerator. We start with the horizontal part of the slab. The function AddBox! allows you to specify a layered lithosphere; here we have a crust and mantle. It also allows specifying a thermal structure. Since the current setup is only mechanical, we don't specify that here.","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"add_box!(model, xlim=(-3000,-1000), ylim=(0,1000), zlim=(-80,0), phase=LithosphericPhases(Layers=[20,60], Phases=[1,2]))","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"The inclined part of the slab is generate by giving it a dip:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"add_box!(model, xlim=(-1000,-810), ylim=(0,1000), zlim=(-80,0), phase=LithosphericPhases(Layers=[20,60], Phases=[1,2]), DipAngle=16)","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"There is a simple way to have a quick look at this setup by using the Plots.jl package:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"using Plots\nplot_cross_section(model, y=100, field=:phase)","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"Which will give the following plot: (Image: 2D cross section)","category":"page"},{"location":"Subduction3D/#3.-Add-material-properties:","page":"Example 4: 3D Subduction","title":"3. Add material properties:","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"We can specify material properties by using the Phase function","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"mantle = Phase(Name=\"mantle\",ID=0,eta=1e21,rho=3200)\ncrust = Phase(Name=\"crust\", ID=1,eta=1e21,rho=3280)\nslab = Phase(Name=\"slab\", ID=2,eta=2e23,rho=3280)","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"and we can add them to the model with:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"add_phase!(model, mantle, slab, crust)","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"You can check that this is set with:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"model","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"LaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(128, 32, 64); xϵ(-3960.0, 500.0), yϵ(0.0, 2640.0), zϵ(-660.0, 0.0)\n|-- Time : nstep_max=200; nstep_out=5; time_end=100.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 1, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : multigrid solver; coarse grid solver=mumps; 4 levels\n|-- Model setup options : Type=files;\n|-- Output options : filename=Subduction_3D; pvd=1; avd=0; surf=0\n|-- Materials : 3 phases;","category":"page"},{"location":"Subduction3D/#4.-Run-the-model","page":"Example 4: 3D Subduction","title":"4. Run the model","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"on windows MPI + mumps currently does not work","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"if Sys.iswindows()\n model.Solver.MGCoarseSolver = \"direct\"\nend","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"Add this stage, we are ready to run the simulation. On my machine it takes around 4 seconds per timestep on 8 cores:","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"try testing == true","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"if we run this as part of the test suite, use fewer timesteps","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":" run_lamem(model, 8, \"-nstep_max 2 -nstep_out 1\")\ncatch\n run_lamem(model, 8) # run on 8 cores (if possible)\nend","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"The results looks like this with paraview: (Image: 3D subduction paraview) Note that this is a significantly higher resolution than the original paper, which was run on an HPC system (admittedly, this was 20 years ago).","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"The file Subduction_3D.jl in /scripts reproduces this example","category":"page"},{"location":"Subduction3D/#Markdown-page-generation","page":"Example 4: 3D Subduction","title":"Markdown page generation","text":"","category":"section"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"#This file was generated using Literate:\n#Literate.markdown(\"Subduction3D.jl\",\"../docs/src/\",keepcomments=true, execute=false, codefence = \"```julia\" => \"```\")","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"","category":"page"},{"location":"Subduction3D/","page":"Example 4: 3D Subduction","title":"Example 4: 3D Subduction","text":"This page was generated using Literate.jl.","category":"page"},{"location":"readtimesteps/#Read-timesteps-back-into-LaMEM","page":"Reading timesteps","title":"Read timesteps back into LaMEM","text":"","category":"section"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"If you want to quantitatively do something with the results, there is an easy way to read the output of a LaMEM timestep back into julia. All routines related to that are part of the LaMEM.IO module.","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> using LaMEM","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"You can first read the *.pvd file in the directory to see which timesteps are available:","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> FileName=\"FB_multigrid\"\njulia> DirName =\"test\"\njulia> Timestep, Filenames, Time = read_LaMEM_simulation(FileName, DirName)\n([0, 1], [\"Timestep_00000000_0.00000000e+00/FB_multigrid.pvtr\", \"Timestep_00000001_6.72970343e+00/FB_multigrid.pvtr\"], [0.0, 6.729703])","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"We can read a particular timestep (say 1) with:","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> data, time = read_LaMEM_timestep(FileName, 1, DirName)\n(CartData \n size : (33, 33, 33)\n x ϵ [ 0.0 : 1.0]\n y ϵ [ 0.0 : 1.0]\n z ϵ [ 0.0 : 1.0]\n fields : (:phase, :visc_total, :visc_creep, :velocity, :pressure, :strain_rate, :j2_dev_stress, :j2_strain_rate)\n attributes: [\"note\"]\n, [6.729703])","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"The output is in a CartData structure (as defined in GeophysicalModelGenerator).","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"If you do not indicate a directory name (DirName) it'll look in your current directory. The default above will load the main LaMEM simulation output. Alternatively, you can also load the phase information by specify the optional keyword phase=true:","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> data, time = read_LaMEM_timestep(FileName, 1, DirName, phase=true)\n(CartData \n size : (96, 96, 96)\n x ϵ [ 0.0052083334885537624 : 0.9947916269302368]\n y ϵ [ 0.0052083334885537624 : 0.9947916269302368]\n z ϵ [ 0.0052083334885537624 : 0.9947916269302368]\n fields : (:phase,)\n attributes: [\"note\"]\n, [6.729703])","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"In the same way, you can load the internal free surface with surf=true (if that was saved), or passive tracers (passive_tracers=true). If you don't want to load all the fields in the file back to julia, you can check which fields are available:","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> read_LaMEM_fieldnames(FileName, DirName)\n(\"phase [ ]\", \"visc_total [ ]\", \"visc_creep [ ]\", \"velocity [ ]\", \"pressure [ ]\", \"strain_rate [ ]\", \"j2_dev_stress [ ]\", \"j2_strain_rate [ ]\")","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"and load only part of those:","category":"page"},{"location":"readtimesteps/","page":"Reading timesteps","title":"Reading timesteps","text":"julia> data, time = read_LaMEM_timestep(FileName, 1, DirName, fields=(\"phase [ ]\", \"visc_total [ ]\",\"velocity [ ]\"))\n(CartData \n size : (33, 33, 33)\n x ϵ [ 0.0 : 1.0]\n y ϵ [ 0.0 : 1.0]\n z ϵ [ 0.0 : 1.0]\n fields : (:phase, :visc_total, :velocity)\n attributes: [\"note\"]\n, [6.729703])","category":"page"},{"location":"juliasetup_pluto/#Using-Pluto-or-Jupyter-notebooks","page":"Notebooks","title":"Using Pluto or Jupyter notebooks","text":"","category":"section"},{"location":"juliasetup_pluto/#Pluto","page":"Notebooks","title":"Pluto","text":"","category":"section"},{"location":"juliasetup_pluto/","page":"Notebooks","title":"Notebooks","text":"You can also run LaMEM directly using Pluto notebooks:","category":"page"},{"location":"juliasetup_pluto/","page":"Notebooks","title":"Notebooks","text":"julia> using Pluto\njulia> Pluto.run()","category":"page"},{"location":"juliasetup_pluto/","page":"Notebooks","title":"Notebooks","text":"we have provided examples in the notebooks directory of the LaMEM.jl package.","category":"page"},{"location":"juliasetup_pluto/#Jupyter","page":"Notebooks","title":"Jupyter","text":"","category":"section"},{"location":"juliasetup_pluto/","page":"Notebooks","title":"Notebooks","text":"And for the ones of you that are more used to Jupyter notebooks, we also provide an example. Note that this will require you to install the required packages in julia first and use the IJulia package:","category":"page"},{"location":"juliasetup_pluto/","page":"Notebooks","title":"Notebooks","text":"julia> using IJulia\njulia> notebook()","category":"page"},{"location":"juliasetup_LaPalma/#La-Palma-Volcano-setup","page":"Example 2: Volcano","title":"La Palma Volcano setup","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"In this example, we will show how to create a 3D model setup for the 2020 La Palma eruption. We mainly focus on the LaMEM part; see the GeophysicalModelGenerator package for more details on how to plot earthquake data etc.","category":"page"},{"location":"juliasetup_LaPalma/#1.-Load-packages-and-topography","page":"Example 2: Volcano","title":"1. Load packages & topography","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Let's start with what we need:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> using LaMEM, GeophysicalModelGenerator, GMT, Plots\nLoading GMT routines within GMG\nWARNING: using GMT.meshgrid in module GeophysicalModelGenerator conflicts with an existing identifier.\nadding Plots.jl plotting extensions for LaMEM","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Load the topography, choose a projection point & project the topography to cartesian coordinates:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> Topo = import_topo(lon = [-18.7, -17.1], lat=[28.0, 29.2], file=\"@earth_relief_03s.grd\");\njulia> proj = ProjectionPoint(Lon=-17.84, Lat=28.56);\njulia> Topo_cart = convert2CartData(Topo, proj)\nCartData \n size : (1921, 1441, 1)\n x ϵ [ -86.09445705828863 : 73.67229892155609]\n y ϵ [ -63.5531883197492 : 73.28446155584604]\n z ϵ [ -4.38352685546875 : 2.414]\n fields : (:Topography,)","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"This shows the dimensions of our domain in kilometers. The issue is that this projected topography is not an orthogonal grid, but (slightly) distorted. In any case, we see the approximate dimensions of the grid (in horizontal directions), so we can create an orthogonal grid on which to project this:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> Topo_LaMEM = CartData(xyz_grid(-70:.2:70,-60:.2:70,0));\njulia> Topo_LaMEM = project_CartData(Topo_LaMEM, Topo, proj)","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"We can plot it with:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> plot_topo(Topo_LaMEM, clim=(-4,4))","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"(Image: LaPalma_topo)","category":"page"},{"location":"juliasetup_LaPalma/#2.-LaMEM-Model-setup","page":"Example 2: Volcano","title":"2. LaMEM Model setup","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Next, we generate a model setup for LaMEM with:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> model = Model(Grid(x=[-50.,50.], y=[-40.,40.], z=[-80,15] , nel=(64,64,32)),\n BoundaryConditions(temp_bot=1350, open_top_bound=1),\n Scaling(GEO_units(stress=1e9Pa, length=1km)),\n Time(nstep_max=20) )\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(64, 64, 32); xϵ(-50.0, 50.0), yϵ(-40.0, 40.0), zϵ(-80.0, 15.0) \n|-- Time : nstep_max=20; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 0 phases; ","category":"page"},{"location":"juliasetup_LaPalma/#Set-geotherm-and-phases","page":"Example 2: Volcano","title":"Set geotherm and phases","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"We can set an initial constant, linear, geotherm with:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> Z = model.Grid.Grid.Z;\njulia> Geotherm=30\njulia> model.Grid.Temp = -Z.*Geotherm;","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"We will cutoff extreme values with:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> model.Grid.Temp[model.Grid.Temp.<20] .= 20;\njulia> model.Grid.Temp[model.Grid.Temp.>1350] .= 1350;\njulia> model.Grid\nLaMEM grid with constant Δ: \n nel : ([64], [64], [32])\n marker/cell : (3, 3, 3)\n x ϵ [-50.0 : 50.0]\n y ϵ [-40.0 : 40.0]\n z ϵ [-80.0 : 15.0]\n Phases : range ϵ [0 - 0]\n Temp : range ϵ [20.0 - 1350.0]","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Set Phases to two everywhere:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> model.Grid.Phases .= 2;","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Now set points above the topography to zero (will be air later), the ones above the topography but below zero to 'water` and below 40 km to mantle (if we had a Moho surface we could use that):","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":" julia> above_surface!(model, Topo_LaMEM, phase=0, T=0)\n julia> model.Grid.Phases[Z.<-0 .&& model.Grid.Phases .== 0] .= 1;\n julia> model.Grid.Phases[Z.<-40] .= 3;","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Finally, we define some magma chambers:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> add_sphere!(model, cen=(0,0,-35), radius=5, phase=ConstantPhase(5), T=ConstantTemp(1200));\njulia> add_ellipsoid!(model, cen=(-1,0,-11), axes=(3,3,8), StrikeAngle=225, DipAngle=45, phase=ConstantPhase(5), T=ConstantTemp(1200));\njulia> add_ellipsoid!(model, cen=(-0,0,-23), axes=(8,8,2), StrikeAngle=0, DipAngle=0, phase=ConstantPhase(5), T=ConstantTemp(1200));","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"We can plot a cross-section through the model:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":" julia> plot_cross_section(model, x=0, field=:phase)","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"(Image: LaPalma_CrossSection)","category":"page"},{"location":"juliasetup_LaPalma/#Set-material-properties","page":"Example 2: Volcano","title":"Set material properties","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"First, we set air and water properties:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> air = set_air(alpha=3e-5, G=1e10, nu=0.2, ch=10e6, fr=30)\nPhase 0 (air): \n rho = 100.0 \n eta = 1.0e17 \n G = 1.0e10 \n nu = 0.2 \n ch = 1.0e7 \n fr = 30.0 \n alpha = 3.0e-5 \n Cp = 1000.0 \n k = 30.0 \njulia> water=deepcopy(air); water.Name=\"water\"; water.ID=1","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Next, we set the crust:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> crust = Phase(Name=\"Crust\", ID=2, rho=2900, alpha=3e-5, disl_prof=\"Mafic_Granulite-Ranalli_1995\",\n G=3e10, nu=0.2, k=3, Cp=1000, ch=10e6, fr=30)\nPhase 2 (Crust): \n rho = 2900.0 \n disl_prof = Mafic_Granulite-Ranalli_1995 \n G = 3.0e10 \n nu = 0.2 \n ch = 1.0e7 \n fr = 30.0 \n alpha = 3.0e-5 \n Cp = 1000.0 \n k = 3.0 ","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"The mantle is done as a copy of that, while changing a few parameters:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":" julia> mantle = copy_phase(crust, Name=\"Mantle\", ID=3, rho=3320.0, disl_prof=\"Dry_Olivine-Ranalli_1995\", G=6.5e10, k=3.3);","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"And we define two different types of magma:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> andesite = Phase(Name=\"andesitic_magma\",ID=4,rho=2700, alpha=3e-5, eta=1e18, G=1.5e10, nu=0.2, k=3, Cp=1000, T=980, ch=1e7, fr=30);\njulia> dacite = copy_phase(andesite,Name=\"dacite_magma\", ID=5, rho=2575.0, eta=1e19, T=800.0)","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Now we add all of this to the model:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> rm_phase!(model)\njulia> add_phase!(model, air, water, crust, mantle, andesite, dacite)","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"And check that we indeed have 6 phases:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> model\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(64, 64, 32); xϵ(-50.0, 50.0), yϵ(-40.0, 40.0), zϵ(-80.0, 15.0) \n|-- Time : nstep_max=50; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 0 phases; ","category":"page"},{"location":"juliasetup_LaPalma/#Add-topography-to-model","page":"Example 2: Volcano","title":"Add topography to model","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"We can add the topography grid that we created earlier to the model with:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> add_topography!(model, Topo_LaMEM)","category":"page"},{"location":"juliasetup_LaPalma/#Set-solver-options","page":"Example 2: Volcano","title":"Set solver options","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"You will want to use a multigrid solver in this case:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> model.Solver = Solver(SolverType=\"multigrid\", MGLevels=4)","category":"page"},{"location":"juliasetup_LaPalma/#3.-Run-LaMEM","page":"Example 2: Volcano","title":"3. Run LaMEM","text":"","category":"section"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"Running LaMEM is simple; here on 4 processors:","category":"page"},{"location":"juliasetup_LaPalma/","page":"Example 2: Volcano","title":"Example 2: Volcano","text":"julia> run_lamem(model, 4)\nSaved file: Model3D.vts\nWritten LaMEM topography file: topography.txt\nWriting LaMEM marker file -> ./markers/mdb.00000000.dat\nWriting LaMEM marker file -> ./markers/mdb.00000001.dat\nWriting LaMEM marker file -> ./markers/mdb.00000002.dat\nWriting LaMEM marker file -> ./markers/mdb.00000003.dat\n-------------------------------------------------------------------------- \n Lithosphere and Mantle Evolution Model \n Compiled: Date: Apr 7 2023 - Time: 22:11:23 \n Version : 1.2.4 \n-------------------------------------------------------------------------- \n STAGGERED-GRID FINITE DIFFERENCE CANONICAL IMPLEMENTATION \n-------------------------------------------------------------------------- \nParsing input file : output.dat \nFinished parsing input file : output.dat \n--------------------------------------------------------------------------\nScaling parameters:\n Temperature : 1000. [C/K] \n Length : 1000. [m] \n Viscosity : 1e+20 [Pa*s] \n Stress : 1e+09 [Pa] \n--------------------------------------------------------------------------","category":"page"},{"location":"listfunctions/#List-of-all-functions","page":"List of functions","title":"List of all functions","text":"","category":"section"},{"location":"listfunctions/","page":"List of functions","title":"List of functions","text":"These are all functions that are available in the package, which can roughly be divided into two groups (running & reading LaMEM)","category":"page"},{"location":"listfunctions/#Julia-interface-to-LaMEM","page":"List of functions","title":"Julia interface to LaMEM","text":"","category":"section"},{"location":"listfunctions/","page":"List of functions","title":"List of functions","text":"Modules = [ LaMEM.LaMEM_Model]","category":"page"},{"location":"listfunctions/#Running-LaMEM","page":"List of functions","title":"Running LaMEM","text":"","category":"section"},{"location":"listfunctions/","page":"List of functions","title":"List of functions","text":"Modules = [LaMEM.Run]","category":"page"},{"location":"listfunctions/#LaMEM.Run.deactivate_multithreading-Tuple{Cmd}","page":"List of functions","title":"LaMEM.Run.deactivate_multithreading","text":"deactivate_multithreading(cmd)\n\nThis deactivates multithreading\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.Run.execute_command","page":"List of functions","title":"LaMEM.Run.execute_command","text":"str = execute_command(command=\"ls\")\n\nExecutes a command-line code and returns the output as a string\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.Run.extract_info_logfile-Tuple{Any, String}","page":"List of functions","title":"LaMEM.Run.extract_info_logfile","text":"value = extract_info_logfile(lines, keyword::String; entry=1, LaMEM=true)\n\nInternal function to extract information from the logfile\n\nNote that the LaMEM keywords should contain \":\" at the end, while the PETSc keywords should not, but we have to indicate the entry number for the PETSc keywords. Example LaMEM keyword:\n\njulia> val = extract_info_logfile(lines, \"Fine grid cells [nx, ny, nz] :\")\n\"[512, 256, 256]\"\n\nExample PETSc keyword:\n\njulia> coarse_grid_solve = extract_info_logfile(lines, \"MGSmooth Level 0\", LaMEM=false, entry=3)\n9.9174\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.Run.read_LaMEM_logfile-Tuple{String}","page":"List of functions","title":"LaMEM.Run.read_LaMEM_logfile","text":"This reads a LaMEM logfile (provided it was run with \"-log_view\") and collects key results from it; mostly for scalability tests on HPC machines. It returns a markdown summary\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.Run.remove_popup_messages_mac-Tuple{}","page":"List of functions","title":"LaMEM.Run.remove_popup_messages_mac","text":"remove_popup_messages_mac()\n\nOn a Mac with firewall enabled, running LaMEM will result in a popup window that says: \"Accept incoming connections\" which you should Allow or Deny. This is a bit annoying, so this julia script fixes that. Note that you must have administrator rights on your machine as we need to run \"sudo\"\n\nRun this script from the terminal with\n\njulia> remove_popup_messages_mac()\n\nYou need to do this once (every time a new version is installed)\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.Run.run_lamem","page":"List of functions","title":"LaMEM.Run.run_lamem","text":"run_lamem(ParamFile::String, cores::Int64=1, args:String=\"\"; wait=true, deactivate_multithreads=true)\n\nThis starts a LaMEM simulation, for using the parameter file ParamFile on cores number of cores. Optional additional command-line parameters can be specified with args.\n\nExample:\n\nYou can call LaMEM with:\n\njulia> using LaMEM\njulia> ParamFile=\"../../input_models/BuildInSetups/FallingBlock_Multigrid.dat\";\njulia> run_lamem(ParamFile)\n\nDo the same on 2 cores with a command-line argument as:\n\njulia> ParamFile=\"../../input_models/BuildInSetups/FallingBlock_Multigrid.dat\";\njulia> run_lamem(ParamFile, 2, \"-nstep_max = 1\")\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.Run.run_lamem_save_grid","page":"List of functions","title":"LaMEM.Run.run_lamem_save_grid","text":"ProcessorPartFile = run_lamem_save_grid(ParamFile::String, cores::Int64=1; verbose=true, directory=pwd())\n\nThis calls LaMEM simulation, for using the parameter file ParamFile and creates processor partitioning file \"ProcessorPartitioning_Xcpu_X.Y.Z.bin\" for {X} number of cores. \n\nExample:\n\njulia> using LaMEM\njulia> ParamFile=\"../../input_models/BuildInSetups/FallingBlock_Multigrid.dat\";\njulia> ProcessorPartFile = run_lamem_save_grid(ParamFile, 2)\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.Run.show_paths_LaMEM-Tuple{}","page":"List of functions","title":"LaMEM.Run.show_paths_LaMEM","text":"show_paths_LaMEM()\n\nThe downloaded LaMEM binaries can also be called from outside julia (directly from the terminal). In that case, you will need to set load correct dynamic libraries (such as PETSc) and call the correct binaries.\n\nThis function shows this for your system. \n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#Reading-LaMEM-output-back-into-julia","page":"List of functions","title":"Reading LaMEM output back into julia","text":"","category":"section"},{"location":"listfunctions/","page":"List of functions","title":"List of functions","text":"Modules = [LaMEM.IO_functions]","category":"page"},{"location":"listfunctions/#LaMEM.IO_functions.ArrayToTuple-Tuple{Any}","page":"List of functions","title":"LaMEM.IO_functions.ArrayToTuple","text":"data_Field = ArrayToTuple(data_Field)\n\nTransfers a 3D array (n>1) to a tuple of length n.\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.ReadField_3D_pVTR-Tuple{Any, Any}","page":"List of functions","title":"LaMEM.IO_functions.ReadField_3D_pVTR","text":"output, isCell = ReadField_3D_pVTR(data, FieldName::String)\n\nExtracts a 3D data field from a pVTR data structure data\n\nInput:\n\ndata: Data structure obtained with ReadVTRFile\nFieldName: Exact name of the field as specified in the *.vtr file\n\nOutput:\n\ndata_field, isCell: 3D field with data, and a flag that indicates whether it is Cell data (PointData otherwise) data_field is a tuple of size 1, or 3 depending on whether it is a scalar or vector field\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.ReadField_3D_pVTS-Tuple{Any, Any}","page":"List of functions","title":"LaMEM.IO_functions.ReadField_3D_pVTS","text":"data_out, isCell = ReadField_3D_pVTS(pvts, FieldName)\n\ninternal routine to read a 3D pvts file\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.ReadField_3D_pVTU-Tuple{Any, Any}","page":"List of functions","title":"LaMEM.IO_functions.ReadField_3D_pVTU","text":"output, isCell = ReadField_3D_pVTU(data, FieldName::String)\n\nExtracts a 3D data field from a pVTU data structure data Input:\n\ndata: Data structure obtained with ReadVTRFile\nFieldName: Exact name of the field as specified in the *.vtr file\n\nOutput:\n\ndata_field: Array with data, data_field is a tuple of size 1, 3 or 9 depending on whether it is a scalar, vector or tensor field\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.changefolder-Tuple{}","page":"List of functions","title":"LaMEM.IO_functions.changefolder","text":"changefolder()\n\nStarts a GUI on Windowss or Mac machines, which allows you to change our working directory\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.clean_directory","page":"List of functions","title":"LaMEM.IO_functions.clean_directory","text":"clean_directory(DirName)\n\nRemoves all LaMEM timesteps & *.pvd files from the directory DirName\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.IO_functions.compress_pvd-Tuple{String}","page":"List of functions","title":"LaMEM.IO_functions.compress_pvd","text":"compress_pvd(filename_pvd::String; Dir=pwd(), delete_original_files=false)\n\nThis compresses all LaMEM VTR files in a simulation.\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.compress_vtr_file-Tuple{String}","page":"List of functions","title":"LaMEM.IO_functions.compress_vtr_file","text":"filename_compressed::String = compress_vtr_file(filename::String; Dir=pwd(), delete_original_files=false)\n\nCompresses a LaMEM VTR file (loads parallel files & save them again )\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.passivetracer_time","page":"List of functions","title":"LaMEM.IO_functions.passivetracer_time","text":"PT = passivetracer_time(ID::Union{Vector{Int64},Int64}, FileName::String, DirName::String=\"\")\n\nThis reads passive tracers with ID from a LaMEM simulation, and returns a named tuple with the temporal evolution of these passive tracers. We return x,y,z coordinates and all fields specified in the FileName for particles number ID.\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.IO_functions.readPVD-Tuple{String}","page":"List of functions","title":"LaMEM.IO_functions.readPVD","text":"FileNames, Time, Timestep = readPVD(FileName::String)\n\nThis reads a PVD file & returns the FileNames, Time and Timesteps\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_PVTR_file-Tuple{String, String}","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_PVTR_file","text":"data_output = read_LaMEM_PVTR_file(DirName, FileName; fields=nothing)\n\nReads a 3D LaMEM timestep from VTR file FileName, located in directory DirName. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.\n\nIt will return data_output which is a CartData output structure.\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_PVTS_file-Tuple{String, String}","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_PVTS_file","text":"data_output = read_LaMEM_PVTS_file(DirName, FileName; field=nothing)\n\nReads a 3D LaMEM timestep from VTS file FileName, located in directory DirName. Typically this is done to read passive tracers back into julia. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.\n\nIt will return data_output which is a CartData output structure.\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_PVTU_file-Tuple{Any, Any}","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_PVTU_file","text":"data_output = read_LaMEM_PVTU_file(DirName, FileName; fields=nothing)\n\nReads a 3D LaMEM timestep from VTU file FileName, located in directory DirName. Typically this is done to read passive tracers back into julia. By default, it will read all fields. If you want you can only read a specific field. See the function fieldnames to get a list with all available fields in the file.\n\nIt will return data_output which is a CartData output structure.\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_fieldnames","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_fieldnames","text":"read_LaMEM_fieldnames(FileName::String, DirName_base::String=\"\"; phase=false, surf=false, tracers=false)\n\nReturns the names of the datasets stored in FileName\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_simulation","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_simulation","text":"Timestep, FileNames, Time = read_LaMEM_simulation(FileName::String, DirName::String=\"\"; phase=false, surf=false, passive_tracers=false)\n\nReads a LaMEM simulation FileName in directory DirName and returns the timesteps, times and filenames of that simulation.\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.IO_functions.read_LaMEM_timestep","page":"List of functions","title":"LaMEM.IO_functions.read_LaMEM_timestep","text":"data, time = read_LaMEM_timestep(FileName::String, TimeStep::Int64=0, DirName::String=\"\"; fields=nothing, phase=false, surf=false, last=false)\n\nThis reads a LaMEM timestep.\n\nInput Arguments:\n\nFileName: name of the simulation, w/out extension\nTimestep: timestep to be read, unless last=true in which case we read the last one\nDirName: name of the main directory (i.e. where the *.pvd files are located)\nfields: Tuple with optional fields; if not specified all will be loaded\nphase: Loads the phase information of LaMEM if true\nsurf: Loads the free surface of LaMEM if true\npassive_tracers: Loads passive tracers if true\nlast: Loads the last timestep\n\nOutput:\n\ndata: Cartesian data struct with LaMEM output\ntime: The time of the timestep\n\n\n\n\n\n","category":"function"},{"location":"listfunctions/#LaMEM.IO_functions.read_phase_diagram-Tuple{String}","page":"List of functions","title":"LaMEM.IO_functions.read_phase_diagram","text":"out = read_phase_diagram(name::String)\n\nReads a phase diagram from a file name and returns a NamedTuple with temperature T, pressure P, melt density ρ_melt, solid density ρ_solid, density ρ and melt fraction ϕ\n\n\n\n\n\n","category":"method"},{"location":"listfunctions/#LaMEM.IO_functions.split_path_name-Tuple{String, String}","page":"List of functions","title":"LaMEM.IO_functions.split_path_name","text":"dir, file = split_path_name(DirName_base::String, FileName::String)\n\nRoutine that splits the name in a directory DirName_base and a filename FileName\n\n\n\n\n\n","category":"method"},{"location":"juliasetup_TMSubduction/#2D-Thermomechanical-subduction-model","page":"Example 3: 2D Subduction","title":"2D Thermomechanical subduction model","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"In this example, we will show how to create a 2D thermomechanical model of subduction. Here the setup is saved into a julia script. First create a textfile called TM_Subduction_example.jl in your current directory. The easiest is to use Visual Studio Code for this, but you can in principle use any text editor.","category":"page"},{"location":"juliasetup_TMSubduction/#1.-Load-necessary-packages","page":"Example 3: 2D Subduction","title":"1. Load necessary packages","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Next start julia in the directory where you saved TM_Subduction_example.jl, or go to correct directory within julia ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Note that you can do the following steps directy from the julia REPL (command prompt), or you can write them in TM_Subduction_example.jl and run that file by typing","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> include(\"TM_Subduction_example.jl\")","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We get started by loading the required packages:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"using LaMEM, GeophysicalModelGenerator, Plots","category":"page"},{"location":"juliasetup_TMSubduction/#2.-LaMEM-model-setup","page":"Example 3: 2D Subduction","title":"2. LaMEM model setup","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"The setup will include 6 different materials with the following ID's:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"# material id's\n# 0: asthenosphere\n# 1: oceanic crust\n# 2: oceanic lithosphere\n# 3: continental crust\n# 4: continental lithosphere\n# 5: air layer","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model = Model(Grid( x = [-2000.,2000.],\n y = [-2.5,2.5], # <- model is 2D, size in y-direction is choosen to be close to a cube shape for the cell\n z = [-660,40] ,\n nel = (512,1,128) ),\n\n BoundaryConditions( temp_bot = 1565.0,\n temp_top = 20.0,\n open_top_bound = 1),\n Scaling(GEO_units( temperature = 1000,\n stress = 1e9Pa,\n length = 1km,\n viscosity = 1e20Pa*s) ),\n Time(nstep_max=20) ) ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"This initializes the initial LaMEM model setup with a number of default options. On the REPL it will show the following info","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"LaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(512, 1, 128); xϵ(-2000.0, 2000.0), yϵ(-8.0, 8.0), zϵ(-660.0, 40.0) \n|-- Time : nstep_max=20; nstep_out=1; time_end=1.0; dt=0.05\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : direct solver; superlu_dist; penalty term=10000.0\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 0 phases; ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"In this case we assume that we have dimensions in kilometers and times in million years (the default).","category":"page"},{"location":"juliasetup_TMSubduction/#Inspecting/modifying-parameters","page":"Example 3: 2D Subduction","title":"Inspecting/modifying parameters","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Each of the parameters in this model setup can be modified. The easiest way to see what is available is by using the REPL. If you type ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> model.","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"and now use your TAB button, you will see all the fields within the model structure:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> model.\nBoundaryConditions FreeSurface Grid Materials ModelSetup Output Scaling SolutionParams\nSolver Time","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"If you want to see which timestepping parameters are set, you type:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> model.Time\nLaMEM Timestepping parameters: \n time_end = 1.0 \n dt = 0.05 \n dt_min = 0.01 \n dt_max = 0.2 \n dt_out = 0.2 \n inc_dt = 0.1 \n CFL = 0.5 \n CFLMAX = 0.8 \n nstep_max = 20 \n nstep_out = 1 \n nstep_rdb = 100 \n nstep_ini = 1 \n time_tol = 1.0e-8 ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"The parameters that are changed from the default settings are highlighted in blue (not visible on this markdown document, but visible in the REPL). ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"If you want to see what each of these parameters mean, you can get some basic help with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"help?> Time\nsearch: Time time Timer time_ns timedwait mtime ctime @time @timev @timed @time_imports @showtime optimize_ticks optimize_datetime_ticks read_LaMEM_timestep\n\n Structure that contains the LaMEM timestepping information. An explanation of the paramneters is given in the struct `Time_info`\n • time_end::Float64: simulation end time\n • dt::Float64: initial time step\n • dt_min::Float64: minimum time step (declare divergence if lower value is attempted)\n • dt_max::Float64: maximum time step\n • dt_out::Float64: output step (output at least at fixed time intervals)\n • inc_dt::Float64: time step increment per time step (fraction of unit)\n • CFL::Float64: CFL (Courant-Friedrichs-Lewy) criterion\n • CFLMAX::Float64: CFL criterion for elasticity\n • nstep_max::Int64: maximum allowed number of steps (lower bound: timeend/dtmax)\n • nstep_out::Int64: save output every n steps; Set this to -1 to deactivate saving output\n • nstep_rdb::Int64: save restart database every n steps\n • num_dt_periods::Int64: number of time stepping periods\n • time_dt_periods::Vector{Int64}: timestamps where timestep should be fixed (first entry has to 0)\n • step_dt_periods::Vector{Float64}: target timesteps ar timestamps above\n • nstep_ini::Int64: save output for n initial steps\n • time_tol::Float64: relative tolerance for time comparisons","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"If you want to change one of the parameters, say the maximum number of timesteps, you can do that with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> model.Time.nstep_max=100\n100","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"You can verify that this has been changed with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> model.Time\nLaMEM Timestepping parameters: \n time_end = 1.0 \n dt = 0.05 \n dt_min = 0.01 \n dt_max = 0.2 \n dt_out = 0.2 \n inc_dt = 0.1 \n CFL = 0.5 \n CFLMAX = 0.8 \n nstep_max = 100 \n nstep_out = 1 \n nstep_rdb = 100 \n nstep_ini = 1 \n time_tol = 1.0e-8 ","category":"page"},{"location":"juliasetup_TMSubduction/#Set-timestepping-parameters","page":"Example 3: 2D Subduction","title":"Set timestepping parameters","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Ok, lets change a few parameters at the same time. Here the maximum time (time_end) is set to a large value (2000 Myrs) as we want to limit the simulation using nstep_max = 400, which implies that we will perform 400 timesteps","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Time = Time( time_end = 2000.0,\n dt = 0.001,\n dt_min = 0.000001,\n dt_max = 0.1,\n nstep_max = 400,\n nstep_out = 10\n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Note that you can achieve the same results with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Time.time_end = 2000.0\nmodel.Time.dt = 0.001\nmodel.Time.dt_min = 0.000001\nmodel.Time.dt_max = 0.1\nmodel.Time.nstep_max = 400\nmodel.Time.nstep_out = 10","category":"page"},{"location":"juliasetup_TMSubduction/#Set-solution-parameters","page":"Example 3: 2D Subduction","title":"Set solution parameters","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We activate shear heating and adiabatic heating, as well as thermal diffusion, and set the minimum and maximum viscosities of the model as:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.SolutionParams = SolutionParams( shear_heat_eff = 1.0,\n Adiabatic_Heat = 1.0,\n act_temp_diff = 1,\n eta_min = 5e18,\n eta_ref = 1e21,\n eta_max = 1e25,\n min_cohes = 1e3\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Set-surface-topography","page":"Example 3: 2D Subduction","title":"Set surface topography","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"In our simulation, we want to take a free surface into account. In LaMEM that is done with a sticky air layer (phase 5 here), combined with a mesh that tracks the location of the free surface. You need to activate the free surface, tell LaMEM which phase is the sticky air phase and what the initial free surface level is at the beginning of the simulation (0 km). Do that with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.FreeSurface = FreeSurface( surf_use = 1, # free surface activation flag\n surf_corr_phase = 1, # air phase ratio correction flag (due to surface position)\n surf_level = 0.0, # initial level\n surf_air_phase = 5, # phase ID of sticky air layer\n surf_max_angle = 40.0 # maximum angle with horizon (smoothed if larger))\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Set-model-output","page":"Example 3: 2D Subduction","title":"Set model output","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We update the list of fields saved as output:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Output = Output( out_density = 1,\n out_j2_strain_rate = 1,\n out_surf = 1, \t\n out_surf_pvd = 1,\n out_surf_topography = 1,\n out_j2_dev_stress = 1,\n out_pressure = 1,\n out_temperature = 1, )","category":"page"},{"location":"juliasetup_TMSubduction/#Set-some-background-properties,-later-overwritten","page":"Example 3: 2D Subduction","title":"Set some background properties, later overwritten","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"The model geometry in LaMEM is defined by two arrays: model.Grid.Temp and model.Grid.Phase which sets the initial temperature and phase at every point. These are 3D arrays that can be modified; in the usual case temperatures are assumed to be in Celcius, and the phases are integers (0-5 here). ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Lets specify a few helpful parameters, such as the adiabatic temperature throughout the model (0.4°C/km) and the mantle potential temperature at the surface 1280°C:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Tair = 20.0;\nTmantle = 1280.0;\nAdiabat = 0.4","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Next, we set the temperature everwhere to (will be overwrittem later) and all phases to 0 with","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Grid.Temp .= Tmantle .+ 1.0; # set mantle temperature (without adiabat at first)\nmodel.Grid.Phases .= 0; # Set Phases to 0 everywhere (0 is/will be asthenosphere in this setup):","category":"page"},{"location":"juliasetup_TMSubduction/#Setup-temperature-of-the-air-to-be-20C","page":"Example 3: 2D Subduction","title":"Setup temperature of the air to be 20°C","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Next we set all \"air\" particles to Tair: ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Grid.Temp[model.Grid.Grid.Z .> 0] .= Tair;","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We can quickly verify that this has been done on the REPL with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia>julia> model.Grid\nLaMEM grid with constant Δ: \n nel : ([512], [1], [128])\n marker/cell : (3, 3, 3)\n x ϵ [-2000.0 : 2000.0]\n y ϵ [-8.0 : 8.0]\n z ϵ [-660.0 : 40.0]\n Phases : range ϵ [0 - 0]\n Temp : range ϵ [20.0 - 1281.0]","category":"page"},{"location":"juliasetup_TMSubduction/#Setup-the-air-layer-(id-5)-if-Z-0.0","page":"Example 3: 2D Subduction","title":"Setup the air layer (id = 5) if Z > 0.0","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Set the air particles to 5:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Grid.Phases[model.Grid.Grid.Z .> 0.0 ] .= 5;","category":"page"},{"location":"juliasetup_TMSubduction/#Add-left-oceanic-plate","page":"Example 3: 2D Subduction","title":"Add left oceanic plate","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"An oceanic plate can be added using the add_box!() function of the GeophysicalModelGenerator package (see ?GeophysicalModelGenerator.add_box! for more information, or check out the online help of the package). The lithosphere to asthenosphere temperature is set to 1250°C. If temperature of the plate is > 1250°C then the material is turned to asthenosphere. The temperature profile of the plate is set using a half space cooling temperature and a spreading rate velocity of 0.5 cm/yr with the ridge prescribed to be at the \"left\" of the box.","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_box!(model; xlim = (-2000.0, 0.0), \n ylim = (model.Grid.coord_y...,), \n zlim = (-660.0, 0.0),\n Origin = nothing, StrikeAngle=0, DipAngle=0,\n phase = LithosphericPhases(Layers=[20 80], Phases=[1 2 0] ),\n T = SpreadingRateTemp( Tsurface = Tair,\n Tmantle = Tmantle,\n MORside = \"left\",\n SpreadingVel= 0.5,\n AgeRidge = 0.01;\n maxAge = 80.0 ) )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-right-oceanic-plate","page":"Example 3: 2D Subduction","title":"Add right oceanic plate","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Same for the plate on the right:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_box!(model; xlim = (1500, 2000), \n ylim = (model.Grid.coord_y..., ), \n zlim = (-660.0, 0.0),\n Origin = nothing, StrikeAngle=0, DipAngle=0,\n phase = LithosphericPhases(Layers=[20 80], Phases=[1 2 0] ),\n T = SpreadingRateTemp( Tsurface = Tair,\n Tmantle = Tmantle,\n MORside = \"right\",\n SpreadingVel= 0.5,\n AgeRidge = 0.01;\n maxAge = 80.0 ) )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-overriding-plate-margin","page":"Example 3: 2D Subduction","title":"Add overriding plate margin","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"For the overriding plate margin the age is fixed to 90 Ma using HalfspaceCoolingTemp().","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_box!(model; xlim = (0.0, 400.0), \n ylim = (model.Grid.coord_y[1], model.Grid.coord_y[2]), \n zlim = (-660.0, 0.0),\n Origin = nothing, StrikeAngle=0, DipAngle=0,\n phase = LithosphericPhases(Layers=[25 90], Phases=[3 4 0] ),\n T = HalfspaceCoolingTemp( Tsurface = Tair,\n Tmantle = Tmantle,\n Age = 80 ) )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-overriding-plate-craton","page":"Example 3: 2D Subduction","title":"Add overriding plate craton","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_box!(model; xlim = (400.0, 1500.0), \n ylim = (model.Grid.coord_y...,), \n zlim = (-660.0, 0.0),\n Origin = nothing, StrikeAngle=0, DipAngle=0,\n phase = LithosphericPhases(Layers=[35 100], Phases=[3 4 0] ),\n T = HalfspaceCoolingTemp( Tsurface = Tair,\n Tmantle = Tmantle,\n Age = 120 ) )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-pre-subducted-slab","page":"Example 3: 2D Subduction","title":"Add pre-subducted slab","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Here we change the dip angle of the box to 30° to initiates subduction:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_box!(model; xlim = (0.0, 300), \n ylim = (model.Grid.coord_y...,), \n zlim = (-660.0, 0.0),\n Origin = nothing, StrikeAngle=0, DipAngle=30,\n phase = LithosphericPhases(Layers=[30 80], Phases=[1 2 0], Tlab=1250 ),\n T = HalfspaceCoolingTemp( Tsurface = Tair,\n Tmantle = Tmantle,\n Age = 80 ) )","category":"page"},{"location":"juliasetup_TMSubduction/#Impose-approximate-adiabat","page":"Example 3: 2D Subduction","title":"Impose approximate adiabat","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We can add a mantle adiabatic temperature to the model with","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Grid.Temp = model.Grid.Temp - model.Grid.Grid.Z.*Adiabat;","category":"page"},{"location":"juliasetup_TMSubduction/#Plot-preview-of-the-setup","page":"Example 3: 2D Subduction","title":"Plot preview of the setup","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Cross-sections of the model setup showing the temperature and the phase fields can be visualized as follows:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"plot_cross_section(model, y=0, field=:temperature)\nplot_cross_section(model, y=0, field=:phase)","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"which gives: (Image: Subduction_CrossSection_phase) (Image: Subduction_CrossSection_temp)","category":"page"},{"location":"juliasetup_TMSubduction/#3.-Define-material-parameters","page":"Example 3: 2D Subduction","title":"3. Define material parameters","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"At this stage, we defined the geometry and thermal structures of the model, but we did yet assign material properties to each of the rocktypes.","category":"page"},{"location":"juliasetup_TMSubduction/#Softening-law","page":"Example 3: 2D Subduction","title":"Softening law","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"We assume that rocks weaken/soften when they becomes damaged, which can be defined by a softening law. Post-softening strength is defined as 0.05 the initial strength","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"softening = Softening( ID = 0, \t\t\t# softening law ID\n APS1 = 0.1, \t\t\t# begin of softening APS\n APS2 = 0.5, \t\t\t# end of softening APS\n A = 0.95, \t\t # reduction ratio\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Material-thermal-and-rheological-properties","page":"Example 3: 2D Subduction","title":"Material thermal and rheological properties","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Mantle For the mantle, we use a dry olivine rheology:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"dryPeridotite = Phase( Name = \"dryPeridotite\", \n ID = 0, # phase id [-]\n rho = 3300.0, # density [kg/m3]\n alpha = 3e-5, # coeff. of thermal expansion [1/K]\n disl_prof = \"Dry_Olivine_disl_creep-Hirth_Kohlstedt_2003\",\n Vn = 14.5e-6,\n diff_prof = \"Dry_Olivine_diff_creep-Hirth_Kohlstedt_2003\",\n Vd = 14.5e-6,\n G = 5e10, # elastic shear module [MPa]\n k = 3, # conductivity\n Cp = 1000.0, # heat capacity\n ch = 30e6, # cohesion [Pa]\n fr = 20.0, # friction angle\t\n A = 6.6667e-12, # radiogenic heat production [W/kg]\n chSoftID = 0, \t # cohesion softening law ID\n frSoftID = 0, \t # friction softening law ID\n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Oceanic crust For the oceanic crust we use a low cohesion and a frictional angle equal to 0. The goal is to make the oceanic crust weak enough to lubricate the interface with the overriding plate and allow for self-sustained subduction. Moreover, as density is not pressure and temperature dependent, it is set to be the same as the mantle (3300) in order to be neutrally buoyant with respect to the rest of the lithosphere.","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"oceanicCrust = Phase( Name = \"oceanCrust\", \n ID = 1, # phase id [-]\n rho = 3300.0, # density [kg/m3]\n alpha = 3e-5, # coeff. of thermal expansion [1/K]\n disl_prof = \"Plagioclase_An75-Ranalli_1995\",\n G = 5e10, # elastic shear module [MPa]\n k = 3, # conductivity\n Cp = 1000.0, # heat capacity\n ch = 5e6, # cohesion [Pa]\n fr = 0.0, # friction angle\t\n A = 2.333e-10, # radiogenic heat production [W/kg]\n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Oceanic mantle lithosphere The oceanic mantle lithosphere has the same properties as the mantle but a different name and different phase. To simplify your life, you can use the copy_phase function for that:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"oceanicLithosphere = copy_phase( dryPeridotite,\n Name = \"oceanicLithosphere\",\n ID = 2\n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Continental crust","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"continentalCrust = copy_phase( oceanicCrust,\n Name = \"continentalCrust\",\n ID = 3,\n disl_prof = \"Quarzite-Ranalli_1995\",\n rho = 2700.0, \n ch = 30e6,\n fr = 20.0,\n A \t = 5.3571e-10,\n chSoftID \t = 0, \t \n frSoftID \t = 0, \t \n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Continental lithosphere","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"continentalLithosphere = copy_phase( dryPeridotite,\n Name = \"continentalLithosphere\",\n ID = 4\n )","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Sticky air","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Finally, the \"air\" in our model is a layer with low density and low viscosity, such that it essentially gives very low stresses compared to those within the lithosphere. We cannot give it the viscosity of real air, as this results in a too large viscosity jump at the surface (geodynamic codes cannot handle that). We therefore also often call this \"sticky air\". Note that we also give it a very high thermal conductivity to ensure that the temperature within the air layer remains more or less constant throughout a simulation (and equal to the temperature at the upper boundary of the model):","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"air = Phase( Name = \"air\", \n ID = 5, # phase id [-]\n rho = 50.0, # density [kg/m3] # coeff. of thermal expansion [1/K]\n eta = 1e19,\n G = 5e10, # elastic shear module [MPa]\n k = 100, # conductivity\n Cp = 1e6, # heat capacity\n ch = 10e6, # cohesion [MPa]\n fr = 0.0, # friction angle\t\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-phases-to-the-model","page":"Example 3: 2D Subduction","title":"Add phases to the model","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Finally, we can add all these phases to the model with:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"rm_phase!(model)\nadd_phase!( model, \n dryPeridotite,\n oceanicCrust,\n oceanicLithosphere,\n continentalCrust,\n continentalLithosphere,\n air\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Add-softening-law","page":"Example 3: 2D Subduction","title":"Add softening law","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Same with the softening law:","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"add_softening!( model,\n softening\n )","category":"page"},{"location":"juliasetup_TMSubduction/#Set-solver-options","page":"Example 3: 2D Subduction","title":"Set solver options","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"The PETSc command -da_refine_y 1 allow to run the model as 2D","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"model.Solver = Solver( SolverType = \"multigrid\",\n MGLevels = 3,\n MGCoarseSolver \t= \"superlu_dist\",\n PETSc_options = [ \"-snes_ksp_ew\",\n \"-snes_ksp_ew_rtolmax 1e-4\",\n \"-snes_rtol 5e-3\",\t\t\t\n \"-snes_atol 1e-4\",\n \"-snes_max_it 200\",\n \"-snes_PicardSwitchToNewton_rtol 1e-3\", \n \"-snes_NewtonSwitchToPicard_it 20\",\n \"-js_ksp_type fgmres\",\n \"-js_ksp_max_it 20\",\n \"-js_ksp_atol 1e-8\",\n \"-js_ksp_rtol 1e-4\",\n \"-snes_linesearch_type l2\",\n \"-snes_linesearch_maxstep 10\",\n \"-da_refine_y 1\"\n ]\n )","category":"page"},{"location":"juliasetup_TMSubduction/#4.-Perform-the-simulation","page":"Example 3: 2D Subduction","title":"4. Perform the simulation","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Here we run LaMEM on 8 cores (if you have them; use less otherwise):","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"julia> run_lamem(model, 8)\nSaved file: Model3D.vts\n(Nprocx, Nprocy, Nprocz, xc, yc, zc, nNodeX, nNodeY, nNodeZ) = (4, 1, 2, [-2000.0, -1000.0, 0.0, 1000.0, 2000.0], [-8.0, 8.0], [-660.0, -310.0, 40.0], 513, 2, 129)\nWriting LaMEM marker file -> ./markers/mdb.00000000.dat\nWriting LaMEM marker file -> ./markers/mdb.00000001.dat\nWriting LaMEM marker file -> ./markers/mdb.00000002.dat\nWriting LaMEM marker file -> ./markers/mdb.00000003.dat\nWriting LaMEM marker file -> ./markers/mdb.00000004.dat\nWriting LaMEM marker file -> ./markers/mdb.00000005.dat\nWriting LaMEM marker file -> ./markers/mdb.00000006.dat\nWriting LaMEM marker file -> ./markers/mdb.00000007.dat\n-------------------------------------------------------------------------- \n Lithosphere and Mantle Evolution Model \n Compiled: Date: Apr 7 2023 - Time: 22:11:23 \n Version : 1.2.4 \n-------------------------------------------------------------------------- \n STAGGERED-GRID FINITE DIFFERENCE CANONICAL IMPLEMENTATION \n-------------------------------------------------------------------------- \nParsing input file : output.dat \nFinished parsing input file : output.dat \n--------------------------------------------------------------------------\nScaling parameters:\n Temperature : 1000. [C/K] \n Length : 1000. [m] \n Viscosity : 1e+20 [Pa*s] \n Stress : 1e+09 [Pa] ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"The results will be saved in the directory where you performed the simulation and can be visualized in Paraview by opening the file output.pvd: (Image: 2D thermomechanical subduction)","category":"page"},{"location":"juliasetup_TMSubduction/#Remark-on-performing-parallel-simulations","page":"Example 3: 2D Subduction","title":"Remark on performing parallel simulations","text":"","category":"section"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Using more processors or cores does not necessarily imply that the simulation will be faster. There is a tradeoff between the number of processors, the resolution, the number of multigrid levels, the machine you use and the speed of the simulation. At some stage it actually becomes slower! ","category":"page"},{"location":"juliasetup_TMSubduction/","page":"Example 3: 2D Subduction","title":"Example 3: 2D Subduction","text":"Unfortunately, it is hard to predict when this happens as this is setup- and machine-dependent. We can thus not automatize this, and our recommendation is therefore that you experiment with this. Run the simulation for a limited number of timesteps (say 5 or so) and check its speed for different number of cores.","category":"page"},{"location":"installation_HPC/#Installation-on-HPC-systems","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"","category":"section"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Installing LaMEM on high performance computer (HPC) systems can be complicated, because you will have to compile PETSc with the correct dependencies for that system. The reason is that HPC systems use MPI versions that are specifically tailored/compiled for that system. ","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Warning: the explanation below is still somewhat experimental and may not work on your system The best approach of running LaMEM on large HPC systems remains to install the correct version of PETSc using the locally recommended MPI libraries and install the correct version of LaMEM with that. You can still save the input setup to file, for the correct number or processors using LaMEM.jl. The locally generated *.dat file will still work.","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Luckily there is a solution thanks to the great work of @eschnett and colleagues, who developed MPITrampoline which is an intermediate layer between the HPC-system-specific MPI libraries and the precompiled LaMEM binaries. ","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"It essentially consists of two steps: 1) compile a small package (MPIwrapper) 2) make sure that you download the version of LaMEM that was compiled versus MPItrampoline.","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Here step-by-step instructions (for Linux, as that is what essentially all HPC systems use):","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Download MPIwrapper: ","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"git clone https://github.com/eschnett/MPIwrapper.git \ncd MPIwrapper","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Install it after making sure that mpiexec points to the one you want (you may have to load some modules, depending on your system):","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"cmake -S . -B build -DMPIEXEC_EXECUTABLE=/full/path/to/mpiexec -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/mpiwrapper\ncmake --build build\ncmake --install build","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"[!IMPORTANT] You need to specify the full path to mpiexec (or equivalent) and not just the name. If you don't know that, you can determine this with which mpiexec","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"At this stage, MPItrampoline is installed in $HOME/mpiwrapper","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Set the correct wrappers:","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"export MPITRAMPOLINE_LIB=$HOME/mpiwrapper/lib64/libmpiwrapper.so\nexport MPITRAMPOLINE_MPIEXEC=$HOME/MPIwrapper/mpiwrapper/bin/mpiwrapperexec ","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Depending on the system it may be called lib instead of lib64 (check!).","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Start julia and install the correct versuion of MPItrampoline_jll","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Since LaMEM_jll and PETSc_jll are compiled versus a specific version of MPItrampoline_jll, this step is important. You can see which one we currently use here. At the time of writting this was version 5.2.1:","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"julia\njulia> ]\npkg>add MPItrampoline_jll@5.2.1","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Install the MPI and MPIPreferences packages:","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"julia\njulia> ]\npkg>add MPI, MPIPreferences","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Set the preference to use MPItrampoline","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"julia> using MPIPreferences; MPIPreferences.use_jll_binary(\"MPItrampoline_jll\")\n┌ Info: MPIPreferences unchanged\n└ binary = \"MPItrampoline_jll\"","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Load MPI and verify it is the correct one","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"julia> using MPI\njulia> MPI.Get_library_version()\n\"MPIwrapper 2.10.3, using MPIABI 2.9.0, wrapping:\\nOpen MPI v4.1.4, package: Open MPI boris@Pluton Distribution, ident: 4.1.4, repo rev: v4.1.4, May 26, 2022\"","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"After this, restart julia (this only needs to be done once, next time all is fine).","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"If you want you can run a test case with:","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"julia> using MPI\njulia> mpiexec(cmd -> run(`$cmd -n 3 echo hello world`));\nhello world\nhello world\nhello world","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"Now load LaMEM and check that it uses the mpitrampoline version:","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"julia> using MPI,LaMEM\njulia> LaMEM.LaMEM_jll.host_platform\nLinux x86_64 {cxxstring_abi=cxx11, julia_version=1.8.1, libc=glibc, libgfortran_version=5.0.0, mpi=mpitrampoline}","category":"page"},{"location":"installation_HPC/","page":"Installation on HPC systems","title":"Installation on HPC systems","text":"At this stage the precompiled version of LaMEM should be useable on that system.","category":"page"},{"location":"#LaMEM.jl","page":"Home","title":"LaMEM.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"This is the julia interface to LaMEM, which does a number of handy things:","category":"page"},{"location":"","page":"Home","title":"Home","text":"It will automatically download a binary installation of LaMEM, along with the correct version of PETSc and mpiexec for your system. You can also use these binaries directly from your terminal, so you are not limited to julia. Gone are the days where you had to first spend hours or days to install PETSc on your system!\nIt provides the functionality to setup a model, run it and plot the results with a few lines of julia.\nWe provide many default options\nYou can do this with Jupyter or Pluto notebooks\nWe provide a simple function to run LaMEM from julia (also in parallel), using classical LaMEM *.dat files\nWe provide functions to read timesteps back into julia and compress out ","category":"page"},{"location":"juliasetup_example_sphere/#1.-Example-1:-Falling-sphere","page":"Example 1: Sphere","title":"1. Example 1: Falling sphere","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"This is a first example that illustrates how to build a setup using the LaMEM.jl package, run it and visualize the results, all without leaving julia.","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"We start with loading the packages we need:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> using LaMEM, GeophysicalModelGenerator, Plots","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"The GeophysicalModelGenerator package can be used to generate model setups and Plots for plotting.","category":"page"},{"location":"juliasetup_example_sphere/#1.1-Define-model-setup","page":"Example 1: Sphere","title":"1.1 Define model setup","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Next, we define a general model setup, in which we specify the units with which we work (for most cases, you'll want to use the default GEO units), the size of the computational box and various timestepping parameters. In this case, we use a multigrid solver.","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> model = Model(Grid(nel=(16,16,16), x=[-1,1], y=[-1,1], z=[-1,1]), \n Time(nstep_max=20, dt_min=1e-3, dt=1, dt_max=10, time_end=100), \n Solver(SolverType=\"multigrid\", MGLevels=2),\n Output(out_dir=\"example_1\"))\nLaMEM Model setup\n|\n|-- Scaling : GeoParams.Units.GeoUnits{GEO}\n|-- Grid : nel=(16, 16, 16); xϵ(-1.0, 1.0), yϵ(-1.0, 1.0), zϵ(-1.0, 1.0) \n|-- Time : nstep_max=20; nstep_out=1; time_end=100.0; dt=1.0\n|-- Boundary conditions : noslip=[0, 0, 0, 0, 0, 0]\n|-- Solution parameters : eta_min=1.0e18; eta_max=1.0e25; eta_ref=1.0e20; act_temp_diff=0\n|-- Solver options : multigrid solver; coarse grid solver=direct; 2 levels\n|-- Model setup options : Type=files; \n|-- Output options : filename=output; pvd=1; avd=0; surf=0\n|-- Materials : 0 phases; ","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Note that each of the fields within Model has many additional and adjustable parameters. You can view that by typing:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> model.Time\nLaMEM Timestepping parameters: \n time_end = 100.0 \n dt = 1.0 \n dt_min = 0.001 \n dt_max = 10.0 \n dt_out = 0.2 \n inc_dt = 0.1 \n CFL = 0.5 \n CFLMAX = 0.8 \n nstep_max = 20 \n nstep_out = 1 \n nstep_rdb = 100 \n nstep_ini = 1 \n time_tol = 1.0e-8 ","category":"page"},{"location":"juliasetup_example_sphere/#1.2-Specify-material-properties","page":"Example 1: Sphere","title":"1.2 Specify material properties","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Once this is specified, we need to set material properties for each of the Phases we will consider in the simulation. This can be done with the Phase structure. First, we define two phases","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> rm_phase!(model)\njulia> matrix = Phase(ID=0,Name=\"matrix\",eta=1e20,rho=3000)\nPhase 0 (matrix): \n rho = 3000.0 \n eta = 1.0e20 \njulia> sphere = Phase(ID=1,Name=\"sphere\",eta=1e23,rho=3200)\nPhase 1 (sphere): \n rho = 3200.0 \n eta = 1.0e23 ","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"and add them to the model with:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> add_phase!(model, sphere, matrix)","category":"page"},{"location":"juliasetup_example_sphere/#1.3-Set-initial-model-geometry","page":"Example 1: Sphere","title":"1.3 Set initial model geometry","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"We also need to specify an initial model geometry. The julia package GeophysicalModelGenerator has a number of functions for that, which can be used here. For the current setup, we just add a sphere: ","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> add_sphere!(model,cen=(0.0,0.0,0.0), radius=(0.5, ))","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"It is often useful to plot the initial model setup. You can do this with the heatmap function from the Plots.jl package, for which we provide a LaMEM plugin that allows you to specify a cross-section through a 3D LaMEM setup:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> plot_cross_section(model, field=:phase, y=0)","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"(Image: InitialSetupSphere)","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"In the initial setup we define two fields: :phase which defines the rocktypes and :temperature which has the initial temperature. They are stored as 3D arrays in model.Grid.Phases and model.Grid.Temp:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> model.Grid\nLaMEM grid with constant Δ: \n nel : ([16], [16], [16])\n marker/cell : (3, 3, 3)\n x ϵ [-1.0 : 1.0]\n y ϵ [-1.0 : 1.0]\n z ϵ [-1.0 : 1.0]\n Phases : range ϵ [0 - 1]\n Temp : range ϵ [0.0 - 0.0]","category":"page"},{"location":"juliasetup_example_sphere/#1.4-Run-LaMEM","page":"Example 1: Sphere","title":"1.4 Run LaMEM","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"At this stage we are ready to run a LaMEM simulation which can simply be done with the run_lamem command. By default, it will run on one processor. If you want to run this in parallel, you can specify the number of cores you want to use. Please note that running things in parallel is only worth the effort for large resolutions; for smaller setups it will be faster on one processor:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> run_lamem(model,1)\nSaved file: Model3D.vts\nWriting LaMEM marker file -> ./markers/mdb.00000000.dat\n-------------------------------------------------------------------------- \n Lithosphere and Mantle Evolution Model \n Compiled: Date: Apr 7 2023 - Time: 22:11:23 \n Version : 1.2.4 \n-------------------------------------------------------------------------- \n STAGGERED-GRID FINITE DIFFERENCE CANONICAL IMPLEMENTATION \n-------------------------------------------------------------------------- \nParsing input file : output.dat \nFinished parsing input file : output.dat \n--------------------------------------------------------------------------\nScaling parameters:\n Temperature : 1000. [C/K] \n Length : 1e+06 [m] \n Viscosity : 1e+20 [Pa*s] \n Stress : 10. [Pa] \n--------------------------------------------------------------------------\nTime stepping parameters:\n Simulation end time : 100. [Myr] \n Maximum number of steps : 20 \n Time step : 1. [Myr] \n Minimum time step : 0.001 [Myr] \n Maximum time step : 10. [Myr] \n Time step increase factor : 0.1 \n CFL criterion : 0.5 \n CFLMAX (fixed time steps) : 0.8 \n Output every [n] steps : 1 \n Output [n] initial steps : 1 \n--------------------------------------------------------------------------\n--------------------------------------------------------------------------","category":"page"},{"location":"juliasetup_example_sphere/#1.5-Visualize-results","page":"Example 1: Sphere","title":"1.5 Visualize results","text":"","category":"section"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Once the simulation is done, you can look at the results using the same heatmap function, but by specifying a timestep, which will read that timestep and plot a cross-section though it:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> plot_cross_section(model, y=0, timestep=20, field=:phase)\t","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"(Image: FallingSphere_t20)","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Alternatively, you can visualize the results with Paraview. Change to the directory where you did the simulation:","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> cd(model.Output.out_dir)\njulia> readdir()\n25-element Vector{String}:\n \"Model3D.vts\"\n \"Timestep_00000000_0.00000000e+00\"\n \"Timestep_00000001_1.10000000e+00\"\n \"Timestep_00000002_2.31000000e+00\"\n \"Timestep_00000003_3.64100000e+00\"\n \"Timestep_00000004_5.10510000e+00\"\n \"Timestep_00000005_6.71561000e+00\"\n ⋮\n \"Timestep_00000017_4.45991731e+01\"\n \"Timestep_00000018_5.01590904e+01\"\n \"Timestep_00000019_5.62749995e+01\"\n \"Timestep_00000020_6.30024994e+01\"\n \"markers\"\n \"output.dat\"\n \"output.pvd\"","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"And you can open output.pvd with paraview. If your system recognizes that *.pvd files should be opened with paraview, you can do that with","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"julia> ;\nshell> open output.pvd","category":"page"},{"location":"juliasetup_example_sphere/","page":"Example 1: Sphere","title":"Example 1: Sphere","text":"Otherwise, start paraview manually and open the file.","category":"page"}] }