LifeV
nonlinear_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 NLF_HPP
28 #define NLF_HPP
29 
30 #include <lifev/core/LifeV.hpp>
31 
32 // ===================================================
33 //! User functions
34 // ===================================================
35 
36 namespace LifeV
37 {
38 
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) ) * std::cos (Pi * x) * std::cos (Pi * y) * std::cos (Pi * z);
47  }
48  inline Real grad (UInt icoor, Real t, Real x, Real y, Real z, UInt /*ic*/ = 0) const
49  {
50  switch (icoor)
51  {
52  case 1:
53  return -Pi * std::exp (-std::sin (Pi / 2 * t) ) * std::sin (Pi * x) * std::cos (Pi * y) * std::cos (Pi * z);
54  case 2:
55  return -Pi * std::exp (-std::sin (Pi / 2 * t) ) * std::cos (Pi * x) * std::sin (Pi * y) * std::cos (Pi * z);
56  case 3:
57  return -Pi * std::exp (-std::sin (Pi / 2 * t) ) * std::cos (Pi * x) * std::cos (Pi * y) * std::sin (Pi * z);
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& icomp)
70 {
71  return std::exp (-std::sin (Pi / 2 * t) ) * std::cos (Pi * x) * std::cos (Pi * y) * std::cos (Pi * 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& icomp)
80 {
81  return (3 * Pi - 1. / 2.*std::cos (Pi / 2 * t) ) * Pi * std::exp (-std::sin (Pi / 2 * t) ) * std::cos (Pi * x) * std::cos (Pi * y) * std::cos (Pi * z);
82 }
83 
84 
85 Real d0 ( const Real& t ,
86  const Real& x,
87  const Real& y,
88  const Real& z,
89  const ID& icomp)
90 {
91  return std::exp (-std::sin (Pi / 2.*t) ) * std::cos (Pi * x) * std::cos (Pi * y) * std::cos (Pi * z) ;
92 }
93 
94 Real v0 ( const Real& t ,
95  const Real& x,
96  const Real& y,
97  const Real& z,
98  const ID& icomp)
99 {
100  return Pi / 2.* (std::cos (Pi * x) * std::cos (Pi * y) * std::cos (Pi * z) ) * std::cos (Pi / 2.*t) * std::exp (-std::sin (Pi / 2.*t) );
101 }
102 
103 Real a0 ( const Real& t ,
104  const Real& x,
105  const Real& y,
106  const Real& z,
107  const ID& icomp)
108 {
109  return Pi2 / 4 * ( std::sin (Pi / 2 * t) + std::cos (Pi / 2 * t) * std::cos (Pi / 2 * t) ) * (std::cos (Pi * x) * std::cos (Pi * y) * std::cos (Pi * z) ) * std::exp (-std::sin (Pi / 2 * t) ) ;
110 }
111 
112 Real UZero ( const Real& /* t */,
113  const Real& ,
114  const Real& ,
115  const Real& ,
116  const ID& )
117 {
118  return 0.;
119 }
120 
121 }
122 #endif
Real d0(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
void updateInverseJacobian(const UInt &iQuadPt)
uint32_type ID
IDs.
Definition: LifeV.hpp:194
double Real
Generic real data.
Definition: LifeV.hpp:175
Real operator()(Real t, Real x, Real y, Real z, UInt=0) const
Real grad(UInt icoor, 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