| 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 |
// Finite Element Problem Class |
| 11 |
/* Provides function (F) and Jacobian evaluations for the following equation |
| 12 |
* via a 1D linear finite element discretization with Epetra objects. |
| 13 |
* |
| 14 |
* d2u |
| 15 |
* --- - k * u**2 = 0 |
| 16 |
* dx2 |
| 17 |
* |
| 18 |
* subject to @ x=0, u=1 |
| 19 |
*/ |
| 20 |
|
| 21 |
#ifndef _NOX_EXAMPLE_EPETRA_NONLINEAR_FINITEELEMENTPROBLEM_H |
| 22 |
#define _NOX_EXAMPLE_EPETRA_NONLINEAR_FINITEELEMENTPROBLEM_H |
| 23 |
|
| 24 |
// This is needed to get the FillType enum values from NOX_Epetra_Interface |
| 25 |
#include "NOX_Epetra.H" |
| 26 |
#include "Teuchos_RCP.hpp" |
| 27 |
|
| 28 |
// Forward Declarations |
| 29 |
class Epetra_Comm; |
| 30 |
class Epetra_Map; |
| 31 |
class Epetra_Vector; |
| 32 |
class Epetra_Import; |
| 33 |
class Epetra_CrsGraph; |
| 34 |
class Epetra_CrsMatrix; |
| 35 |
|
| 36 |
// Flag to tell how to order the unknowns - Currently not used |
| 37 |
enum StoreUnknowns {Interleaved, Staggered}; |
| 38 |
|
| 39 |
// Finite Element Problem Class |
| 40 |
class PelletTransport { |
| 41 |
|
| 42 |
public: |
| 43 |
|
| 44 |
enum ACTIVE_REGIONS { |
| 45 |
UO2 , |
| 46 |
HELIUM , |
| 47 |
CLAD , |
| 48 |
NONE |
| 49 |
}; |
| 50 |
|
| 51 |
// Constructor |
| 52 |
PelletTransport( int NumGlobalElementsUO2 , double xminUO2 , double xmaxUO2 , |
| 53 |
int NumGlobalElementsHe , double xminHe , double xmaxHe , |
| 54 |
int NumGlobalElementsClad , double xminClad , double xmaxClad , |
| 55 |
Epetra_Comm& Comm, bool restart = false ); |
| 56 |
|
| 57 |
// Destructor |
| 58 |
~PelletTransport(); |
| 59 |
|
| 60 |
// Reset problem for next parameter (time) step. |
| 61 |
// For now, this simply updates oldsoln with the given Epetra_Vector |
| 62 |
void reset(const Epetra_Vector& x); |
| 63 |
|
| 64 |
// Set initial condition for solution vector |
| 65 |
void initializeSoln(); |
| 66 |
|
| 67 |
// Evaluates the function (F) and/or the Jacobian using the solution |
| 68 |
// values in solnVector. |
| 69 |
bool evaluate(NOX::Epetra::Interface::Required::FillType fType, |
| 70 |
const Epetra_Vector *solnVector, |
| 71 |
Epetra_Vector *rhsVector, Epetra_RowMatrix *matrix); |
| 72 |
|
| 73 |
// Return a reference to the Epetra_Vector with the initial guess |
| 74 |
// that is generated by the PelletTransport class. |
| 75 |
Teuchos::RCP<Epetra_Vector> getSolution(); |
| 76 |
|
| 77 |
// Return a reference to the Epetra_Vector with the Jacobian |
| 78 |
// that is generated by the PelletTransport class. |
| 79 |
Teuchos::RCP<Epetra_CrsMatrix> getJacobian(); |
| 80 |
|
| 81 |
// Return a reference to the Epetra_Vector with the mesh positions |
| 82 |
Teuchos::RCP<Epetra_Vector> getMesh(); |
| 83 |
|
| 84 |
// Accesor function for time step |
| 85 |
double getdt(); |
| 86 |
|
| 87 |
// Return a reference to the Epetra_Vector with the old solution |
| 88 |
Epetra_Vector& getOldSoln(); |
| 89 |
|
| 90 |
// Return a reference to the Epetra_CrsGraph that is generated by |
| 91 |
// the PelletTransport problem class. |
| 92 |
Teuchos::RCP<Epetra_CrsGraph> getGraph(); |
| 93 |
|
| 94 |
private: |
| 95 |
|
| 96 |
// inserts the global column indices into the Graph |
| 97 |
Epetra_CrsGraph& generateGraphUsingNodes(Epetra_CrsGraph& AA); |
| 98 |
|
| 99 |
private: |
| 100 |
|
| 101 |
int NumGlobalElementsUO2 ; |
| 102 |
int NumGlobalElementsHe ; |
| 103 |
int NumGlobalElementsClad; |
| 104 |
double xminUO2 , xmaxUO2 ; |
| 105 |
double xminHe , xmaxHe ; |
| 106 |
double xminClad, xmaxClad; |
| 107 |
double dt; |
| 108 |
|
| 109 |
bool restart; |
| 110 |
|
| 111 |
Epetra_Map *StandardNodeMap; |
| 112 |
Epetra_Map *OverlapNodeMap; |
| 113 |
Epetra_Map *StandardMap; |
| 114 |
Epetra_Map *OverlapMap; |
| 115 |
Epetra_Import *Importer; |
| 116 |
Epetra_Import *nodeImporter; |
| 117 |
Teuchos::RCP<Epetra_IntVector> elemTypes; |
| 118 |
Teuchos::RCP<Epetra_Vector> xptr; |
| 119 |
Teuchos::RCP<Epetra_Vector> initialSolution; |
| 120 |
Epetra_Vector *oldSolution; |
| 121 |
Epetra_Vector *rhs; |
| 122 |
Teuchos::RCP<Epetra_CrsGraph> AA; |
| 123 |
Teuchos::RCP<Epetra_CrsMatrix> A; |
| 124 |
Epetra_Comm *Comm; |
| 125 |
|
| 126 |
int MyPID; // Process number |
| 127 |
int NumProc; // Total number of processes |
| 128 |
|
| 129 |
int NumSpecies; // Number of unknowns owned by this process |
| 130 |
enum { NUMSPECIES = 2}; // Needed for SGI build |
| 131 |
int NumMyNodes; // Number of nodes owned by this process |
| 132 |
int NumGlobalNodes; // Total Number of nodes |
| 133 |
int NumMyUnknowns; // Number of unknowns owned by this process |
| 134 |
int NumGlobalUnknowns; // Total Number of unknowns |
| 135 |
|
| 136 |
}; |
| 137 |
#endif |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|