Browse Source

update

master
J.E. Garay Labra 1 year ago
parent
commit
1b00a76a17
  1. 51
      kalman/graphics/figure3.py
  2. 16
      kalman/input_files/aorta.yaml
  3. BIN
      presentations/press_8ecm/images/Rd_Pb.png
  4. BIN
      presentations/press_8ecm/images/Rd_Pc.png
  5. BIN
      presentations/press_8ecm/images/U_Pb.png
  6. BIN
      presentations/press_8ecm/images/U_Pc.png
  7. 124
      presentations/press_8ecm/press.tex

51
kalman/graphics/figure3.py

@ -6,11 +6,12 @@ import pickle @@ -6,11 +6,12 @@ import pickle
import yaml
#import matplotlib.font_manager
from matplotlib import rc
rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']})
rc('text', usetex=True)
import matplotlib.font_manager
def is_ipython():
''' Check if script is run in IPython.
@ -98,10 +99,10 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None): @@ -98,10 +99,10 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None):
ids.append(bnd_c['id'])
ids_type.append('windkessel')
current_val.append(bnd_set['parameters']['R_d'])
labels.append('$R_' + str(bnd_c['id']))
labels.append('$R_' + str(bnd_c['id']-3))
if RC_flag:
current_val_C.append(bnd_set['parameters']['C'])
labels.append('$C_' + str(bnd_c['id']))
labels.append('$C_' + str(bnd_c['id']-3))
elif 'dirichlet' in bnd_c['type']:
@ -112,10 +113,9 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None): @@ -112,10 +113,9 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None):
fig1, axes1 = plt.subplots(1,1,figsize=(12,6))
fig1, axes1 = plt.subplots(1,1,figsize=(12,7))
if RC_flag:
fig2, axes2 = plt.subplots(1,1,figsize=(12,6))
fig2, axes2 = plt.subplots(1,1,figsize=(12,7))
t = dat['times']
@ -162,13 +162,22 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None): @@ -162,13 +162,22 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None):
if ids_type[i] == 'dirichlet':
pass
#axes3.plot(t, curve , '-', color=col_,label= legends_ + '= ' + str(rec_value) + '/' + str(true_values[cur_key]) + '$')
#axes3.fill_between(t, curve - np.sqrt(P[:, idx, idx]), curve + np.sqrt(P[:, idx, idx]), alpha=0.3, color=col_)
#legends_=next(legends)
#axes3.plot(t, dash_curve , color=col_,ls='--')
fig3, axes3 = plt.subplots(1,1,figsize=(12,5))
axes3.plot(t, curve , '-', color=col_,label= legends_ + '= ' + str(rec_value) + '/' + str(true_values[cur_key]) + '$', linewidth = 4)
axes3.fill_between(t, std_down, std_up, alpha=0.3, color=col_)
legends_=next(legends)
axes3.plot(t, dash_curve , color=col_,ls='--')
axes3.set_ylabel(r'$U$',fontsize=36)
axes3.legend(fontsize=36,loc='upper right')
axes3.set_xlim([-0.01,0.81])
axes3.set_xlabel(r'$t (s)$',fontsize=36)
axes3.set_box_aspect(1/4)
plt.xticks(fontsize=28)
plt.yticks(fontsize=28)
plt.savefig('U.png')
plt.close(fig3)
else:
axes1.plot(t, curve , '-', color=col_,label= legends_ + '= ' + str(rec_value) + '/' + str(true_values[cur_key]) + '$', linewidth = 2)
axes1.plot(t, curve , '-', color=col_,label= legends_ + '= ' + str(rec_value) + '/' + str(true_values[cur_key]) + '$', linewidth = 3)
axes1.fill_between(t, std_down, std_up, alpha=0.3, color=col_)
axes1.plot(t, dash_curve , color=col_,ls='--')
legends_=next(legends)
@ -199,19 +208,23 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None): @@ -199,19 +208,23 @@ def plot_parameters(dat, input_file, deparameterize=False, ref=None):
idx +=1
axes1.set_ylabel(r'$R_d$',fontsize=22)
axes1.legend(fontsize=18,loc='upper right')
axes1.set_ylabel(r'$R_d$',fontsize=36)
axes1.legend(fontsize=36,loc='upper right')
axes1.set_xlim([-0.01,0.81])
axes1.set_ylim([1700,35000])
axes1.set_xlabel(r'$t (s)$',fontsize=22)
plt.savefig('C.png')
axes1.set_ylim([1700,45000])
axes1.set_box_aspect(1/2)
plt.xticks(fontsize=28)
plt.yticks(fontsize=28)
axes1.set_xlabel(r'$t (s)$',fontsize=36)
plt.savefig('Rd.png')
if RC_flag:
axes2.set_ylabel(r'$C$',fontsize=22)
axes2.set_ylabel(r'$C$',fontsize=24)
axes2.legend(fontsize=18,loc='upper right')
axes2.set_xlim([-0.01,0.81])
axes2.set_xlabel(r'$t (s)$',fontsize=22)
axes2.set_xlabel(r'$t (s)$',fontsize=24)
fig2.savefig('C.png')
fig1.savefig('Rd.png')

16
kalman/input_files/aorta.yaml

@ -8,7 +8,7 @@ fluid: @@ -8,7 +8,7 @@ fluid:
implicit_windkessel: True
io:
write_path: 'results/aorta'
write_path: 'results/HRz_Pb_V70'
restart:
path: '' # './projects/nse_coa3d/results/test_restart2/'
time: 0
@ -186,18 +186,18 @@ estimation: @@ -186,18 +186,18 @@ estimation:
mesh: '/home/yeye/NuMRI/kalman/meshes/coaortaH3_leo2.0.h5'
#mesh: './meshes/coaortaH1.h5'
fe_degree: 1
#xdmf_file: 'measurements/aorta_zdir/Perturbation/Mg15V120/u_all.xdmf'
#file_root: 'measurements/aorta_zdir/Perturbation/Mg15V120/u{i}.h5'
xdmf_file: 'measurements/aorta/u_all.xdmf'
file_root: 'measurements/aorta/u{i}.h5'
xdmf_file: 'measurements/aorta_zdir/Perturbation/Mg15V70/u_all.xdmf'
file_root: 'measurements/aorta_zdir/Perturbation/Mg15V70/u{i}.h5'
#xdmf_file: 'measurements/aorta/u_all.xdmf'
#file_root: 'measurements/aorta/u{i}.h5'
indices: 0 # indices of checkpoints to be processed. 0 == all
velocity_direction: ~
noise_stddev: 0 # standard deviation of Gaussian noise
noise_stddev: 45 # standard deviation of Gaussian noise
roukf:
particles: 'simplex' # unique or simplex
observation_operator: 'postprocessing' #state or postprocessing
reparameterize: True
ODV_functional:
enable: False
VENC: 244
enable: True
VENC: 142

BIN
presentations/press_8ecm/images/Rd_Pb.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
presentations/press_8ecm/images/Rd_Pc.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 77 KiB

BIN
presentations/press_8ecm/images/U_Pb.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
presentations/press_8ecm/images/U_Pc.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

124
presentations/press_8ecm/press.tex

@ -237,22 +237,11 @@ P_l = R_{p,l} \ Q_l + \pi_l @@ -237,22 +237,11 @@ P_l = R_{p,l} \ Q_l + \pi_l
\column{.5\textwidth} % Left column and width
\footnotesize
\begin{itemize}
\item Incompressible Navier-Stokes equations:
\begin{equation}
\begin{cases}
\displaystyle \rho \frac{\partial \vec{u}}{\partial t} + \rho \big ( \vec{u} \cdot \nabla \big) \vec{u} - \mu \Delta \vec{u} + \nabla p = 0 \\[0.2cm]
\nabla \cdot \vec{u} = 0 \quad \text{in} \quad \Omega \\[0.2cm]
\vec{u} = \vec{u}_{inlet} \quad \text{on} \quad \Gamma_{in} \\[0.2cm]
\vec{u} = 0 \quad \text{on} \quad \Gamma_{walls}
\end{cases}
\end{equation}
\item \emph{Three-element} Windkessel coupling at every outlet:
\begin{equation}
\begin{cases}
\displaystyle C_{d,l} \frac{d \pi_l}{dt} + \frac{\pi_l}{R_{d,l}} = Q_l \\[0.2cm]
P_l = R_{p,l} \ Q_l + \pi_l
\end{cases}
\end{equation}
\item<1-> $u_{inlet} = -U f(t) \hat{n}$, with $f(t)$ the weaveform.
\item<2-> Fractional step scheme.
\item<3-> Semi-implicit Windkessel model.
\item<4-> Stabilized $\mathbb{P}1/\mathbb{P}1$ finite elements.
\item<4-> Implemented in FEniCS.
\end{itemize}
@ -260,7 +249,7 @@ P_l = R_{p,l} \ Q_l + \pi_l @@ -260,7 +249,7 @@ P_l = R_{p,l} \ Q_l + \pi_l
\begin{figure}[!hbtp]
\begin{center}
\includegraphics[height=0.9\textwidth]{images/ref.png}
\caption{\footnotesize Schematic of the model}
\caption{\footnotesize Reference solution at peak systole}
\end{center}
\end{figure}
\end{columns}
@ -290,13 +279,14 @@ P_l = R_{p,l} \ Q_l + \pi_l @@ -290,13 +279,14 @@ P_l = R_{p,l} \ Q_l + \pi_l
\item<5-> Gaussian noise into the magnetization
\item<6-> Different levels of aliasing varying the $venc$ parameter
\item<7-> Only using the dominant component of the velocity: $u_z$
\item<8-> Time interpolation $dt = 1 \ ms \Longrightarrow dt = 30 \ ms$
\end{itemize}
\end{columns}
\end{frame}
\section{The inverse problem}
\begin{frame}
\frametitle{The inverse problem}
@ -381,19 +371,109 @@ J(\theta) = \displaystyle \frac{1}{2} || \theta - \theta_0 ||^2_{P_0^{-1}} + \ @@ -381,19 +371,109 @@ J(\theta) = \displaystyle \frac{1}{2} || \theta - \theta_0 ||^2_{P_0^{-1}} + \
The parameter vector:
\begin{itemize}
\item<1-> Plug flow at the inlet: $u_{inlet} = -U f(t) \hat{n}$, with $f(t)$ is the weaveform which simulate a cardiac cycle and $\hat{n}$ is the outward normal vector.
\item<2-> Since $R_p << R_d$, we only consider an optimization dependent on $R_d, C$ for every 3D-0D coupled outlet
\item<1-> Amplitude of the inlet velocity: $U$
\item<2-> Since $R_p << R_d$, we only consider an optimization dependent on $\big ( R_{d,l}, C_l \big )$ for $l=1,...,n_l$
\end{itemize}
\onslide<3-> $$\theta = (U,\vec{R_d},\vec{C})$$ \\ with $\vec{R_d} = R_{d,l}$, $\vec{C} = C_l$ for $l=1,..., n_l$
\onslide<3-> $$\theta = (U,\vec{R_d},\vec{C})$$ \\ with $\vec{R_d} = R_{d,l}$, $\vec{C} = C_l$ for $l=1,..., \color{red} n_{l-1}$ \\[0.3cm]
\onslide<4-> \color{red} Not all the resistences can be recovered at once $\Longrightarrow$ desc. aorta fixed.
\end{frame}
\section{Numerical Experiments}
\begin{frame}
\frametitle{Easy example}
\footnotesize
\begin{itemize}
\item<1-> $\theta_{ref} = (U,\vec{R_d})$ , $U=75$, $\vec{R_d} = (7200,11520,11520)$
\end{itemize}
\begin{columns}
\footnotesize
\column{.4\textwidth}
\begin{figure}
\onslide<2-> \textbf{Test I:} $U_0 = 150$ $\vec{R_{d,0}}= (8760,8760,8760)$
\onslide<3->
\includegraphics[width=1.2\textwidth]{images/U_Pb.png}
\includegraphics[width=1.2\textwidth]{images/Rd_Pb.png}
\end{figure}
\column{.4\textwidth}
\begin{figure}
\onslide<2-> \textbf{Test II:} $U_0 = 40$ $\vec{R_{d,0}}= (4000,4000,4000)$
\onslide<4->
\includegraphics[width=1.2\textwidth]{images/U_Pc.png}
\includegraphics[width=1.2\textwidth]{images/Rd_Pc.png}
\end{figure}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{Aliased data}
\begin{center}
What happend when $venc < u_{max}$ ?
\end{center}
\end{frame}
\begin{frame}
\frametitle{Easy example: with $venc = 70 \% u_{max}$}
\footnotesize
\begin{itemize}
\item $\theta_{ref} = (U,\vec{R_d})$ , $U=75$, $\vec{R_d} = (7200,11520,11520)$
\end{itemize}
\begin{columns}
\footnotesize
\column{.4\textwidth}
\begin{figure}
\onslide<1-> \textbf{Test I:} $U_0 = 150$ $\vec{R_{d,0}}= (8760,8760,8760)$
\onslide<2->
\includegraphics[width=1.2\textwidth]{images/U_Pb.png}
\includegraphics[width=1.2\textwidth]{images/Rd_Pb.png}
\end{figure}
\column{.4\textwidth}
\begin{figure}
\onslide<1-> \textbf{Test II:} $U_0 = 40$ $\vec{R_{d,0}}= (4000,4000,4000)$
\onslide<2->
\includegraphics[width=1.2\textwidth]{images/U_Pc.png}
\includegraphics[width=1.2\textwidth]{images/Rd_Pc.png}
\end{figure}
\end{columns}
\end{frame}
\begin{frame}
\frametitle{The Kalman Filter: A frequency defined functional}
\begin{itemize}
\item<1-> We proposed a change in the cost functional:
\onslide<2->
\begin{equation*}
\hat{\theta} = arg \min_{\theta} J(\theta)
\end{equation*}
\begin{equation}
J(\theta) = \displaystyle \frac{1}{2} || \theta - \theta_0 ||^2_{P_0^{-1}} + \color{red} \sum_{k=1}^N 1- cos \big ( \frac{\pi}{venc} \cdot ( Z_k - \mathbb{H} X_k ) \big )
\end{equation}
\end{itemize}
\end{frame}
\section{Numerical Experiments}
\begin{frame}
\frametitle{Numerical Experiments}

Loading…
Cancel
Save