49 #include <lifev/one_d_fsi/solver/OneDFSISolver.hpp> 95 std::fill ( M_dFdUVector.begin(), M_dFdUVector.end(), ublas::zero_vector<Real> ( M_physicsPtr->data()->numberOfNodes() ) );
96 std::fill ( M_dSdUVector.begin(), M_dSdUVector.end(), ublas::zero_vector<Real> ( M_physicsPtr->data()->numberOfNodes() ) );
98 for (
UInt i (0); i < 4; ++i )
100 M_dSdUMassMatrixPtr[i].reset (
new matrix_Type ( M_feSpacePtr->map() ) );
101 M_dFdUStiffnessMatrixPtr[i].reset (
new matrix_Type ( M_feSpacePtr->map() ) );
102 M_dFdUGradientMatrixPtr[i].reset (
new matrix_Type ( M_feSpacePtr->map() ) );
103 M_dSdUDivergenceMatrixPtr[i].reset (
new matrix_Type ( M_feSpacePtr->map() ) );
107 for ( UInt iElement (0); iElement < M_physicsPtr->data()->numberOfElements(); ++iElement )
110 M_elementalMassMatrixPtr->zero();
111 M_elementalGradientMatrixPtr->zero();
114 M_feSpacePtr->fe().update ( M_feSpacePtr->mesh()->edgeList ( iElement ), UPDATE_DPHI | UPDATE_WDET );
117 AssemblyElemental::mass ( 1, *M_elementalMassMatrixPtr, M_feSpacePtr->fe(), 0, 0 );
118 AssemblyElemental::grad ( 0 , -1, *M_elementalGradientMatrixPtr, M_feSpacePtr->fe(), M_feSpacePtr->fe(), 0, 0 );
121 assembleMatrix ( *M_homogeneousMassMatrixPtr, *M_elementalMassMatrixPtr, M_feSpacePtr->fe(), M_feSpacePtr->dof() , 0, 0, 0, 0 );
122 assembleMatrix ( *M_homogeneousGradientMatrixPtr, *M_elementalGradientMatrixPtr, M_feSpacePtr->fe(), M_feSpacePtr->dof() , 0, 0, 0, 0 );
126 M_homogeneousMassMatrixPtr->globalAssemble();
127 M_homogeneousGradientMatrixPtr->globalAssemble();
132 matrix_Type systemMatrix ( *M_homogeneousMassMatrixPtr );
133 applyDirichletBCToMatrix ( systemMatrix );
134 M_linearSolverPtr->setMatrix ( systemMatrix );
140 solution[
"Q"].reset (
new vector_Type ( map ) );
141 solution[
"P"].reset (
new vector_Type ( map ) );
142 solution[
"AoverA0minus1"].reset (
new vector_Type ( map ) );
144 if ( onlyMainQuantities )
149 solution[
"A"].reset (
new vector_Type ( map ) );
150 solution[
"W1"].reset (
new vector_Type ( map ) );
151 solution[
"W2"].reset (
new vector_Type ( map ) );
154 if ( M_physicsPtr->data()->viscoelasticWall() )
156 solution[
"Q_visc"].reset (
new vector_Type ( map ) );
157 solution[
"P_visc"].reset (
new vector_Type ( map ) );
161 if ( M_physicsPtr->data()->inertialWall() )
163 solution[
"Q_inert"].reset (
new vector_Type ( map ) );
167 if ( M_physicsPtr->data()->longitudinalWall() )
169 solution[
"Q_long"].reset (
new vector_Type ( map ) );
173 for ( solutionConstIterator_Type i = solution.begin(); i != solution.end(); ++i )
182 for ( UInt iNode (0); iNode < M_physicsPtr->data()->numberOfNodes() ; ++iNode )
184 (*solution[
"A"]) [iNode] = M_physicsPtr->data()->area0 ( iNode );
185 (*solution[
"Q"]) [iNode] = 0;
195 M_physicsPtr->setArea_tn ( *solution[
"A"] );
196 computePressure ( solution, M_physicsPtr->data()->dataTime()->timeStep() );
202 for ( UInt iNode (0); iNode < M_physicsPtr->data()->numberOfNodes() ; ++iNode )
204 M_physicsPtr->fromUToW ( ( *solution[
"W1"]) [iNode], (*solution[
"W2"]) [iNode],
205 ( *solution[
"A"] ) [iNode], (*solution[
"Q"] ) [iNode], iNode );
212 for ( UInt iNode (0); iNode < M_physicsPtr->data()->numberOfNodes() ; ++iNode )
214 ( *solution[
"P"] ) [iNode] = M_physicsPtr->elasticPressure ( ( *solution[
"A"] ) [iNode], iNode )
215 + M_physicsPtr->externalPressure();
217 if ( M_physicsPtr->data()->viscoelasticWall() )
219 ( *solution[
"P_visc"] ) [iNode] = M_physicsPtr->viscoelasticPressure ( ( *solution[
"A"]) [iNode], timeStep, iNode );
220 ( *solution[
"P"] ) [iNode] += ( *solution[
"P_visc"] ) [iNode];
228 for ( UInt iNode (0); iNode < M_physicsPtr->data()->numberOfNodes() ; ++iNode )
230 ( *solution[
"AoverA0minus1"] ) [iNode] = ( *solution[
"A"] ) [iNode] / M_physicsPtr->data()->area0 ( iNode ) - 1;
237 for ( UInt iNode (0); iNode < M_physicsPtr->data()->numberOfNodes() ; ++iNode )
239 ( *solution[
"A"] ) [iNode] = ( (*solution[
"AoverA0minus1"] ) [iNode] + 1 ) * M_physicsPtr->data()->area0 ( iNode );
259 Real dt2over2 = timeStep * timeStep * 0.5;
265 for (
UInt i (0); i < 2; ++i )
268 *M_residual[i] += ( *M_homogeneousGradientMatrixPtr ) * ( timeStep * *M_fluxVector[i] );
271 *M_residual[i] += ( *M_homogeneousMassMatrixPtr ) * ( - timeStep * *M_sourceVector[i] );
273 for (
UInt j (0); j < 2; ++j )
276 M_dFdUGradientMatrixPtr[2 * i + j]->globalAssemble();
277 *M_residual[i] += *M_dFdUGradientMatrixPtr[2 * i + j] * ( -dt2over2 * *M_sourceVector[j] );
280 M_dSdUDivergenceMatrixPtr[2 * i + j]->globalAssemble();
281 *M_residual[i] += *M_dSdUDivergenceMatrixPtr[2 * i + j] * ( dt2over2 * *M_fluxVector[j] );
284 M_dFdUStiffnessMatrixPtr[2 * i + j]->globalAssemble();
285 *M_residual[i] += *M_dFdUStiffnessMatrixPtr[2 * i + j] * ( -dt2over2 * *M_fluxVector[j] );
288 M_dSdUMassMatrixPtr[2 * i + j]->globalAssemble();
289 *M_residual[i] += *M_dSdUMassMatrixPtr[2 * i + j] * ( dt2over2 * *M_sourceVector[j] );
294 *M_rhs[0] = *M_residual[0] + ( *M_homogeneousMassMatrixPtr ) * *solution.find (
"A")->second;
295 *M_rhs[1] = *M_residual[1] + ( *M_homogeneousMassMatrixPtr ) * *solution.find (
"Q")->second;
297 if ( M_physicsPtr->data()->viscoelasticWall() )
299 *M_rhs[1] -= ( *M_homogeneousMassMatrixPtr ) * *solution.find (
"Q_visc")->second;
311 M_linearSolverPtr->solveSystem ( *M_rhs[0], area, M_homogeneousMassMatrixPtr );
315 M_linearSolverPtr->solveSystem ( *M_rhs[1], flowRate, M_homogeneousMassMatrixPtr );
318 if ( M_physicsPtr->data()->inertialWall() )
320 *solution[
"Q_inert"] = inertialFlowRateCorrection ( flowRate );
321 flowRate += *solution[
"Q_inert"];
324 if ( M_physicsPtr->data()->viscoelasticWall() )
326 *solution[
"Q_visc"] = viscoelasticFlowRateCorrection ( area, flowRate, *solution.find (
"Q_visc")->second, timeStep, bcHandler );
327 flowRate += *solution[
"Q_visc"];
330 if ( M_physicsPtr->data()->longitudinalWall() )
332 *solution[
"Q_long"] = longitudinalFlowRateCorrection();
333 flowRate += *solution[
"Q_long"];
337 *solution[
"A"] = area;
338 *solution[
"Q"] = flowRate;
354 const bool& updateSystemMatrix )
358 matrix_Type stiffnessMatrix ( M_feSpacePtr->map() );
360 Real massCoefficient;
361 Real stiffnessCoefficient;
368 for ( UInt iElement (0); iElement < M_physicsPtr->data()->numberOfElements() ; ++iElement )
371 M_feSpacePtr->fe().update ( M_feSpacePtr->mesh()->edgeList (iElement), UPDATE_DPHI | UPDATE_WDET );
374 massCoefficient = 1 / ( 0.5 * ( newArea[ iElement ] + newArea[ iElement + 1 ] ) );
378 stiffnessCoefficient = timeStep * 0.5 * ( M_physicsPtr->data()->viscoelasticCoefficient ( iElement ) + M_physicsPtr->data()->viscoelasticCoefficient ( iElement + 1 ) )
379 / M_physicsPtr->data()->densityRho() * massCoefficient * std::sqrt ( massCoefficient );
382 M_elementalMassMatrixPtr->zero();
383 M_elementalStiffnessMatrixPtr->zero();
386 AssemblyElemental::mass ( massCoefficient, *M_elementalMassMatrixPtr, M_feSpacePtr->fe(), 0, 0 );
387 AssemblyElemental::stiff ( stiffnessCoefficient, *M_elementalStiffnessMatrixPtr, M_feSpacePtr->fe(), 0, 0 );
390 assembleMatrix ( massMatrix, *M_elementalMassMatrixPtr, M_feSpacePtr->fe(), M_feSpacePtr->dof(), 0, 0, 0, 0 );
391 assembleMatrix ( stiffnessMatrix, *M_elementalStiffnessMatrixPtr, M_feSpacePtr->fe(), M_feSpacePtr->dof(), 0, 0, 0, 0 );
396 rhs ( 0 ) -= stiffnessCoefficient * M_fluxPtr->physics()->data()->computeSpatialDerivativeAtNode ( newElasticFlowRate, 0, 1 );
398 if ( iElement == M_physicsPtr->data()->numberOfElements() - 1 )
400 rhs ( iElement + 1 ) += stiffnessCoefficient * M_fluxPtr->physics()->data()->computeSpatialDerivativeAtNode ( newElasticFlowRate, iElement + 1, 1 );
405 massMatrix.globalAssemble();
406 stiffnessMatrix.globalAssemble();
409 rhs += massMatrix * (oldViscoelasticFlowRate) + stiffnessMatrix * (-newElasticFlowRate);
412 massMatrix += stiffnessMatrix;
415 bcHandler.applyViscoelasticBC ( M_fluxPtr, massMatrix, rhs );
420 if ( updateSystemMatrix )
422 M_linearViscoelasticSolverPtr->setMatrix ( massMatrix );
424 M_linearViscoelasticSolverPtr->solveSystem ( rhs, newViscoelasticFlowRate, M_homogeneousMassMatrixPtr );
426 return newViscoelasticFlowRate;
432 Real lambdaMax ( 0. );
434 container2D_Type eigenvalues;
435 container2D_Type leftEigenvector1;
436 container2D_Type leftEigenvector2;
438 for ( UInt iNode (0); iNode < M_physicsPtr->data()->numberOfNodes() ; ++iNode )
441 M_fluxPtr->eigenValuesEigenVectors ( ( *solution.find (
"A")->second ) ( iNode ),
442 ( *solution.find (
"Q")->second ) ( iNode ),
443 eigenvalues, leftEigenvector1, leftEigenvector2, iNode );
445 lambdaMax = std::max<Real> ( std::max<Real> ( std::fabs (eigenvalues[0]), std::fabs (eigenvalues[1]) ), lambdaMax );
448 Real minH = MeshUtility::MeshStatistics::computeSize (*M_feSpacePtr->mesh() ).minH;
449 return lambdaMax * timeStep / minH;
455 std::ofstream outfile;
456 for ( solutionConstIterator_Type i = solution.begin(); i != solution.end(); ++i )
458 std::string file = M_physicsPtr->data()->postprocessingDirectory() +
"/" + M_physicsPtr->data()->postprocessingFile() +
"_" + i->first +
".mfile";
459 outfile.open ( file.c_str(), std::ios::trunc );
467 std::ofstream outfile;
468 for ( solutionConstIterator_Type i = solution.begin(); i != solution.end(); ++i )
470 std::string file = M_physicsPtr->data()->postprocessingDirectory() +
"/" + M_physicsPtr->data()->postprocessingFile() +
"_" + i->first +
".mfile";
471 outfile.open ( file.c_str(), std::ios::app );
472 outfile.setf ( std::ios::scientific, std::ios::floatfield );
474 outfile << time <<
" ";
475 for ( UInt iNode (0); iNode <
static_cast< UInt > ( (*i->second).size() ); ++iNode )
477 outfile << (*i->second) (iNode) <<
" ";
480 outfile << std::endl;
511 M_elementalMassMatrixPtr.reset (
new MatrixElemental ( M_feSpacePtr->fe().nbFEDof(), 1, 1 ) );
512 M_elementalStiffnessMatrixPtr.reset (
new MatrixElemental ( M_feSpacePtr->fe().nbFEDof(), 1, 1 ) );
513 M_elementalGradientMatrixPtr.reset (
new MatrixElemental ( M_feSpacePtr->fe().nbFEDof(), 1, 1 ) );
514 M_elementalDivergenceMatrixPtr.reset (
new MatrixElemental ( M_feSpacePtr->fe().nbFEDof(), 1, 1 ) );
517 for (
UInt i (0) ; i < 2 ; ++i )
519 M_rhs[i].reset (
new vector_Type ( M_feSpacePtr->map() ) );
520 M_residual[i].reset (
new vector_Type ( M_feSpacePtr->map() ) );
521 M_fluxVector[i].reset (
new vector_Type ( M_feSpacePtr->map() ) );
522 M_sourceVector[i].reset (
new vector_Type ( M_feSpacePtr->map() ) );
526 M_homogeneousMassMatrixPtr.reset (
new matrix_Type ( M_feSpacePtr->map() ) );
527 M_homogeneousGradientMatrixPtr.reset (
new matrix_Type ( M_feSpacePtr->map() ) );
558 return M_physicsPtr->data()->numberOfNodes() - 1;
564 std::cout <<
"Warning: bcSide \"" << bcSide <<
"\" not available!" << std::endl;
579 return (*solution.find (
"A")->second) ( boundaryDof );
584 return (*solution.find (
"Q")->second) ( boundaryDof ) * ( ( bcSide == OneDFSI::left ) ? -1. : 1. );
588 return (*solution.find (
"W1")->second) ( boundaryDof );
592 return (*solution.find (
"W2")->second) ( boundaryDof );
596 return (*solution.find (
"P")->second) ( boundaryDof );
600 return - (*solution.find (
"P")->second) ( boundaryDof );
604 Real P = ( *solution.find (
"P")->second ) ( boundaryDof );
605 Real rho = M_physicsPtr->data()->densityRho();
606 Real alpha = M_physicsPtr->data()->alpha ( boundaryDof );
607 Real Q = ( *solution.find (
"Q")->second ) ( boundaryDof );
608 Real A = ( *solution.find (
"A")->second ) ( boundaryDof );
612 return -P - 0.5 * rho * alpha * Q * Q / ( A * A );
616 std::cout <<
"Warning: bcType \"" << bcType <<
"\"not available!" << std::endl;
625 container2D_Type& eigenvalues,
626 container2D_Type& leftEigenvector1,
627 container2D_Type& leftEigenvector2 )
631 M_fluxPtr->eigenValuesEigenVectors ( (*solution.find (
"A")->second) ( boundaryDof ),
632 (*solution.find (
"Q")->second) ( boundaryDof ),
633 eigenvalues, leftEigenvector1, leftEigenvector2,
645 for ( UInt iNode (0); iNode < M_physicsPtr->data()->numberOfNodes() ; ++iNode )
647 Ai = (*solution.find (
"A")->second) ( iNode );
648 Qi = (*solution.find (
"Q")->second) ( iNode );
650 (*M_fluxVector[0]) ( iNode ) = M_fluxPtr->flux ( Ai, Qi, 0, iNode );
651 (*M_fluxVector[1]) ( iNode ) = M_fluxPtr->flux ( Ai, Qi, 1, iNode );
666 for ( UInt iElement (0); iElement < M_physicsPtr->data()->numberOfElements(); ++iElement )
669 Aii = (*solution.find (
"A")->second) ( iElement );
670 Qii = (*solution.find (
"Q")->second) ( iElement );
672 Aiip1 = (*solution.find (
"A")->second) ( iElement + 1 );
673 Qiip1 = (*solution.find (
"Q")->second) ( iElement + 1 );
675 for ( UInt ii = 0; ii < 2; ++ii )
677 for ( UInt jj = 0; jj < 2; ++jj )
679 tmp = M_fluxPtr->dFdU ( Aii, Qii, ii, jj, iElement );
680 tmp += M_fluxPtr->dFdU ( Aiip1, Qiip1, ii, jj, iElement + 1 );
682 M_dFdUVector[ 2 * ii + jj ] ( iElement ) = 0.5 * tmp;
693 for ( UInt iNode (0); iNode < M_physicsPtr->data()->numberOfNodes() ; ++iNode )
695 Ai = (*solution.find (
"A")->second) ( iNode );
696 Qi = (*solution.find (
"Q")->second) ( iNode );
698 (*M_sourceVector[0]) ( iNode ) = M_sourcePtr->source ( Ai, Qi, 0, iNode );
699 (*M_sourceVector[1]) ( iNode ) = M_sourcePtr->source ( Ai, Qi, 1, iNode );
714 for ( UInt iElement (0); iElement < M_physicsPtr->data()->numberOfElements(); ++iElement )
717 Aii = (*solution.find (
"A")->second) ( iElement);
718 Qii = (*solution.find (
"Q")->second) ( iElement);
719 Aiip1 = (*solution.find (
"A")->second) ( iElement + 1 );
720 Qiip1 = (*solution.find (
"Q")->second) ( iElement + 1 );
722 for ( UInt ii = 0; ii < 2; ++ii )
724 for ( UInt jj = 0; jj < 2; ++jj )
726 tmp = M_sourcePtr->dSdU ( Aii, Qii, ii, jj, iElement );
727 tmp += M_sourcePtr->dSdU ( Aiip1, Qiip1, ii, jj, iElement + 1 );
729 M_dSdUVector[ 2 * ii + jj ] ( iElement ) = 0.5 * tmp;
739 for (
UInt i (0); i < 4; ++i )
741 M_dSdUMassMatrixPtr[i].reset (
new matrix_Type ( M_feSpacePtr->map() ) );
742 M_dFdUStiffnessMatrixPtr[i].reset (
new matrix_Type ( M_feSpacePtr->map() ) );
743 M_dFdUGradientMatrixPtr[i].reset (
new matrix_Type ( M_feSpacePtr->map() ) );
744 M_dSdUDivergenceMatrixPtr[i].reset (
new matrix_Type ( M_feSpacePtr->map() ) );
748 for ( UInt iElement (0); iElement < M_physicsPtr->data()->numberOfElements(); ++iElement )
751 M_feSpacePtr->fe().update ( M_feSpacePtr->mesh()->edgeList ( iElement), UPDATE_DPHI | UPDATE_WDET );
753 for ( UInt ii (0); ii < 2; ++ii )
755 for ( UInt jj (0); jj < 2; ++jj )
758 updateElementalMatrices ( M_dFdUVector[ 2 * ii + jj ] ( iElement ), M_dSdUVector[ 2 * ii + jj ] ( iElement ) );
761 matrixAssemble ( ii, jj );
771 M_elementalMassMatrixPtr->zero();
772 M_elementalStiffnessMatrixPtr->zero();
773 M_elementalGradientMatrixPtr->zero();
774 M_elementalDivergenceMatrixPtr->zero();
777 AssemblyElemental::mass ( dSdU, *M_elementalMassMatrixPtr, M_feSpacePtr->fe(), 0, 0 );
782 AssemblyElemental::stiff ( dFdU, *M_elementalStiffnessMatrixPtr, M_feSpacePtr->fe(), 0 , 0 );
799 AssemblyElemental::grad ( 0, -dFdU, *M_elementalGradientMatrixPtr, M_feSpacePtr->fe(), M_feSpacePtr->fe(), 0, 0 );
813 AssemblyElemental::div ( 0, -dSdU, *M_elementalDivergenceMatrixPtr, M_feSpacePtr->fe(), M_feSpacePtr->fe(), 0, 0 );
822 assembleMatrix ( *M_dSdUMassMatrixPtr[ 2 * ii + jj ], *M_elementalMassMatrixPtr, M_feSpacePtr->fe(), M_feSpacePtr->dof(), 0, 0, 0, 0 );
825 assembleMatrix ( *M_dFdUStiffnessMatrixPtr[ 2 * ii + jj ], *M_elementalStiffnessMatrixPtr, M_feSpacePtr->fe(), M_feSpacePtr->dof(), 0, 0, 0, 0 );
828 assembleMatrix ( *M_dFdUGradientMatrixPtr[ 2 * ii + jj ], *M_elementalGradientMatrixPtr, M_feSpacePtr->fe(), M_feSpacePtr->dof(), 0, 0, 0, 0 );
831 assembleMatrix ( *M_dSdUDivergenceMatrixPtr[ 2 * ii + jj ], *M_elementalDivergenceMatrixPtr, M_feSpacePtr->fe(), M_feSpacePtr->dof(), 0, 0, 0, 0 );
838 matrix.globalAssemble();
839 matrix.diagonalize ( 0, 1, 0 );
840 matrix.diagonalize ( M_physicsPtr->data()->numberOfNodes() - 1, 1, 0 );
866 for ( UInt iElement (0); iElement < M_physicsPtr->data()->numberOfElements(); ++iElement )
869 elmatMassLHS. zero();
870 elmatStiffLHS.zero();
871 elmatStiffRHS.zero();
873 coeffMass = (*M_rhs[0]) ( iElement ) + (*M_rhs[0]) ( iElement + 1 );
875 coeffMass = 1. / coeffMass;
877 meanA0 = M_physicsPtr->data()->area0 (iElement) + M_physicsPtr->data()->area0 (iElement + 1);
880 m = M_physicsPtr->data()->densityWall() * M_physicsPtr->data()->thickness (iElement + 1) /
881 ( 2 * std::sqrt (4 * std::atan (1.) ) * std::sqrt (meanA0) );
883 coeffStiff = m / M_physicsPtr->data()->densityRho();
886 M_feSpacePtr->fe().update ( M_feSpacePtr->mesh()->edgeList (iElement), UPDATE_DPHI | UPDATE_WDET );
888 AssemblyElemental::mass ( coeffMass, elmatMassLHS, M_feSpacePtr->fe(), 0, 0 );
889 AssemblyElemental::stiff ( coeffStiff, elmatStiffLHS, M_feSpacePtr->fe(), 0, 0 );
890 AssemblyElemental::stiff ( - coeffStiff, elmatStiffRHS, M_feSpacePtr->fe(), 0, 0 );
893 assembleMatrix ( matrixLHS, elmatMassLHS, M_feSpacePtr->fe(), M_feSpacePtr->dof(), 0, 0, 0, 0 );
894 assembleMatrix ( matrixLHS, elmatStiffLHS, M_feSpacePtr->fe(), M_feSpacePtr->dof(), 0, 0, 0, 0 );
895 assembleMatrix ( stiffRHS, elmatStiffRHS, M_feSpacePtr->fe(), M_feSpacePtr->dof(), 0, 0, 0, 0 );
897 #ifdef HAVE_LIFEV_DEBUG 898 debugStream ( 6310 ) <<
"\n\tm = " << m <<
"\n\t_coeffMass = " << coeffMass <<
"\n\t_coeffStiff = " << coeffStiff <<
"\n";
905 rhs = stiffRHS * flux;
921 applyDirichletBCToMatrix ( matrixLHS );
931 M_linearSolverPtr->setMatrix ( matrixLHS );
957 for ( UInt iNode (0); iNode < M_physicsPtr->data()->numberOfNodes(); ++iNode )
959 g (iNode) = std::sqrt ( (*M_rhs[0]) (iNode) ) - std::sqrt (M_physicsPtr->data()->area0 (iNode) );
972 Real h ( M_physicsPtr->data()->length() /
static_cast<Real> (M_physicsPtr->data()->numberOfElements() - 1) );
976 for ( UInt iElement (0); iElement < M_physicsPtr->data()->numberOfElements() ; ++iElement )
985 coeffMassLHS = (*M_rhs[0]) ( iNode ) + (*M_rhs[0]) ( iNode + 1 );
987 coeffMassLHS = 1. / coeffMassLHS;
989 a = M_physicsPtr->data()->inertialModulus() / std::sqrt (4 * std::atan (1.) );
990 coeffMassRHS = M_physicsPtr->data()->dataTime()->timeStep() * a / M_physicsPtr->data()->densityRho();
1001 #ifdef HAVE_LIFEV_DEBUG 1002 debugStream ( 6310 ) <<
"\ninode = " << iNode <<
"\n";
1007 f ( iNode ) = - g ( iNode ) + g ( iNode + 3 ) - 3 * g ( iNode + 2 ) + 3 * g ( iNode + 1 );
1008 #ifdef HAVE_LIFEV_DEBUG 1009 debugStream ( 6310 ) <<
"\n\tbackward differentiation = " << coeffMassLHS <<
"\n";
1012 else if (iNode > M_feSpacePtr->mesh()->numEdges() - 2)
1015 f ( iNode ) = g ( iNode ) - g ( iNode - 3 ) + 3 * g ( iNode - 2 ) - 3 * g ( iNode - 1 );
1016 #ifdef HAVE_LIFEV_DEBUG 1017 debugStream ( 6310 ) <<
"\n\forward differentiation = " << coeffMassLHS <<
"\n";
1023 f ( iNode ) = - g ( iNode - 2 ) + 2 * g ( iNode - 1 ) - 2 * g ( iNode + 1 ) + g ( iNode + 2 );
1024 #ifdef HAVE_LIFEV_DEBUG 1025 debugStream ( 6310 ) <<
"\n\tcentral differentiation = " << coeffMassLHS <<
"\n";
1029 f (iNode) *= 1 / ( 2 * OneDFSI::pow30 (h, 3) );
1032 M_feSpacePtr->fe().update ( M_feSpacePtr->mesh()->edgeList (iElement), UPDATE_DPHI | UPDATE_WDET );
1034 AssemblyElemental::mass ( coeffMassLHS, elmatMassLHS, M_feSpacePtr->fe(), 0, 0 );
1035 AssemblyElemental::mass ( coeffMassRHS, elmatMassRHS, M_feSpacePtr->fe(), 0, 0 );
1039 assembleMatrix ( massLHS, elmatMassLHS, M_feSpacePtr->fe(), M_feSpacePtr->dof() , 0, 0, 0, 0 );
1041 assembleMatrix ( massRHS, elmatMassRHS, M_feSpacePtr->fe(), M_feSpacePtr->dof() , 0, 0, 0, 0 );
1043 #ifdef HAVE_LIFEV_DEBUG 1044 debugStream ( 6310 ) <<
"\n\t_coeffMassLHS = " << coeffMassLHS <<
"\n";
1045 debugStream ( 6310 ) <<
"\n\t_coeffMassRHS = " << coeffMassRHS <<
"\n";
1067 applyDirichletBCToMatrix ( massLHS);
sourcePtr_Type M_sourcePtr
void initialize(solution_Type &solution)
Initialize all the variables of the solution to a reference condition with , , and ...
void setLinearSolver(const linearSolverPtr_Type &linearSolverPtr)
Set the linear solver.
void updatedSdU(const solution_Type &solution)
Call _updateSource and update the P0 derivative of source vector from U:
scalarVectorContainer_Type M_dFdUVector
diffFlux = dF(U)/dU (in P0)
matrixPtrContainer_Type M_dSdUMassMatrixPtr
tridiagonal mass matrices multiplied by diffSrcij
linearSolverPtr_Type M_linearViscoelasticSolverPtr
void updateRHS(const solution_Type &solution, const Real &timeStep)
Compute the right hand side.
linearSolver_Type::matrix_type matrix_Type
std::shared_ptr< comm_Type > commPtr_Type
data_type & operator()(const UInt row)
Access operators.
vector_Type viscoelasticFlowRateCorrection(const vector_Type &newArea, const vector_Type &newElasticFlowRate, const vector_Type &oldViscoelasticFlowRate, const Real &timeStep, OneDFSIBCHandler &bcHandler, const bool &updateSystemMatrix=true)
Apply the viscoelastic flow rate correction.
Real computeCFL(const solution_Type &solution, const Real &timeStep) const
CFL computation (correct for constant mesh)
std::map< std::string, fluxTerm_Type > fluxMap
std::shared_ptr< physics_Type > physicsPtr_Type
scalarVectorContainer_Type M_dSdUVector
diffSrc = dSource(U)/dU (in P0)
void buildConstantMatrices()
Build constant matrices (mass and grad)
linearSolverPtr_Type M_linearSolverPtr
The linear solver.
std::map< std::string, physicsType_Type > physicsMap
void setCommunicator(const commPtr_Type &comm)
Set the communicator.
void setCommunicator(const commPtr_Type &commPtr)
Set the communicator.
OneDFSISolver()
Empty Constructor.
void updateInverseJacobian(const UInt &iQuadPt)
void setProblem(const physicsPtr_Type &physicsPtr, const fluxPtr_Type &fluxPtr, const sourcePtr_Type &sourcePtr)
Set problem classes.
void updateMatrices()
Update the matrices.
void computeAreaRatio(solution_Type &solution)
Update the ratio between and .
void computePressure(solution_Type &solution, const Real &timeStep)
Update the pressure.
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.
matrixPtrContainer_Type M_dSdUDivergenceMatrixPtr
tridiagonal divergence matrices multiplied by diffSrcij
UInt boundaryDOF(const bcSide_Type &bcSide) const
Return the ID of the boundary node given a side.
linearSolver_Type::vector_type vector_Type
Epetra_Import const & importer()
Getter for the Epetra_Import.
void boundaryEigenValuesEigenVectors(const bcSide_Type &bcSide, const solution_Type &solution, container2D_Type &eigenvalues, container2D_Type &leftEigenvector1, container2D_Type &leftEigenvector2)
Return the value of the eigenvalues and eigenvectors on a specified boundary.
matrixPtrContainer_Type M_dFdUGradientMatrixPtr
tridiagonal gradient matrices multiplied by diffFluxij
void matrixAssemble(const UInt &ii, const UInt &jj)
Assemble the matrices.
vectorPtrContainer_Type M_residual
Residual of the linear system.
void setLinearViscoelasticSolver(const linearSolverPtr_Type &linearViscoelasticSolverPtr)
Set the viscoelastic linear solver.
void iterate(OneDFSIBCHandler &bcH, solution_Type &solution, const Real &time, const Real &timeStep)
Update convective term and BC. Then solve the linearized system.
Real boundaryValue(const solution_Type &solution, const bcType_Type &bcType, const bcSide_Type &bcSide) const
Return the value of a quantity ( , , , , ) on a specified boundary.
OneDFSIBCHandler - Class featuring methods to handle boundary conditions.
matrixPtr_Type M_homogeneousMassMatrixPtr
tridiagonal mass matrix
void updateSource(const solution_Type &solution)
Update the P1 source vector from U: M_sourcei = S_h(Un) i=1,2 (works only for P1Seg elements) ...
VectorEpetra & operator=(data_type scalar)
Affectation operator.
std::shared_ptr< flux_Type > fluxPtr_Type
vector_Type longitudinalFlowRateCorrection()
Apply the longitudinal Flux correction:
void applyDirichletBCToMatrix(matrix_Type &matrix)
Update the matrices to take into account Dirichlet BC.
Int size() const
Return the size of the vector.
double Real
Generic real data.
matrixPtrContainer_Type M_dFdUStiffnessMatrixPtr
tridiagonal stiffness matrices multiplied by diffFluxij
std::map< std::string, vectorPtr_Type > solution_Type
feSpacePtr_Type M_feSpacePtr
std::shared_ptr< source_Type > sourcePtr_Type
std::shared_ptr< linearSolver_Type > linearSolverPtr_Type
OneDFSISolver - Solver class for the 1D model.
vectorPtrContainer_Type M_fluxVector
Flux F(U) (in P1)
void resetOutput(const solution_Type &solution)
Reset the output files.
void setFESpace(const feSpacePtr_Type &feSpacePtr)
Set the FEspace.
vectorPtrContainer_Type M_rhs
Right hand sides of the linear system i: "mass * M_Ui = M_rhsi".
void updatedFdU(const solution_Type &solution)
Call _updateFlux and update the P0 derivative of flux vector from U:
void computeArea(solution_Type &solution)
Compute A from the area ratio: .
void setupSolution(solution_Type &solution, const MapEpetra &map, const bool &onlyMainQuantities=false)
Setup the solution using user defined FESpace map.
void updateFlux(const solution_Type &solution)
Update the P1 flux vector from U: M_fluxi = F_h(Un) i=1,2 (works only for P1Seg elements) ...
std::map< std::string, sourceTerm_Type > sourceMap
VectorEpetra(const VectorEpetra &vector)
Copy constructor.
std::shared_ptr< feSpace_Type > feSpacePtr_Type
void postProcess(const solution_Type &solution, const Real &time)
Save results on output files.
matrixPtr_Type M_homogeneousGradientMatrixPtr
tridiagonal gradient matrix
physicsPtr_Type M_physicsPtr
L2 Projection of the second derivative of Q over P1 space.
void computeW1W2(solution_Type &solution)
Update the Riemann variables.
vectorPtrContainer_Type M_sourceVector
Source term S (in P1)
uint32_type UInt
generic unsigned integer (used mainly for addressing)
void updateElementalMatrices(const Real &dFdU, const Real &dSdU)
Update the element matrices with the current element.
vector_Type inertialFlowRateCorrection(const vector_Type &)
Apply the inertial Flux correction: