LifeV
/linear_function.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 #ifndef LF_HPP
28 #define LF_HPP
29 
30 #include <lifev/core/LifeV.hpp>
31 
32 // ===================================================
33 //! User functions
34 // ===================================================
35 
36 namespace LifeV
37 {
38 const Real Pi = 3.14159265358979323846264338328;
39 Real Pi2 = Pi* Pi;
40 
41 class AnalyticalSol
42 {
43 public:
44  inline Real operator() (Real t, Real x, Real y, Real z, UInt /*ic*/ = 0) const
45  {
46  return std::exp (-std::sin (Pi / 2 * t) ) * (x + y + z);
47  }
48  inline Real grad (UInt icoor, Real t , Real , Real , Real , UInt /*ic*/ = 0) const
49  {
50  switch (icoor)
51  {
52  case 1: // der_x
53  return std::exp (-std::sin (Pi / 2 * t) );
54  case 2: // der_y
55  return std::exp (-std::sin (Pi / 2 * t) );
56  case 3: // der_z
57  return std::exp (-std::sin (Pi / 2 * t) );
58  default:
59  return 0;
60  }
61  }
62 };
63 
64 //solution on the boundary
65 Real uexact ( const Real& t ,
66  const Real& x,
67  const Real& y,
68  const Real& z,
69  const ID& )
70 {
71  return std::exp (-std::sin (Pi / 2 * t) ) * (x + y + z);
72 }
73 
74 
75 Real source_in ( const Real& t ,
76  const Real& x,
77  const Real& y,
78  const Real& z,
79  const ID& )
80 {
81  return Pi2 / 4 * ( std::sin (Pi / 2 * t) + std::cos (Pi / 2 * t) * std::cos (Pi / 2 * t) ) * std::exp (-std::sin (Pi / 2 * t) ) * (x + y + z);
82 }
83 
84 
85 Real d0 ( const Real& ,
86  const Real& x,
87  const Real& y,
88  const Real& z,
89  const ID& )
90 {
91  return x + y + z;
92 }
93 
94 Real v0 ( const Real& t ,
95  const Real& x,
96  const Real& y,
97  const Real& z,
98  const ID& )
99 {
100  return -Pi / 2 * std::cos (Pi / 2 * t) * std::exp (-std::sin (Pi / 2 * t) ) * (x + y + z);
101 }
102 
103 Real a0 ( const Real& t ,
104  const Real& x,
105  const Real& y,
106  const Real& z,
107  const ID& )
108 {
109  return Pi2 / 4 * ( std::sin (Pi / 2 * t) + std::cos (Pi / 2 * t) * std::cos (Pi / 2 * t) ) * std::exp (-std::sin (Pi / 2 * t) ) * (x + y + z);
110 }
111 
112 Real UOne ( const Real& /* t */,
113  const Real& ,
114  const Real& ,
115  const Real& ,
116  const ID& )
117 {
118  return 1.;
119 }
120 
121 Real UZero ( const Real& /* t */,
122  const Real& ,
123  const Real& ,
124  const Real& ,
125  const ID& )
126 {
127  return 0.;
128 }
129 
130 }
131 
132 #endif
Real UOne(const Real &, const Real &, const Real &, const Real &, const ID &)
Real grad(UInt icoor, Real t, Real, Real, Real, UInt=0) const
Real uexact(const Real &t, const Real &x, const Real &y, const Real &z, const ID &)
uint32_type ID
IDs.
Definition: LifeV.hpp:194
double Real
Generic real data.
Definition: LifeV.hpp:175
Real source_in(const Real &t, const Real &x, const Real &y, const Real &z, const ID &)
Real operator()(Real t, Real x, Real y, Real z, UInt=0) const
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
Real UZero(const Real &, const Real &, const Real &, const Real &, const ID &)
Real v0(const Real &t, const Real &x, const Real &y, const Real &z, const ID &)