LifeV
OneDFSISourceLinear.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
29  * @brief File containing a class for the linear source function B of the 1D hyperbolic problem
30  *
31  * @version 1.0
32  * @author Vincent Martin
33  *
34  * @version 2.0
35  * @date 15-04-2010
36  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
37  *
38  * @contributor Simone Rossi <simone.rossi@epfl.ch>
39  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
40  */
41 
42 #include <lifev/one_d_fsi/solver/OneDFSISourceLinear.hpp>
43 
44 namespace LifeV
45 {
46 // ===================================================
47 // Methods
48 // ===================================================
49 Real
50 OneDFSISourceLinear::source ( const Real& U1, const Real& U2, const ID& row, const UInt& iNode ) const
51 {
52  if ( row == 0 ) // S1
53  {
54  return M_physicsPtr->data()->source10 ( iNode ) +
55  M_physicsPtr->data()->source11 ( iNode ) * U1 +
56  M_physicsPtr->data()->source12 ( iNode ) * U2;
57  }
58  if ( row == 1 ) // S2
59  {
60  return M_physicsPtr->data()->source20 ( iNode ) +
61  M_physicsPtr->data()->source21 ( iNode ) * U1 +
62  M_physicsPtr->data()->source22 ( iNode ) * U2;
63  }
64  ERROR_MSG ("The flux function has only 2 components.");
65  return -1.;
66 }
67 
68 Real
69 OneDFSISourceLinear::dSdU ( const Real& /*U1*/, const Real& /*U2*/, const ID& row, const ID& column, const UInt& iNode ) const
70 {
71  if ( row == 0 && column == 0) // dS1/dU1 = 0
72  {
73  return M_physicsPtr->data()->source11 ( iNode );
74  }
75  if ( row == 0 && column == 1) // dS1/dU2 = 0
76  {
77  return M_physicsPtr->data()->source12 ( iNode );
78  }
79  if ( row == 1 && column == 0 ) // dS2/dU1
80  {
81  return M_physicsPtr->data()->source21 ( iNode );
82  }
83  if ( row == 1 && column == 1 ) // dS2/dU2
84  {
85  return M_physicsPtr->data()->source22 ( iNode );
86  }
87  ERROR_MSG ("Source's differential function has only 4 components.");
88  return -1.;
89 }
90 
91 Real
93  const ID& row, const container2D_Type& bcNodes, const Real& /*cfl*/ ) const
94 {
95  //TODO Implement the interpolation as done for the non-linear case
96  return this->source (U1, U2, row, bcNodes[0]);
97 }
98 
99 }
Real source(const Real &U1, const Real &U2, const ID &row, const UInt &iNode) const
Evaluate the source term.
OneDFSISourceLinear - Class for the linear source function S of the 1D hyperbolic problem...
void updateInverseJacobian(const UInt &iQuadPt)
#define ERROR_MSG(A)
Definition: LifeAssert.hpp:69
uint32_type ID
IDs.
Definition: LifeV.hpp:194
Real interpolatedNonConservativeSource(const Real &U1, const Real &U2, const ID &row, const container2D_Type &bcNodes, const Real &cfl) const
Evaluate the non-conservative form of the source term at the foot of the outgoing characteristic...
Real dSdU(const Real &U1, const Real &U2, const ID &row, const ID &colum, const UInt &iNode) const
Evaluate the derivative of the source term.
double Real
Generic real data.
Definition: LifeV.hpp:175
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191