| 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 |
// 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**3 = 0 |
| 16 |
* dx2 |
| 17 |
* |
| 18 |
* subject to @ x=0, u=1 |
| 19 |
*/ |
| 20 |
|
| 21 |
#ifndef _TCUBED_FINITEELEMENTPROBLEM_H |
| 22 |
#define _TCUBED_FINITEELEMENTPROBLEM_H |
| 23 |
|
| 24 |
#include "FiniteElementProblem.H" // base class |
| 25 |
|
| 26 |
// Forward Declarations |
| 27 |
class Epetra_Comm; |
| 28 |
class Epetra_Map; |
| 29 |
class Epetra_Vector; |
| 30 |
class Epetra_Import; |
| 31 |
class Epetra_CrsGraph; |
| 32 |
class Epetra_CrsMatrix; |
| 33 |
|
| 34 |
// Finite Element Problem Class |
| 35 |
class Tcubed_FiniteElementProblem : public FiniteElementProblem { |
| 36 |
|
| 37 |
public: |
| 38 |
|
| 39 |
// Constructor |
| 40 |
Tcubed_FiniteElementProblem(int NumGlobalElements, Epetra_Comm& Comm, |
| 41 |
double s = 1.0); |
| 42 |
|
| 43 |
// Destructor |
| 44 |
virtual ~Tcubed_FiniteElementProblem(); |
| 45 |
|
| 46 |
// Evaluates the function (F) and/or the Jacobian using the solution |
| 47 |
// values in solnVector. |
| 48 |
virtual bool evaluate(FillType f, const Epetra_Vector *solnVector, |
| 49 |
Epetra_Vector *rhsVector, Epetra_RowMatrix *matrix, |
| 50 |
double jac_coeff = 1.0, |
| 51 |
double mass_coeff = 0.0); |
| 52 |
|
| 53 |
// Return a reference to the Epetra_Vector with the initial guess |
| 54 |
// that is generated by the FiniteElementProblem class. |
| 55 |
virtual Epetra_Vector& getSolution(); |
| 56 |
|
| 57 |
// Return a reference to the Epetra_Vector with the Jacobian |
| 58 |
// that is generated by the FiniteElementProblem class. |
| 59 |
virtual Epetra_CrsMatrix& getJacobian(); |
| 60 |
|
| 61 |
// Set a bifurcation parameter in the application physics |
| 62 |
virtual bool setParameter(std::string label, double value); |
| 63 |
|
| 64 |
private: |
| 65 |
|
| 66 |
// inserts the global column indices into the Graph |
| 67 |
Epetra_CrsGraph& generateGraph(Epetra_CrsGraph& AA); |
| 68 |
|
| 69 |
// Private to prohibit copying |
| 70 |
Tcubed_FiniteElementProblem(const Tcubed_FiniteElementProblem&); |
| 71 |
|
| 72 |
// Private to prohibit copying |
| 73 |
Tcubed_FiniteElementProblem& operator=(const Tcubed_FiniteElementProblem&); |
| 74 |
|
| 75 |
private: |
| 76 |
|
| 77 |
FillType flag; |
| 78 |
Epetra_Map *StandardMap; |
| 79 |
Epetra_Map *OverlapMap; |
| 80 |
Epetra_Import *Importer; |
| 81 |
Epetra_Vector *initialSolution; |
| 82 |
Epetra_Vector *rhs; |
| 83 |
Epetra_CrsGraph *AA; |
| 84 |
Epetra_CrsMatrix *A; |
| 85 |
Epetra_Comm *Comm; |
| 86 |
|
| 87 |
int MyPID; // Process number |
| 88 |
int NumProc; // Total number of processes |
| 89 |
int NumMyElements; // Number of elements owned by this process |
| 90 |
int NumGlobalElements; // Total Number of elements |
| 91 |
|
| 92 |
public: |
| 93 |
|
| 94 |
double factor; // factor used on nonlinear term |
| 95 |
double leftBC; // value of the essential BC at x = 0. |
| 96 |
double rightBC; // value of the essential BC at x = 1. |
| 97 |
double scale; // scale factor to test parameter scaling |
| 98 |
|
| 99 |
}; |
| 100 |
#endif |
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|