$extrastylesheet
rb_evaluation.h
Go to the documentation of this file.
00001 // rbOOmit: An implementation of the Certified Reduced Basis method.
00002 // Copyright (C) 2009, 2010 David J. Knezevic
00003 
00004 // This file is part of rbOOmit.
00005 
00006 // rbOOmit is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License, or (at your option) any later version.
00010 
00011 // rbOOmit is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 
00020 #ifndef LIBMESH_RB_EVALUATION_H
00021 #define LIBMESH_RB_EVALUATION_H
00022 
00023 // rbOOmit includes
00024 #include "libmesh/rb_parametrized.h"
00025 #include "libmesh/rb_theta_expansion.h"
00026 
00027 // libMesh includes
00028 #include "libmesh/dense_matrix.h"
00029 #include "libmesh/dense_vector.h"
00030 #include "libmesh/auto_ptr.h"
00031 #include "libmesh/parallel_object.h"
00032 
00033 // C++ includes
00034 
00035 namespace libMesh
00036 {
00037 
00038 class System;
00039 template <typename T> class NumericVector;
00040 
00050 // ------------------------------------------------------------
00051 // RBEvaluation class definition
00052 class RBEvaluation : public RBParametrized,
00053                      public ParallelObject
00054 {
00055 public:
00056 
00060   RBEvaluation (const Parallel::Communicator &comm
00061                 LIBMESH_CAN_DEFAULT_TO_COMMWORLD);
00062 
00066   virtual ~RBEvaluation ();
00067 
00072   virtual void clear();
00073 
00077   void set_rb_theta_expansion(RBThetaExpansion& rb_theta_expansion_in);
00078 
00082   RBThetaExpansion& get_rb_theta_expansion();
00083 
00087   bool is_rb_theta_expansion_initialized() const;
00088 
00096   virtual void resize_data_structures(const unsigned int Nmax,
00097                                       bool resize_error_bound_data=true);
00098 
00102   NumericVector<Number>& get_basis_function(unsigned int i);
00103 
00113   virtual Real rb_solve(unsigned int N);
00114 
00118   virtual Real get_rb_solution_norm();
00119 
00124   virtual Real compute_residual_dual_norm(const unsigned int N);
00125 
00131   virtual Real residual_scaling_denom(Real alpha_LB);
00132 
00137   Real eval_output_dual_norm(unsigned int n, const RBParameters& mu);
00138 
00143   virtual Real get_stability_lower_bound();
00144 
00148   virtual unsigned int get_n_basis_functions() const
00149   { return cast_int<unsigned int>(basis_functions.size()); }
00150 
00155   virtual void set_n_basis_functions(unsigned int n_bfs) { basis_functions.resize(n_bfs); }
00156 
00162   virtual void clear_riesz_representors();
00163 
00168   virtual void write_offline_data_to_files(const std::string& directory_name = "offline_data",
00169                                            const bool write_binary_data=true);
00170 
00175   virtual void read_offline_data_from_files(const std::string& directory_name = "offline_data",
00176                                             bool read_error_bound_data=true,
00177                                             const bool read_binary_data=true);
00178 
00186   virtual void write_out_basis_functions(System& sys,
00187                                          const std::string& directory_name = "offline_data",
00188                                          const bool write_binary_basis_functions = true);
00189 
00194   virtual void write_out_vectors(System& sys,
00195                                  std::vector<NumericVector<Number>*>& vectors,
00196                                  const std::string& directory_name = "offline_data",
00197                                  const std::string& data_name = "bf",
00198                                  const bool write_binary_basis_functions = true);
00199 
00207   virtual void read_in_basis_functions(System& sys,
00208                                        const std::string& directory_name = "offline_data",
00209                                        const bool read_binary_basis_functions = true);
00210 
00216   void read_in_vectors(System& sys,
00217                        std::vector<NumericVector<Number>*>& vectors,
00218                        const std::string& directory_name,
00219                        const std::string& data_name,
00220                        const bool read_binary_vectors);
00221 
00228   void read_in_vectors_from_multiple_files(System& sys,
00229                                            std::vector< std::vector<NumericVector<Number>*>* > multiple_vectors,
00230                                            const std::vector<std::string>& multiple_directory_names,
00231                                            const std::vector<std::string>& multiple_data_names,
00232                                            const bool read_binary_vectors);
00233 
00237   static std::string get_io_version_string();
00238 
00239   //----------- PUBLIC DATA MEMBERS -----------//
00240 
00245   std::vector< NumericVector<Number>* > basis_functions;
00246 
00251   std::vector< RBParameters > greedy_param_list;
00252 
00259   DenseMatrix<Number> RB_inner_product_matrix;
00260 
00264   std::vector< DenseMatrix<Number> > RB_Aq_vector;
00265 
00269   std::vector< DenseVector<Number> > RB_Fq_vector;
00270 
00274   DenseVector<Number> RB_solution;
00275 
00279   std::vector< std::vector< DenseVector<Number> > > RB_output_vectors;
00280 
00285   std::vector< Number > RB_outputs;
00286   std::vector< Real > RB_output_error_bounds;
00287 
00294   std::vector<Number> Fq_representor_innerprods;
00295 
00303   std::vector< std::vector< std::vector<Number> > > Fq_Aq_representor_innerprods;
00304   std::vector< std::vector< std::vector<Number> > > Aq_Aq_representor_innerprods;
00305 
00312   std::vector< std::vector< Number > > output_dual_innerprods;
00313 
00320   std::vector< std::vector< NumericVector<Number>* > > Aq_representor;
00321 
00326   bool evaluate_RB_error_bound;
00327 
00331   bool compute_RB_inner_product;
00332 
00333 private:
00334 
00340   RBThetaExpansion* rb_theta_expansion;
00341 
00342 };
00343 
00344 }
00345 
00346 #endif // LIBMESH_RB_EVALUATION_H