| 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_BRUSSELATOR_EQUATION_B_H |
| 22 |
#define _NOX_EXAMPLE_EPETRA_BRUSSELATOR_EQUATION_B_H |
| 23 |
|
| 24 |
#include "GenericEpetraProblem.H" // Base class |
| 25 |
|
| 26 |
// Single PDE Equation Problem Class for Brusselator system |
| 27 |
|
| 28 |
class Equation_B : public GenericEpetraProblem { |
| 29 |
|
| 30 |
public: |
| 31 |
|
| 32 |
// Constructor |
| 33 |
Equation_B(Epetra_Comm& Comm, int NumGlobalUnknowns, |
| 34 |
std::string name = ""); |
| 35 |
|
| 36 |
// Destructor |
| 37 |
~Equation_B(); |
| 38 |
|
| 39 |
// Reset problem for next parameter (time) step. |
| 40 |
// For now, this simply updates oldsoln with the given Epetra_Vector |
| 41 |
void reset(const Epetra_Vector& x); |
| 42 |
|
| 43 |
void reset(); // Empty reset method needed here to prevent hiding base |
| 44 |
// class method. |
| 45 |
|
| 46 |
// Set initial condition for solution vector |
| 47 |
void initializeSolution(); |
| 48 |
|
| 49 |
// Initialize based on registrations |
| 50 |
void initialize(); |
| 51 |
|
| 52 |
// Evaluates the function (F) and/or the Jacobian using the solution |
| 53 |
// values in solnVector. |
| 54 |
bool evaluate( NOX::Epetra::Interface::Required::FillType fill, |
| 55 |
const Epetra_Vector *solnVector, |
| 56 |
Epetra_Vector *rhsVector); |
| 57 |
|
| 58 |
// Accesor function for time step |
| 59 |
double getdt() const { return dt; } |
| 60 |
|
| 61 |
// Accesor function for time step |
| 62 |
void setdt( double dt_ ) { dt = dt_;} |
| 63 |
|
| 64 |
// Return a reference to the Epetra_Vector with the old solution |
| 65 |
Epetra_Vector& getOldSoln(); |
| 66 |
|
| 67 |
|
| 68 |
protected: |
| 69 |
|
| 70 |
// inserts the global column indices into the Graph |
| 71 |
void generateGraph(); |
| 72 |
|
| 73 |
protected: |
| 74 |
|
| 75 |
double xmin; |
| 76 |
double xmax; |
| 77 |
double dx; |
| 78 |
double dt; |
| 79 |
|
| 80 |
Epetra_Import *ColumnToOverlapImporter; |
| 81 |
Epetra_Vector *oldSolution; |
| 82 |
Epetra_Vector *rhs; |
| 83 |
|
| 84 |
int id_temp ; |
| 85 |
int id_vel ; |
| 86 |
|
| 87 |
bool useConvection; |
| 88 |
}; |
| 89 |
#endif |