GridapROMs.RBSteady

GridapROMs.RBSteadyModule
module RBSteady

Reduced-basis infrastructure for steady parametric PDEs.

Implements the offline–online decomposition for parameter-dependent FE problems. The offline stage compresses high-fidelity snapshots into a low-dimensional basis and constructs hyper-reduced operators; the online stage solves the resulting small system for new parameter values. Main building blocks:

  • Reduction methods (ReductionMethods.jl) — PODReduction (SVD-based), TTSVDReduction (tensor-train SVD), GreedyReduction, SupremizerReduction, MDEIMHyperReduction, SOPTHyperReduction, RBFHyperReduction, NNHyperReduction (NN-based EIM coefficient prediction), NNOperatorReduction (full operator regression), LocalHyperReduction (cluster-local variants), and composites. Rank/tolerance criteria expressed via SearchSVDRank, FixedSVDRank, LRApproxRank, TTSVDRanks. NN training controlled by NNStrategy.

  • Bases construction (BasesConstruction.jl) — tpod (truncated POD), ttsvd (tensor-train SVD), gram_schmidt / orth_complement!, orth_projection.

  • Projections (Projections.jl) — PODProjection, TTSVDProjection, NormedProjection (energy norm), BlockProjection, ReducedProjection. Core operations: project/project!, inv_project/inv_project!, union_bases, enrich!.

  • RB spaces (RBSpaces.jl) — SingleFieldRBSpace, MultiFieldRBSpace, reduced_subspace, reduced_basis.

  • Hyper-reduction (HyperReductions.jl) — HRProjection hierarchy (MDEIMProjection, RBFProjection, NNHRProjection, BlockHRProjection) together with IntegrationDomain (DEIM-style reduced integration), Interpolation (GreedyInterpolation, RBFInterpolation, NNInterpolation), NNOperator (NN operator regression projection), NNContribution, and reduced_triangulation / reduced_jacobian / reduced_residual / reduced_weak_form.

  • Neural network models (NonlinearModels.jl) — MultiLayerPerceptron, GenericNeuralNetwork, TrainedNeuralNetwork; minimal ForwardDiff-based training loop with mini-batching, LR scheduling, and early stopping.

  • Reduced operators (ReducedOperators.jl) — GenericRBOperator, LinearNonlinearRBOperator; reduced_operator.

  • RB solvers (RBSolvers.jl) — RBSolver orchestrates snapshot collection, offline reduction, and online solve; solution_snapshots, residual_snapshots, jacobian_snapshots.

  • Tensor-train linear algebra (TTLinearAlgebra.jl) — contraction, unbalanced_contractions, sequential_product, cores2basis, TTCores.

  • Local / cluster-based projections (LocalProjections.jl) — LocalProjection, cluster, get_clusters, get_local, local_vals.

  • Post-processing (PostProcess.jl) — ROMPerformance, eval_performance, I/O helpers (load_snapshots, load_contribution, load_operator, …).

The RBTransient module extends all of the above to the time-dependent setting.

source
GridapROMs.RBSteady.AdaptiveReductionType
struct AdaptiveReduction{A,B,R<:DirectReduction{A,B}} <: GreedyReduction{A,B}
  reduction::R
  adaptive_nparams::Int
  adaptive_tol::Float64
  adaptive_maxiter::Int
end

Not implemented yet. Will serve as a parameter-adaptivity greedy reduction algorithm

source
GridapROMs.RBSteady.AffineHyperReductionType
struct AffineHyperReduction <: TrivialHyperReduction end

Reduction employed when reduced contributions are affine with respect to parameter-independent (μ-independent) structures. As in the no-hyper-reduction case, this uses a single effective parameter sample (num_params = 1) for the hyper-reduction stage.

source
GridapROMs.RBSteady.AutoDecoderType
AutoDecoder{D,A} <: NeuralNetwork

Decoder-only model (Park et al., 2019). Per-sample latent codes are stored in latent_codes (latent_dim × n_train) and optimised jointly with the decoder parameters during training. Inference for unseen samples requires fitting a latent code via infer_latent.

evaluate! applies the decoder (latent_dim × k → n_h × k).

NNStrategy interpretation: layers = (h₁, …, latent_dim) defines the decoder from last to first (i.e. decoder layers are (latent_dim, reverse(h₁,…,h_{L-1})…, n_h)).

source
GridapROMs.RBSteady.AutoEncoderType
AutoEncoder{E,D} <: NeuralNetwork

Encoder–decoder pair for unsupervised dimensionality reduction. Both sub-networks are MultiLayerPerceptrons with parameters stored as a flat vector for ForwardDiff-based joint training.

evaluate!(cache, ae, z) applies the decoder (latent → high-dim). Use encode for the encoder direction (high-dim → latent).

