Reaction diffusion models
MSE works with models based on parabolic partial differential equation of the following form (1):
Where \(\Omega\) is the study zone of dimension 1 or 2. The bondary condition on \(\delta \Omega\) depends on the study and will be adjustied in case of interaction with the border.
Diffusion term
The diffusion process is represented by the term \(\Delta D(x,\Theta)U(t,x)\). In MSE, this part of the model is implemented in the class Diffusion process.
Sources terms
The sources terms are contains in \(f(\Theta,U(t,x))\). These terms are implemented in the class Source Term Model, which uses the model’s database. It is also possible to defined new ones using a simple textual description. The relations between compartments are also defined in these terms.
Initial state
The initial state of the system \(U_0(x,\Theta)\) is defined in the dynamical system class Dynamical System.
Observation Process
At this step it can be useful to see the MSE simulator has the function (2):
(2)\[\begin{split}\begin{equation} \left\{ \begin{array}{lcl} S&:& \mathbb{R}^p \mapsto ((t,\Omega) \mapsto \mathbb{R}^m)\\ && \Theta \to S(\Theta), \text{ The funtion satisfyng (1) for $\Theta$}. \end{array} \right. \end{equation}\end{split}\]
Let \(\mathcal{L}\) in (3) be a function that can represent a likelihood, a log-likelihood, a contrat function. This function can describe an observation process. The implementation is in the class observation Processus.
Optimisation, Maximum likelihood Edstimation
MSE provides algorithms (BFGS, system adjoint, MCMC) to estimate the model parameters. It consists in looking the function (4) as an objetive function. An example is the tutorial optim.
Because optimisation requires computing the variation of the likelihood, MSE provides algorithms to perform this task.
Computing variations using adjoint method
In MSE, this algorithm is implemented in the class Adjoint system. It consists in computing \(\partial_{\theta_i} \mathcal{O}(\Theta)\).
Assumptions and notations:
assumption: the likelihood in (3) can be written as \(\mathcal{L}(u)=\int_Q v(u)(x,t)\) with \(Q=\Omega \times [0,T]\),
\(H\) is the Hilbert functions \(Q\to\mathbb{R}\), with the dot product \(<u,v>_H=\int_Q u.v\),
\(v(u) \in H\),
\(v'(u) \in L(H,H)\) is \(\partial _u v(u)\) such that \(v(u+\delta u)=v(u)+v'(u)(\delta u) + o(\delta u)\),
assumption: \(v'(u)\) can be written as \(v'(u)=(\delta u)(x,t)=\tilde v'(u)(x,t) . \delta u(x,t) \in \mathbb{R}\) ,
leading to \(\mathcal{L}'(u)(\delta u)=<\tilde v'(u),\delta u>_H\).
Let \(S\) play the role of a simulator parameterized by \(\Theta\):
Linearization of \(S\) at \(\Theta\):
Operator \(S'(\Theta)^*\):
computing variation using the implicit function theorem
Link between \(\nabla \mathcal{O}(\Theta) \in \mathbb{R}^p\) and \(\mathcal{O}'(\Theta) \in \mathbb{R}^{p*}\):
That is, \(\mathcal{O}'(\Theta)^*=\nabla \mathcal{O}(\Theta)\). Taking into account function compositions, with \(\delta \Theta \in \mathbb{R}^p\):
We then obtain:
Adding the state function
Let \(F:\mathbb{R}^p\times H \to H\) such that \(S(\Theta)=u_\Theta\) satisfies \(F(\Theta,u_\Theta)=0\in H\).
If we apply the implicit function theorem:
and
By substituting into (5):
That is, \(P+\partial_u(F(\Theta,u_\Theta)^{-1*}\tilde v'(u_\Theta)=0\).
Writing the weak formulation of the adjoint equation, for all \(w \in H\):
\(P\) is called the adjoint state.
Details:
\(\partial_uF (\Theta, u_\Theta)\in L(H,H)\)
\(\partial_uF (\Theta, u_\Theta)^*\in L(H,H)\)
Such that \(\langle \partial_uF (\Theta, u_\Theta)(u),w\rangle_H=\langle u,\partial_uF (\Theta, u_\Theta)^*(w)\rangle_H\)
computing variation using the Lagrangian
Let \(L\) be:
If \(u=u_\Theta\), then:
Taking the derivative:
We then choose \(p\) such that for all \(\delta u\):
which means:
which corresponds to the adjoint equation. We then obtain:
We can then deduce the components of \(\nabla \mathcal{O}(\Theta)\) by choosing \(\delta \Theta=e_i\).
In the examples, we will explicitly define and solve/simulate system (7) to obtain the vector \(\nabla \mathcal{O}(\Theta)\).
Remarks:
The adjoint system (7) does not depend on the model parameterization! This means that it can be computed without considering the parameterization of the model (an important detail for implementation).
Moreover, the left-hand side of the adjoint system, the matrix in equation (7), does not depend on the observation process. This means that the construction of the linear system for simulating the adjoint state depends only on the model.
Equation (8) corresponds to computing an integral over \(Q\), regardless of the nature of the observation process, even if observations are discrete in time and/or space.
The computation of \(\nabla \mathcal{O}(\Theta)\) reduces to simulating a linear PDE and computing \(p\) integrals over \(Q\).
Computing variations using the linear tangent equation
comming soon.
References
Interactions between 2 geometrical domains
Exchanges between geometrically different domains, \(D1\) and \(D2\), can be modeled by adding source terms or fluxes between \(D1\) and \(D2\). Without interaction, the variational formulation leads to the linear system \(M \left( \begin{array}{c} \alpha \\ \beta \end{array} \right)=B\) , \(M\) is the matrix:
where the first bloc row is about the dynamic on \(D1\), the extract diagonal could be zero.
An interaction consists in adding \(addM\) to M:
The following describes various interactions and the corresponding implementation adopted in MSE.
Interaction 2d1d
We first proposed a resolution model with interaction 2d1d, based on the following study: The influence of a line with fast diffusion on Fisher-KPP propagation, https://arxiv.org/abs/1210.3721 .
Let:
\(\delta\) a 1d segment,
\(\Omega\) a rectangle based on \(\delta\),
\(V\) is defined in \(\Omega\),
\(U\) is defined on \(\delta\).
The system coupling \(\Omega\) and delta is:
The interaction consists in adding the 1d sources terme \(\boldsymbol {V}(x,0,t)-U(x,t)\) and the 2d flux \(U(x,t)-\boldsymbol {V}(x,0,t)\).
Matrices descritpion of the 2d1d interaction
For notation, we assume that 2d domain is \(D1\), corresponding to the first block row \((M1, M1\_2)\).Let
The map \(I_{2,1}\) makes the link beetween \(D2\) and \(D1\) dofs : \(I_{2,1}(i)\) is the 2d index geometrialy-equals the 1d index i
In the system (9), we write the Green’s formula on adding fluxes in \(\Omega\):
Using the 2d1d transfer:
This leads to:
Note that many \(\int_\delta\psi_j \psi_i\) are null. Rewriting it using \(mass_{1d}\), we get:
In the system (9), we now Write the variational formulation of the source term in \(\delta\):
If \(\psi\) equals \(\phi\) on \(\delta\), we get:
Interaction to connect two 1d domains sharing one border vertex
Let \(\delta_1\) and \(\delta_2\), two edges sharing a vertex at the coordinate \(x_v\). The goal is to modify the fluxes at the boundary \(x_v\) so that \(u_1\) and \(u_2\) aproximate a model on \(\delta_1 \cup \delta_2\).
The fluxes are:
The larger \(\gamma\) is, the smaller \(|u_2(x_v,t)-u_1(x_v,t)|\) becomes.
Matrices description
\(\phi_i\) where \(i \in [0,n_1]\): basis functions on \(\delta_1\)
\(\psi_i\) where \(i \in [0,n_2]\): basis functions on \(\delta_2\)
\(\alpha\): degrees of freedom on \(\delta_1\), with \(u_1 = \sum \alpha_i \phi_i\)
\(\beta\): degrees of freedom on \(\delta_2\), with \(u_2 = \sum \beta_i \psi_i\)
Let \((i_1, i_2)\) such that \(\phi_{i_1}(x_v)=1\) and \(\psi_{i_2}(x_v)=1\); for linear piecewise basis functions, this implies \(\phi_{i \ne i_1}(x_v)=0\) and \(\psi_{i \ne i_2}(x_v)=0\).
Applying integration by parts:
The flux in \(\delta_1\) is:
We get the interaction matrices that must be multiply by \(\gamma\):
Multi-edge connection case
Let \(\delta_k\) for \(k \in [1,n]\) be edges sharing a vertex at \(x_v\). Let \(i_k\) be the index in the basis of \(\delta_k\) such that \(\phi_{i_k}(x_v) = 1\).
The boundary condition at the junction is:
Matrix additions for multiple edges that must be multiply by \(\gamma\):
This interaction is not implemented because it is equivalent to applying the 2-edge interaction \((n-1)\) times.
Interaction 1d1d
Let \(\delta_1\) and \(\delta_2\) sharing the same geometry. This interaction consist in allowing the population transfert between them. \(U_1\) and \(U_2\) are respecrtively defined on \(\delta_1\) and \(\delta_2\). The intercation in adding the terms:
Matrices description of the 1d1d interaction
Let
Let \(I_{\delta1\delta2}(i)\) be the index in \(\delta_2\) geometrically equal to the \(\delta_1\) index \(i\), \(\phi_i = \psi_{I_{\delta1\delta2}(i)}\) , \(I_{\delta2\delta1}(I_{\delta1\delta2}(i)) = i\).
The weak formulation in \(\delta_1\) of the source terms described in (10), leads to :
\(addM1_{i,j} = \int_{\delta_1} \phi_j \cdot \phi_i = (mass_1)_{i,j}\)
\(addM1M2_{i,j} = \int_{\delta_1} \psi_j \cdot \phi_i = \int_{\delta_1} \phi_{I_{\delta2\delta1}(j)} \cdot \phi_i = (mass_1)_{i, I_{\delta2\delta1(j)}}\)
Thus:
In \(\delta_2\), we get:
Interaction 2d2d
The connexion between two field \((\Omega_1,\Omega_2)\) sharing an border \(\delta\) is defined as follow:
The tutorial of interaction 2d2d model is avaible here: Tutorial: simulation with 2D2D interaction.
Matrices description of the 2d2d interaction
hese interations are implemented in the class Interactions.