LifeV
navier_stokes/examples/resistanceBCs/flowConditions.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 the boundary conditions for the Monolithic Test
30  *
31  * @date 2009-04-09
32  * @author Paolo Crosetto <crosetto@iacspc70.epfl.ch>
33  *
34  * @contributor Cristiano Malossi <cristiano.malossi@epfl.ch>
35  * @maintainer Paolo Crosetto <crosetto@iacspc70.epfl.ch>
36  */
37 
38 #include "flowConditions.hpp"
39 
40 #define PI 3.141592653589793
41 
42 namespace LifeV
43 {
44 FlowConditions::FlowConditions() :
45  pi (3.141592635),
46  M_outflux (0),
47  M_resistance (0),
48  M_hydrostaticP (0),
49  M_outP (0),
50  M_flag (0),
51  M_name ( ),
52  conditionNumber (0)
53 {
54  outputVector.push_back (0);
55  conditionNumber = FlowConditions::outputVector.size() - 1;
56 }
57 
58 
59 void FlowConditions::initParameters ( const int flag,
60  const Real resistance,
61  const Real hydrostatic,
62  const std::string name)
63 {
64  // In this function we set up the pressure and the resistance value
65  // The resistance BCs are applied as Neumann BCs using the flux at
66  // the previous time
67 
68  M_resistance = resistance;
69  M_hydrostaticP = hydrostatic;
70  M_flag = flag;
71  M_name = name;
72 
73 }
74 
75 void FlowConditions::renewParameters ( OseenSolver<RegionMesh<LinearTetra> >& solver,
76  const VectorEpetra& solution)
77 {
78 
79  // Compute the flux using the solution on the desired flag
80  M_outflux = solver.flux ( M_flag, solution);
81 
82  M_outP = 1.0 * ( M_resistance * M_outflux + M_hydrostaticP );
83 
84  FlowConditions::outputVector[conditionNumber] = M_outP;
85 }
86 
87 
88 
89 
90 Real FlowConditions::fZero (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
91 {
92  return 0.0;
93 }
94 
95 Real FlowConditions::outPressure0 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
96 {
97  return -FlowConditions::outputVector[0];
98 }
99 
100 Real FlowConditions::outPressure1 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
101 {
102  return -FlowConditions::outputVector[1];
103 }
104 
105 Real FlowConditions::outPressure2 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
106 {
107  return -FlowConditions::outputVector[2];
108 }
109 Real FlowConditions::outPressure3 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
110 {
111  return -FlowConditions::outputVector[3];
112 }
113 
114 Real FlowConditions::outPressure4 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
115 {
116  return -FlowConditions::outputVector[4];
117 }
118 
119 
120 Real FlowConditions::outPressure5 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
121 {
122  return -FlowConditions::outputVector[5];
123 }
124 
125 Real FlowConditions::outPressure6 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
126 {
127  return -FlowConditions::outputVector[6];
128 }
129 
130 std::vector<Real> FlowConditions::outputVector;
131 }
VectorEpetra - The Epetra Vector format Wrapper.
static Real outPressure1(const Real &, const Real &, const Real &, const Real &, const ID &)
static Real outPressure5(const Real &, const Real &, const Real &, const Real &, const ID &)
void updateInverseJacobian(const UInt &iQuadPt)
void renewParameters(OseenSolver< RegionMesh< LinearTetra > > &solver, const VectorEpetra &solution)
uint32_type ID
IDs.
Definition: LifeV.hpp:194
static Real outPressure4(const Real &, const Real &, const Real &, const Real &, const ID &)
void initParameters(const int outflowFlag, const Real resistance, const Real hydrostatic, const std::string name)
Real fZero(const Real &, const Real &, const Real &, const Real &, const ID &)
double Real
Generic real data.
Definition: LifeV.hpp:175
static Real outPressure6(const Real &, const Real &, const Real &, const Real &, const ID &)
static Real outPressure3(const Real &, const Real &, const Real &, const Real &, const ID &)
static Real outPressure2(const Real &, const Real &, const Real &, const Real &, const ID &)
static Real outPressure0(const Real &, const Real &, const Real &, const Real &, const ID &)