Convolutional variants: wrap a Lux/Flux CNN chain in GenericNeuralNetwork and supply a custom train! using Lux.Training.single_train_step! with AutoZygote.

Build and train in one call via TrainedNeuralNetwork:

s = NNStrategy(type=AutoEncoderType(), layers=(128,64,16))
ae = TrainedNeuralNetwork(s, r, snapshots)

where s.layers = (h₁, h₂, …, latent_dim) defines the encoder hidden widths; the decoder mirrors them symmetrically.

source
GridapROMs.RBSteady.BlockHRProjectionType
struct BlockHRProjection{N,A,B} <: HRProjection{BlockProjection{A,N},B}
  array::Array{<:HRProjection{A,B},N}
  touched::Array{Bool,N}
end

Block container for HRProjection in a MultiField setting. This type is conceived similarly to ArrayBlock in Gridap

source
GridapROMs.RBSteady.BlockProjectionType
struct BlockProjection{A<:Projection,N} <: Projection
  array::Array{A,N}
  touched::Array{Bool,N}
end

Block container for Projection of type A in a MultiField setting. This type is conceived similarly to ArrayBlock in Gridap

source
GridapROMs.RBSteady.DiagnosticsContributionType
struct DiagnosticsContribution{A,B,C}
  fecache::A
  coeff::B
  hypred::C
end

Diagnostic counterpart of HRParamArray. Unlike HRParamArray, which accumulates hyper-reduced contributions across triangulations into a single reduced-dimension array, DiagnosticsContribution keeps one per-triangulation entry in hypred::C, where C is either an ArrayContribution (steady) or a TupOfArrayContribution (transient Jacobians). Each entry stores the reconstruction of the HR operator contribution from that triangulation, expanded back to a high-dimensional (FE or RB) space so that it can be directly compared with full-order snapshots.

source
GridapROMs.RBSteady.DofMapCoreType
struct DofMapCore{T,A<:AbstractArray{T,3},B<:AbstractArray} <: AbstractTTCore{T,3}
  core::A
  dof_map::B
end

Represents a tensor train core core reindexed by means of an index mapping dof_map

source
GridapROMs.RBSteady.EnergyNormType
struct EnergyNorm <: NormStyle
  norm_op::Function
end

Trait indicating that the reduction algorithm will produce a basis orthogonal in the norm specified by norm_op. Note: norm_op should represent a symmetric, positive definite bilinear form (matrix)

source
GridapROMs.RBSteady.FixedSVDRankType
struct FixedSVDRank <: ReductionStyle
  rank::Int
end

Struct employed when the chosen reduction algorithm is a truncated POD at a rank rank. Check this reference for more details on the truncated POD algorithm

source
GridapROMs.RBSteady.GenericDomainType
struct GenericDomain{A,B} <: IntegrationDomain
  cells::Vector{Int32}
  cell_idofs::A
  dofs::B
end

Integration domain for the hyper-reduction of a residual (vector-valued form) or a Jacobian (matrix-valued form).

  • cells: sorted list of cell indices (local to the triangulation) that contain at least one interpolation DOF.
  • cell_idofs: lazy map over cells; for the vector case, cell_idofs[ic][j] is the 1-based index into dofs of the j-th DOF of cell cells[ic], or 0 if that DOF is not an interpolation DOF. For the matrix case, cell_idofs[ic] is a flat (column-major) array of length ncellrows * ncellcols; position r + (c-1)*ncellrows stores the EIM pair index, or 0 if that (row,col) entry is not an interpolation pair.
  • dofs: for the vector case, a vector of global DOF indices selected as interpolation DOFs by EIM/DEIM. For the matrix case, a tuple (rows, cols) of such vectors.
source
GridapROMs.RBSteady.GenericNeuralNetworkType
struct GenericNeuralNetwork{A} <: NeuralNetwork
  model::A
end

Wraps any callable A (Flux chain, Lux closure, plain Julia function) as an NeuralNetwork. The wrapped callable must accept a (d × k) parameter matrix and return an (n × k) prediction matrix.

source
GridapROMs.RBSteady.GenericRBOperatorType
struct GenericRBOperator{O,T,A,B} <: RBOperator{O,T}
  op::ParamOperator{O,T}
  trial::RBSpace
  test::RBSpace
  lhs::A
  rhs::B
end

Fields:

  • op: underlying high dimensional FE operator
  • trial: reduced trial space
  • test: reduced test space
  • lhs: hyper-reduced left hand side
  • rhs: hyper-reduced right hand side
source
GridapROMs.RBSteady.HRProjectionType
abstract type HRProjection{A<:Projection,B<:HyperReduction} <: Projection end

Subtype of a Projection dedicated to the output of a hyper-reduction procedure applied on residual/jacobians of a differential problem. This procedure can be summarized in the following steps:

  1. compute a snapshots tensor T
  2. construct a Projection Φ by running the function reduction on T
  3. implement an interpolation strategy

