romtools.hyper_reduction.ecsw#
Implementation of Energy-conserving sampling and weighting (ECSW) hyper-reduction
Energy-conserving sampling and weighting (ECSW) is a hyper-reduction approach originally developed specifically for solid mechanics problems, but it has since been generalized. It is a project-then-approximate hyper-reduction approach, similar in spirit and implementation to empirical cubature approaches. The name comes from the energy conservation properties the method has for solid mechanics applications; note that this property is not provable for general systems.
Given a set of residual snapshots ECSW computes sampling indices \(GID_i\) and weights \(\xi_i\). Specifically, the residual snapshots must be computed for reconstructed full-order model snapshots,
where \(\boldsymbol r_i\) is the residual \(i`th residual snapshot, :math:\)mathbf{u}_i` is the \(i`th state snapshot, and :math:\)boldsymbol Phi` is the trial basis.
The goal of ECSW is to find a sparse set of weights to approximate the reduced residual with a subset of local test-basis/residual products
For more details, consult Chapman et al. 2016 DOI: 10.1002/nme.5332.
The ECSW class contains the methods needed to compute sampling indices and weights given a set of residual snapshot and trial basis data.
Functions
|
ECSW implementation for a fixed test basis, such as POD-Galerkin projection |
|
ECSW implementation for Least-Squares Petrov-Galerkin projection of a discrete system with near-zero residual snapshots Uses the test basis as a snapshot instead, as proposed in section 3.2 of https://www.sciencedirect.com/science/article/pii/S0045782522004558. |
|
ECSW implementation for a varying test basis, such as Least-Squares Petrov-Galerkin projection |
Classes
|
Abstract base class for ECSW solvers |
|
Given a linear system with left-hand side full_mesh_lhs and right-hand side full_mesh_rhs, compute sample mesh indices and weights for ECSW using the non-negative least squares algorithm from Chapman et al. 2016 DOI: 10.1002/nme.5332. |
- class romtools.hyper_reduction.ecsw.ECSWsolver(solver_param_dict=None)[source]#
Bases:
ABCAbstract base class for ECSW solvers
ECSW solvers should take in a linear system constructed from projected residual vector snapshots and the contributions at each mesh degree of freedom to the projected snapshot. The solvers should return arrays with sample mesh indices and weights.
Methods:
- Parameters:
solver_param_dict (dict)
- class romtools.hyper_reduction.ecsw.ECSWsolverNNLS(solver_param_dict=None)[source]#
Bases:
ECSWsolverGiven a linear system with left-hand side full_mesh_lhs and right-hand side full_mesh_rhs, compute sample mesh indices and weights for ECSW using the non-negative least squares algorithm from Chapman et al. 2016 DOI: 10.1002/nme.5332.
- Parameters:
solver_param_dict (dict)
- romtools.hyper_reduction.ecsw.ecsw_fixed_test_basis(ecsw_solver, residual_snapshots, test_basis, n_var, tolerance)[source]#
ECSW implementation for a fixed test basis, such as POD-Galerkin projection
- Parameters:
ecsw_solver (ECSWsolver) – ECSWsolver object corresponding to a child class with concrete implementations such as ECSWsolverNNLS.
residual_snapshots (ndarray) – (n_var, n_dof, n_snap) numpy ndarray, where n_dof is the number of mesh degrees of freedom (DoFs) (nodes, volumes, or elements), n_var is the number of residual variables, and n_snap is the number of snapshots
test_basis (ndarray) – (n_var, n_dof, n_mode) numpy ndarray, where n_mode is the number of modes in the basis.
n_var (int) – int, the number of residual variables (e.g. for fluid flow, residual variable could be mass, x-momentum, y-momentum, z-momentum, and energy)
tolerance (float64) – Double, the ECSW tolerance parameter. Lower values of tolerance will result in more mesh DoF samples
- Returns:
Tuple of numpy ndarrays. First array: (n_dof_sample_mesh,) numpy ndarray of ints, the mesh indices in the sample mesh. Second array: (n_dof_sample_mesh,) numpy ndarray of doubles, the corresponding sample mesh weights.
- romtools.hyper_reduction.ecsw.ecsw_lspg_zero_residual(ecsw_solver, test_basis, n_var, tolerance)[source]#
ECSW implementation for Least-Squares Petrov-Galerkin projection of a discrete system with near-zero residual snapshots Uses the test basis as a snapshot instead, as proposed in section 3.2 of https://www.sciencedirect.com/science/article/pii/S0045782522004558.
- Parameters:
ecsw_solver (ECSWsolver) – ECSWsolver object corresponding to a child class with concrete implementations such as ECSWsolverNNLS.
test_basis (ndarray) – (n_snap, n_var, n_dof, n_mode) numpy ndarray, where n_snap is the number of test basis snapshots and n_mode is the number of modes in the basis.
n_var (int) – int, the number of residual variables (e.g. for fluid flow, residual variable could be mass, x-momentum, y-momentum, z-momentum, and energy)
tolerance (float64) – Double, the ECSW tolerance parameter. Lower values of tolerance will result in more mesh DoF samples
- Returns:
Tuple of numpy ndarrays. First array: (n_dof_sample_mesh,) numpy ndarray of ints, the mesh indices in the sample mesh. Second array: (n_dof_sample_mesh,) numpy ndarray of doubles, the corresponding sample mesh weights.
- romtools.hyper_reduction.ecsw.ecsw_varying_test_basis(ecsw_solver, residual_snapshots, test_basis, n_var, tolerance)[source]#
ECSW implementation for a varying test basis, such as Least-Squares Petrov-Galerkin projection
- Parameters:
ecsw_solver (ECSWsolver) – ECSWsolver object corresponding to a child class with concrete implementations such as ECSWsolverNNLS.
residual_snapshots (ndarray) – (n_var, n_dof, n_snap) numpy ndarray, where n_dof is the number of mesh degrees of freedom (DoFs) (nodes, volumes, or elements), n_var is the number of residual variables, and n_snap is the number of snapshots
test_basis (ndarray) – (n_snap, n_var, n_dof, n_mode) numpy ndarray, where n_snap is the number of test basis snapshots and n_mode is the number of modes in the basis.
n_var (int) – int, the number of residual variables (e.g. for fluid flow, residual variable could be mass, x-momentum, y-momentum, z-momentum, and energy)
tolerance (float64) – Double, the ECSW tolerance parameter. Lower values of tolerance will result in more mesh DoF samples
- Returns:
Tuple of numpy ndarrays. First array: (n_dof_sample_mesh,) numpy ndarray of ints, the mesh indices in the sample mesh. Second array: (n_dof_sample_mesh,) numpy ndarray of doubles, the corresponding sample mesh weights.