39 #ifndef _DARCYSOLVERLINEAR_HPP_ 40 #define _DARCYSOLVERLINEAR_HPP_ 1
43 #include <Epetra_LAPACK.h> 44 #include <Epetra_BLAS.h> 47 #include <lifev/core/algorithm/LinearSolver.hpp> 49 #include <lifev/core/fem/Assembly.hpp> 50 #include <lifev/core/fem/AssemblyElemental.hpp> 52 #include <lifev/core/util/Displayer.hpp> 54 #include <lifev/core/array/MatrixElemental.hpp> 55 #include <lifev/core/array/VectorElemental.hpp> 57 #include <lifev/core/fem/BCManage.hpp> 58 #include <lifev/core/fem/FEFunction.hpp> 59 #include <lifev/core/fem/TimeAdvance.hpp> 61 #include <lifev/darcy/solver/DarcyData.hpp> 244 template <
typename MeshType >
332 typedef typename solver_Type::preconditionerPtr_Type preconditionerPtr_Type;
354 virtual void setup ();
363 virtual void solve ();
488 M_displayer.reset (
new displayerPtr_Type::element_type ( comm ) );
592 return M_hybridField->getFESpace().map();
601 return M_displayer->comm();
655 MatrixElemental& elmatMix,
656 MatrixElemental& elmatReactionTerm );
667 VectorElemental& elvecMix );
680 VectorElemental& localVectorHybrid,
681 MatrixElemental& elmatMix,
682 MatrixElemental& elmatReactionTerm,
683 VectorElemental& elvecMix );
693 MatrixElemental& elmatMix,
694 MatrixElemental& elmatReactionTerm,
695 VectorElemental& elvecMix );
724 template <
typename MatrixType >
809 template <
typename MeshType >
816 ASSERT ( M_primalField.get(),
"DarcySolverLinear : primal field not set." );
819 ASSERT ( M_dualField.get(),
"DarcySolverLinear : dual field not set." );
822 ASSERT ( M_hybridField.get(),
"DarcySolverLinear : hybrid field not set." );
825 LifeChrono chronoStaticCondensation;
826 LifeChrono chronoAssemble;
829 const UInt meshNumberOfElements = M_primalField->getFESpace().mesh()->numElements();
832 ASSERT ( M_displayer.get(),
"DarcySolverLinear : displayer not set." );
834 M_displayer->leaderPrint (
"Perform Static Condensation..." );
835 chronoStaticCondensation.start();
841 const UInt primalNbDof = M_primalField->getFESpace().refFE().nbDof();
842 const UInt dualNbDof = M_dualField->getFESpace().refFE().nbDof();
843 const UInt hybridNbDof = M_hybridField->getFESpace().refFE().nbDof();
845 MatrixElemental elmatMix ( dualNbDof, 1, 1,
850 VectorElemental elvecMix ( dualNbDof, 1,
854 MatrixElemental elmatReactionTerm ( primalNbDof, 1, 1 );
857 MatrixElemental localMatrixHybrid ( hybridNbDof, 1, 1 );
860 VectorElemental localVectorHybrid ( hybridNbDof, 1 );
869 for (
UInt iElem (0); iElem < meshNumberOfElements; ++iElem )
873 localMatrixHybrid.zero();
874 localVectorHybrid.zero();
884 elmatMix
, elmatReactionTerm
, elvecMix
);
889 assembleMatrix ( *M_matrHybrid,
890 M_primalField->getFESpace().fe().currentLocalId(),
893 M_hybridField->getFESpace().dof(),
899 assembleVector ( *M_rhs,
900 M_primalField->getFESpace().fe().currentLocalId(),
903 M_hybridField->getFESpace().dof(), 0 );
907 chronoStaticCondensation.stop();
908 M_displayer->leaderPrintMax (
" done in " , chronoStaticCondensation.diff() );
910 M_displayer->leaderPrint (
"Apply boundary conditions and assemble global matrix and vector..." );
912 chronoAssemble.start();
918 M_matrHybrid->globalAssemble();
921 M_rhs->globalAssemble();
923 chronoAssemble.stop();
925 M_displayer->leaderPrintMax (
" done in " , chronoAssemble.diff() );
930 template <
typename MeshType >
936 M_linearSolver.setParameters ( M_data->linearSolverList() );
937 M_linearSolver.setCommunicator ( M_displayer->comm() );
940 const std::string precType = M_data->preconditionerList().
template get<std::string> (
"prectype" );
943 M_prec.reset ( PRECFactory::instance().createObject ( precType ) );
944 ASSERT ( M_prec.get() != 0,
"DarcySolverLinear : Preconditioner not set" );
947 M_prec->setParametersList ( M_data->preconditionerList().sublist ( precType ) );
951 template <
typename MeshType >
958 M_linearSolver.setOperator ( M_matrHybrid );
961 M_linearSolver.setRightHandSide ( M_rhs );
964 M_linearSolver.setPreconditioner ( M_prec );
965 M_linearSolver.buildPreconditioner ();
968 vectorPtr_Type solution (
new vector_Type ( M_hybridField->getFESpace().map(), Unique ) );
971 M_linearSolver.solve ( solution );
974 M_hybridField->setVector ( *solution );
979 template <
typename MeshType >
986 LifeChrono chronoComputePrimalAndDual;
988 M_displayer->leaderPrint (
"Compute pressure and flux..." );
989 chronoComputePrimalAndDual.start();
992 const UInt meshNumberOfElements = M_primalField->getFESpace().mesh()->numElements();
995 const UInt elementNumberFacets =
mesh_Type::element_Type::S_numFacets;
1007 vector_Type hybrid_Repeated ( M_hybridField->getVector(), Repeated );
1010 M_primalField->cleanField();
1011 M_dualField->cleanField();
1017 const UInt primalNbDof = M_primalField->getFESpace().refFE().nbDof();
1018 const UInt dualNbDof = M_dualField->getFESpace().refFE().nbDof();
1019 const UInt hybridNbDof = M_hybridField->getFESpace().refFE().nbDof();
1021 MatrixElemental elmatMix ( dualNbDof, 1, 1,
1023 hybridNbDof, 0, 1 );
1026 VectorElemental elvecMix ( dualNbDof, 1,
1030 MatrixElemental elmatReactionTerm ( primalNbDof, 1, 1 );
1036 VectorElemental localSolution ( dualNbDof, 1,
1041 for (
UInt iElem (0); iElem < meshNumberOfElements; ++iElem )
1044 localSolution.zero();
1053 extract_vec ( hybrid_Repeated,
1055 M_hybridField->getFESpace().refFE (),
1056 M_hybridField->getFESpace().dof (),
1057 M_primalField->getFESpace().fe().currentLocalId (), 2 );
1063 assembleVector ( M_primalField->getVector (),
1064 M_primalField->getFESpace().fe().currentLocalId (),
1067 M_primalField->getFESpace().dof (), 1 );
1069 for (
UInt iLocalFacet (0); iLocalFacet < elementNumberFacets; ++iLocalFacet )
1071 const UInt iGlobalFacet ( M_dualField->getFESpace().mesh()->localFacetId ( iElem, iLocalFacet ) );
1072 if ( M_dualField->getFESpace().mesh()->facet ( iGlobalFacet ).firstAdjacentElementIdentity() != iElem )
1074 localSolution.block ( 0 ) [ iLocalFacet ] = 0.;
1079 assembleVector ( M_dualField->getVector (),
1080 M_dualField->getFESpace().fe().currentLocalId (),
1083 M_dualField->getFESpace().dof (), 0 );
1089 M_primalField->getVector().globalAssemble ();
1095 chronoComputePrimalAndDual.stop ();
1096 M_displayer->leaderPrintMax (
" done in " , chronoComputePrimalAndDual.diff() );
1101 template <
typename MeshType >
1122 template <
typename MeshType >
1129 elmatMix.block ( 0, 1 ) =
static_cast<Real> (0.);
1132 elmatMix.block ( 0, 2 ) =
static_cast<Real> (0.);
1136 AssemblyElemental::grad_Hdiv (
static_cast<Real> (1.), elmatMix, M_dualField->getFESpace().fe(),
1137 M_primalField->getFESpace().fe(), 0, 1 );
1140 const ReferenceFEHybrid* feRT0VdotNHyb = 0;
1143 switch (
mesh_Type::elementShape_Type::S_shape )
1146 feRT0VdotNHyb = &feTriaRT0VdotNHyb;
1149 feRT0VdotNHyb = &feTetraRT0VdotNHyb;
1152 feRT0VdotNHyb = &feHexaRT0VdotNHyb;
1155 ASSERT (
false,
"DarcySolverLinear : Hybrid finite element not found." );
1164 AssemblyElemental::TP_VdotN_Hdiv ( 1., elmatMix,
1165 *
static_cast <
const ReferenceFEHybrid* > (& ( M_hybridField->getFESpace().refFE() ) ),
1166 *feRT0VdotNHyb, 0, 2 );
1171 template <
typename MeshType >
1175 MatrixElemental& elmatReactionTerm )
1178 const typename mesh_Type::element_Type& element = M_primalField->getFESpace().mesh()->element ( iElem );
1184 elmatMix.block ( 0, 0 ) = 0.;
1187 M_dualField->getFESpace().fe().update ( element, UPDATE_PHI_VECT | UPDATE_WDET );
1191 M_dualField->getFESpace().fe().barycenter ( barycenter[0], barycenter[1], barycenter[2] );
1194 ASSERT ( M_inversePermeabilityFct.get(),
"DarcySolverLinear : inverse of the permeability tensor not set." );
1197 const Matrix permeabilityValue = M_inversePermeabilityFct->eval ( iElem, barycenter, M_data->dataTimePtr()->time() );
1202 AssemblyElemental::mass_Hdiv ( permeabilityValue, elmatMix, M_dualField->getFESpace().fe(), 0, 0 );
1205 ASSERT ( M_reactionTermFct.get(),
"DarcySolverLinear : reaction term not set." );
1208 elmatReactionTerm.zero();
1211 const Real reactionValue = M_reactionTermFct->eval ( iElem, barycenter, M_data->dataTimePtr()->time() );
1214 M_primalField->getFESpace().fe().update ( element, UPDATE_WDET );
1217 AssemblyElemental::mass ( reactionValue, elmatReactionTerm, M_primalField->getFESpace().fe(), 0, 0 );
1222 template <
typename MeshType >
1228 const typename mesh_Type::element_Type& element = M_primalField->getFESpace().mesh()->element ( iElem );
1231 M_dualField->getFESpace().fe().update ( element, UPDATE_PHI_VECT | UPDATE_WDET );
1235 M_dualField->getFESpace().fe().barycenter ( barycenter[0], barycenter[1], barycenter[2] );
1241 ASSERT ( M_vectorSourceFct.get(),
"DarcySolverLinear : vector source term not set." );
1244 const Vector vectorSourceValue = M_vectorSourceFct->eval ( iElem, barycenter, M_data->dataTimePtr()->time() );
1247 AssemblyElemental::source_Hdiv ( vectorSourceValue, elvecMix, M_dualField->getFESpace().fe(), 0 );
1250 ASSERT ( M_scalarSourceFct.get(),
"DarcySolverLinear : scalar source term not set." );
1253 const Real scalarSourceValue = M_scalarSourceFct->eval ( iElem, barycenter, M_data->dataTimePtr()->time() );
1257 M_primalField->getFESpace().fe().update ( element, UPDATE_WDET );
1260 AssemblyElemental::source ( scalarSourceValue, elvecMix, M_primalField->getFESpace().fe(), 1 );
1265 template <
typename MeshType >
1269 VectorElemental& localVectorHybrid,
1270 MatrixElemental& elmatMix,
1271 MatrixElemental& elmatReactionTerm,
1272 VectorElemental& elvecMix )
1276 Epetra_LAPACK lapack;
1285 const Int NBRHS = 1;
1287 const Int primalNbDof = M_primalField->getFESpace().refFE().nbDof();
1289 const Int dualNbDof = M_dualField->getFESpace().refFE().nbDof();
1291 const Int hybridNbDof = M_hybridField->getFESpace().refFE().nbDof();
1293 const Real ONE = 1.0;
1294 const Real MINUSONE = -1.0;
1295 const Real ZERO = 0.0;
1298 const char UPLO =
'L';
1301 const char TRANS =
'T';
1302 const char NOTRANS =
'N';
1305 const char NODIAG =
'N';
1308 MatrixElemental::matrix_type A = elmatMix.block ( 0, 0 );
1309 MatrixElemental::matrix_type B = elmatMix.block ( 0, 1 );
1310 MatrixElemental::matrix_type C = elmatMix.block ( 0, 2 );
1313 VectorElemental::super fv = elvecMix.block ( 0 );
1314 VectorElemental::super fp = elvecMix.block ( 1 );
1317 MatrixElemental::matrix_type BtB ( primalNbDof, primalNbDof );
1318 MatrixElemental::matrix_type CtC ( hybridNbDof, hybridNbDof );
1319 MatrixElemental::matrix_type BtC ( primalNbDof, hybridNbDof );
1329 lapack.POTRF ( UPLO, dualNbDof, A, dualNbDof, INFO );
1330 ASSERT_PRE ( !INFO[0],
"Lapack factorization of A is not achieved." );
1334 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, dualNbDof, primalNbDof, A, dualNbDof, B, dualNbDof, INFO );
1335 ASSERT_PRE ( !INFO[0],
"Lapack Computation B = L^{-1} B is not achieved." );
1339 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, dualNbDof, hybridNbDof, A, dualNbDof, C, hybridNbDof, INFO );
1340 ASSERT_PRE ( !INFO[0],
"Lapack Computation C = L^{-1} C is not achieved." );
1345 blas.SYRK ( UPLO, TRANS, primalNbDof, dualNbDof, ONE, B, dualNbDof, ZERO, BtB, primalNbDof );
1350 BtB += elmatReactionTerm.mat();
1355 blas.SYRK ( UPLO, TRANS, hybridNbDof, dualNbDof, ONE, C, dualNbDof, ZERO, CtC, hybridNbDof );
1360 blas.GEMM ( TRANS, NOTRANS, primalNbDof, hybridNbDof, dualNbDof, ONE, B, dualNbDof, C, dualNbDof,
1361 ZERO, BtC, primalNbDof );
1366 lapack.POTRF ( UPLO, primalNbDof, BtB, primalNbDof, INFO );
1367 ASSERT_PRE ( !INFO[0],
"Lapack factorization of BtB is not achieved." );
1371 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, primalNbDof, hybridNbDof, BtB, primalNbDof, BtC, primalNbDof, INFO );
1372 ASSERT_PRE ( !INFO[0],
"Lapack Computation BtC = LB^{-1} BtC is not achieved." );
1378 blas.SYRK ( UPLO, TRANS, hybridNbDof, primalNbDof, ONE, BtC, primalNbDof, MINUSONE, CtC, hybridNbDof );
1396 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, primalNbDof, NBRHS, BtB, primalNbDof, fp, primalNbDof, INFO );
1397 ASSERT_PRE ( !INFO[0],
"Lapack Computation fp = LB^{-1} fp is not achieved." );
1403 blas.GEMM ( TRANS, NOTRANS, hybridNbDof, NBRHS, primalNbDof, ONE, BtC, primalNbDof, fp, primalNbDof,
1404 ZERO, localVectorHybrid, hybridNbDof );
1408 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, dualNbDof, NBRHS, A, dualNbDof, fv, dualNbDof, INFO );
1409 ASSERT_PRE ( !INFO[0],
"Lapack Computation fv = L^{-1} fv is not achieved." );
1415 blas.GEMM ( TRANS, NOTRANS, hybridNbDof, NBRHS, hybridNbDof, MINUSONE, C, hybridNbDof, fv, dualNbDof,
1416 ONE, localVectorHybrid, hybridNbDof );
1421 blas.GEMM ( TRANS, TRANS, primalNbDof, NBRHS, dualNbDof, ONE, B, dualNbDof, fv, NBRHS, ZERO, fp, NBRHS );
1425 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, primalNbDof, NBRHS, BtB, primalNbDof, fp, NBRHS, INFO );
1426 ASSERT_PRE ( !INFO[0],
"Lapack Computation fp = LB^{-1} rhs is not achieved." );
1432 blas.GEMM ( TRANS, NOTRANS, hybridNbDof, NBRHS, primalNbDof, ONE, BtC, primalNbDof, fp, NBRHS, ONE,
1433 localVectorHybrid, hybridNbDof );
1440 symmetrizeMatrix ( hybridNbDof, CtC );
1443 localMatrixHybrid.block (0, 0) = CtC;
1448 template <
typename MeshType >
1452 MatrixElemental& elmatMix,
1453 MatrixElemental& elmatReactionTerm,
1454 VectorElemental& elvecMix )
1458 Epetra_LAPACK lapack;
1468 const Int NBRHS = 1;
1470 const Int primalNbDof = M_primalField->getFESpace().refFE().nbDof();
1472 const Int dualNbDof = M_dualField->getFESpace().refFE().nbDof();
1474 const Int hybridNbDof = M_hybridField->getFESpace().refFE().nbDof();
1476 const Real ONE = 1.0;
1477 const Real MINUSONE = -1.0;
1478 const Real ZERO = 0.0;
1481 const char UPLO =
'L';
1483 const char TRANS =
'T';
1484 const char NOTRANS =
'N';
1486 const char NODIAG =
'N';
1489 MatrixElemental::matrix_type A = elmatMix.block ( 0, 0 );
1490 MatrixElemental::matrix_type B = elmatMix.block ( 0, 1 );
1491 MatrixElemental::matrix_type C = elmatMix.block ( 0, 2 );
1493 VectorElemental::super fv = elvecMix.block ( 0 );
1494 VectorElemental::super fp = elvecMix.block ( 1 );
1499 MatrixElemental::matrix_type BtB ( primalNbDof, primalNbDof );
1500 MatrixElemental::matrix_type BtC ( primalNbDof, hybridNbDof );
1510 lapack.POTRF ( UPLO, dualNbDof, A, dualNbDof, INFO );
1511 ASSERT_PRE ( !INFO[0],
"Lapack factorization of A is not achieved." );
1515 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, dualNbDof, primalNbDof, A, dualNbDof, B, dualNbDof, INFO );
1516 ASSERT_PRE ( !INFO[0],
"Lapack Computation B = L^{-1} B is not achieved." );
1520 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, dualNbDof, hybridNbDof, A, dualNbDof, C, dualNbDof, INFO );
1521 ASSERT_PRE ( !INFO[0],
"Lapack Computation C = L^{-1} C is not achieved." );
1526 blas.SYRK ( UPLO, TRANS, primalNbDof, dualNbDof, ONE, B, dualNbDof, ZERO, BtB, primalNbDof );
1531 BtB += elmatReactionTerm.mat();
1536 blas.GEMM ( TRANS, NOTRANS, primalNbDof, hybridNbDof, dualNbDof, ONE, B, dualNbDof, C,
1537 dualNbDof, ZERO, BtC, primalNbDof );
1542 lapack.POTRF ( UPLO, primalNbDof, BtB, primalNbDof, INFO );
1543 ASSERT_PRE ( !INFO[0],
"Lapack factorization of BtB is not achieved." );
1547 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, primalNbDof, hybridNbDof, BtB, primalNbDof, BtC, primalNbDof, INFO );
1548 ASSERT_PRE ( !INFO[0],
"Lapack Computation BtC = LB^{-1} BtC is not achieved." );
1566 localSolution.block ( 0 ) = fv;
1570 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, dualNbDof, NBRHS, A, dualNbDof, fv, dualNbDof, INFO );
1571 ASSERT_PRE ( !INFO[0],
"Lapack Computation fv = L^{-1} fv is not achieved." );
1576 blas.GEMM ( TRANS, TRANS, primalNbDof, NBRHS, dualNbDof, ONE, B, dualNbDof, fv, NBRHS, ONE, fp, NBRHS );
1580 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, primalNbDof, NBRHS, BtB, primalNbDof, fp, primalNbDof, INFO );
1581 ASSERT_PRE ( !INFO[0],
"Lapack Computation fp = LB^{-1} fp is not achieved." );
1586 blas.GEMM ( NOTRANS, NOTRANS, primalNbDof, NBRHS, hybridNbDof, MINUSONE, BtC, primalNbDof,
1587 localSolution.block ( 2 ), hybridNbDof, MINUSONE, fp, primalNbDof );
1592 lapack.TRTRS ( UPLO, TRANS, NODIAG, primalNbDof, NBRHS, BtB, primalNbDof, fp, primalNbDof, INFO );
1593 ASSERT_PRE ( !INFO[0],
"Lapack Computation fp = LB^{-T} fp is not achieved." );
1596 localSolution.block ( 1 ) = fp;
1602 lapack.TRTRS ( UPLO, NOTRANS, NODIAG, dualNbDof, NBRHS, A, dualNbDof, localSolution.block ( 0 ), dualNbDof, INFO );
1603 ASSERT_PRE ( !INFO[0],
"Lapack Computation localDual = L^{-1} localDual is not achieved." );
1607 blas.GEMV ( NOTRANS, dualNbDof, primalNbDof, ONE, B, dualNbDof, localSolution.block ( 1 ),
1608 MINUSONE, localSolution.block ( 0 ) );
1613 blas.GEMV ( NOTRANS, dualNbDof, hybridNbDof, MINUSONE, C, hybridNbDof, localSolution.block ( 2 ),
1614 MINUSONE, localSolution.block ( 0 ) );
1619 lapack.TRTRS ( UPLO, TRANS, NODIAG, dualNbDof, NBRHS, A, dualNbDof, localSolution.block ( 0 ), dualNbDof, INFO );
1620 ASSERT_PRE ( !INFO[0],
"Lapack Computation localDual = L^{-T} localDual is not achieved.");
1627 template <
typename MeshType >
1633 const map_Type& problemMap = M_hybridField->getFESpace().map();
1636 M_matrHybrid.reset (
new matrix_Type ( problemMap ) );
1639 M_rhs.reset (
new vector_Type ( problemMap ) );
1642 M_residual.reset (
new vector_Type ( problemMap ) );
1645 M_primalField->cleanField();
1648 M_dualField->cleanField();
1651 M_hybridField->cleanField();
1656 template <
typename MeshType >
1663 ASSERT ( M_boundaryConditionHandler.get(),
"DarcySolverLinear : boundary conditions not set." );
1666 if ( !M_boundaryConditionHandler->bcUpdateDone() )
1669 M_boundaryConditionHandler->bcUpdate ( *M_dualField->getFESpace().mesh(),
1670 M_dualField->getFESpace().feBd(),
1671 M_dualField->getFESpace().dof() );
1675 vector_Type rhsFull ( *M_rhs, Unique );
1679 bcManage ( *M_matrHybrid, rhsFull, *M_dualField->getFESpace().mesh(),
1680 M_dualField->getFESpace().dof(), *M_boundaryConditionHandler, M_dualField->getFESpace().feBd(), 1.,
1681 M_data->dataTimePtr()->time() );
1689 template <
typename MeshType >
1690 template <
typename MatrixType >
1696 for (
UInt i ( 0 ); i <
static_cast<
UInt> (N); ++i )
1698 for (
UInt j ( i + 1 ); j <
static_cast<
UInt> (N); ++j )
1700 A ( i, j ) = A ( j, i );
void solveLinearSystem()
Solve the global hybrid system.
virtual void setup()
Set up the linear solver and the preconditioner for the linear system.
void setCommunicator(const commPtr_Type &comm)
Set the communicator and, implicitly, the displayer.
vectorPtr_Type & residualPtr()
void setVectorSource(const vectorFctPtr_Type &vectorSourceFct)
Set vector source term.
FESpace< mesh_Type, map_Type > fESpace_Type
Finite element space.
solver_Type M_linearSolver
Linear solver.
void computeConstantMatrices(MatrixElemental &elmatMix)
Pre-computes local (element independant) matrices.
scalarFieldPtr_Type & dualFieldPtr()
Returns pointer to the dual solution field.
scalarFieldPtr_Type M_hybridField
Hybrid solution.
void buildSystem()
Build the global hybrid system, the right hand and apply the boundary conditions. ...
scalarFctPtr_Type M_scalarSourceFct
Source function.
FESpace - Short description here please!
scalarFctPtr_Type M_reactionTermFct
Reaction term function.
const scalarFieldPtr_Type & primalFieldPtr() const
Returns pointer to the primal solution field.
virtual void localVectorComputation(const UInt &iElem, VectorElemental &elvecMix)
Computes local (element dependent) vectors.
matrixFctPtr_Type M_inversePermeabilityFct
Inverse of the permeability tensor.
std::shared_ptr< vectorFct_Type > vectorFctPtr_Type
Shared pointer to a vector value function.
DarcySolverLinear()
Constructor for the class.
void computePrimalAndDual()
Compute primal and dual variables from the hybrid variable as a post process.
virtual void setInversePermeability(const matrixFctPtr_Type &invPermFct)
Set inverse diffusion tensor.
std::shared_ptr< scalarFct_Type > scalarFctPtr_Type
Shared pointer to a scalar value function.
std::shared_ptr< vectorField_Type > vectorFieldPtr_Type
Shared pointer to a scalar field.
vectorPtr_Type M_residual
Residual.
const vectorPtr_Type & residualPtr() const
scalarFieldPtr_Type & hybridFieldPtr()
Returns pointer to the hybrid solution field.
int32_type Int
Generic integer data.
std::shared_ptr< Displayer > displayerPtr_Type
Shared pointer to a displayer.
displayerPtr_Type M_displayer
Displayer for parallel cout.
DarcyData< mesh_Type > data_Type
Typedef for the data type.
std::shared_ptr< data_Type > dataPtr_Type
Shared pointer for the data type.
FEFunction< mesh_Type, map_Type, Matrix > matrixFct_Type
Matrix value funcion.
DarcySolverLinear< mesh_Type > darcySolver_Type
Self typedef.
FEScalarField - This class gives an abstract implementation of a finite element scalar field...
void setPrimalField(const scalarFieldPtr_Type &primalField)
Set the primal field vector.
const map_Type & getMap() const
Returns Epetra local map.
FEScalarField< mesh_Type, map_Type > scalarField_Type
Scalar field.
MeshType mesh_Type
Typedef for mesh template.
void applyBoundaryConditions()
Apply the boundary condition.
std::shared_ptr< bcHandler_Type > bcHandlerPtr_Type
Shared pointer to a boundary condition handler.
void setBoundaryConditions(bcHandlerPtr_Type &bcHandler)
Set the boundary conditions.
void setReactionTerm(const scalarFctPtr_Type &reactionTermFct)
Set the coefficient for the reaction term.
std::shared_ptr< Epetra_Comm > commPtr_Type
Shared pointer to a MPI communicator.
virtual void preLoopElementsComputation()
Perform all the operations before doing the loop on volume elements.
void setScalarSource(const scalarFctPtr_Type &scalarSourceFct)
Set scalar source term.
void staticCondensation(MatrixElemental &localMatrixHybrid, VectorElemental &localVectorHybrid, MatrixElemental &elmatMix, MatrixElemental &elmatReactionTerm, VectorElemental &elvecMix)
Performs static condensation.
void setDualField(const scalarFieldPtr_Type &dualField)
Set the dual field vector.
const scalarFieldPtr_Type & hybridFieldPtr() const
Returns pointer to the hybrid solution field.
std::shared_ptr< fESpace_Type > fESpacePtr_Type
Shared pointer to a finite element space.
std::shared_ptr< scalarField_Type > scalarFieldPtr_Type
Shared pointer to a scalar field.
const bcHandlerPtr_Type & boundaryConditionHandlerPtr() const
Returns boundary conditions handler.
std::shared_ptr< matrixFct_Type > matrixFctPtr_Type
Shared pointer to a matrix value function.
void symmetrizeMatrix(Int N, MatrixType &A)
Make matrix symmetric.
std::vector< FEVectorFieldPtr_Type > FEVectorFieldPtrContainer_Type
void setDisplayer(const displayerPtr_Type &displayer)
Set the displayer and, implicitly, the communicator.
bcHandlerPtr_Type M_boundaryConditionHandler
Bondary conditions handler.
vectorPtr_Type M_rhs
Right hand side.
LinearSolver solver_Type
Typedef for solver template.
double Real
Generic real data.
implements a mixed-hybrid FE Darcy solver.
virtual void postComputePrimalAndDual()
Do some computation after the calculation of the primal and dual variable.
scalarFieldPtr_Type & primalFieldPtr()
Returns pointer to the primal solution field.
FEVectorField< mesh_Type, map_Type > vectorField_Type
Vector field.
FEVectorField - This class gives an abstract implementation of a finite element vector field...
void setHybridField(const scalarFieldPtr_Type &hybridField)
Set the hybrid field vector.
virtual void localMatrixComputation(const UInt &iElem, MatrixElemental &elmatMix, MatrixElemental &elmatReactionTerm)
Computes local (element dependent) matrices.
MapEpetra map_Type
Map type.
preconditionerPtr_Type M_prec
Epetra preconditioner for the linear system.
darcySolver_Type & operator=(const darcySolver_Type &)
Inhibited assign operator.
FEFunction< mesh_Type, map_Type, Real > scalarFct_Type
Scalar value function.
VectorSmall< 3 > Vector3D
matrixPtr_Type M_matrHybrid
Hybrid matrix.
DarcySolverLinear(const darcySolver_Type &)
Inhibited copy constructor.
contain the basic data for the Darcy solver.
virtual void resetVariables()
Update all problem variables.
FEFunction< mesh_Type, map_Type, Vector > vectorFct_Type
Vector value function.
scalarFieldPtr_Type M_dualField
Dual solution.
bcHandlerPtr_Type & boundaryConditionHandlerPtr()
Returns boundary conditions handler.
const commPtr_Type & getCommPtr() const
Returns Epetra communicator.
vectorFctPtr_Type M_vectorSourceFct
Vector source function.
scalarFieldPtr_Type M_primalField
Primal solution.
virtual void solve()
Solve the Darcy problem grouping other public methods.
void localComputePrimalAndDual(VectorElemental &localSolution, MatrixElemental &elmatMix, MatrixElemental &elmatReactionTerm, VectorElemental &elvecMix)
Compute locally, as a post process, the primal and dual variable given the hybrid.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
void setData(dataPtr_Type &data)
Set the data.
dataPtr_Type M_data
Data for Darcy solvers.
const scalarFieldPtr_Type & dualFieldPtr() const
Returns pointer to the dual solution field.
void setFields(const scalarFieldPtr_Type &dualField, const scalarFieldPtr_Type &primalField, const scalarFieldPtr_Type &hybridField)
Set the fields.
BCHandler bcHandler_Type
Boundary condition handler.
virtual ~DarcySolverLinear()
Virtual destructor.