libMesh
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/parameter_vector.h"
4 #include "libmesh/qoi_set.h"
5 #include "libmesh/system.h"
6 #include "libmesh/parameter_pointer.h"
7 
8 // Bring in everything from the libMesh namespace
9 using namespace libMesh;
10 
11 // FEMSystem, TimeSolver and NewtonSolver will handle most tasks,
12 // but we must specify element residuals
13 class LaplaceSystem : public FEMSystem
14 {
15 public:
16  // Constructor
18  const std::string & name_in,
19  const unsigned int number_in)
20  : FEMSystem(es, name_in, number_in),
21  _fe_family("LAGRANGE"),
22  _fe_order(1),
23  _analytic_jacobians(true)
24  {}
25 
26  std::string & fe_family() { return _fe_family; }
27  unsigned int & fe_order() { return _fe_order; }
28  bool & analytic_jacobians() { return _analytic_jacobians; }
29 
30  Number & get_parameter_value(unsigned int parameter_index)
31  {
32  return parameters[parameter_index];
33  }
34 
36  {
37  typedef ParameterPointer<Number> PP;
38  parameter_vector.clear();
39  for (std::size_t i = 0; i != parameters.size(); ++i)
40  parameter_vector.push_back(UniquePtr<ParameterAccessor<Number>>(new PP(&parameters[i])));
41 
42  return parameter_vector;
43  }
44 
45 protected:
46  // System initialization
47  virtual void init_data ();
48 
49  // Context initialization
50  virtual void init_context (DiffContext & context);
51 
52  // Element residual and jacobian calculations
53  // Time dependent parts
54  virtual bool element_time_derivative (bool request_jacobian,
55  DiffContext & context);
56 
57  // Constraint parts
58  virtual bool side_constraint (bool request_jacobian,
59  DiffContext & context);
60 
61  Number exact_solution (const Point &);
62 
63  // Parameters associated with the system
64  std::vector<Number> parameters;
65 
66  // The ParameterVector object that will contain pointers to
67  // the system parameters
69 
70  // The FE type to use
71  std::string _fe_family;
72  unsigned int _fe_order;
73 
74  // Calculate Jacobians analytically or not?
75  bool _analytic_jacobians;
76 };
This is the EquationSystems class.
This class provides all data required for a physics package (e.g.
Definition: diff_context.h:54
std::vector< Number > parameters
Definition: L-shaped.h:64
Data structure for specifying which Parameters should be independent variables in a parameter sensiti...
Accessor object allowing reading and modification of the independent variables in a parameter sensiti...
Number(* exact_solution)(const Point &p, const Parameters &, const std::string &, const std::string &)
std::string & fe_family()
Definition: L-shaped.h:26
LaplaceSystem(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Definition: L-shaped.h:17
bool & analytic_jacobians()
Definition: L-shaped.h:28
The libMesh namespace provides an interface to certain functionality in the library.
ParameterVector parameter_vector
Definition: L-shaped.h:68
This class provides a specific system class.
Definition: fem_system.h:53
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
Number & get_parameter_value(unsigned int parameter_index)
Definition: L-shaped.h:30
unsigned int & fe_order()
Definition: L-shaped.h:27
ParameterVector & get_parameter_vector()
Definition: L-shaped.h:35
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
Accessor object allowing reading and modification of the independent variables in a parameter sensiti...