API Reference

On this page the docs of the provided functions are listed

FerriteViz.MakiePlotterType
MakiePlotter(dh::Ferrite.AbstractDofHandler, u::Vector)
MakiePlotter(dh::Ferrite.AbstractDofHandler, u::Vector, topology::TOP) where {TOP<:Ferrite.AbstractTopology}

Builds a static triangulation of the underlying grid in dh.grid for rendering via Makie. The triangulation acts as a "L2" triangulation, i.e. the nodes which are shared between elements in the mesh are doubled.

Tip

For large 3D grids, prefer to use the second constructor if you have already a topology. Otherwise, it will be rebuilt which is time consuming.

source
FerriteViz.solutionplotFunction
solutionplot(plotter::MakiePlotter; kwargs...)
solutionplot(dh::AbstractDofHandler, u::Vector; kwargs...)
solutionplot!(plotter::MakiePlotter; kwargs...)
solutionplot!(dh::AbstractDofHandler, u::Vector; kwargs...)

Solutionplot produces the classical contour plot onto the finite element mesh. Most important keyword arguments are:

  • field::Symbol=:default representing the field which gets plotted, defaults to the first field in the dh.
  • deformation_field::Symbol=:default field that transforms the mesh by the given deformation, defaults to no deformation
  • process::Function=postprocess function to construct nodal scalar values from a vector valued problem
  • colormap::Symbol=:cividis
  • colorrange::NTuple{2,<:Number}: Specify (min, max) of the colorscale. If not given, min and max are calculated automatically from the data.
  • deformation_scale=1.0
  • shading=false
  • scale_plot=false
  • transparent=false
  • nan_color::Union{Symbol, <:Colorant}=:red
source
FerriteViz.solutionplot!Function
solutionplot(plotter::MakiePlotter; kwargs...)
solutionplot(dh::AbstractDofHandler, u::Vector; kwargs...)
solutionplot!(plotter::MakiePlotter; kwargs...)
solutionplot!(dh::AbstractDofHandler, u::Vector; kwargs...)

Solutionplot produces the classical contour plot onto the finite element mesh. Most important keyword arguments are:

  • field::Symbol=:default representing the field which gets plotted, defaults to the first field in the dh.
  • deformation_field::Symbol=:default field that transforms the mesh by the given deformation, defaults to no deformation
  • process::Function=postprocess function to construct nodal scalar values from a vector valued problem
  • colormap::Symbol=:cividis
  • colorrange::NTuple{2,<:Number}: Specify (min, max) of the colorscale. If not given, min and max are calculated automatically from the data.
  • deformation_scale=1.0
  • shading=false
  • scale_plot=false
  • transparent=false
  • nan_color::Union{Symbol, <:Colorant}=:red
source
FerriteViz.cellplotFunction
cellplot(plotter::MakiePlotter,σ::Vector{T}; kwargs...) where T
cellplot!(plotter::MakiePlotter,σ::Vector{T}; kwargs...) where T

cellplot plots constant scalar data on the cells of the finite element mesh. If T is not a number, the keyword argument process can be passed in order to reduce the elements of σ to a scalar.

keyword arguments are:

  • deformation_field::Symbol=:default field that transforms the mesh by the given deformation, defaults to no deformation
  • process::Function=identity function to construct cell scalar values. Defaults to identity, i.e. scalar values.
  • colormap::Symbol=:cividis
  • colorrange::NTuple{2,<:Number}: Specify (min, max) of the colorscale. If not given, min and max are calculated automatically from the data.
  • deformation_scale=1.0
  • shading=false
  • scale_plot=false
  • transparent=false
  • nan_color::Union{Symbol, <:Colorant}=:red
source
FerriteViz.cellplot!Function
cellplot(plotter::MakiePlotter,σ::Vector{T}; kwargs...) where T
cellplot!(plotter::MakiePlotter,σ::Vector{T}; kwargs...) where T

cellplot plots constant scalar data on the cells of the finite element mesh. If T is not a number, the keyword argument process can be passed in order to reduce the elements of σ to a scalar.

keyword arguments are:

  • deformation_field::Symbol=:default field that transforms the mesh by the given deformation, defaults to no deformation
  • process::Function=identity function to construct cell scalar values. Defaults to identity, i.e. scalar values.
  • colormap::Symbol=:cividis
  • colorrange::NTuple{2,<:Number}: Specify (min, max) of the colorscale. If not given, min and max are calculated automatically from the data.
  • deformation_scale=1.0
  • shading=false
  • scale_plot=false
  • transparent=false
  • nan_color::Union{Symbol, <:Colorant}=:red
source
FerriteViz.wireframeFunction
wireframe(plotter::MakiePlotter; kwargs...)
wireframe(dh::AbstractDofHandler, u::Vector; kwargs...)
wireframe(grid::AbstractGrid; kwargs...)
wireframe!(plotter::MakiePlotter; kwargs...)
wireframe!(dh::AbstractDofHandler, u::Vector; kwargs...)
wireframe!(grid::AbstractGrid; kwargs...)

