Finite Element Domain Decomposition Library
FEDDLib
Loading...
Searching...
No Matches
NonLinearProblem_decl.hpp
1#ifndef NONLINEARPROBLEM_DECL_hpp
2#define NONLINEARPROBLEM_DECL_hpp
3
4#include "Problem.hpp"
5#include <Thyra_StateFuncModelEvaluatorBase.hpp>
6
7
16
17namespace FEDD{
18template<class SC_, class LO_, class GO_, class NO_>
19class Problem;
20template <class SC = default_sc,
21 class LO = default_lo,
22 class GO = default_go,
23 class NO = default_no>
24class NonLinearProblem : public Problem<SC,LO,GO,NO> , public Thyra::StateFuncModelEvaluatorBase<SC> {
25
26public:
27
28 typedef Problem<SC,LO,GO,NO> Problem_Type;
29 typedef typename Problem_Type::CommConstPtr_Type CommConstPtr_Type;
30 typedef typename Problem_Type::MapConstPtr_Type MapConstPtr_Type;
31 typedef typename Problem_Type::MultiVector_Type MultiVector_Type;
32 typedef typename Problem_Type::MultiVectorPtr_Type MultiVectorPtr_Type;
33 typedef typename Problem_Type::MultiVectorConstPtr_Type MultiVectorConstPtr_Type;
34 typedef typename Problem_Type::BlockMultiVector_Type BlockMultiVector_Type;
35 typedef typename Problem_Type::BlockMultiVectorPtr_Type BlockMultiVectorPtr_Type;
36
37 typedef typename Problem_Type::Matrix_Type Matrix_Type;
38 typedef typename Problem_Type::MatrixPtr_Type MatrixPtr_Type;
39
40 typedef typename Problem_Type::BlockMatrix_Type BlockMatrix_Type;
41 typedef typename Problem_Type::BlockMatrixPtr_Type BlockMatrixPtr_Type;
42
43
44 typedef Tpetra::Map<LO,GO,NO> TpetraMap_Type;
45 typedef Teuchos::RCP<TpetraMap_Type> TpetraMapPtr_Type;
46 typedef Teuchos::RCP<const TpetraMap_Type> TpetraMapConstPtr_Type;
47 typedef const TpetraMapConstPtr_Type TpetraMapConstPtrConst_Type;
48
49
50 typedef BlockMap<LO,GO,NO> BlockMap_Type;
51 typedef Teuchos::RCP<BlockMap_Type> BlockMapPtr_Type;
52 typedef Teuchos::RCP<const BlockMap_Type> BlockMapConstPtr_Type;
53 typedef Teuchos::Array<BlockMultiVectorPtr_Type> BlockMultiVectorPtrArray_Type;
54
55 typedef Thyra::VectorSpaceBase<SC> ThyraVecSpace_Type;
56 typedef Teuchos::RCP<const ThyraVecSpace_Type> ThyraVecSpaceConstPtr_Type;
57 typedef Thyra::VectorBase<SC> ThyraVec_Type;
58 typedef Tpetra::CrsMatrix<SC, LO, GO, NO> TpetraMatrix_Type;
59 typedef Thyra::LinearOpBase<SC> ThyraOp_Type;
60 typedef Tpetra::Operator<SC,LO,GO,NO> TpetraOp_Type;
61
62 NonLinearProblem(CommConstPtr_Type comm);
63
64 NonLinearProblem(ParameterListPtr_Type &parameterList, CommConstPtr_Type comm);
65
66 ~NonLinearProblem();
67
68 virtual void info() = 0;
69
70 void infoNonlinProblem();
71
72 void initializeProblem(int nmbVectors=1);
73
74 virtual void assemble( std::string type = "" ) const = 0;
75
76 virtual void getValuesOfInterest( vec_dbl_Type& values ) = 0;
77
78 int solveAndUpdate( const std::string& criterion , double& criterionValue );
79
80 int solveUpdate( );
81
82// virtual void reAssemble(std::string type="FixedPoint") const = 0;
83
84 virtual void reAssemble( BlockMultiVectorPtr_Type previousSolution ) const = 0;
85
86 void reAssembleAndFill( BlockMatrixPtr_Type bMat, std::string type="FixedPoint" );
87
88 virtual void reAssembleExtrapolation(BlockMultiVectorPtrArray_Type previousSolutions) = 0;
89 //MultiVector_ptr_vec_ptr_Type allPreviousSolutions
90// virtual int ComputeDragLift(vec_dbl_ptr_Type &values) = 0;
91
92 void initializeVectorsNonLinear(int nmbVectors=1);
93
94 double calculateResidualNorm() const;
95
96 virtual void calculateNonLinResidualVec(std::string type="standard", double time=0.) const = 0; //type=standard or reverse
97
98 // if used for timeproblem
99 virtual void calculateNonLinResidualVec(SmallMatrix<double>& coeff, std::string type="standard", double time=0.); //type=standard or reverse
100
101 BlockMultiVectorPtr_Type getResidualVector() const;
102
103 BlockMultiVectorPtr_Type getPreviousSolution() const{ return previousSolution_; };
104
105 virtual Thyra::ModelEvaluatorBase::InArgs<SC> getNominalValues() const;
106
107 virtual Teuchos::RCP<const ::Thyra::VectorSpaceBase<SC> > get_x_space() const;
108
109 virtual Teuchos::RCP<const ::Thyra::VectorSpaceBase<SC> > get_f_space() const;
110
111 virtual ::Thyra::ModelEvaluatorBase::InArgs<SC> createInArgs() const;
112
113 void initNOXParameters( );
114
115 void initVectorSpaces( );
116
117 void initVectorSpacesMonolithic( );
118
119 void initVectorSpacesBlock( );
120
121 virtual void evalModelImpl(const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
122 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs) const = 0;
123
124 virtual ::Thyra::ModelEvaluatorBase::OutArgs<SC> createOutArgsImpl() const;
125
126 double nonLinearTolerance_;
127 BlockMultiVectorPtr_Type previousSolution_;
128 mutable BlockMultiVectorPtr_Type residualVec_;
129 SmallMatrix<double> coeff_;// coefficients for a time-dependent problem
130
131private:
132
133 Thyra::ModelEvaluatorBase::InArgs<SC> nominalValues_;
134
135 ::Thyra::ModelEvaluatorBase::InArgs<SC> prototypeInArgs_;
136 ::Thyra::ModelEvaluatorBase::OutArgs<SC> prototypeOutArgs_;
137
138 Teuchos::RCP<const ThyraVecSpace_Type> xSpace_;
139 Teuchos::RCP<const ThyraVecSpace_Type> fSpace_;
140
141 Teuchos::RCP<ThyraVec_Type> x0_;
142
143
144
145};
146}
147
148#endif
Block Variant of Map class.
Definition BlockMap_decl.hpp:38
Definition Problem_decl.hpp:38
This class represents a templated small Matrix of type T. Primarily created for 2x2 and 3x3 matrices....
Definition SmallMatrix.hpp:22
Adaptive Mesh Refinement.
Definition AdaptiveMeshRefinement.cpp:5