libMesh
Loading...
Searching...
No Matches
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.
44using 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.
54{
55public:
56
65
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{
94public:
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
virtual ~SimpleRBConstruction()=default
Destructor.
Ex02RBAssemblyExpansion ex02_rb_assembly_expansion
The object that stores the "assembly" expansion of the parameter dependent PDE, i....
Definition rb_classes.h:175
virtual void init_data()
Initialize data structures.
Definition rb_classes.h:120
SimpleRBConstruction sys_type
The type of system.
Definition rb_classes.h:110
std::unique_ptr< DirichletBoundary > dirichlet_bc
The object that defines which degrees of freedom are on a Dirichlet boundary.
Definition rb_classes.h:165
RBConstruction Parent
The type of the parent.
Definition rb_classes.h:115
unsigned int u_var
Variable number for u.
Definition rb_classes.h:153
SimpleRBConstruction(EquationSystems &es, const std::string &name, const unsigned int number)
Definition rb_classes.h:96
virtual void init_context(FEMContext &c)
Pre-request all relevant element data.
Definition rb_classes.h:148
SimpleRBEvaluation(const libMesh::Parallel::Communicator &comm)
Constructor.
Definition rb_classes.h:60
RBSCMEvaluation * rb_scm_eval
Pointer to the SCM object that will provide our coercivity constant lower bound.
Definition rb_classes.h:79
Ex02RBThetaExpansion ex02_rb_theta_expansion
The object that stores the "theta" expansion of the parameter dependent PDE, i.e.
Definition rb_classes.h:85
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
This class allows one to associate Dirichlet boundary values with a given set of mesh boundary ids an...
void add_dirichlet_boundary(const DirichletBoundary &dirichlet_boundary)
Adds a copy of the specified Dirichlet boundary to the system.
This is the EquationSystems class.
This class provides all data required for a physics package (e.g.
Definition fem_context.h:63
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...
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.
virtual void init_data() override
Initializes new data members of the system.
const Parallel::Communicator & comm() const
This class stores the set of ElemAssembly functor objects that define the "parameter-independent expa...
This class is part of the rbOOmit framework.
void set_inner_product_assembly(ElemAssembly &inner_product_assembly_in)
Set the rb_assembly_expansion object.
void set_rb_assembly_expansion(RBAssemblyExpansion &rb_assembly_expansion_in)
Set the rb_assembly_expansion 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...
This class is part of the rbOOmit framework.
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
This class is part of the rbOOmit framework.
const RBParameters & get_parameters() const
Get the current parameters.
bool set_parameters(const RBParameters &params)
Set the current parameters to params The parameters are checked for validity; an error is thrown if t...
This class is part of the rbOOmit framework.
This class is part of the rbOOmit framework.
virtual Real get_SCM_LB()
Evaluate single SCM lower bound.
This class stores the set of RBTheta functor objects that define the "parameter-dependent expansion" ...
const std::string & name() const
Definition system.h:2385
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:1344
const DofMap & get_dof_map() const
Definition system.h:2417
unsigned int number() const
Definition system.h:2393
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real