| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// NOX: An Object-Oriented Nonlinear Solver Package |
| 4 |
// |
| 5 |
// Copyright 2002 NTESS and the NOX contributors. |
| 6 |
// SPDX-License-Identifier: BSD-3-Clause |
| 7 |
// ***************************************************************************** |
| 8 |
// @HEADER |
| 9 |
|
| 10 |
// 1D Finite Element Interfacial Coupling Problem from |
| 11 |
// Yeckel, Pandy & Derby IJNME 2006. |
| 12 |
|
| 13 |
/* Solves the nonlinear equation: |
| 14 |
*/ |
| 15 |
|
| 16 |
// NOX Objects |
| 17 |
#include "NOX.H" |
| 18 |
#include "NOX_Epetra.H" |
| 19 |
#include "NOX_TestCompare.H" |
| 20 |
|
| 21 |
// For parsing command line |
| 22 |
#include "Teuchos_CommandLineProcessor.hpp" |
| 23 |
|
| 24 |
// Trilinos Objects |
| 25 |
#ifdef HAVE_MPI |
| 26 |
#include "Epetra_MpiComm.h" |
| 27 |
#else |
| 28 |
#include "Epetra_SerialComm.h" |
| 29 |
#endif |
| 30 |
#include "Epetra_Map.h" |
| 31 |
#include "Epetra_Vector.h" |
| 32 |
#include "Epetra_RowMatrix.h" |
| 33 |
#include "Epetra_CrsMatrix.h" |
| 34 |
#include "Epetra_Map.h" |
| 35 |
#include "Epetra_LinearProblem.h" |
| 36 |
#include "AztecOO.h" |
| 37 |
|
| 38 |
#ifdef HAVE_NOX_ML_EPETRA |
| 39 |
#include "Teuchos_ParameterList.hpp" |
| 40 |
#endif |
| 41 |
|
| 42 |
// Headers needed for FD coloring |
| 43 |
#include <vector> |
| 44 |
#ifdef HAVE_NOX_EPETRAEXT // Use epetraext package in Trilinos |
| 45 |
#include "EpetraExt_MapColoring.h" |
| 46 |
#include "EpetraExt_MapColoringIndex.h" |
| 47 |
#endif |
| 48 |
|
| 49 |
// New coupling library headers |
| 50 |
#include "NOX_Multiphysics_Solver_Manager.H" |
| 51 |
|
| 52 |
// User's application specific files |
| 53 |
#include "Problem_Manager.H" |
| 54 |
#include "NOX_Epetra_SchurCoupler.H" |
| 55 |
#include "Problem_Interface.H" |
| 56 |
#include "ConvDiff_PDE.H" |
| 57 |
|
| 58 |
// Added to allow timings |
| 59 |
#include "Epetra_Time.h" |
| 60 |
|
| 61 |
// Added temporarily |
| 62 |
#include "Epetra_IntVector.h" |
| 63 |
|
| 64 |
using namespace std; |
| 65 |
|
| 66 |
int main(int argc, char *argv[]) |
| 67 |
{ |
| 68 |
|
| 69 |
// Initialize MPI |
| 70 |
#ifdef HAVE_MPI |
| 71 |
MPI_Init(&argc,&argv); |
| 72 |
#endif |
| 73 |
|
| 74 |
// Create a communicator for Epetra objects |
| 75 |
#ifdef HAVE_MPI |
| 76 |
Epetra_MpiComm Comm( MPI_COMM_WORLD ); |
| 77 |
#else |
| 78 |
Epetra_SerialComm Comm; |
| 79 |
#endif |
| 80 |
|
| 81 |
Teuchos::CommandLineProcessor clp( false ); |
| 82 |
|
| 83 |
// Default run-time options that can be changed from the command line |
| 84 |
CouplingSolveMethod method = MATRIX_FREE ; |
| 85 |
bool verbose = true ; |
| 86 |
int NumGlobalNodes = 20 ; |
| 87 |
int probSizeRatio = 1 ; |
| 88 |
bool useMatlab = false ; |
| 89 |
bool doOffBlocks = false ; |
| 90 |
std::string solvType = "seidel" ; |
| 91 |
// Coupling parameters |
| 92 |
double alpha = 0.50 ; |
| 93 |
double beta = 0.40 ; |
| 94 |
// Physical parameters |
| 95 |
double radiation = 5.67 ; |
| 96 |
double initVal = 0.995 ; |
| 97 |
std::string outputDir = "." ; |
| 98 |
std::string goldDir = "." ; |
| 99 |
|
| 100 |
|
| 101 |
clp.setOption<CouplingSolveMethod>( "solvemethod", &method, 4, SolveMethodValues, SolveMethodNames, "Selects the coupling method to use"); |
| 102 |
clp.setOption( "verbose", "no-verbose", &verbose, "Verbosity on or off." ); |
| 103 |
clp.setOption( "n", &NumGlobalNodes, "Number of elements" ); |
| 104 |
clp.setOption( "nratio", &probSizeRatio, "Ratio of size of problem 2 to problem 1" ); |
| 105 |
clp.setOption( "offblocks", "no-offblocks", &doOffBlocks, "Include off-diagonal blocks in preconditioning matrix" ); |
| 106 |
clp.setOption( "matlab", "no-matlab", &useMatlab, "Use Matlab debugging engine" ); |
| 107 |
clp.setOption( "solvType", &solvType, "Solve Type. Valid choices are: jacobi, seidel" ); |
| 108 |
clp.setOption( "alpha", &alpha, "Interfacial coupling coefficient, alpha" ); |
| 109 |
clp.setOption( "beta", &beta, "Interfacial coupling coefficient, beta" ); |
| 110 |
clp.setOption( "radiation", &radiation, "Radiation source term coefficient, R" ); |
| 111 |
clp.setOption( "initialval", &initVal, "Initial guess for solution values" ); |
| 112 |
clp.setOption( "outputdir", &outputDir, "Directory to output mesh and results into. Default is \"./\"" ); |
| 113 |
clp.setOption( "golddir", &goldDir, "Directory to read gold test from. Default is \"./\"" ); |
| 114 |
|
| 115 |
Teuchos::CommandLineProcessor::EParseCommandLineReturn parse_return = clp.parse(argc,argv); |
| 116 |
|
| 117 |
if( parse_return != Teuchos::CommandLineProcessor::PARSE_SUCCESSFUL ) |
| 118 |
return parse_return; |
| 119 |
|
| 120 |
outputDir += "/"; |
| 121 |
goldDir += "/"; |
| 122 |
|
| 123 |
// Create and reset the Timer |
| 124 |
Epetra_Time myTimer(Comm); |
| 125 |
double startWallTime = myTimer.WallTime(); |
| 126 |
|
| 127 |
// Get the process ID and the total number of processors |
| 128 |
int MyPID = Comm.MyPID(); |
| 129 |
int NumProc = Comm.NumProc(); |
| 130 |
|
| 131 |
NumGlobalNodes++; // convert #elements to #nodes |
| 132 |
|
| 133 |
// The number of unknowns must be at least equal to the number of processors. |
| 134 |
if (NumGlobalNodes < NumProc) |
| 135 |
{ |
| 136 |
std::cout << "numGlobalNodes = " << NumGlobalNodes |
| 137 |
<< " cannot be < number of processors = " << NumProc << std::endl; |
| 138 |
exit(1); |
| 139 |
} |
| 140 |
|
| 141 |
// Begin Nonlinear Solver ************************************ |
| 142 |
|
| 143 |
// NOTE: For now these parameters apply to all problems handled by |
| 144 |
// Problem_Manager. Each problem could be made to have its own |
| 145 |
// parameter list as wwell as its own convergence test(s). |
| 146 |
|
| 147 |
// Create the top level parameter list |
| 148 |
Teuchos::RCP<Teuchos::ParameterList> nlParamsPtr = |
| 149 |
Teuchos::rcp(new Teuchos::ParameterList); |
| 150 |
Teuchos::ParameterList& nlParams = *(nlParamsPtr.get()); |
| 151 |
|
| 152 |
// Set the nonlinear solver method |
| 153 |
nlParams.set("Nonlinear Solver", "Line Search Based"); |
| 154 |
|
| 155 |
// Set the printing parameters in the "Printing" sublist |
| 156 |
Teuchos::ParameterList& printParams = nlParams.sublist("Printing"); |
| 157 |
printParams.set("MyPID", MyPID); |
| 158 |
printParams.set("Output Precision", 3); |
| 159 |
printParams.set("Output Processor", 0); |
| 160 |
printParams.set("Output Information", |
| 161 |
NOX::Utils::Warning + |
| 162 |
NOX::Utils::OuterIteration + |
| 163 |
NOX::Utils::InnerIteration + |
| 164 |
NOX::Utils::Parameters + |
| 165 |
NOX::Utils::Details + |
| 166 |
NOX::Utils::OuterIterationStatusTest + |
| 167 |
NOX::Utils::LinearSolverDetails + |
| 168 |
NOX::Utils::TestDetails ); |
| 169 |
|
| 170 |
NOX::Utils outputUtils(printParams); |
| 171 |
|
| 172 |
// Sublist for line search |
| 173 |
Teuchos::ParameterList& searchParams = nlParams.sublist("Line Search"); |
| 174 |
searchParams.set("Method", "Full Step"); |
| 175 |
|
| 176 |
// Sublist for direction |
| 177 |
Teuchos::ParameterList& dirParams = nlParams.sublist("Direction"); |
| 178 |
dirParams.set("Method", "Newton"); |
| 179 |
Teuchos::ParameterList& newtonParams = dirParams.sublist("Newton"); |
| 180 |
newtonParams.set("Forcing Term Method", "Constant"); |
| 181 |
|
| 182 |
// Sublist for linear solver for the Newton method |
| 183 |
Teuchos::ParameterList& lsParams = newtonParams.sublist("Linear Solver"); |
| 184 |
lsParams.set("Aztec Solver", "GMRES"); |
| 185 |
lsParams.set("Max Iterations", 800); |
| 186 |
lsParams.set("Tolerance", 1e-4); |
| 187 |
lsParams.set("Output Frequency", 50); |
| 188 |
lsParams.set("Preconditioner", "AztecOO"); |
| 189 |
|
| 190 |
// Create the convergence tests |
| 191 |
// Note: as for the parameter list, both (all) problems use the same |
| 192 |
// convergence test(s) for now, but each could have its own. |
| 193 |
Teuchos::RCP<NOX::StatusTest::NormF> absresid = |
| 194 |
Teuchos::rcp(new NOX::StatusTest::NormF(1.0e-8)); |
| 195 |
Teuchos::RCP<NOX::StatusTest::NormUpdate> update = |
| 196 |
Teuchos::rcp(new NOX::StatusTest::NormUpdate(1.0e-5)); |
| 197 |
Teuchos::RCP<NOX::StatusTest::Combo> converged = |
| 198 |
Teuchos::rcp(new NOX::StatusTest::Combo(NOX::StatusTest::Combo::AND)); |
| 199 |
converged->addStatusTest(absresid); |
| 200 |
//converged->addStatusTest(update); |
| 201 |
Teuchos::RCP<NOX::StatusTest::MaxIters> maxiters = |
| 202 |
Teuchos::rcp(new NOX::StatusTest::MaxIters(500)); |
| 203 |
Teuchos::RCP<NOX::StatusTest::FiniteValue> finiteValue = |
| 204 |
Teuchos::rcp(new NOX::StatusTest::FiniteValue); |
| 205 |
Teuchos::RCP<NOX::StatusTest::Combo> combo = |
| 206 |
Teuchos::rcp(new NOX::StatusTest::Combo(NOX::StatusTest::Combo::OR)); |
| 207 |
combo->addStatusTest(converged); |
| 208 |
combo->addStatusTest(maxiters); |
| 209 |
combo->addStatusTest(finiteValue); |
| 210 |
|
| 211 |
// Create the Problem Manager |
| 212 |
Problem_Manager problemManager(Comm, false, 0, useMatlab); |
| 213 |
|
| 214 |
// Note that each problem could contain its own nlParams list as well as |
| 215 |
// its own convergence test(s). |
| 216 |
problemManager.registerParameters(nlParamsPtr); |
| 217 |
problemManager.registerStatusTest(combo); |
| 218 |
|
| 219 |
// Domain boundary temperaures |
| 220 |
double Tleft = 0.98 ; |
| 221 |
double Tright = 1.0 ; |
| 222 |
|
| 223 |
// Distinguish certain parameters needed for T1_analytic |
| 224 |
double peclet_1 = 9.0 ; |
| 225 |
double peclet_2 = 0.0 ; |
| 226 |
double kappa_1 = 1.0 ; |
| 227 |
double kappa_2 = 0.1 ; |
| 228 |
|
| 229 |
double T1_analytic = ConvDiff_PDE::computeAnalyticInterfaceTemp( radiation, Tleft, Tright, kappa_2, peclet_1 ); |
| 230 |
|
| 231 |
// Create Region 1 PDE |
| 232 |
std::string myName = "Region_1" ; |
| 233 |
double radiation_reg1 = 0.0 ; |
| 234 |
double xmin = 0.0 ; |
| 235 |
double xmax = 1.0 ; |
| 236 |
|
| 237 |
ConvDiff_PDE Reg1_PDE ( |
| 238 |
Comm, |
| 239 |
peclet_1, |
| 240 |
radiation_reg1, |
| 241 |
kappa_1, |
| 242 |
alpha, |
| 243 |
xmin, |
| 244 |
xmax, |
| 245 |
Tleft, |
| 246 |
T1_analytic, |
| 247 |
NumGlobalNodes, |
| 248 |
myName ); |
| 249 |
|
| 250 |
// Override default initialization with values we want |
| 251 |
Reg1_PDE.initializeSolution(initVal); |
| 252 |
|
| 253 |
problemManager.addProblem(Reg1_PDE); |
| 254 |
|
| 255 |
|
| 256 |
// Create Region 2 PDE |
| 257 |
myName = "Region_2" ; |
| 258 |
xmin = 1.0 ; |
| 259 |
xmax = 2.0 ; |
| 260 |
|
| 261 |
ConvDiff_PDE Reg2_PDE ( |
| 262 |
Comm, |
| 263 |
peclet_2, |
| 264 |
radiation, |
| 265 |
kappa_2, |
| 266 |
beta, |
| 267 |
xmin, |
| 268 |
xmax, |
| 269 |
T1_analytic, |
| 270 |
Tright, |
| 271 |
probSizeRatio*NumGlobalNodes, |
| 272 |
myName ); |
| 273 |
|
| 274 |
// For this problem involving interfacial coupling, the problems are given control |
| 275 |
// over whether or not and how to construct off-block contributions to the |
| 276 |
// Jacobian/Preconditioner matrix. We explicitly told the problem manager to omit |
| 277 |
// off-blocks via the OffBlock_Manager class. Here, we inform each problem. |
| 278 |
Reg1_PDE.setExpandJacobian( doOffBlocks ); |
| 279 |
Reg2_PDE.setExpandJacobian( doOffBlocks ); |
| 280 |
|
| 281 |
// Override default initialization with values we want |
| 282 |
Reg2_PDE.initializeSolution(initVal); |
| 283 |
|
| 284 |
problemManager.addProblem(Reg2_PDE); |
| 285 |
|
| 286 |
problemManager.createDependency(Reg1_PDE, Reg2_PDE); |
| 287 |
problemManager.createDependency(Reg2_PDE, Reg1_PDE); |
| 288 |
|
| 289 |
problemManager.registerComplete(); |
| 290 |
|
| 291 |
// A consistencyy check associated with using BroydenOperator |
| 292 |
if( 0 ) |
| 293 |
{ |
| 294 |
Epetra_CrsGraph maskGraph(Copy, problemManager.getCompositeSoln()->Map(), 0); |
| 295 |
|
| 296 |
map<int, Teuchos::RCP<GenericEpetraProblem> >::iterator problemIter = problemManager.getProblems().begin(); |
| 297 |
map<int, Teuchos::RCP<GenericEpetraProblem> >::iterator problemLast = problemManager.getProblems().end(); |
| 298 |
|
| 299 |
// Loop over each problem being managed and ascertain its graph as well |
| 300 |
// as its graph from its dependencies |
| 301 |
for( ; problemIter != problemLast; ++problemIter ) |
| 302 |
{ |
| 303 |
GenericEpetraProblem & problem = *(*problemIter).second; |
| 304 |
int probId = problem.getId(); |
| 305 |
|
| 306 |
// Get the indices map for copying data from this problem into |
| 307 |
// the composite problem |
| 308 |
map<int, Teuchos::RCP<Epetra_IntVector> > & problemToCmpositeIndices = |
| 309 |
problemManager.getProblemToCompositeIndices(); |
| 310 |
Epetra_IntVector & problemIndices = *(problemToCmpositeIndices[probId]); |
| 311 |
|
| 312 |
// Get known dependencies on the other problem |
| 313 |
for( unsigned int k = 0; k < problem.getDependentProblems().size(); ++k) |
| 314 |
{ |
| 315 |
// Get the needed objects for the depend problem |
| 316 |
GenericEpetraProblem & dependProblem = *(problemManager.getProblems()[problem.getDependentProblems()[k]]); |
| 317 |
int dependId = dependProblem.getId(); |
| 318 |
Epetra_IntVector & dependIndices = *(problemManager.getProblemToCompositeIndices()[dependId]); |
| 319 |
|
| 320 |
map<int, std::vector<int> > offBlockIndices; |
| 321 |
problem.getOffBlockIndices( offBlockIndices ); |
| 322 |
|
| 323 |
map<int, std::vector<int> >::iterator indIter = offBlockIndices.begin(), |
| 324 |
indIter_end = offBlockIndices.end() ; |
| 325 |
|
| 326 |
for( ; indIter != indIter_end; ++indIter ) |
| 327 |
{ |
| 328 |
int compositeRow = problemIndices[(*indIter).first]; |
| 329 |
std::vector<int> & colIndices = (*indIter).second; |
| 330 |
|
| 331 |
// Convert column indices to composite values |
| 332 |
for( unsigned int cols = 0; cols < colIndices.size(); ++cols ) |
| 333 |
colIndices[cols] = dependIndices[ colIndices[cols] ]; |
| 334 |
|
| 335 |
maskGraph.InsertGlobalIndices( compositeRow, colIndices.size(), &colIndices[0] ); |
| 336 |
} |
| 337 |
} |
| 338 |
} |
| 339 |
maskGraph.FillComplete(); |
| 340 |
|
| 341 |
std::cout << maskGraph << std::endl; |
| 342 |
|
| 343 |
NOX::Epetra::BroydenOperator * broydenOp = dynamic_cast<NOX::Epetra::BroydenOperator*>( |
| 344 |
problemManager.getJacobianOperator().get() ); |
| 345 |
|
| 346 |
broydenOp->removeEntriesFromBroydenUpdate( maskGraph ); |
| 347 |
#ifdef HAVE_NOX_DEBUG |
| 348 |
broydenOp->outputActiveEntries(); |
| 349 |
#endif |
| 350 |
} |
| 351 |
|
| 352 |
problemManager.outputStatus(std::cout); |
| 353 |
|
| 354 |
std::cout << "\n\tAnalytic solution, T_1 = " << T1_analytic << "\n" << std::endl; |
| 355 |
|
| 356 |
// Print initial solution |
| 357 |
if( verbose ) |
| 358 |
problemManager.outputSolutions( outputDir, 0 ); |
| 359 |
|
| 360 |
// Identify the test problem |
| 361 |
if( outputUtils.isPrintType(NOX::Utils::TestDetails) ) |
| 362 |
outputUtils.out() << "Starting epetra/MultiPhysics/example_yeckel.exe" << std::endl; |
| 363 |
|
| 364 |
// Identify processor information |
| 365 |
#ifdef HAVE_MPI |
| 366 |
outputUtils.out() << "This test is broken in parallel." << std::endl; |
| 367 |
outputUtils.out() << "Test failed!" << std::endl; |
| 368 |
MPI_Finalize(); |
| 369 |
return -1; |
| 370 |
#else |
| 371 |
if (outputUtils.isPrintType(NOX::Utils::TestDetails)) |
| 372 |
outputUtils.out() << "Serial Run" << std::endl; |
| 373 |
#endif |
| 374 |
|
| 375 |
// Identify the test problem |
| 376 |
if( outputUtils.isPrintType(NOX::Utils::TestDetails) ) |
| 377 |
outputUtils.out() << "Starting epetra/MultiPhysics/example_yeckel.exe" << std::endl; |
| 378 |
|
| 379 |
// Identify processor information |
| 380 |
#ifdef HAVE_MPI |
| 381 |
outputUtils.out() << "This test is broken in parallel." << std::endl; |
| 382 |
outputUtils.out() << "Test failed!" << std::endl; |
| 383 |
MPI_Finalize(); |
| 384 |
return -1; |
| 385 |
#else |
| 386 |
if (outputUtils.isPrintType(NOX::Utils::TestDetails)) |
| 387 |
outputUtils.out() << "Serial Run" << std::endl; |
| 388 |
#endif |
| 389 |
|
| 390 |
// Solve the coupled problem |
| 391 |
switch( method ) |
| 392 |
{ |
| 393 |
case MATRIX_FREE : |
| 394 |
problemManager.solveMF(); // Need a status test check here .... |
| 395 |
break; |
| 396 |
|
| 397 |
case SCHUR_BASED : |
| 398 |
problemManager.solveSchurBased(); |
| 399 |
break; |
| 400 |
|
| 401 |
case LOOSE_HARDCODED : |
| 402 |
problemManager.solve(); // Hard-coded loose coupling |
| 403 |
break; |
| 404 |
|
| 405 |
case LOOSE_LIBRARY : |
| 406 |
default : |
| 407 |
{ |
| 408 |
// Create the loose coupling solver manager |
| 409 |
Teuchos::RCP<vector<Teuchos::RCP<NOX::Solver::Generic> > > solversVec = |
| 410 |
Teuchos::rcp( new std::vector<Teuchos::RCP<NOX::Solver::Generic> > ); |
| 411 |
|
| 412 |
map<int, Teuchos::RCP<NOX::Solver::Generic> >::iterator iter = problemManager.getSolvers().begin(), |
| 413 |
iter_end = problemManager.getSolvers().end() ; |
| 414 |
for( ; iter_end != iter; ++iter ) |
| 415 |
{ |
| 416 |
std::cout << " ........ registered Solver::Manager # " << (*iter).first << std::endl; |
| 417 |
solversVec->push_back( (*iter).second ); |
| 418 |
} |
| 419 |
|
| 420 |
// Package the Problem_Manager as the DataExchange::Intreface |
| 421 |
Teuchos::RCP<NOX::Multiphysics::DataExchange::Interface> dataExInterface = |
| 422 |
Teuchos::rcp( &problemManager, false ); |
| 423 |
|
| 424 |
Teuchos::RCP<NOX::StatusTest::MaxIters> fixedPt_maxiters = |
| 425 |
Teuchos::rcp(new NOX::StatusTest::MaxIters(20)); |
| 426 |
|
| 427 |
if( "jacobi" == solvType ) |
| 428 |
nlParamsPtr->sublist("Solver Options").set("Fixed Point Iteration Type", "Jacobi"); |
| 429 |
|
| 430 |
NOX::Multiphysics::Solver::Manager cplSolv( solversVec, dataExInterface, fixedPt_maxiters, nlParamsPtr ); |
| 431 |
|
| 432 |
cplSolv.solve(); |
| 433 |
|
| 434 |
// Refresh all problems with solutions from solver |
| 435 |
problemManager.copyAllGroupXtoProblems(); |
| 436 |
|
| 437 |
// Reset all solver groups to force recomputation of residuals |
| 438 |
problemManager.resetAllCurrentGroupX(); |
| 439 |
} |
| 440 |
} |
| 441 |
|
| 442 |
// Output timing info |
| 443 |
if( 0 == MyPID ) |
| 444 |
std::cout << "\nTimings :\n\tWallTime --> " << myTimer.WallTime() - startWallTime << " sec." |
| 445 |
<< "\n\tElapsedTime --> " << myTimer.ElapsedTime() << " sec." << std::endl << std::endl; |
| 446 |
|
| 447 |
if( verbose ) |
| 448 |
problemManager.outputSolutions( outputDir, 1 ); |
| 449 |
|
| 450 |
// Create a TestCompare class |
| 451 |
int status = 0; |
| 452 |
NOX::TestCompare tester( outputUtils.out(), outputUtils ); |
| 453 |
double abstol = 1.e-4; |
| 454 |
double reltol = 1.e-4 ; |
| 455 |
|
| 456 |
map<int, Teuchos::RCP<GenericEpetraProblem> >::iterator iter = problemManager.getProblems().begin(), |
| 457 |
iter_end = problemManager.getProblems().end() ; |
| 458 |
for( ; iter_end != iter; ++iter ) |
| 459 |
{ |
| 460 |
ConvDiff_PDE & problem = dynamic_cast<ConvDiff_PDE &>( *(*iter).second ); |
| 461 |
std::string msg = "Numerical-to-Exact Solution comparison for problem \"" + problem.getName() + "\""; |
| 462 |
|
| 463 |
// Need NOX::Epetra::Vectors for tests |
| 464 |
NOX::Epetra::Vector numerical ( problem.getSolution() , NOX::Epetra::Vector::CreateView ); |
| 465 |
NOX::Epetra::Vector analytic ( problem.getExactSolution(), NOX::Epetra::Vector::CreateView ); |
| 466 |
|
| 467 |
status += tester.testVector( numerical, analytic, reltol, abstol, msg ); |
| 468 |
} |
| 469 |
|
| 470 |
// Summarize test results |
| 471 |
if( status == 0 ) |
| 472 |
outputUtils.out() << "Test passed!" << std::endl; |
| 473 |
else |
| 474 |
outputUtils.out() << "Test failed!" << std::endl; |
| 475 |
|
| 476 |
#ifdef HAVE_MPI |
| 477 |
MPI_Finalize() ; |
| 478 |
#endif |
| 479 |
|
| 480 |
return 0 ; |
| 481 |
} |
| 482 |
|