LifeV
OneDFSISourceNonLinear.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 non 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/OneDFSISourceNonLinear.hpp>
43 
44 namespace LifeV
45 {
46 // ===================================================
47 // Methods
48 // ===================================================
49 Real
50 OneDFSISourceNonLinear::source ( const Real& A, const Real& Q, const ID& row, const UInt& iNode ) const
51 {
52  if ( row == 0 ) // B1
53  {
54  return 0.;
55  }
56  if ( row == 1 ) // B2
57  {
58  Real beta1plus1 ( M_physicsPtr->data()->beta1 ( iNode ) + 1 );
59  Real AoverA0 ( A / M_physicsPtr->data()->area0 ( iNode ) );
60  Real C0 ( 1 / ( M_physicsPtr->data()->densityRho() * beta1plus1 ) );
61  Real C ( 1 / ( M_physicsPtr->data()->densityRho() * beta1plus1 ) * OneDFSI::pow15 ( AoverA0, beta1plus1 ) );
62 
63  return ( M_physicsPtr->data()->friction() * Q / A
64  + Q * Q / A * M_physicsPtr->data()->dAlphadz ( iNode )
65  + C * ( M_physicsPtr->data()->area0 ( iNode ) * M_physicsPtr->data()->dBeta0dz ( iNode )
66  - M_physicsPtr->data()->beta0 ( iNode ) * M_physicsPtr->data()->beta1 ( iNode ) * M_physicsPtr->data()->dArea0dz ( iNode )
67  + M_physicsPtr->data()->area0 ( iNode ) * M_physicsPtr->data()->beta0 ( iNode )
68  * ( std::log ( AoverA0 ) - 1. / beta1plus1 ) * M_physicsPtr->data()->dBeta1dz ( iNode )
69  )
70  - C0 * ( M_physicsPtr->data()->area0 ( iNode ) * M_physicsPtr->data()->dBeta0dz ( iNode )
71  - M_physicsPtr->data()->beta0 ( iNode ) * M_physicsPtr->data()->beta1 ( iNode ) * M_physicsPtr->data()->dArea0dz ( iNode )
72  - M_physicsPtr->data()->area0 ( iNode ) * M_physicsPtr->data()->beta0 ( iNode ) / beta1plus1 * M_physicsPtr->data()->dBeta1dz ( iNode )
73  )
74  + ( M_physicsPtr->data()->area0 ( iNode ) - A ) / M_physicsPtr->data()->densityRho() * M_physicsPtr->data()->dBeta0dz ( iNode )
75  ) * M_physicsPtr->data()->robertsonCorrection();
76  }
77 
78  ERROR_MSG ("The flux function has only 2 components.");
79 
80  return -1.;
81 }
82 
83 Real
84 OneDFSISourceNonLinear::dSdU ( const Real& A, const Real& Q, const ID& row, const ID& column, const UInt& iNode) const
85 {
86  if ( row == 0 ) // B1
87  {
88  if ( column == 0 || column == 1 ) // dB2/dUj = 0
89  {
90  return 0.;
91  }
92  }
93  if ( row == 1 ) // B2
94  {
95  if ( column == 0 ) // dB2/dA
96  {
97  Real AoverA0 ( A / M_physicsPtr->data()->area0 ( iNode ) );
98  Real C ( OneDFSI::pow05 ( AoverA0, M_physicsPtr->data()->beta1 ( iNode ) ) / M_physicsPtr->data()->densityRho() );
99 
100  return ( -M_physicsPtr->data()->friction() * Q / A / A
101  - Q * Q / ( A * A ) * M_physicsPtr->data()->dAlphadz ( iNode )
102  + C * ( M_physicsPtr->data()->dBeta0dz ( iNode )
103  - M_physicsPtr->data()->beta0 ( iNode ) * M_physicsPtr->data()->beta1 ( iNode )
104  / M_physicsPtr->data()->area0 ( iNode ) * M_physicsPtr->data()->dArea0dz ( iNode )
105  + M_physicsPtr->data()->beta0 ( iNode ) * std::log ( AoverA0 ) * M_physicsPtr->data()->dBeta1dz ( iNode )
106  )
107  - 1. / M_physicsPtr->data()->densityRho() * M_physicsPtr->data()->dBeta0dz ( iNode )
108  ) * M_physicsPtr->data()->robertsonCorrection();
109  }
110  if ( column == 1 ) // dB2/dQ
111  {
112  return M_physicsPtr->data()->robertsonCorrection() * ( M_physicsPtr->data()->friction() / A +
113  2 * Q / A * M_physicsPtr->data()->dAlphadz ( iNode ) );
114  }
115  }
116 
117  ERROR_MSG ("Source's differential function has only 4 components.");
118 
119  return -1.;
120 }
121 
122 Real
124  const ID& row, const container2D_Type &bcNodes, const Real& cfl ) const
125 {
126  if ( row == 0 ) // QLS1
127  {
128  return 0.;
129  }
130  if ( row == 1 ) // QLS2
131  {
132  // Interpolate quantities
133  Real area0 = ( 1 - cfl ) * M_physicsPtr->data()->area0 (bcNodes[0]) + cfl * M_physicsPtr->data()->area0 (bcNodes[1]);
134  Real beta0 = ( 1 - cfl ) * M_physicsPtr->data()->beta0 (bcNodes[0]) + cfl * M_physicsPtr->data()->beta0 (bcNodes[1]);
135  Real beta1 = ( 1 - cfl ) * M_physicsPtr->data()->beta1 (bcNodes[0]) + cfl * M_physicsPtr->data()->beta1 (bcNodes[1]);
136  Real dArea0dz = ( 1 - cfl ) * M_physicsPtr->data()->dArea0dz (bcNodes[0]) + cfl * M_physicsPtr->data()->dArea0dz (bcNodes[1]);
137  Real dBeta0dz = ( 1 - cfl ) * M_physicsPtr->data()->dBeta0dz (bcNodes[0]) + cfl * M_physicsPtr->data()->dBeta0dz (bcNodes[1]);
138  Real dBeta1dz = ( 1 - cfl ) * M_physicsPtr->data()->dBeta1dz (bcNodes[0]) + cfl * M_physicsPtr->data()->dBeta1dz (bcNodes[1]);
139  Real dAlphadz = ( 1 - cfl ) * M_physicsPtr->data()->dAlphadz (bcNodes[0]) + cfl * M_physicsPtr->data()->dAlphadz (bcNodes[1]);
140 
141  Real AoverA0 ( A / area0 );
142  Real C ( A / M_physicsPtr->data()->densityRho() * OneDFSI::pow05 ( AoverA0, beta1 ) );
143 
144  return ( M_physicsPtr->data()->friction() * Q / A
145  + Q * Q / A * dAlphadz
146  + C * ( dBeta0dz
147  - beta0 * beta1 / area0 * dArea0dz
148  + beta0 * std::log ( AoverA0 ) * dBeta1dz
149  )
150  - A / M_physicsPtr->data()->densityRho() * dBeta0dz
151  ) * M_physicsPtr->data()->robertsonCorrection();
152  }
153 
154  ERROR_MSG ("The QLS function has only 2 components.");
155 
156  return -1.;
157 }
158 
159 }
void updateInverseJacobian(const UInt &iQuadPt)
#define ERROR_MSG(A)
Definition: LifeAssert.hpp:69
uint32_type ID
IDs.
Definition: LifeV.hpp:194
Real source(const Real &A, const Real &Q, const ID &row, const UInt &iNode) const
Evaluate the source term.
OneDFSISourceNonLinear - Class for the non-linear source function B of the 1D hyperbolic problem...
double Real
Generic real data.
Definition: LifeV.hpp:175
Real dSdU(const Real &A, const Real &Q, const ID &row, const ID &column, const UInt &iNode) const
Evaluate the derivative of the source term.
Real interpolatedNonConservativeSource(const Real &A, const Real &Q, 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...
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191