libMesh
rb_classes.h
Go to the documentation of this file.
1 #ifndef RB_CLASSES_H
2 #define RB_CLASSES_H
3 
4 // local includes
5 #include "assembly.h"
6 
7 // rbOOmit includes
8 #include "libmesh/rb_construction.h"
9 #include "libmesh/rb_evaluation.h"
10 
11 // libMesh includes
12 #include "libmesh/fe_base.h"
13 #include "libmesh/dof_map.h"
14 
15 using namespace libMesh;
16 
17 #ifdef LIBMESH_ENABLE_DIRICHLET
18 
20 {
21 public:
22 
27  : RBEvaluation(comm)
28  {
29  set_rb_theta_expansion(elasticity_theta_expansion);
30  }
31 
36  virtual Real get_stability_lower_bound() { return 1.; }
37 
43 };
44 
45 
47 {
48 public:
49 
51  const std::string & name_in,
52  const unsigned int number_in) :
53  Parent(es, name_in, number_in),
54  u_var(0), v_var(0), w_var(0), var_order(FIRST),
55  elasticity_assembly_expansion(*this),
56  ip_assembly(*this)
57  {}
58 
62  virtual ~ElasticityRBConstruction () = default;
63 
68 
73 
77  virtual void init_data()
78  {
79  unsigned int n_components = this->get_mesh().mesh_dimension();
80 
81  libmesh_assert_less_equal(n_components, 3);
82 
83  u_var = this->add_variable("u", var_order);
84  if (n_components > 1)
85  v_var = this->add_variable("v", var_order);
86  if (n_components > 2)
87  w_var = this->add_variable("w", var_order);
88 
89  // Generate a DirichletBoundary object
90  dirichlet_bc = build_zero_dirichlet_boundary_object();
91 
92  // Set the Dirichlet boundary condition
93  dirichlet_bc->b.insert(BOUNDARY_ID_MIN_X); // Dirichlet boundary at x=0
94  dirichlet_bc->variables.push_back(u_var);
95  if (n_components > 1)
96  dirichlet_bc->variables.push_back(v_var);
97  if (n_components > 2)
98  dirichlet_bc->variables.push_back(w_var);
99 
100  // Attach dirichlet_bc (must do this _before_ Parent::init_data)
101  get_dof_map().add_dirichlet_boundary(*dirichlet_bc);
102 
103  Parent::init_data();
104 
105  // Set the rb_assembly_expansion for this Construction object
106  set_rb_assembly_expansion(elasticity_assembly_expansion);
107 
108  // We need to define an inner product matrix for this problem
109  set_inner_product_assembly(ip_assembly);
110  }
111 
115  virtual void init_context(FEMContext & c)
116  {
117  // For efficiency, we should prerequest all
118  // the data we will need to build the
119  // linear system before doing an element loop.
120  FEBase * elem_fe = nullptr;
121  c.get_element_fe(u_var, elem_fe);
122 
123  elem_fe->get_JxW();
124  elem_fe->get_phi();
125  elem_fe->get_dphi();
126 
127  FEBase * side_fe = nullptr;
128  c.get_side_fe(u_var, side_fe);
129  side_fe->get_JxW();
130  side_fe->get_phi();
131  }
132 
136  unsigned int u_var;
137  unsigned int v_var;
138  unsigned int w_var;
140 
145 
150 
154  std::unique_ptr<DirichletBoundary> dirichlet_bc;
155 };
156 
157 #endif // LIBMESH_ENABLE_DIRICHLET
158 
159 #endif
This is the EquationSystems class.
Order
defines an enum for polynomial orders.
Definition: enum_order.h:40
ElasticityRBConstruction(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Definition: rb_classes.h:50
void get_side_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for edge/face (2D/3D) finite element object for variable var for the largest dimension in th...
Definition: fem_context.h:317
virtual Real get_stability_lower_bound()
Return a "dummy" lower bound for the coercivity constant.
Definition: rb_classes.h:36
ElasticityThetaExpansion elasticity_theta_expansion
The object that stores the "theta" expansion of the parameter dependent PDE, i.e. ...
Definition: rb_classes.h:42
unsigned int u_var
Variable numbers and approximation order.
Definition: rb_classes.h:136
InnerProductAssembly ip_assembly
Object to assemble the inner product matrix.
Definition: rb_classes.h:149
The libMesh namespace provides an interface to certain functionality in the library.
virtual void init_data()
Initialize data structures.
Definition: rb_classes.h:77
ElasticityRBConstruction sys_type
The type of system.
Definition: rb_classes.h:67
const std::vector< std::vector< OutputGradient > > & get_dphi() const
Definition: fe_base.h:230
virtual_for_inffe const std::vector< Real > & get_JxW() const
Definition: fe_abstract.h:295
This class provides all data required for a physics package (e.g.
Definition: fem_context.h:62
RBConstruction Parent
The type of the parent.
Definition: rb_classes.h:72
virtual void init_context(FEMContext &c)
Pre-request all relevant element data.
Definition: rb_classes.h:115
std::unique_ptr< DirichletBoundary > dirichlet_bc
The object that defines which degrees of freedom are on a Dirichlet boundary.
Definition: rb_classes.h:154
This class is part of the rbOOmit framework.
Definition: rb_evaluation.h:50
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void get_element_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for interior finite element object for variable var for the largest dimension in the mesh...
Definition: fem_context.h:277
This class is part of the rbOOmit framework.
ElasticityRBEvaluation(const Parallel::Communicator &comm)
Constructor.
Definition: rb_classes.h:26
ElasticityAssemblyExpansion elasticity_assembly_expansion
The object that stores the "assembly" expansion of the parameter dependent PDE.
Definition: rb_classes.h:144
This class forms the foundation from which generic finite elements may be derived.
const std::vector< std::vector< OutputShape > > & get_phi() const
Definition: fe_base.h:207