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 
60  SimpleRBEvaluation(const libMesh::Parallel::Communicator & comm)
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 () {}
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 
164  unsigned int u_var;
165 
172 
176  std::unique_ptr<DirichletBoundary> dirichlet_bc;
177 
178 };
179 
180 #endif // LIBMESH_ENABLE_DIRICHLET
181 
182 #endif // LIBMESH_HAVE_SLEPC && LIBMESH_HAVE_GLPK
183 
184 #endif
SimpleRBConstruction
Definition: rb_classes.h:73
libMesh::DofMap::add_dirichlet_boundary
void add_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Adds a copy of the specified Dirichlet boundary to the system.
Definition: dof_map_constraints.C:4390
SimpleRBConstruction::u_var
unsigned int u_var
Variable number for u.
Definition: rb_classes.h:149
SimpleRBConstruction::dirichlet_bc
std::unique_ptr< DirichletBoundary > dirichlet_bc
The object that defines which degrees of freedom are on a Dirichlet boundary.
Definition: rb_classes.h:161
SimpleRBEvaluation::SimpleRBEvaluation
SimpleRBEvaluation(const libMesh::Parallel::Communicator &comm)
Constructor.
Definition: rb_classes.h:60
SimpleRBConstruction::SimpleRBConstruction
SimpleRBConstruction(EquationSystems &es, const std::string &name, const unsigned int number)
Definition: rb_classes.h:96
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
SimpleRBConstruction::init_data
virtual void init_data()
Initialize data structures.
Definition: rb_classes.h:120
libMesh::RBParameters
This class is part of the rbOOmit framework.
Definition: rb_parameters.h:42
libMesh::RBConstructionBase< LinearImplicitSystem >::init_data
virtual void init_data()
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
Definition: rb_construction_base.C:74
libMesh::RBConstruction::build_zero_dirichlet_boundary_object
static std::unique_ptr< DirichletBoundary > build_zero_dirichlet_boundary_object()
It's helpful to be able to generate a DirichletBoundary that stores a ZeroFunction in order to impose...
Definition: rb_construction.C:2018
SimpleRBConstruction::sys_type
SimpleRBConstruction sys_type
The type of system.
Definition: rb_classes.h:110
libMesh::System::number
unsigned int number() const
Definition: system.h:2075
libMesh::RBSCMConstruction
This class is part of the rbOOmit framework.
Definition: rb_scm_construction.h:53
libMesh::RBConstruction::set_inner_product_assembly
void set_inner_product_assembly(ElemAssembly &inner_product_assembly_in)
Set the rb_assembly_expansion object.
Definition: rb_construction.C:379
libMesh::RBEvaluation::set_rb_theta_expansion
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
Definition: rb_evaluation.C:83
libMesh::RBParametrized::set_parameters
void set_parameters(const RBParameters &params)
Set the current parameters to params.
Definition: rb_parametrized.C:155
libMesh::RBParametrized::get_parameters
const RBParameters & get_parameters() const
Get the current parameters.
Definition: rb_parametrized.C:166
Ex02RBThetaExpansion
Definition: assembly.h:240
Ex02RBAssemblyExpansion::B_assembly
B B_assembly
Definition: assembly.h:296
SimpleRBEvaluation::rb_scm_eval
RBSCMEvaluation * rb_scm_eval
Pointer to the SCM object that will provide our coercivity constant lower bound.
Definition: rb_classes.h:79
libMesh::RBAssemblyExpansion
This class stores the set of ElemAssembly functor objects that define the "parameter-independent expa...
Definition: rb_assembly_expansion.h:44
Ex02RBAssemblyExpansion
Definition: assembly.h:269
libMesh::FEBase
FEGenericBase< Real > FEBase
Definition: exact_error_estimator.h:39
libMesh::System::add_variable
unsigned int add_variable(const std::string &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:1069
libMesh::RBConstruction
This class is part of the rbOOmit framework.
Definition: rb_construction.h:53
libMesh::RBConstruction::set_rb_assembly_expansion
void set_rb_assembly_expansion(RBAssemblyExpansion &rb_assembly_expansion_in)
Set the rb_assembly_expansion object.
Definition: rb_construction.C:366
SimpleRBConstruction::~SimpleRBConstruction
virtual ~SimpleRBConstruction()
Destructor.
Definition: rb_classes.h:105
libMesh::EquationSystems
This is the EquationSystems class.
Definition: equation_systems.h:74
SimpleRBEvaluation
Definition: rb_classes.h:45
libMesh::FEMContext::get_element_fe
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:275
SimpleRBConstruction::ex02_rb_assembly_expansion
Ex02RBAssemblyExpansion ex02_rb_assembly_expansion
The object that stores the "assembly" expansion of the parameter dependent PDE, i....
Definition: rb_classes.h:171
SimpleRBConstruction::init_context
virtual void init_context(FEMContext &c)
Pre-request all relevant element data.
Definition: rb_classes.h:148
libMesh::System::name
const std::string & name() const
Definition: system.h:2067
libMesh::RBEvaluation
This class is part of the rbOOmit framework.
Definition: rb_evaluation.h:50
libMesh::DirichletBoundary
This class allows one to associate Dirichlet boundary values with a given set of mesh boundary ids an...
Definition: dirichlet_boundaries.h:88
libMesh::RBSCMEvaluation
This class is part of the rbOOmit framework.
Definition: rb_scm_evaluation.h:52
libMesh::RBSCMEvaluation::get_SCM_LB
virtual Real get_SCM_LB()
Evaluate single SCM lower bound.
Definition: rb_scm_evaluation.C:166
libMesh::System::get_dof_map
const DofMap & get_dof_map() const
Definition: system.h:2099
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::RBThetaExpansion
This class stores the set of RBTheta functor objects that define the "parameter-dependent expansion" ...
Definition: rb_theta_expansion.h:44
SimpleRBEvaluation::get_stability_lower_bound
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
SimpleRBEvaluation::ex02_rb_theta_expansion
Ex02RBThetaExpansion ex02_rb_theta_expansion
The object that stores the "theta" expansion of the parameter dependent PDE, i.e.
Definition: rb_classes.h:85
libMesh::FIRST
Definition: enum_order.h:42
SimpleRBConstruction::Parent
RBConstruction Parent
The type of the parent.
Definition: rb_classes.h:115
libMesh::FEMContext
This class provides all data required for a physics package (e.g.
Definition: fem_context.h:62