libMesh
sigma_physics.h
Go to the documentation of this file.
1 #include "libmesh/fem_system.h"
2 #include "libmesh/mesh.h"
3 #include "libmesh/mesh_function.h"
4 #include "libmesh/fem_physics.h"
5 #include "libmesh/system.h"
6 
7 // Using namespace libMesh
8 using namespace libMesh;
9 
10 // FEMSystem, TimeSolver and NewtonSolver will handle most tasks,
11 // but we must specify element residuals
12 class SigmaPhysics : public FEMPhysics
13 {
14 public:
15  // Constructor
17 
18  // Special functions
19  SigmaPhysics (SigmaPhysics &&) = default;
20  SigmaPhysics (const SigmaPhysics &) = default;
21  SigmaPhysics & operator= (const SigmaPhysics &) = default;
22  SigmaPhysics & operator= (SigmaPhysics &&) = default;
23  virtual ~SigmaPhysics () = default;
24 
25  Real & k() { return _k; }
26  bool & analytic_jacobians() { return _analytic_jacobians; }
27 
28  // System initialization
29  virtual void init_data (System & sys);
30 
31  virtual std::unique_ptr<DifferentiablePhysics> clone_physics() override;
32 
33 protected:
34 
35  // Context initialization
36  virtual void init_context (DiffContext & context) override;
37 
38  // Element residual and jacobian calculations
39  // Time dependent parts
40  virtual bool element_time_derivative (bool request_jacobian,
41  DiffContext & context) override;
42 
43  // The parameters to solve for
45 
46  // Variables to hold the computed QoIs
47  Number computed_QoI[1];
48 
49  // The FE type to use
50  std::string _fe_family;
51  unsigned int _fe_order;
52 
53  // Index for T variable
54  unsigned int T_var;
55 
56  // Calculate Jacobians analytically or not?
58 };
std::string _fe_family
Definition: sigma_physics.h:50
bool _analytic_jacobians
Definition: sigma_physics.h:57
This class provides all data required for a physics package (e.g.
Definition: diff_context.h:55
This class provides a specific system class.
Definition: fem_physics.h:44
unsigned int _fe_order
Definition: sigma_physics.h:51
The libMesh namespace provides an interface to certain functionality in the library.
bool & analytic_jacobians()
Definition: sigma_physics.h:26
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:96
unsigned int T_var
Definition: sigma_physics.h:54
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Real & k()
Definition: sigma_physics.h:25