Go to the source code of this file.
◆ main()
      
        
          | int main  | 
          ( | 
          int  | 
          argc,  | 
        
        
           | 
           | 
          char **  | 
          argv  | 
        
        
           | 
          ) | 
           |  | 
        
      
 
Definition at line 78 of file reduced_basis_ex2.C.
   84 #if !defined(LIBMESH_HAVE_SLEPC) || !defined(LIBMESH_HAVE_GLPK) 
   85   libmesh_example_requires(
false, 
"--enable-slepc --enable-glpk");
 
   88 #if !defined(LIBMESH_HAVE_XDR) 
   90   libmesh_example_requires(
false, 
"--enable-xdr");
 
   91 #elif defined(LIBMESH_DEFAULT_SINGLE_PRECISION) 
   93   libmesh_example_requires(
false, 
"--disable-singleprecision");
 
   99   libmesh_example_requires(
init.comm().size() == 1, 
"mpirun -np 1");
 
  102   libmesh_example_requires(2 <= LIBMESH_DIM, 
"2D support");
 
  104 #ifndef LIBMESH_ENABLE_DIRICHLET 
  105   libmesh_example_requires(
false, 
"--enable-dirichlet");
 
  109   std::string parameters_filename = 
"reduced_basis_ex2.in";
 
  110   GetPot infile(parameters_filename);
 
  112   unsigned int n_elem = infile(
"n_elem", 1);       
 
  113   const unsigned int dim = 2;                      
 
  115   bool store_basis_functions = infile(
"store_basis_functions", 
true); 
 
  118   GetPot command_line (argc, argv);
 
  120   if (command_line.search(1, 
"-online_mode"))
 
  121     online_mode = command_line.next(online_mode);
 
  143   rb_scm_con.add_variable(
"p", 
FIRST);
 
  146   equation_systems.init ();
 
  149   equation_systems.print_info();
 
  153   equation_systems.parameters.set<
unsigned int>(
"eigenpairs")    = 1;
 
  154   equation_systems.parameters.set<
unsigned int>(
"basis vectors") = 3;
 
  155   equation_systems.parameters.set<
unsigned int>
 
  156     (
"linear solver maximum iterations") = 1000;
 
  172   rb_eval.rb_scm_eval = &rb_scm_eval;
 
  176   rb_scm_con.set_rb_scm_evaluation(rb_scm_eval);
 
  182       rb_scm_con.process_parameters_file(parameters_filename);
 
  186       rb_scm_con.print_info();
 
  195       rb_scm_con.perform_SCM_greedy();
 
  203 #if defined(LIBMESH_HAVE_CAPNPROTO) 
  210       rb_scm_con.get_rb_scm_evaluation().legacy_write_offline_data_to_files(
"scm_data");
 
  214       if (store_basis_functions)
 
  224 #if defined(LIBMESH_HAVE_CAPNPROTO) 
  226       rb_eval_reader.read_from_file(
"rb_eval.bin",  
true);
 
  228       rb_scm_eval_reader.read_from_file(
"rb_scm_eval.bin");
 
  230       rb_eval.legacy_read_offline_data_from_files(
"rb_data");
 
  231       rb_scm_eval.legacy_read_offline_data_from_files(
"scm_data");
 
  235       unsigned int online_N = infile(
"online_N", 1);
 
  236       Real online_mu_0 = infile(
"online_mu_0", 0.);
 
  237       Real online_mu_1 = infile(
"online_mu_1", 0.);
 
  238       Real online_mu_2 = infile(
"online_mu_2", 0.);
 
  240       online_mu.
set_value(
"mu_0", online_mu_0);
 
  241       online_mu.
set_value(
"mu_1", online_mu_1);
 
  242       online_mu.
set_value(
"mu_2", online_mu_2);
 
  243       rb_eval.set_parameters(online_mu);
 
  244       rb_eval.print_parameters();
 
  247       rb_eval.rb_solve(online_N);
 
  250       libMesh::out << 
"output 1, value = " << rb_eval.RB_outputs[0]
 
  251                    << 
", bound = " << rb_eval.RB_output_error_bounds[0]
 
  253       libMesh::out << 
"output 2, value = " << rb_eval.RB_outputs[1]
 
  254                    << 
", bound = " << rb_eval.RB_output_error_bounds[1]
 
  256       libMesh::out << 
"output 3, value = " << rb_eval.RB_outputs[2]
 
  257                    << 
", bound = " << rb_eval.RB_output_error_bounds[2]
 
  259       libMesh::out << 