There are two types of interpolation strategies:

  1. Empirical interpolation of the Projection Φ
  2. Radial basis interpolation over the parameter space

We recall that a RB method requires the (Petrov-)Galerkin projection of the operators (residuals/Jacobians) on the reduced subspace spanned by Φ:

  • for residuals: Φrb = test_basisᵀ Φ
  • for Jacobians: Φrb = test_basisᵀ Φ trial_basis

The output of this operation is a ReducedProjection. Therefore, a HRProjection is completely characterized by the couple (Φrb,i), where i indicates the chosen interpolation strategy.

Subtypes:

source
GridapROMs.RBSteady.InterpolationMethod
Interpolation(red::NNHyperReduction, basis::Projection, s::Snapshots)
  -> NNInterpolation

Offline training step for NNHyperReduction:

  1. Runs empirical interpolation on basis to determine integration points and the EIM matrix
  2. Solves the EIM system for each snapshot to obtain coefficient vectors
  3. Trains a NeuralNetwork via red.strategy on the (parameter, coefficient) pairs

Returns an NNInterpolation ready for online use.

source
GridapROMs.RBSteady.LRApproxRankType
struct LRApproxRank <: ReductionStyle
  opts::LRAOptions
end

Struct employed when the chosen reduction algorithm is a randomized POD that leverages the package LowRankApprox. The field opts specifies the options needed to run the randomized POD

source
GridapROMs.RBSteady.MultiLayerPerceptronType
struct MultiLayerPerceptron{L,A<:AbstractVector} <: NeuralNetwork
  layers::NTuple{L,Int}
  activation::Function
  θ::A
end

A minimal dense feed-forward network whose parameters are stored as a flat vector θ for ForwardDiff compatibility. Architecture is determined by layers = (d, h₁, h₂, …, n) where d is input dim and n is output dim. Hidden layers apply activation (default: tanh); the output layer is linear.

Use NNStrategy with MLPType() (the default) to build and train one automatically via TrainedNeuralNetwork. For large networks or long training runs prefer injecting a Flux/Lux model via GenericNeuralNetwork.

source
GridapROMs.RBSteady.NNHyperReductionType
struct NNHyperReduction{A} <: AbstractNNHyperReduction{A}
  reduction::Reduction{A,EuclideanNorm}
  strategy::NNStrategy
end

A hyper-reduction strategy that uses a neural network to predict EIM coefficients from parameter values. The offline phase:

  1. applies empirical interpolation on the snapshot basis to extract coefficients
  2. trains a MultiLayerPerceptron via strategy on the (μ, coefficient) pairs

The online phase calls the NN forward pass instead of assembling the FE operator on the reduced integration domain.

source
GridapROMs.RBSteady.NNHyperReductionMethod
NNHyperReduction(args...; strategy=NNStrategy(), kwargs...) -> NNHyperReduction

Constructs a NNHyperReduction from a Reduction built with the same positional/keyword arguments accepted by Reduction. An optional strategy keyword overrides the default NNStrategy.

source
GridapROMs.RBSteady.NNInterpolationType
struct NNInterpolation{A<:NeuralNetwork} <: Interpolation

An Interpolation backed by a neural network model. During the online phase, interpolate! replaces the EIM linear solve with a NN forward pass: coeff[:, i] = model(μ_i).

Constructed automatically by Interpolation(red::NNHyperReduction, basis, s).

source
GridapROMs.RBSteady.NNOperatorReductionType
struct NNOperatorReduction <: AbstractNNHyperReduction{NoReduction}
  nparams::Int
  strategy::NNStrategy
end

A hyper-reduction strategy for operator regression: the NN directly maps parameter values to the Galerkin-projected residual vector, bypassing FE assembly entirely during the online phase. Only suitable for residual (vector-valued) operators.

The offline phase projects the residual snapshots onto the test space and trains the NN to reproduce the projected vectors. The online phase calls the NN forward pass, producing the projected residual without any assembly.

strategy controls the MultiLayerPerceptron architecture and training. nparams controls how many parameter samples to use for NN training.

source
GridapROMs.RBSteady.NNStrategyType
struct NNStrategy{A,L,O,F,S}
  type::A
  layers::NTuple{L,Int}
  optimiser::O
  loss::F
  epochs::Int
  batch_size::Int
  lr_schedule::S
  patience::Int
  val_fraction::Float64
end

Bundles all training hyperparameters for a MultiLayerPerceptron:

  • layers: widths of the hidden layers as an NTuple (e.g. (64, 64))
  • optimiser: an Optimisers.jl rule (default: Adam(1e-3)); weight decay is folded in at construction time via OptimiserChain(..., WeightDecay(λ))
  • loss: loss(ŷ, y) -> scalar; built-ins are loss_mse and loss_mae
  • epochs: maximum number of gradient steps per run
  • batch_size: mini-batch column count; 0 (default) uses all training samples (full-batch)
  • lr_schedule: nothing (default, constant lr) or a callable (epoch::Int, total_epochs::Int) -> Float64 invoked each epoch via Optimisers.adjust!
  • patience: number of consecutive epochs without validation-loss improvement before stopping early; 0 (default) disables early stopping and runs all epochs
  • val_fraction: fraction of samples held out for validation when patience > 0 (default 0.1; ignored when patience == 0)

