Discretization in time ======================= In this chapter, we simply repeat the variational formulations by applying a discretization with respect to time of the theta-schema type for hydraulics and thermics. This is a general method for integrating differential equations [:ref:`bib12 `] and [:ref:`bib13 `]. :math:`\theta` is a numerical parameter between :math:`0` and :math:`1`. For linear differential equations (which is not our case...) this diagram is unconditionally stable for :math:`\theta \ge 1/2`, it is of order :math:`1` for :math:`\theta \ne 1/2` and of order 2 for :math:`\theta =1/2`. However, it may be preferable to use a value other than :math:`1/2`, for reasons of parasitic oscillations [:ref:`bib12 `]. The quantities indexed by :math:`+` are the quantities at the end of the time step, and those indexed by :math:`–` are those at the start of the time step. We note: :math:`\mathrm{\Delta }t={t}^{+}-{t}^{-}` :math:`{a}^{\theta }=\theta {a}^{+}+\left(1-\theta \right){a}^{-}\text{}\forall a` Mechanics --------- :math:`\mathrm{\{}\begin{array}{c}{\sigma }^{+}\mathrm{=}\sigma {\text{'}}^{+}+{\sigma }_{p}^{+}\mathrm{I}\\ {\mathrm{\int }}_{\Omega }{\sigma }^{+}\text{.}\varepsilon (\mathrm{v})d\Omega \mathrm{=}{\mathrm{\int }}_{\Omega }{r}^{+}{\mathrm{F}}^{\mathrm{m}+}\text{.}\mathrm{v}d\Omega +{\mathrm{\int }}_{\mathrm{\partial }\Omega }{\mathrm{f}}^{\mathrm{ext}+}\text{.}vd\Gamma \text{}\mathrm{\forall }\mathrm{v}\mathrm{\in }{U}_{\mathit{ad}}\end{array}` **eq 5.1-1** Hydraulics ----------- :math:`\begin{array}{}-{\int }_{\Omega }({m}_{1}^{{1}^{+}}+{m}_{1}^{{2}^{+}})\text{.}{\pi }_{1}d\Omega +\theta \Delta t{\int }_{\Omega }({M}_{1}^{{1}^{+}}+{M}_{1}^{{2}^{+}})\text{.}\nabla {\pi }_{1}d\Omega =\\ -{\int }_{\Omega }({m}_{1}^{{1}^{-}}+{m}_{1}^{{2}^{-}})\text{.}{\pi }_{1}d\Omega -(1-\theta )\Delta t{\int }_{\Omega }({M}_{1}^{{1}^{-}}+{M}_{1}^{{2}^{-}})\text{.}\nabla {\pi }_{1}d\Omega \\ +\Delta t{\int }_{\partial \Omega }({M}_{1\mathrm{ext}}^{{1}^{\theta }}+{M}_{1\mathrm{ext}}^{{2}^{\theta }})\text{.}{\pi }_{1}d\Gamma \forall {\pi }_{1}\in {P}_{1\mathrm{ad}}\\ -{\int }_{\Omega }({m}_{2}^{{1}^{+}}+{m}_{2}^{{2}^{+}})\text{.}{\pi }_{2}d\Omega +\theta \Delta t{\int }_{\Omega }({M}_{2}^{{1}^{+}}+{M}_{2}^{{2}^{+}})\text{.}\nabla {\pi }_{2}d\Omega =\\ -{\int }_{\Omega }({m}_{2}^{{1}^{-}}+{m}_{2}^{{2}^{-}})\text{.}{\pi }_{2}d\Omega -(1-\theta )\Delta t{\int }_{\Omega }({M}_{2}^{{1}^{-}}+{M}_{2}^{{2}^{-}})\text{.}\nabla {\pi }_{2}d\Omega \\ +\Delta t{\int }_{\partial \Omega }({M}_{2\mathrm{ext}}^{{1}^{\theta }}+{M}_{2\mathrm{ext}}^{{2}^{\theta }})\text{.}{\pi }_{2}d\Gamma \forall {\pi }_{2}\in {P}_{2\mathrm{ad}}\end{array}\}` **eq 5.2-1** Thermal --------- :math:`\begin{array}{}{\int }_{\Omega }(Q{\text{'}}^{+}-Q{\text{'}}^{-})\tau d\Omega -\theta \Delta t{\int }_{\Omega }(\sum _{p,c}{h}_{c}^{mp+}{M}_{c}^{p+}+{q}^{+})\nabla \tau d\Omega \\ -(1-\theta )\Delta t{\int }_{\Omega }(\sum _{p,c}{h}_{c}^{mp-}{M}_{c}^{p-}+{q}^{-})\nabla \tau d\Omega +\theta {\int }_{\Omega }(\sum _{p,c}{h}_{c}^{mp+}({m}_{c}^{p+}-{m}_{c}^{p-}))\tau d\Omega \\ +(1-\theta ){\int }_{\Omega }{h}_{c}^{mp-}({m}_{c}^{p+}-{m}_{c}^{p-})\tau d\Omega =\\ +\theta \Delta t{\int }_{\Omega }\sum _{p,c}{M}_{c}^{p+}\text{.}{F}^{m}\tau d\Omega +(1-\theta )\Delta t{\int }_{\Omega }\sum _{p,c}{M}_{c}^{p-}\text{.}{F}^{m}\tau d\Omega \\ +\Delta t{\int }_{\Omega }{\Theta }^{\theta }\tau d\Omega -\Delta t{\int }_{\partial \Omega }(\sum _{p,c}{h}_{c}^{m{p}^{\theta }}{M}_{c\mathrm{ext}}^{{p}^{\theta }}+{q}_{\mathrm{ext}}^{\theta })\text{.}\tau d\Gamma \forall \tau \in {T}_{\mathrm{ad}}\end{array}\}` **eq 5.3-1** Once again, it can be considered that the heat flow conditions directly define: :math:`{\tilde{q}}_{\mathrm{ext}}^{\theta }=\sum _{p,c}{h}_{c}^{m{p}^{\theta }}{M}_{c\mathrm{ext}}^{{p}^{\theta }}+{q}_{\mathrm{ext}}^{\theta }`