40 #define PI 3.141592653589793
45 ResistanceBCs::ResistanceBCs() :
55 outputVector.push_back (0);
56 conditionNumber = ResistanceBCs::outputVector.size() - 1;
60 void ResistanceBCs::initParameters (
const int flag,
61 const Real resistance,
62 const Real hydrostatic,
63 const std::string name)
69 M_resistance = resistance;
70 M_hydrostaticP = hydrostatic;
76 void ResistanceBCs::renewParameters ( OseenSolverShapeDerivative<RegionMesh<LinearTetra> >& solver,
77 const VectorEpetra& solution,
82 M_resistance = computeResistance ( time );
85 M_outflux = solver.flux ( M_flag, solution);
87 M_outP = 1.0 * ( M_resistance * M_outflux + M_hydrostaticP );
89 solver.getDisplayer().leaderPrint (
" ****************** Resistance BCs infos ***************************x\n" );
90 solver.getDisplayer().leaderPrint (
" Flow rate = " , M_outflux );
91 solver.getDisplayer().leaderPrint (
" \n" );
92 solver.getDisplayer().leaderPrint (
" Area Inlet = " , solver.area (2) );
93 solver.getDisplayer().leaderPrint (
" \n" );
94 solver.getDisplayer().leaderPrint (
" Area Outlet = ", solver.area (3) );
95 solver.getDisplayer().leaderPrint (
" \n" );
96 solver.getDisplayer().leaderPrint (
" Hydrostatic pressure = " , M_hydrostaticP );
97 solver.getDisplayer().leaderPrint (
" \n" );
98 solver.getDisplayer().leaderPrint (
" Resistance = " , M_resistance );
99 solver.getDisplayer().leaderPrint (
" \n" );
100 solver.getDisplayer().leaderPrint (
" Outflow pressure = " , M_outP );
101 solver.getDisplayer().leaderPrint (
" \n" );
102 solver.getDisplayer().leaderPrint (
" ****************** Resistance BCs infos ***************************" );
104 ResistanceBCs::outputVector[conditionNumber] = M_outP;
107 Real ResistanceBCs::computeResistance (
const Real t )
111 Real highestResistance ( 501950 );
112 Real totalTime = 1.012;
113 Real halfTime = totalTime / 3.0;
115 Real m = ( 0.8 * highestResistance ) / ( totalTime - halfTime );
119 resistance = ( ( highestResistance / 5 ) / ( halfTime ) ) * t ;
122 if ( t > halfTime && t <= totalTime)
124 resistance = m * (t - halfTime ) + highestResistance / 5 ;
129 resistance = highestResistance;
147 Real ResistanceBCs::fZero (
const Real& ,
const Real& ,
const Real& ,
const Real& ,
const ID& )
152 Real ResistanceBCs::outPressure0 (
const Real& ,
const Real& ,
const Real& ,
const Real& ,
const ID& )
154 return -ResistanceBCs::outputVector[0];
157 Real ResistanceBCs::outPressure1 (
const Real& ,
const Real& ,
const Real& ,
const Real& ,
const ID& )
159 return -ResistanceBCs::outputVector[1];
162 Real ResistanceBCs::outPressure2 (
const Real& ,
const Real& ,
const Real& ,
const Real& ,
const ID& )
164 return -ResistanceBCs::outputVector[2];
166 Real ResistanceBCs::outPressure3 (
const Real& ,
const Real& ,
const Real& ,
const Real& ,
const ID& )
168 return -ResistanceBCs::outputVector[3];
171 Real ResistanceBCs::outPressure4 (
const Real& ,
const Real& ,
const Real& ,
const Real& ,
const ID& )
173 return -ResistanceBCs::outputVector[4];
177 Real ResistanceBCs::outPressure5 (
const Real& ,
const Real& ,
const Real& ,
const Real& ,
const ID& )
179 return -ResistanceBCs::outputVector[5];
182 Real ResistanceBCs::outPressure6 (
const Real& ,
const Real& ,
const Real& ,
const Real& ,
const ID& )
184 return -ResistanceBCs::outputVector[6];
187 std::vector<Real> ResistanceBCs::outputVector;
192 ImplicitResistance::ImplicitResistance() :
193 bcVectorResistance( ),
200 void ImplicitResistance::setQuantities ( FSIOperator& _oper,
201 const Real resistance )
204 fluidVector.reset(
new FSIOperator::vector_Type( _oper.uFESpacePtr()->map(), Repeated ) );
205 fluidVector->epetraVector().PutScalar(0.0);
207 bcVectorResistance.setRhsVector( *fluidVector,_oper.uFESpacePtr()->dof().numTotalDof(),1);
208 bcVectorResistance.setResistanceCoeff( resistance );