Pass to NNHyperReduction or NNOperatorReduction via the strategy keyword.

source
GridapROMs.RBSteady.NNStrategyMethod
NNStrategy(; type=MLPType(), layers=(64,64), lr=1e-3, optimiser=Adam(lr),
           loss=loss_mse, epochs=1000, weight_decay=0.0,
           batch_size=0, lr_schedule=nothing, patience=0, val_fraction=0.1)
source
GridapROMs.RBSteady.NeuralNetworkType
abstract type NeuralNetwork <: Map end

Abstract supertype for neural network models. Any concrete subtype must implement (a::T)(x::AbstractMatrix) -> AbstractMatrix where x is a (param_dim × batch_size) matrix of parameters and the output is a (output_dim × batch_size) matrix of predictions.

Wrap external Flux/Lux models with GenericNeuralNetwork:

model = GenericNeuralNetwork(flux_chain)     # Flux
model = GenericNeuralNetwork(p -> lux_apply(chain, p, ps, st))  # Lux closure
source
GridapROMs.RBSteady.NoHyperReductionType
struct NoHyperReduction <: TrivialHyperReduction end

Reduction employed when the input data is independent with respect to the considered realisation. Therefore, simply considering a number of parameters equal to 1 suffices for this type of reduction

source
GridapROMs.RBSteady.NormedProjectionType
struct NormedProjection <: Projection
  projection::Projection
  norm_matrix::MatrixOrTensor
end

Represents a Projection projection spanning a space equipped with an inner product represented by the quantity norm_matrix

source
GridapROMs.RBSteady.PODReductionType
struct PODReduction{A,B} <: DirectReduction{A,B}
  red_style::A
  norm_style::B
  nparams::Int
end

Reduction by means of a truncated POD. The field nparams indicates the number of parameters selected for the computation of the snapshots

source
GridapROMs.RBSteady.RBDiagnosticsType
struct RBDiagnostics
  offline::Dict{String,Any}
  online::Dict{String,Any}
end

Container for ROM diagnostics, each phase stored as a Dict{String,Any}.

Every dict always contains a "tols" key mapping to a Vector{Float64} of tolerances sorted in decreasing order. All other keys map to a Vector of the same length, with one entry per tolerance.

Offline (structural) keys are derived by flattening the offline_diagnostics named tuple:

  • "state dim", "state factor" — basis size and compression factor
  • "rhs dim"Vector{Tuple}, one K-tuple per tolerance (one integer per triangulation)
  • "lhs dim" — same for the Jacobian contributions
  • For LinearNonlinearRBOperator: "lin_rhs dim", "nlin_lhs dim", etc.

Online keys:

  • "projection_error"Vector{Float64}
  • "hr_error_res"Vector{Tuple}, one K-tuple per tolerance
  • "hr_error_jac"Vector{Tuple}, one K-tuple per tolerance
source
GridapROMs.RBSteady.RBParamVectorType
struct RBParamVector{T,A<:ParamVector{T},B} <: ParamArray{T,1}
  data::A
  fe_data::B
end

Parametric vector obtained by applying a Projection on a high-dimensional parametric FE vector fe_data, which is stored (but mostly unused) for conveniency

source
GridapROMs.RBSteady.RBSolverType
struct RBSolver{A,B,C,D,E} <: GridapType
  fesolver::A
  context::B
  state_reduction::C
  residual_reduction::D
  jacobian_reduction::E
end

Wrapper around a FE solver (e.g. NonlinearSolver or ODESolver in Gridap) with additional information on the reduced basis (RB) method employed to solve a given problem dependent on a set of parameters. A RB method is a projection-based reduced order model where

  1. a suitable subspace of a FESpace is sought, of dimension n << Nₕ
  2. a matrix-based discrete empirical interpolation method (e.g. MDEIM) is performed

to approximate the manifold of the parametric residuals and jacobians

  1. the EIM approximations are compressed with (Petrov-)Galerkin projections

onto the subspace

  1. for every desired choice of parameters, numerical integration is performed, and

the resulting n × n system of equations is cheaply solved

In particular:

  • tol: tolerance used in the projection-based truncated proper orthogonal decomposition (TPOD) or in the tensor train singular value decomposition (TT-SVD), where a basis spanning the reduced subspace is computed; the value of tol is responsible for selecting the dimension of the subspace, i.e. n = n(tol)
  • nparams_state: number of snapshots considered when running TPOD or TT-SVD
  • nparams_res: number of snapshots considered when running hyper-reduction for the residual
  • nparams_jac: number of snapshots considered when running hyper-reduction for the jacobian
  • nparams_test: number of snapshots considered when computing the error the RB method commits with respect to the FE procedure
