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// libMesh includes
24#include "libmesh/rb_construction.h"
25#include "libmesh/fe_base.h"
26#include "libmesh/rb_evaluation.h"
27
28// local include
29#include "assembly.h"
30
31// C++ includes
32#include <memory>
33
34#ifdef LIBMESH_USE_COMPLEX_NUMBERS
35
36// Bring in bits from the libMesh namespace.
37// Just the bits we're using, since this is a header.
43using libMesh::Real;
44using libMesh::SECOND;
45
46
47// A simple subclass of RBEvaluation, which just needs to specify
48// (a lower bound for) the coercivity constant for this problem.
49// For this simple convection-diffusion problem, we can set the
50// coercivity constant lower bound to 0.05.
52{
53public:
54
63
68 virtual Real get_stability_lower_bound() { return 1.; }
69
75
76};
77
78// A simple subclass of Construction, which just needs to override build_rb_evaluation
79// in order to build a SimpleRBEvaluation object, rather than an RBEvaluation object.
81{
82public:
83
85 const std::string & name_in,
86 const unsigned int number_in)
87 : Parent(es, name_in, number_in)
88 {}
89
93 virtual ~SimpleRBConstruction () = default;
94
99
104
108 virtual void init_data()
109 {
110 p_var = this->add_variable ("p", SECOND);
111
113
115 std::make_unique<AcousticsRBAssemblyExpansion>();
116
117 // Set the rb_assembly_expansion for this Construction object.
118 // The theta expansion comes from the RBEvaluation object.
120
121 // We need to define an inner product matrix for this problem
123 }
124
128 virtual void init_context(FEMContext & c)
129 {
130 // For efficiency, we should prerequest all
131 // the data we will need to build the
132 // linear system before doing an element loop.
133 FEBase * elem_fe = nullptr;
134 c.get_element_fe(p_var, elem_fe);
135 elem_fe->get_JxW();
136 elem_fe->get_phi();
137 elem_fe->get_dphi();
138
139 FEBase * side_fe = nullptr;
140 c.get_side_fe(p_var, side_fe);
141 side_fe->get_JxW();
142 side_fe->get_phi();
143 }
144
148 unsigned int p_var;
149
155 std::unique_ptr<AcousticsRBAssemblyExpansion> acoustics_rb_assembly_expansion;
156};
157
158#endif
159
160#endif
virtual ~SimpleRBConstruction()=default
Destructor.
virtual void init_data()
Initialize data structures.
Definition rb_classes.h:108
std::unique_ptr< AcousticsRBAssemblyExpansion > acoustics_rb_assembly_expansion
The object that stores the "assembly" expansion of the parameter dependent PDE, i....
Definition rb_classes.h:155
SimpleRBConstruction sys_type
The type of system.
Definition rb_classes.h:98
SimpleRBConstruction(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Definition rb_classes.h:84
RBConstruction Parent
The type of the parent.
Definition rb_classes.h:103
virtual void init_context(FEMContext &c)
Pre-request all relevant element data.
Definition rb_classes.h:128
unsigned int p_var
Variable number for pd.
Definition rb_classes.h:148
SimpleRBEvaluation(const libMesh::Parallel::Communicator &comm_in)
Constructor.
Definition rb_classes.h:58
virtual Real get_stability_lower_bound()
Return a "dummy" stability lower bound factor (for a rigorous error bound this should be a lower boun...
Definition rb_classes.h:68
AcousticsRBThetaExpansion acoustics_rb_theta_expansion
The object that stores the "theta" expansion of the parameter dependent PDE, i.e.
Definition rb_classes.h:74
This class allows one to associate Dirichlet boundary values with a given set of mesh boundary ids an...
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.
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.
This class is part of the rbOOmit framework.
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
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
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real