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 "assembly.h"
25 
26 // Bring in bits from the libMesh namespace.
27 // Just the bits we're using, since this is a header.
31 using libMesh::UniquePtr;
32 
33 // A simple subclass of RBEvaluation.
34 class SimpleRBEvaluation : public RBEvaluation
35 {
36 public:
37 
42  RBEvaluation(comm)
43  {
45  }
46 
52 };
53 
55 {
56 public:
57 
58  SimpleRBConstruction (EquationSystems & es,
59  const std::string & name_in,
60  const unsigned int number_in)
61  : Parent(es, name_in, number_in),
62  dirichlet_bc(UniquePtr<DirichletBoundary>())
63  {}
64 
68  virtual ~SimpleRBConstruction () {}
69 
74 
79 
83  virtual void init_data()
84  {
85  u_var = this->add_variable ("u", libMesh::FIRST);
86 
87  // Generate a DirichletBoundary object
88  dirichlet_bc = build_zero_dirichlet_boundary_object();
89 
90  // Set the Dirichlet boundary IDs
91  // and the Dirichlet boundary variable numbers
92  dirichlet_bc->b.insert(0);
93  dirichlet_bc->b.insert(1);
94  dirichlet_bc->b.insert(2);
95  dirichlet_bc->b.insert(3);
96  dirichlet_bc->variables.push_back(u_var);
97 
98  // Attach dirichlet_bc (must do this _before_ Parent::init_data)
99  get_dof_map().add_dirichlet_boundary(*dirichlet_bc);
100 
101  Parent::init_data();
102 
103  // Set the rb_assembly_expansion for this Construction object.
104  set_rb_assembly_expansion(eim_test_rb_assembly_expansion);
105 
106  // We need to define an inner product matrix for this problem
107  set_inner_product_assembly(eim_test_rb_assembly_expansion.A0_assembly);
108  }
109 
113  virtual void init_context(FEMContext & c)
114  {
115  // For efficiency, we should prerequest all
116  // the data we will need to build the
117  // linear system before doing an element loop.
118  FEBase * elem_fe = libmesh_nullptr;
119  c.get_element_fe(u_var, elem_fe);
120 
121  elem_fe->get_JxW();
122  elem_fe->get_phi();
123  elem_fe->get_dphi();
124  }
125 
129  unsigned int u_var;
130 
136 
143 
147  UniquePtr<DirichletBoundary> dirichlet_bc;
148 };
149 
150 #endif
Encapsulates the MPI_Comm object.
Definition: parallel.h:657
RBConstruction Parent
The type of the parent.
Definition: rb_classes.h:78
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:68
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:113
EimTestRBAssemblyExpansion eim_test_rb_assembly_expansion
The object that stores the "assembly" expansion of the parameter dependent PDE, i.e.
Definition: rb_classes.h:142
SimpleRBConstruction(EquationSystems &es, const std::string &name_in, const unsigned int number_in)
Definition: rb_classes.h:58
virtual void init_data()
Initialize data structures.
Definition: rb_classes.h:83
SimpleRBEvaluation(const libMesh::Parallel::Communicator &comm)
Constructor.
Definition: rb_classes.h:41
FEGenericBase< Real > FEBase
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
Definition: rb_evaluation.C:84
EimTestRBThetaExpansion eim_test_rb_theta_expansion
The object that stores the "theta" expansion of the parameter dependent PDE, i.e. ...
Definition: rb_classes.h:51
This class is part of the rbOOmit framework.
Definition: rb_evaluation.h:50
const Parallel::Communicator & comm() const
This class is part of the rbOOmit framework.
SimpleRBConstruction sys_type
The type of system.
Definition: rb_classes.h:73
EimTestRBThetaExpansion eim_test_rb_theta_expansion
The object that stores the "theta" expansion of the parameter dependent PDE, i.e. ...
Definition: rb_classes.h:135
sys get_dof_map()