|
44 | 44 | #
|
45 | 45 |
|
46 | 46 | '''
|
47 |
| -The scaler class is used to performed scaled POD. |
| 47 | +--- |
| 48 | +##**Notes** |
| 49 | +The scaler class is used to performed scaled POD. Scaling is applied to tensors of shape $\mathbb{R}^{ N_{\\mathrm{vars}} \\times N_{\\mathrm{x}} \\times N_s}$. These tensors are then reshaped into matrices when performing SVD. |
| 50 | +
|
| 51 | +___ |
| 52 | +##**Theory** |
48 | 53 |
|
49 | 54 | *What is scaled POD, and why would I do it?*
|
50 | 55 |
|
51 | 56 | Standard POD computes a basis that minimizes the projection error in a standard Euclidean $\\ell^2$ inner product,
|
52 |
| -i.e., for a snapshot matrix $\\mathbf{S}$, POD computes the basis by solving the minimization problem |
| 57 | +i.e., for a snapshot matrix $\\mathbf{S} \\in \\mathbb{R}^{ N_{\\mathrm{vars}} N_{\\mathrm{x}} \\times N_s}$, POD computes the basis by solving the minimization problem |
53 | 58 | (assuming no affine offset)
|
54 |
| -$$ \\boldsymbol \\Phi = \\underset{ \\boldsymbol \\Phi_{\\*} \\in \\mathbb{R}^{N \\times K} | \\boldsymbol |
| 59 | +$$ \\boldsymbol \\Phi = \\underset{ \\boldsymbol \\Phi_{\\*} \\in \\mathbb{R}^{ N_{\\mathrm{vars}} N_{\\mathrm{x}} \\times K} | \\boldsymbol |
55 | 60 | \\Phi_{\\*}^T \\boldsymbol \\Phi_{\\*} = \\mathbf{I}}{ \\mathrm{arg \\; min} } \\| \\Phi_{\\*} \\Phi_{\\*}^T
|
56 | 61 | \\mathbf{S} - \\mathbf{S} \\|_2.$$
|
57 | 62 | In this minimization problem, errors are measured in a standard $\\ell^2$ norm.
|
|
64 | 69 | Defining $\\mathbf{S}_{\\*} = \\mathbf{W}^{-1} \\mathbf{S}$, where $\\mathbf{W}$ is a weighting matrix
|
65 | 70 | (e.g., a diagonal matrix containing the max absolute value of each state variable),
|
66 | 71 | we compute the basis as the solution to the minimization problem
|
67 |
| -$$ \\boldsymbol \\Phi = \\mathbf{W} \\underset{ \\boldsymbol \\Phi_{\\*} \\in \\mathbb{R}^{N \\times K} |\\boldsymbol |
| 72 | +$$ \\boldsymbol \\Phi = \\mathbf{W} \\underset{ \\boldsymbol \\Phi_{\\*} \\in \\mathbb{R}^{N_{\\mathrm{vars}} N_{\\mathrm{x}} \\times K} |\\boldsymbol |
68 | 73 | \\Phi_{\\*}^T \\boldsymbol \\Phi_{\\*} = \\mathbf{I}}{ \\mathrm{arg \\; min} } \\| \\Phi_{\\*} \\Phi_{\\*}^T
|
69 | 74 | \\mathbf{S}_{\\*} - \\mathbf{S}_{\\*} \\|_2.$$
|
70 | 75 |
|
71 |
| -The Scaler encapsulates this information |
| 76 | +The Scaler encapsulates this information. |
| 77 | +
|
| 78 | +___ |
| 79 | +##**API** |
72 | 80 | '''
|
73 | 81 |
|
74 | 82 | import abc
|
@@ -113,7 +121,7 @@ class VectorScaler(Scaler):
|
113 | 121 | '''
|
114 | 122 | Concrete implementation designed to scale snapshot matrices by a vector.
|
115 | 123 | For a snapshot tensor $\\mathbf{S} \\in \\mathbb{R}^{N_{\\mathrm{u}} \\times N \\times K}$, the VectorScaler
|
116 |
| - accepts in a scaling vector $\\mathbf{v} \\in \\mathbb{R}^{N$, and scales by |
| 124 | + accepts in a scaling vector $\\mathbf{v} \\in \\mathbb{R}^{N}$, and scales by |
117 | 125 | $$\\mathbf{S}^* = \\mathrm{diag}(\\mathbf{v})^{-1} \\mathbf{S}$$
|
118 | 126 | before performing POD (i.e., POD is performed on $\\mathbf{S}^*$). After POD is performed, the bases
|
119 | 127 | are post-scaled by $$\\boldsymbol \\Phi = \\mathrm{diag}(\\mathbf{v}) \\mathbf{U}$$
|
|
0 commit comments