| 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 |
#include "NOX_Common.H" |
| 11 |
#include "Epetra_Comm.h" |
| 12 |
#include "Epetra_Map.h" |
| 13 |
#include "Epetra_Vector.h" |
| 14 |
#include "Epetra_IntVector.h" |
| 15 |
#include "Epetra_Import.h" |
| 16 |
#include "Epetra_CrsGraph.h" |
| 17 |
#include "Epetra_CrsMatrix.h" |
| 18 |
#include "Basis.H" |
| 19 |
|
| 20 |
#include "../test/utils/NOX_Epetra_DebugTools.H" |
| 21 |
//#include "NOX_Epetra_DebugTools.H" |
| 22 |
|
| 23 |
#include "PelletTransport.H" |
| 24 |
#include "MaterialProps.H" |
| 25 |
|
| 26 |
// Constructor - creates the Epetra objects (maps and vectors) |
| 27 |
PelletTransport::PelletTransport( int NumGlobalElementsUO2_ , double xminUO2_ , double xmaxUO2_ , |
| 28 |
int NumGlobalElementsHe_ , double xminHe_ , double xmaxHe_ , |
| 29 |
int NumGlobalElementsClad_ , double xminClad_ , double xmaxClad_ , |
| 30 |
Epetra_Comm& Comm_, bool restart_ ) : |
| 31 |
NumGlobalElementsUO2(NumGlobalElementsUO2_), |
| 32 |
NumGlobalElementsHe(NumGlobalElementsHe_), |
| 33 |
NumGlobalElementsClad(NumGlobalElementsClad_), |
| 34 |
xminUO2(xminUO2_), |
| 35 |
xmaxUO2(xmaxUO2_), |
| 36 |
xminHe(xminHe_), |
| 37 |
xmaxHe(xmaxHe_), |
| 38 |
xminClad(xminClad_), |
| 39 |
xmaxClad(xmaxClad_), |
| 40 |
dt(1.0e+10), |
| 41 |
restart(restart_), |
| 42 |
Comm(&Comm_) |
| 43 |
{ |
| 44 |
|
| 45 |
NumGlobalNodes = NumGlobalElementsUO2 + NumGlobalElementsHe + NumGlobalElementsClad + 1; |
| 46 |
|
| 47 |
MyPID = Comm->MyPID(); // Process ID |
| 48 |
NumProc = Comm->NumProc(); // Total number of processes |
| 49 |
|
| 50 |
// Here we assume a 2-species PelletTransport model, ie 2 dofs per node |
| 51 |
// Note that this needs to be echoed in thew anonymous enum for NUMSPECIES. |
| 52 |
NumSpecies = 2; |
| 53 |
NumGlobalUnknowns = NumSpecies * NumGlobalNodes; |
| 54 |
|
| 55 |
// Construct a Source Map that puts approximately the same |
| 56 |
// number of equations on each processor |
| 57 |
|
| 58 |
// Begin by distributing nodes fairly equally |
| 59 |
StandardNodeMap = new Epetra_Map(NumGlobalNodes, 0, *Comm); |
| 60 |
|
| 61 |
// Get the number of nodes owned by this processor |
| 62 |
NumMyNodes = StandardNodeMap->NumMyElements(); |
| 63 |
|
| 64 |
// Construct an overlap node map for the finite element fill |
| 65 |
// For single processor jobs, the overlap and standard maps are the same |
| 66 |
if (NumProc == 1) |
| 67 |
OverlapNodeMap = new Epetra_Map(*StandardNodeMap); |
| 68 |
else |
| 69 |
{ |
| 70 |
// Distribute elements such that nodes are ghosted |
| 71 |
int OverlapNumMyNodes; |
| 72 |
int OverlapMinMyNodeGID; |
| 73 |
|
| 74 |
OverlapNumMyNodes = NumMyNodes + 1; |
| 75 |
if ( MyPID == NumProc - 1 ) |
| 76 |
OverlapNumMyNodes --; |
| 77 |
|
| 78 |
OverlapMinMyNodeGID = StandardNodeMap->MinMyGID(); |
| 79 |
|
| 80 |
int* OverlapMyGlobalNodes = new int[OverlapNumMyNodes]; |
| 81 |
|
| 82 |
for( int i = 0; i < OverlapNumMyNodes; ++i ) |
| 83 |
OverlapMyGlobalNodes[i] = OverlapMinMyNodeGID + i; |
| 84 |
|
| 85 |
OverlapNodeMap = new Epetra_Map(-1, OverlapNumMyNodes, |
| 86 |
OverlapMyGlobalNodes, 0, *Comm); |
| 87 |
|
| 88 |
delete [] OverlapMyGlobalNodes; |
| 89 |
|
| 90 |
} // End Overlap node map construction ******************************** |
| 91 |
|
| 92 |
// Now create the unknowns maps from the node maps |
| 93 |
NumMyUnknowns = NumSpecies * NumMyNodes; |
| 94 |
int* StandardMyGlobalUnknowns = new int[NumMyUnknowns]; |
| 95 |
for( int k = 0; k < NumSpecies; ++k ) |
| 96 |
for( int i = 0; i < NumMyNodes; ++i ) |
| 97 |
{ |
| 98 |
// For now, we employ an interleave of unknowns |
| 99 |
StandardMyGlobalUnknowns[ NumSpecies * i + k ] = NumSpecies * StandardNodeMap->GID(i) + k; |
| 100 |
} |
| 101 |
|
| 102 |
StandardMap = new Epetra_Map(-1, NumMyUnknowns, StandardMyGlobalUnknowns, 0, *Comm); |
| 103 |
delete [] StandardMyGlobalUnknowns; |
| 104 |
|
| 105 |
assert(StandardMap->NumGlobalElements() == NumGlobalUnknowns); |
| 106 |
|
| 107 |
if (NumProc == 1) |
| 108 |
OverlapMap = new Epetra_Map(*StandardMap); |
| 109 |
else |
| 110 |
{ |
| 111 |
int OverlapNumMyNodes = OverlapNodeMap->NumMyElements(); |
| 112 |
int OverlapNumMyUnknowns = NumSpecies * OverlapNumMyNodes; |
| 113 |
int* OverlapMyGlobalUnknowns = new int[OverlapNumMyUnknowns]; |
| 114 |
for (int k=0; k<NumSpecies; k++) |
| 115 |
for( int i = 0; i < OverlapNumMyNodes; ++i ) |
| 116 |
OverlapMyGlobalUnknowns[ NumSpecies * i + k ] = NumSpecies * OverlapNodeMap->GID(i) + k; |
| 117 |
|
| 118 |
OverlapMap = new Epetra_Map(-1, OverlapNumMyUnknowns, OverlapMyGlobalUnknowns, 0, *Comm); |
| 119 |
delete [] OverlapMyGlobalUnknowns; |
| 120 |
|
| 121 |
} // End Overlap unknowns map construction *************************** |
| 122 |
|
| 123 |
|
| 124 |
#ifdef DEBUG_MAPS |
| 125 |
// Output to check progress so far |
| 126 |
printf("[%d] NumSpecies, NumMyNodes, NumGlobalNodes, NumMyUnknowns, NumGlobalUnknowns :\n %d\t%d\t%d\t%d\n", |
| 127 |
MyPID,NumSpecies, NumMyNodes, NumGlobalNodes, NumMyUnknowns, NumGlobalUnknowns); |
| 128 |
|
| 129 |
Comm->Barrier(); |
| 130 |
Comm->Barrier(); |
| 131 |
Comm->Barrier(); |
| 132 |
printf("[%d] StandardNodeMap :\n", MyPID); |
| 133 |
Comm->Barrier(); |
| 134 |
std::cout << *StandardNodeMap << std::endl; |
| 135 |
Comm->Barrier(); |
| 136 |
printf("[%d] OverlapNodeMap :\n", MyPID); |
| 137 |
Comm->Barrier(); |
| 138 |
std::cout << *OverlapNodeMap << std::endl; |
| 139 |
Comm->Barrier(); |
| 140 |
printf("[%d] StandardMap :\n", MyPID); |
| 141 |
Comm->Barrier(); |
| 142 |
std::cout << *StandardMap << std::endl; |
| 143 |
Comm->Barrier(); |
| 144 |
printf("[%d] StandardMap :\n", MyPID); |
| 145 |
Comm->Barrier(); |
| 146 |
std::cout << *OverlapMap << std::endl; |
| 147 |
Comm->Barrier(); |
| 148 |
#endif |
| 149 |
|
| 150 |
// Construct Linear Objects |
| 151 |
Importer = new Epetra_Import(*OverlapMap, *StandardMap); |
| 152 |
nodeImporter = new Epetra_Import(*OverlapNodeMap, *StandardNodeMap); |
| 153 |
initialSolution = Teuchos::rcp(new Epetra_Vector(*StandardMap)); |
| 154 |
oldSolution = new Epetra_Vector(*StandardMap); |
| 155 |
AA = Teuchos::rcp(new Epetra_CrsGraph(Copy, *StandardMap, 0)); |
| 156 |
|
| 157 |
// Allocate the memory for a matrix dynamically (i.e. the graph is dynamic). |
| 158 |
generateGraphUsingNodes(*AA); |
| 159 |
|
| 160 |
#ifdef DEBUG_GRAPH |
| 161 |
AA->Print(cout); |
| 162 |
#endif |
| 163 |
#ifdef DEBUG_IMPORTER |
| 164 |
Importer->Print(cout); |
| 165 |
#endif |
| 166 |
|
| 167 |
// Create the element type int vector |
| 168 |
int numLocalElems = OverlapNodeMap->NumMyElements() - 1; |
| 169 |
Epetra_Map * elemMap = new Epetra_Map(-1, numLocalElems, 0, *Comm); |
| 170 |
elemTypes = Teuchos::rcp(new Epetra_IntVector(*elemMap)); |
| 171 |
for( int i = 0; i < numLocalElems; ++i ) |
| 172 |
if( i < NumGlobalElementsUO2 ) |
| 173 |
(*elemTypes)[i] = UO2; |
| 174 |
else if( i < (NumGlobalElementsUO2 + NumGlobalElementsHe) ) |
| 175 |
(*elemTypes)[i] = HELIUM; |
| 176 |
//(*elemTypes)[i] = UO2; |
| 177 |
else |
| 178 |
(*elemTypes)[i] = CLAD; |
| 179 |
//(*elemTypes)[i] = UO2; |
| 180 |
delete elemMap; |
| 181 |
|
| 182 |
// Create the nodal coordinates - only works in serial for now - RWH |
| 183 |
xptr = Teuchos::rcp(new Epetra_Vector(*StandardNodeMap)); |
| 184 |
int inode = 0; |
| 185 |
double length = xmaxUO2 - xminUO2; |
| 186 |
double dx = length/((double) NumGlobalElementsUO2 ); |
| 187 |
(*xptr)[inode++] = xminUO2; |
| 188 |
for( int i = 1; i < NumGlobalElementsUO2; ++i ) |
| 189 |
{ |
| 190 |
(*xptr)[inode] = (*xptr)[inode-1] + dx; |
| 191 |
inode++; |
| 192 |
} |
| 193 |
length = xmaxHe - xminHe; |
| 194 |
dx = length/((double) NumGlobalElementsHe ); |
| 195 |
(*xptr)[inode++] = xminHe; |
| 196 |
for( int i = 1; i < NumGlobalElementsHe; ++i ) |
| 197 |
{ |
| 198 |
(*xptr)[inode] = (*xptr)[inode-1] + dx; |
| 199 |
inode++; |
| 200 |
} |
| 201 |
length = xmaxClad - xminClad; |
| 202 |
dx = length/((double) NumGlobalElementsClad ); |
| 203 |
(*xptr)[inode++] = xminClad; |
| 204 |
for( int i = 0; i < NumGlobalElementsClad; ++i ) |
| 205 |
{ |
| 206 |
(*xptr)[inode] = (*xptr)[inode-1] + dx; |
| 207 |
inode++; |
| 208 |
} |
| 209 |
|
| 210 |
initializeSoln(); |
| 211 |
|
| 212 |
} |
| 213 |
|
| 214 |
// Destructor |
| 215 |
PelletTransport::~PelletTransport() |
| 216 |
{ |
| 217 |
delete oldSolution; |
| 218 |
delete nodeImporter; |
| 219 |
delete Importer; |
| 220 |
delete OverlapMap; |
| 221 |
delete StandardMap; |
| 222 |
delete StandardNodeMap; |
| 223 |
delete OverlapNodeMap; |
| 224 |
} |
| 225 |
|
| 226 |
// Reset function |
| 227 |
void |
| 228 |
PelletTransport::reset(const Epetra_Vector& x) |
| 229 |
{ |
| 230 |
*oldSolution = x; |
| 231 |
} |
| 232 |
|
| 233 |
// Set initialSolution to desired initial condition |
| 234 |
void |
| 235 |
PelletTransport::initializeSoln() |
| 236 |
{ |
| 237 |
Epetra_Vector& soln = *initialSolution; |
| 238 |
Epetra_Vector& x = *xptr; |
| 239 |
|
| 240 |
// Here we do a sinusoidal perturbation of the unstable |
| 241 |
// steady state. |
| 242 |
|
| 243 |
if( restart ) |
| 244 |
{ |
| 245 |
std::string name = "restartVec"; |
| 246 |
Epetra_Vector * tmpVec = NULL; |
| 247 |
NOX::Epetra::DebugTools::readVector(name, soln.Comm(), tmpVec ); |
| 248 |
soln = *tmpVec; |
| 249 |
} |
| 250 |
else |
| 251 |
{ |
| 252 |
for( int i = 0; i < x.MyLength(); ++i ) |
| 253 |
{ |
| 254 |
soln[2*i] = 750.0 ; |
| 255 |
soln[2*i+1] = 0.02 ; |
| 256 |
} |
| 257 |
} |
| 258 |
*oldSolution = soln; |
| 259 |
} |
| 260 |
|
| 261 |
bool |
| 262 |
PelletTransport::evaluate(NOX::Epetra::Interface::Required::FillType fType, |
| 263 |
const Epetra_Vector* soln, |
| 264 |
Epetra_Vector* tmp_rhs, |
| 265 |
Epetra_RowMatrix* tmp_matrix) |
| 266 |
{ |
| 267 |
|
| 268 |
if( fType == NOX::Epetra::Interface::Required::Jac ) |
| 269 |
{ |
| 270 |
std::cout << "This problem only works for Finite-Difference or Matrix-Free Based Jacobians." |
| 271 |
<< " No analytic Jacobian fill available !!" << std::endl; |
| 272 |
throw "Problem ERROR"; |
| 273 |
} |
| 274 |
else |
| 275 |
rhs = new Epetra_Vector(*OverlapMap); |
| 276 |
|
| 277 |
// Create the overlapped solution and position vectors |
| 278 |
Epetra_Vector u(*OverlapMap); |
| 279 |
Epetra_Vector uold(*OverlapMap); |
| 280 |
Epetra_Vector xvec(*OverlapNodeMap); |
| 281 |
|
| 282 |
// Export Solution to Overlap vector |
| 283 |
uold.Import(*oldSolution, *Importer, Insert); |
| 284 |
xvec.Import(*xptr, *nodeImporter, Insert); |
| 285 |
u.Import(*soln, *Importer, Insert); |
| 286 |
|
| 287 |
// Declare required variables |
| 288 |
int i; |
| 289 |
int OverlapNumMyNodes = OverlapNodeMap->NumMyElements(); |
| 290 |
|
| 291 |
MaterialPropBase::PropData materialProps; |
| 292 |
// Hard-code use of UO2 for now - RWH 5/14/2007 |
| 293 |
std::string fixedType = "UO2"; |
| 294 |
|
| 295 |
int OverlapMinMyNodeGID; |
| 296 |
if (MyPID==0) OverlapMinMyNodeGID = StandardNodeMap->MinMyGID(); |
| 297 |
else OverlapMinMyNodeGID = StandardNodeMap->MinMyGID()-1; |
| 298 |
|
| 299 |
int row1, row2; |
| 300 |
double term1, term2; |
| 301 |
double flux1, flux2; |
| 302 |
double xx[2]; |
| 303 |
double uu[2*NUMSPECIES]; // Use of the anonymous enum is needed for SGI builds |
| 304 |
double uuold[2*NUMSPECIES]; |
| 305 |
Basis basis(NumSpecies); |
| 306 |
|
| 307 |
|
| 308 |
// Zero out the objects that will be filled |
| 309 |
rhs->PutScalar(0.0); |
| 310 |
|
| 311 |
ACTIVE_REGIONS propType; |
| 312 |
|
| 313 |
// Loop Over # of Finite Elements on Processor |
| 314 |
for( int ne = 0; ne < OverlapNumMyNodes - 1; ++ne ) |
| 315 |
{ |
| 316 |
propType = (ACTIVE_REGIONS) (*elemTypes)[ne]; |
| 317 |
|
| 318 |
// Loop Over Gauss Points |
| 319 |
for( int gp = 0; gp < 2; ++gp ) |
| 320 |
{ |
| 321 |
// Get the solution and coordinates at the nodes |
| 322 |
xx[0] = xvec[ne]; |
| 323 |
xx[1] = xvec[ne+1]; |
| 324 |
for (int k=0; k<NumSpecies; k++) { |
| 325 |
uu[NumSpecies * 0 + k] = u[NumSpecies * ne + k]; |
| 326 |
uu[NumSpecies * 1 + k] = u[NumSpecies * (ne+1) + k]; |
| 327 |
uuold[NumSpecies * 0 + k] = uold[NumSpecies * ne + k]; |
| 328 |
uuold[NumSpecies * 1 + k] = uold[NumSpecies * (ne+1) + k]; |
| 329 |
} |
| 330 |
// Calculate the basis function at the gauss point |
| 331 |
basis.getBasis(gp, xx, uu, uuold); |
| 332 |
MaterialPropFactory::computeProps( propType, basis.uu[0], basis.uu[1], materialProps ); |
| 333 |
double & rho1 = materialProps.density ; |
| 334 |
double & k1 = materialProps.k_thermal; |
| 335 |
double & Cp1 = materialProps.Cp ; |
| 336 |
double & Qstar1 = materialProps.Qstar ; |
| 337 |
double & Qdot1 = materialProps.Qdot ; |
| 338 |
double & Ffunc = materialProps.thermoF ; |
| 339 |
double & D_diff1 = materialProps.D_diff ; |
| 340 |
|
| 341 |
|
| 342 |
// Loop over Nodes in Element |
| 343 |
for( i = 0; i < 2; ++i ) |
| 344 |
{ |
| 345 |
row1=OverlapMap->GID(NumSpecies * (ne+i)); |
| 346 |
row2=OverlapMap->GID(NumSpecies * (ne+i) + 1); |
| 347 |
flux1 = -k1*basis.duu[0]/basis.dx; |
| 348 |
flux2 = -0.5*D_diff1*(basis.duu[1]/basis.dx |
| 349 |
+ basis.uu[1]*Qstar1/(Ffunc*8.3142*basis.uu[0]*basis.uu[0])*basis.duu[0]/basis.dx); |
| 350 |
term1 = basis.wt*basis.dx*basis.xx*( |
| 351 |
rho1*Cp1*(basis.uu[0] - basis.uuold[0])/dt * basis.phi[i] |
| 352 |
- flux1*basis.dphide[i]/basis.dx |
| 353 |
- Qdot1*basis.phi[i] |
| 354 |
); |
| 355 |
term2 = basis.wt*basis.dx*basis.xx*( |
| 356 |
0.5*(basis.uu[1] - basis.uuold[1])/dt * basis.phi[i] |
| 357 |
- flux2*basis.dphide[i]/basis.dx |
| 358 |
); |
| 359 |
(*rhs)[NumSpecies*(ne+i)] += term1; |
| 360 |
(*rhs)[NumSpecies*(ne+i)+1] += term2; |
| 361 |
} |
| 362 |
} |
| 363 |
} |
| 364 |
|
| 365 |
// Insert Boundary Conditions and modify Jacobian and function (F) |
| 366 |
// Dirichlet BCs at xminUO2 |
| 367 |
const double xB = dynamic_cast<const MaterialProp_UO2 &>(MaterialPropFactory::factory().get_model(PelletTransport::UO2)).get_xB(); |
| 368 |
if (MyPID==0) |
| 369 |
{ |
| 370 |
// Use no-flux BCs |
| 371 |
//(*rhs)[0]= (*soln)[0] - 0.6; |
| 372 |
//(*rhs)[1]= (*soln)[1] - 10.0/3.0; |
| 373 |
} |
| 374 |
// Dirichlet BCs at xmaxUO2 |
| 375 |
if( StandardMap->LID(NumSpecies*(NumGlobalElementsUO2)) >= 0 ) |
| 376 |
{ |
| 377 |
int lastUO2Dof = StandardMap->LID(NumSpecies*(NumGlobalElementsUO2) + 1); |
| 378 |
//(*rhs)[lastDof - 1] = (*soln)[lastDof - 1] - 840.0; |
| 379 |
(*rhs)[lastUO2Dof] = (*soln)[lastUO2Dof] - xB; |
| 380 |
} |
| 381 |
// Dirichlet BCs at all He and Clad species variables |
| 382 |
int lastUO2DofGID = NumSpecies*NumGlobalElementsUO2 + 1; |
| 383 |
int lastGID = StandardMap->MaxAllGID(); |
| 384 |
for( int i = lastUO2DofGID; i < lastGID; i+=2 ) |
| 385 |
if( StandardMap->LID(i) >= 0 ) |
| 386 |
(*rhs)[StandardMap->LID(i)] = (*soln)[StandardMap->LID(i)] - xB; |
| 387 |
|
| 388 |
// Dirichlet BCs at xmaxClad |
| 389 |
if( StandardMap->LID(StandardMap->MaxAllGID()) >= 0 ) |
| 390 |
{ |
| 391 |
int lastDof = StandardMap->LID(StandardMap->MaxAllGID()); |
| 392 |
(*rhs)[lastDof - 1] = (*soln)[lastDof - 1] - 750.0; |
| 393 |
(*rhs)[lastDof] = (*soln)[lastDof] - xB; |
| 394 |
} |
| 395 |
|
| 396 |
// Sync up processors to be safe |
| 397 |
Comm->Barrier(); |
| 398 |
|
| 399 |
// Do an assemble for overlap nodes |
| 400 |
tmp_rhs->Export(*rhs, *Importer, Add); |
| 401 |
|
| 402 |
delete rhs; |
| 403 |
|
| 404 |
return true; |
| 405 |
} |
| 406 |
|
| 407 |
Teuchos::RCP<Epetra_Vector> |
| 408 |
PelletTransport::getSolution() |
| 409 |
{ |
| 410 |
return initialSolution; |
| 411 |
} |
| 412 |
|
| 413 |
Teuchos::RCP<Epetra_CrsMatrix> |
| 414 |
PelletTransport::getJacobian() |
| 415 |
{ |
| 416 |
if( Teuchos::is_null(A) ) return A; |
| 417 |
else { |
| 418 |
std::cout << "No valid Jacobian matrix for this problem. This is likely the" |
| 419 |
<< " result of overlapping NODES rather than ELEMENTS.\n" << std::endl; |
| 420 |
throw "PelletTransport Error"; |
| 421 |
} |
| 422 |
} |
| 423 |
|
| 424 |
Teuchos::RCP<Epetra_Vector> |
| 425 |
PelletTransport::getMesh() |
| 426 |
{ |
| 427 |
return xptr; |
| 428 |
} |
| 429 |
|
| 430 |
Epetra_Vector& |
| 431 |
PelletTransport::getOldSoln() |
| 432 |
{ |
| 433 |
return *oldSolution; |
| 434 |
} |
| 435 |
|
| 436 |
double |
| 437 |
PelletTransport::getdt() |
| 438 |
{ |
| 439 |
return dt; |
| 440 |
} |
| 441 |
|
| 442 |
Teuchos::RCP<Epetra_CrsGraph> |
| 443 |
PelletTransport::getGraph() |
| 444 |
{ |
| 445 |
return AA; |
| 446 |
} |
| 447 |
|
| 448 |
|
| 449 |
Epetra_CrsGraph& |
| 450 |
PelletTransport::generateGraphUsingNodes(Epetra_CrsGraph& AA) |
| 451 |
{ |
| 452 |
|
| 453 |
int row, column; |
| 454 |
|
| 455 |
int myMinNodeGID = StandardNodeMap->MinMyGID(); |
| 456 |
int myMaxNodeGID = StandardNodeMap->MaxMyGID(); |
| 457 |
|
| 458 |
int leftNodeGID, rightNodeGID; |
| 459 |
for( int myNode = myMinNodeGID; myNode <= myMaxNodeGID; myNode++ ) { |
| 460 |
|
| 461 |
leftNodeGID = myNode - 1; |
| 462 |
rightNodeGID = myNode + 1; |
| 463 |
|
| 464 |
if( leftNodeGID < StandardNodeMap->MinAllGID() ) |
| 465 |
leftNodeGID = StandardNodeMap->MinAllGID(); |
| 466 |
|
| 467 |
if( rightNodeGID > StandardNodeMap->MaxAllGID() ) |
| 468 |
rightNodeGID = StandardNodeMap->MaxAllGID(); |
| 469 |
|
| 470 |
for( int dependNode = leftNodeGID; dependNode <= rightNodeGID; dependNode++ ) { |
| 471 |
|
| 472 |
// Loop over unknowns in Node |
| 473 |
for (int j = 0; j < NumSpecies; j++) { |
| 474 |
row = NumSpecies * myNode + j; // Interleave scheme |
| 475 |
|
| 476 |
// Loop over unknowns at supporting nodes |
| 477 |
for (int m = 0; m < NumSpecies; m++) { |
| 478 |
column = NumSpecies * dependNode + m; |
| 479 |
//printf("\t\tWould like to insert -> (%d, %d)\n",row,column); |
| 480 |
AA.InsertGlobalIndices(row, 1, &column); |
| 481 |
} |
| 482 |
} |
| 483 |
} |
| 484 |
} |
| 485 |
|
| 486 |
AA.FillComplete(); |
| 487 |
|
| 488 |
return AA; |
| 489 |
} |
| 490 |
|