source
GridapROMs.RBSteady.ROMPerformanceType
struct ROMPerformance
  error
  speedup
end

Allows to compute errors and computational speedups to compare the properties of the algorithm with the FE performance.

source
GridapROMs.RBSteady.SearchSVDRankType
struct SearchSVDRank <: ReductionStyle
  tol::Float64
end

Struct employed when the chosen reduction algorithm is a truncated POD at a tolerance tol. Check this reference for more details on the truncated POD algorithm

source
GridapROMs.RBSteady.SparseCoreCSCType
struct SparseCoreCSC{T,Ti} <: SparseCore{T,3}
  array::Array{T,3}
  sparsity::SparsityCSC{T,Ti}
end

Tensor train cores for sparse matrices in CSC format

source
GridapROMs.RBSteady.SparseCoreCSC4DType
struct SparseCoreCSC4D{T,Ti} <: SparseCore{T,4}
  core::SparseCoreCSC{T,Ti}
  sparse_indexes::Vector{CartesianIndex{2}}
end

Tensor train cores for sparse matrices in CSC format, reshaped as 4D arrays

source
GridapROMs.RBSteady.SupremizerReductionType
struct SupremizerReduction{A,R<:Reduction{A,EnergyNorm}} <: Reduction{A,EnergyNorm}
  reduction::R
  supr_op::Function
  supr_tol::Float64
end

Wrapper for reduction methods reduction that require an additional step of stabilization, by means of a supremizer enrichment. Check this for more details in a steady setting, and this for more details in a transient setting. The fields supr_op and supr_tol (which is only needed only in transient applications) are respectively the supremizing operator and the tolerance involved in the enrichment. For a saddle point problem with a Jacobian of the form

[ A Bᵀ B 0 ]

this operator is given by the bilinear form representing the matrix Bᵀ.

source
GridapROMs.RBSteady.TTSVDProjectionType
struct TTSVDProjection <: Projection
  cores::AbstractVector{<:AbstractArray{<:Any,3}}
  dof_map::AbstractDofMap
end

Projection stemming from a tensor train SVD ttsvd. For reindexing purposes a field dof_map is provided along with the tensor train cores cores

source
GridapROMs.RBSteady.TTSVDRanksType
struct TTSVDRanks <: ReductionStyle
  style::Vector{<:ReductionStyle}
end

Struct employed when the chosen reduction algorithm is a TTSVD, with reduction algorithm at each step specified in the vector of reduction styles style. Check this reference for more details on the TTSVD algorithm

source
GridapROMs.RBSteady.TTSVDReductionType
struct TTSVDReduction{B} <: DirectReduction{TTSVDRanks,B}
  red_style::TTSVDRanks
  norm_style::B
  nparams::Int
end

Reduction by means of a TTSVD. The field nparams indicates the number of parameters selected for the computation of the snapshots

source
GridapROMs.RBSteady.VariationalAutoEncoderType
VariationalAutoEncoder{E,D} <: NeuralNetwork

VAE with reparameterisation trick. The encoder outputs [μ; log σ²] (2 × latent_dim values per sample); during training a latent sample z = μ + ε·exp(log σ²/2) with ε ~ N(0,I) is passed to the decoder.

Training loss: recon_loss + β · KL, where KL = -½ mean(1 + log σ² - μ² - σ²).

NNStrategy interpretation: layers = (h₁, …, h_{L-1}, latent_dim); the encoder hidden widths are (h₁, …, h_{L-1}) and the decoder mirrors them. β controls the KL weight (keyword to NeuralNetwork/TrainedNeuralNetwork).

Convolutional variants: use GenericNeuralNetwork wrapping a Lux/Flux CNN.

source
GridapROMs.RBSteady.contractionMethod
contraction(Φₗₖ::AbstractArray{T,3},Aₖ::AbstractArray{T,3}) -> AbstractArray{T,4}
contraction(Φₗₖ::AbstractArray{T,3},Aₖ::AbstractArray{T,3},Φᵣₖ::AbstractArray{T,3}) -> AbstractArray{T,6}

Contraction of tensor train cores, as a result of a (Petrov-)Galerkin projection. The contraction of Aₖ by Φₗₖ is the left-contraction of a TT core Aₖ by a (left, test) TT core Φₗₖ, whereas the contraction of Aₖ by Φᵣₖ is the right-contraction of a TT core Aₖ by a (right, trial) TT core Φᵣₖ. The dimension of the output of a contraction involving N factors is: 3N - N = 2N.

