Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
NavierStokesAssFE_decl.hpp
1#ifndef NAVIERSTOKESASSFE_decl_hpp
2#define NAVIERSTOKESASSFE_decl_hpp
3#include "feddlib/problems/abstract/NonLinearProblem.hpp"
4#include <Xpetra_ThyraUtils.hpp>
5#include <Xpetra_CrsMatrixWrap.hpp>
6#include <Thyra_ProductVectorBase.hpp>
7#include <Thyra_PreconditionerBase.hpp>
8#include <Thyra_ModelEvaluatorBase_decl.hpp>
17
18namespace FEDD{
19
28
29template <class SC = default_sc, class LO = default_lo, class GO = default_go, class NO = default_no>
30class NavierStokesAssFE : public NonLinearProblem<SC,LO,GO,NO> {
31
32public:
34
35 typedef Problem<SC,LO,GO,NO> Problem_Type;
36 typedef typename Problem_Type::Matrix_Type Matrix_Type;
37 typedef typename Problem_Type::MatrixPtr_Type MatrixPtr_Type;
38
39 typedef typename Problem_Type::MapConstPtr_Type MapConstPtr_Type;
40
41 typedef typename Problem_Type::BlockMatrix_Type BlockMatrix_Type;
42 typedef typename Problem_Type::BlockMatrixPtr_Type BlockMatrixPtr_Type;
43
44 typedef typename Problem_Type::MultiVector_Type MultiVector_Type;
45 typedef typename Problem_Type::MultiVectorPtr_Type MultiVectorPtr_Type;
46 typedef typename Problem_Type::MultiVectorConstPtr_Type MultiVectorConstPtr_Type;
47 typedef typename Problem_Type::BlockMultiVector_Type BlockMultiVector_Type;
48 typedef typename Problem_Type::BlockMultiVectorPtr_Type BlockMultiVectorPtr_Type;
49
50 typedef typename Problem_Type::DomainConstPtr_Type DomainConstPtr_Type;
51 typedef typename Problem_Type::CommConstPtr_Type CommConstPtr_Type;
52
53 typedef NonLinearProblem<SC,LO,GO,NO> NonLinearProblem_Type;
54 typedef typename NonLinearProblem_Type::BlockMultiVectorPtrArray_Type BlockMultiVectorPtrArray_Type;
55
56 typedef typename NonLinearProblem_Type::TpetraMatrix_Type TpetraMatrix_Type;
57
58 typedef typename NonLinearProblem_Type::ThyraVecSpace_Type ThyraVecSpace_Type;
59 typedef typename NonLinearProblem_Type::ThyraVec_Type ThyraVec_Type;
60 typedef typename NonLinearProblem_Type::ThyraOp_Type ThyraOp_Type;
61 typedef Thyra::BlockedLinearOpBase<SC> ThyraBlockOp_Type;
62
63 typedef typename NonLinearProblem_Type::TpetraOp_Type TpetraOp_Type;
65
67
68 NavierStokesAssFE( const DomainConstPtr_Type &domainVelocity, std::string FETypeVelocity, const DomainConstPtr_Type &domainPressure, std::string FETypePressure, ParameterListPtr_Type parameterList );
70
71 virtual void info();
72
73 virtual void assemble( std::string type = "" ) const;
74
75 void assembleConstantMatrices() const;
76
77 void assembleDivAndStab() const;
78
79 void reAssemble( std::string type ) const;
80
81 virtual void reAssemble( BlockMultiVectorPtr_Type previousSolution ) const{};
82
83 //void reAssembleFSI(std::string type, MultiVectorPtr_Type u_minus_w, MatrixPtr_Type P) const;
84
85 virtual void reAssemble(MatrixPtr_Type& massmatrix, std::string type ) const;
86
87 virtual void reAssembleExtrapolation(BlockMultiVectorPtrArray_Type previousSolutions);
88
89 virtual void calculateNonLinResidualVec(std::string type="standard", double time=0.) const; //standard or reverse
90
91 void calculateNonLinResidualVecWithMeshVelo(std::string type, double time, MultiVectorPtr_Type u_minus_w, MatrixPtr_Type P) const;
92// virtual int ComputeDragLift(vec_dbl_ptr_Type &values);
93
94 virtual void getValuesOfInterest( vec_dbl_Type& values ){};
95
96 virtual void computeValuesOfInterestAndExport() {};
97
98// virtual void assembleExternal( std::string type ){};
99 /*####################*/
100
101 void computeSteadyPostprocessingViscosity_Solution(); // Compute the viscosity based on the current velocity solution and save it inside viscosity_element_
102
103
104 mutable MatrixPtr_Type A_;
105 vec_int_ptr_Type pressureIDsLoc;
106 MultiVectorPtr_Type u_rep_;
107 MultiVectorPtr_Type p_rep_;
108
109 MultiVectorPtr_Type viscosity_element_; //In case of a generalized-Newtonian fluid one can compute viscosity for visualization
110
111private:
112 mutable bool stokesTekoPrecUsed_; //Help variable to signal that we constructed the initial preconditioner for NOX with the Stokes system and we do not need to compute it if fill_W_prec is called for the first time. However, the preconditioner is only correct if a Stokes system is solved in the first nonlinear iteration. This only affects the block preconditioners of Teko
113 /*####################*/
114
115public:
116
117 Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op() const;
118 Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op_Monolithic() const;
119#ifdef FEDD_HAVE_TEKO
120 Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op_Block() const;
121#endif
122 Teuchos::RCP<Thyra::PreconditionerBase<SC> > create_W_prec() const;
123
124private:
125
126 virtual void evalModelImpl(
127 const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
128 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs
129 ) const;
130
131 void evalModelImplMonolithic(const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
132 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs) const;
133
134#ifdef FEDD_HAVE_TEKO
135 void evalModelImplBlock(const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
136 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs) const;
137#endif
138
139};
140}
141#endif
void calculateNonLinResidualVecWithMeshVelo(std::string type, double time, MultiVectorPtr_Type u_minus_w, MatrixPtr_Type P) const
Block Approach for Nonlinear Solver NOX. Input. Includes calculation of the residual vector and updat...
Definition NavierStokesAssFE_def.hpp:580
Definition Problem_decl.hpp:38
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5