"output 4, value = " << rb_eval.RB_outputs[3]
 
  260                    << 
", bound = " << rb_eval.RB_output_error_bounds[3]
 
  261                    << std::endl << std::endl;
 
  263       if (store_basis_functions)
 
  266           rb_eval.read_in_basis_functions(rb_con, 
"rb_data");
 
  270 #ifdef LIBMESH_HAVE_EXODUS_API 
  277 #ifdef LIBMESH_HAVE_EXODUS_API 
  283 #endif // LIBMESH_ENABLE_DIRICHLET 
  287 #endif // LIBMESH_HAVE_SLEPC && LIBMESH_HAVE_GLPK 
 
References libMesh::EquationSystems::add_system(), libMesh::MeshTools::Generation::build_square(), libMesh::ParallelObject::comm(), libMesh::default_solver_package(), dim, libMesh::FIRST, libMesh::RBConstruction::get_rb_evaluation(), libMesh::TriangleWrapper::init(), libMesh::EquationSystems::init(), libMesh::RBConstruction::initialize_rb_construction(), libMesh::RBEvaluation::legacy_write_offline_data_to_files(), libMesh::RBConstruction::load_basis_function(), libMesh::RBConstruction::load_rb_solution(), mesh, libMesh::MeshTools::n_elem(), libMesh::out, libMesh::EquationSystems::parameters, libMesh::PETSC_SOLVERS, libMesh::RBConstruction::print_info(), libMesh::EquationSystems::print_info(), libMesh::MeshBase::print_info(), libMesh::RBConstruction::process_parameters_file(), libMesh::QUAD4, libMesh::RBDataDeserialization::RBEvaluationDeserialization::read_from_file(), libMesh::RBDataDeserialization::RBSCMEvaluationDeserialization::read_from_file(), libMesh::Real, libMesh::Parameters::set(), libMesh::RBConstruction::set_rb_evaluation(), libMesh::RBSCMConstruction::set_RB_system_name(), libMesh::RBSCMEvaluation::set_rb_theta_expansion(), libMesh::RBParameters::set_value(), libMesh::RBConstruction::train_reduced_basis(), libMesh::MeshOutput< MT >::write_equation_systems(), libMesh::RBEvaluation::write_out_basis_functions(), libMesh::RBDataSerialization::RBEvaluationSerialization::write_to_file(), and libMesh::RBDataSerialization::RBSCMEvaluationSerialization::write_to_file().
 
 
 
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
 
virtual void process_parameters_file(const std::string ¶meters_filename)
Read in from the file specified by parameters_filename and set the this system's member variables acc...
 
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.
 
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.
 
void set_rb_evaluation(RBEvaluation &rb_eval_in)
Set the RBEvaluation object.
 
const Parallel::Communicator & comm() const
 
This class is part of the rbOOmit framework.
 
This class serializes an RBEvaluation object using the Cap'n Proto library.
 
SolverPackage default_solver_package()
 
This class is part of the rbOOmit framework.
 
void set_RB_system_name(const std::string &new_name)
Set the name of the associated RB system — we need this to load the (symmetrized) affine operators.
 
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
 
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
 
void write_to_file(const std::string &path)
Write the Cap'n'Proto buffer to disk.
 
RBEvaluation & get_rb_evaluation()
Get a reference to the RBEvaluation object.
 
void set_value(const std::string ¶m_name, Real value)
Set the value of the specified parameter.
 
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
 
This class de-serializes a RBSCMEvaluation object using the Cap'n Proto library.
 
void write_to_file(const std::string &path)
Write the Cap'n'Proto buffer to disk.
 
This is the EquationSystems class.
 
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 ...
 
virtual void print_info()
Print out info that describes the current setup of this RBConstruction.
 
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.
 
void set_rb_theta_expansion(RBThetaExpansion &rb_theta_expansion_in)
Set the RBThetaExpansion object.
 
virtual void load_basis_function(unsigned int i)
Load the i^th RB function into the RBConstruction solution vector.
 
void print_info(std::ostream &os=libMesh::out) const
Prints relevant information about the mesh.
 
virtual void load_rb_solution()
Load the RB solution from the most recent solve with rb_eval into this system's solution vector.
 
This class de-serializes an RBEvaluation object using the Cap'n Proto library.
 
This class is part of the rbOOmit framework.
 
This class serializes an RBSCMEvaluation object using the Cap'n Proto library.
 
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
 
virtual Real train_reduced_basis(const bool resize_rb_eval_data=true)
Train the reduced basis.