LifeV
NavierStokesEthierSteinman.cpp
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 /*!
28  @file NavierStokesEthierSteinman.cpp
29  @brief Navier-Stokes Ethier-Steinman problem
30 
31  @author Gwenol Grandperrin <gwenol.grandperrin@epfl.ch>
32  @date 19-08-2011
33  */
34 
35 #include <vector>
36 #include <lifev/core/mesh/RegionMesh3DStructured.hpp>
37 #include <lifev/core/fem/BCFunction.hpp>
38 #include <lifev/navier_stokes/function/RossEthierSteinmanDec.hpp>
39 #include <lifev/navier_stokes/function/RossEthierSteinmanInc.hpp>
40 #include <lifev/navier_stokes/examples/TestCases/NavierStokesEthierSteinman.hpp>
41 #include <lifev/core/mesh/MeshLoadingUtility.hpp>
42 
43 namespace LifeV
44 {
45 
46 // Walls
47 const Int NavierStokesEthierSteinman::LEFTWALL = 4;
48 const Int NavierStokesEthierSteinman::RIGHTWALL = 2;
49 const Int NavierStokesEthierSteinman::FRONTWALL = 1;
50 const Int NavierStokesEthierSteinman::BACKWALL = 3;
51 const Int NavierStokesEthierSteinman::TOPWALL = 6;
52 const Int NavierStokesEthierSteinman::BOTTOMWALL = 5;
53 // Edges
54 const Int NavierStokesEthierSteinman::BOTTOMEDGE1 = 7;
55 const Int NavierStokesEthierSteinman::BOTTOMEDGE2 = 8;
56 const Int NavierStokesEthierSteinman::BOTTOMEDGE3 = 9;
57 const Int NavierStokesEthierSteinman::BOTTOMEDGE4 = 10;
58 const Int NavierStokesEthierSteinman::SIDEEDGE1 = 11;
59 const Int NavierStokesEthierSteinman::SIDEEDGE2 = 12;
60 const Int NavierStokesEthierSteinman::SIDEEDGE3 = 13;
61 const Int NavierStokesEthierSteinman::SIDEEDGE4 = 14;
62 const Int NavierStokesEthierSteinman::TOPEDGE1 = 15;
63 const Int NavierStokesEthierSteinman::TOPEDGE2 = 16;
64 const Int NavierStokesEthierSteinman::TOPEDGE3 = 17;
65 const Int NavierStokesEthierSteinman::TOPEDGE4 = 18;
66 // Corners
67 const Int NavierStokesEthierSteinman::BOTTOMCORNER1 = 19;
68 const Int NavierStokesEthierSteinman::BOTTOMCORNER2 = 20;
69 const Int NavierStokesEthierSteinman::BOTTOMCORNER3 = 21;
70 const Int NavierStokesEthierSteinman::BOTTOMCORNER4 = 22;
71 const Int NavierStokesEthierSteinman::TOPCORNER1 = 23;
72 const Int NavierStokesEthierSteinman::TOPCORNER2 = 24;
73 const Int NavierStokesEthierSteinman::TOPCORNER3 = 25;
74 const Int NavierStokesEthierSteinman::TOPCORNER4 = 26;
75 
76 NavierStokesEthierSteinman::NavierStokesEthierSteinman()
77  : NavierStokesProblem< esMesh_Type >()
78 {
79  RossEthierSteinmanUnsteadyDec::setA ( 1.0 );
80  RossEthierSteinmanUnsteadyDec::setD ( 1.0 );
81  RossEthierSteinmanUnsteadyDec::setViscosity ( M_viscosity );
82  RossEthierSteinmanUnsteadyDec::setDensity ( M_density );
83 }
84 
85 NavierStokesEthierSteinman::~NavierStokesEthierSteinman()
86 {
87 
88 }
89 
90 bool
91 NavierStokesEthierSteinman::hasExactSolution() const
92 {
93  return true;
94 }
95 
96 NavierStokesProblem< esMesh_Type >::function_Type
97 NavierStokesEthierSteinman::xexact()
98 {
99  return RossEthierSteinmanUnsteadyDec::xexact;
100 }
101 
102 NavierStokesProblem< esMesh_Type >::function_Type
103 NavierStokesEthierSteinman::uexact()
104 {
105  return RossEthierSteinmanUnsteadyDec::uexact;
106 }
107 
108 NavierStokesProblem< esMesh_Type >::function_Type
109 NavierStokesEthierSteinman::uderexact()
110 {
111  return RossEthierSteinmanUnsteadyDec::uderexact;
112 }
113 
114 NavierStokesProblem< esMesh_Type >::function_Type
115 NavierStokesEthierSteinman::pexact()
116 {
117  return RossEthierSteinmanUnsteadyDec::pexact;
118 }
119 
120 void
121 NavierStokesEthierSteinman::showMe ( std::ostream& output ) const
122 {
123  output << "To be implemented";
124 }
125 
126 void
127 NavierStokesEthierSteinman::setViscosity ( const Real& viscosity )
128 {
129  NavierStokesProblem< esMesh_Type >::setViscosity ( viscosity );
130  RossEthierSteinmanUnsteadyDec::setViscosity ( viscosity );
131 }
132 
133 void
134 NavierStokesEthierSteinman::setDensity ( const Real& density )
135 {
136  NavierStokesProblem< esMesh_Type >::setDensity ( density );
137  RossEthierSteinmanUnsteadyDec::setDensity ( density );
138 }
139 
140 void
141 NavierStokesEthierSteinman::mesh ( std::shared_ptr< RegionMesh<LinearTetra> >& mesh ) const
142 {
143  if ( M_refinement == 0 )
144  {
145  std::cout << "ERROR: The mesh refinement requested is not valid." << std::endl;
146  exit ( 0 );
147  }
148  std::vector<Real> width (3, -1.0);
149  std::vector<Real> shift (3, -1.0);
150  std::vector<UInt> numMeshElem (3, M_refinement);
151  MeshUtility::loadStructuredMesh ( mesh, 1, numMeshElem, false, width, shift );
152 
153 }
154 
155 void
156 NavierStokesEthierSteinman::boundaryConditions ( std::shared_ptr<BCHandler> bcHandler ) const
157 {
158  BCFunctionBase uDirichlet ( RossEthierSteinmanUnsteadyDec::uexact );
159  BCFunctionBase uNeumann ( RossEthierSteinmanUnsteadyDec::fNeumann );
160 
161  bcHandler->addBC ( "Flux", FRONTWALL, Natural, Full, uNeumann, 3 );
162 
163  bcHandler->addBC ( "Top" , TOPWALL , LifeV::Essential , Full, uDirichlet, 3 );
164  bcHandler->addBC ( "Top" , TOPEDGE1 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
165  bcHandler->addBC ( "Top" , TOPEDGE2 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
166  bcHandler->addBC ( "Top" , TOPEDGE3 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
167  bcHandler->addBC ( "Top" , TOPEDGE4 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
168  bcHandler->addBC ( "Top" , TOPCORNER1 , LifeV::EssentialVertices, Full, uDirichlet, 3 );
169  bcHandler->addBC ( "Top" , TOPCORNER2 , LifeV::EssentialVertices, Full, uDirichlet, 3 );
170  bcHandler->addBC ( "Top" , TOPCORNER3 , LifeV::EssentialVertices, Full, uDirichlet, 3 );
171  bcHandler->addBC ( "Top" , TOPCORNER4 , LifeV::EssentialVertices, Full, uDirichlet, 3 );
172  bcHandler->addBC ( "Left" , LEFTWALL , LifeV::Essential , Full, uDirichlet, 3 );
173  bcHandler->addBC ( "Left" , SIDEEDGE1 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
174  bcHandler->addBC ( "Left" , SIDEEDGE4 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
175  bcHandler->addBC ( "Right" , RIGHTWALL , LifeV::Essential , Full, uDirichlet, 3 );
176  bcHandler->addBC ( "Right" , SIDEEDGE2 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
177  bcHandler->addBC ( "Right" , SIDEEDGE3 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
178  bcHandler->addBC ( "Back" , BACKWALL , LifeV::Essential , Full, uDirichlet, 3 );
179  bcHandler->addBC ( "Bottom", BOTTOMWALL , LifeV::Essential , Full, uDirichlet, 3 );
180  bcHandler->addBC ( "Bottom", BOTTOMEDGE1 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
181  bcHandler->addBC ( "Bottom", BOTTOMEDGE2 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
182  bcHandler->addBC ( "Bottom", BOTTOMEDGE3 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
183  bcHandler->addBC ( "Bottom", BOTTOMEDGE4 , LifeV::EssentialEdges , Full, uDirichlet, 3 );
184  bcHandler->addBC ( "Bottom", BOTTOMCORNER1, LifeV::EssentialVertices, Full, uDirichlet, 3 );
185  bcHandler->addBC ( "Bottom", BOTTOMCORNER2, LifeV::EssentialVertices, Full, uDirichlet, 3 );
186  bcHandler->addBC ( "Bottom", BOTTOMCORNER3, LifeV::EssentialVertices, Full, uDirichlet, 3 );
187  bcHandler->addBC ( "Bottom", BOTTOMCORNER4, LifeV::EssentialVertices, Full, uDirichlet, 3 );
188 }
189 
190 std::string
191 NavierStokesEthierSteinman::name() const
192 {
193  return "Ethier-Steinman problem";
194 }
195 
196 } // namespace LifeV
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
double Real
Generic real data.
Definition: LifeV.hpp:175