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 GmshToolsUsers are encouraged to read Gmsh Julia API for more comprehensive operations.
Public Interface
Quaycle.gen_mesh — Functiongen_mesh(::Val{:AntiPlaneHex8}, ma::SBarbotHex8MeshEntity, ratio::Real=1e4)Quaycle.gen_mesh — Methodgen_mesh(::Val{:LineOkada}, ξ::T, Δξ::T, dip::T)Generate LineOkadaMesh
Arguments
ξ: downdip lengthΔξ: downdip intervaldip: dipping angle
Quaycle.gen_mesh — Methodgen_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 intervaldip: dipping angle
Quaycle.gen_gmsh_mesh — Methodgen_gmsh_mesh(mf::OkadaMesh; kwargs...)Generate an equivalent unstructured mesh as mf::OkadaMesh
Arguments
mf::OkadaMesh: the structured meshkwargs...: stay the same as other methods forgen_gmsh_mesh
Quaycle.gen_gmsh_mesh — Methodgen_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.
Quaycle.gen_gmsh_mesh — Methodgen_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 surfacedx,dy,dz: x-, y-, z-extensionnx,ny: number of cells along x-, y-axisrfx,rfy: refinement coefficients along x-, y-axis using Bump algorithm, please refergmsh.model.geo.mesh.setTransfiniteCurverfzn: number of cells along z-axis, please refernumElementsingmsh.model.geo.extruderfzh: accumulated height of cells along z-axis, please referheightsingmsh.model.geo.extrude
Quaycle.gen_gmsh_mesh — Methodgen_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.
Quaycle.gen_gmsh_mesh — Methodgen_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 surfacedx,dy,dz: x-, y-, z-extensionnx,nv: number of cells along x-, vertical-axis
KWARGS
rfxstr,rfx,rfvstr,rfv: the transfinite mesh parameters, see Gmsh docs.
Quaycle.gen_gmsh_mesh — Methodgen_gmsh_mesh(::Val{:LineOkada}, ξ::T, Δξ::T, dip::T;
filename::AbstractString="temp.msh", reg::Integer=1) where TGenerate 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.
Quaycle.gen_gmsh_mesh — Methodgen_gmsh_mesh(::Val{:RectOkada}, x::T, ξ::T, Δx::T, Δξ::T, dip::T;
filename::AbstractString="temp.msh", reg::Integer=1) where TGenerate 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.
Quaycle.gmsh_vtk_output_cache — Methodgmsh_vtk_output_cache(file::AbstractString, phydim::I, phytag::I) where I<:IntegerCreate cache of unstructured mesh for VTK output.
Arguments
file::AbstractString: mesh filephydim: physical group dimension, which you will querryphytag: physical group tag associated withphydim. If smaller than 0, retrieve all entities in physical group whose dimension isphydim. 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.
Quaycle.gmsh_vtk_output_cache — Methodgmsh_vtk_output_cache(file::AbstractString, mf::OkadaMesh{N}, phytag::Integer=-1, datatype=Float64) where NCreate 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 abovephytag::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 bymf. 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
Quaycle.read_gmsh_mesh — Methodread_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.
Quaycle.read_gmsh_mesh — Methodread_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 namephytag: physical tag for targeting volume entity. If smaller than0, retrieve all elements in all 3-dimensional entities. If in this case, your mesh must contain only one element type, which should be Hex8rotate: the angle of strike direction, seesbarbot_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 zeroreverse: iftrue, 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-axischeck: iftrue, check that number of distinctiveq1equals that ofx1, same forq2andx2at 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
checkprocedure 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 changereverseaccordingly.
Quaycle.read_gmsh_mesh — Methodread_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 namephytag: physical tag for targeting volume entity. If smaller than0, retrieve all elements in all 3-dimensional entities. If in this case, your mesh must contain only one element type, which should be Tet4.
Quaycle.read_gmsh_mesh — Methodread_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 namephytag: physical tag for targeting volume entity. If smaller than0, 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 default1e-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.
Quaycle.DIPPING — TypeDipping, indicate dislocation occurs at downdip direction.
Quaycle.STRIKING — TypeStriking, indicate dislocation occurs at strike direction.
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