source
GridapROMs.RBSteady.contractionMethod
contraction(basis::AbstractArray,coefficient::AbstractArray) -> AbstractArray

Multiplies a reduced basis basis by a set of reduced coeffiecients coefficient. It acts as a generalized linear combination, since basis might have a dimension higher than 2.

source
GridapROMs.RBSteady.cores2basisMethod
cores2basis(cores::AbstractArray{T,3}...) -> AbstractMatrix

Returns a basis in a matrix format from a list of tensor train cores cores. When also supplying the indexing strategy dof_map, the result is reindexed accordingly

source
GridapROMs.RBSteady.empirical_interpolationMethod
empirical_interpolation(a::Projection) -> (AbstractVector,AbstractMatrix)

Computes the EIM of a. The outputs are:

  • a vector of integers i, corresponding to a list of interpolation row indices
  • a matrix Φi = view(Φ,i), where Φ = get_basis(a). This quantity represents the restricted basis on the set of interpolation rows i
source
GridapROMs.RBSteady.enrich!Method
enrich!(
  red::SupremizerReduction,
  a::BlockProjection,
  norm_matrix::MatrixOrTensor,
  supr_matrix::MatrixOrTensor) -> Nothing

In-place augmentation of the primal block of a BlockProjection a. This function has the purpose of stabilizing the reduced equations stemming from a saddle point problem

source
GridapROMs.RBSteady.eval_performanceMethod
eval_performance(
  solver::RBSolver,
  rbop::RBOperator,
  fesnaps::AbstractSnapshots,
  rbsnaps::AbstractSnapshots,
  festats::CostTracker,
  rbstats::CostTracker
  ) -> ROMPerformance

Arguments:

  • solver: solver for the reduced problem
  • rbop: reduced operator representing the PDE
  • fesnaps: online snapshots of the FE solution
  • rbsnaps: reduced approximation of fesnaps
  • festats: time and memory consumption needed to compute fesnaps
  • rbstats: time and memory consumption needed to compute rbsnaps

Returns the performance of the reduced algorithm, in terms of the (relative) error between rbsnaps and fesnaps, and the computational speedup between rbstats and festats

source
GridapROMs.RBSteady.galerkin_projectionMethod
galerkin_projection(Φₗ,A) -> Any
galerkin_projection(Φₗ,A,Φᵣ) -> Any

Galerkin projection of A on the subspaces specified by a (left, test) subspace Φₗ (row projection) and a (right, trial) subspace Φᵣ (column projection)

source
GridapROMs.RBSteady.galerkin_projectionMethod
galerkin_projection(a::Projection,b::Projection) -> ReducedProjection
galerkin_projection(a::Projection,b::Projection,c::Projection,args...) -> ReducedProjection

(Petrov) Galerkin projection of a projection map b onto the subspace a (row projection) and, if applicable, onto the subspace c (column projection)

source
GridapROMs.RBSteady.get_rowcols_to_cellsMethod
get_rowcols_to_cells(
  cell_row_ids::AbstractArray,
  cell_col_ids::AbstractArray,
  rows::AbstractVector,
  cols::AbstractVector) -> AbstractVector

Returns the list of cells containing the row ids rows and the col ids cols

source
GridapROMs.RBSteady.gram_schmidtFunction
gram_schmidt(A::AbstractMatrix,args...) -> AbstractMatrix
gram_schmidt(A::AbstractMatrix,X::AbstractSparseMatrix,args...) -> AbstractMatrix

Gram-Schmidt orthogonalization for a matrix A under a Euclidean norm. A (positive definite) sparse matrix X representing an inner product on the row space of A can be provided to make the result orthogonal under a different norm

source
GridapROMs.RBSteady.hr_errorMethod
hr_error(solver,op,res,jac,μ) -> (Tuple,Tuple)

Compute per-triangulation hyper-reduction errors for residuals and Jacobians.

For each triangulation in the HR contributions:

  • Residuals: the HR reconstruction Ψ·Φrb·coeff (in FE space) is compared with the full-order snapshot vector using the Euclidean norm.
  • Jacobians: the HR reconstruction Φrb·coeff (in RB space) is compared with the Galerkin projection of the FOM Jacobian onto the RB subspace using the Frobenius norm; this equals the full-space Frobenius error when the RB bases are orthonormal.

Returns (hr_error_res,hr_error_jac) where each is a Tuple with one Float64 per triangulation (mean relative error over parameters).

source
GridapROMs.RBSteady.infer_latentMethod
infer_latent(a::AutoDecoder, x_target::AbstractVector, s::NNStrategy) -> AbstractVector

Fit a latent code z for an unseen snapshot x_target by minimising s.loss(decoder(z), x_target) with the decoder weights fixed. Uses the optimiser and epoch count from s.

source
GridapROMs.RBSteady.inv_project!Method
inv_project!(x::AbstractArray,a::Projection,x̂::AbstractArray) -> Nothing

