Postprocessing API

Visualization, probing, path plots, and result extraction helpers.

Derived Quantities

LowLevelFEM.fieldError — Function
fieldError(F::Union{ScalarField,VectorField,TensorField})

Computes the deviation of field results F (stresses, strains, heat flux components) at nodes where the field has jumps. The result can be displayed with the showDoFResults function.

Returns: e

Types:

  • F: VectorField or TensorField
  • e: ScalarField
source
LowLevelFEM.resultant — Function
resultant(field::VectorField, phName::String) -> Vector{Float64}
resultant(problem, view_or_field, phName; grad=false, component=:x,
          offsetX=0, offsetY=0, offsetZ=0)

Sum nodal vector entries on the named physical group. The two-argument form requires nodal input and returns a length-problem.dim vector. Only the first stored column is used; this is suitable for a resultant of assembled nodal loads, not quadrature of an arbitrary sampled traction. Axisymmetric presets multiply each selected entry by the local 2πr factor.

The legacy three-argument form returns a scalar/tuple for vector fields. For a scalar Gmsh view tag, it instead integrates probed values over the group: grad=true requests the view gradient, component=:x/:y/:z selects the probed component, and offsetX/Y/Z shift the probing coordinates. These keywords apply to the view-integration branch, not to nodal summation. The legacy Matrix branch expects field metadata and is not an ordinary array-based interface; prefer a VectorField.

Use integrate for explicit spatial quadrature of a function or ScalarField, selecting step there when several columns are present.

source
LowLevelFEM.integrate — Function
integrate(problem::Problem, phName::String, f::Union{Function,ScalarField}; step::Int64=1, order::Int64=...)
∫(problem::Problem, phName::String, f::Union{Function,ScalarField}; step::Int64=1, order::Int64=...)

Integrates the function or scalar field f over the physical group phName defined in the geometry of problem. If f is a ScalarField, the time step step will be integrated. The optional parameter order controls the numerical integration rule. If order > 0, it is used as a hint for selecting the Gauss quadrature order (i.e. the number of integration points) employed during integration. The exactness of the integration depends on the element geometry and the regularity of the integrand.

Returns: integral

Types:

  • problem: Problem
  • phName: String
  • f: Function (of x, y and z) or ScalarField
  • integral: Number

Examples:

f(x, y, z) = x^2 + y^2
Iz = integrate(prob, "body", f)
source
integrate(s::Union{ScalarField,VectorField,TensorField})
∫(s::Union{ScalarField,VectorField,TensorField})

Compute the time integral of a time-dependent field using a discrete inverse of the central finite-difference time derivative.

The result reproduces the original field (up to a time-independent constant) when applied to a field obtained by ∂t.

source
LowLevelFEM.normalVector — Function
normalVector(problem::Problem, phName::String) -> VectorField

Compute outward unit normal vectors for all nodes belonging to a surface-type physical group in a 3D Gmsh model.

For curve-type physical groups, the function returns normal curvature vectors: the direction corresponds to the unit normal within the curve’s osculating plane, and the vector magnitude equals the local curvature of the curve.

Arguments

  • problem::Problem: A Problem structure containing the current Gmsh model (name, dimension, number of nodes, etc.).
  • phName::String: The name of a physical surface group in Gmsh for which the normal vectors are computed.

Description

The function sets the current model, queries the elements and nodes that belong to the given physical surface group, and evaluates the gradients of the Lagrange basis functions to compute local tangent vectors of the surface. Normal vectors are obtained as cross products of these tangents and normalized to unit length.

Each node belonging to the physical surface group is assigned its corresponding 3D unit normal vector.

Returns

  • VectorField: A VectorField structure that stores the nodal normal vectors on the given physical surface.

Errors

  • Throws an error if the provided physical group is not of surface type (dim != 2).

Example

using LowLevelFEM

# Load a 3D geometry and mesh it in Gmsh
gmsh.initialize()
gmsh.open("box_with_surface.msh")

# Define a 3D model on the volume physical group "body"
mat = material("body")
prob = Problem([mat])

# Compute nodal normals on a physical surface named "leftWall"
nv = normalVector(problem, "leftWall")

# Show the normal vectors on the model
showDoFResults(nv)
openPostProcessor()
source
LowLevelFEM.normalVectors — Function
normalVectors(problem::Problem, phName::String) -> (n1, n2)

