libMesh
reduced_basis_ex5.C
Go to the documentation of this file.
1 // The libMesh Finite Element Library.
2 // Copyright (C) 2002-2019 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
3 
4 // This library is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU Lesser General Public
6 // License as published by the Free Software Foundation; either
7 // version 2.1 of the License, or (at your option) any later version.
8 
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // Lesser General Public License for more details.
13 
14 // You should have received a copy of the GNU Lesser General Public
15 // License along with this library; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 
18 // rbOOmit: An implementation of the Certified Reduced Basis method.
19 // Copyright (C) 2009, 2010 David J. Knezevic
20 // This file is part of rbOOmit.
21 
22 
23 
24 // <h1>Reduced Basis: Example 5 - Reduced Basis Cantilever</h1>
25 // 3D cantilever beam using the Reduced Basis Method
26 // \author David Knezevic
27 // \author Kyunghoon "K" Lee
28 // \date 2012
29 //
30 // We consider four parameters in this problem:
31 // x_scaling: scales the length of the cantilever
32 // load_Fx: the traction in the x-direction on the right boundary of the cantilever
33 // load_Fy: the traction in the y-direction on the right boundary of the cantilever
34 // load_Fz: the traction in the z-direction on the right boundary of the cantilever
35 
36 // C++ include files that we need
37 #include <iostream>
38 #include <algorithm>
39 #include <cstdlib> // *must* precede <cmath> for proper std:abs() on PGI, Sun Studio CC
40 #include <cmath>
41 #include <set>
42 
43 // Basic include file needed for the mesh functionality.
44 #include "libmesh/libmesh.h"
45 #include "libmesh/mesh.h"
46 #include "libmesh/mesh_generation.h"
47 #include "libmesh/exodusII_io.h"
48 #include "libmesh/equation_systems.h"
49 #include "libmesh/dof_map.h"
50 #include "libmesh/getpot.h"
51 #include "libmesh/elem.h"
52 #include "libmesh/quadrature_gauss.h"
53 #include "libmesh/libmesh_logging.h"
54 #include "libmesh/rb_data_serialization.h"
55 #include "libmesh/rb_data_deserialization.h"
56 #include "libmesh/enum_solver_package.h"
57 #include "libmesh/enum_solver_type.h"
58 
59 // local includes
60 #include "rb_classes.h"
61 #include "assembly.h"
62 
63 // boundary IDs
64 #define BOUNDARY_ID_MIN_Z 0
65 #define BOUNDARY_ID_MIN_Y 1
66 #define BOUNDARY_ID_MAX_X 2
67 #define BOUNDARY_ID_MAX_Y 3
68 #define BOUNDARY_ID_MIN_X 4
69 #define BOUNDARY_ID_MAX_Z 5
70 #define NODE_BOUNDARY_ID 10
71 
72 // Bring in everything from the libMesh namespace
73 using namespace libMesh;
74 
75 // Define a function to scale the mesh according to the parameter.
77  const RBParameters & mu,
78  const std::string & filename);
79 
80 // Post-process the solution to compute stresses
82 
83 // The main program.
84 int main(int argc, char ** argv)
85 {
86  // Initialize libMesh.
87  LibMeshInit init (argc, argv);
88 
89  // This example requires a linear solver package.
90  libmesh_example_requires(libMesh::default_solver_package() != INVALID_SOLVER_PACKAGE,
91  "--enable-petsc, --enable-trilinos, or --enable-eigen");
92 
93 #if !defined(LIBMESH_HAVE_XDR)
94  // We need XDR support to write out reduced bases
95  libmesh_example_requires(false, "--enable-xdr");
96 #elif defined(LIBMESH_DEFAULT_SINGLE_PRECISION)
97  // XDR binary support requires double precision
98  libmesh_example_requires(false, "--disable-singleprecision");
99 #elif defined(LIBMESH_DEFAULT_TRIPLE_PRECISION)
100  // I have no idea why long double isn't working here... [RHS]
101  libmesh_example_requires(false, "double precision");
102 #endif
103 
104  // Eigen can take forever to solve the offline mode portion of this
105  // example
106  libmesh_example_requires(libMesh::default_solver_package() != EIGEN_SOLVERS, "--enable-petsc or --enable-laspack");
107 
108  // Trilinos reports "true residual is too large" in the offline mode
109  // portion of this example
110  libmesh_example_requires(libMesh::default_solver_package() != TRILINOS_SOLVERS, "--enable-petsc or --enable-laspack");
111 
112  // This example only works if libMesh was compiled for 3D
113  const unsigned int dim = 3;
114  libmesh_example_requires(dim == LIBMESH_DIM, "3D support");
115 
116 #ifndef LIBMESH_ENABLE_DIRICHLET
117  libmesh_example_requires(false, "--enable-dirichlet");
118 #else
119 
120  std::string parameters_filename = "reduced_basis_ex5.in";
121  GetPot infile(parameters_filename);
122 
123  unsigned int n_elem_x = infile("n_elem_x", 0);
124  unsigned int n_elem_y = infile("n_elem_y", 0);
125  unsigned int n_elem_z = infile("n_elem_z", 0);
126  Real x_size = infile("x_size", 0.);
127  Real y_size = infile("y_size", 0.);
128  Real z_size = infile("z_size", 0.);
129 
130  bool store_basis_functions = infile("store_basis_functions", true);
131 
132  // Read the "online_mode" flag from the command line
133  GetPot command_line(argc, argv);
134  int online_mode = 0;
135  if (command_line.search(1, "-online_mode"))
136  online_mode = command_line.next(online_mode);
137 
138 
139  Mesh mesh (init.comm(), dim);
141  n_elem_x,
142  n_elem_y,
143  n_elem_z,
144  0., x_size,
145  0., y_size,
146  0., z_size,
147  HEX8);
148 
149  // Let's add a node boundary condition so that we can impose a point
150  // load.
151  // Each processor should know about each boundary condition it can
152  // see, so we loop over all elements, not just local elements.
153  for (const auto & elem : mesh.element_ptr_range())
154  {
155  unsigned int side_max_x = 0, side_max_y = 0, side_max_z = 0;
156  bool found_side_max_x = false, found_side_max_y = false, found_side_max_z = false;
157  for (auto side : elem->side_index_range())
158  {
159  if (mesh.get_boundary_info().has_boundary_id(elem, side, BOUNDARY_ID_MAX_X))
160  {
161  side_max_x = side;
162  found_side_max_x = true;
163  }
164 
165  if (mesh.get_boundary_info().has_boundary_id(elem, side, BOUNDARY_ID_MAX_Y))
166  {
167  side_max_y = side;
168  found_side_max_y = true;
169  }
170 
171  if (mesh.get_boundary_info().has_boundary_id(elem, side, BOUNDARY_ID_MAX_Z))
172  {
173  side_max_z = side;
174  found_side_max_z = true;
175  }
176  }
177 
178  // If elem has sides on boundaries
179  // BOUNDARY_ID_MAX_X, BOUNDARY_ID_MAX_Y, BOUNDARY_ID_MAX_Z
180  // then let's set a node boundary condition
181  if (found_side_max_x && found_side_max_y && found_side_max_z)
182  {
183  for (auto n : elem->node_index_range())
184  {
185  if (elem->is_node_on_side(n, side_max_x) &&
186  elem->is_node_on_side(n, side_max_y) &&
187  elem->is_node_on_side(n, side_max_z))
188  {
189  mesh.get_boundary_info().add_node(elem->node_ptr(n), NODE_BOUNDARY_ID);
190  }
191  }
192  }
193  }
194 
195  mesh.print_info();
196 
197  // Create an equation systems object.
198  EquationSystems equation_systems(mesh);
199 
200  // We override RBConstruction with ElasticityRBConstruction in order to
201  // specialize a few functions for this particular problem.
202  ElasticityRBConstruction & rb_con =
203  equation_systems.add_system<ElasticityRBConstruction>("RBElasticity");
204 
205  // Also, initialize an ExplicitSystem to store stresses
206  ExplicitSystem & stress_system =
207  equation_systems.add_system<ExplicitSystem> ("StressSystem");
208  stress_system.add_variable("sigma_00", CONSTANT, MONOMIAL);
209  stress_system.add_variable("sigma_01", CONSTANT, MONOMIAL);
210  stress_system.add_variable("sigma_02", CONSTANT, MONOMIAL);
211  stress_system.add_variable("sigma_10", CONSTANT, MONOMIAL);
212  stress_system.add_variable("sigma_11", CONSTANT, MONOMIAL);
213  stress_system.add_variable("sigma_12", CONSTANT, MONOMIAL);
214  stress_system.add_variable("sigma_20", CONSTANT, MONOMIAL);
215  stress_system.add_variable("sigma_21", CONSTANT, MONOMIAL);
216  stress_system.add_variable("sigma_22", CONSTANT, MONOMIAL);
217  stress_system.add_variable("vonMises", CONSTANT, MONOMIAL);
218 
219  // Initialize the data structures for the equation system.
220  equation_systems.init ();
221  equation_systems.print_info();
222 
223  // Build a new RBEvaluation object which will be used to perform
224  // Reduced Basis calculations. This is required in both the
225  // "Offline" and "Online" stages.
226  ElasticityRBEvaluation rb_eval(mesh.comm());
227 
228  // We need to give the RBConstruction object a pointer to
229  // our RBEvaluation object
230  rb_con.set_rb_evaluation(rb_eval);
231 
232  if (!online_mode) // Perform the Offline stage of the RB method
233  {
234  // Use CG solver. This echoes the Petsc command line options set
235  // in run.sh, but also works for non-PETSc linear solvers.
237 
238  // Read in the data that defines this problem from the specified text file
239  rb_con.process_parameters_file(parameters_filename);
240 
241  // Print out info that describes the current setup of rb_con
242  rb_con.print_info();
243 
244  // Prepare rb_con for the Construction stage of the RB method.
245  // This sets up the necessary data structures and performs
246  // initial assembly of the "truth" affine expansion of the PDE.
248 
249  // Compute the reduced basis space by computing "snapshots", i.e.
250  // "truth" solves, at well-chosen parameter values and employing
251  // these snapshots as basis functions.
252  rb_con.train_reduced_basis();
253 
254  // Write out the data that will subsequently be required for the Evaluation stage
255 #if defined(LIBMESH_HAVE_CAPNPROTO)
257  rb_eval_writer.write_to_file("rb_eval.bin");
258 #else
260 #endif
261 
262  // If requested, write out the RB basis functions for visualization purposes
263  if (store_basis_functions)
264  {
265  // Write out the basis functions
267  }
268  }
269  else // Perform the Online stage of the RB method
270  {
271  // Read in the reduced basis data
272 #if defined(LIBMESH_HAVE_CAPNPROTO)
274  rb_eval_reader.read_from_file("rb_eval.bin", /*read_error_bound_data*/ true);
275 #else
276  rb_eval.legacy_read_offline_data_from_files();
277 #endif
278 
279  // Initialize online parameters
280  Real online_x_scaling = infile("online_x_scaling", 0.);
281  Real online_load_Fx = infile("online_load_Fx", 0.);
282  Real online_load_Fy = infile("online_load_Fy", 0.);
283  Real online_load_Fz = infile("online_load_Fz", 0.);
284  Real online_point_load_Fx = infile("online_point_load_Fx", 0.);
285  Real online_point_load_Fy = infile("online_point_load_Fy", 0.);
286  Real online_point_load_Fz = infile("online_point_load_Fz", 0.);
287  RBParameters online_mu;
288  online_mu.set_value("x_scaling", online_x_scaling);
289  online_mu.set_value("load_Fx", online_load_Fx);
290  online_mu.set_value("load_Fy", online_load_Fy);
291  online_mu.set_value("load_Fz", online_load_Fz);
292  online_mu.set_value("point_load_Fx", online_point_load_Fx);
293  online_mu.set_value("point_load_Fy", online_point_load_Fy);
294  online_mu.set_value("point_load_Fz", online_point_load_Fz);
295  rb_eval.set_parameters(online_mu);
296  rb_eval.print_parameters();
297 
298  // Now do the Online solve using the precomputed reduced basis
299  rb_eval.rb_solve(rb_eval.get_n_basis_functions());
300 
301  if (store_basis_functions)
302  {
303  // Read in the basis functions
304  rb_eval.read_in_basis_functions(rb_con);
305 
306  // Plot the solution
307  rb_con.load_rb_solution();
308 
309  const RBParameters & rb_eval_params = rb_eval.get_parameters();
310  scale_mesh_and_plot(equation_systems, rb_eval_params, "RB_sol.e");
311  }
312  }
313 
314 #endif // LIBMESH_ENABLE_DIRICHLET
315 
316  return 0;
317 }
318 
319 #ifdef LIBMESH_ENABLE_DIRICHLET
320 
322  const RBParameters & mu,
323  const std::string & filename)
324 {
325  // Loop over the mesh nodes and move them!
326  MeshBase & mesh = es.get_mesh();
327 
328  for (auto & node : mesh.node_ptr_range())
329  (*node)(0) *= mu.get_value("x_scaling");
330 
331  // Post-process the solution to compute the stresses
332  compute_stresses(es);
333 
334 #ifdef LIBMESH_HAVE_EXODUS_API
335  ExodusII_IO (mesh).write_equation_systems (filename, es);
336 #endif
337 
338  // Loop over the mesh nodes and move them!
339  for (auto & node : mesh.node_ptr_range())
340  (*node)(0) /= mu.get_value("x_scaling");
341 }
342 
344 {
345  LOG_SCOPE("compute_stresses()", "main");
346 
347  const MeshBase & mesh = es.get_mesh();
348 
349  const unsigned int dim = mesh.mesh_dimension();
350 
351  ElasticityRBConstruction & system = es.get_system<ElasticityRBConstruction>("RBElasticity");
352 
353  unsigned int displacement_vars[3];
354  displacement_vars[0] = system.variable_number ("u");
355  displacement_vars[1] = system.variable_number ("v");
356  displacement_vars[2] = system.variable_number ("w");
357  const unsigned int u_var = system.variable_number ("u");
358 
359  const DofMap & dof_map = system.get_dof_map();
360  FEType fe_type = dof_map.variable_type(u_var);
361  std::unique_ptr<FEBase> fe (FEBase::build(dim, fe_type));
362  QGauss qrule (dim, fe_type.default_quadrature_order());
363  fe->attach_quadrature_rule (&qrule);
364 
365  const std::vector<Real> & JxW = fe->get_JxW();
366  const std::vector<std::vector<RealGradient>> & dphi = fe->get_dphi();
367 
368  // Also, get a reference to the ExplicitSystem
369  ExplicitSystem & stress_system = es.get_system<ExplicitSystem>("StressSystem");
370  const DofMap & stress_dof_map = stress_system.get_dof_map();
371  unsigned int sigma_vars[3][3];
372  sigma_vars[0][0] = stress_system.variable_number ("sigma_00");
373  sigma_vars[0][1] = stress_system.variable_number ("sigma_01");
374  sigma_vars[0][2] = stress_system.variable_number ("sigma_02");
375  sigma_vars[1][0] = stress_system.variable_number ("sigma_10");
376  sigma_vars[1][1] = stress_system.variable_number ("sigma_11");
377  sigma_vars[1][2] = stress_system.variable_number ("sigma_12");
378  sigma_vars[2][0] = stress_system.variable_number ("sigma_20");
379  sigma_vars[2][1] = stress_system.variable_number ("sigma_21");
380  sigma_vars[2][2] = stress_system.variable_number ("sigma_22");
381  unsigned int vonMises_var = stress_system.variable_number ("vonMises");
382 
383  // Storage for the stress dof indices on each element
384  std::vector<std::vector<dof_id_type>> dof_indices_var(system.n_vars());
385  std::vector<dof_id_type> stress_dof_indices_var;
386 
387  // To store the stress tensor on each element
388  DenseMatrix<Number> elem_sigma;
389 
390  for (const auto & elem : mesh.active_local_element_ptr_range())
391  {
392  for (unsigned int var=0; var<3; var++)
393  dof_map.dof_indices (elem, dof_indices_var[var], displacement_vars[var]);
394 
395  fe->reinit (elem);
396 
397  elem_sigma.resize(3, 3);
398 
399  for (unsigned int qp=0; qp<qrule.n_points(); qp++)
400  for (unsigned int C_i=0; C_i<3; C_i++)
401  for (unsigned int C_j=0; C_j<3; C_j++)
402  for (unsigned int C_k=0; C_k<3; C_k++)
403  {
404  const unsigned int n_var_dofs = dof_indices_var[C_k].size();
405 
406  // Get the gradient at this quadrature point
407  Gradient displacement_gradient;
408  for (unsigned int l=0; l<n_var_dofs; l++)
409  displacement_gradient.add_scaled(dphi[l][qp], system.current_solution(dof_indices_var[C_k][l]));
410 
411  for (unsigned int C_l=0; C_l<3; C_l++)
412  elem_sigma(C_i,C_j) += JxW[qp] * (elasticity_tensor(C_i, C_j, C_k, C_l) * displacement_gradient(C_l));
413  }
414 
415  // Get the average stresses by dividing by the element volume
416  elem_sigma.scale(1./elem->volume());
417 
418  // load elem_sigma data into stress_system
419  for (unsigned int i=0; i<3; i++)
420  for (unsigned int j=0; j<3; j++)
421  {
422  stress_dof_map.dof_indices (elem, stress_dof_indices_var, sigma_vars[i][j]);
423 
424  // We are using CONSTANT MONOMIAL basis functions, hence we only need to get
425  // one dof index per variable
426  dof_id_type dof_index = stress_dof_indices_var[0];
427 
428  if ((stress_system.solution->first_local_index() <= dof_index) &&
429  (dof_index < stress_system.solution->last_local_index()))
430  {
431  stress_system.solution->set(dof_index, elem_sigma(i,j));
432  }
433 
434  }
435 
436  // Also, the von Mises stress
437  Number vonMises_value = std::sqrt(0.5*(pow(elem_sigma(0,0) - elem_sigma(1,1),2.) +
438  pow(elem_sigma(1,1) - elem_sigma(2,2),2.) +
439  pow(elem_sigma(2,2) - elem_sigma(0,0),2.) +
440  6.*(pow(elem_sigma(0,1),2.) + pow(elem_sigma(1,2),2.) + pow(elem_sigma(2,0),2.))
441  ));
442  stress_dof_map.dof_indices (elem, stress_dof_indices_var, vonMises_var);
443  dof_id_type dof_index = stress_dof_indices_var[0];
444  if ((stress_system.solution->first_local_index() <= dof_index) &&
445  (dof_index < stress_system.solution->last_local_index()))
446  {
447  stress_system.solution->set(dof_index, vonMises_value);
448  }
449 
450  }
451 
452  // Should call close and update when we set vector entries directly
453  stress_system.solution->close();
454  stress_system.update();
455 }
456 
457 #endif // LIBMESH_ENABLE_DIRICHLET
458 
elasticity_tensor
Real elasticity_tensor(unsigned int i, unsigned int j, unsigned int k, unsigned int l)
Definition: assembly.C:40
libMesh::Number
Real Number
Definition: libmesh_common.h:195
libMesh::dof_id_type
uint8_t dof_id_type
Definition: id_types.h:67
libMesh::System::n_vars
unsigned int n_vars() const
Definition: system.h:2155
libMesh::Mesh
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
Definition: mesh.h:50
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::EquationSystems::get_mesh
const MeshBase & get_mesh() const
Definition: equation_systems.h:637
libMesh::MeshBase::get_boundary_info
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
Definition: mesh_base.h:132
libMesh::QGauss
This class implements specific orders of Gauss quadrature.
Definition: quadrature_gauss.h:39
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::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::RBEvaluation::write_out_basis_functions
virtual void write_out_basis_functions(System &sys, const std::string &directory_name="offline_data", const bool write_binary_basis_functions=true)
Write out all the basis functions to file.
Definition: rb_evaluation.C:880
libMesh::HEX8
Definition: enum_elem_type.h:47
libMesh::BoundaryInfo::add_node
void add_node(const Node *node, const boundary_id_type id)
Add Node node with boundary id id to the boundary information data structures.
Definition: boundary_info.C:636
libMesh::MeshBase::active_local_element_ptr_range
virtual SimpleRange< element_iterator > active_local_element_ptr_range()=0
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::RBConstruction::set_rb_evaluation
void set_rb_evaluation(RBEvaluation &rb_eval_in)
Set the RBEvaluation object.
Definition: rb_construction.C:170
libMesh
The libMesh namespace provides an interface to certain functionality in the library.
Definition: factoryfunction.C:55
libMesh::EquationSystems::get_system
const T_sys & get_system(const std::string &name) const
Definition: equation_systems.h:757
libMesh::MeshTools::Generation::build_cube
void build_cube(UnstructuredMesh &mesh, const unsigned int nx=0, const unsigned int ny=0, const unsigned int nz=0, const Real xmin=0., const Real xmax=1., const Real ymin=0., const Real ymax=1., const Real zmin=0., const Real zmax=1., const ElemType type=INVALID_ELEM, const bool gauss_lobatto_grid=false)
Builds a (elements) cube.
Definition: mesh_generation.C:298
std::sqrt
MetaPhysicL::DualNumber< T, D > sqrt(const MetaPhysicL::DualNumber< T, D > &in)
libMesh::ParallelObject::comm
const Parallel::Communicator & comm() const
Definition: parallel_object.h:94
libMesh::DenseMatrix< Number >
libMesh::RBParameters
This class is part of the rbOOmit framework.
Definition: rb_parameters.h:42
libMesh::RBDataSerialization::RBEvaluationSerialization
This class serializes an RBEvaluation object using the Cap'n Proto library.
Definition: rb_data_serialization.h:58
libMesh::default_solver_package
SolverPackage default_solver_package()
Definition: libmesh.C:993
mesh
MeshBase & mesh
Definition: mesh_communication.C:1257
libMesh::MeshBase::mesh_dimension
unsigned int mesh_dimension() const
Definition: mesh_base.C:135
libMesh::ExodusII_IO
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
Definition: exodusII_io.h:51
dim
unsigned int dim
Definition: adaptivity_ex3.C:113
libMesh::DenseMatrix::resize
void resize(const unsigned int new_m, const unsigned int new_n)
Resize the matrix.
Definition: dense_matrix.h:822
libMesh::VectorValue< Number >
libMesh::System::current_solution
Number current_solution(const dof_id_type global_dof_number) const
Definition: system.C:194
libMesh::TriangleWrapper::init
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
libMesh::MeshBase::element_ptr_range
virtual SimpleRange< element_iterator > element_ptr_range()=0
libMesh::CG
Definition: enum_solver_type.h:34
libMesh::MeshBase
This is the MeshBase class.
Definition: mesh_base.h:78
libMesh::LinearSolver::set_solver_type
void set_solver_type(const SolverType st)
Sets the type of solver to use.
Definition: linear_solver.h:126
libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file
void write_to_file(const std::string &path)
Write the Cap'n'Proto buffer to disk.
Definition: rb_data_serialization.C:82
libMesh::LinearImplicitSystem::get_linear_solver
virtual LinearSolver< Number > * get_linear_solver() const override
Definition: linear_implicit_system.C:353
libMesh::MeshBase::node_ptr_range
virtual SimpleRange< node_iterator > node_ptr_range()=0
libMesh::INVALID_SOLVER_PACKAGE
Definition: enum_solver_package.h:43
libMesh::FEGenericBase::build
static std::unique_ptr< FEGenericBase > build(const unsigned int dim, const FEType &type)
Builds a specific finite element type.
libMesh::System::add_variable
unsigned int add_variable(const std::string &var, const FEType &type, const std::set< subdomain_id_type > *const active_subdomains=nullptr)
Adds the variable var to the list of variables for this system.
Definition: system.C:1069
libMesh::EquationSystems::init
virtual void init()
Initialize all the systems.
Definition: equation_systems.C:96
libMesh::TypeVector::add_scaled
void add_scaled(const TypeVector< T2 > &, const T &)
Add a scaled value to this vector without creating a temporary.
Definition: type_vector.h:665
main
int main(int argc, char **argv)
Definition: reduced_basis_ex5.C:84
libMesh::RBConstruction::get_rb_evaluation
RBEvaluation & get_rb_evaluation()
Get a reference to the RBEvaluation object.
Definition: rb_construction.C:175
libMesh::RBParameters::set_value
void set_value(const std::string &param_name, Real value)
Set the value of the specified parameter.
Definition: rb_parameters.C:47
std::pow
double pow(double a, int b)
Definition: libmesh_augment_std_namespace.h:58
libMesh::CONSTANT
Definition: enum_order.h:41
libMesh::DofMap::variable_type
const FEType & variable_type(const unsigned int c) const
Definition: dof_map.h:1924
libMesh::LibMeshInit
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
Definition: libmesh.h:83
ElasticityRBConstruction
Definition: rb_classes.h:46
libMesh::EquationSystems::print_info
void print_info(std::ostream &os=libMesh::out) const
Prints information about the equation systems, by default to libMesh::out.
Definition: equation_systems.C:1314
libMesh::MONOMIAL
Definition: enum_fe_family.h:39
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::RBEvaluation::legacy_write_offline_data_to_files
virtual void legacy_write_offline_data_to_files(const std::string &directory_name="offline_data", const bool write_binary_data=true)
Write out all the data to text files in order to segregate the Offline stage from the Online stage.
Definition: rb_evaluation.C:416
ElasticityRBEvaluation
Definition: rb_classes.h:19
libMesh::TRILINOS_SOLVERS
Definition: enum_solver_package.h:37
libMesh::ExplicitSystem
Manages consistently variables, degrees of freedom, and coefficient vectors for explicit systems.
Definition: explicit_system.h:48
libMesh::System::solution
std::unique_ptr< NumericVector< Number > > solution
Data structure to hold solution values.
Definition: system.h:1539
libMesh::FEType
class FEType hides (possibly multiple) FEFamily and approximation orders, thereby enabling specialize...
Definition: fe_type.h:178
libMesh::DofMap
This class handles the numbering of degrees of freedom on a mesh.
Definition: dof_map.h:176
compute_stresses
void compute_stresses(EquationSystems &es)
Definition: reduced_basis_ex5.C:343
libMesh::MeshBase::print_info
void print_info(std::ostream &os=libMesh::out) const
Prints relevant information about the mesh.
Definition: mesh_base.C:585
libMesh::RBConstruction::load_rb_solution
virtual void load_rb_solution()
Load the RB solution from the most recent solve with rb_eval into this system's solution vector.
Definition: rb_construction.C:1800
libMesh::RBDataDeserialization::RBEvaluationDeserialization
This class de-serializes an RBEvaluation object using the Cap'n Proto library.
Definition: rb_data_deserialization.h:60
scale_mesh_and_plot
void scale_mesh_and_plot(EquationSystems &es, const RBParameters &mu, const std::string &filename)
Definition: reduced_basis_ex5.C:321
libMesh::System::variable_number
unsigned short int variable_number(const std::string &var) const
Definition: system.C:1232
libMesh::RBDataDeserialization::RBEvaluationDeserialization::read_from_file
void read_from_file(const std::string &path, bool read_error_bound_data)
Write the Cap'n'Proto buffer to disk.
Definition: rb_data_deserialization.C:78
libMesh::System::get_dof_map
const DofMap & get_dof_map() const
Definition: system.h:2099
libMesh::Real
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Definition: libmesh_common.h:121
libMesh::FEType::default_quadrature_order
Order default_quadrature_order() const
Definition: fe_type.h:353
libMesh::BoundaryInfo::has_boundary_id
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
Definition: boundary_info.C:972
libMesh::System::update
virtual void update()
Update the local values to reflect the solution on neighboring processors.
Definition: system.C:408
libMesh::EIGEN_SOLVERS
Definition: enum_solver_package.h:40
libMesh::DenseMatrix::scale
void scale(const T factor)
Multiplies every element in the matrix by factor.
Definition: dense_matrix.h:913
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::RBParameters::get_value
Real get_value(const std::string &param_name) const
Get the value of the specific parameter.
Definition: rb_parameters.C:41