libMesh
rb_eim_construction.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 LIBMESH_RB_EIM_CONSTRUCTION_H
21 #define LIBMESH_RB_EIM_CONSTRUCTION_H
22 
23 // rbOOmit includes
24 #include "libmesh/rb_construction.h"
25 #include "libmesh/rb_assembly_expansion.h"
26 #include "libmesh/rb_eim_assembly.h"
27 
28 // libMesh includes
29 #include "libmesh/mesh_function.h"
30 #include "libmesh/coupling_matrix.h"
31 
32 // C++ includes
33 
34 namespace libMesh
35 {
36 
49 {
50 public:
51 
53 
59  const std::string & name,
60  const unsigned int number);
61 
65  virtual ~RBEIMConstruction ();
66 
71 
76 
80  virtual void clear() libmesh_override;
81 
86  virtual void process_parameters_file (const std::string & parameters_filename) libmesh_override;
87 
92  void set_best_fit_type_flag (const std::string & best_fit_type_string);
93 
97  virtual void print_info() libmesh_override;
98 
103  virtual void initialize_rb_construction(bool skip_matrix_assembly=false,
104  bool skip_vector_assembly=false) libmesh_override;
105 
109  virtual Real train_reduced_basis(const bool resize_rb_eval_data=true) libmesh_override;
110 
119  virtual Real truth_solve(int plot_solution) libmesh_override;
120 
128  virtual Real compute_best_fit_error();
129 
133  virtual void init_context_with_sys(FEMContext & c, System & sys);
134 
139  virtual void init_explicit_system() = 0;
140 
145  virtual void init_implicit_system() = 0;
146 
150  Number evaluate_mesh_function(unsigned int var_number,
151  Point p);
152 
157  void set_point_locator_tol(Real point_locator_tol);
158 
162  Real get_point_locator_tol() const;
163 
170  virtual void initialize_eim_assembly_objects();
171 
176 
183  virtual UniquePtr<ElemAssembly> build_eim_assembly(unsigned int bf_index) = 0;
184 
189 
195  virtual void load_basis_function(unsigned int i) libmesh_override;
196 
202  virtual void load_rb_solution() libmesh_override;
203 
209  unsigned int var,
210  NumericVector<Number>& source);
211 
217  unsigned int var,
218  NumericVector<Number>& localized_source);
219 
224 
230  void plot_parametrized_functions_in_training_set(const std::string & pathname);
231 
232  //----------- PUBLIC DATA MEMBERS -----------//
233 
244 
245 protected:
246 
250  virtual void init_data() libmesh_override;
251 
256  virtual void enrich_RB_space() libmesh_override;
257 
262  virtual void update_system() libmesh_override;
263 
269  virtual void update_RB_system_matrices() libmesh_override;
270 
275  virtual Real get_RB_error_bound() libmesh_override;
276 
282 
288 
294 
295 private:
296 
301 
307 
313 
319 
328 
333 
339 
344 };
345 
346 } // namespace libMesh
347 
348 #endif // LIBMESH_RB_EIM_CONSTRUCTION_H
void get_explicit_sys_subvector(NumericVector< Number > &dest, unsigned int var, NumericVector< Number > &localized_source)
Load the subvector of localized_source corresponding to variable var into dest.
This is the EquationSystems class.
UniquePtr< NumericVector< Number > > _ghosted_meshfunction_vector
We also need an extra vector in which we can store a ghosted copy of the vector that we wish to use M...
virtual Real get_RB_error_bound() libmesh_override
Override to return the best fit error.
void set_point_locator_tol(Real point_locator_tol)
Set a point locator tolerance to be used in this class&#39;s MeshFunction, and other operations that requ...
virtual Real train_reduced_basis(const bool resize_rb_eval_data=true) libmesh_override
Override train_reduced_basis to first initialize _parametrized_functions_in_training_set.
virtual void print_info() libmesh_override
Print out info that describes the current setup of this RBConstruction.
ImplicitSystem & sys
std::string _explicit_system_name
We use an ExplicitSystem to store the EIM basis functions.
virtual void enrich_RB_space() libmesh_override
Add a new basis function to the RB space.
RBEIMConstruction sys_type
The type of system.
This class is part of the rbOOmit framework.
std::vector< NumericVector< Number > * > _parametrized_functions_in_training_set
The libMesh vectors storing the finite element coefficients of the RB basis functions.
Numeric vector.
Definition: dof_map.h:66
UniquePtr< MeshFunction > _mesh_function
A mesh function to interpolate on the mesh.
The libMesh namespace provides an interface to certain functionality in the library.
virtual UniquePtr< ElemAssembly > build_eim_assembly(unsigned int bf_index)=0
Build an element assembly object that will access basis function bf_index.
const std::string & name() const
Definition: system.h:1998
virtual void clear() libmesh_override
Clear this object.
virtual void init_explicit_system()=0
Add variables to the ExplicitSystem that is used to store the basis functions.
std::unique_ptr< T > UniquePtr
Definition: auto_ptr.h:46
virtual void update_system() libmesh_override
Update the system after enriching the RB space; this calls a series of functions to update the system...
std::vector< ElemAssembly * > get_eim_assembly_objects()
virtual Real compute_best_fit_error()
We compute the best fit of parametrized_function into the EIM space and then evaluate the error in th...
virtual Real truth_solve(int plot_solution) libmesh_override
Load the truth representation of the parametrized function at the current parameters into the solutio...
std::vector< NumericVector< Number > * > _matrix_times_bfs
This vector is used to store inner_product_matrix * basis_function[i] for each i, since we frequently...
virtual void init_implicit_system()=0
Add one variable to the ImplicitSystem (i.e.
ExplicitSystem & get_explicit_system()
Get the ExplicitSystem associated with this system.
Real _point_locator_tol
The point locator tolerance.
void set_best_fit_type_flag(const std::string &best_fit_type_string)
Specify which type of "best fit" we use to guide the EIM greedy algorithm.
This is the base class for classes which contain information related to any physical process that mig...
Definition: system.h:76
virtual void init_data() libmesh_override
Override to initialize the coupling matrix to decouple variables in this system.
virtual void update_RB_system_matrices() libmesh_override
Compute the reduced basis matrices for the current basis.
virtual void load_basis_function(unsigned int i) libmesh_override
Load the i^th RB function into the RBConstruction solution vector.
This class provides all data required for a physics package (e.g.
Definition: fem_context.h:61
std::vector< ElemAssembly * > _rb_eim_assembly_objects
The vector of assembly objects that are created to point to this RBEIMConstruction.
RBConstruction Parent
The type of the parent.
BEST_FIT_TYPE best_fit_type_flag
Enum that indicates which type of "best fit" algorithm we should use.
virtual void initialize_rb_construction(bool skip_matrix_assembly=false, bool skip_vector_assembly=false) libmesh_override
Initialize this system so that we can perform the Construction stage of the RB method.
void initialize_parametrized_functions_in_training_set()
Loop over the training set and compute the parametrized function for each training index...
virtual void process_parameters_file(const std::string &parameters_filename) libmesh_override
Read parameters in from file and set up this system accordingly.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Number evaluate_mesh_function(unsigned int var_number, Point p)
Evaluate the mesh function at the specified point and for the specified variable. ...
unsigned int number() const
Definition: system.h:2006
This class stores the set of ElemAssembly functor objects that define the "parameter-independent expa...
ElemAssembly provides a per-element (interior and boundary) assembly functionality.
Definition: elem_assembly.h:38
virtual void init_context_with_sys(FEMContext &c, System &sys)
Initialize c based on sys.
void plot_parametrized_functions_in_training_set(const std::string &pathname)
Plot all the parameterized functions that we are storing in _parametrized_functions_in_training_set.
This class is part of the rbOOmit framework.
std::vector< std::vector< dof_id_type > > _dof_map_between_systems
The index map between the explicit system and the implicit system.
RBAssemblyExpansion _empty_rb_assembly_expansion
We initialize RBEIMConstruction so that it has an "empty" RBAssemblyExpansion, because this isn&#39;t use...
virtual ~RBEIMConstruction()
Destructor.
This class provides function-like objects for data distributed over a mesh.
Definition: mesh_function.h:53
void init_dof_map_between_systems()
Set up the index map between the implicit and explicit systems.
bool _parametrized_functions_in_training_set_initialized
Boolean flag to indicate whether or not we have called compute_parametrized_functions_in_training_set...
RBEIMConstruction(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
The ExplicitSystem provides only "right hand side" storage, which should be sufficient for solving mo...
virtual void initialize_eim_assembly_objects()
Build a vector of ElemAssembly objects that accesses the basis functions stored in this RBEIMConstruc...
virtual void load_rb_solution() libmesh_override
Load the RB solution from the most recent solve with rb_eval into this system&#39;s solution vector...
uint8_t dof_id_type
Definition: id_types.h:64
void set_explicit_sys_subvector(NumericVector< Number > &dest, unsigned int var, NumericVector< Number > &source)
Load source into the subvector of dest corresponding to var var.