| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// LOCA: Library of Continuation Algorithms Package |
| 4 |
// |
| 5 |
// Copyright 2001-2005 NTESS and the LOCA contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
// 1D Finite Element Test Problem |
| 11 |
/* Solves continuation problem (Parameter c="Right BC") |
| 12 |
* |
| 13 |
* d2u |
| 14 |
* --- + a * u**3 = 0 |
| 15 |
* dx2 |
| 16 |
* |
| 17 |
* subject to @ x=0, u=b |
| 18 |
* subject to @ x=1, u=c |
| 19 |
*/ |
| 20 |
|
| 21 |
// LOCA Objects |
| 22 |
#include "LOCA.H" |
| 23 |
#include "LOCA_Epetra.H" |
| 24 |
#include "NOX_TestCompare.H" |
| 25 |
|
| 26 |
// Trilinos Objects |
| 27 |
#ifdef HAVE_MPI |
| 28 |
#include "Epetra_MpiComm.h" |
| 29 |
#else |
| 30 |
#include "Epetra_SerialComm.h" |
| 31 |
#endif |
| 32 |
#include "Epetra_Map.h" |
| 33 |
#include "Epetra_Vector.h" |
| 34 |
#include "Epetra_RowMatrix.h" |
| 35 |
#include "Epetra_CrsMatrix.h" |
| 36 |
#include "Epetra_Map.h" |
| 37 |
#include "Epetra_LinearProblem.h" |
| 38 |
#include "AztecOO.h" |
| 39 |
|
| 40 |
// User's application specific files |
| 41 |
#include "Problem_Interface.H" // Interface file to NOX |
| 42 |
#include "Tcubed_FiniteElementProblem.H" |
| 43 |
|
| 44 |
using namespace std; |
| 45 |
|
| 46 |
int tcubed_test(int NumGlobalElements, bool verbose, Epetra_Comm& Comm, |
| 47 |
bool includeUV, bool useP, const std::string& prec, |
| 48 |
const std::string& prec_method) |
| 49 |
{ |
| 50 |
int ierr = 0; |
| 51 |
int MyPID = Comm.MyPID(); |
| 52 |
|
| 53 |
if (MyPID == 0) { |
| 54 |
std::cout << "********** " |
| 55 |
<< "Testing includeUV = " << includeUV << " useP = " << useP |
| 56 |
<< " Preconditioner = " << prec |
| 57 |
<< " Preconditioner method = " << prec_method |
| 58 |
<< " **********" << std::endl; |
| 59 |
} |
| 60 |
|
| 61 |
try { |
| 62 |
|
| 63 |
double nonlinear_factor = 1.0; |
| 64 |
double left_bc = 0.0; |
| 65 |
double right_bc = 2.07; |
| 66 |
|
| 67 |
// Create the FiniteElementProblem class. This creates all required |
| 68 |
// Epetra objects for the problem and allows calls to the |
| 69 |
// function (RHS) and Jacobian evaluation routines. |
| 70 |
Tcubed_FiniteElementProblem Problem(NumGlobalElements, Comm); |
| 71 |
|
| 72 |
// Get the vector from the Problem |
| 73 |
Epetra_Vector& soln = Problem.getSolution(); |
| 74 |
|
| 75 |
// Initialize Solution |
| 76 |
soln.PutScalar(1.0); |
| 77 |
|
| 78 |
// Create initial guess for the null vector of jacobian |
| 79 |
// Only needed for Moore-Spence |
| 80 |
Teuchos::RCP<NOX::Abstract::Vector> nullVec = |
| 81 |
Teuchos::rcp(new NOX::Epetra::Vector(soln)); |
| 82 |
nullVec->init(1.0); // initial value 1.0 |
| 83 |
|
| 84 |
// Begin LOCA Solver ************************************ |
| 85 |
|
| 86 |
// Create parameter list |
| 87 |
Teuchos::RCP<Teuchos::ParameterList> paramList = |
| 88 |
Teuchos::rcp(new Teuchos::ParameterList); |
| 89 |
|
| 90 |
// Create LOCA sublist |
| 91 |
Teuchos::ParameterList& locaParamsList = paramList->sublist("LOCA"); |
| 92 |
|
| 93 |
// Create the stepper sublist and set the stepper parameters |
| 94 |
Teuchos::ParameterList& locaStepperList = |
| 95 |
locaParamsList.sublist("Stepper"); |
| 96 |
locaStepperList.set("Continuation Method", "Arc Length"); |
| 97 |
locaStepperList.set("Continuation Parameter", "Nonlinear Factor"); |
| 98 |
locaStepperList.set("Initial Value", nonlinear_factor); |
| 99 |
locaStepperList.set("Max Value", 2.0); |
| 100 |
locaStepperList.set("Min Value", 0.05); |
| 101 |
locaStepperList.set("Max Steps", 20); |
| 102 |
locaStepperList.set("Max Nonlinear Iterations", 15); |
| 103 |
|
| 104 |
locaStepperList.set("Bordered Solver Method", "Nested"); |
| 105 |
Teuchos::ParameterList& nestedList = |
| 106 |
locaStepperList.sublist("Nested Bordered Solver"); |
| 107 |
nestedList.set("Bordered Solver Method", "Householder"); |
| 108 |
nestedList.set("Include UV In Preconditioner", includeUV); |
| 109 |
nestedList.set("Use P For Preconditioner", useP); |
| 110 |
|
| 111 |
// Create bifurcation sublist |
| 112 |
Teuchos::ParameterList& bifurcationList = |
| 113 |
locaParamsList.sublist("Bifurcation"); |
| 114 |
bifurcationList.set("Type", "Turning Point"); |
| 115 |
bifurcationList.set("Bifurcation Parameter", "Right BC"); |
| 116 |
|
| 117 |
bifurcationList.set("Formulation", "Minimally Augmented"); |
| 118 |
bifurcationList.set("Symmetric Jacobian", false); |
| 119 |
bifurcationList.set("Update Null Vectors Every Continuation Step", true); |
| 120 |
bifurcationList.set("Update Null Vectors Every Nonlinear Iteration", |
| 121 |
false); |
| 122 |
bifurcationList.set("Transpose Solver Method",prec); |
| 123 |
bifurcationList.set("Multiply Null Vectors by Mass Matrix", true); |
| 124 |
|
| 125 |
// The others don't seem to work with "Solve df/dp" |
| 126 |
if (prec == "Explicit Transpose") |
| 127 |
bifurcationList.set("Initial Null Vector Computation", "Solve df/dp"); |
| 128 |
else { |
| 129 |
bifurcationList.set("Initial A Vector", nullVec); |
| 130 |
bifurcationList.set("Initial B Vector", nullVec); |
| 131 |
} |
| 132 |
|
| 133 |
bifurcationList.set("Bordered Solver Method", "Householder"); |
| 134 |
bifurcationList.set("Include UV In Preconditioner", includeUV); |
| 135 |
bifurcationList.set("Use P For Preconditioner", useP); |
| 136 |
bifurcationList.set("Preconditioner Method", prec_method); |
| 137 |
|
| 138 |
//bifurcationList.set("Formulation", "Moore-Spence"); |
| 139 |
//bifurcationList.set("Solver Method", "Phipps Bordering"); |
| 140 |
//bifurcationList.set("Solver Method", "Salinger Bordering"); |
| 141 |
//bifurcationList.set("Initial Null Vector", nullVec); |
| 142 |
//bifurcationList.set("Length Normalization Vector", nullVec); |
| 143 |
|
| 144 |
// Create predictor sublist |
| 145 |
Teuchos::ParameterList& predictorList = |
| 146 |
locaParamsList.sublist("Predictor"); |
| 147 |
predictorList.set("Method", "Secant"); |
| 148 |
|
| 149 |
// Create step size sublist |
| 150 |
Teuchos::ParameterList& stepSizeList = locaParamsList.sublist("Step Size"); |
| 151 |
stepSizeList.set("Method", "Adaptive"); |
| 152 |
stepSizeList.set("Initial Step Size", 0.1); |
| 153 |
stepSizeList.set("Min Step Size", 1.0e-3); |
| 154 |
stepSizeList.set("Max Step Size", 2000.0); |
| 155 |
stepSizeList.set("Aggressiveness", 0.1); |
| 156 |
|
| 157 |
// Create the "Solver" parameters sublist to be used with NOX Solvers |
| 158 |
Teuchos::ParameterList& nlParams = paramList->sublist("NOX"); |
| 159 |
|
| 160 |
// Create the NOX printing parameter list |
| 161 |
Teuchos::ParameterList& nlPrintParams = nlParams.sublist("Printing"); |
| 162 |
nlPrintParams.set("MyPID", MyPID); |
| 163 |
nlPrintParams.set("Output Precision", 4); |
| 164 |
if (verbose) |
| 165 |
nlPrintParams.set("Output Information", |
| 166 |
NOX::Utils::OuterIteration + |
| 167 |
NOX::Utils::OuterIterationStatusTest + |
| 168 |
NOX::Utils::InnerIteration + |
| 169 |
NOX::Utils::Details + |
| 170 |
NOX::Utils::LinearSolverDetails + |
| 171 |
NOX::Utils::Warning + |
| 172 |
NOX::Utils::TestDetails + |
| 173 |
NOX::Utils::Error + |
| 174 |
NOX::Utils::StepperIteration + |
| 175 |
NOX::Utils::StepperDetails + |
| 176 |
NOX::Utils::StepperParameters); |
| 177 |
else |
| 178 |
nlPrintParams.set("Output Information", NOX::Utils::Error); |
| 179 |
|
| 180 |
// Create the "Linear Solver" sublist for Newton's method |
| 181 |
Teuchos::ParameterList& dirParams = nlParams.sublist("Direction"); |
| 182 |
Teuchos::ParameterList& newParams = dirParams.sublist("Newton"); |
| 183 |
Teuchos::ParameterList& lsParams = newParams.sublist("Linear Solver"); |
| 184 |
lsParams.set("Aztec Solver", "GMRES"); |
| 185 |
lsParams.set("Max Iterations", 200); |
| 186 |
lsParams.set("Tolerance", 1e-6); |
| 187 |
lsParams.set("Output Frequency", 50); |
| 188 |
//lsParams.set("Scaling", "None"); |
| 189 |
//lsParams.set("Scaling", "Row Sum"); |
| 190 |
lsParams.set("Compute Scaling Manually", false); |
| 191 |
//lsParams.set("Preconditioner", "Ifpack"); |
| 192 |
lsParams.set("Preconditioner", "New Ifpack"); |
| 193 |
lsParams.set("Ifpack Preconditioner", "ILU"); |
| 194 |
|
| 195 |
// Create and initialize the parameter vector |
| 196 |
LOCA::ParameterVector pVector; |
| 197 |
pVector.addParameter("Nonlinear Factor",nonlinear_factor); |
| 198 |
pVector.addParameter("Left BC", left_bc); |
| 199 |
pVector.addParameter("Right BC", right_bc); |
| 200 |
|
| 201 |
// Create the interface between the test problem and the nonlinear solver |
| 202 |
// This is created by the user using inheritance of the abstract base class |
| 203 |
Teuchos::RCP<Problem_Interface> interface = |
| 204 |
Teuchos::rcp(new Problem_Interface(Problem)); |
| 205 |
Teuchos::RCP<LOCA::Epetra::Interface::TimeDependent> iReq = interface; |
| 206 |
Teuchos::RCP<NOX::Epetra::Interface::Jacobian> iJac = interface; |
| 207 |
|
| 208 |
// Create the Epetra_RowMatrixfor the Jacobian/Preconditioner |
| 209 |
Teuchos::RCP<Epetra_RowMatrix> Amat = |
| 210 |
Teuchos::rcp(&Problem.getJacobian(),false); |
| 211 |
|
| 212 |
// Create scaling object |
| 213 |
Teuchos::RCP<NOX::Epetra::Scaling> scaling = Teuchos::null; |
| 214 |
// scaling = Teuchos::rcp(new NOX::Epetra::Scaling); |
| 215 |
// Teuchos::RCP<Epetra_Vector> scalingVector = |
| 216 |
// Teuchos::rcp(new Epetra_Vector(soln.Map())); |
| 217 |
// //scaling->addRowSumScaling(NOX::Epetra::Scaling::Left, scalingVector); |
| 218 |
// scaling->addColSumScaling(NOX::Epetra::Scaling::Right, scalingVector); |
| 219 |
|
| 220 |
// Create transpose scaling object |
| 221 |
// Teuchos::RCP<NOX::Epetra::Scaling> trans_scaling = Teuchos::null; |
| 222 |
// trans_scaling = Teuchos::rcp(new NOX::Epetra::Scaling); |
| 223 |
// Teuchos::RCP<Epetra_Vector> transScalingVector = |
| 224 |
// Teuchos::rcp(new Epetra_Vector(soln.Map())); |
| 225 |
// trans_scaling->addRowSumScaling(NOX::Epetra::Scaling::Right, |
| 226 |
// transScalingVector); |
| 227 |
// trans_scaling->addColSumScaling(NOX::Epetra::Scaling::Left, |
| 228 |
// transScalingVector); |
| 229 |
// //bifurcationList.set("Transpose Scaling", trans_scaling); |
| 230 |
|
| 231 |
// Create the linear systems |
| 232 |
Teuchos::RCP<NOX::Epetra::LinearSystemAztecOO> linsys = |
| 233 |
Teuchos::rcp(new NOX::Epetra::LinearSystemAztecOO(nlPrintParams, |
| 234 |
lsParams, |
| 235 |
iReq, iJac, Amat, soln, |
| 236 |
scaling)); |
| 237 |
|
| 238 |
// Create the loca vector |
| 239 |
NOX::Epetra::Vector locaSoln(soln); |
| 240 |
|
| 241 |
// Create Epetra factory |
| 242 |
Teuchos::RCP<LOCA::Abstract::Factory> epetraFactory = |
| 243 |
Teuchos::rcp(new LOCA::Epetra::Factory); |
| 244 |
|
| 245 |
// Create global data object |
| 246 |
Teuchos::RCP<LOCA::GlobalData> globalData = |
| 247 |
LOCA::createGlobalData(paramList, epetraFactory); |
| 248 |
|
| 249 |
// Create the Group |
| 250 |
Teuchos::RCP<LOCA::Epetra::Group> grp = |
| 251 |
Teuchos::rcp(new LOCA::Epetra::Group(globalData, nlPrintParams, iReq, |
| 252 |
locaSoln, linsys, linsys, |
| 253 |
pVector)); |
| 254 |
grp->computeF(); |
| 255 |
|
| 256 |
// Create the Solver convergence test |
| 257 |
//NOX::StatusTest::NormWRMS wrms(1.0e-2, 1.0e-8); |
| 258 |
Teuchos::RCP<NOX::StatusTest::NormF> wrms = |
| 259 |
Teuchos::rcp(new NOX::StatusTest::NormF(1.0e-12)); |
| 260 |
Teuchos::RCP<NOX::StatusTest::MaxIters> maxiters = |
| 261 |
Teuchos::rcp(new NOX::StatusTest::MaxIters(locaStepperList.get("Max Nonlinear Iterations", 10))); |
| 262 |
Teuchos::RCP<NOX::StatusTest::Combo> combo = |
| 263 |
Teuchos::rcp(new NOX::StatusTest::Combo(NOX::StatusTest::Combo::OR)); |
| 264 |
combo->addStatusTest(wrms); |
| 265 |
combo->addStatusTest(maxiters); |
| 266 |
|
| 267 |
// Create the stepper |
| 268 |
LOCA::Stepper stepper(globalData, grp, combo, paramList); |
| 269 |
LOCA::Abstract::Iterator::IteratorStatus status = stepper.run(); |
| 270 |
|
| 271 |
if (status != LOCA::Abstract::Iterator::Finished) { |
| 272 |
ierr = 1; |
| 273 |
if (globalData->locaUtils->isPrintType(NOX::Utils::Error)) |
| 274 |
globalData->locaUtils->out() |
| 275 |
<< "Stepper failed to converge!" << std::endl; |
| 276 |
} |
| 277 |
|
| 278 |
// Get the final solution from the stepper |
| 279 |
Teuchos::RCP<const LOCA::Epetra::Group> finalGroup = |
| 280 |
Teuchos::rcp_dynamic_cast<const LOCA::Epetra::Group>(stepper.getSolutionGroup()); |
| 281 |
const NOX::Epetra::Vector& finalSolution = |
| 282 |
dynamic_cast<const NOX::Epetra::Vector&>(finalGroup->getX()); |
| 283 |
|
| 284 |
// Output the parameter list |
| 285 |
if (globalData->locaUtils->isPrintType(NOX::Utils::StepperParameters)) { |
| 286 |
globalData->locaUtils->out() |
| 287 |
<< std::endl << "Final Parameters" << std::endl |
| 288 |
<< "****************" << std::endl; |
| 289 |
stepper.getList()->print(globalData->locaUtils->out()); |
| 290 |
globalData->locaUtils->out() << std::endl; |
| 291 |
} |
| 292 |
|
| 293 |
// Check some statistics on the solution |
| 294 |
NOX::TestCompare testCompare(globalData->locaUtils->out(), |
| 295 |
*(globalData->locaUtils)); |
| 296 |
|
| 297 |
if (globalData->locaUtils->isPrintType(NOX::Utils::TestDetails)) |
| 298 |
globalData->locaUtils->out() |
| 299 |
<< std::endl |
| 300 |
<< "***** Checking solution statistics *****" |
| 301 |
<< std::endl; |
| 302 |
|
| 303 |
// Check number of steps |
| 304 |
int numSteps = stepper.getStepNumber(); |
| 305 |
int numSteps_expected = 7; |
| 306 |
ierr += testCompare.testValue(numSteps, numSteps_expected, 0.0, |
| 307 |
"number of continuation steps", |
| 308 |
NOX::TestCompare::Absolute); |
| 309 |
|
| 310 |
// Check number of failed steps |
| 311 |
int numFailedSteps = stepper.getNumFailedSteps(); |
| 312 |
int numFailedSteps_expected = 0; |
| 313 |
ierr += testCompare.testValue(numFailedSteps, numFailedSteps_expected, 0.0, |
| 314 |
"number of failed continuation steps", |
| 315 |
NOX::TestCompare::Absolute); |
| 316 |
|
| 317 |
// Check final value of continuation parameter |
| 318 |
double factor_final = finalGroup->getParam("Nonlinear Factor"); |
| 319 |
double factor_expected = 2.0; |
| 320 |
ierr += testCompare.testValue(factor_final, factor_expected, 1.0e-14, |
| 321 |
"final value of continuation parameter", |
| 322 |
NOX::TestCompare::Relative); |
| 323 |
|
| 324 |
// Check final value of bifurcation parameter |
| 325 |
double right_bc_final = finalGroup->getParam("Right BC"); |
| 326 |
double right_bc_expected = 1.47241293; |
| 327 |
ierr += testCompare.testValue(right_bc_final, right_bc_expected, 1.0e-7, |
| 328 |
"final value of bifurcation parameter", |
| 329 |
NOX::TestCompare::Relative); |
| 330 |
|
| 331 |
// Check norm of solution |
| 332 |
double norm_x = finalSolution.norm(); |
| 333 |
double norm_x_expected = 12.038464; |
| 334 |
ierr += testCompare.testValue(norm_x, norm_x_expected, 1.0e-7, |
| 335 |
"norm of final solution", |
| 336 |
NOX::TestCompare::Relative); |
| 337 |
|
| 338 |
LOCA::destroyGlobalData(globalData); |
| 339 |
|
| 340 |
} |
| 341 |
|
| 342 |
catch (std::exception& e) { |
| 343 |
std::cout << e.what() << std::endl; |
| 344 |
ierr = 1; |
| 345 |
} |
| 346 |
catch (const char *s) { |
| 347 |
std::cout << s << std::endl; |
| 348 |
ierr = 1; |
| 349 |
} |
| 350 |
catch (...) { |
| 351 |
std::cout << "Caught unknown exception!" << std::endl; |
| 352 |
ierr = 1; |
| 353 |
} |
| 354 |
|
| 355 |
return ierr ; |
| 356 |
} |
| 357 |
|
| 358 |
int main(int argc, char *argv[]) |
| 359 |
{ |
| 360 |
int ierr = 0; |
| 361 |
|
| 362 |
// Initialize MPI |
| 363 |
#ifdef HAVE_MPI |
| 364 |
MPI_Init(&argc,&argv); |
| 365 |
#endif |
| 366 |
|
| 367 |
// Create a communicator for Epetra objects |
| 368 |
#ifdef HAVE_MPI |
| 369 |
Epetra_MpiComm Comm( MPI_COMM_WORLD ); |
| 370 |
#else |
| 371 |
Epetra_SerialComm Comm; |
| 372 |
#endif |
| 373 |
|
| 374 |
// Get the process ID and the total number of processors |
| 375 |
int MyPID = Comm.MyPID(); |
| 376 |
int NumProc = Comm.NumProc(); |
| 377 |
|
| 378 |
// Check for verbose output |
| 379 |
bool verbose = false; |
| 380 |
if (argc>1) |
| 381 |
if (argv[1][0]=='-' && argv[1][1]=='v') |
| 382 |
verbose = true; |
| 383 |
|
| 384 |
// Get the number of elements from the command line |
| 385 |
int NumGlobalElements = 0; |
| 386 |
if ((argc > 2) && (verbose)) |
| 387 |
NumGlobalElements = atoi(argv[2]) + 1; |
| 388 |
else if ((argc > 1) && (!verbose)) |
| 389 |
NumGlobalElements = atoi(argv[1]) + 1; |
| 390 |
else |
| 391 |
NumGlobalElements = 101; |
| 392 |
|
| 393 |
// The number of unknowns must be at least equal to the |
| 394 |
// number of processors. |
| 395 |
if (NumGlobalElements < NumProc) { |
| 396 |
std::cout << "numGlobalBlocks = " << NumGlobalElements |
| 397 |
<< " cannot be < number of processors = " << NumProc << std::endl; |
| 398 |
exit(1); |
| 399 |
} |
| 400 |
|
| 401 |
// Test includeUV = true, useP = true, prec = "Transpose Preconditioner" |
| 402 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 403 |
true, true, "Transpose Preconditioner", |
| 404 |
"Jacobian"); |
| 405 |
|
| 406 |
// Test includeUV = true, useP = false, prec = "Transpose Preconditioner" |
| 407 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 408 |
true, false, "Transpose Preconditioner", |
| 409 |
"Jacobian"); |
| 410 |
|
| 411 |
// Test includeUV = false, useP = true, prec = "Transpose Preconditioner" |
| 412 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 413 |
true, true, "Transpose Preconditioner", |
| 414 |
"SMW"); |
| 415 |
|
| 416 |
// Test includeUV = false, useP = false, prec = "Transpose Preconditioner" |
| 417 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 418 |
true, false, "Transpose Preconditioner", |
| 419 |
"SMW"); |
| 420 |
|
| 421 |
if (NumProc > 1) { |
| 422 |
// Test includeUV = false, useP = true, prec = "Transpose Preconditioner" |
| 423 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 424 |
false, true, "Transpose Preconditioner", |
| 425 |
"Jacobian"); |
| 426 |
|
| 427 |
// Test includeUV = false, useP = false, prec = "Transpose Preconditioner" |
| 428 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 429 |
false, false, "Transpose Preconditioner", |
| 430 |
"Jacobian"); |
| 431 |
|
| 432 |
// Test includeUV = false, useP = true, prec = "Transpose Preconditioner" |
| 433 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 434 |
false, true, "Transpose Preconditioner", |
| 435 |
"SMW"); |
| 436 |
|
| 437 |
// Test includeUV = false, useP = false, prec = "Transpose Preconditioner" |
| 438 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 439 |
false, false, "Transpose Preconditioner", |
| 440 |
"SMW"); |
| 441 |
} |
| 442 |
|
| 443 |
// Test includeUV = true, useP = true, prec = "Left Preconditioning" |
| 444 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 445 |
true, true, "Left Preconditioning", |
| 446 |
"Jacobian"); |
| 447 |
|
| 448 |
// Test includeUV = true, useP = false, prec = "Left Preconditioning" |
| 449 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 450 |
true, false, "Left Preconditioning", |
| 451 |
"Jacobian"); |
| 452 |
|
| 453 |
// Test includeUV = true, useP = true, prec = "Left Preconditioning" |
| 454 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 455 |
true, true, "Left Preconditioning", |
| 456 |
"SMW"); |
| 457 |
|
| 458 |
// Test includeUV = true, useP = false, prec = "Left Preconditioning" |
| 459 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 460 |
true, false, "Left Preconditioning", |
| 461 |
"SMW"); |
| 462 |
|
| 463 |
if (NumProc > 1) { |
| 464 |
// Test includeUV = false, useP = true, prec = "Left Preconditioning" |
| 465 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 466 |
false, true, "Left Preconditioning", |
| 467 |
"Jacobian"); |
| 468 |
|
| 469 |
// Test includeUV = false, useP = false, prec = "Left Preconditioning" |
| 470 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 471 |
false, false, "Left Preconditioning", |
| 472 |
"Jacobian"); |
| 473 |
|
| 474 |
// Test includeUV = false, useP = true, prec = "Left Preconditioning" |
| 475 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 476 |
false, true, "Left Preconditioning", |
| 477 |
"SMW"); |
| 478 |
|
| 479 |
// Test includeUV = false, useP = false, prec = "Left Preconditioning" |
| 480 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 481 |
false, false, "Left Preconditioning", |
| 482 |
"SMW"); |
| 483 |
} |
| 484 |
|
| 485 |
#ifdef HAVE_NOX_EPETRAEXT |
| 486 |
// Test includeUV = true, useP = true, prec = "Explicit Transpose" |
| 487 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 488 |
true, true, "Explicit Transpose", |
| 489 |
"Jacobian"); |
| 490 |
|
| 491 |
// Test includeUV = true, useP = false, prec = "Explicit Transpose" |
| 492 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 493 |
true, false, "Explicit Transpose", |
| 494 |
"Jacobian"); |
| 495 |
|
| 496 |
if (NumProc > 1) { |
| 497 |
// Test includeUV = false, useP = true, prec = "Explicit Transpose" |
| 498 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 499 |
false, true, "Explicit Transpose", |
| 500 |
"Jacobian"); |
| 501 |
|
| 502 |
// Test includeUV = false, useP = false, prec = "Explicit Transpose" |
| 503 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 504 |
false, false, "Explicit Transpose", |
| 505 |
"Jacobian"); |
| 506 |
|
| 507 |
// Test includeUV = false, useP = true, prec = "Explicit Transpose" |
| 508 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 509 |
false, true, "Explicit Transpose", |
| 510 |
"SMW"); |
| 511 |
|
| 512 |
// Test includeUV = false, useP = false, prec = "Explicit Transpose" |
| 513 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 514 |
false, false, "Explicit Transpose", |
| 515 |
"SMW"); |
| 516 |
} |
| 517 |
|
| 518 |
// Test includeUV = false, useP = false, prec = "Explicit Transpose" |
| 519 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 520 |
true, true, "Explicit Transpose", |
| 521 |
"SMW"); |
| 522 |
|
| 523 |
// Test includeUV = false, useP = false, prec = "Explicit Transpose" |
| 524 |
ierr += tcubed_test(NumGlobalElements, verbose, Comm, |
| 525 |
true, false, "Explicit Transpose", |
| 526 |
"SMW"); |
| 527 |
#endif |
| 528 |
|
| 529 |
if (MyPID == 0) { |
| 530 |
if (ierr == 0) |
| 531 |
std::cout << "All tests passed!" << std::endl; |
| 532 |
else |
| 533 |
std::cout << ierr << " test(s) failed!" << std::endl; |
| 534 |
} |
| 535 |
|
| 536 |
#ifdef HAVE_MPI |
| 537 |
MPI_Finalize() ; |
| 538 |
#endif |
| 539 |
|
| 540 |
/* end main |
| 541 |
*/ |
| 542 |
return ierr ; |
| 543 |
} |