Return two elementwise 3D VectorFields normal to the tangent of a curve physical group. At each element node, (t, n1, n2) is right-handed and orthonormal, with t oriented as in tangentVector.

Project a common global coordinate axis onto the normal plane to form n2. Choose the axis least aligned with the tangents across the group, preferring z, then y, then x in a tie. For a curve in the xy plane, n2 points along positive z and n1 lies in the plane. Where the chosen axis is nearly parallel to the tangent, use the least aligned axis at that node. This switch can change the frame orientation between nodes. Supply section principal directions separately when their orientation matters to the constitutive law.

source
LowLevelFEM.tangentVector — Function
tangentVector(problem::Problem, phName::String) -> VectorField

Compute unit tangent vectors for all nodes of a curve-type physical group in a 3D Gmsh model.

Arguments

  • problem::Problem: A Problem structure containing the current Gmsh model (name, dimension, number of nodes, etc.).
  • phName::String: The name of a physical curve group in Gmsh for which the tangent vectors are computed.

Description

The function sets the current model, queries the elements and nodes that belong to the given 1D physical group, and evaluates the gradients of the Lagrange basis functions to determine the local mapping derivative ∂x/∂ξ. Since this derivative represents the geometric tangent direction of the curve at each evaluation point, it is normalized to produce a unit tangent vector.

Each node belonging to the physical curve group is assigned the corresponding 3D unit tangent vector aligned with the parametric direction of the curve.

Returns

  • VectorField: A VectorField structure that stores the nodal tangent vectors on the given physical curve.

Errors

  • Throws an error if the provided physical group is not of curve type (dim != 1).

Example

using LowLevelFEM

# Load a 3D geometry containing a curved edge
gmsh.initialize()
gmsh.open("curve_geometry.msh")

# Create a problem structure
mat = material("body")
prob = Problem([mat])

# Compute tangent vectors along the curve named "leadingEdge"
tv = tangentVector(prob, "leadingEdge")

# Visualize the tangent field
showDoFResults(tv)
openPostProcessor()
source
LowLevelFEM.tangentVectors — Function
tangentVectors(problem::Problem, phName::String) -> (t1, t2)

Return two elementwise 3D VectorFields tangent to a surface physical group. At each element node, (t1, t2, n) is right-handed and orthonormal, with n oriented as in normalVector.

Project a common global coordinate axis onto the tangent plane to form t1 and set t2 = cross(n, t1). Choose the axis least aligned with the normals across the group, preferring x, then y, then z in a tie. Where the chosen axis is nearly parallel to the normal, use the least aligned axis at that node. On curved elements, interpolating the returned fields can change their lengths and orthogonality between nodes.

source

Result Views

LowLevelFEM.showDoFResults — Function
showDoFResults(q::Union{ScalarField,VectorField,TensorField}, comp::Symbol; 
               name=comp, visible=false, factor=0)

Loads nodal results into a View in Gmsh. q is the field to show, comp is the component of the field (:vector, :uvec, :ux, :uy, :uz, :vvec, :vx, :vy, :vz, :qvec, :qx, :qy, :qz, :T, :p, :qn, :s, :sx, :sy, :sz, :sxy, :syx, :syz, :szy, :szx, :sxz, :e, :ex, :ey, :ez, :exy, :eyx, :eyz, :ezy, :ezx, :exz, :x, :y, :z, :xy, :yz, :zx, :yx, :zy, :xz, :seqv, :scalar, :tensor), name is a title to display and visible is a Boolean to toggle the initial visibility in Gmsh on or off. If q has more columns, then a sequence of results will be shown (e.g., as an animation). factor multiplies the DoF result to increase for better visibility. This function returns the tag of the View.

Returns: tag

Types:

  • q: ScalarField, VectorField or TensorField
  • comp: Symbol
  • name: String
  • visible: Boolean
  • tag: Integer
source
LowLevelFEM.showModalResults — Function
showModalResults(Φ::Eigen; name="", visible=false)

Loads modal results into a View in Gmsh. Φ is an Eigen struct. name is a title to display and visible is a Boolean to toggle the initial visibility in Gmsh on or off. Click on ▷| to change the results. This function returns the tag of the View.

Returns: tag

Types:

  • Φ: Eigen
  • name: String
  • visible: Boolean
  • tag: Integer
source
showModalResults(u::Field; name=:modal, visible=false, ff=1, factor=0)