In-place recasting of a low-dimensional object the high-dimensional space in which a is immersed

source
GridapROMs.RBSteady.inv_projectMethod
inv_project(a::Projection,x::AbstractArray) -> AbstractArray

Recasts a low-dimensional object x onto the high-dimensional space in which a is immersed

source
GridapROMs.RBSteady.jacobian_snapshotsMethod
jacobian_snapshots(solver::RBSolver,op::ParamOperator,s::AbstractSnapshots) -> Contribution
jacobian_snapshots(solver::RBSolver,op::ODEParamOperator,s::AbstractSnapshots) -> Tuple{Vararg{Contribution}}

Returns a Jacobian Contribution relative to the FE operator op. The quantity s denotes the solution snapshots in which we evaluate the jacobian. In transient settings, the output is a tuple whose nth element is the Jacobian relative to the nth temporal derivative

source
GridapROMs.RBSteady.load_operatorMethod
load_operator(dir,feop::ParamOperator;kwargs...) -> RBOperator

Given a FE operator feop, load its reduced counterpart stored in the directory dir. Throws an error if the reduced operator has not been previously saved to file

source
GridapROMs.RBSteady.load_snapshotsMethod
load_snapshots(dir;label="") -> AbstractSnapshots

Load the snapshots at the directory dir. Throws an error if the snapshots have not been previously saved to file

source
GridapROMs.RBSteady.orth_complement!Method
orth_complement!(v::AbstractVector,basis::AbstractMatrix,args...) -> Nothing

In-place orthogonal complement of v on the column space of basis. When a symmetric, positive definite matrix X is provided as an argument, the output is X-orthogonal, otherwise it is ℓ²-orthogonal

source
GridapROMs.RBSteady.orth_projectionMethod
orth_projection(v::AbstractVector, basis::AbstractMatrix, args...) -> AbstractVector

Orthogonal projection of v on the column space of basis. When a symmetric, positive definite matrix X is provided as an argument, the output is X-orthogonal, otherwise it is ℓ²-orthogonal

source
GridapROMs.RBSteady.project!Method
project!(x̂::AbstractArray,a::Projection,x::AbstractArray,args...) -> Nothing

In-place projection of a high-dimensional object x onto the subspace represented by a

source
GridapROMs.RBSteady.projectMethod
project(a::Projection,x::AbstractArray,args...) -> AbstractArray

Projects a high-dimensional object x onto the subspace represented by a

source
GridapROMs.RBSteady.reduced_jacobianMethod
reduced_jacobian(
  solver::RBSolver,
  op::ParamOperator,
  red_trial::RBSpace,
  red_test::RBSpace,
  s::AbstractSnapshots
  ) -> Union{AffineContribution,TupOfAffineContribution}

Reduces the Jacobian contained in op via hyper-reduction. This function first builds the Jacobian snapshots, which are then reduced according to the strategy reduced_jacobian specified in the reduced solver solver. In transient applications, the output is a tuple of length equal to the number of Jacobians(i.e., equal to the order of the ODE plus one)

source
GridapROMs.RBSteady.reduced_operatorMethod
reduced_operator(solver::RBSolver,feop::ParamOperator,args...;kwargs...) -> RBOperator
reduced_operator(solver::RBSolver,feop::TransientParamOperator,args...;kwargs...) -> TransientRBOperator

Computes a RB operator from the FE operator feop

source
GridapROMs.RBSteady.reduced_residualMethod
reduced_residual(
  solver::RBSolver,
  op::ParamOperator,
  red_test::RBSpace,
  s::AbstractSnapshots
  ) -> AffineContribution

Reduces the residual contained in op via hyper-reduction. This function first builds the residual snapshots, which are then reduced according to the strategy residual_reduction specified in the reduced solver solver

source
GridapROMs.RBSteady.reduced_spacesMethod
reduced_spaces(solver::RBSolver,feop::ParamOperator,s::AbstractSnapshots
  ) -> (RBSpace, RBSpace)

Computes the subspace of the test, trial FESpaces contained in the FE operator feop by compressing the snapshots s

source
GridapROMs.RBSteady.reduced_weak_formMethod
reduced_weak_form(
  solver::RBSolver,
  op::ParamOperator,
  red_trial::RBSpace,
  red_test::RBSpace,
  s::AbstractSnapshots
  ) -> (AffineContribution,Union{AffineContribution,TupOfAffineContribution})

Reduces the residual/Jacobian contained in op via hyper-reduction. Check the functions reduced_residual and reduced_jacobian for more details

source
GridapROMs.RBSteady.reductionMethod
reduction(red::Reduction,A::AbstractArray,args...) -> AbstractArray
reduction(red::Reduction,A::AbstractArray,X::AbstractSparseMatrix) -> AbstractArray

Given an array (of snapshots) A, returns a reduced basis obtained by means of the reduction strategy red

