◆ FORGE Suite
GitHubMechanical Neuroimaging Lab · Univ. of Delaware
Skip to content

Postprocessing

Visualization, convergence analysis, and property interpolation tools.

VTK Export

Export meshes and results to VTK format for visualization in ParaView.

Sentinel.export_vtk Function
julia
export_vtk(filename::AbstractString, result::HexMeshResult;
           write_disp::Bool=true, write_anatomical::Bool=true,
           write_region::Bool=true)

Export a HexMeshResult to VTK (.vtu) format with hex27 cells.

Arguments

  • filename: output path (without .vtu extension)

  • result: hex mesh generation result

  • write_disp: include displacement point data (default: true)

  • write_anatomical: include anatomical magnitude point data (default: true)

  • write_region: include region assignment point data (default: true)

source
julia
export_vtk(filename::AbstractString, grid, dh, disp::Displacement;
           dispset::Int=1)

Export a Ferrite grid with displacement solution to VTK.

Arguments

  • filename: output path (without .vtu extension)

  • grid: Ferrite Grid

  • dh: DofHandler

  • disp: solved displacement

  • dispset: which displacement set to export (default: 1)

source
julia
export_vtk(filename::AbstractString, material::Material, mesh::MaterialMesh;
           prop_indices=1:material.numprop, val_idx::Int=1)

Export material properties on a MaterialMesh to VTK (.vtu).

Nodal-basis properties are written as point data; elemental-basis properties are written as cell data.

Arguments

  • filename: output path (without .vtu extension)

  • material: Material with property arrays

  • mesh: MaterialMesh (structured hex8)

  • prop_indices: which properties to export (default: all)

  • val_idx: which value-per-point column (default: 1)

source
Sentinel.PropertyMapData Type
julia
PropertyMapData

Extracted material property coordinates and values (no file I/O).

Fields

  • coords::Matrix{Float64}: (n, 3) point coordinates

  • values::Dict{String, Vector{Float64}}: named property arrays

  • mesh_type::Symbol: :hex8, :hex27, or :structured

source

Convergence Analysis

Sentinel.print_convergence_table Function
julia
print_convergence_table(history::ConvergenceHistory; io::IO=stdout, header::Bool=true)

Print a formatted convergence table showing per-iteration metrics.

Columns: Iteration | Objective | Disp Error | Mat Epsilon | Obj Ratio

The objective ratio is objective[i] / objective[i-1] (shown as --- for iteration 1).

source
Sentinel.convergence_statistics Function
julia
convergence_statistics(history::ConvergenceHistory) -> NamedTuple

Compute summary statistics from a convergence history.

Returns

Named tuple with fields:

  • iterations: total iterations

  • converged: whether the optimizer converged

  • initial_objective: first iteration objective

  • final_objective: last iteration objective

  • objective_reduction: final / initial

  • initial_disp_error: first iteration displacement error

  • final_disp_error: last iteration displacement error

  • final_mat_epsilon: last iteration material change

  • min_objective: minimum objective across all iterations

  • min_objective_iter: iteration at which minimum occurred

  • avg_obj_reduction_rate: geometric mean of per-iteration ratios

source
Sentinel.export_convergence_csv Function
julia
export_convergence_csv(filename::AbstractString, history::ConvergenceHistory;
                       delimiter::Char=',')

Export convergence history to a CSV file.

Columns: iteration, objective, disp_error, mat_epsilon

source

Property Interpolation

Interpolate reconstructed material properties from the material mesh to arbitrary points or structured grids.

Sentinel.PropertyGridResult Type
julia
PropertyGridResult

Result of interpolating material properties onto a structured grid.

Fields

  • data::Dict{String, Array{Float64, 3}}: property arrays keyed by name (e.g., "prop1_real", "prop1_imag")

  • origin::SVector{3, Float64}: grid origin (meters)

  • resolution::SVector{3, Float64}: voxel size (meters)

  • dims::NTuple{3, Int}: grid dimensions (nx, ny, nz)

source
Sentinel.interpolate_properties Function
julia
interpolate_properties(material::Material, mesh::MaterialMesh,
                       target_coords::AbstractMatrix{<:Real};
                       prop_indices=1:material.numprop, val_idx::Int=1)

Interpolate material properties from a MaterialMesh to arbitrary target coordinates.

Arguments

  • material: Material with property arrays

  • mesh: MaterialMesh defining the structured hex8 grid

  • target_coords: (n, 3) matrix of target (x, y, z) coordinates

  • prop_indices: which properties to interpolate (default: all)

  • val_idx: which value-per-point column to use (default: 1)

Returns

Dict{String, Vector{Float64}} with keys "prop{i}_real" and "prop{i}_imag" for each property index i.

Out-of-bounds points get NaN.

source
Sentinel.interpolate_to_grid Function
julia
interpolate_to_grid(material::Material, mesh::MaterialMesh,
                    origin, resolution, dims::NTuple{3, Int};
                    prop_indices=1:material.numprop, val_idx::Int=1)

Interpolate material properties onto a structured grid.

Arguments

  • material: Material with property arrays

  • mesh: MaterialMesh defining the source hex8 grid

  • origin: (3,) grid origin [x0, y0, z0]

  • resolution: (3,) voxel size [dx, dy, dz]

  • dims: (nx, ny, nz) grid dimensions

  • prop_indices: which properties to interpolate (default: all)

  • val_idx: which value-per-point column to use (default: 1)

Returns

PropertyGridResult with 3D arrays for each property.

source