31class TimeProblem:
public Thyra::StateFuncModelEvaluatorBase<SC> {
36 typedef Teuchos::RCP<Problem_Type> ProblemPtr_Type;
37 typedef typename Problem_Type::CommConstPtr_Type CommConstPtr_Type;
39 typedef typename Problem_Type::Map_Type Map_Type;
40 typedef typename Problem_Type::MapPtr_Type MapPtr_Type;
41 typedef typename Problem_Type::MapConstPtr_Type MapConstPtr_Type;
43 typedef typename Problem_Type::Matrix_Type Matrix_Type;
44 typedef typename Problem_Type::MatrixPtr_Type MatrixPtr_Type;
45 typedef Teuchos::RCP<const Matrix_Type> MatrixConstPtr_Type;
47 typedef typename Problem_Type::BlockMatrix_Type BlockMatrix_Type;
48 typedef typename Problem_Type::BlockMatrixPtr_Type BlockMatrixPtr_Type;
49 typedef typename Problem_Type::BlockMatrixConstPtr_Type BlockMatrixConstPtr_Type;
50 typedef Teuchos::Array<BlockMatrixPtr_Type> BlockMatrixPtrArray_Type;
52 typedef typename Problem_Type::MultiVector_Type MultiVector_Type;
53 typedef typename Problem_Type::MultiVectorPtr_Type MultiVectorPtr_Type;
55 typedef typename Problem_Type::BlockMultiVector_Type BlockMultiVector_Type;
56 typedef typename Problem_Type::BlockMultiVectorPtr_Type BlockMultiVectorPtr_Type;
57 typedef typename Problem_Type::BlockMultiVectorConstPtr_Type BlockMultiVectorConstPtr_Type;
58 typedef Teuchos::Array<BlockMultiVectorPtr_Type> BlockMultiVectorPtrArray_Type;
60 typedef typename Problem_Type::DomainConstPtr_Type DomainConstPtr_Type;
62 typedef typename Problem_Type::FEFac_Type FEFac_Type;
63 typedef Teuchos::RCP<FEFac_Type> FEFacPtr_Type;
64 typedef Teuchos::RCP<const FEFac_Type> FEFacConstPtr_Type;
65 typedef typename Problem_Type::BCConstPtr_Type BCConstPtr_Type;
68 typedef Teuchos::RCP<NonLinProb_Type> NonLinProbPtr_Type;
70 typedef typename Problem_Type::Preconditioner_Type Preconditioner_Type;
71 typedef typename Problem_Type::PreconditionerPtr_Type PreconditionerPtr_Type;
73 typedef typename Problem_Type::LinSolverBuilderPtr_Type LinSolverBuilderPtr_Type;
76 using TpetraMatrix_Type =
typename TpetraTypes::TpetraMatrix_Type;
77 using TpetraOp_Type =
typename TpetraTypes::TpetraOp_Type;
80 using ThyraVecSpace_Type =
typename ThyraTypes::ThyraVecSpace_Type;
81 using ThyraVec_Type =
typename ThyraTypes::ThyraVec_Type;
82 typedef Thyra::BlockedLinearOpBase<SC> ThyraBlockOp_Type;
84 using ThyraOp_Type =
typename ThyraTypes::ThyraOp_Type;
86 TimeProblem(Problem_Type& problem, CommConstPtr_Type comm);
90 void assemble(std::string type=
"")
const;
92 virtual void reAssembleAndFill( BlockMatrixPtr_Type bMat, std::string type=
"FixedPoint" );
96 void updateMultistepRhs(vec_dbl_Type& coeff,
int nmbToUse);
99 void updateMultistepRhsFSI(vec_dbl_Type& coeff,
int nmbToUse);
105 void updateNewmarkRhs(
double dt,
double beta,
double gamma, vec_dbl_Type coeff);
107 void combineSystems()
const;
109 void initializeCombinedSystems()
const;
111 void assembleMassSystem( )
const;
115 int solveAndUpdate(
const std::string& criterion,
double& criterionValue );
121 int solve( BlockMultiVectorPtr_Type rhs = Teuchos::null );
123 double calculateResidualNorm();
125 void calculateNonLinResidualVec(std::string type=
"standard",
double time=0.)
const;
129 void addBoundaries(BCConstPtr_Type bcFactory);
131 void setBoundaries(
double time=.0);
133 void setBoundariesRHS(
double time=.0);
135 void setBoundariesSystem()
const;
139 BlockMultiVectorPtr_Type getRhs();
141 BlockMultiVectorPtr_Type getRhs()
const;
143 BlockMultiVectorPtr_Type getSolution();
145 BlockMultiVectorConstPtr_Type getSolutionConst()
const;
147 BlockMultiVectorPtr_Type getResidual();
149 BlockMultiVectorConstPtr_Type getResidualConst()
const;
151 DomainConstPtr_Type getDomain(
int i)
const;
153 std::string getFEType(
int i);
155 std::string getVariableName(
int i);
157 int getDofsPerNode(
int i);
159 BlockMatrixPtr_Type getSystem();
161 BlockMatrixPtr_Type getSystemCombined();
163 BlockMatrixPtr_Type getSystemCombined()
const;
165 ProblemPtr_Type getUnderlyingProblem();
167 void updateSolutionPreviousStep();
169 void updateSolutionMultiPreviousStep(
int nmbSteps);
171 void updateSystemMassMultiPreviousStep(
int nmbSteps);
177 void updateSolutionNewmarkPreviousStep(
double dt,
double beta,
double gamma);
179 BlockMultiVectorPtr_Type getSolutionPreviousTimestep();
181 BlockMultiVectorPtrArray_Type getSolutionAllPreviousTimestep();
183 BlockMatrixPtr_Type getMassSystem();
185 ParameterListPtr_Type getParameterList();
187 void assembleSourceTerm(
double time=0. );
189 BlockMultiVectorPtr_Type getSourceTerm( );
191 bool hasSourceTerm()
const;
193 CommConstPtr_Type getComm()
const{
return comm_;}
195 LinSolverBuilderPtr_Type getLinearSolverBuilder()
const;
197 void getValuesOfInterest( vec_dbl_Type& values );
199 void computeValuesOfInterestAndExport();
201 void updateTime(
double time ){ time_ = time;}
203 void addToRhs(BlockMultiVectorPtr_Type x);
205 ProblemPtr_Type problem_;
206 CommConstPtr_Type comm_;
208 mutable BlockMatrixPtr_Type systemCombined_;
209 mutable BlockMatrixPtr_Type systemMass_;
214 FEFacPtr_Type feFactory_;
218 ParameterListPtr_Type parameterList_;
219 mutable BCConstPtr_Type bcFactory_;
221 BlockMultiVectorPtrArray_Type solutionPreviousTimesteps_;
227 BlockMultiVectorPtrArray_Type velocityPreviousTimesteps_;
228 BlockMultiVectorPtrArray_Type accelerationPreviousTimesteps_;
233 BlockMatrixPtrArray_Type systemMassPreviousTimeSteps_;
237#define TIMEPROBLEM_TIMER
238#ifdef TIMEPROBLEM_TIMER
239 TimePtr_Type TimeSolveTimer_;
245 virtual Thyra::ModelEvaluatorBase::InArgs<SC> getNominalValues()
const;
247 virtual Teuchos::RCP<const ::Thyra::VectorSpaceBase<SC> > get_x_space()
const;
249 virtual Teuchos::RCP<const ::Thyra::VectorSpaceBase<SC> > get_f_space()
const;
251 virtual ::Thyra::ModelEvaluatorBase::InArgs<SC> createInArgs()
const;
253 virtual ::Thyra::ModelEvaluatorBase::OutArgs<SC> createOutArgsImpl()
const;
263 Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op() ;
265 Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op_Monolithic() ;
267 Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op_Block() ;
269 Teuchos::RCP<Thyra::PreconditionerBase<SC> > create_W_prec() ;
271 std::string description()
const;
274 virtual void evalModelImpl(
275 const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
276 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs
279 void evalModelImplMonolithic(const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
280 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs)
const;
282 void evalModelImplBlock(const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
283 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs)
const;
285 mutable bool precInitOnly_;