Debian Codegraph @

packages/nox/test/epetra/LOCA_TestProblems/Pitchfork_FiniteElementProblem.H

raw
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 * --- + lambda * u - alpha * u**2 + beta * u**3 = 0
16 * dx2
17 *
18 * subject to the boundar conditions u(-1) = u(1) = beta.
19 */
20
21 #ifndef _PITCHFORK_FINITEELEMENTPROBLEM_H
22 #define _PITCHFORK_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 Pitchfork_FiniteElementProblem : public FiniteElementProblem {
36
37 public:
38
39 // Constructor
40 Pitchfork_FiniteElementProblem(int NumGlobalElements, Epetra_Comm& Comm);
41
42 // Destructor
43 virtual ~Pitchfork_FiniteElementProblem();
44
45 // Evaluates the function (F) and/or the Jacobian using the solution
46 // values in solnVector.
47 virtual bool evaluate(FillType f, const Epetra_Vector *solnVector,
48 Epetra_Vector *rhsVector, Epetra_RowMatrix *matrix,
49 double jac_coeff = 1.0,
50 double mass_coeff = 0.0);
51
52 // Return a reference to the Epetra_Vector with the initial guess
53 // that is generated by the FiniteElementProblem class.
54 virtual Epetra_Vector& getSolution();
55
56 // Return a reference to the Epetra_Vector with the Jacobian
57 // that is generated by the FiniteElementProblem class.
58 virtual Epetra_CrsMatrix& getJacobian();
59
60 // Set a bifurcation parameter in the application physics
61 virtual bool setParameter(std::string label, double value);
62
63 private:
64
65 // inserts the global column indices into the Graph
66 Epetra_CrsGraph& generateGraph(Epetra_CrsGraph& AA);
67
68 // Computes the source term
69 double source_term(double x);
70
71 // Computes the derivative of the source term
72 double source_deriv(double x);
73
74 // Private to prohibit copying
75 Pitchfork_FiniteElementProblem(const Pitchfork_FiniteElementProblem&);
76
77 // Private to prohibit copying
78 Pitchfork_FiniteElementProblem& operator=(const Pitchfork_FiniteElementProblem&);
79
80 private:
81
82 FillType flag;
83 Epetra_Map *StandardMap;
84 Epetra_Map *OverlapMap;
85 Epetra_Import *Importer;
86 Epetra_Vector *initialSolution;
87 Epetra_Vector *rhs;
88 Epetra_CrsGraph *AA;
89 Epetra_CrsMatrix *A;
90 Epetra_Comm *Comm;
91
92 int MyPID; // Process number
93 int NumProc; // Total number of processes
94 int NumMyElements; // Number of elements owned by this process
95 int NumGlobalElements; // Total Number of elements
96
97 public:
98
99 double lambda; // factor used on nonlinear term
100 double alpha; // factor used on nonlinear term
101 double beta; // factor used on nonlinear term
102
103 };
104 #endif
105
106
107
108