40 #ifndef _DARCYSOLVERTRANSIENT_H_ 41 #define _DARCYSOLVERTRANSIENT_H_ 1
43 #include <lifev/core/fem/TimeAdvanceBDF.hpp> 45 #include <lifev/darcy/solver/DarcySolverLinear.hpp> 250 template <
typename MeshType >
317 virtual void setup ();
320 virtual void solve ();
361 MatrixElemental& elmatMix,
362 MatrixElemental& elmatReactionTerm );
372 VectorElemental& elvecMix );
381 M_timeAdvance->shiftRight (
this->M_primalField->getVector() );
465 template <
typename MeshType >
485 template <
typename MeshType >
500 template <
typename MeshType >
506 const typename darcySolverLinear_Type::data_Type::data_Type& dataFile = * (
this->M_data->dataFilePtr() );
509 M_reusePrec = dataFile ( (
this->M_data->section() +
"/solver/reuse" ).data(),
false );
512 this->M_linearSolver.setReusePreconditioner (
M_reusePrec );
515 M_maxIterSolver = dataFile ( (
this->M_data->section() +
"/solver/max_iter_reuse" ).data(),
static_cast<
Int> (0) );
518 M_timeAdvance->setup (
this->M_data->dataTimeAdvancePtr()->orderBDF(), 1 );
523 template <
typename MeshType >
533 this->M_primalField->getVector().mapType() );
537 this->M_data->dataTimePtr()->initialTime() );
540 M_timeAdvance->setInitialCondition ( primalInitialField.getVector() );
549 template <
typename MeshType >
558 M_timeAdvance->updateRHSFirstDerivative ();
562 *M_rhsTimeAdvance = M_timeAdvance->rhsContributionFirstDerivative ();
570 template <
typename MeshType >
579 const UInt meshNumberOfElements =
this->M_primalField->getFESpace().mesh()->numElements();
582 typename mesh_Type::element_Type element;
585 M_localMassMatrix.reserve ( meshNumberOfElements );
588 MatrixElemental localMassMatrix (
this->M_primalField->getFESpace().refFE().nbDof(), 1, 1 );
594 for (
UInt iElem (0); iElem < meshNumberOfElements; ++iElem )
597 element =
this->M_primalField->getFESpace().mesh()->element ( iElem );
603 localMassMatrix.zero ();
606 this->M_primalField->getFESpace().fe().barycenter ( barycenter
[0
], barycenter
[1
], barycenter
[2
] );
609 const Real massValue =
M_massFct->eval ( iElem, barycenter );
612 AssemblyElemental::mass ( massValue, localMassMatrix,
this->M_primalField->getFESpace().fe(), 0, 0);
615 M_localMassMatrix.push_back ( localMassMatrix );
621 template <
typename MeshType >
625 MatrixElemental& elmatReactionTerm )
631 ASSERT ( M_massFct.get(),
"DarcySolverTransient : mass function not set." );
637 localMassMatrix *= M_timeAdvance->coefficientFirstDerivative ( 0 ) /
638 this->M_data->dataTimePtr()->timeStep();
642 elmatReactionTerm.mat() += localMassMatrix.mat();
647 template <
typename MeshType >
657 VectorElemental localRhsTimeAdvance (
this->M_primalField->getFESpace().refFE().nbDof(), 1 );
660 localRhsTimeAdvance.zero ();
665 this->M_primalField->getFESpace().refFE(),
666 this->M_primalField->getFESpace().dof(),
667 this->M_primalField->getFESpace().fe().currentLocalId(), 0 );
670 ASSERT ( M_massFct.get(),
"DarcySolverTransient : mass function not setted." );
673 MatrixElemental::matrix_type localMassMatrix ( M_localMassMatrix [ iElem ].mat() );
676 localMassMatrix /=
this->M_data->dataTimePtr()->timeStep();
679 elvecMix.block ( 1 ) += localMassMatrix * localRhsTimeAdvance.vec();
darcySolverLinear_Type::vector_Type vector_Type
Distributed vector.
DarcySolverLinear< mesh_Type > darcySolverLinear_Type
Darcy solver class.
matrixElementalContainer_Type M_localMassMatrix
Local mass matrices.
virtual void localMatrixComputation(const UInt &iElem, MatrixElemental &elmatMix, MatrixElemental &elmatReactionTerm)
Compute element matrices.
void setupTime()
Setup the time data.
vectorPtr_Type M_rhsTimeAdvance
Right hand side coming from the time advance scheme.
virtual ~DarcySolverTransient()
Virtual destructor.
int32_type Int
Generic integer data.
virtual void postComputePrimalAndDual()
Do some computation after the calculation of the primal and dual variable.
scalarFctPtr_Type M_massFct
Mass function, it does not depend on time.
const flag_Type UPDATE_WDET(UPDATE_ONLY_CELL_NODES|UPDATE_ONLY_DPHI_GEO_MAP|UPDATE_ONLY_JACOBIAN|UPDATE_ONLY_DET_JACOBIAN|UPDATE_ONLY_W_DET_JACOBIAN)
implements a mixed-hybrid FE Darcy solver for transient problems
bool M_recomputeMatrix
Boolean that indicates if the matrix is recomputed for the current iteration.
timeAdvancePtr_Type M_timeAdvance
Time advance.
UInt M_maxIterSolver
Interger storing the max number of solver iteration with preconditioner recomputing.
darcySolverLinear_Type::dataPtr_Type dataPtr_Type
Shared pointer for the data type.
virtual void setup()
Set up the linear solver and the preconditioner for the linear system.
DarcySolverTransient(const darcySolverTransient_Type &)
Inhibited copy constructor.
Real & operator[](UInt const &i)
Operator [].
MeshType mesh_Type
Typedef for mesh template.
TimeAdvanceBDF< vector_Type > timeAdvance_Type
Time advance scheme.
darcySolverLinear_Type::scalarField_Type scalarField_Type
Scalar field.
std::vector< MatrixElemental > matrixElementalContainer_Type
Container of matrix elemental.
class TimeAdvanceBDF - Backward differencing formula time discretization for the first and the second...
bool M_updated
Boolean that indicates if the matrix is updated for the current iteration.
bool M_reusePrec
Boolean that indicates if the preconditioner is re-used or not.
std::shared_ptr< timeAdvance_Type > timeAdvancePtr_Type
Shared pointer to a time advance scheme.
virtual void solve()
Solve the problem.
double Real
Generic real data.
implements a mixed-hybrid FE Darcy solver.
scalarFctPtr_Type M_primalFieldInitialFct
Initial time primal variable.
virtual void localVectorComputation(const UInt &iElem, VectorElemental &elvecMix)
Computes local vectors.
darcySolverLinear_Type::vectorPtr_Type vectorPtr_Type
Shared pointer to a distributed vector.
const flag_Type UPDATE_QUAD_NODES(UPDATE_ONLY_CELL_NODES|UPDATE_ONLY_QUAD_NODES)
DarcySolverTransient()
Constructor for the class.
void setMass(const scalarFctPtr_Type &massFct)
Set mass matrix.
VectorSmall< 3 > Vector3D
darcySolverTransient_Type & operator=(const darcySolverTransient_Type &)
Inhibited assign operator.
DarcySolverTransient< mesh_Type > darcySolverTransient_Type
Self typedef.
void setInitialPrimal(const scalarFctPtr_Type &primalInitialFct)
Initialize primal solution.
darcySolverLinear_Type::data_Type data_Type
Typedef for the data type.
darcySolverLinear_Type::scalarFieldPtr_Type scalarFieldPtr_Type
Shared pointer to a scalar field.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
darcySolverLinear_Type::scalarFctPtr_Type scalarFctPtr_Type
Shared pointer to a scalar value function.