LifeV
navier_stokes_blocks/examples/example_external_flow/ud_functions.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 /*!
28  * @file
29  * @brief File containing the functions for BCs
30  *
31  * @author Davide Forti <davide.forti@epfl.ch>
32  *
33  */
34 
35 #ifndef UDFNS_HPP
36 #define UDFNS_HPP
37 
38 // LifeV includes
39 #include <lifev/core/LifeV.hpp>
40 
41 namespace LifeV
42 {
43 
44 Real zeroFunction(const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
45 {
46  return 0.0;
47 }
48 
49 Real inflowFunction(const Real& t, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& i)
50 {
51  if (i == 0)
52  {
53  Real ux = 22.0;
54  Real T_ramp = 0.3;
55  Real inflowVel;
56 
57  if ( t <= T_ramp )
58  {
59  inflowVel = ux/2.0*(1.0-std::cos(M_PI/T_ramp*t));
60  }
61  else
62  {
63  inflowVel = ux;
64  }
65  return inflowVel;
66  }
67  else
68  {
69  return 0;
70  }
71 
72 }
73 
74 Real oneFunctionX(const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& i)
75 {
76  if(i==0)
77  {
78  return 1.0;
79  }
80  else
81  {
82  return 0.0;
83  }
84 }
85 
86 Real oneFunctionY(const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& i)
87 {
88  if(i==1)
89  {
90  return 1.0;
91  }
92  else
93  {
94  return 0.0;
95  }
96 }
97 
98 }
99 
100 #endif
Real oneFunctionX(const Real &, const Real &, const Real &, const Real &, const ID &i)
#define M_PI
Definition: winmath.h:20
uint32_type ID
IDs.
Definition: LifeV.hpp:194
double Real
Generic real data.
Definition: LifeV.hpp:175
Real inflowFunction(const Real &t, const Real &, const Real &, const Real &, const ID &i)
Real zeroFunction(const Real &, const Real &, const Real &, const Real &, const ID &)
Real oneFunctionY(const Real &, const Real &, const Real &, const Real &, const ID &i)