Mesh

This package provides some buildin structured mesh functionality and some data structures coupled with existing Green's functions where users could explore external mesh tools.

This package also has rich utilities based on Gmsh. To use them, it is recommended to install GmshTools.jl which automatically downloads Gmsh SDK and provides a few convenient macros.

pkg> add GmshTools
julia> using Quaycle
julia> using GmshTools

Users are encouraged to read Gmsh Julia API for more comprehensive operations.

Public Interface

Quaycle.gen_meshFunction
gen_mesh(::Val{:AntiPlaneHex8}, ma::SBarbotHex8MeshEntity, ratio::Real=1e4)
source
Quaycle.gen_meshMethod
gen_mesh(::Val{:RectOkada}, x::T, ξ::T, Δx::T, Δξ::T, dip::T)

Generate RectOkadaMesh

Arguments

  • x: along strike length
  • ξ: downdip length
  • Δx: along strike interval
  • Δξ: downdip interval
  • dip: dipping angle
source
Quaycle.gen_gmsh_meshMethod
gen_gmsh_mesh(mf::OkadaMesh; kwargs...)

Generate an equivalent unstructured mesh as mf::OkadaMesh

Arguments

  • mf::OkadaMesh: the structured mesh
  • kwargs...: stay the same as other methods for gen_gmsh_mesh
source
Quaycle.gen_gmsh_meshMethod
gen_gmsh_mesh(mf::RectOkadaMesh,
    ::Val{:BoxHexByExtrude},
    llx::T, lly::T, llz::T, dx::T, dy::T, dz::T, nx::I, ny::I,
    rfx::T, rfy::T, rfzn::AbstractVector, rfzh::AbstractVector;
    filename::AbstractString="temp.msh") where {T, I}

Generate a mesh combinating RectOkadaMesh and BoxHexExtrudeFromSurface mesh for asthenosphere. The first argument is the corresponding RectOkadaMesh, the rest ones stay the same.

source
Quaycle.gen_gmsh_meshMethod
gen_gmsh_mesh(::Val{:BoxHexByExtrude},
    llx::T, lly::T, llz::T, dx::T, dy::T, dz::T, nx::I, ny::I,
    rfx::T, rfy::T, rfzn::AbstractVector, rfzh::AbstractVector;
    filename::AbstractString="temp.msh") where {T, I}

Gernate a box for Asthenosphere using 8-node hexahedron elements (via setting transfinite curve).

Arguments

  • llx, lly, llz: coordinates of low-left corner on the top surface
  • dx, dy, dz: x-, y-, z-extension
  • nx, ny: number of cells along x-, y-axis
  • rfx, rfy: refinement coefficients along x-, y-axis using Bump algorithm, please refer gmsh.model.geo.mesh.setTransfiniteCurve
  • rfzn: number of cells along z-axis, please refer numElements in gmsh.model.geo.extrude
  • rfzh: accumulated height of cells along z-axis, please refer heights in gmsh.model.geo.extrude
source
Quaycle.gen_gmsh_meshMethod
gen_gmsh_mesh(mf::RectOkadaMesh, ::Val{:InPlaneX},
    llx::T, lly::T, llz::T, dx::T, dy::T, dz::T, nx::I, nv::I;
    rfxstr::S="Bump", rfx::T=1.0,
    rfvstr::S="Progression", rfv::T=1.0,
    filename="temp.msh", reg::Integer=1,
    faulttag=(1, "fault"), asthenospheretag=(2, "asthenosphere")) where {T, I, S}

Generate an rectangle with one side parallel to YZ plane along with a Rect Okada mesh.

source
Quaycle.gen_gmsh_meshMethod
gen_gmsh_mesh(::Val{:InPlaneX},
    llx::T, lly::T, llz::T, dx::T, dy::T, dz::T, nx::I, nv::I;
    rfxstr::S="Bump", rfx::T=1.0,
    rfvstr::S="Progression", rfv::T=1.0,
    filename::AbstractString="temp.msh", reg::Integer=1) where {T, I, S}

Generate an rectangle with one side parallel to YZ plane.

Arguments

  • llx, lly, llz: coordinates of low-left corner on the top surface
  • dx, dy, dz: x-, y-, z-extension
  • nx, nv: number of cells along x-, vertical-axis

KWARGS

  • rfxstr, rfx, rfvstr, rfv: the transfinite mesh parameters, see Gmsh docs.
source
Quaycle.gen_gmsh_meshMethod
gen_gmsh_mesh(::Val{:LineOkada}, ξ::T, Δξ::T, dip::T;
    filename::AbstractString="temp.msh", reg::Integer=1) where T

Generate equivalent LineOkadaMesh via Gmsh buildin engine.

Extra Arguments

  • filename::AbstractString="temp.msh": name of the generated mesh file. The file ext will be automatically handled by Gmsh.
  • reg::Integer=1: the starting tag for entity of any dimension

The rest arguments stay the same as gen_mesh.

