rom.deim.bilinear_form_hyperrom_deim
Purpose: Implements DEIM-based hyperreduction for finite element bilinear forms—enabling reduced-order matrix assembly that is 100–1000× faster than classical projection approaches. By assembling only a small, carefully selected subset of elements and using DEIM interpolation to reconstruct the full reduced operator, this module enables real-time and large-scale nonlinear parametric ROM simulations with dramatic savings in both computation time and memory.
Summary: Provides the BilinearFormHYPERROM_deim class, which combines element selection (driven by DEIM sampling points) with sparse assembly and reduced-basis projection. Assembly cost scales with the number of selected elements rather than the total mesh size—making this approach particularly effective when the operator is approximately low-rank with respect to parameters, or when most of the mesh contributes negligibly to the parametric variation.
Author: Suparno Bhattacharyya
Classes
| Name | Description |
|---|---|
| BilinearFormHYPERROM_deim | DEIM-based hyperreduced bilinear form assembly for fast ROM operator construction. |
BilinearFormHYPERROM_deim
rom.deim.bilinear_form_hyperrom_deim.BilinearFormHYPERROM_deim(
form,
elem_weight,
ubasis,
lob,
rob,
sampled_rows,
deim_mat,
vbasis=None,
free_dofs=None,
mean=None,
nthreads=0,
dtype=np.float64,
)Summary: Constructs a hyperreduced bilinear form operator by restricting element assembly to only the elements connected to DEIM-selected degrees of freedom. The reduced operator is reconstructed from these sparse samples using the DEIM interpolation matrix and projected onto the reduced basis—producing the final ( r r ) system matrix at a fraction of the cost of full assembly.
The assembly process follows four key stages:
- Element Selection: Only elements linked to DEIM-identified critical DOFs are assembled, reducing the active set from potentially thousands of elements to just a few dozen.
- Sparse Assembly: Local element matrices for the active subset are assembled into a sparse global matrix using COO-to-CSR conversion, minimizing memory usage.
- DEIM Reconstruction: The DEIM interpolation matrix is applied to the sampled rows of the sparse global matrix to reconstruct the full reduced operator.
- Basis Projection: The reconstructed operator is projected onto the right reduced basis to yield the final ROM system matrix.
This approach is most advantageous when operators are approximately low-rank in the parameter space, or when real-time ROM evaluation is required for large-scale nonlinear problems.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| form | callable | Full-order bilinear form function; must accept basis objects and return element-wise matrices. | required |
| elem_weight | array_like, shape (n_elements,) | Element selection vector from DEIM; entries are 1 for selected elements and 0 for skipped ones. |
required |
| ubasis | Basis | Full FE basis for trial functions, containing mesh, quadrature, and connectivity information. | required |
| lob | ndarray, shape (n_free, r) | Left (test) reduced basis; included for interface compatibility. | required |
| rob | ndarray, shape (n_free, r) | Right (trial) reduced basis used for projecting the reconstructed operator. | required |
| sampled_rows | array_like of int, shape (n_samp,) | Global DOF indices selected by DEIM as the most informative interpolation points. | required |
| deim_mat | ndarray, shape (r, n_samp) | DEIM interpolation matrix used to reconstruct the full reduced operator from sampled values. | required |
| vbasis | Basis or None | FE basis for test functions; defaults to ubasis if not provided. |
None |
| free_dofs | ndarray of int or None | Indices of non-Dirichlet (free) DOFs for boundary condition handling. | None |
| mean | ndarray or None | Mean snapshot field subtracted prior to POD/SVD basis construction. | None |
| nthreads | int | Number of threads for parallel element assembly; 0 uses single-core execution. |
0 |
| dtype | numpy.dtype | Numeric precision for assembly operations. | np.float64 |
Attributes
| Name | Type | Description |
|---|---|---|
| weight | ndarray, shape (n_elements,) | Copy of the element selection weight vector identifying active elements. |
| nonzero_elements | ndarray of int | Indices of elements that are active (selected for assembly by DEIM). |
| ubasis_rom | Basis | FE basis restricted to only the active elements of the hyperreduced mesh. |
| sampled_rows | ndarray of int, shape (n_samp,) | Global DOF indices at which DEIM interpolation is performed. |
| n_samp | int | Number of DEIM sampling points (length of sampled_rows). |
| deim_mat | ndarray, shape (r, n_samp) | DEIM interpolation matrix for operator reconstruction. |
| edofs | ndarray, shape (n_active_elements, n_local_dofs) | Local-to-global DOF connectivity table for the active element subset. |
| n_elems | int | Number of active elements in the hyperreduced mesh. |
| n_loc | int | Number of local DOFs per element. |
| n_dofs | int | Total number of global DOFs in the restricted mesh. |
| rows, cols | ndarray | Row and column index arrays for local-to-global sparse matrix assembly. |
| row_flat, col_flat | ndarray | Flattened index arrays for fast COO sparse matrix construction. |
Methods
| Name | Description |
|---|---|
| assemble_deim | Construct the DEIM hyperreduced bilinear form matrix ready for ROM solve. |
| deim_elem_assembly | Assemble a sparse global matrix restricted to the DEIM-selected elements. |
| extract_element_matrices_rom | Compute local stiffness matrices for the active (DEIM-selected) elements only. |
assemble_deim
rom.deim.bilinear_form_hyperrom_deim.BilinearFormHYPERROM_deim.assemble_deim(**kwargs)Summary: Orchestrates the full DEIM hyperreduction pipeline to produce the final reduced-order operator matrix. Executes the following four steps in sequence:
- Calls
deim_elem_assemblyto build a sparse global matrix from only the active elements. - Extracts the rows corresponding to DEIM sampling points (
sampled_rows) from the sparse matrix. - Applies the DEIM interpolation matrix to reconstruct the full reduced operator from the sampled values.
- Projects the result onto the right reduced basis
robto obtain the ROM-ready matrix.
The assembled operator follows:
[ A_{} = D A_{}[,, :] V ]
where ( D ) is the DEIM matrix, ( A_{} ) is the sparse global matrix from selected elements, and ( V ) is the right reduced basis rob.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| **kwargs | dict | Additional keyword arguments forwarded to element assembly. | {} |
Returns
| Name | Type | Description |
|---|---|---|
| A_reduced | ndarray, shape (r, r) | Hyperreduced bilinear form matrix assembled via DEIM, ready for ROM linear solve. |
deim_elem_assembly
rom.deim.bilinear_form_hyperrom_deim.BilinearFormHYPERROM_deim.deim_elem_assembly(**kwargs)Summary: Assembles a sparse global stiffness matrix by accumulating contributions from only the DEIM-selected elements. Local element matrices are obtained via extract_element_matrices_rom and inserted into a global COO sparse matrix, which is then converted to CSR format for efficient downstream row extraction. Zero entries are optionally skipped to further reduce memory usage. The resulting matrix is equivalent to what would be obtained from a full assembly if only the active elements were present in the mesh.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| **kwargs | dict | Additional keyword arguments forwarded to element matrix extraction. | {} |
Returns
| Name | Type | Description |
|---|---|---|
| K | scipy.sparse.csr_matrix, shape (n_dofs, n_dofs) | Sparse global stiffness matrix assembled over the DEIM-selected element subset. |
extract_element_matrices_rom
rom.deim.bilinear_form_hyperrom_deim.BilinearFormHYPERROM_deim.extract_element_matrices_rom(
ubasis,
vbasis=None,
elem_indices=None,
**kwargs,
)Summary: Evaluates the bilinear form element by element and returns the local stiffness matrices for the active (DEIM-selected) elements only. Supports both serial and parallel execution. For each selected element ( e ), the local matrix entry is:
[ K_e[i,j] = _{_e} _i (_j) , d ]
where ( _i ) and ( _j ) are local basis functions and ( ) denotes the bilinear operator. Only the elements identified by elem_indices (defaulting to all active elements) are integrated, significantly reducing quadrature cost relative to full-mesh evaluation.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| ubasis | Basis | Trial FE basis with correct mesh, quadrature rule, and element connectivity. | required |
| vbasis | Basis or None | Test FE basis; defaults to ubasis if not provided. |
None |
| elem_indices | array of int or None | Indices of elements to integrate; defaults to all active (DEIM-selected) elements. | None |
| **kwargs | dict | Additional keyword arguments forwarded to the form evaluation. | {} |
Returns
| Name | Type | Description |
|---|---|---|
| element_matrices | ndarray, shape (n_elements, n_local_dofs, n_local_dofs) | Stack of local stiffness matrices for each selected element. |
Raises
| Type | Condition |
|---|---|
| ValueError | Raised if trial and test bases are incompatible due to a quadrature rule mismatch. |
Notes
BilinearFormHYPERROM_deim is the recommended class for DEIM-accelerated ROM operator assembly when the bilinear form varies with parameters. It reduces assembly cost from ((N_{})) to ((N_{})), where ( N_{} N_{} ) in typical applications. It is most effective for parametric nonlinear problems where the operator cannot be precomputed offline in its entirety.