hydrogym
hydrogym copied to clipboard
Linear algebra module
When working with projection-based modeling and modal analysis, it would be nice to have some expanded linear algebra functionality. This would ideally look something like a combination of the VectorSpaceHandles
in Modred and the LinearOperator
in Scipy. So you would probably have three fundamental objects:
- A
Vector
-type class (possibly the same as the implementation of the ModredVectorHandle
, currently calledSnapshot
, or maybe with aFunction
as the underlying object...). Should support basic vector algebra operations - An
Operator
class which is composable, ideally just inheriting from the Scipy version, but without assuming that the underlying vectors are actually numpy arrays. - A
Basis
orSubspace
, which is a collection ofVectors
(and optionally adjoints) that supports creation of projection and orthogonal projectionOperators
With these, you could do things like:
- Apply an
Operator
to aVector
and get a newVector
(e.g. timestepping as a sequence of linear solves) - Project an
Operator
onto aSubspace
to get a reduced-order approximation - Compose an
Operator
with projection onto the complement of aSubspace
, for instance to do balanced POD in the stable subspace of a linearized Navier-Stokes operator
Other ideas and thoughts:
- How would you handle parallel I/O from different sources? See #31 for more discussion
- Replace explicit dependence on
flow
in modal analysis with a set of callbacks for the snapshots - Hide all references to
Snapshot
and only usemr.VectorHandle
, then hide all references to this to avoid confusion with the newVector
objects