Render a real eigenmode Field as an undamped vibration mode. The temporary Gmsh view displays frequencies sqrt(λ)/(2π) rather than λ; the input Field and its original eigenvalue labels are not modified.

source
LowLevelFEM.showBucklingResults — Function
showBucklingResults(Φ::Eigen; name="", visible=false)

Loads buckling results into a View in Gmsh. Φ is an Eigen struct. name is a title to display and visible is a Boolean to toggle the initial visibility in Gmsh on or off. Click on ▷| to change the results. This function returns the tag of the View.

Returns: tag

Types:

  • Φ: Eigen
  • name: String
  • visible: Boolean
  • tag: Integer
source
showBucklingResults(u::Field; name=:buckling, visible=false, ff=2, factor=0)

Display buckling eigenvectors and their corresponding eigenvalue components.

source
LowLevelFEM.showStrainResults — Function
showStrainResults(E::TensorField, comp::Symbol; 
                  name=comp, visible=false, smooth=true)

Loads strain results into a View in Gmsh. E is a strain field to show, comp is the component of the field (:e, :ex, :ey, :ez, :exy, :eyz, :ezx, :x, :y, :z, :xy, :yz, :zx, :yx, :zy, :xz), name is a title to display, visible is a Boolean to toggle the initial visibility in Gmsh on or off and smooth is a Boolean to toggle smoothing the stress field on or off. If E contains more than one time steps, then a sequence of results will be shown (e.g., as an animation). This function returns the tag of the View.

Returns: tag

Types:

  • E: TensorField
  • comp: Symbol
  • name: String
  • visible: Boolean
  • smooth: Boolean
  • tag: Integer

Display configuration

The keyword factor is accepted by this view constructor; the current call signature is:

showStrainResults(E0, comp; name=comp, visible=false, smooth=true)

View options affect visualization only, not the stored finite-element field.

source
LowLevelFEM.showStressResults — Function
showStressResults(S0::TensorField, comp::Symbol; 
                  name=comp, visible=false, smooth=false)

Loads stress results into a View in Gmsh. S is a stress field to show, comp is the component of the field (:s, :sx, :sy, :sz, :sxy, :syz, :szx, :seqv, :x, :y, :z, :xy, :yz, :zx, :yx, :zy, :xz), name is a title to display, visible is a Boolean to toggle the initial visibility in Gmsh on or off, and smooth is a Boolean to toggle smoothing the stress field on or off. If S contains more than one time step, a sequence of results will be shown (e.g., as an animation). This function returns the tag of the View.

Returns: tag

Types:

  • S: TensorField
  • comp: Symbol
  • name: String
  • visible: Boolean
  • smooth: Boolean
  • tag: Integer
source
LowLevelFEM.showElementResults — Function
showElementResults(F::Union{ScalarField,VectorField,TensorField}, comp=:Symbol; 
                   name=comp, visible=false, smooth=false, factor=0)

showElementResults(F, comp; name=..., visible=..., smooth=...)

Same as ShowStressResults or showStrainResults, depending on the type of F data field.

Return: tag

Types:

  • F: TensorField
  • comp: Symbol
  • name: String
  • visible: Boolean
  • smooth: Boolean
  • tag: Integer

Display configuration

The keyword ff is accepted by this view constructor; the current call signature is:

showElementResults(F::Union{ScalarField,VectorField,TensorField}, comp; name=comp, visible=false, smooth=false, factor=0)

View options affect visualization only, not the stored finite-element field.

Display configuration

The keyword factor is accepted by this view constructor; the current call signature is:

showStressResults(q::TensorField; name="StressField", visible=false, smooth=false, ff = 0, factor=0)

View options affect visualization only, not the stored finite-element field.

source
LowLevelFEM.showHeatFluxResults — Function
showHeatFluxResults(S0::VectorField, comp::Symbol; 
                    name=comp, visible=false, smooth=true, factor=0)

Loads heat flux results into a View in Gmsh. Q is a heat flux field to show, comp is the component of the field (:qvec, :qx, :qy, :qz, :q, :x, :y, :z), name is a title to display, visible is a Boolean to toggle the initial visibility in Gmsh on or off, and smooth is a Boolean to toggle smoothing on or off. If Q contains more than one time step, a sequence of results will be shown (e.g., as an animation). This function returns the tag of the View.

Returns: tag

Types:

  • S: VectorField
  • comp: Symbol
  • name: String
  • visible: Boolean
  • smooth: Boolean
  • tag: Integer
