Difference between revisions of "Tutorial/Coupled problems"

From ONELAB
Jump to: navigation, search
(The considered problem)
(Mathematics)
Line 6: Line 6:
  
 
=== Mathematics ===
 
=== Mathematics ===
Let us begin by the first example with the very simple following example. The computation domain is the unit square $\Omega = [0,1]\times[0,1]$ with boundary $\Gamma$ and unit outwardly directed normal $\mathbf{n}$.  
+
Let the computation domain be the unit square $\Omega = [0,1]\times[0,1]$ with boundary $\Gamma$ and unit outwardly directed normal $\mathbf{n}$. Consider the two coupled following problems : firstly, find $u$, solution of
 
 
The first coupled problem read as follows :
 
 
\begin{equation}
 
\begin{equation}
 
\begin{cases}\label{eq:problemU}
 
\begin{cases}\label{eq:problemU}
Line 22: Line 20:
 
\end{cases}
 
\end{cases}
 
\end{equation}
 
\end{equation}
where $u$ is the solution of problem \ref{eq:problemU}. Obviously, solution $u$ is constant inside $\Omega$ and is equal to $C$ and there is no "real" need in solving problem \ref{eq:problemU}. The weak formulation of problems \ref{eq:problemU} and \ref{eq:problemV} read as :
+
where $u$ is the solution of problem \ref{eq:problemU}. Obviously, the function $u$ is the constant function equal to $C$ and thus, there is no "real" need in solving numerically problem \ref{eq:problemU}, keep in mind that this is just an example. In order to solve numerically these problem using a finite element method, on has to write the weak formulations of problems \ref{eq:problemU} and \ref{eq:problemV}, which read as:
 
 
 
\begin{equation}\label{eq:WeakFormulationU}
 
\begin{equation}\label{eq:WeakFormulationU}
 
\left\{\begin{array}{l}
 
\left\{\begin{array}{l}
\text{Find } u\in H^1(\Omega) \text{ such that, $u|_{\Gamma} = C$ and}\\
+
\text{Find } (u-C)\in H^1_0(\Omega) \text{ such that}\\
 
\displaystyle{\forall u'\in H^1_0(\Omega), \qquad \int_{\Omega} \nabla u\cdot\nabla u' \;{\rm d}\Omega  = 0},
 
\displaystyle{\forall u'\in H^1_0(\Omega), \qquad \int_{\Omega} \nabla u\cdot\nabla u' \;{\rm d}\Omega  = 0},
 
\end{array}\right.
 
\end{array}\right.
 
\end{equation}
 
\end{equation}
 
+
and
 
\begin{equation}\label{eq:WeakFormulationV}
 
\begin{equation}\label{eq:WeakFormulationV}
 
\left\{\begin{array}{l}
 
\left\{\begin{array}{l}

Revision as of 14:47, 12 December 2011

Introduction

Here is explained how to use the solution of a first problem as a data in a second problem. Two kind of problem are studied here. In the "first" one, the solution of the first problem directly appears in the weak formulation of the second problem (for example, as a source or a Neumann boundary) whereas in the second kind of problem, the solution is used as a constraint (Dirichlet boundary condition), so it should appears in the function space. Note that a Lagrange multiplier could be used to force the Dirichlet constraint in the weak formulation.

First kind of coupled problem : solution appearing in the weak formulation

Mathematics

Let the computation domain be the unit square $\Omega = [0,1]\times[0,1]$ with boundary $\Gamma$ and unit outwardly directed normal $\mathbf{n}$. Consider the two coupled following problems : firstly, find $u$, solution of \begin{equation} \begin{cases}\label{eq:problemU} \Delta u = 0 & \text{in } \Omega,\\ u = C & \text{on }\Gamma, \end{cases} \end{equation} where $C$ is a constant. Then, find the solution $v$ of the second problem \begin{equation} \begin{cases}\label{eq:problemV} -\Delta v + v = 0 & \text{in } \Omega,\\ \displaystyle{\frac{\partial v}{\partial \mathbf{n}} = u} & \text{on }\Gamma, \end{cases} \end{equation} where $u$ is the solution of problem \ref{eq:problemU}. Obviously, the function $u$ is the constant function equal to $C$ and thus, there is no "real" need in solving numerically problem \ref{eq:problemU}, keep in mind that this is just an example. In order to solve numerically these problem using a finite element method, on has to write the weak formulations of problems \ref{eq:problemU} and \ref{eq:problemV}, which read as: \begin{equation}\label{eq:WeakFormulationU} \left\{\begin{array}{l} \text{Find } (u-C)\in H^1_0(\Omega) \text{ such that}\\ \displaystyle{\forall u'\in H^1_0(\Omega), \qquad \int_{\Omega} \nabla u\cdot\nabla u' \;{\rm d}\Omega = 0}, \end{array}\right. \end{equation} and \begin{equation}\label{eq:WeakFormulationV} \left\{\begin{array}{l} \text{Find } v\in H^1(\Omega) \text{ such that, }\\ \displaystyle{\forall v'\in H^1(\Omega), \qquad \int_{\Omega} \nabla v\cdot\nabla v' \;{\rm d}\Omega + \int_{\Omega}vv' \;{\rm d}\Omega - \int_{\Gamma}uv'\;{\rm d}\Gamma = 0}, \end{array}\right. \end{equation} where $H^1(\Omega)$ is the classical Sobolev space, $H^1_0(\Omega)$ is the space of $H^1(\Omega)$ functions which vanish at the boundary $\Gamma$.

GetDP

In GetDP, this kind of problem is very easy to solve. The user must introduce two function space (one per solution), and solve each problem in the right order. There is no trap ! Here are the files. The .gmsh file quite the same as in the previous examples : it has no special interest.

Second kind of coupled problem : solution used as a Dirichlet boundary condition

Mathematics

We still consider problem (\ref{eq:problemU}) satisfied by $u$, but now, the second problem is to find $v$, solution of \begin{equation} \begin{cases}\label{eq:problemV2} -\Delta v + v = 0 & \text{in } \Omega,\\ \displaystyle{v = u} & \text{on }\Gamma, \end{cases} \end{equation} where $u$ is the solution of problem \ref{eq:problemU}. The solution $u$ is now used as a Dirichlet boundary condition.

GetDP

With GetDP, a dirichlet boundary condition is generally imposed through the "Constraint" term. Here, we propose to solve this problem using the function "AssignFromResolution". The procedure is the following :

  • Construct only ONE function space that will contain $u$ and then $v$
  • Solve problem 1 (and save $u$)
  • Transfert solution of problem 1 to problem 2
  • Solve problem 2 (and erase $u$ by $v$)

Remarks

  • The solution $u$ is no more stored at the end of the process. To avoid this, we propose here to save $u$ in an auxiliary function.
  • A Dirichlet boundary condition can also be imposed using a Lagrange Multiplier, that also avoid to use "TransfertSolution" ...

Files

Saving the solution $u$