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/fe_base.h"
25 #include "libmesh/auto_ptr.h"
26 #include "libmesh/rb_evaluation.h"
27 
28 // local include
29 #include "assembly.h"
30 
31 #ifdef LIBMESH_USE_COMPLEX_NUMBERS
32 
33 // Bring in bits from the libMesh namespace.
34 // Just the bits we're using, since this is a header.
40 using libMesh::Real;
41 using libMesh::SECOND;
42 using libMesh::UniquePtr;
43 
44 
45 // A simple subclass of RBEvaluation, which just needs to specify
46 // (a lower bound for) the coercivity constant for this problem.
47 // For this simple convection-diffusion problem, we can set the
48 // coercivity constant lower bound to 0.05.
49 class SimpleRBEvaluation : public RBEvaluation
50 {
51 public:
52 
57  : RBEvaluation(comm_in)
58  {
60  }
61 
66  virtual Real get_stability_lower_bound() { return 1.; }
67 
73 
74 };
75 
76 // A simple subclass of Construction, which just needs to override build_rb_evaluation
77 // in order to build a SimpleRBEvaluation object, rather than an RBEvaluation object.
79 {
80 public:
81 
83  const std::string & name_in,
84  const unsigned int number_in)
85  : Parent(es, name_in, number_in)
86  {}
87 
91  virtual ~SimpleRBConstruction () {}
92 
97 
102 
106  virtual void init_data()
107  {
108  p_var = this->add_variable ("p", SECOND);
109 
110  Parent::init_data();
111 
112  acoustics_rb_assembly_expansion.reset
114 
115  // Set the rb_assembly_expansion for this Construction object.
116  // The theta expansion comes from the RBEvaluation object.
117  set_rb_assembly_expansion(*acoustics_rb_assembly_expansion);
118 
119  // We need to define an inner product matrix for this problem
120  set_inner_product_assembly(acoustics_rb_assembly_expansion->acoustics_inner_product);
121  }
122 
126  virtual void init_context(FEMContext & c)
127  {
128  // For efficiency, we should prerequest all
129  // the data we will need to build the
130  // linear system before doing an element loop.
131  FEBase * elem_fe = libmesh_nullptr;
132  c.get_element_fe(p_var, elem_fe);
133  elem_fe->get_JxW();
134  elem_fe->get_phi();
135  elem_fe->get_dphi();
136 
137  FEBase * side_fe = libmesh_nullptr;
138  c.get_side_fe(p_var, side_fe);
139  side_fe->get_JxW();
140  side_fe->get_phi();
141  }
142 
146  unsigned int p_var;
147 
153  UniquePtr<AcousticsRBAssemblyExpansion> acoustics_rb_assembly_expansion;
154 };
155 
156 #endif
157 
158 #endif
This is the EquationSystems class.
unsigned int p_var
Variable number for pd.
Definition: rb_classes.h:146
Encapsulates the MPI_Comm object.
Definition: parallel.h:657
RBConstruction Parent
The type of the parent.
Definition: rb_classes.h:101
const class libmesh_nullptr_t libmesh_nullptr
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:91
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:262
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
virtual void init_context(FEMContext &c)
Pre-request all relevant element data.
Definition: rb_classes.h:126
SimpleRBConstruction(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Definition: rb_classes.h:82
virtual void init_data()
Initialize data structures.
Definition: rb_classes.h:106
This class provides all data required for a physics package (e.g.
Definition: fem_context.h:61
AcousticsRBThetaExpansion acoustics_rb_theta_expansion
The object that stores the "theta" expansion of the parameter dependent PDE, i.e. ...
Definition: rb_classes.h:72
FEGenericBase< Real > FEBase
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
Definition: rb_evaluation.C:84
This class is part of the rbOOmit framework.
Definition: rb_evaluation.h:50
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
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:66
This class is part of the rbOOmit framework.
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:299
SimpleRBConstruction sys_type
The type of system.
Definition: rb_classes.h:96
UniquePtr< AcousticsRBAssemblyExpansion > acoustics_rb_assembly_expansion
The object that stores the "assembly" expansion of the parameter dependent PDE, i.e.
Definition: rb_classes.h:153
SimpleRBEvaluation(const libMesh::Parallel::Communicator &comm_in)
Constructor.
Definition: rb_classes.h:56