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 
40 class AnalyticalSol
41 {
42 public:
43  inline Real operator() (Real t, Real x, Real y, Real z, UInt /*ic*/ = 0) const
44  {
45  return exp (-sin (Pi / 2 * t) ) * (x + y + z);
46  }
47  inline Real grad (UInt icoor, Real t, Real /*x*/, Real /*y*/, Real /*z*/, UInt /*ic*/ = 0) const
48  {
49  switch (icoor)
50  {
51  case 1: // der_x
52  return exp (-sin (Pi / 2 * t) );
53  case 2: // der_y
54  return exp (-sin (Pi / 2 * t) );
55  case 3: // der_z
56  return exp (-sin (Pi / 2 * t) );
57  default:
58  return 0;
59  }
60  }
61 };
62 
63 //solution on the boundary
64 Real uexact ( const Real& t ,
65  const Real& x,
66  const Real& y,
67  const Real& z,
68  const ID& /*icomp*/)
69 {
70  return exp (-sin (Pi / 2 * t) ) * (x + y + z);
71 }
72 
73 
74 Real source_in ( const Real& t ,
75  const Real& x,
76  const Real& y,
77  const Real& z,
78  const ID& /*icomp*/)
79 {
80  return -Pi / 2 * cos (Pi / 2 * t) * exp (-sin (Pi / 2 * t) ) * (x + y + z) ;
81  // return (3*Pi*Pi-alpha)*exp(-alpha*t)*sin(Pi*x+Pi/2)*sin(Pi*y+Pi/2)*sin(Pi*z+Pi/2);
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 * cos (Pi / 2 * t) * exp (-sin (Pi / 2 * t) ) * (x + y + z);
101 }
102 
103 Real a0 ( const Real& ,
104  const Real& ,
105  const Real& ,
106  const Real& ,
107  const ID& )
108 {
109  return 0;
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 &)