Comparison of Traditional MOR with Lagrangian MOR for scalar convection and high-Pe scalar convection-diffusion equations
%%latex
where , , , .
Case 1: (scalar convection) and Case 2: (scalar convection-diffusion)
Generate Snapshots using High Fidelity Model (HFM)
%%latex The discretized High Fidelity Model is given by
Perform SVD
Perform SVD for snapshots
is a diagonal matrix containing the eigenvalues and is a square matrix containing the eigenvectors of the kernel ,
Perform SVD on Lagrangian coordinate snapshots
Perform SVD for snapshots of Lagrangian coordinates
is a diagonal matrix containing the eigenvalues and is a square matrix containing the eigenvectors of the kernel ,
Lagrangian MOR
%%latex
The procedure for the case of a linear 1D scalar convection-diffusion equation involves the following steps - ParseError: KaTeX parse error: No such environment: itemize at position 7: \begin{̲i̲t̲e̲m̲i̲z̲e̲}̲ \item The obje…
%%latex
Find optimal reduced bases: ParseError: KaTeX parse error: Undefined control sequence: \label at position 14: \begin{align}\̲l̲a̲b̲e̲l̲{opt} \min_{\m…
Define: ParseError: KaTeX parse error: Undefined control sequence: \label at position 165: …_k \times n_t} \̲l̲a̲b̲e̲l̲{trunc-sol}\\ \…
NO USE: Computing a non-optimized approximation by interpolating the reduced Eulerian state basis on the reduced Lagrangian coordinate basis
NO USE: Computing a non-optimized approximation by interpolating the reduced Eulerian state basis on the FULL Lagrangian coordinate basis
Function computing the residual error between the true state snapshot basis and the truncated state snapshot basis interpolated on the truncated Lagrangian basis
''' def residual_err2(tilde,full): W_interp1 = W.copy() W_interp2 = W.copy() if full == 1: # FULL Lagrangian basis Uk = np.reshape(tilde[:Nnn_k],(Nn,n_k),'F') Vk = np.reshape(tilde[Nnn_k:],(n_k,n_t+1),'F') ## For full Lagrangian basis X_tilde = Ux.dot(Sx_full.dot(Vx)) #Xpod_k# elif full == 0: # TRUNCATED Lagrangian basis Uxk = np.reshape(tilde[:Nnnx_k],(Nn,nx_k),'F') Vxk = np.reshape(tilde[Nnnx_k:(Nnnx_k + (n_t+1)nx_k)],(nx_k,n_t+1),'F') Uk = np.reshape(tilde[(Nnnx_k + (n_t+1)nx_k):(Nnnx_k + (n_t+1)nx_k + Nnn_k)],(Nn,n_k),'F') Vk = np.reshape(tilde[(Nnnx_k + (n_t+1)nx_k + Nnn_k):],(n_k,n_t+1),'F') ## For truncated Lagrangian basis X_tilde = Uxk.dot(Vxk)
''' from scipy.optimize import leastsq
Optimization call with FULL Lagrangian basis
#full = 1 #lag, mesg = leastsq(residual_err, guess_full, args=(1), xtol=1.49012e-5, ftol=1.49012e-4)
Optimization call with TRUNCATED Lagrangian basis
full = 0 lag, mesg = leastsq(residual_err2, guess_trunc, args=(0), xtol=1.49012e-5,ftol=1.49012e-5)
print mesg
''' Ux_kop = np.reshape(lag[:Nnnx_k],(Nn,nx_k),'F') Vx_kop = np.reshape(lag[Nnnx_k:(Nnnx_k + (n_t+1)nx_k)],(nx_k,n_t+1),'F') U_kop = np.reshape(lag[(Nnnx_k + (n_t+1)nx_k):(Nnnx_k + (n_t+1)nx_k + Nnn_k)],(Nn,n_k),'F') #U_kopT = U_kop.conj().T V_kop = np.reshape(lag[(Nnnx_k + (n_t+1)nx_k + Nnn_k):],(n_k,n_t+1),'F')
Optimized truncated Lagrangian coordinate basis
X_lag = Ux_kop.dot(Vx_kop)
W_temp = U_kop.dot(V_kop)
plt.plot(x,W[:,0],'k-',x,W_temp[:,0],'g-o',x,W[:,n_t/3],'k-',x,W_temp[:,n_t/3],'g-o',x,W[:,2n_t/3],'k-',x,W_temp[:,2n_t/3],'g-o',x,W[:,n_t],'k-',x,W_temp[:,n_t],'g-o') plt.title('Comparison of truth solution (black) \n and Lagrangian MOR (green dots)')
Online evaluation - No idea what's going on here!!!
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-39-eed75b7ed6af> in <module>()
53 #interpolate Lagrangian state basis from Lagrangian to Eulerian coordinates
54 for nn in np.arange(nt_online):
---> 55 f = interpolate.interp1d(X_lag[:,nn], Znew[:,nn],fill_value="extrapolate")
56 Znew_E[:,nn] = f(x0)
IndexError: index 71 is out of bounds for axis 1 with size 71