24class NonLinearProblem :
public Problem<SC,LO,GO,NO> ,
public Thyra::StateFuncModelEvaluatorBase<SC> {
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;
37 typedef typename Problem_Type::Matrix_Type Matrix_Type;
38 typedef typename Problem_Type::MatrixPtr_Type MatrixPtr_Type;
40 typedef typename Problem_Type::BlockMatrix_Type BlockMatrix_Type;
41 typedef typename Problem_Type::BlockMatrixPtr_Type BlockMatrixPtr_Type;
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;
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;
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 typedef Thyra::BlockedLinearOpBase<SC> ThyraBlockOp_Type;
63 NonLinearProblem(CommConstPtr_Type comm);
65 NonLinearProblem(ParameterListPtr_Type ¶meterList, CommConstPtr_Type comm);
69 virtual void info() = 0;
71 void infoNonlinProblem();
73 void initializeProblem(
int nmbVectors=1);
75 virtual void assemble( std::string type =
"" )
const = 0;
77 virtual void getValuesOfInterest( vec_dbl_Type& values ) = 0;
79 int solveAndUpdate(
const std::string& criterion ,
double& criterionValue );
85 virtual void reAssemble( BlockMultiVectorPtr_Type previousSolution )
const = 0;
87 void reAssembleAndFill( BlockMatrixPtr_Type bMat, std::string type=
"FixedPoint" );
89 virtual void reAssembleExtrapolation(BlockMultiVectorPtrArray_Type previousSolutions) = 0;
93 void initializeVectorsNonLinear(
int nmbVectors=1);
95 double calculateResidualNorm()
const;
97 virtual void calculateNonLinResidualVec(std::string type=
"standard",
double time=0.)
const = 0;
100 virtual void calculateNonLinResidualVec(
SmallMatrix<double>& coeff, std::string type=
"standard",
double time=0.);
102 BlockMultiVectorPtr_Type getResidualVector()
const;
104 BlockMultiVectorPtr_Type getPreviousSolution()
const{
return previousSolution_; }
106 virtual Thyra::ModelEvaluatorBase::InArgs<SC> getNominalValues()
const;
108 virtual Teuchos::RCP<const ::Thyra::VectorSpaceBase<SC> > get_x_space()
const;
110 virtual Teuchos::RCP<const ::Thyra::VectorSpaceBase<SC> > get_f_space()
const;
112 virtual ::Thyra::ModelEvaluatorBase::InArgs<SC> createInArgs()
const;
114 void initNOXParameters( );
116 void initVectorSpaces( );
118 void initVectorSpacesMonolithic( );
120 void initVectorSpacesBlock( );
125 virtual ::Thyra::ModelEvaluatorBase::OutArgs<SC> createOutArgsImpl()
const;
127 double nonLinearTolerance_;
128 BlockMultiVectorPtr_Type previousSolution_;
129 mutable BlockMultiVectorPtr_Type residualVec_;
132 mutable int newtonStep_;
135 Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op_Monolithic()
const;
137 Teuchos::RCP< Thyra::LinearOpBase<SC> > create_W_op_Block()
const;
139 Teuchos::RCP<Thyra::PreconditionerBase<SC> > create_W_prec()
const;
143 mutable bool precInitOnly_;
149 Thyra::ModelEvaluatorBase::InArgs<SC> nominalValues_;
151 ::Thyra::ModelEvaluatorBase::InArgs<SC> prototypeInArgs_;
152 ::Thyra::ModelEvaluatorBase::OutArgs<SC> prototypeOutArgs_;
154 Teuchos::RCP<const ThyraVecSpace_Type> xSpace_;
155 Teuchos::RCP<const ThyraVecSpace_Type> fSpace_;
157 Teuchos::RCP<ThyraVec_Type> x0_;
159 virtual void evalModelImpl(
160 const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
161 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs
164 void evalModelImplMonolithic(const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
165 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs)
const;
168 void evalModelImplBlock(const ::Thyra::ModelEvaluatorBase::InArgs<SC> &inArgs,
169 const ::Thyra::ModelEvaluatorBase::OutArgs<SC> &outArgs)
const;