18NonLinTPM<SC,LO,GO,NO>::NonLinTPM(
const DomainConstPtr_Type &domainVelocity, std::string FETypeVelocity,
const DomainConstPtr_Type &domainPressure, std::string FETypePressure, ParameterListPtr_Type parameterList):
153 std::cout <<
"-- Assembly nonlinear TPM " <<
" ("<<type <<
") ... " << std::flush;
155 std::string tpmType = this->parameterList_->sublist(
"Parameter").get(
"TPM Type",
"Biot");
157 if (type==
"Newton-Residual") {
161 if (type ==
"FirstAssemble") {
162 if (u_repNewton_.is_null()){
163 u_repNewton_ = Teuchos::rcp(
new MultiVector_Type( this->getDomain(0)->getMapVecFieldRepeated() )) ;
164 u_repNewton_->putScalar(0.);
166 if (p_repNewton_.is_null()){
167 p_repNewton_ = Teuchos::rcp(
new MultiVector_Type( this->getDomain(1)->getMapRepeated() )) ;
168 p_repNewton_->putScalar(0.);
171 if (u_repTime_.is_null()){
172 u_repTime_ = Teuchos::rcp(
new MultiVector_Type( this->getDomain(0)->getMapVecFieldRepeated() )) ;
173 u_repTime_->putScalar(0.);
175 if (p_repTime_.is_null()){
176 p_repTime_ = Teuchos::rcp(
new MultiVector_Type( this->getDomain(1)->getMapRepeated() )) ;
177 p_repTime_->putScalar(0.);
182 if (type ==
"SetSolutionInTime") {
183 TEUCHOS_TEST_FOR_EXCEPTION( u_repTime_.is_null(), std::runtime_error,
"u_repTime_ not initialized.");
184 TEUCHOS_TEST_FOR_EXCEPTION( p_repTime_.is_null(), std::runtime_error,
"p_repTime_ not initialized.");
185 MultiVectorConstPtr_Type u = this->solution_->getBlock(0);
186 MultiVectorConstPtr_Type p = this->solution_->getBlock(1);
187 u_repTime_->importFromVector(u,
true);
188 p_repTime_->importFromVector(p,
true);
190 else if (type ==
"SetSolutionNewton") {
191 TEUCHOS_TEST_FOR_EXCEPTION( u_repNewton_.is_null(), std::runtime_error,
"u_repNewton_ not initialized.");
192 TEUCHOS_TEST_FOR_EXCEPTION( p_repNewton_.is_null(), std::runtime_error,
"p_repNewton_ not initialized.");
194 MultiVectorConstPtr_Type u = this->solution_->getBlock(0);
195 MultiVectorConstPtr_Type p = this->solution_->getBlock(1);
196 u_repNewton_->importFromVector(u,
true);
197 p_repNewton_->importFromVector(p,
true);
199 else if( type ==
"FirstAssemble" || type ==
"Assemble" || type ==
"OnlyUpdate" || type ==
"AssembleAndUpdate"){
201 std::cout <<
"-- External assembly ... " << std::flush;
203 MapConstPtr_Type mapRepeatedConst1 = this->getDomain(0)->getMapRepeated();
204 MapConstPtr_Type mapRepeatedConst2 = this->getDomain(1)->getMapRepeated();
205 MapPtr_Type mapRepeated1 = Teuchos::rcp_const_cast<Map_Type>(mapRepeatedConst1);
206 MapPtr_Type mapRepeated2 = Teuchos::rcp_const_cast<Map_Type>(mapRepeatedConst2);
208 MatrixPtr_Type A00(
new Matrix_Type( this->getDomain(0)->getMapVecFieldUnique(), this->getDomain(0)->getDimension() * this->getDomain(0)->getApproxEntriesPerRow() ) );
209 MatrixPtr_Type A01(
new Matrix_Type( this->getDomain(0)->getMapVecFieldUnique(), this->getDomain(1)->getDimension() * this->getDomain(1)->getApproxEntriesPerRow() ) );
210 MatrixPtr_Type A10(
new Matrix_Type( this->getDomain(1)->getMapUnique(), this->getDomain(0)->getDimension() * this->getDomain(0)->getApproxEntriesPerRow() ) );
211 MatrixPtr_Type A11(
new Matrix_Type( this->getDomain(1)->getMapUnique(), this->getDomain(1)->getDimension() * this->getDomain(1)->getApproxEntriesPerRow() ) );
214 MultiVectorPtr_Type F0(
new MultiVector_Type( this->getDomain(0)->getMapVecFieldRepeated(), 1 ) );
215 MultiVectorPtr_Type F1(
new MultiVector_Type( this->getDomain(1)->getMapRepeated(), 1 ) );
217 bool update(type ==
"FirstAssemble" || type ==
"Assemble" || type ==
"AssembleAndUpdate");
218 bool updateHistory(type ==
"OnlyUpdate" || type ==
"AssembleAndUpdate");
220 if(tpmType ==
"Biot" || tpmType ==
"Biot-StVK"){
221 this->feFactory_->assemblyAceGenTPM(A00,
229 this->parameterList_,
238 this->system_->addBlock( A00, 0, 0 );
239 this->system_->addBlock( A01, 0, 1 );
240 this->system_->addBlock( A10, 1, 0 );
241 this->system_->addBlock( A11, 1, 1 );
244 MultiVectorPtr_Type F0Unique = Teuchos::rcp(
new MultiVector_Type( this->getDomain(0)->getMapVecFieldUnique() ) );
245 MultiVectorPtr_Type F1Unique = Teuchos::rcp(
new MultiVector_Type( this->getDomain(1)->getMapUnique() ) );
246 F0Unique->exportFromVector( F0,
false,
"Add" );
247 F1Unique->exportFromVector( F1,
false,
"Add" );
249 this->rhs_->addBlock( F0Unique, 0 );
250 this->rhs_->addBlock( F1Unique, 1 );
254 std::cout <<
"done -- " << std::endl;