rom.bilinear_form_rom

Purpose: Transforms full-order element stiffness matrices into their reduced-order counterparts by handling all index mapping, Dirichlet boundary classification, and memory-efficient assembly. Designed to produce accurate reduced stiffness matrices for large-scale ROM problems without excessive memory overhead.

Summary: Provides the BilinearFormROM class for projecting and assembling reduced bilinear forms. Elements are grouped by their Dirichlet boundary interactions to streamline assembly, and chunked processing is available for problems where memory is a constraint. The broader rom package also includes:

  • Classes for reduced assembly and projection of both bilinear and linear forms
  • Dirichlet boundary condition handling utilities tailored for ROM workflows
  • Chunked and group-wise matrix assembly strategies for large-scale problems
  • Index and DOF mapping tools between full-order and reduced-order representations

Author: Suparno Bhattacharyya


Classes

Name Description
BilinearFormROM Assembles reduced-order bilinear forms (ROM stiffness matrices) via element-wise projection.

BilinearFormROM

rom.bilinear_form_rom.BilinearFormROM(
    form,
    ubasis,
    lob,
    rob,
    vbasis=None,
    free_dofs=None,
    mean=None,
    nthreads=0,
    dtype=np.float64,
)

Summary: Projects element-wise full-order stiffness matrices onto user-supplied reduced bases and accumulates them into a global reduced stiffness matrix. Handles the complete mapping from full DOFs to free (non-Dirichlet) DOFs, classifies elements into all-free and mixed-boundary groups for efficient processing, and supports chunked assembly to manage memory usage on large meshes.


Attributes

Name Type Description
lob ndarray, shape (N_free, r) or (N, r) Left (test) reduced basis vectors.
rob ndarray, shape (N_free, r) or (N, r) Right (trial) reduced basis vectors.
free_dofs ndarray or None Indices of free (non-Dirichlet) DOFs in the global system.
mean ndarray or None Mean field subtracted from snapshots prior to SVD-based basis construction.
nthreads int Number of threads used for parallel assembly operations.
dtype data-type Numeric precision for assembly (e.g., np.float64).
ubasis Basis Full finite element basis for trial functions.
vbasis Basis Full finite element basis for test functions.
mapping ndarray, shape (N_full,) Maps each global DOF to its reduced index; entries are -1 for Dirichlet-constrained DOFs.
element_dofs ndarray Local-to-global DOF mapping for each element in the mesh.
free_indices ndarray Reduced DOF index each element node maps to, after Dirichlet filtering.
mask ndarray of bool Boolean mask identifying free DOFs within each element’s local DOF set.
r int Number of reduced basis vectors retained.
groupA ndarray Element indices for elements whose DOFs are entirely free (fast assembly path).
groupB ndarray Element indices for elements with at least one Dirichlet-constrained DOF (mixed case).
chunk_size int Number of elements processed per chunk during groupA assembly.
n_full_chunks int Number of complete chunks in the groupA assembly pass.
remainder int Number of leftover elements in the final (incomplete) chunk.

Methods

Name Description
assemble Project all element stiffness matrices onto the reduced basis and accumulate into the global reduced stiffness matrix.
extract_element_matrices Extract per-element full-order stiffness matrices, ready for projection onto the reduced basis.

assemble

rom.bilinear_form_rom.BilinearFormROM.assemble(vbasis=None, **kwargs)

Summary: Iterates over all mesh elements, projects each local full-order stiffness matrix onto the left and right reduced bases, and accumulates contributions into the global reduced stiffness matrix ( K_r ^{r r} ). Only free (non-Dirichlet) DOFs participate in the projection. GroupA elements (all-free DOFs) are processed in chunks for memory efficiency; GroupB elements (mixed boundary) are handled separately.

Parameters
Name Type Description Default
vbasis Basis or None FE basis for test functions; falls back to ubasis if not provided. None
**kwargs dict Additional keyword arguments forwarded to the underlying form assembly. {}
Returns
Name Type Description
K_reduced ndarray, shape (r, r) Assembled global reduced stiffness matrix.

extract_element_matrices

rom.bilinear_form_rom.BilinearFormROM.extract_element_matrices(
    ubasis,
    vbasis=None,
    **kwargs,
)

Summary: Evaluates the full-order bilinear form element by element and returns the resulting local stiffness matrices as a single array. This is the preparatory step before projection—each element matrix will subsequently be projected onto the reduced basis during assembly.

Parameters
Name Type Description Default
form BilinearForm Full-order bilinear form to evaluate element-wise. required
ubasis Basis FE basis for trial functions. required
vbasis Basis or None FE basis for test functions; defaults to ubasis if not provided. None
**kwargs dict Additional arguments forwarded to the form assembly routine. {}
Returns
Name Type Description
element_matrices ndarray, shape (n_elements, Nbfun, Nbfun) Stack of local stiffness matrices, one per element. Nbfun denotes the number of local basis functions per element.

Notes

BilinearFormROM is the recommended entry point for constructing reduced stiffness matrices in projection-based ROM workflows. It handles all index mapping between full and free DOFs, classifies elements for optimized assembly paths, and avoids memory spikes through chunked processing—making it suitable for large-scale FEM problems with non-trivial Dirichlet boundary conditions.