source
LowLevelFEM.showOnSurface — Function
showOnSurface(field::Number, phName::String; 
              grad=false, component=:x, offsetX=0, offsetY=0, offsetZ=0, 
              name=phName, visible=false)

Shows the values of a scalar field on a surface with physical name phName. field is the tag of a View in Gmsh. The values of the field are calculated at the intersection with the surface. grad is a Boolean to toggle the gradient of the field on or off. component is the component of the gradient of field (:x, :y, :z) to be shown. offsetX, offsetY, offsetZ are the offsets in the x, y, and z directions where the values are sampled. name is a title to display, and visible is a Boolean to toggle the initial visibility in Gmsh on or off.

Returns: tag

Types:

  • field: Integer
  • phName: String
  • grad: Boolean
  • component: Symbol
  • offsetX: Float64
  • offsetY: Float64
  • offsetZ: Float64
  • name: String
  • visible: Boolean
  • tag: Integer
source
LowLevelFEM.plotOnPath — Function
plotOnPath(pathName, field; points=100, step=nothing, plot=false,
           name="field [$field] on $pathName", visible=false,
           offsetX=0, offsetY=0, offsetZ=0)

Sample a Gmsh model-data view along the curves of a physical group. step is a zero-based view step; nothing selects all steps. All selected steps are retrieved in one probe per sampling point. Vector values are shown as magnitudes and tensor values as von Mises equivalents. Return the new view tag, or (tag, (x, y)) when plot=true; y contains the first selected step. Samples are uniform in curve parameter, as in the original implementation.

source
LowLevelFEM.plotOnBeam — Function
plotOnBeam(
    phName::String,
    s::ScalarField;
    step=nothing,
    plot=false,
    name="field on $phName",
    visible=false,
    reverse=false
)

Create a diagram of a scalar field along a one-dimensional finite element path.

The physical group phName must define a single connected, non-branching, open chain of 1D finite elements. The element order is reconstructed from the mesh topology, independently of the order in which Gmsh returns the elements.

The horizontal coordinate of the graph is the cumulative length of the discretized beam path.

Both nodal and elementwise ScalarField representations are supported. For elementwise fields, common element-end nodes are repeated in the graph, so discontinuities between adjacent elements are preserved.

If the field contains multiple time steps and step=nothing, all time steps are added to the Gmsh view and can be animated. If step is specified, it is interpreted as a zero-based time-step index, consistently with plotOnPath.

With reverse=true, traversal starts from the opposite end of the beam path.

Arguments

  • phName: name of a 1D Gmsh physical group defining the beam path.
  • s: scalar field to plot.

Keyword arguments

  • step=nothing: plot all time steps, or select one zero-based time-step index.
  • plot=false: if true, also return (x, y) data for the selected or first step.
  • name="field on $phName": name of the generated Gmsh view.
  • visible=false: initial visibility of the generated Gmsh view.
  • reverse=false: reverse the traversal direction.

Returns

If plot=false:

beamView

If plot=true:

beamView, (x, y)

where x is the cumulative beam length and y contains the values of the selected time step, or the first time step if all steps are shown.

Notes

The physical group must contain exactly one open path. Branching, disconnected paths and closed loops are rejected because they do not define a unique beam coordinate.

source

Probing and UI

LowLevelFEM.probe — Function
probe(A::Union{ScalarField,VectorField,TensorField}, 
      x::Number, y::Number, z::Number; step=Int)

Get the value of the field A at point coordinates x, y, z at time step step.

Returns: Float64 or Vector{Float64} or Matrix{Float64}

Types:

  • A: ScalarField or VectorField or TensorField
  • x: Number
  • y: Number
  • z: Number
  • step: Int
source
probe(A::Union{ScalarField,VectorField,TensorField}, name::String; step=1)

Get the value of the field A at a point given by its physical name in Gmsh at time step step.

Returns: Float64 or Vector{Float64} or Matrix{Float64}

Types:

  • A: ScalarField or VectorField or TensorField
  • x: Number
  • y: Number
  • z: Number
  • step: Int
source
LowLevelFEM.openPostProcessor — Function
openPostProcessor(; model=...)

Launches the Gmsh postprocessor window with the postprocessor tree opened (of model).

Returns: nothing

Types:

  • model: Int64
source

Field persistence is documented under Fields and storage, result coordinate transformations under Boundary conditions and coordinates, and field derivatives under Field calculus.