78{
79
81
82
84 "--enable-petsc, --enable-trilinos, or --enable-eigen");
85
86#if !defined(LIBMESH_HAVE_XDR)
87
88 libmesh_example_requires(false, "--enable-xdr");
89#elif defined(LIBMESH_DEFAULT_SINGLE_PRECISION)
90
91 libmesh_example_requires(false, "--disable-singleprecision");
92#endif
93
94
96
97
98 libmesh_example_requires(2 <= LIBMESH_DIM, "2D support");
99
100#ifndef LIBMESH_ENABLE_DIRICHLET
101 libmesh_example_requires(false, "--enable-dirichlet");
102#else
103
104
105 std::string parameters_filename = "reduced_basis_ex1.in";
106 GetPot infile(parameters_filename);
107
108
109 infile.parse_command_line(argc, argv);
110
111 unsigned int n_elem = infile(
"n_elem", 1);
112 const unsigned int dim = 2;
113
114 bool store_basis_functions = infile("store_basis_functions", true);
115
116
118
119
122 n_elem, n_elem,
123 0., 1.,
124 0., 1.,
126
127
129
130
131
134
135
136 equation_systems.
init ();
137
138
139 equation_systems.print_info();
141
142
143
144
146
147
148
150
151 if (!online_mode)
152 {
153
155
156
158
159
160
161
163
164
165
166
168
169
170#if defined(LIBMESH_HAVE_CAPNPROTO)
172 rb_eval_writer.write_to_file("rb_eval.bin");
173#else
175#endif
176
177
178 if (store_basis_functions)
179 {
180
182 }
183
184
185
187 }
188 else
189 {
190
191#if defined(LIBMESH_HAVE_CAPNPROTO)
193 rb_eval_reader.read_from_file("rb_eval.bin", true);
194#else
195 rb_eval.legacy_read_offline_data_from_files();
196#endif
197
198
199 unsigned int online_N = infile("online_N", 1);
200 Real online_x_vel = infile(
"online_x_vel", 0.);
201 Real online_y_vel = infile(
"online_y_vel", 0.);
203 online_mu.
set_value(
"x_vel", online_x_vel);
204 online_mu.
set_value(
"y_vel", online_y_vel);
205 rb_eval.set_parameters(online_mu);
206 rb_eval.print_parameters();
207
208
209 rb_eval.rb_solve(online_N);
210
211
212 libMesh::out <<
"output 1, value = " << rb_eval.RB_outputs[0]
213 << ", bound = " << rb_eval.RB_output_error_bounds[0]
214 << std::endl;
215 libMesh::out <<
"output 2, value = " << rb_eval.RB_outputs[1]
216 << ", bound = " << rb_eval.RB_output_error_bounds[1]
217 << std::endl;
218 libMesh::out <<
"output 3, value = " << rb_eval.RB_outputs[2]
219 << ", bound = " << rb_eval.RB_output_error_bounds[2]
220 << std::endl;
221 libMesh::out <<
"output 4, value = " << rb_eval.RB_outputs[3]
222 << ", bound = " << rb_eval.RB_output_error_bounds[3]
223 << std::endl << std::endl;
224
225 if (store_basis_functions)
226 {
227
228 rb_eval.read_in_basis_functions(rb_con);
229
230
232#ifdef LIBMESH_HAVE_EXODUS_API
234#endif
235
236
237
239#ifdef LIBMESH_HAVE_EXODUS_API
241#endif
242 }
243 }
244
245#endif
246
247 return 0;
248}
This is the EquationSystems class.
The ExodusII_IO class implements reading meshes in the ExodusII file format from Sandia National Labs...
virtual void write_equation_systems(const std::string &fname, const EquationSystems &es, const std::set< std::string > *system_names=nullptr) override
Writes out the solution for no specific time or timestep.
The LibMeshInit class, when constructed, initializes the dependent libraries (e.g.
void print_info(std::ostream &os=libMesh::out, const unsigned int verbosity=0, const bool global=true) const
Prints relevant information about the mesh.
The Mesh class is a thin wrapper, around the ReplicatedMesh class by default.
const Parallel::Communicator & comm() const
void print_basis_function_orthogonality() const
Print out a matrix that shows the orthogonality of the RB basis functions.
void set_rb_evaluation(RBEvaluation &rb_eval_in)
Set the RBEvaluation object.
virtual void print_info() const
Print out info that describes the current setup of this RBConstruction.
RBEvaluation & get_rb_evaluation()
Get a reference to the RBEvaluation object.
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.
virtual Real train_reduced_basis(const bool resize_rb_eval_data=true)
Train the reduced basis.
virtual void load_basis_function(unsigned int i)
Load the i^th RB function into the RBConstruction solution vector.
virtual void load_rb_solution()
Load the RB solution from the most recent solve with rb_eval into this system's solution vector.
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.
This class serializes an RBEvaluation object using the Cap'n Proto library.
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.
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.
This class is part of the rbOOmit framework.
void set_value(const std::string ¶m_name, Real value)
Set the value of the specified parameter.
void init()
Initializes degrees of freedom on the current mesh.
void init(triangulateio &t)
Initializes the fields of t to nullptr/0 as necessary.
SolverPackage default_solver_package()
T command_line_next(std::string name, T default_value)
Use GetPot's search()/next() functions to get following arguments from the command line.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real