44 #include <lifev/one_d_fsi/fem/OneDFSIBC.hpp> 70 const fluxPtr_Type& fluxPtr, vectorPtrContainer_Type& rhs )
73 ( M_bcSide == OneDFSI::left ) ? iNode = 0 : iNode = fluxPtr->physics()->data()->numberOfNodes() - 1;
75 container2D_Type boundaryU;
76 boundaryU[0] = (*solution.find (
"A")->second) (iNode);
77 boundaryU[1] = (*solution.find (
"Q")->second) (iNode);
80 container2D_Type eigenvalues;
81 container2D_Type leftEigenvector1, leftEigenvector2;
83 fluxPtr->eigenValuesEigenVectors ( boundaryU[0], boundaryU[1],
84 eigenvalues, leftEigenvector1, leftEigenvector2, iNode );
86 std::map<bcLine_Type, container2D_Type> bcMatrix;
87 bcMatrix[ OneDFSI::first ] = container2D_Type();
88 bcMatrix[ OneDFSI::second ] = container2D_Type();
90 container2D_Type bcRHS;
93 computeMatrixAndRHS ( time, timeStep, fluxPtr, OneDFSI::first,
94 leftEigenvector1, leftEigenvector2, iNode, bcMatrix, bcRHS[0] );
97 computeMatrixAndRHS ( time, timeStep, fluxPtr, OneDFSI::second,
98 leftEigenvector1, leftEigenvector2, iNode, bcMatrix, bcRHS[1] );
101 container2D_Type bc = solveLinearSystem ( bcMatrix[OneDFSI::first], bcMatrix[OneDFSI::second], bcRHS );
104 (*rhs[0]) ( iNode ) = bc[0];
105 (*rhs[1]) ( iNode ) = bc[1];
107 #ifdef HAVE_LIFEV_DEBUG 108 debugStream (6311) <<
"[OneDFSIBC::applyBC] on bcSide " << M_bcSide <<
" imposing [ A, Q ] = [ " << bc[0] <<
", " << bc[1] <<
" ]\n";
116 ( M_bcSide == OneDFSI::left ) ? iNode = 0 : iNode = fluxPtr->physics()->data()->numberOfNodes() - 1;
118 switch ( M_bcType.find ( OneDFSI::first )->second )
124 #ifdef HAVE_NEUMANN_VISCOELASTIC_BC 132 matrix.diagonalize ( iNode, 1 );
139 std::cout <<
"Warning: bcType \"" << M_bcType.find ( OneDFSI::first )->second <<
"\"not available!" << std::endl;
150 const container2D_Type& leftEigenvector1,
const container2D_Type& leftEigenvector2,
151 const UInt& iNode, std::map<bcLine_Type, container2D_Type>& bcMatrix,
Real& bcRHS )
161 bcRHS = M_bcFunction[ line ] (time, timeStep);
162 switch ( M_bcType[line] )
165 bcMatrix[line] = leftEigenvector1;
168 bcMatrix[line] = leftEigenvector2;
171 bcMatrix[line][0] = 1.;
172 bcMatrix[line][1] = 0.;
179 bcRHS = fluxPtr->physics()->fromPToA ( bcRHS, timeStep, iNode );
180 bcMatrix[line][0] = 1.;
181 bcMatrix[line][1] = 0.;
185 if ( M_bcSide == OneDFSI::left )
189 bcMatrix[line][0] = 0.;
190 bcMatrix[line][1] = 1.;
193 std::cout <<
"\n[OneDFSIBC::computeMatrixAndRHS] Wrong boundary variable as " << line <<
" condition on bcSide " << M_bcSide;
197 #ifdef HAVE_LIFEV_DEBUG 198 debugStream (6311) <<
"[OneDFSIBC::computeMatrixAndRHS] to impose variable " 199 << M_bcType[line] <<
", " << line <<
" line = " << bcMatrix[line][0] <<
", " << bcMatrix[line][1] <<
"\n";
205 const container2D_Type& line2,
206 const container2D_Type& rhs )
const 208 #ifdef HAVE_LIFEV_DEBUG 209 ASSERT_PRE ( line1.size() == 2 && line2.size() == 2 && rhs.size() == 2,
210 "OneDFSIBC::solveLinearSystem works only for 2D vectors");
213 Real determinant = line1[0] * line2[1] - line1[1] * line2[0];
215 #ifdef HAVE_LIFEV_DEBUG 216 ASSERT ( determinant != 0,
217 "Error: the 2x2 system on the boundary is not invertible." 218 "\nCheck the boundary conditions.");
221 container2D_Type solution;
223 solution[0] = ( line2[1] * rhs[0] - line1[1] * rhs[1] ) / determinant;
224 solution[1] = ( - line2[0] * rhs[0] + line1[0] * rhs[1] ) / determinant;
void applyBC(const Real &time, const Real &timeStep, const solution_Type &solution, const fluxPtr_Type &fluxPtr, vectorPtrContainer_Type &rhs)
Apply boundary conditions to the rhs of the Taylor-Galerkin problem.
OneDFSIBC(const OneDFSIBC &bc)
Copy constructor.
void computeMatrixAndRHS(const Real &time, const Real &timeStep, const fluxPtr_Type &fluxPtr, const bcLine_Type &bcLine, const container2D_Type &leftEigenvector1, const container2D_Type &leftEigenvector2, const UInt &dof, std::map< bcLine_Type, container2D_Type > &bcMatrix, Real &bcRHS)
Compute the matrix and the RHS for the BC 2x2 linear system.
void updateInverseJacobian(const UInt &iQuadPt)
OneDFSIBC - Class featuring methods to handle boundary conditions.
void applyViscoelasticBC(const fluxPtr_Type &fluxPtr, matrix_Type &matrix, vector_Type &rhs)
Apply boundary conditions to the rhs of the viscoelastic problem.
double Real
Generic real data.
container2D_Type solveLinearSystem(const container2D_Type &line1, const container2D_Type &line2, const container2D_Type &rhs) const
Solve a 2x2 linear system by the Cramer method (for the boundary conditions)
OneDFSIBC(const bcSide_Type &bcSide)
Constructor.
uint32_type UInt
generic unsigned integer (used mainly for addressing)