source
Quaycle.gen_gmsh_meshMethod
gen_gmsh_mesh(::Val{:RectOkada}, x::T, ξ::T, Δx::T, Δξ::T, dip::T;
    filename::AbstractString="temp.msh", reg::Integer=1) where T

Generate equivalent RectOkadaMesh via Gmsh buildin engine.

Extra Arguments

  • filename::AbstractString="temp.msh": name of the generated mesh file. The file ext will be automatically handled by Gmsh.
  • reg::Integer=1: the starting tag for entity of any dimension

The rest arguments stay the same as gen_mesh.

source
Quaycle.gmsh_vtk_output_cacheMethod
gmsh_vtk_output_cache(file::AbstractString, phydim::I, phytag::I) where I<:Integer

Create cache of unstructured mesh for VTK output.

Arguments

  • file::AbstractString: mesh file
  • phydim: physical group dimension, which you will querry
  • phytag: physical group tag associated with phydim. If smaller than 0, retrieve all entities in physical group whose dimension is phydim. If in this case, only one such entity, binded with that physical group, shall exist. If you would like to write multi-block data, create VTK output caches for each physical group.
source
Quaycle.gmsh_vtk_output_cacheMethod
gmsh_vtk_output_cache(file::AbstractString, mf::OkadaMesh{N}, phytag::Integer=-1, datatype=Float64) where N

Create cache of structured OkadaMesh for VTK output, which handles the data mapping from structured data to unstructured mesh. It's worth mention that currently WriteVTK cannot write inclined plane in 3D space. As a workround, it seeks transfering from Gmsh unstructured (transfinite) mesh.

Arguments

  • file::AbstractString: mesh file containing fault mesh (transfinite)
  • mf::OkadaMesh{N}: equivalent structured mesh, must match unstructured mesh in the file above
  • phytag::Integer=-1: physical group tag associated with fault mesh in the mesh file. If smaller than 0, retrieve all entities in physical group whose dimension is determined by mf. If in this case, only one such entity, assumed to be the fault, shall exist.
  • datatype=Float64: data type for temporary array storing the mapped data
source
Quaycle.read_gmsh_meshMethod
read_gmsh_mesh(::Val{:InPlaneX}, f::AbstractString; phytag::Integer=2, inxz::Bool=true)

Read the mesh and construct mesh entity infomation for SBarbot Quad4 in-plane (x-z, no y) Green's function use.

source
Quaycle.read_gmsh_meshMethod
read_gmsh_mesh(::Val{:SBarbotHex8}, f::AbstractString;
    phytag::Integer=-1, rotate::Number=0.0, reverse=false, check=false)

Read the mesh and construct mesh entity infomation for SBarbot Hex8 Green's function use.

Arguments

  • f: mesh file name
  • phytag: physical tag for targeting volume entity. If smaller than 0, retrieve all elements in all 3-dimensional entities. If in this case, your mesh must contain only one element type, which should be Hex8
  • rotate: the angle of strike direction, see sbarbot_disp_hex8!. If your meshing box isn't parallel to x, y-axis, your must provide your strike angle manually. By default, the strike angle is zero
  • reverse: if true, reverse the along-x, y-node tag during read. By default, 1→4 in x-axis, 1→2 in y-axis, 1→5 in z-axis
  • check: if true, check that number of distinctive q1 equals that of x1, same for q2 and x2 at orthogonal direction, which should hold for transfinite mesh.

Notice

  • This function can only be used for Hex8 element with each element lying parallel to z-axis.

  • The check procedure is not complete for arbitrary strike angle (0 < θ < 90). The user should take a close look on the node ordering for one element to ensure the x-, y-extent are correctly resolved by change reverse accordingly.

source
Quaycle.read_gmsh_meshMethod
read_gmsh_mesh(::Val{:SBarbotTet4}, f::AbstractString; phytag::Integer=-1)

Read the mesh and construct mesh entity infomation for SBarbot Tet4 Green's function use.

Arguments

  • f: mesh file name
  • phytag: physical tag for targeting volume entity. If smaller than 0, retrieve all elements in all 3-dimensional entities. If in this case, your mesh must contain only one element type, which should be Tet4.
source
Quaycle.read_gmsh_meshMethod
read_gmsh_mesh(::Val{:TDTri3}, f::AbstractString; phytag::Integer=-1)

Read the mesh and construct mesh entity infomation for triangular Green's function use.

Arguments

  • f: mesh file name
  • phytag: physical tag for targeting volume entity. If smaller than 0, retrieve all elements in all 2-dimensional entities. If in this case, your mesh must contain only one element type, which should be Tri3.
  • atol: absolute tolerance, by default 1e-12, to determine whether the triangle is parallel to axis. If this reading procedure does not resolve the slip direction correctly, try to lower this value.
source

References

Geuzaine, C., & Remacle, J.-F. (2009). Gmsh: A 3-D finite element mesh generator with built-in pre- and post-processing facilities. International Journal for Numerical Methods in Engineering, 79(11), 1309–1331. https://doi.org/10.1002/nme.2579