Plots the finite element mesh, optionally labels it and transforms it if a suitable deformation_field is given.

  • plotnodes::Bool=true plots the nodes as circles/spheres
  • strokewidth::Int=2 how thick faces/edges are drawn
  • color::Symbol=theme(scene,:linecolor) color of the faces/edges and nodes
  • markersize::Int=30 size of the nodes
  • deformation_field::Symbol=:default field that transforms the mesh by the given deformation, defaults to no deformation
  • deformation_scale::Number=1.0 scaling of the deformation
  • cellsets=false Color cells based on their cellset association. If no cellset is found for a cell, the cell is marked blue.
  • nodelables=false global node id labels
  • nodelabelcolor=:darkblue
  • celllabels=false global cell id labels
  • celllabelcolor=:darkred
  • textsize::Int=15 size of the label's text
  • visible=true
source
FerriteViz.wireframe!Function
wireframe(plotter::MakiePlotter; kwargs...)
wireframe(dh::AbstractDofHandler, u::Vector; kwargs...)
wireframe(grid::AbstractGrid; kwargs...)
wireframe!(plotter::MakiePlotter; kwargs...)
wireframe!(dh::AbstractDofHandler, u::Vector; kwargs...)
wireframe!(grid::AbstractGrid; kwargs...)

Plots the finite element mesh, optionally labels it and transforms it if a suitable deformation_field is given.

  • plotnodes::Bool=true plots the nodes as circles/spheres
  • strokewidth::Int=2 how thick faces/edges are drawn
  • color::Symbol=theme(scene,:linecolor) color of the faces/edges and nodes
  • markersize::Int=30 size of the nodes
  • deformation_field::Symbol=:default field that transforms the mesh by the given deformation, defaults to no deformation
  • deformation_scale::Number=1.0 scaling of the deformation
  • cellsets=false Color cells based on their cellset association. If no cellset is found for a cell, the cell is marked blue.
  • nodelables=false global node id labels
  • nodelabelcolor=:darkblue
  • celllabels=false global cell id labels
  • celllabelcolor=:darkred
  • textsize::Int=15 size of the label's text
  • visible=true
source
FerriteViz.arrowsFunction
arrows(plotter::MakiePlotter; kwargs...)
arrows(dh::AbstractDofHandler, u::Vector; kwargs...)
arrows!(plotter::MakiePlotter; kwargs...)
arrows!(dh::AbstractDofHandler, u::Vector; kwargs...)

At every node position a arrows is drawn, where the arrow tip ends at the node. Only works in dim >=2. If a color is specified the arrows are unicolored. Otherwise the color corresponds to the magnitude, or any other scalar value based on the process function.

  • arrowsize = 0.08
  • normalize = true
  • field = :default
  • color = :default
  • colormap = :cividis
  • process=postprocess
  • lengthscale = 1f0
source
FerriteViz.arrows!Function
arrows(plotter::MakiePlotter; kwargs...)
arrows(dh::AbstractDofHandler, u::Vector; kwargs...)
arrows!(plotter::MakiePlotter; kwargs...)
arrows!(dh::AbstractDofHandler, u::Vector; kwargs...)

At every node position a arrows is drawn, where the arrow tip ends at the node. Only works in dim >=2. If a color is specified the arrows are unicolored. Otherwise the color corresponds to the magnitude, or any other scalar value based on the process function.

  • arrowsize = 0.08
  • normalize = true
  • field = :default
  • color = :default
  • colormap = :cividis
  • process=postprocess
  • lengthscale = 1f0
source
FerriteViz.surfaceFunction
surface(plotter::MakiePlotter; kwargs...)
surface(dh::AbstractDofHandler, u::Vector; kwargs...)
surface!(plotter::MakiePlotter; kwargs...)
surface!(dh::AbstractDofHandler, u::Vector; kwargs...)

Uses the given field and plots the scalar values as a surface. If it's a vector valued problem, the nodal vector values are transformed to a scalar based on process which defaults to the magnitude. Only availble in dim=2.

  • field = :default
  • process = postprocess
  • scale_plot = false
  • shading = false
  • colormap = :cividis
  • colorrange=Makie.automatic
  • nan_color::Union{Symbol, <:Colorant}=:red
source
FerriteViz.surface!Function
surface(plotter::MakiePlotter; kwargs...)
surface(dh::AbstractDofHandler, u::Vector; kwargs...)
surface!(plotter::MakiePlotter; kwargs...)
surface!(dh::AbstractDofHandler, u::Vector; kwargs...)

Uses the given field and plots the scalar values as a surface. If it's a vector valued problem, the nodal vector values are transformed to a scalar based on process which defaults to the magnitude. Only availble in dim=2.

  • field = :default
  • process = postprocess
  • scale_plot = false
  • shading = false
  • colormap = :cividis
  • colorrange=Makie.automatic
  • nan_color::Union{Symbol, <:Colorant}=:red
