33class TimeProblem:
public Thyra::StateFuncModelEvaluatorBase<SC> {
38 typedef Teuchos::RCP<Problem_Type> ProblemPtr_Type;
39 typedef typename Problem_Type::CommConstPtr_Type CommConstPtr_Type;
41 typedef typename Problem_Type::Map_Type Map_Type;
42 typedef typename Problem_Type::MapPtr_Type MapPtr_Type;
43 typedef typename Problem_Type::MapConstPtr_Type MapConstPtr_Type;
45 typedef typename Problem_Type::Matrix_Type Matrix_Type;
46 typedef typename Problem_Type::MatrixPtr_Type MatrixPtr_Type;
47 typedef Teuchos::RCP<const Matrix_Type> MatrixConstPtr_Type;
49 typedef typename Problem_Type::BlockMatrix_Type BlockMatrix_Type;
50 typedef typename Problem_Type::BlockMatrixPtr_Type BlockMatrixPtr_Type;
51 typedef typename Problem_Type::BlockMatrixConstPtr_Type BlockMatrixConstPtr_Type;
52 typedef Teuchos::Array<BlockMatrixPtr_Type> BlockMatrixPtrArray_Type;
54 typedef typename Problem_Type::MultiVector_Type MultiVector_Type;
55 typedef typename Problem_Type::MultiVectorPtr_Type MultiVectorPtr_Type;
57 typedef typename Problem_Type::BlockMultiVector_Type BlockMultiVector_Type;
58 typedef typename Problem_Type::BlockMultiVectorPtr_Type BlockMultiVectorPtr_Type;
59 typedef typename Problem_Type::BlockMultiVectorConstPtr_Type BlockMultiVectorConstPtr_Type;
60 typedef Teuchos::Array<BlockMultiVectorPtr_Type> BlockMultiVectorPtrArray_Type;
62 typedef typename Problem_Type::DomainConstPtr_Type DomainConstPtr_Type;
64 typedef typename Problem_Type::FEFac_Type FEFac_Type;
65 typedef Teuchos::RCP<FEFac_Type> FEFacPtr_Type;
66 typedef Teuchos::RCP<const FEFac_Type> FEFacConstPtr_Type;
67 typedef typename Problem_Type::BCConstPtr_Type BCConstPtr_Type;
70 typedef Teuchos::RCP<NonLinProb_Type> NonLinProbPtr_Type;
73 typedef typename Problem_Type::Preconditioner_Type Preconditioner_Type;
74 typedef typename Problem_Type::PreconditionerPtr_Type PreconditionerPtr_Type;
76 typedef typename Problem_Type::LinSolverBuilderPtr_Type LinSolverBuilderPtr_Type;
78 typedef typename NonLinProb_Type::TpetraMatrix_Type TpetraMatrix_Type;
80 typedef typename NonLinProb_Type::ThyraVecSpace_Type ThyraVecSpace_Type;
81 typedef typename NonLinProb_Type::ThyraVec_Type ThyraVec_Type;
82 typedef typename NonLinProb_Type::ThyraOp_Type ThyraOp_Type;
83 typedef Thyra::BlockedLinearOpBase<SC> ThyraBlockOp_Type;
85 typedef typename NonLinProb_Type::TpetraOp_Type TpetraOp_Type;
87 TimeProblem(Problem_Type& problem, CommConstPtr_Type comm);
91 void assemble(std::string type=
"")
const;
93 virtual void reAssembleAndFill( BlockMatrixPtr_Type bMat, std::string type=
"FixedPoint" );
97 void updateMultistepRhs(vec_dbl_Type& coeff,
int nmbToUse);
100 void updateMultistepRhsFSI(vec_dbl_Type& coeff,
int nmbToUse);
106 void updateNewmarkRhs(
double dt,
double beta,
double gamma, vec_dbl_Type coeff);
108 void combineSystems()
const;
110 void initializeCombinedSystems()
const;
112 void assembleMassSystem( )
const;
116 int solveAndUpdate(
const std::string& criterion,
double& criterionValue );
122 int solve( BlockMultiVectorPtr_Type rhs = Teuchos::null );
124 double calculateResidualNorm();
126 void calculateNonLinResidualVec(std::string type=
"standard",
double time=0.)
const;
130 void addBoundaries(BCConstPtr_Type bcFactory);
132 void setBoundaries(
double time=.0);
134 void setBoundariesRHS(
double time=.0);
136 void setBoundariesSystem()
const;
140 BlockMultiVectorPtr_Type getRhs();
142 BlockMultiVectorPtr_Type getRhs()
const;
144 BlockMultiVectorPtr_Type getSolution();
146 BlockMultiVectorConstPtr_Type getSolutionConst()
const;
148 BlockMultiVectorPtr_Type getResidual();
150 BlockMultiVectorConstPtr_Type getResidualConst()
const;
152 DomainConstPtr_Type getDomain(
int i)
const;
154 std::string getFEType(
int i);
156 std::string getVariableName(
int i);
158 int getDofsPerNode(
int i);
160 BlockMatrixPtr_Type getSystem();
162 BlockMatrixPtr_Type getSystemCombined();
164 BlockMatrixPtr_Type getSystemCombined()
const;
166 ProblemPtr_Type getUnderlyingProblem();
168 void updateSolutionPreviousStep();
170 void updateSolutionMultiPreviousStep(
int nmbSteps);
172 void updateSystemMassMultiPreviousStep(
int nmbSteps);
178 void updateSolutionNewmarkPreviousStep(
double dt,
double beta,
double gamma);
180 BlockMultiVectorPtr_Type getSolutionPreviousTimestep();
182 BlockMultiVectorPtrArray_Type getSolutionAllPreviousTimestep();
184 BlockMatrixPtr_Type getMassSystem();
186 ParameterListPtr_Type getParameterList();
188 void assembleSourceTerm(
double time=0. );
190 BlockMultiVectorPtr_Type getSourceTerm( );
192 bool hasSourceTerm()
const;
194 CommConstPtr_Type getComm()
const{
return comm_;};
196 LinSolverBuilderPtr_Type getLinearSolverBuilder()
const;
198 void getValuesOfInterest( vec_dbl_Type& values );
200 void computeValuesOfInterestAndExport();
202 void updateTime(
double time ){ time_ = time;};
204 void addToRhs(BlockMultiVectorPtr_Type x);
206 ProblemPtr_Type problem_;
207 CommConstPtr_Type comm_;
209 mutable BlockMatrixPtr_Type systemCombined_;
210 mutable BlockMatrixPtr_Type systemMass_;
215 FEFacPtr_Type feFactory_;
219 ParameterListPtr_Type parameterList_;
220 mutable BCConstPtr_Type bcFactory_;
222 BlockMultiVectorPtrArray_Type solutionPreviousTimesteps_;
228 BlockMultiVectorPtrArray_Type velocityPreviousTimesteps_;
229 BlockMultiVectorPtrArray_Type accelerationPreviousTimesteps_;
234 BlockMatrixPtrArray_Type systemMassPreviousTimeSteps_;
238#define TIMEPROBLEM_TIMER
239#ifdef TIMEPROBLEM_TIMER
240 TimePtr_Type TimeSolveTimer_;
246 virtual Thyra::ModelEvaluatorBase::InArgs<SC> getNominalValues()
const;
248 virtual Teuchos::RCP<const ::Thyra::VectorSpaceBase<SC> > get_x_space()
const;
250 virtual Teuchos::RCP<const ::Thyra::VectorSpaceBase<SC> > get_f_space()
const;
252 virtual ::Thyra::ModelEvaluatorBase::InArgs<SC> createInArgs()
const;
254 virtual ::Thyra::ModelEvaluatorBase::OutArgs<SC> createOutArgsImpl()
const;
264 Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op() ;
266 Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op_Monolithic() ;
268 Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op_Block() ;
270 Teuchos::RCP<Thyra::PreconditionerBase<SC> > create_W_prec() ;
272 std::string description()
const;
275 virtual void evalModelImpl(
276 const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
277 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs
280 void evalModelImplMonolithic(const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
281 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs)
const;
283 void evalModelImplBlock(const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
284 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs)
const;
286 mutable bool precInitOnly_;