libMesh
rb_classes.h
Go to the documentation of this file.
1 // rbOOmit: An implementation of the Certified Reduced Basis method.
2 // Copyright (C) 2009, 2010 David J. Knezevic
3 //
4 // This file is part of rbOOmit.
5 
6 // rbOOmit is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
10 
11 // rbOOmit is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
15 
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 
20 #ifndef RB_CLASSES_H
21 #define RB_CLASSES_H
22 
23 #if defined(LIBMESH_HAVE_SLEPC) && defined(LIBMESH_HAVE_GLPK)
24 
25 // libMesh includes
26 #include "libmesh/rb_construction.h"
27 #include "libmesh/rb_scm_construction.h"
28 #include "libmesh/fe_base.h"
29 #include "libmesh/rb_evaluation.h"
30 #include "libmesh/rb_scm_evaluation.h"
31 
32 // Bring in bits from the libMesh namespace.
33 // Just the bits we're using, since this is a header.
44 using libMesh::Real;
45 
46 // local include
47 #include "assembly.h"
48 
49 #ifdef LIBMESH_ENABLE_DIRICHLET
50 
51 // A simple subclass of RBEvaluation. We also store the theta expansion object
52 // for the affine expansion of the PDE as a member variable.
53 class SimpleRBEvaluation : public RBEvaluation
54 {
55 public:
56 
62  {
64  }
65 
71  {
73  return rb_scm_eval->get_SCM_LB();
74  }
75 
80 
86 
87 };
88 
89 // A simple subclass of RBConstruction, which initializes libMesh-related data such
90 // as the number of variables and their finite element type. We also store the objects
91 // that define the affine expansion of the PDE as member variables.
93 {
94 public:
95 
97  const std::string & name,
98  const unsigned int number)
99  : Parent(es, name, number)
100  {}
101 
105  virtual ~SimpleRBConstruction () = default;
106 
111 
116 
120  virtual void init_data()
121  {
122  u_var = this->add_variable ("u", libMesh::FIRST);
123 
124  // Generate a DirichletBoundary object
126 
127  // Set the Dirichlet boundary IDs
128  // and the Dirichlet boundary variable numbers
129  dirichlet_bc->b.insert(3);
130  dirichlet_bc->variables.push_back(u_var);
131 
132  // Attach dirichlet_bc (must do this _before_ Parent::init_data)
134 
136 
137  // Set the rb_assembly_expansion for this Construction object.
139 
140  // We need to define an inner product matrix for this problem
142  }
143 
148  virtual void init_context(FEMContext & c)
149  {
150  // For efficiency, we should prerequest all
151  // the data we will need to build the
152  // linear system before doing an element loop.
153  FEBase * elem_fe = nullptr;
154  c.get_element_fe(u_var, elem_fe);
155 
156  elem_fe->get_JxW();
157  elem_fe->get_phi();
158  elem_fe->get_dphi();
159 
160  FEBase * side_fe = nullptr;
161  c.get_side_fe(u_var, side_fe);
162  side_fe->get_nothing();
163  }
164 
168  unsigned int u_var;
169 
176 
180  std::unique_ptr<DirichletBoundary> dirichlet_bc;
181 
182 };
183 
184 #endif // LIBMESH_ENABLE_DIRICHLET
185 
186 #endif // LIBMESH_HAVE_SLEPC && LIBMESH_HAVE_GLPK
187 
188 #endif
This is the EquationSystems class.
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
RBConstruction Parent
The type of the parent.
Definition: rb_classes.h:115
This class allows one to associate Dirichlet boundary values with a given set of mesh boundary ids an...
virtual ~SimpleRBConstruction()
Destructor.
Definition: rb_classes.h:87
const Parallel::Communicator & comm() const
Ex02RBAssemblyExpansion ex02_rb_assembly_expansion
The object that stores the "assembly" expansion of the parameter dependent PDE, i.e.
Definition: rb_classes.h:175
This class stores the set of RBTheta functor objects that define the "parameter-dependent expansion" ...
static std::unique_ptr< DirichletBoundary > build_zero_dirichlet_boundary_object()
It&#39;s helpful to be able to generate a DirichletBoundary that stores a ZeroFunction in order to impose...
virtual Real get_SCM_LB()
Evaluate single SCM lower bound.
virtual void init_context(FEMContext &c)
Pre-request all relevant element data.
Definition: rb_classes.h:148
unsigned int number() const
Definition: system.h:2269
Ex02RBThetaExpansion ex02_rb_theta_expansion
The object that stores the "theta" expansion of the parameter dependent PDE, i.e. ...
Definition: rb_classes.h:85
This class is part of the rbOOmit framework.
void set_rb_assembly_expansion(RBAssemblyExpansion &rb_assembly_expansion_in)
Set the rb_assembly_expansion object.
unsigned int u_var
Variable number for u.
Definition: rb_classes.h:153
virtual void init_data()
Initialize data structures.
Definition: rb_classes.h:120
This class provides all data required for a physics package (e.g.
Definition: fem_context.h:62
unsigned int add_variable(std::string_view var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1305
RBSCMEvaluation * rb_scm_eval
Pointer to the SCM object that will provide our coercivity constant lower bound.
Definition: rb_classes.h:79
SimpleRBEvaluation(const libMesh::Parallel::Communicator &comm)
Constructor.
Definition: rb_classes.h:60
const RBParameters & get_parameters() const
Get the current parameters.
void set_inner_product_assembly(ElemAssembly &inner_product_assembly_in)
Set the rb_assembly_expansion object.
This class is part of the rbOOmit framework.
Definition: rb_parameters.h:52
FEGenericBase< Real > FEBase
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
Definition: rb_evaluation.C:80
This class is part of the rbOOmit framework.
Definition: rb_evaluation.h:50
bool set_parameters(const RBParameters &params)
Set the current parameters to params The parameters are checked for validity; an error is thrown if t...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
This class stores the set of ElemAssembly functor objects that define the "parameter-independent expa...
virtual Real get_stability_lower_bound()
We override get_stability_lower_bound so that it calls rb_scm_eval to return a parameter-dependent lo...
Definition: rb_classes.h:70
void add_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Adds a copy of the specified Dirichlet boundary to the system.
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.
const std::string & name() const
Definition: system.h:2261
virtual void init_data()
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used...
SimpleRBConstruction(EquationSystems &es, const std::string &name, const unsigned int number)
Definition: rb_classes.h:96
SimpleRBConstruction sys_type
The type of system.
Definition: rb_classes.h:110
const DofMap & get_dof_map() const
Definition: system.h:2293
This class is part of the rbOOmit framework.
std::unique_ptr< DirichletBoundary > dirichlet_bc
The object that defines which degrees of freedom are on a Dirichlet boundary.
Definition: rb_classes.h:165