transient_rb_construction.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_TRANSIENT_RB_CONSTRUCTION_H 00021 #define LIBMESH_TRANSIENT_RB_CONSTRUCTION_H 00022 00023 // rbOOmit includes 00024 #include "libmesh/rb_construction.h" 00025 #include "libmesh/transient_rb_evaluation.h" 00026 #include "libmesh/rb_temporal_discretization.h" 00027 00028 // libMesh includes 00029 #include "libmesh/transient_system.h" 00030 00031 // C++ includes 00032 00033 namespace libMesh 00034 { 00035 00045 // ------------------------------------------------------------ 00046 // TransientRBConstruction class definition 00047 00048 class TransientRBConstruction : public TransientSystem<RBConstruction>, public RBTemporalDiscretization 00049 { 00050 public: 00051 00056 TransientRBConstruction (EquationSystems& es, 00057 const std::string& name, 00058 const unsigned int number); 00059 00063 virtual ~TransientRBConstruction (); 00064 00068 typedef TransientRBConstruction sys_type; 00069 00073 typedef TransientSystem<RBConstruction> Parent; 00074 00079 virtual void clear (); 00080 00089 virtual void initialize_rb_construction(); 00090 00094 virtual Real truth_solve(int write_interval); 00095 00103 virtual Real train_reduced_basis(const std::string& directory_name = "offline_data", 00104 const bool resize_rb_eval_data=true); 00105 00110 virtual void process_parameters_file (const std::string& parameters_filename); 00111 00115 virtual void print_info(); 00116 00121 virtual bool greedy_termination_test(Real training_greedy_error, int count); 00122 00127 virtual void assemble_all_affine_operators(); 00128 00132 virtual void assemble_misc_matrices(); 00133 00137 void assemble_L2_matrix(SparseMatrix<Number>* input_matrix, bool apply_dirichlet_bc=true); 00138 00143 void assemble_mass_matrix(SparseMatrix<Number>* input_matrix); 00144 00149 void add_scaled_mass_matrix(Number scalar, 00150 SparseMatrix<Number>* input_matrix); 00151 00156 void mass_matrix_scaled_matvec(Number scalar, 00157 NumericVector<Number>& dest, 00158 NumericVector<Number>& arg); 00159 00163 void set_L2_assembly(ElemAssembly& L2_assembly_in); 00164 00168 ElemAssembly& get_L2_assembly(); 00169 00173 void assemble_Mq_matrix(unsigned int q, SparseMatrix<Number>* input_matrix, bool apply_dirichlet_bc=true); 00174 00178 SparseMatrix<Number>* get_M_q(unsigned int q); 00179 00183 SparseMatrix<Number>* get_non_dirichlet_M_q(unsigned int q); 00184 00188 virtual void truth_assembly(); 00189 00196 int get_max_truth_solves() const { return max_truth_solves; } 00197 void set_max_truth_solves(int max_truth_solves_in) { this->max_truth_solves = max_truth_solves_in; } 00198 00202 Real get_POD_tol() const { return POD_tol; } 00203 void set_POD_tol(const Real POD_tol_in) { this->POD_tol = POD_tol_in; } 00204 00209 void set_delta_N(const unsigned int new_delta_N) { this->delta_N = new_delta_N; } 00210 00215 virtual void load_rb_solution(); 00216 00223 const NumericVector<Number>& get_error_temporal_data(); 00224 00230 void update_RB_initial_condition_all_N(); 00231 00236 virtual void write_riesz_representors_to_files(const std::string& riesz_representors_dir, 00237 const bool write_binary_residual_representors); 00238 00243 virtual void read_riesz_representors_from_files(const std::string& riesz_representors_dir, 00244 const bool write_binary_residual_representors); 00245 00246 00247 //----------- PUBLIC DATA MEMBERS -----------// 00248 00252 AutoPtr< SparseMatrix<Number> > L2_matrix; 00253 00258 AutoPtr< SparseMatrix<Number> > non_dirichlet_L2_matrix; 00259 00263 std::vector< SparseMatrix<Number>* > M_q_vector; 00264 00270 std::vector< SparseMatrix<Number>* > non_dirichlet_M_q_vector; 00271 00276 std::vector< std::vector<Number> > truth_outputs_all_k; 00277 00282 bool nonzero_initialization; 00283 00289 bool compute_truth_projection_error; 00290 00295 std::string init_filename; 00296 00297 protected: 00298 00303 virtual void allocate_data_structures(); 00304 00309 virtual void assemble_affine_expansion(); 00310 00316 virtual void initialize_truth(); 00317 00322 virtual void assemble_matrix_for_output_dual_solves(); 00323 00328 void add_IC_to_RB_space(); 00329 00335 virtual void enrich_RB_space(); 00336 00340 virtual void update_system(); 00341 00345 virtual void update_RB_system_matrices(); 00346 00351 virtual void update_residual_terms(bool compute_inner_products); 00352 00358 Number set_error_temporal_data(); 00359 00360 //----------- PROTECTED DATA MEMBERS -----------// 00361 00367 Real POD_tol; 00368 00375 int max_truth_solves; 00376 00380 ElemAssembly* L2_assembly; 00381 00386 DenseVector<Number> RB_ic_proj_rhs_all_N; 00387 00388 private: 00389 00390 //----------- PRIVATE DATA MEMBERS -----------// 00391 00395 std::vector< NumericVector<Number>* > temporal_data; 00396 00397 }; 00398 00399 } // namespace libMesh 00400 00401 #endif // LIBMESH_TRANSIENT_RB_CONSTRUCTION_H
Site Created By: libMesh Developers
Last modified: February 05 2013 19:54:49 UTC
Hosted By: