libMesh
transient_rb_evaluation.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_TRANSIENT_RB_EVALUATION_H
21 #define LIBMESH_TRANSIENT_RB_EVALUATION_H
22 
23 // rbOOmit includes
24 #include "libmesh/rb_evaluation.h"
25 #include "libmesh/rb_temporal_discretization.h"
26 
27 // libMesh includes
28 
29 // C++ includes
30 
31 namespace libMesh
32 {
33 
34 class TransientRBThetaExpansion;
35 
51 {
52 public:
53 
58 
69  virtual ~TransientRBEvaluation ();
70 
75 
80  virtual void clear() override;
81 
89  virtual void resize_data_structures(const unsigned int Nmax,
90  bool resize_error_bound_data=true) override;
91 
98  virtual Real rb_solve(unsigned int N) override;
99 
105  virtual Real rb_solve_again();
106 
111  virtual Real get_error_bound_normalization() override;
112 
118  virtual Real residual_scaling_numer(Real alpha_LB);
119 
126  virtual Real compute_residual_dual_norm(const unsigned int N) override;
127 
134  virtual Real uncached_compute_residual_dual_norm(const unsigned int N);
135 
141  void cache_online_residual_terms(const unsigned int N);
142 
149  virtual void clear_riesz_representors() override;
150 
157  virtual void legacy_write_offline_data_to_files(const std::string & directory_name = "offline_data",
158  const bool write_binary_data=true) override;
159 
166  virtual void legacy_read_offline_data_from_files(const std::string & directory_name = "offline_data",
167  bool read_error_bound_data=true,
168  const bool read_binary_data=true) override;
169 
170  //----------- PUBLIC DATA MEMBERS -----------//
171 
176 
183 
187  std::vector<DenseMatrix<Number>> RB_M_q_vector;
188 
193  std::vector<std::vector<Number>> RB_outputs_all_k;
194 
199  std::vector<std::vector<Real>> RB_output_error_bounds_all_k;
200 
205 
209  std::vector<DenseVector<Number>> RB_temporal_solution_data;
210 
215  std::vector<Real > error_bound_all_k;
216 
221  std::vector<Real> initial_L2_error_all_N;
222 
227  std::vector<DenseVector<Number>> RB_initial_condition_all_N;
228 
233  std::vector<std::vector<std::vector<Number>>> Fq_Mq_representor_innerprods;
234  std::vector<std::vector<std::vector<Number>>> Mq_Mq_representor_innerprods;
235  std::vector<std::vector<std::vector<std::vector<Number>>>> Aq_Mq_representor_innerprods;
236 
237 
248 
253  std::vector<std::vector<std::unique_ptr<NumericVector<Number>>>> M_q_representor;
254 
259 };
260 
261 }
262 
263 #endif // LIBMESH_TRANSIENT_RB_EVALUATION_H
std::vector< std::vector< std::vector< Number > > > Mq_Mq_representor_innerprods
virtual void resize_data_structures(const unsigned int Nmax, bool resize_error_bound_data=true) override
Resize and clear the data vectors corresponding to the value of Nmax.
TransientRBEvaluation & operator=(const TransientRBEvaluation &)=delete
virtual Real uncached_compute_residual_dual_norm(const unsigned int N)
Compute the dual norm of the residual for the solution saved in RB_solution.
Number cached_Fq_term
Cached residual terms.
DenseMatrix< Number > RB_LHS_matrix
Cached data for subsequent solves.
virtual void clear_riesz_representors() override
Clear all the Riesz representors that are used to compute the RB residual (and hence error bound)...
std::vector< DenseMatrix< Number > > RB_M_q_vector
Dense matrices for the RB mass matrices.
void cache_online_residual_terms(const unsigned int N)
Helper function for caching the terms in the online residual assembly that do not change in time...
virtual Real compute_residual_dual_norm(const unsigned int N)
Compute the dual norm of the residual for the solution saved in RB_solution_vector.
DenseVector< Number > old_RB_solution
The RB solution at the previous time-level.
virtual Real compute_residual_dual_norm(const unsigned int N) override
Compute the dual norm of the residual for the solution saved in RB_solution_vector.
This class is part of the rbOOmit framework.
The libMesh namespace provides an interface to certain functionality in the library.
virtual Real get_error_bound_normalization() override
std::vector< std::vector< std::unique_ptr< NumericVector< Number > > > > M_q_representor
Vector storing the mass matrix representors.
virtual void legacy_write_offline_data_to_files(const std::string &directory_name="offline_data", const bool write_binary_data=true) override
Write out all the data to text files in order to segregate the Offline stage from the Online stage...
bool _rb_solve_data_cached
Check that the data has been cached in case of using rb_solve_again.
std::vector< Real > initial_L2_error_all_N
Vector storing initial L2 error for all 1 <= N <= RB_size.
virtual Real residual_scaling_numer(Real alpha_LB)
Specifies the residual scaling on the numerator to be used in the a posteriori error bound...
std::vector< std::vector< std::vector< Number > > > Fq_Mq_representor_innerprods
Vectors storing the residual representor inner products to be used in computing the residuals online...
std::vector< std::vector< Real > > RB_output_error_bounds_all_k
The error bounds for each RB output for all time-levels from the most recent rb_solve.
std::vector< Real > error_bound_all_k
The error bound data for all time-levels from the most recent rb_solve.
virtual void clear() override
Clear this TransientRBEvaluation object.
RBEvaluation Parent
The type of the parent.
virtual Real rb_solve_again()
If a solve has already been performed, then we cached some data and we can perform a new solve much m...
std::vector< DenseVector< Number > > RB_initial_condition_all_N
The RB initial conditions (i.e.
virtual Real rb_solve(unsigned int N)
Perform online solve with the N RB basis functions, for the set of parameters in current_params, where 0 <= N <= RB_size.
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 void legacy_read_offline_data_from_files(const std::string &directory_name="offline_data", bool read_error_bound_data=true, const bool read_binary_data=true) override
Read in the saved Offline reduced basis data to initialize the system for Online solves.
std::vector< DenseVector< Number > > RB_temporal_solution_data
Array storing the solution data at each time level from the most recent solve.
std::vector< std::vector< Number > > RB_outputs_all_k
The RB outputs for all time-levels from the most recent rb_solve.
Define a class that encapsulates the details of a "generalized Euler" temporal discretization to be u...
std::vector< std::vector< std::vector< std::vector< Number > > > > Aq_Mq_representor_innerprods
TransientRBEvaluation(const Parallel::Communicator &comm_in)
Constructor.
virtual Real rb_solve(unsigned int N) override
Perform online solve with the N RB basis functions, for the set of parameters in current_params, where 0 <= N <= RB_size.
DenseMatrix< Number > RB_L2_matrix
Dense RB L2 matrix.