46 #ifndef NAVIERSTOKESSOLVERBLOCKS_H 47 #define NAVIERSTOKESSOLVERBLOCKS_H 49 #include <lifev/core/LifeV.hpp> 52 #include <lifev/core/array/MatrixEpetra.hpp> 53 #include <lifev/core/array/VectorEpetra.hpp> 56 #include <Epetra_FECrsGraph.h> 57 #include <lifev/eta/expression/Integrate.hpp> 58 #include <lifev/eta/expression/BuildGraph.hpp> 61 #include <lifev/core/fem/FESpace.hpp> 64 #include <lifev/core/fem/BCManage.hpp> 67 #include <lifev/eta/fem/ETFESpace.hpp> 70 #include <lifev/navier_stokes_blocks/solver/NavierStokesOperator.hpp> 71 #include <lifev/core/linear_algebra/ApproximatedInvertibleRowMatrix.hpp> 73 #include <lifev/navier_stokes_blocks/solver/NavierStokesPreconditionerOperator.hpp> 74 #include <lifev/navier_stokes_blocks/solver/aSIMPLEOperator.hpp> 77 #include <lifev/core/util/LifeChrono.hpp> 78 #include <lifev/core/util/Displayer.hpp> 80 #include <Teuchos_ParameterList.hpp> 81 #include <Teuchos_XMLParameterListHelpers.hpp> 83 #include <lifev/core/algorithm/NonLinearRichardson.hpp> 85 #include <lifev/core/filter/GetPot.hpp> 87 #include <lifev/navier_stokes_blocks/solver/Stabilization.hpp> 88 #include <lifev/navier_stokes_blocks/solver/StabilizationSUPG.hpp> 89 #include <lifev/navier_stokes_blocks/solver/StabilizationSUPG_semi_implicit.hpp> 90 #include <lifev/navier_stokes_blocks/solver/StabilizationSUPGALE.hpp> 91 #include <lifev/navier_stokes_blocks/solver/StabilizationSUPG_semi_implicit_ale.hpp> 93 #include <Teuchos_ParameterList.hpp> 94 #include <Teuchos_XMLParameterListHelpers.hpp> 95 #include <Teuchos_RCP.hpp> 96 #include <lifev/core/algorithm/LinearSolver.hpp> 97 #include <lifev/core/algorithm/Preconditioner.hpp> 98 #include <lifev/core/algorithm/PreconditionerIfpack.hpp> 99 #include <lifev/core/algorithm/PreconditionerML.hpp> 100 #include <lifev/core/filter/ExporterHDF5.hpp> 102 #include <lifev/core/fem/PostProcessingBoundary.hpp> 103 #include <lifev/navier_stokes_blocks/solver/FastAssemblerNS.hpp> 405 M_stabilization->setAlpha( M_alpha );
415 M_velocityRhs.reset(
new vector_Type ( *vel_rhs ) );
457 return M_velocityFESpace;
463 return M_pressureFESpace;
469 return M_velocityFESpaceScalar;
475 *velocity = *M_velocity;
481 *pressure = *M_pressure;
std::shared_ptr< dataFile_Type > dataFilePtr_Type
vectorPtr_Type M_rhs_pressure
std::shared_ptr< vector_Type > vectorPtr_Type
Epetra_FECrsGraph graph_Type
std::string M_methodAerodynamicLoads
~NavierStokesSolverBlocks()
void setAlpha(const Real &alpha)
Set coefficient associated to the time discretization scheme.
matrixPtr_Type M_block00_noBC
std::shared_ptr< FESpace< mesh_Type, map_Type > > M_velocityFESpaceScalar
void setup(const meshPtr_Type &mesh, const int &id_domain=36)
Setup for the solver.
vectorPtr_Type M_residual_u
std::shared_ptr< matrix_Type > matrixPtr_Type
vectorPtr_Type const & getRhsPressure() const
Get the rhs vector (pressure part)
void iterate_steady()
Solve the steady Navier-Stokes equations.
void updateSystem(const vectorPtr_Type &u_star, const vectorPtr_Type &rhs_velocity)
Update the convective term and the right hand side.
std::shared_ptr< ETFESpace_velocity > M_fespaceUETA
void applyBoundaryConditionsResidual(vector_Type &r_u, const Real &time=0.0)
Apply Bc to the residual vector.
std::shared_ptr< Epetra_FECrsGraph > graphPtr_Type
vectorPtr_Type const & getRhs() const
Get the rhs.
vectorPtr_Type M_uExtrapolated
vectorPtr_Type M_solution
vectorPtr_Type M_velocity_old_newton
graphPtr_Type M_Jacobian_graph
std::shared_ptr< Epetra_Operator > invOpPtr_Type
matrixPtr_Type const & getF() const
Get the F block.
vectorPtr_Type M_pressure_old_newton
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file.
matrixPtr_Type M_block11_noBC
matrixPtr_Type M_block10_noBC
void solveJac(vector_Type &increment, const vector_Type &residual, const Real linearRelTol)
Evaluate the residual of the NS problem.
std::shared_ptr< parameterList_Type > parameterListPtr_Type
ETFESpace< mesh_Type, map_Type, 3, 1 > ETFESpace_pressure
NavierStokesSolverBlocks(const dataFile_Type dataFile, const commPtr_Type &communicator)
LifeV::PreconditionerIfpack prec_Type
int32_type Int
Generic integer data.
std::shared_ptr< map_Type > M_monolithicMap
bool M_penalizeReverseFlow
ID markerID_Type
markerID_Type is the type used to store the geometric entity marker IDs
void evaluateResidual(const vectorPtr_Type &convective_velocity, const vectorPtr_Type &velocity_km1, const vectorPtr_Type &pressure_km1, const vectorPtr_Type &rhs_velocity, vectorPtr_Type &residual)
Evaluates the fluid residual in FSI simulations.
std::shared_ptr< map_Type > mapPtr_Type
matrixPtr_Type M_block00_weakBC
std::shared_ptr< Operators::InvertibleOperator > M_invOper
void preprocessBoundary(const Real &nx, const Real &ny, const Real &nz, BCHandler &bc, Real &Q_hat, const vectorPtr_Type &Phi_h, const UInt flag, vectorPtr_Type &Phi_h_flag, vectorPtr_Type &V_hat_x, vectorPtr_Type &V_hat_y, vectorPtr_Type &V_hat_z)
Additional method used for pre-processing on non-circular boundaries (used only in example aorta) ...
std::shared_ptr< PostProcessingBoundary< mesh_Type > > M_postProcessing
Postprocessing class.
Displayer M_displayer
Displayer to print in parallel (only PID 0 will print)
Teuchos::RCP< Teuchos::ParameterList > parameterListRCP_Type
std::shared_ptr< FastAssemblerNS > M_fastAssembler
parameterListPtr_Type M_pListLinSolver
std::shared_ptr< ETFESpace_pressure > M_fespacePETA
void updateStabilization(const vector_Type &convective_velocity_previous_newton_step, const vector_Type &velocity_previous_newton_step, const vector_Type &pressure_previous_newton_step, const vector_Type &velocity_rhs)
Update stabilization terms.
matrixPtr_Type const & getJacobian() const
Get the jacobian block.
void evaluateResidual(const vectorPtr_Type &convective_velocity, const vectorPtr_Type &velocity_km1, const vectorPtr_Type &pressure_km1, const vectorPtr_Type &rhs_velocity, vectorPtr_Type &residualVelocity, vectorPtr_Type &residualPressure)
Evaluates the fluid residual in FSI simulations.
matrixPtr_Type const & getBtranspose() const
Get the Btranspose block.
matrixPtr_Type M_block01_noBC
Displayer const & getDisplayer() const
Get the displayer.
matrixPtr_Type const & block00() const
Get the (0,0) block.
vectorPtr_Type M_rhs_noBC
Epetra_Import const & importer()
Getter for the Epetra_Import.
void updateJacobian(const vector_Type &u_k)
Update the Jacobian matrix, only the term associated with the linearization of the convective term...
std::shared_ptr< ETFESpace_pressure > M_fespaceUETA_scalar
void iterate(bcPtr_Type &bc, const Real &time, const vectorPtr_Type &velocities)
Solve the current timestep, provided the BC and a vector of velocities (used only for for aorta examp...
ETFESpace< mesh_Type, map_Type, 3, 3 > ETFESpace_velocity
void setRhsVelocity(const vectorPtr_Type &vel_rhs)
Set the rhs vector, velocity component.
std::shared_ptr< BCHandler > bcPtr_Type
void assembleInterfaceMass(matrixPtr_Type &mass_interface, const mapPtr_Type &interface_map, markerID_Type interfaceFlag, const vectorPtr_Type &numerationInterface, const UInt &offset)
void setupPostProc()
Additional setup for postprocessing on boundaries.
void setSolversOptions(const Teuchos::ParameterList &solversOptions)
Set options preconditioner.
Teuchos::ParameterList parameterList_Type
std::shared_ptr< Stabilization > M_stabilization
void solveLaplacian(const UInt &flag, bcPtr_Type &bc_laplacian, vectorPtr_Type &laplacianSolution)
Additional method used for pre-processing on non-circular boundaries (used only in example aorta) ...
const std::shared_ptr< FESpace< mesh_Type, map_Type > > & uFESpace() const
Get the velocity FE space.
matrixPtr_Type const & block10() const
Get the (1,0) block.
std::shared_ptr< LifeV::Operators::NavierStokesOperator > M_oper
void setExportFineScaleVelocity(ExporterHDF5< mesh_Type > &exporter, const int &numElementsTotal)
Set if one needs to export the fine scale component (when using LES models)
MatrixEpetra< Real > matrix_Type
std::shared_ptr< comm_Type > commPtr_Type
matrixPtr_Type const & getB() const
Get the B block.
void applyBoundaryConditionsSolution(const Real &time)
Apply the BCs to the solution.
Real pres(const markerID_Type &flag, const vector_Type &pressure)
Compute mean pressure at a boundary face of the domain.
void applyBoundaryConditionsJacobian(bcPtr_Type &bc)
Apply the BCs on the Jacobian matrix.
const std::shared_ptr< FESpace< mesh_Type, map_Type > > & uFESpace_scalar() const
Get the velocity FE space.
bool useStabilization() const
Get if using a stabilization.
void setExtrapolatedPressure(const vectorPtr_Type &pressure_extrapolated)
Set the extrapolated pressure vector (used by semi-implicit VMS-LES stabilization) ...
void applyBoundaryConditions(bcPtr_Type &bc, const Real &time, const vectorPtr_Type &velocities)
Apply the BCs semi-implicit case (example aorta)
std::shared_ptr< FESpace< mesh_Type, map_Type > > M_velocityFESpace
void setParameters()
Set parameters of the solver.
LifeV::Preconditioner basePrec_Type
matrixPtr_Type const & Mu() const
std::shared_ptr< LifeV::Operators::NavierStokesPreconditionerOperator > M_prec
void applyBoundaryConditions(bcPtr_Type &bc, const Real &time)
Apply the BCs semi-implicit case.
std::shared_ptr< prec_Type > precPtr_Type
vectorPtr_Type M_velocityExtrapolated
RegionMesh< LinearTetra > mesh_Type
void computeForcesNonLinear(vectorPtr_Type &force, const vectorPtr_Type &solution)
Compute Aerodynamic Forces - nonlinear case.
vectorPtr_Type M_pressure
vectorPtr_Type M_velocity
double Real
Generic real data.
matrixPtr_Type block00_noBC() const
Get the (0,0) block without BCs.
std::shared_ptr< LifeV::Operators::NavierStokesOperator > M_operLoads
void updateVelocity(vectorPtr_Type &velocity)
Get the velocity vector.
Real area(const markerID_Type &flag)
Compute area of a boundary face of the domain.
void iterate(bcPtr_Type &bc, const Real &time)
Solve the current timestep, provided the BC.
void iterate_nonlinear(const Real &time)
Solve the Navier-Stokes equations at a certain time.
UInt M_flagPenalizeReverseFlow
void updatePressure(vectorPtr_Type &pressure)
Get the pressure vector.
Int M_nonLinearLineSearch
bcPtr_Type M_bc_res_essential
void setTimeStep(const Real &dt)
Set time step.
graphPtr_Type M_Btranspose_graph
matrixPtr_Type const & block01() const
Get the (0,1) block.
VectorSmall< 2 > computeForces(BCHandler &bcHandlerDrag, BCHandler &bcHandlerLift)
Compute Aerodynamic Forces.
matrixPtr_Type const & block11() const
Get the (1,1)
void buildSystem()
Assemble constant terms.
matrixPtr_Type M_block01_weakBC
vectorPtr_Type rhs_noBC() const
Get the rhs without bcs applied.
vectorPtr_Type M_pressure_extrapolated
matrixPtr_Type M_Btranspose
Vector geometricCenter(const markerID_Type &flag)
Compute center of a boundary face of the domain.
const std::shared_ptr< FESpace< mesh_Type, map_Type > > & pFESpace() const
Get the velocity FE space.
vectorPtr_Type M_velocityRhs
matrixPtr_Type M_Jacobian
std::shared_ptr< mesh_Type > meshPtr_Type
void evalResidual(vector_Type &residual, const vector_Type &solution, const UInt iter_newton)
Evaluate the residual of the NS problem.
vectorPtr_Type M_residual_p
void updateConvectiveTerm(const vectorPtr_Type &velocity)
Update the convective term.
matrixPtr_Type block01_noBC() const
Get the (0,1) block without BCs.
class ETFESpace A light, templated version of the FESpace
void setBoundaryConditions(const bcPtr_Type &bc)
Set time step.
std::shared_ptr< basePrec_Type > basePrecPtr_Type
Vector normal(const markerID_Type &flag)
Compute normal of a boundary face of the domain.
std::string M_stabilizationType
bcPtr_Type M_bc_res_natural
vectorPtr_Type getForces() const
Get the forces.
Real flux(const markerID_Type &flag, const vector_Type &velocity)
Compute flux through a boundary face of the domain.
void buildGraphs()
Build the graphs.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
std::shared_ptr< FESpace< mesh_Type, map_Type > > M_pressureFESpace
void solveTimeStep()
Solve a time step.
bool M_computeAerodynamicLoads
void updateBCHandler(bcPtr_Type &bc)
Update the bc handler.
void integrateForces(const vectorPtr_Type &velocity, const vectorPtr_Type &pressure)
Computation of forces.