libMesh
rb_eim_construction.C
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 // C++ includes
21 #include <fstream>
22 #include <sstream>
23 
24 // LibMesh includes
25 #include "libmesh/sparse_matrix.h"
26 #include "libmesh/numeric_vector.h"
27 #include "libmesh/dense_matrix.h"
28 #include "libmesh/dense_vector.h"
29 #include "libmesh/dof_map.h"
30 #include "libmesh/libmesh_logging.h"
31 #include "libmesh/equation_systems.h"
32 #include "libmesh/parallel.h"
33 #include "libmesh/parallel_algebra.h"
34 #include "libmesh/fe.h"
35 #include "libmesh/quadrature.h"
36 #include "libmesh/utility.h"
37 #include "libmesh/fe_interface.h"
38 #include "libmesh/fe_compute_data.h"
39 #include "libmesh/getpot.h"
40 #include "libmesh/exodusII_io.h"
41 #include "libmesh/fem_context.h"
42 #include "libmesh/elem.h"
43 #include "libmesh/int_range.h"
44 #include "libmesh/auto_ptr.h"
45 
46 // rbOOmit includes
47 #include "libmesh/rb_eim_construction.h"
48 #include "libmesh/rb_eim_evaluation.h"
49 
50 namespace libMesh
51 {
52 
54  const std::string & name_in,
55  const unsigned int number_in)
56  : Parent(es, name_in, number_in),
57  best_fit_type_flag(PROJECTION_BEST_FIT),
58  _parametrized_functions_in_training_set_initialized(false),
59  _point_locator_tol(TOLERANCE)
60 {
61  _explicit_system_name = name_in + "_explicit_sys";
62 
63  // We cannot do rb_solve with an empty
64  // "rb space" with EIM
66 
67  // Indicate that we need to compute the RB
68  // inner product matrix in this case
70 
71  // Indicate that we need the training set
72  // for the Greedy to be the same on all
73  // processors
74  serial_training_set = true;
75 
76  // attach empty RBAssemblyExpansion object
78 
79  // We set implicit_neighbor_dofs = false. This is important when we use
80  // DISCONTINUOUS basis functions, since by default libMesh sets
81  // implicit_neighbor_dofs = true for "all discontinuous" systems, which
82  // results in a larger sparsity: dofs on neighboring elements are added
83  // to the sparsity pattern since this is typically required for DG or FV
84  // discretizations. Since we're only doing L2 projects here, we do not
85  // need extra dofs in the sparsity pattern, so we set implicit neighbor
86  // dofs to false.
88 }
89 
91 {
92  this->clear();
93 }
94 
96 {
97  Parent::clear();
98 
99  // clear the mesh function
100  _mesh_function.reset();
101 
102  // clear the eim assembly vector
103  _rb_eim_assembly_objects.clear();
104 
105  // clear the parametrized functions from the training set
108 
109  _matrix_times_bfs.clear();
110 }
111 
112 void RBEIMConstruction::process_parameters_file (const std::string & parameters_filename)
113 {
114  Parent::process_parameters_file(parameters_filename);
115 
116  GetPot infile(parameters_filename);
117 
118  std::string best_fit_type_string = infile("best_fit_type","projection");
119  set_best_fit_type_flag(best_fit_type_string);
120 }
121 
122 void RBEIMConstruction::set_best_fit_type_flag (const std::string & best_fit_type_string)
123 {
124  if (best_fit_type_string == "projection")
125  {
127  }
128  else
129  if (best_fit_type_string == "eim")
130  {
132  }
133  else
134  libmesh_error_msg("Error: invalid best_fit_type in input file");
135 }
136 
138 {
140 
141  // Print out setup info
142  libMesh::out << std::endl << "RBEIMConstruction parameters:" << std::endl;
144  {
145  libMesh::out << "best fit type: projection" << std::endl;
146  }
147  else
149  {
150  libMesh::out << "best fit type: eim" << std::endl;
151  }
152  libMesh::out << std::endl;
153 }
154 
156 {
157  // Add the ExplicitSystem that we use to store the EIM basis functions
159 
162 
164 }
165 
166 void RBEIMConstruction::initialize_rb_construction(bool skip_matrix_assembly,
167  bool skip_vector_assembly)
168 {
169  Parent::initialize_rb_construction(skip_matrix_assembly, skip_vector_assembly);
170 
171  // initialize a serial vector that we will use for MeshFunction evaluations
174  get_explicit_system().get_dof_map().get_send_list(), false,
175  GHOSTED);
176 
177  // Initialize the MeshFunction for interpolating the
178  // solution vector at quadrature points
179  std::vector<unsigned int> vars;
181  _mesh_function = libmesh_make_unique<MeshFunction>
185  vars);
186  _mesh_function->init();
187 
188  // inner_product_solver performs solves with the same matrix every time
189  // hence we can set reuse_preconditioner(true).
190  inner_product_solver->reuse_preconditioner(true);
191 
193 }
194 
195 Real RBEIMConstruction::train_reduced_basis(const bool resize_rb_eval_data)
196 {
197  // precompute all the parametrized functions that we'll use in the greedy
199 
200  return Parent::train_reduced_basis(resize_rb_eval_data);
201 }
202 
204  Point p)
205 {
206  // Set default values to be an empty vector so that we can use it
207  // below
208  // to check if this processor returned valid data.
209  DenseVector<Number> default_values;
210  _mesh_function->enable_out_of_mesh_mode(default_values);
211 
212  _mesh_function->set_point_locator_tolerance( get_point_locator_tol() );
213 
214  DenseVector<Number> values;
215  (*_mesh_function)(p,
216  /*time*/ 0.,
217  values);
218 
219  // We evaluated the mesh function, but it will only return a valid set of values on one processor
220  // (values will be empty on all other processors) so we need to broadcast those valid values
221  // to all processors.
222  Number value = 0;
223  unsigned int root_id=0;
224  unsigned int check_for_valid_value = 0;
225  if (values.size() != 0)
226  {
227  root_id = this->processor_id();
228  value = values(var_number);
229  check_for_valid_value = 1;
230  }
231 
232  // If this sum is zero, then we didn't enter the if block above on any processor. In that
233  // case we should throw an error.
234  this->comm().sum(check_for_valid_value);
235  if (check_for_valid_value == 0)
236  {
237  libmesh_error_msg("MeshFunction evaluation failed on all processors");
238  }
239 
240  // root_id may be non-zero on more than one processor due to ghost elements
241  // so use this->comm().max to get just one proc id
242  this->comm().max(root_id);
243 
244  // Then broadcast the result
245  this->comm().broadcast(value, root_id);
246 
247  return value;
248 }
249 
251 {
252  _point_locator_tol = point_locator_tol;
253 }
254 
256 {
257  return _point_locator_tol;
258 }
259 
261 {
262  _rb_eim_assembly_objects.clear();
263  for (unsigned int i=0; i<get_rb_evaluation().get_n_basis_functions(); i++)
265 }
266 
268 {
270 }
271 
273 {
274  LOG_SCOPE("load_basis_function()", "RBEIMConstruction");
275 
276  libmesh_assert_less (i, get_rb_evaluation().get_n_basis_functions());
277 
279 
281 }
282 
284 {
285  LOG_SCOPE("load_rb_solution()", "RBEIMConstruction");
286 
287  solution->zero();
288 
289  if (get_rb_evaluation().RB_solution.size() > get_rb_evaluation().get_n_basis_functions())
290  libmesh_error_msg("ERROR: System contains " << get_rb_evaluation().get_n_basis_functions() << " basis functions." \
291  << " RB_solution vector constains " << get_rb_evaluation().RB_solution.size() << " entries." \
292  << " RB_solution in RBConstruction::load_rb_solution is too long!");
293 
295  for (auto i : IntRange<unsigned int>(0, rbe.RB_solution.size()))
297  rbe.get_basis_function(i));
298 
300 }
301 
302 std::vector<std::unique_ptr<ElemAssembly>> & RBEIMConstruction::get_eim_assembly_objects()
303 {
305 }
306 
308 {
309  LOG_SCOPE("enrich_RB_space()", "RBEIMConstruction");
310 
311  // put solution in _ghosted_meshfunction_vector so we can access it from the mesh function
312  // this allows us to compute EIM_rhs appropriately
314  get_explicit_system().get_dof_map().get_send_list());
315 
316  RBEIMEvaluation & eim_eval = cast_ref<RBEIMEvaluation &>(get_rb_evaluation());
317 
318  // If we have at least one basis function we need to use
319  // rb_solve to find the EIM interpolation error, otherwise just use solution as is
320  if (get_rb_evaluation().get_n_basis_functions() > 0)
321  {
322  // get the right-hand side vector for the EIM approximation
323  // by sampling the parametrized function (stored in solution)
324  // at the interpolation points
325  unsigned int RB_size = get_rb_evaluation().get_n_basis_functions();
326  DenseVector<Number> EIM_rhs(RB_size);
327  for (unsigned int i=0; i<RB_size; i++)
328  {
329  EIM_rhs(i) = evaluate_mesh_function( eim_eval.interpolation_points_var[i],
330  eim_eval.interpolation_points[i] );
331  }
332 
333  eim_eval.set_parameters( get_parameters() );
334  eim_eval.rb_solve(EIM_rhs);
335 
336  // Load the "EIM residual" into solution by subtracting
337  // the EIM approximation
338  for (unsigned int i=0; i<get_rb_evaluation().get_n_basis_functions(); i++)
339  {
341  }
342  }
343 
344  // need to update since context uses current_local_solution
346 
347  // Find the quadrature point at which solution (which now stores
348  // the "EIM residual") has maximum absolute value
349  // by looping over the mesh
350  Point optimal_point;
351  Number optimal_value = 0.;
352  unsigned int optimal_var = 0;
353  dof_id_type optimal_elem_id = DofObject::invalid_id;
354 
355  // Initialize largest_abs_value to be negative so that it definitely gets updated.
356  Real largest_abs_value = -1.;
357 
358  // Compute truth representation via projection
359  MeshBase & mesh = this->get_mesh();
360 
361  std::unique_ptr<DGFEMContext> explicit_c = libmesh_make_unique<DGFEMContext>(get_explicit_system());
362  DGFEMContext & explicit_context = cast_ref<DGFEMContext &>(*explicit_c);
363  init_context_with_sys(explicit_context, get_explicit_system());
364 
365  for (const auto & elem : mesh.active_local_element_ptr_range())
366  {
367  explicit_context.pre_fe_reinit(get_explicit_system(), elem);
368  explicit_context.elem_fe_reinit();
369 
370  for (unsigned int var=0; var<get_explicit_system().n_vars(); var++)
371  {
372  unsigned int n_qpoints = explicit_context.get_element_qrule().n_points();
373 
374  for (unsigned int qp=0; qp<n_qpoints; qp++)
375  {
376  Number value = explicit_context.interior_value(var, qp);
377  Real abs_value = std::abs(value);
378 
379  if (abs_value > largest_abs_value)
380  {
381  optimal_value = value;
382  largest_abs_value = abs_value;
383  optimal_var = var;
384  optimal_elem_id = elem->id();
385 
386  FEBase * elem_fe = nullptr;
387  explicit_context.get_element_fe( var, elem_fe );
388  optimal_point = elem_fe->get_xyz()[qp];
389  }
390 
391  }
392  }
393  }
394 
395  // Find out which processor has the largest of the abs values
396  unsigned int proc_ID_index;
397  this->comm().maxloc(largest_abs_value, proc_ID_index);
398 
399  // Broadcast the optimal point from proc_ID_index
400  this->comm().broadcast(optimal_point, proc_ID_index);
401 
402  // Also broadcast the corresponding optimal_var, optimal_value, and optimal_elem_id
403  this->comm().broadcast(optimal_var, proc_ID_index);
404  this->comm().broadcast(optimal_value, proc_ID_index);
405  this->comm().broadcast(optimal_elem_id, proc_ID_index);
406 
407  // In debug mode, assert that we found an optimal_elem_id
408  libmesh_assert_not_equal_to(optimal_elem_id, DofObject::invalid_id);
409 
410  // Scale the solution
411  get_explicit_system().solution->scale(1./optimal_value);
412 
413  // Store optimal point in interpolation_points
414  eim_eval.interpolation_points.push_back(optimal_point);
415  eim_eval.interpolation_points_var.push_back(optimal_var);
416  Elem * elem_ptr = mesh.elem_ptr(optimal_elem_id);
417  eim_eval.interpolation_points_elem.push_back( elem_ptr );
418 
419  {
420  auto new_bf = NumericVector<Number>::build(this->comm());
421  new_bf->init (get_explicit_system().n_dofs(), get_explicit_system().n_local_dofs(), false, PARALLEL);
422  *new_bf = *get_explicit_system().solution;
423  get_rb_evaluation().basis_functions.emplace_back( std::move(new_bf) );
424  }
425 
427  {
428  // In order to speed up dot products, we store the product
429  // of the basis function and the inner product matrix
430 
431  std::unique_ptr<NumericVector<Number>> implicit_sys_temp1 = this->solution->zero_clone();
432  std::unique_ptr<NumericVector<Number>> implicit_sys_temp2 = this->solution->zero_clone();
433  auto matrix_times_new_bf = get_explicit_system().solution->zero_clone();
434 
435  // We must localize new_bf before calling get_explicit_sys_subvector
436  std::unique_ptr<NumericVector<Number>> localized_new_bf =
438  localized_new_bf->init(get_explicit_system().n_dofs(), false, SERIAL);
439  get_rb_evaluation().basis_functions.back()->localize(*localized_new_bf);
440 
441  for (unsigned int var=0; var<get_explicit_system().n_vars(); var++)
442  {
443  get_explicit_sys_subvector(*implicit_sys_temp1,
444  var,
445  *localized_new_bf);
446 
447  inner_product_matrix->vector_mult(*implicit_sys_temp2, *implicit_sys_temp1);
448 
449  set_explicit_sys_subvector(*matrix_times_new_bf,
450  var,
451  *implicit_sys_temp2);
452  }
453 
454  _matrix_times_bfs.emplace_back(std::move(matrix_times_new_bf));
455  }
456 }
457 
459 {
460  if (!serial_training_set)
461  libmesh_error_msg("Error: We must have serial_training_set==true in " \
462  << "RBEIMConstruction::initialize_parametrized_functions_in_training_set");
463 
464  libMesh::out << "Initializing parametrized functions in training set..." << std::endl;
465  // initialize rb_eval's parameters
467 
469  for (unsigned int i=0; i<get_n_training_samples(); i++)
470  {
472  truth_solve(-1);
473 
475 
476  libMesh::out << "Completed solve for training sample " << (i+1) << " of " << get_n_training_samples() << std::endl;
477  }
478 
480 
481  libMesh::out << "Parametrized functions in training set initialized" << std::endl << std::endl;
482 }
483 
485 {
486  // Ignore unused parameter warnings when Exodus is not available.
487  libmesh_ignore(pathname);
488 
490 
492  {
493 #ifdef LIBMESH_HAVE_EXODUS_API
495 
496  std::stringstream pathname_i;
497  pathname_i << pathname << "_" << i << ".exo";
498 
499  std::set<std::string> system_names;
500  system_names.insert(get_explicit_system().name());
501  ExodusII_IO(get_mesh()).write_equation_systems (pathname_i.str(),
502  this->get_equation_systems(),
503  &system_names);
504  libMesh::out << "Plotted parameterized function " << i << std::endl;
505 #endif
506  }
507 }
508 
509 
510 
512 {
513  LOG_SCOPE("compute_best_fit_error()", "RBEIMConstruction");
514 
515  const unsigned int RB_size = get_rb_evaluation().get_n_basis_functions();
516 
517  // load up the parametrized function for the current parameters
518  truth_solve(-1);
519 
520  switch(best_fit_type_flag)
521  {
522  // Perform an L2 projection in order to find an approximation to solution (from truth_solve above)
523  case(PROJECTION_BEST_FIT):
524  {
525  // We have pre-stored inner_product_matrix * basis_function[i] for each i
526  // so we can just evaluate the dot product here.
527  DenseVector<Number> best_fit_rhs(RB_size);
528  for (unsigned int i=0; i<RB_size; i++)
529  {
530  best_fit_rhs(i) = get_explicit_system().solution->dot(*_matrix_times_bfs[i]);
531  }
532 
533  // Now compute the best fit by an LU solve
535  DenseMatrix<Number> RB_inner_product_matrix_N(RB_size);
536  get_rb_evaluation().RB_inner_product_matrix.get_principal_submatrix(RB_size, RB_inner_product_matrix_N);
537 
538  RB_inner_product_matrix_N.lu_solve(best_fit_rhs, get_rb_evaluation().RB_solution);
539  break;
540  }
541  // Perform EIM solve in order to find the approximation to solution
542  // (rb_solve provides the EIM basis function coefficients used below)
543  case(EIM_BEST_FIT):
544  {
545  // Turn off error estimation for this rb_solve, we use the linfty norm instead
548  get_rb_evaluation().rb_solve(RB_size);
550  break;
551  }
552  default:
553  libmesh_error_msg("Should not reach here");
554  }
555 
556  // load the error into solution
557  for (unsigned int i=0; i<get_rb_evaluation().get_n_basis_functions(); i++)
558  get_explicit_system().solution->add(-get_rb_evaluation().RB_solution(i),
559  get_rb_evaluation().get_basis_function(i));
560 
561  Real best_fit_error = get_explicit_system().solution->linfty_norm();
562 
563  return best_fit_error;
564 }
565 
567 {
568  LOG_SCOPE("truth_solve()", "RBEIMConstruction");
569 
570  int training_parameters_found_index = -1;
572  {
573  // Check if parameters are in the training set. If so, we can just load the
574  // solution from _parametrized_functions_in_training_set
575 
576  for (unsigned int i=0; i<get_n_training_samples(); i++)
577  {
579  {
580  training_parameters_found_index = i;
581  break;
582  }
583  }
584  }
585 
586  // If the parameters are in the training set, just copy the solution vector
587  if (training_parameters_found_index >= 0)
588  {
590  *_parametrized_functions_in_training_set[training_parameters_found_index];
591  get_explicit_system().update(); // put the solution into current_local_solution as well
592  }
593  // Otherwise, we have to compute the projection
594  else
595  {
596  if (this->n_vars() != 1)
597  {
598  libmesh_error_msg("The system that we use to perform EIM L2 solves should have one variable");
599  }
600 
601  RBEIMEvaluation & eim_eval = cast_ref<RBEIMEvaluation &>(get_rb_evaluation());
602  eim_eval.set_parameters( get_parameters() );
603 
604  // Compute truth representation via L2 projection
605  const MeshBase & mesh = this->get_mesh();
606 
607  std::unique_ptr<DGFEMContext> c = libmesh_make_unique<DGFEMContext>(*this);
608  DGFEMContext & context = cast_ref<DGFEMContext &>(*c);
609  init_context_with_sys(context, *this);
610 
611  // First cache all the element data
612  std::vector<std::vector<std::vector<Number>>> parametrized_fn_vals(mesh.n_elem());
613  std::vector<std::vector<Real>> JxW_values(mesh.n_elem());
614  std::vector<std::vector<std::vector<Real>>> phi_values(mesh.n_elem());
615 
616  for (const auto & elem : mesh.active_local_element_ptr_range())
617  {
618  dof_id_type elem_id = elem->id();
619 
620  context.pre_fe_reinit(*this, elem);
621  context.elem_fe_reinit();
622 
623  FEBase * elem_fe = nullptr;
624  context.get_element_fe( 0, elem_fe );
625  unsigned int n_qpoints = context.get_element_qrule().n_points();
626  const std::vector<Real> & JxW = elem_fe->get_JxW();
627  const std::vector<std::vector<Real>> & phi = elem_fe->get_phi();
628  const std::vector<Point> & xyz = elem_fe->get_xyz();
629 
630  // Loop over qp before var because parametrized functions often use
631  // some caching based on qp.
632  parametrized_fn_vals[elem_id].resize(n_qpoints);
633  JxW_values[elem_id].resize(n_qpoints);
634  phi_values[elem_id].resize(n_qpoints);
635  for (unsigned int qp=0; qp<n_qpoints; qp++)
636  {
637  JxW_values[elem_id][qp] = JxW[qp];
638 
639  unsigned int n_var_dofs = cast_int<unsigned int>(context.get_dof_indices().size());
640  phi_values[elem_id][qp].resize(n_var_dofs);
641  for (unsigned int i=0; i != n_var_dofs; i++)
642  {
643  phi_values[elem_id][qp][i] = phi[i][qp];
644  }
645 
646  parametrized_fn_vals[elem_id][qp].resize(get_explicit_system().n_vars());
647  for (unsigned int var=0; var<get_explicit_system().n_vars(); var++)
648  {
649  Number eval_result = eim_eval.evaluate_parametrized_function(var, xyz[qp], *elem);
650  parametrized_fn_vals[elem_id][qp][var] = eval_result;
651  }
652  }
653  }
654 
655  // We do a distinct solve for each variable in the ExplicitSystem
656  for (unsigned int var=0; var<get_explicit_system().n_vars(); var++)
657  {
658  rhs->zero();
659 
660  for (const auto & elem : mesh.active_local_element_ptr_range())
661  {
662  dof_id_type elem_id = elem->id();
663 
664  context.pre_fe_reinit(*this, elem);
665  //context.elem_fe_reinit(); <--- skip this because we cached all the FE data
666 
667  // Loop over qp before var because parametrized functions often use
668  // some caching based on qp.
669  for (auto qp : index_range(JxW_values[elem_id]))
670  {
671  const unsigned int n_var_dofs =
672  cast_int<unsigned int>(phi_values[elem_id][qp].size());
673 
674  Number eval_result = parametrized_fn_vals[elem_id][qp][var];
675  for (unsigned int i=0; i != n_var_dofs; i++)
676  {
677  context.get_elem_residual()(i) +=
678  JxW_values[elem_id][qp] * eval_result * phi_values[elem_id][qp][i];
679  }
680  }
681 
682  // Apply constraints, e.g. periodic constraints
684 
685  // Add element vector to global vector
686  rhs->add_vector(context.get_elem_residual(), context.get_dof_indices() );
687  }
688 
689  // Solve to find the best fit, then solution stores the truth representation
690  // of the function to be approximated
692 
693  if (assert_convergence)
695 
696  // Now copy the solution to the explicit system's solution.
698  }
700  }
701 
702  if (plot_solution > 0)
703  {
704 #ifdef LIBMESH_HAVE_EXODUS_API
706  this->get_equation_systems());
707 #endif
708  }
709 
710  return 0.;
711 }
712 
714 {
715  // default implementation of init_context
716  // for compute_best_fit
717  for (unsigned int var=0; var<sys.n_vars(); var++)
718  {
719  FEBase * elem_fe = nullptr;
720  c.get_element_fe( var, elem_fe );
721  elem_fe->get_JxW();
722  elem_fe->get_phi();
723  elem_fe->get_xyz();
724  }
725 }
726 
728 {
729  LOG_SCOPE("update_RB_system_matrices()", "RBEIMConstruction");
730 
731  // First, update the inner product matrix
732  {
733  unsigned int RB_size = get_rb_evaluation().get_n_basis_functions();
734 
735  std::unique_ptr<NumericVector<Number>> explicit_sys_temp =
736  get_explicit_system().solution->zero_clone();
737 
738  std::unique_ptr<NumericVector<Number>> temp1 = this->solution->zero_clone();
739  std::unique_ptr<NumericVector<Number>> temp2 = this->solution->zero_clone();
740 
741  for (unsigned int i=(RB_size-1); i<RB_size; i++)
742  {
743  for (unsigned int j=0; j<RB_size; j++)
744  {
745  // We must localize get_rb_evaluation().get_basis_function(j) before calling
746  // get_explicit_sys_subvector
747  std::unique_ptr<NumericVector<Number>> localized_basis_function =
749  localized_basis_function->init(get_explicit_system().n_dofs(), false, SERIAL);
750  get_rb_evaluation().get_basis_function(j).localize(*localized_basis_function);
751 
752  // Compute reduced inner_product_matrix via a series of matvecs
753  for (unsigned int var=0; var<get_explicit_system().n_vars(); var++)
754  {
755  get_explicit_sys_subvector(*temp1, var, *localized_basis_function);
756  inner_product_matrix->vector_mult(*temp2, *temp1);
757  set_explicit_sys_subvector(*explicit_sys_temp, var, *temp2);
758  }
759 
760  Number value = explicit_sys_temp->dot( get_rb_evaluation().get_basis_function(i) );
762  if (i!=j)
763  {
764  // The inner product matrix is assumed
765  // to be hermitian
767  }
768  }
769  }
770  }
771 
772  unsigned int RB_size = get_rb_evaluation().get_n_basis_functions();
773 
774  RBEIMEvaluation & eim_eval = cast_ref<RBEIMEvaluation &>(get_rb_evaluation());
775 
776  // update the EIM interpolation matrix
777  for (unsigned int j=0; j<RB_size; j++)
778  {
779  // Sample the basis functions at the
780  // new interpolation point
782  get_explicit_system().get_dof_map().get_send_list());
783 
784  eim_eval.interpolation_matrix(RB_size-1,j) =
786  eim_eval.interpolation_points[RB_size-1] );
787  }
788 }
789 
791 {
792  Real best_fit_error = compute_best_fit_error();
793  return best_fit_error;
794 }
795 
797 {
798  libMesh::out << "Updating RB matrices" << std::endl;
800 }
801 
803  unsigned int var,
804  NumericVector<Number> & source)
805 {
806  LOG_SCOPE("set_explicit_sys_subvector()", "RBEIMConstruction");
807 
808  // For convenience we localize the source vector first to make it easier to
809  // copy over (no need to do distinct send/receives).
810  std::unique_ptr<NumericVector<Number>> localized_source =
812  localized_source->init(this->n_dofs(), false, SERIAL);
813  source.localize(*localized_source);
814 
815  for (auto i : IntRange<dof_id_type>(0, _dof_map_between_systems[var].size()))
816  {
817  dof_id_type implicit_sys_dof_index = i;
818  dof_id_type explicit_sys_dof_index = _dof_map_between_systems[var][i];
819 
820  if ((dest.first_local_index() <= explicit_sys_dof_index) &&
821  (explicit_sys_dof_index < dest.last_local_index()))
822  dest.set(explicit_sys_dof_index,
823  (*localized_source)(implicit_sys_dof_index));
824  }
825 
826  dest.close();
827 }
828 
830  unsigned int var,
831  NumericVector<Number> & localized_source)
832 {
833  LOG_SCOPE("get_explicit_sys_subvector()", "RBEIMConstruction");
834 
835  for (auto i : IntRange<dof_id_type>(0, _dof_map_between_systems[var].size()))
836  {
837  dof_id_type implicit_sys_dof_index = i;
838  dof_id_type explicit_sys_dof_index = _dof_map_between_systems[var][i];
839 
840  if ((dest.first_local_index() <= implicit_sys_dof_index) &&
841  (implicit_sys_dof_index < dest.last_local_index()))
842  dest.set(implicit_sys_dof_index,
843  localized_source(explicit_sys_dof_index));
844  }
845 
846  dest.close();
847 }
848 
850 {
851  LOG_SCOPE("init_dof_map_between_systems()", "RBEIMConstruction");
852 
853  unsigned int n_vars = get_explicit_system().n_vars();
854  unsigned int n_sys_dofs = this->n_dofs();
855 
856  _dof_map_between_systems.resize(n_vars);
857  for (unsigned int var=0; var<n_vars; var++)
858  {
859  _dof_map_between_systems[var].resize(n_sys_dofs);
860  }
861 
862  std::vector<dof_id_type> implicit_sys_dof_indices;
863  std::vector<dof_id_type> explicit_sys_dof_indices;
864 
865  for (const auto & elem : get_mesh().active_element_ptr_range())
866  {
867  this->get_dof_map().dof_indices (elem, implicit_sys_dof_indices);
868 
869  const std::size_t n_dofs = implicit_sys_dof_indices.size();
870 
871  for (unsigned int var=0; var<n_vars; var++)
872  {
873  get_explicit_system().get_dof_map().dof_indices (elem, explicit_sys_dof_indices, var);
874 
875  libmesh_assert(explicit_sys_dof_indices.size() == n_dofs);
876 
877  for (std::size_t i=0; i<n_dofs; i++)
878  {
879  dof_id_type implicit_sys_dof_index = implicit_sys_dof_indices[i];
880  dof_id_type explicit_sys_dof_index = explicit_sys_dof_indices[i];
881 
882  _dof_map_between_systems[var][implicit_sys_dof_index] =
883  explicit_sys_dof_index;
884  }
885  }
886  }
887 }
888 
889 } // namespace libMesh
libMesh::RBConstruction::inner_product_matrix
std::unique_ptr< SparseMatrix< Number > > inner_product_matrix
The inner product matrix.
Definition: rb_construction.h:484
libMesh::RBEIMConstruction::process_parameters_file
virtual void process_parameters_file(const std::string &parameters_filename) override
Read parameters in from file and set up this system accordingly.
Definition: rb_eim_construction.C:112
libMesh::RBEIMConstruction::train_reduced_basis
virtual Real train_reduced_basis(const bool resize_rb_eval_data=true) override
Override train_reduced_basis to first initialize _parametrized_functions_in_training_set.
Definition: rb_eim_construction.C:195
libMesh::System
Manages consistently variables, degrees of freedom, and coefficient vectors.
Definition: system.h:100
libMesh::RBEvaluation::get_n_basis_functions
virtual unsigned int get_n_basis_functions() const
Get the current number of basis functions.
Definition: rb_evaluation.h:145
libMesh::NumericVector::zero
virtual void zero()=0
Set all entries to zero.
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::Number
Real Number
Definition: libmesh_common.h:195
libMesh::DiffContext::get_elem_residual
const DenseVector< Number > & get_elem_residual() const
Const accessor for element residual.
Definition: diff_context.h:249
libMesh::FEMContext::get_element_qrule
const QBase & get_element_qrule() const
Accessor for element interior quadrature rule for the dimension of the current _elem.
Definition: fem_context.h:790
libMesh::System::n_vars
unsigned int n_vars() const
Definition: system.h:2155
libMesh::RBEIMConstruction::print_info
virtual void print_info() override
Print out info that describes the current setup of this RBConstruction.
Definition: rb_eim_construction.C:137
libMesh::RBEIMConstruction::load_rb_solution
virtual void load_rb_solution() override
Load the RB solution from the most recent solve with rb_eval into this system's solution vector.
Definition: rb_eim_construction.C:283
libMesh::System::get_equation_systems
const EquationSystems & get_equation_systems() const
Definition: system.h:720
libMesh::FEAbstract::get_xyz
const std::vector< Point > & get_xyz() const
Definition: fe_abstract.h:237
libMesh::EquationSystems::add_system
virtual System & add_system(const std::string &system_type, const std::string &name)
Add the system of type system_type named name to the systems array.
Definition: equation_systems.C:345
libMesh::RBEIMConstruction::enrich_RB_space
virtual void enrich_RB_space() override
Add a new basis function to the RB space.
Definition: rb_eim_construction.C:307
libMesh::RBEIMEvaluation::rb_solve
virtual Real rb_solve(unsigned int N) override
Calculate the EIM approximation to parametrized_function using the first N EIM basis functions.
Definition: rb_eim_evaluation.C:113
libMesh::RBEIMConstruction::update_system
virtual void update_system() override
Update the system after enriching the RB space; this calls a series of functions to update the system...
Definition: rb_eim_construction.C:796
libMesh::ExplicitSystem::rhs
NumericVector< Number > * rhs
The system matrix.
Definition: explicit_system.h:114
libMesh::DofMap::dof_indices
void dof_indices(const Elem *const elem, std::vector< dof_id_type > &di) const
Fills the vector di with the global degree of freedom indices for the element.
Definition: dof_map.C:1967
libMesh::DiffContext::get_dof_indices
const std::vector< dof_id_type > & get_dof_indices() const
Accessor for element dof indices.
Definition: diff_context.h:367
libMesh::RBConstruction::process_parameters_file
virtual void process_parameters_file(const std::string &parameters_filename)
Read in from the file specified by parameters_filename and set the this system's member variables acc...
Definition: rb_construction.C:193
libMesh::PARALLEL
Definition: enum_parallel_type.h:36
libMesh::DofMap::constrain_element_vector
void constrain_element_vector(DenseVector< Number > &rhs, std::vector< dof_id_type > &dofs, bool asymmetric_constraint_rows=true) const
Constrains the element vector.
Definition: dof_map.h:2030
libMesh::RBEIMConstruction::init_explicit_system
virtual void init_explicit_system()=0
Add variables to the ExplicitSystem that is used to store the basis functions.
libMesh::RBEIMConstruction::EIM_BEST_FIT
Definition: rb_eim_construction.h:52
libMesh::RBEIMConstruction::~RBEIMConstruction
virtual ~RBEIMConstruction()
Destructor.
Definition: rb_eim_construction.C:90
libMesh::RBConstruction::initialize_rb_construction
virtual void initialize_rb_construction(bool skip_matrix_assembly=false, bool skip_vector_assembly=false)
Allocate all the data structures necessary for the construction stage of the RB method.
Definition: rb_construction.C:419
libMesh::RBEIMConstruction::_empty_rb_assembly_expansion
RBAssemblyExpansion _empty_rb_assembly_expansion
We initialize RBEIMConstruction so that it has an "empty" RBAssemblyExpansion, because this isn't use...
Definition: rb_eim_construction.h:312
libMesh::DGFEMContext
This class extends FEMContext in order to provide extra data required to perform local element residu...
Definition: dg_fem_context.h:39
libMesh::QBase::n_points
unsigned int n_points() const
Definition: quadrature.h:126
libMesh::RBEvaluation::rb_solve
virtual Real rb_solve(unsigned int N)
Perform online solve with the N RB basis functions, for the set of parameters in current_params,...
Definition: rb_evaluation.C:209
libMesh::SERIAL
Definition: enum_parallel_type.h:35
libMesh::NumericVector::last_local_index
virtual numeric_index_type last_local_index() const =0
libMesh::index_range
IntRange< std::size_t > index_range(const std::vector< T > &vec)
Helper function that returns an IntRange<std::size_t> representing all the indices of the passed-in v...
Definition: int_range.h:106
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::RBEIMConstruction::_matrix_times_bfs
std::vector< std::unique_ptr< NumericVector< Number > > > _matrix_times_bfs
This vector is used to store inner_product_matrix * basis_function[i] for each i, since we frequently...
Definition: rb_eim_construction.h:338
libMesh::RBEIMConstruction::truth_solve
virtual Real truth_solve(int plot_solution) override
Load the truth representation of the parametrized function at the current parameters into the solutio...
Definition: rb_eim_construction.C:566
libMesh::FEMContext::pre_fe_reinit
virtual void pre_fe_reinit(const System &, const Elem *e)
Reinitializes local data vectors/matrices on the current geometric element.
Definition: fem_context.C:1642
libMesh::NumericVector::close
virtual void close()=0
Calls the NumericVector's internal assembly routines, ensuring that the values are consistent across ...
libMesh::FEGenericBase
This class forms the foundation from which generic finite elements may be derived.
Definition: exact_error_estimator.h:39
libMesh::EquationSystems::get_system
const T_sys & get_system(const std::string &name) const
Definition: equation_systems.h:757
libMesh::FEAbstract::get_JxW
const std::vector< Real > & get_JxW() const
Definition: fe_abstract.h:244
libMesh::TOLERANCE
static const Real TOLERANCE
Definition: libmesh_common.h:128
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
libMesh::DenseMatrix< Number >
libMesh::RBConstruction::assert_convergence
bool assert_convergence
A boolean flag to indicate whether to check for proper convergence after each solve.
Definition: rb_construction.h:781
libMesh::GHOSTED
Definition: enum_parallel_type.h:37
libMesh::RBConstructionBase< LinearImplicitSystem >::init_data
virtual void init_data()
Initializes the member data fields associated with the system, so that, e.g., assemble() may be used.
Definition: rb_construction_base.C:74
libMesh::libmesh_conj
T libmesh_conj(T a)
Definition: libmesh_common.h:167
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::RBEIMConstruction::initialize_parametrized_functions_in_training_set
void initialize_parametrized_functions_in_training_set()
Loop over the training set and compute the parametrized function for each training index.
Definition: rb_eim_construction.C:458
libMesh::RBEIMConstruction::_dof_map_between_systems
std::vector< std::vector< dof_id_type > > _dof_map_between_systems
The index map between the explicit system and the implicit system.
Definition: rb_eim_construction.h:332
libMesh::ExodusII_IO
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Definition: exodusII_io.h:51
libMesh::RBConstruction::use_empty_rb_solve_in_greedy
bool use_empty_rb_solve_in_greedy
A boolean flag to indicate whether or not we initialize the Greedy algorithm by performing rb_solves ...
Definition: rb_construction.h:567
libMesh::RBEIMConstruction::_mesh_function
std::unique_ptr< MeshFunction > _mesh_function
A mesh function to interpolate on the mesh.
Definition: rb_eim_construction.h:300
libMesh::RBParametrized::set_parameters
void set_parameters(const RBParameters &params)
Set the current parameters to params.
Definition: rb_parametrized.C:155
libMesh::RBEIMConstruction::plot_parametrized_functions_in_training_set
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.
Definition: rb_eim_construction.C:484
libMesh::NumericVector::build
static std::unique_ptr< NumericVector< T > > build(const Parallel::Communicator &comm, const SolverPackage solver_package=libMesh::default_solver_package())
Builds a NumericVector on the processors in communicator comm using the linear solver package specifi...
Definition: numeric_vector.C:49
libMesh::RBParametrized::get_parameters
const RBParameters & get_parameters() const
Get the current parameters.
Definition: rb_parametrized.C:166
libMesh::RBEIMConstruction::_parametrized_functions_in_training_set_initialized
bool _parametrized_functions_in_training_set_initialized
Boolean flag to indicate whether or not we have called compute_parametrized_functions_in_training_set...
Definition: rb_eim_construction.h:287
libMesh::RBEIMEvaluation::interpolation_points_var
std::vector< unsigned int > interpolation_points_var
The corresponding list of variables indices at which the interpolation points were identified.
Definition: rb_eim_evaluation.h:188
libMesh::NumericVector< Number >
libMesh::RBEIMConstruction::evaluate_mesh_function
Number evaluate_mesh_function(unsigned int var_number, Point p)
Evaluate the mesh function at the specified point and for the specified variable.
Definition: rb_eim_construction.C:203
libMesh::libmesh_assert
libmesh_assert(ctx)
libMesh::IntRange
The IntRange templated class is intended to make it easy to loop over integers which are indices of a...
Definition: int_range.h:53
libMesh::RBEIMConstruction::load_basis_function
virtual void load_basis_function(unsigned int i) override
Load the i^th RB function into the RBConstruction solution vector.
Definition: rb_eim_construction.C:272
libMesh::NumericVector::add_vector
virtual void add_vector(const T *v, const std::vector< numeric_index_type > &dof_indices)
Computes , where v is a pointer and each dof_indices[i] specifies where to add value v[i].
Definition: numeric_vector.C:363
libMesh::RBEIMConstruction::init_context_with_sys
virtual void init_context_with_sys(FEMContext &c, System &sys)
Initialize c based on sys.
Definition: rb_eim_construction.C:713
libMesh::MeshBase
This is the MeshBase class.
Definition: mesh_base.h:78
libMesh::RBEvaluation::evaluate_RB_error_bound
bool evaluate_RB_error_bound
Boolean to indicate whether we evaluate a posteriori error bounds when rb_solve is called.
Definition: rb_evaluation.h:322
std::abs
MetaPhysicL::DualNumber< T, D > abs(const MetaPhysicL::DualNumber< T, D > &in)
libMesh::RBConstruction::inner_product_solver
std::unique_ptr< LinearSolver< Number > > inner_product_solver
We store an extra linear solver object which we can optionally use for solving all systems in which t...
Definition: rb_construction.h:471
libMesh::RBConstruction::clear
virtual void clear() override
Clear all the data structures associated with the system.
Definition: rb_construction.C:100
libMesh::RBEIMConstruction::set_explicit_sys_subvector
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.
Definition: rb_eim_construction.C:802
libMesh::RBEIMConstruction::_ghosted_meshfunction_vector
std::unique_ptr< 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...
Definition: rb_eim_construction.h:306
libMesh::NumericVector::localize
virtual void localize(std::vector< T > &v_local) const =0
Creates a copy of the global vector in the local vector v_local.
libMesh::RBEIMConstruction::set_best_fit_type_flag
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.
Definition: rb_eim_construction.C:122
libMesh::RBEIMConstruction::set_point_locator_tol
void set_point_locator_tol(Real point_locator_tol)
Set a point locator tolerance to be used in this class's MeshFunction, and other operations that requ...
Definition: rb_eim_construction.C:250
libMesh::RBConstructionBase< LinearImplicitSystem >::get_n_training_samples
numeric_index_type get_n_training_samples() const
Get the total number of training samples.
Definition: rb_construction_base.C:98
libMesh::System::n_local_dofs
dof_id_type n_local_dofs() const
Definition: system.C:187
libMesh::RBConstructionBase< LinearImplicitSystem >::get_params_from_training_set
RBParameters get_params_from_training_set(unsigned int index)
Return the RBParameters in index index of training set.
Definition: rb_construction_base.C:136
libMesh::RBEvaluation::RB_solution
DenseVector< Number > RB_solution
The RB solution vector.
Definition: rb_evaluation.h:270
libMesh::DofMap::set_implicit_neighbor_dofs
void set_implicit_neighbor_dofs(bool implicit_neighbor_dofs)
Allow the implicit_neighbor_dofs flag to be set programmatically.
Definition: dof_map.C:1704
libMesh::RBConstructionBase< LinearImplicitSystem >::set_params_from_training_set
void set_params_from_training_set(unsigned int index)
Set parameters to the RBParameters stored in index index of the training set.
Definition: rb_construction_base.C:130
libMesh::System::get_mesh
const MeshBase & get_mesh() const
Definition: system.h:2083
libMesh::ParallelObject::processor_id
processor_id_type processor_id() const
Definition: parallel_object.h:106
libMesh::libmesh_ignore
void libmesh_ignore(const Args &...)
Definition: libmesh_common.h:526
libMesh::DofObject::invalid_id
static const dof_id_type invalid_id
An invalid id to distinguish an uninitialized DofObject.
Definition: dof_object.h:421
libMesh::RBEIMConstruction::init_dof_map_between_systems
void init_dof_map_between_systems()
Set up the index map between the implicit and explicit systems.
Definition: rb_eim_construction.C:849
libMesh::Point
A Point defines a location in LIBMESH_DIM dimensional Real space.
Definition: point.h:38
libMesh::RBConstructionBase< LinearImplicitSystem >
libMesh::RBEIMConstruction::get_point_locator_tol
Real get_point_locator_tol() const
Definition: rb_eim_construction.C:255
libMesh::RBConstruction::solve_for_matrix_and_rhs
virtual void solve_for_matrix_and_rhs(LinearSolver< Number > &input_solver, SparseMatrix< Number > &input_matrix, NumericVector< Number > &input_rhs)
Assembles & solves the linear system A*x=b for the specified matrix input_matrix and right-hand side ...
Definition: rb_construction.C:130
libMesh::RBConstruction::get_rb_evaluation
RBEvaluation & get_rb_evaluation()
Get a reference to the RBEvaluation object.
Definition: rb_construction.C:175
libMesh::RBConstruction::set_rb_assembly_expansion
void set_rb_assembly_expansion(RBAssemblyExpansion &rb_assembly_expansion_in)
Set the rb_assembly_expansion object.
Definition: rb_construction.C:366
libMesh::DenseVector::size
virtual unsigned int size() const override
Definition: dense_vector.h:92
libMesh::RBEIMEvaluation
This class is part of the rbOOmit framework.
Definition: rb_eim_evaluation.h:51
libMesh::RBEIMConstruction::PROJECTION_BEST_FIT
Definition: rb_eim_construction.h:52
libMesh::RBEIMConstruction::get_eim_assembly_objects
std::vector< std::unique_ptr< ElemAssembly > > & get_eim_assembly_objects()
Definition: rb_eim_construction.C:302
libMesh::RBConstruction::check_convergence
void check_convergence(LinearSolver< Number > &input_solver)
Check if the linear solver reports convergence.
Definition: rb_construction.C:2231
libMesh::EquationSystems
This is the EquationSystems class.
Definition: equation_systems.h:74
libMesh::MeshOutput::write_equation_systems
virtual void write_equation_systems(const std::string &, const EquationSystems &, const std::set< std::string > *system_names=nullptr)
This method implements writing a mesh with data to a specified file where the data is taken from the ...
Definition: mesh_output.C:31
libMesh::RBConstruction::print_info
virtual void print_info()
Print out info that describes the current setup of this RBConstruction.
Definition: rb_construction.C:312
libMesh::RBEIMConstruction::compute_best_fit_error
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...
Definition: rb_eim_construction.C:511
libMesh::ExplicitSystem
Manages consistently variables, degrees of freedom, and coefficient vectors for explicit systems.
Definition: explicit_system.h:48
libMesh::DenseVector::resize
void resize(const unsigned int n)
Resize the vector.
Definition: dense_vector.h:355
libMesh::FEMContext::elem_fe_reinit
virtual void elem_fe_reinit(const std::vector< Point > *const pts=nullptr)
Reinitializes interior FE objects on the current geometric element.
Definition: fem_context.C:1436
libMesh::RBParametrized::initialize_parameters
void initialize_parameters(const RBParameters &mu_min_in, const RBParameters &mu_max_in, const std::map< std::string, std::vector< Real >> &discrete_parameter_values)
Initialize the parameter ranges and set current_parameters.
Definition: rb_parametrized.C:60
libMesh::RBConstruction::compute_RB_inner_product
bool compute_RB_inner_product
Boolean flag to indicate whether we compute the RB_inner_product_matrix.
Definition: rb_construction.h:553
libMesh::RBEIMConstruction::_point_locator_tol
Real _point_locator_tol
The point locator tolerance.
Definition: rb_eim_construction.h:343
libMesh::FEMContext::get_element_fe
void get_element_fe(unsigned int var, FEGenericBase< OutputShape > *&fe) const
Accessor for interior finite element object for variable var for the largest dimension in the mesh.
Definition: fem_context.h:275
libMesh::System::solution
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1539
libMesh::RBEIMConstruction::_rb_eim_assembly_objects
std::vector< std::unique_ptr< ElemAssembly > > _rb_eim_assembly_objects
The vector of assembly objects that are created to point to this RBEIMConstruction.
Definition: rb_eim_construction.h:318
libMesh::RBEIMConstruction::_explicit_system_name
std::string _explicit_system_name
We use an ExplicitSystem to store the EIM basis functions.
Definition: rb_eim_construction.h:327
libMesh::RBEvaluation::RB_inner_product_matrix
DenseMatrix< Number > RB_inner_product_matrix
The inner product matrix.
Definition: rb_evaluation.h:255
libMesh::NumericVector::set
virtual void set(const numeric_index_type i, const T value)=0
Sets v(i) = value.
value
static const bool value
Definition: xdr_io.C:56
libMesh::System::name
const std::string & name() const
Definition: system.h:2067
libMesh::RBEvaluation
This class is part of the rbOOmit framework.
Definition: rb_evaluation.h:50
libMesh::RBEIMConstruction::get_RB_error_bound
virtual Real get_RB_error_bound() override
Override to return the best fit error.
Definition: rb_eim_construction.C:790
libMesh::RBConstructionBase< LinearImplicitSystem >::serial_training_set
bool serial_training_set
This boolean flag indicates whether or not the training set should be the same on all processors.
Definition: rb_construction_base.h:247
libMesh::DenseMatrix::get_principal_submatrix
void get_principal_submatrix(unsigned int sub_m, unsigned int sub_n, DenseMatrix< T > &dest) const
Put the sub_m x sub_n principal submatrix into dest.
Definition: dense_matrix_impl.h:574
libMesh::RBEIMConstruction::RBEIMConstruction
RBEIMConstruction(EquationSystems &es, const std::string &name, const unsigned int number)
Constructor.
Definition: rb_eim_construction.C:53
libMesh::Elem
This is the base class from which all geometric element types are derived.
Definition: elem.h:100
libMesh::RBEIMConstruction::get_explicit_system
ExplicitSystem & get_explicit_system()
Get the ExplicitSystem associated with this system.
Definition: rb_eim_construction.C:267
libMesh::RBEIMConstruction::build_eim_assembly
virtual std::unique_ptr< ElemAssembly > build_eim_assembly(unsigned int bf_index)=0
Build an element assembly object that will access basis function bf_index.
libMesh::RBEIMConstruction::best_fit_type_flag
BEST_FIT_TYPE best_fit_type_flag
Enum that indicates which type of "best fit" algorithm we should use.
Definition: rb_eim_construction.h:243
libMesh::RBEIMConstruction::update_RB_system_matrices
virtual void update_RB_system_matrices() override
Compute the reduced basis matrices for the current basis.
Definition: rb_eim_construction.C:727
libMesh::System::get_dof_map
const DofMap & get_dof_map() const
Definition: system.h:2099
libMesh::RBEIMEvaluation::interpolation_points
std::vector< Point > interpolation_points
The list of interpolation points, i.e.
Definition: rb_eim_evaluation.h:182
libMesh::System::n_dofs
dof_id_type n_dofs() const
Definition: system.C:150
libMesh::RBEIMConstruction::_parametrized_functions_in_training_set
std::vector< std::unique_ptr< NumericVector< Number > > > _parametrized_functions_in_training_set
The libMesh vectors storing the finite element coefficients of the RB basis functions.
Definition: rb_eim_construction.h:293
libMesh::RBEIMEvaluation::interpolation_points_elem
std::vector< Elem * > interpolation_points_elem
The corresponding list of elements at which the interpolation points were identified.
Definition: rb_eim_evaluation.h:194
libMesh::DenseMatrix::lu_solve
void lu_solve(const DenseVector< T > &b, DenseVector< T > &x)
Solve the system Ax=b given the input vector b.
Definition: dense_matrix_impl.h:625
libMesh::FEGenericBase::get_phi
const std::vector< std::vector< OutputShape > > & get_phi() const
Definition: fe_base.h:206
libMesh::RBEIMConstruction::initialize_eim_assembly_objects
virtual void initialize_eim_assembly_objects()
Build a vector of ElemAssembly objects that accesses the basis functions stored in this RBEIMConstruc...
Definition: rb_eim_construction.C:260
libMesh::RBEvaluation::basis_functions
std::vector< std::unique_ptr< NumericVector< Number > > > basis_functions
The libMesh vectors storing the finite element coefficients of the RB basis functions.
Definition: rb_evaluation.h:241
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::RBEIMConstruction::initialize_rb_construction
virtual void initialize_rb_construction(bool skip_matrix_assembly=false, bool skip_vector_assembly=false) override
Initialize this system so that we can perform the Construction stage of the RB method.
Definition: rb_eim_construction.C:166
libMesh::System::get_all_variable_numbers
void get_all_variable_numbers(std::vector< unsigned int > &all_variable_numbers) const
Fills all_variable_numbers with all the variable numbers for the variables that have been added to th...
Definition: system.C:1240
libMesh::RBEIMConstruction::clear
virtual void clear() override
Clear this object.
Definition: rb_eim_construction.C:95
libMesh::RBEIMEvaluation::interpolation_matrix
DenseMatrix< Number > interpolation_matrix
Dense matrix that stores the lower triangular interpolation matrix that can be used.
Definition: rb_eim_evaluation.h:176
libMesh::out
OStreamProxy out
libMesh::System::update
virtual void update()
Update the local values to reflect the solution on neighboring processors.
Definition: system.C:408
libMesh::RBEIMConstruction::get_explicit_sys_subvector
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.
Definition: rb_eim_construction.C:829
libMesh::RBEIMConstruction::init_data
virtual void init_data() override
Override to initialize the coupling matrix to decouple variables in this system.
Definition: rb_eim_construction.C:155
libMesh::FEMContext::interior_value
Number interior_value(unsigned int var, unsigned int qp) const
Definition: fem_context.C:371
libMesh::RBEvaluation::get_basis_function
NumericVector< Number > & get_basis_function(unsigned int i)
Get a reference to the i^th basis function.
Definition: rb_evaluation.C:202
libMesh::DenseVector< Number >
libMesh::RBConstruction::train_reduced_basis
virtual Real train_reduced_basis(const bool resize_rb_eval_data=true)
Train the reduced basis.
Definition: rb_construction.C:1024
libMesh::RBEIMEvaluation::evaluate_parametrized_function
Number evaluate_parametrized_function(unsigned int var_index, const Point &p, const Elem &elem)
Definition: rb_eim_evaluation.C:103
libMesh::NumericVector::first_local_index
virtual numeric_index_type first_local_index() const =0
libMesh::RBEIMConstruction::init_implicit_system
virtual void init_implicit_system()=0
Add one variable to the ImplicitSystem (i.e.
libMesh::FEMContext
This class provides all data required for a physics package (e.g.
Definition: fem_context.h:62