source
GridapROMs.RBSteady.residual_snapshotsMethod
residual_snapshots(solver::RBSolver,op::ParamOperator,s::AbstractSnapshots) -> Contribution
residual_snapshots(solver::RBSolver,op::ODEParamOperator,s::AbstractSnapshots) -> Contribution

Returns a residual Contribution relative to the FE operator op. The quantity s denotes the solution snapshots in which we evaluate the residual

source
GridapROMs.RBSteady.rom_diagnosticsMethod
rom_diagnostics(dir,rbsolver,feop,args...;label=online_label,kwargs...)
    -> RBDiagnostics

Scans every immediate sub-directory of dir whose name parses as a Float64 tolerance, loads the corresponding RB operator, and computes both offline (structural) and online (accuracy) diagnostics using the snapshots stored in dir under label.

Returns an RBDiagnostics object whose offline and online fields are Dict{String,Any} sorted by decreasing tolerance (coarsest model first), with all scalar fields flattened into named Vector entries.

source
GridapROMs.RBSteady.s_optMethod
s_opt(a::Projection) -> (AbstractVector,AbstractMatrix)

Computes the S-OPT hyper-reduction of a. Check this reference for more information

source
GridapROMs.RBSteady.sequential_productMethod
sequential_product(a::AbstractArray,b::AbstractArray...) -> AbstractArray

This function sequentially multiplies the results of several (sequential as well) calls to contraction

source
GridapROMs.RBSteady.solution_snapshotsMethod
solution_snapshots(solver::NonlinearSolver,feop::ParamOperator,r::Realisation) -> SteadySnapshots
solution_snapshots(solver::ODESolver,feop::TransientParamOperator,r::TransientRealisation,u0) -> TransientSnapshots

The problem encoded in the FE operator feop is solved several times, and the solution snapshots are returned along with the information related to the computational cost of the FE method. In transient settings, an initial condition u0 should be provided.

source
GridapROMs.RBSteady.tpodMethod
tpod(red_style::ReductionStyle,A::AbstractMatrix) -> AbstractMatrix
tpod(red_style::ReductionStyle,A::AbstractMatrix,X::AbstractSparseMatrix) -> AbstractMatrix

Truncated proper orthogonal decomposition of A. When provided, X is a (symmetric, positive definite) norm matrix with respect to which the output is made orthogonal. If X is not provided, the output is orthogonal with respect to the euclidean norm

source
GridapROMs.RBSteady.train!Method
train!(ad::AutoDecoder, s::NNStrategy, X::AbstractMatrix) -> AutoDecoder

Jointly optimise decoder parameters and all latent codes to minimise s.loss(decoder(Z), X). After training, ad.latent_codes[:,i] is the learned latent representation of snapshot X[:,i].

source
GridapROMs.RBSteady.train!Method
train!(ae::AutoEncoder, s::NNStrategy, X::AbstractMatrix) -> AutoEncoder

Train ae on the snapshot matrix X (n_h × k) by minimising the reconstruction loss s.loss(decoder(encoder(X)), X). Encoder and decoder parameters are optimised jointly via ForwardDiff. Supports mini-batching, LR scheduling, and early stopping from s.

source
GridapROMs.RBSteady.train!Method
train!(a::MultiLayerPerceptron, s::NNStrategy, x::AbstractMatrix, y::AbstractMatrix) -> MultiLayerPerceptron

Trains a using the hyperparameters in s with ForwardDiff for gradients. x is (param_dim × n_samples), y is (output_dim × n_samples). Updates a.θ in-place and returns a.

  • Mini-batching: when s.batch_size > 0 samples are shuffled and looped each epoch; the last incomplete batch is dropped.
  • LR scheduling: when s.lr_schedule is not nothing, it is called as lr_schedule(epoch, total_epochs) and applied via Optimisers.adjust!.
  • Early stopping: when s.patience > 0, a s.val_fraction fraction of samples is held out; training stops when the validation loss fails to improve for patience consecutive epochs.
source
GridapROMs.RBSteady.ttsvdMethod
ttsvd(red_style::TTSVDRanks,A::AbstractArray) -> AbstractVector{<:AbstractArray}
ttsvd(red_style::TTSVDRanks,A::AbstractArray,X::AbstractRankTensor) -> AbstractVector{<:AbstractArray}

Tensor train SVD of A. When provided, X is a norm tensor (representing a symmetric, positive definite matrix) with respect to which the output is made orthogonal. Note: if ndims(A) = N, the length of the ouptput is N-1, since we are not interested in reducing the axis of the parameters. Check this reference for more details

source
GridapROMs.RBSteady.union_basesMethod
union_bases(a::Projection,b::Projection,args...) -> Projection

Computes the projection corresponding to the union of a and b. In essence this operation performs as

gram_schmidt(union(get_basis(a),get_basis(b)))

source