libMesh
Loading...
Searching...
No Matches
L-shaped.h
Go to the documentation of this file.
1#include "libmesh/enum_fe_family.h"
2#include "libmesh/fem_system.h"
3#include "libmesh/qoi_set.h"
4#include "libmesh/system.h"
5
6// Bring in everything from the libMesh namespace
7using namespace libMesh;
8
9// FEMSystem, TimeSolver and NewtonSolver will handle most tasks,
10// but we must specify element residuals
11class LaplaceSystem : public FEMSystem
12{
13public:
14 // Constructor
16 const std::string & name_in,
17 const unsigned int number_in) :
18 FEMSystem(es, name_in, number_in),
19 _fe_family("LAGRANGE"),
20 _fe_order(1),
22 { this->init_qois(2); }
23
24 std::string & fe_family() { return _fe_family; }
25 unsigned int & fe_order() { return _fe_order; }
27
28 // Postprocessing function which we are going to override for this application
29
30 virtual void postprocess();
31
32 Number & get_QoI_value(std::string type, unsigned int QoI_index)
33 {
34 if (type == "exact")
35 return exact_QoI[QoI_index];
36 else
37 return computed_QoI[QoI_index];
38 }
39
40protected:
41 // System initialization
42 virtual void init_data ();
43
44 // Context initialization
45 virtual void init_context (DiffContext & context);
46
47 // Element residual and jacobian calculations
48 // Time dependent parts
49 virtual bool element_time_derivative (bool request_jacobian,
50 DiffContext & context);
51
52 // Constraint parts
53 virtual bool side_constraint (bool request_jacobian,
54 DiffContext & context);
55
56 // Overloading the postprocess function
57
58 virtual void element_postprocess(DiffContext & context);
59
60 virtual void side_postprocess(DiffContext & context);
61
62 // Overloading the qoi function on elements
63
64 virtual void element_qoi_derivative (DiffContext & context,
65 const QoISet & qois);
66
67 // Overloading the qoi function on sides
68
69 virtual void side_qoi_derivative (DiffContext & context,
70 const QoISet & qois);
71
73
74 // Variables to hold the computed QoIs
75
77
78 // Variables to read in the exact QoIs from l-shaped.in
79
81
82 // The FE type to use
83 std::string _fe_family;
84 unsigned int _fe_order;
85
86 // Calculate Jacobians analytically or not?
88};
std::string _fe_family
Definition L-shaped.h:84
bool _analytic_jacobians
Definition L-shaped.h:88
Number exact_QoI[2]
Definition L-shaped.h:81
virtual void element_qoi_derivative(DiffContext &context, const QoISet &qois)
Does any work that needs to be done on elem in a quantity of interest derivative assembly loop,...
Number exact_solution(const Point &)
virtual void side_postprocess(DiffContext &context)
Does any work that needs to be done on side of elem in a postprocessing loop.
virtual bool element_time_derivative(bool request_jacobian, DiffContext &context)
Adds the time derivative contribution on elem to elem_residual.
LaplaceSystem(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Definition L-shaped.h:15
virtual void side_qoi_derivative(DiffContext &context, const QoISet &qois)
Does any work that needs to be done on side of elem in a quantity of interest derivative assembly loo...
Number computed_QoI[2]
Definition L-shaped.h:77
std::string & fe_family()
Definition L-shaped.h:24
unsigned int _fe_order
Definition L-shaped.h:85
Number & get_QoI_value(std::string type, unsigned int QoI_index)
Definition L-shaped.h:32
virtual void element_postprocess(DiffContext &context)
Does any work that needs to be done on elem in a postprocessing loop.
unsigned int & fe_order()
Definition L-shaped.h:25
bool & analytic_jacobians()
Definition L-shaped.h:26
virtual void init_data()
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
virtual void init_context(DiffContext &context)
virtual bool side_constraint(bool request_jacobian, DiffContext &context)
Adds the constraint contribution on side of elem to elem_residual.
virtual void postprocess()
Runs a postprocessing loop over all elements, and if postprocess_sides is true over all sides.
This class provides all data required for a physics package (e.g.
This is the EquationSystems class.
This class provides a specific system class.
Definition fem_system.h:55
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition point.h:40
Data structure for specifying which Quantities of Interest should be calculated in an adjoint or a pa...
Definition qoi_set.h:46
void init_qois(unsigned int n_qois)
Accessors for qoi and qoi_error_estimates vectors.
Definition system.C:2169
The libMesh namespace provides an interface to certain functionality in the library.