LifeV
3d/darcy.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 /**
27  @file darcy.hpp
28  @author A. Fumagalli <alessio.fumagalli@mail.polimi.it>
29  @date 2012-06-13
30 */
31 
32 #ifndef __darcy_H
33 #define __darcy_H 1
34 
35 
36 // ===================================================
37 //! Includes
38 // ===================================================
39 
40 #include <lifev/core/LifeV.hpp>
41 
42 #include <lifev/core/mesh/RegionMesh3DStructured.hpp>
43 #include <lifev/core/mesh/MeshPartitioner.hpp>
44 
45 #ifdef HAVE_HDF5
46 #include <lifev/core/filter/ExporterHDF5.hpp>
47 #endif
48 #include <lifev/core/filter/ExporterEmpty.hpp>
49 
50 /*!
51  @class darcy_linear
52  @brief LifeV linear Darcy test case
53 
54  @author A. Fumagalli <alessio.fumagalli@mail.polimi.it>
55 
56  Simple linear 3D Darcy test with Dirichlet, Neumann and Robin Boundary condition.
57  <br>
58  Solve the problem in dual-mixed form
59  \f[
60  \left\{
61  \begin{array}{l l l }
62  \Lambda^{-1} \sigma + \nabla p = f_v & \mathrm{in} & \Omega, \vspace{0.2cm} \\
63  \nabla \cdot \sigma + \pi p - f = 0 & \mathrm{in} & \Omega, \vspace{0.2cm} \\
64  p = g_D & \mathrm{on} & \Gamma_D,\vspace{0.2cm} \\
65  \sigma \cdot n + h p = g_R & \mathrm{on} & \Gamma_R, \vspace{0.2cm} \\
66  \sigma \cdot n = g_N & \mathrm{on} & \Gamma_N,
67  \end{array}
68  \right.
69  \f]
70  where \f$ \Omega = (0,1)^3 \f$ with
71  \f$ \Gamma_R = \left\{ z = 0 \right\} \f$,
72  \f$ \Gamma_{N_1} = \left\{ z = 1 \right\} \f$,
73  \f$ \Gamma_{N_2} = \left\{ y = 0 \right\} \f$ and
74  \f$ \Gamma_D = \partial \Omega \setminus \left( \Gamma_R \cup \Gamma_{N_1}
75  \cup \Gamma_{N_2} \right) \f$.
76  Furthermore the data are
77  \f[
78  \begin{array}{l l l}
79  f_v(x,y,z) = \left( x^3, 2y, 4z \right)^T &
80  \pi(x,y,z) = xy - 0.5z &
81  f(x,y,z) = 4x^2 - 4y^2 - 8xy + 6 + (xy - 0.5z)(x^2y^2 + 6x + 5z), \vspace{0.2cm} \\
82  g_D(x,y,z) = x^2y^2 + 6x + 5z, &
83  h(x,y,z) = 1, &
84  g_R(x,y,z) = 5 - 4z + x^2y^2 + 6x + 5z, \vspace{0.2cm} \\
85  g_{N_1}(x,y,z) = - 5 + 4z, &
86  g_{N_2}(x,y,z) = 2xy^2 + 6 + 2x^2y - 2y - x^3, &
87  \Lambda (x,y,z) =
88  \left(
89  \begin{array}{c c c}
90  2 & 1 & 0 \\
91  1 & 1 & 0 \\
92  0 & 0 & 1
93  \end{array}
94  \right).
95  \end{array}
96  \f]
97  The analytical solutions are
98  \f[
99  p(x,y,z) = x^2y^2 + 6x + 5z,
100  \quad
101  \sigma(x,y,z) =
102  \left(
103  \begin{array}{c}
104  - 4xy^2 - 12 - 2x^2y + 2x^3 + 2y \\
105  -2xy^2 - 6 - 2x^2y + 2y + x^3 \\
106  - 5 + 4z
107  \end{array}
108  \right).
109  \f]
110  The computed errors are
111  <table border="1" align="center">
112  <tr>
113  <th> N </th>
114  <th> \f$ \left\Vert p - p_h \right\Vert_{L^2} \f$ </th>
115  <th> \f$ \left\Vert \sigma - \Pi_{P_0} \sigma_h \right\Vert_{L^2} \f$ </th>
116  <th> N proc </th>
117  </tr>
118  <tr>
119  <td> 5 </td>
120  <td> 0.338269 </td>
121  <td> 0.411764 </td>
122  <td> 3 </td>
123  </tr>
124  <tr>
125  <td> 10 </td>
126  <td> 0.166443 </td>
127  <td> 0.204983 </td>
128  <td> 3 </td>
129  </tr>
130  <tr>
131  <td> 20 </td>
132  <td> 0.0832153 </td>
133  <td> 0.102579 </td>
134  <td> 3 </td>
135  </tr>
136  <tr>
137  <td> 40 </td>
138  <td> 0.0416069 </td>
139  <td> 0.051361 </td>
140  <td> 32 </td>
141  </tr>
142  <tr>
143  <td> 80 </td>
144  <td> 0.0208047 </td>
145  <td> 0.0258553 </td>
146  <td> 96 </td>
147  </tr>
148  </table>
149  where N is the number of subdivisions for each boundary.
150  @image html darcy/3d.png "Example of the solution with N = 5."
151 */
153  // :
154  // public LifeV::Application
155 {
156 public:
157 
158  /* @name Constructors and destructor
159  */
160  //@{
161 
162  //! Constructor
163  darcy_linear ( int argc, char** argv );
164 
165 
166  //! Destructor
168 
169  //@}
170 
171  /* @name Methods
172  */
173  //@{
174 
175  //! To lunch the simulation
176  LifeV::Real run();
177 
178  //@}
179 
180 
181 private:
182  struct Private;
184 };
185 
186 #endif /* __darcy_H */
LifeV::Real run()
To lunch the simulation.
Definition: 3d/darcy.cpp:130
Includes.
Definition: 3d/darcy.hpp:152
~darcy_linear()
Destructor.
Definition: 3d/darcy.hpp:167
std::shared_ptr< Private > Members
Definition: 3d/darcy.hpp:182
darcy_linear(int argc, char **argv)
Constructor.
Definition: 3d/darcy.cpp:106
Private Members.
Definition: 3d/darcy.cpp:62