rom.deim.linear_form_hyperrom_deim
Purpose: Implements DEIM-based hyperreduction for finite element linear forms, enabling fast load vector assembly for reduced-order models by restricting element integration to a small, strategically selected subset and reconstructing the full reduced load vector via DEIM interpolation. Delivers dramatic assembly speedups while preserving accuracy for parameter-dependent forcing terms.
Summary: Provides the LinearFormHYPERROM_deim class, which combines DEIM element sampling with sparse vector assembly and reduced-basis projection. Assembly complexity is reduced from ((N_{})) to ((N_{})) where (N_{} N_{}), making it particularly effective for real-time ROM applications with spatially localized or low-rank load distributions.
Author: Suparno Bhattacharyya
Classes
| Name | Description |
|---|---|
| LinearFormHYPERROM_deim | DEIM-based hyperreduced linear form for efficient ROM load vector assembly. |
LinearFormHYPERROM_deim
rom.deim.linear_form_hyperrom_deim.LinearFormHYPERROM_deim(
form,
elem_weight,
ubasis,
lob,
sampled_rows,
deim_mat,
free_dofs=None,
mean=None,
nthreads=0,
dtype=np.float64,
)Summary: Implements a hyperreduction strategy that combines DEIM element sampling with sparse vector assembly to achieve substantial computational savings in linear form evaluation. The assembly pipeline proceeds through four stages:
- Element Selection: Uses DEIM-selected DOFs to identify the finite elements that must be assembled for load vector construction, dramatically reducing the active element count relative to the full mesh.
- Sparse Assembly: Integrates only the selected elements using efficient scatter-add operations, avoiding computation over the entire domain.
- DEIM Reconstruction: Applies the DEIM interpolation matrix to values sampled at the selected DOF rows to reconstruct the full reduced-order load vector.
- Basis Projection: Projects the reconstructed load vector onto the left reduced test basis to produce the final ROM-ready vector.
This approach is most effective when load distributions are spatially localized or exhibit low-rank parametric variation, and is essential for real-time ROM applications where parameter-dependent forcing terms must be re-evaluated at every online query.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| form | callable | Full-order linear form function to be hyperreduced; should accept test basis functions and return element-wise load contributions. | required |
| elem_weight | array_like, shape (n_elements,) | Element selection vector derived from DEIM DOF analysis; entries are 1 for selected elements and 0 for elements to skip. |
required |
| ubasis | Basis | Test basis for the full-order FE space, containing mesh connectivity and quadrature information. | required |
| lob | ndarray, shape (n_free, r) | Left (test) reduced basis matrix projecting full-order load vectors onto the (r)-dimensional reduced test space. | required |
| sampled_rows | array_like of int, shape (n_samp,) | Global DOF indices selected by DEIM for interpolation; only these rows are retained from the sparse assembled vector. | required |
| deim_mat | ndarray, shape (r, n_samp) | DEIM interpolation matrix reconstructing the reduced-order load vector from sampled values: ( {} = D {}[] ). | required |
| free_dofs | ndarray of int or None | Indices of unconstrained DOFs for boundary condition handling in the full-order system. | None |
| mean | ndarray or None | Mean load vector for centering; required if load data was mean-subtracted during DEIM basis construction. | None |
| nthreads | int | Number of threads for parallel element vector extraction; 0 uses serial execution. |
0 |
| dtype | numpy.dtype | Numeric precision for all computations and storage. | np.float64 |
Attributes
| Name | Type | Description |
|---|---|---|
| r_basis | ndarray, shape (n_free, r) | Copy of the left (test) reduced basis matrix used for load vector projection. |
| weight | ndarray, shape (n_elements,) | Copy of the element selection weight vector identifying active elements. |
| nonzero_elements | ndarray of int | Indices of elements with nonzero weights selected for assembly. |
| ubasis | Basis | Reference to the original full-order finite element basis. |
| ubasis_rom | Basis | FE basis restricted to the hyperreduced mesh containing only selected elements. |
| 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 projection matrix for load vector reconstruction. |
| edofs | ndarray, shape (n_active_elements, n_local_dofs) | Element-to-DOF connectivity mapping for the reduced mesh. |
| n_dofs | int | Total number of global DOFs in the restricted mesh. |
| rows | ndarray, shape (n_active_elements × n_local_dofs,) | Flattened element-DOF indices used in scatter-add vector assembly operations. |
Methods
| Name | Description |
|---|---|
| assemble_deim | Assemble the hyperreduced load vector using DEIM reconstruction. |
| deim_elem_assembly | Assemble the sparse global load vector over the hyperreduced element set. |
| extract_element_vector_rom | Extract local element load vectors for the hyperreduced mesh. |
assemble_deim
rom.deim.linear_form_hyperrom_deim.LinearFormHYPERROM_deim.assemble_deim(**kwargs)Summary: Orchestrates the complete hyperreduction assembly pipeline to produce the final reduced-order load vector. Executes the following steps in sequence:
- Parameter Setup: Merges default finite element parameters with user-provided keyword arguments for element-level load evaluation.
- Sparse Assembly: Calls
deim_elem_assembly()to build the sparse full-order load vector using only the selected elements. - DEIM Sampling: Extracts values at DEIM-selected DOF rows from the sparse vector, providing the minimal information needed for accurate reconstruction.
- Vector Reconstruction: Applies the DEIM interpolation matrix to the sampled values to produce the reduced-order load vector:
[ {} = D {}[] ]
where ( D ) is deim_mat and ( _{} ) is assembled over selected elements only.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| **kwargs | dict | Keyword arguments forwarded to deim_elem_assembly for element-level assembly control, such as material parameters or time-dependent loading conditions. |
{} |
Returns
| Name | Type | Description |
|---|---|---|
| F_reduced | ndarray, shape (r,) | Reduced-order load vector ready for use in the ROM linear system; the hyperreduced approximation of the full-order load projected onto the reduced test basis. |
deim_elem_assembly
rom.deim.linear_form_hyperrom_deim.LinearFormHYPERROM_deim.deim_elem_assembly(**kwargs)Summary: Performs the element-level sparse assembly phase of the hyperreduction pipeline, accumulating local load vector contributions from only the DEIM-selected elements into a global sparse vector. Proceeds through three steps:
- Element Vector Extraction: Calls
extract_element_vector_rom()to compute local load contributions for selected elements, avoiding integration over the full domain. - Data Preparation: Flattens the local element load vectors into a 1D array aligned with the connectivity pattern for efficient global assembly.
- Scatter-Add Assembly: Uses NumPy’s
add.atto accumulate element contributions at their global DOF locations, correctly handling overlapping nodal contributions.
The resulting vector is equivalent to what would be obtained from a full-domain assembly if only the active elements were present, preserving the mathematical structure of the full-order load vector.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| **kwargs | dict | Additional keyword arguments forwarded to extract_element_vector_rom for controlling element-level assembly behavior, such as load magnitude parameters or spatial distribution functions. |
{} |
Returns
| Name | Type | Description |
|---|---|---|
| f | ndarray, shape (n_dofs,) | Sparse global load vector assembled over the hyperreduced element set; only selected elements contribute, making it substantially cheaper to construct than the full-order equivalent. |
extract_element_vector_rom
rom.deim.linear_form_hyperrom_deim.LinearFormHYPERROM_deim.extract_element_vector_rom(
basis,
elem_indices=None,
**kwargs,
)Summary: Evaluates the linear form element by element over the hyperreduced element set and returns the resulting local load vectors. Integration is performed only over elements identified by elem_indices (defaulting to all active elements), using the quadrature rules embedded in the provided basis. For each selected element ( e ), the local load vector entry is:
[ F_e[i] = _{_e} _i() f() , d ]
where ( _i ) are local test basis functions and ( f ) is the linear form integrand. Supports both serial (nthreads=0) and multi-threaded parallel (nthreads>0) execution modes.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| basis | Basis | FE basis for test functions containing mesh connectivity, quadrature points, and basis function evaluations. | required |
| elem_indices | array_like of int or None | Specific element indices to process; defaults to all elements in the hyperreduced mesh if not provided. | None |
| **kwargs | dict | Additional keyword arguments forwarded to the linear form evaluation, such as load magnitudes, time-dependent coefficients, or other problem-specific data. | {} |
Returns
| Name | Type | Description |
|---|---|---|
| element_vectors | ndarray, shape (n_elements, n_local_dofs) | Stack of local element load vectors; element_vectors[e] contains the n_local_dofs-length load vector for element ( e ). |
Raises
| Type | Condition |
|---|---|
| ValueError | Raised if no valid basis is provided for load vector extraction. |