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 #include "libmesh/rb_construction.h"
24 #include "libmesh/rb_evaluation.h"
25 #include "assembly.h"
26 
27 #ifdef LIBMESH_ENABLE_DIRICHLET
28 
29 // Bring in bits from the libMesh namespace.
30 // Just the bits we're using, since this is a header.
34 
35 // A simple subclass of RBEvaluation.
36 class SimpleRBEvaluation : public RBEvaluation
37 {
38 public:
39 
45  {
47  }
48 
54 };
55 
57 {
58 public:
59 
60  SimpleRBConstruction (EquationSystems & es,
61  const std::string & name_in,
62  const unsigned int number_in)
63  : Parent(es, name_in, number_in),
64  dirichlet_bc(std::unique_ptr<DirichletBoundary>())
65  {}
66 
70  virtual ~SimpleRBConstruction () = default;
71 
76 
81 
85  virtual void init_data()
86  {
87  u_var = this->add_variable ("u", libMesh::FIRST);
88 
89  // Generate a DirichletBoundary object
91 
92  // Set the Dirichlet boundary IDs
93  // and the Dirichlet boundary variable numbers
94  dirichlet_bc->b = {0,1,2,3};
95  dirichlet_bc->variables.push_back(u_var);
96 
97  // Attach dirichlet_bc (must do this _before_ Parent::init_data)
99 
101 
102  // Set the rb_assembly_expansion for this Construction object.
104 
105  // We need to define an inner product matrix for this problem
107  }
108 
112  virtual void init_context(FEMContext & c)
113  {
114  // For efficiency, we should prerequest all
115  // the data we will need to build the
116  // linear system before doing an element loop.
117  FEBase * elem_fe = nullptr;
118  c.get_element_fe(u_var, elem_fe);
119 
120  elem_fe->get_JxW();
121  elem_fe->get_phi();
122  elem_fe->get_dphi();
123 
124  FEBase * side_fe = nullptr;
125  c.get_side_fe(u_var, side_fe);
126  side_fe->get_nothing();
127  }
128 
132  unsigned int u_var;
133 
139 
146 
150  std::unique_ptr<DirichletBoundary> dirichlet_bc;
151 };
152 
153 #endif // LIBMESH_ENABLE_DIRICHLET
154 
155 #endif
RBConstruction Parent
The type of the parent.
Definition: rb_classes.h:80
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
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 void init_context(FEMContext &c)
Pre-request all relevant element data.
Definition: rb_classes.h:112
void set_rb_assembly_expansion(RBAssemblyExpansion &rb_assembly_expansion_in)
Set the rb_assembly_expansion object.
EimTestRBAssemblyExpansion eim_test_rb_assembly_expansion
The object that stores the "assembly" expansion of the parameter dependent PDE, i.e.
Definition: rb_classes.h:145
SimpleRBConstruction(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Definition: rb_classes.h:60
unsigned int u_var
Variable number for u.
Definition: rb_classes.h:153
virtual void init_data()
Initialize data structures.
Definition: rb_classes.h:85
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
SimpleRBEvaluation(const libMesh::Parallel::Communicator &comm)
Constructor.
Definition: rb_classes.h:43
void set_inner_product_assembly(ElemAssembly &inner_product_assembly_in)
Set the rb_assembly_expansion object.
FEGenericBase< Real > FEBase
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
Definition: rb_evaluation.C:80
EimTestRBThetaExpansion eim_test_rb_theta_expansion
The object that stores the "theta" expansion of the parameter dependent PDE, i.e. ...
Definition: rb_classes.h:53
This class is part of the rbOOmit framework.
Definition: rb_evaluation.h:50
void add_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Adds a copy of the specified Dirichlet boundary to the system.
This class is part of the rbOOmit framework.
virtual void init_data()
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used...
SimpleRBConstruction sys_type
The type of system.
Definition: rb_classes.h:75
const DofMap & get_dof_map() const
Definition: system.h:2293
EimTestRBThetaExpansion eim_test_rb_theta_expansion
The object that stores the "theta" expansion of the parameter dependent PDE, i.e. ...
Definition: rb_classes.h:138
std::unique_ptr< DirichletBoundary > dirichlet_bc
The object that defines which degrees of freedom are on a Dirichlet boundary.
Definition: rb_classes.h:165