Skip to content

Commit 14aeaca

Browse files
authored
Merge pull request #104 from Pressio/92_trial_space
updated trial space documentation
2 parents 176af0f + 2bb3790 commit 14aeaca

File tree

1 file changed

+24
-7
lines changed

1 file changed

+24
-7
lines changed

romtools/trial_space.py

+24-7
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,42 @@
4444
#
4545

4646
'''
47-
#Trial space overview
47+
___
48+
##**Notes**
49+
50+
Like the snapshot data, the basis and the affine offset for a trial space are viewed as tensors,
51+
$$\\mathcal{\Phi} \\in \mathbb{R}^{ N_{\\mathrm{vars}} \\times N_{\\mathrm{x}} \\times K},$$
52+
$$\\mathcal{u}_{\\mathrm{shift}} \\in \mathbb{R}^{ N_{\\mathrm{vars}} \\times N_{\\mathrm{x}}}.$$
53+
Here, $N_{\\mathrm{vars}}$ is the number of PDE variables (e.g., 5 for the compressible Navier-Stokes
54+
equations in 3D), $N_{\\mathrm{x}}$ is the number of spatial DOFs, and $K$ is the number of basis
55+
vectors. We emphasize that all tensors are reshaped into 2D matrices,
56+
e.g., when performing SVD.
57+
___
58+
##**Theory**
59+
4860
4961
A trial space is foundational to reduced-order models.
5062
In a ROM, we restrict a high-dimensional state to live within a low-dimensional trial space.
51-
Mathematically, for a "FOM" vector $\\mathbf{u} \\in \\mathbb{R}^N$, we represent this as
52-
$$\\mathbf{u} \\approx \\tilde{\\mathbf{u}} \\in \\mathcal{V}$$
63+
Mathematically, for a "FOM" vector $\\mathbf{u} \\in \\mathbb{R}^{N_{\\mathrm{vars}} N_{\\mathrm{x}}}$, we represent this as
64+
$$\\mathbf{u} \\approx \\tilde{\\mathbf{u}} \\in \\mathcal{V} + \\mathbf{u}_{\\mathrm{shift}}$$
5365
where $\\mathcal{V}$ with
54-
$\\text{dim}(\\mathcal{V}) = K \\le N$
66+
$\\text{dim}(\\mathcal{V}) = K \\le N_{\\mathrm{vars}} N_{\\mathrm{x}}$
5567
is the trial space. Formally, we can describe this low-dimensional representation with a basis and an affine offset,
5668
$$\\tilde{\\mathbf{u}} = \\boldsymbol \\Phi \\hat{\\mathbf{u}} + \\mathbf{u}_{\\mathrm{shift}}$$
57-
where $\\boldsymbol \\Phi \\in \\mathbb{R}^{N \\times K}$ is the basis matrix,
69+
where $\\boldsymbol \\Phi \\in \\mathbb{R}^{ N_{\\mathrm{vars}} N_{\\mathrm{x}} \\times K}$ is the basis matrix,
5870
$\\hat{\\mathbf{u}} \\in \\mathbb{R}^{K}$ are the reduced, or generalized coordinates,
59-
$\\mathbf{u}_{\\mathrm{shift}} \\in \\mathbb{R}^N$ is the shift vector (or affine offset), and, by definition,
60-
$\\mathcal{V} \\equiv \\mathrm{range}(\\boldsymbol \\Phi) + \\mathbf{u}_{\\mathrm{shift}}$.
71+
$\\mathbf{u}_{\\mathrm{shift}} \\in \\mathbb{R}^{ N_{\\mathrm{vars}} N_{\\mathrm{x}}}$ is the shift vector (or affine offset), and, by definition,
72+
$\\mathcal{V} \\equiv \\mathrm{range}(\\boldsymbol \\Phi)$.
6173
6274
The trial_space class encapsulates the information of an affine trial space, $\\mathcal{V}$,
6375
by virtue of providing access to a basis matrix, a shift vector, and the dimensionality of the trial space.
76+
Note that, like the snapshot data, we view the basis as a tensor.
77+
78+
___
79+
##**API**
6480
'''
6581

82+
6683
import abc
6784
import numpy as np
6885
from romtools.trial_space_utils.truncater import Truncater, NoOpTruncater

0 commit comments

Comments
 (0)