source
FerriteViz.elementinfoFunction
elementinfo(ip::Interpolation; kwargs...)
elementinfo(cell::AbstractCell; kwargs...)
elementinfo(ip::Type{Interpolation}; kwargs...)
elementinfo(cell::Type{AbstractCell}; kwargs...)
  • plotnodes=true controls if nodes of element are plotted
  • strokewidth=2 strokwidth of faces/edges
  • color=theme(scene, :linecolor)
  • markersize=30 size of the nodes
  • textsize=60 textsize of node-, edges- and facelabels
  • nodelabels=true switch that controls plotting of nodelabels
  • nodelabelcolor=:darkred
  • nodelabeloffset=(0.0,0.0) offset of the nodelabel text relative to its associated node
  • facelabels=true switch that controls plotting of facelabels
  • facelabelcolor=:darkgreen
  • facelabeloffset=(-40,0) offset of the facelabel text relative to its associated face middlepoint
  • edgelabels=true switch that controls plotting of edgelabels
  • edgelabelcolor=:darkblue
  • edgelabeloffset=(-40,-40) offset of the edgelabel text relative to its associated edge middlepoint
  • font="Julia Mono" font of the node-, edge-, and facelabels
source
FerriteViz.elementinfo!Function
elementinfo(ip::Interpolation; kwargs...)
elementinfo(cell::AbstractCell; kwargs...)
elementinfo(ip::Type{Interpolation}; kwargs...)
elementinfo(cell::Type{AbstractCell}; kwargs...)
  • plotnodes=true controls if nodes of element are plotted
  • strokewidth=2 strokwidth of faces/edges
  • color=theme(scene, :linecolor)
  • markersize=30 size of the nodes
  • textsize=60 textsize of node-, edges- and facelabels
  • nodelabels=true switch that controls plotting of nodelabels
  • nodelabelcolor=:darkred
  • nodelabeloffset=(0.0,0.0) offset of the nodelabel text relative to its associated node
  • facelabels=true switch that controls plotting of facelabels
  • facelabelcolor=:darkgreen
  • facelabeloffset=(-40,0) offset of the facelabel text relative to its associated face middlepoint
  • edgelabels=true switch that controls plotting of edgelabels
  • edgelabelcolor=:darkblue
  • edgelabeloffset=(-40,-40) offset of the edgelabel text relative to its associated edge middlepoint
  • font="Julia Mono" font of the node-, edge-, and facelabels
source
FerriteViz.ferriteviewerFunction
ferriteviewer(plotter::MakiePlotter)
ferriteviewer(plotter::MakiePlotter, u_history::Vector{Vector{T}}})

Constructs a viewer with a solutionplot, Colorbar as well as sliders,toggles and menus to change the current view. If the second dispatch is called a timeslider is added, in order to step through a set of solutions obtained from a simulation.

source
FerriteViz.update!Function
FerriteViz.update!(plotter::MakiePlotter, u::Vector)

Updates the Observable plotter.u and thereby, triggers the plot to update.

source
FerriteViz.interpolate_gradient_fieldFunction
interpolate_gradient_field(dh::DofHandler, u::AbstractVector, field_name::Symbol; copy_fields::Vector{Symbol})

Compute the piecewise discontinuous gradient field for field_name. Returns the flux dof handler and the corresponding flux dof values. If the additional keyword argument copy_fields is provided with a non empty Vector{Symbol}, the corresponding fields of dh will be copied into the returned flux dof handler and flux dof value vector.

source
FerriteViz.uniform_refinementFunction
uniform_refinement(plotter::MakiePlotter)
uniform_refinement(plotter::MakiePlotter, num_refinements::Int)

Generates 3 triangles for each triangle by adding a center vertex and connecting them (orientation preserving).

Danger

This method has high RAM usage!

Info

This function currently does not increase the resolution of the geometrical points in space, only the solution quality!

Details

TODO investigate whether it is possible to eliminate the coordinate duplication without trashing the caches

source
FerriteViz.crinkle_clip!Function
crinkle_clip!(plotter::MakiePlotter{3}, decision_fun)

Crinkle clip updates the visibility of the triangles, based on an implicit description of the clipping surface. Here decision_fun takes the grid and a cell index as input and returns whether the cell is visible or not.

Warning

Chained calls to crinkle_clip! won't work at the moment.

source
FerriteViz.crinkle_clipFunction
crinkle_clip(plotter::MakiePlotter{3}, decision_fun) -> MakiePlotter

Crinkle clip generates a new plotter with updated visibility of the triangles. Non-mutating version of crinkle_clip!. Note that chained calls to crinkle_clip won't work.

source
FerriteViz.ClipPlaneType
ClipPlane{T}(normal, distance_to_origin)

Clip plane with data of type T described by the normal and its distance to the coordinate origin.

Details

INTERNAL: Instances are callable as plane(grid, cellid) returning true if all nodes of a cell are on the side of the positive side of the plane, i.e. where for its normal we have coord ⋅ plane.normal > plane.distance. With this helper we perform the crinkle clip internally. xref [crinkle_clip!](@ref)

source