93 "--enable-petsc, --enable-trilinos, or --enable-eigen");
95 #if !defined(LIBMESH_HAVE_XDR) 97 libmesh_example_requires(
false,
"--enable-xdr");
98 #elif defined(LIBMESH_DEFAULT_SINGLE_PRECISION) 100 libmesh_example_requires(
false,
"--disable-singleprecision");
101 #elif defined(LIBMESH_DEFAULT_TRIPLE_PRECISION) 103 libmesh_example_requires(
false,
"double precision");
111 libmesh_example_requires(LIBMESH_DIM == 3,
"3D support");
113 #ifndef LIBMESH_ENABLE_DIRICHLET 114 libmesh_example_requires(
false,
"--enable-dirichlet");
117 std::string parameters_filename =
"reduced_basis_ex5.in";
118 GetPot infile(parameters_filename);
121 infile.parse_command_line(argc, argv);
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.);
130 bool store_basis_functions = infile(
"store_basis_functions",
true);
138 const std::string mesh_filename = infile(
"mesh_filename",
"NO MESH FILE");
140 if (mesh_filename ==
"NO MESH FILE")
142 (
mesh, n_elem_x, n_elem_y, n_elem_z,
143 0., x_size, 0., y_size, 0., z_size,
HEX27);
153 #if !defined(LIBMESH_HAVE_CAPNPROTO) && !defined(LIBMESH_ENABLE_UNIQUE_ID) 154 libmesh_example_requires(
false,
"--enable-unique-id or --enable-capnp");
166 for (
const auto & elem :
mesh.element_ptr_range())
167 for (
auto side : elem->side_index_range())
168 if (!elem->neighbor_ptr(side))
170 const Point side_center = side_builder(*elem, side).vertex_average();
174 if (side_center(2) < 0.1)
176 if (side_center(2) > 11.9)
186 for (
const auto & elem :
mesh.element_ptr_range())
188 unsigned int side_max_x = 0, side_max_y = 0, side_max_z = 0;
189 bool found_side_max_x =
false, found_side_max_y =
false, found_side_max_z =
false;
190 for (
auto side : elem->side_index_range())
195 found_side_max_x =
true;
201 found_side_max_y =
true;
207 found_side_max_z =
true;
214 if (found_side_max_x && found_side_max_y && found_side_max_z)
216 for (
auto n : elem->node_index_range())
218 if (elem->is_node_on_side(n, side_max_x) &&
219 elem->is_node_on_side(n, side_max_y) &&
220 elem->is_node_on_side(n, side_max_z))
240 unsigned int order = infile(
"order", 1);
268 equation_systems.init ();
269 equation_systems.print_info();
303 #if defined(LIBMESH_HAVE_CAPNPROTO) 311 if (store_basis_functions)
320 #if defined(LIBMESH_HAVE_CAPNPROTO) 322 rb_eval_reader.read_from_file(
"rb_eval.bin",
true);
324 rb_eval.legacy_read_offline_data_from_files();
328 Real online_x_scaling = infile(
"online_x_scaling", 0.);
329 Real online_load_Fx = infile(
"online_load_Fx", 0.);
330 Real online_load_Fy = infile(
"online_load_Fy", 0.);
331 Real online_load_Fz = infile(
"online_load_Fz", 0.);
332 Real online_point_load_Fx = infile(
"online_point_load_Fx", 0.);
333 Real online_point_load_Fy = infile(
"online_point_load_Fy", 0.);
334 Real online_point_load_Fz = infile(
"online_point_load_Fz", 0.);
336 online_mu.
set_value(
"x_scaling", online_x_scaling);
337 online_mu.
set_value(
"load_Fx", online_load_Fx);
338 online_mu.
set_value(
"load_Fy", online_load_Fy);
339 online_mu.
set_value(
"load_Fz", online_load_Fz);
340 online_mu.
set_value(
"point_load_Fx", online_point_load_Fx);
341 online_mu.
set_value(
"point_load_Fy", online_point_load_Fy);
342 online_mu.
set_value(
"point_load_Fz", online_point_load_Fz);
343 rb_eval.set_parameters(online_mu);
344 rb_eval.print_parameters();
347 rb_eval.rb_solve(rb_eval.get_n_basis_functions());
349 if (store_basis_functions)
352 rb_eval.read_in_basis_functions(rb_con);
357 const RBParameters & rb_eval_params = rb_eval.get_parameters();
362 #endif // LIBMESH_ENABLE_DIRICHLET 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.
T command_line_next(std::string name, T default_value)
Use GetPot's search()/next() functions to get following arguments from the command line...
This is the EquationSystems class.
virtual void read(const std::string &name, void *mesh_data=nullptr, bool skip_renumber_nodes_and_elements=false, bool skip_find_neighbors=false)=0
Interfaces for reading/writing a mesh to/from a file.
Order
defines an enum for polynomial orders.
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.
bool has_boundary_id(const Node *const node, const boundary_id_type id) const
virtual Real train_reduced_basis(const bool resize_rb_eval_data=true)
Train the reduced basis.
This class serializes an RBEvaluation object using the Cap'n Proto library.
const Parallel::Communicator & comm() const
virtual LinearSolver< Number > * get_linear_solver() const override
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
const BoundaryInfo & get_boundary_info() const
The information about boundary ids on the mesh.
virtual void print_info() const
Print out info that describes the current setup of this RBConstruction.
SolverPackage default_solver_package()
void add_node(const Node *node, const boundary_id_type id)
Add Node node with boundary id id to the boundary information data structures.
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 print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
Prints relevant information about the mesh.
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
unsigned int add_variable(std::string_view 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.
Helper for building element sides that minimizes the construction of new elements.
void set_solver_type(const SolverType st)
Sets the type of solver to use.
This class is part of the rbOOmit framework.
void scale_mesh_and_plot(EquationSystems &es, const RBParameters &mu, const std::string &filename)
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void write_to_file(const std::string &path, bool use_packing=false)
Write the Cap'n'Proto buffer to disk.
void set_value(const std::string ¶m_name, Real value)
Set the value of the specified parameter.
void add_side(const dof_id_type elem, const unsigned short int side, const boundary_id_type id)
Add side side of element number elem with boundary id id to the boundary information data structure...
unsigned int mesh_dimension() const
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...
This class de-serializes an RBEvaluation object using the Cap'n Proto library.
RBEvaluation & get_rb_evaluation()
Get a reference to the RBEvaluation object.
virtual void load_rb_solution()
Load the RB solution from the most recent solve with rb_eval into this system's solution vector...
void set_rb_evaluation(RBEvaluation &rb_eval_in)
Set the RBEvaluation object.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
A Point defines a location in LIBMESH_DIM dimensional Real space.
Manages consistently variables, degrees of freedom, and coefficient vectors for explicit systems...