112{
113
115
116
118 "--enable-petsc, --enable-trilinos, or --enable-eigen");
119
120#if !defined(LIBMESH_HAVE_XDR)
121
122 libmesh_example_requires(false, "--enable-xdr");
123#elif defined(LIBMESH_DEFAULT_SINGLE_PRECISION)
124
125 libmesh_example_requires(false, "--disable-singleprecision");
126#elif defined(LIBMESH_DEFAULT_TRIPLE_PRECISION)
127
128 libmesh_example_requires(false, "double precision");
129#elif defined(LIBMESH_ENABLE_BLOCKED_STORAGE)
130
131
132 libmesh_example_requires(false, "--disable-blocked-storage");
133#endif
134
135
136 libmesh_example_requires(3 == LIBMESH_DIM, "3D support");
137
138
139
140#if !defined(LIBMESH_ENABLE_DIRICHLET) || !defined(LIBMESH_HAVE_CAPNPROTO)
141 libmesh_example_requires(false, "--enable-dirichlet --enable-capnp");
142#else
143
144
145 std::string eim_parameters = "eim.in";
146 std::string rb_parameters = "rb.in";
147 std::string main_parameters = "reduced_basis_ex6.in";
148 GetPot infile(main_parameters);
149
150 unsigned int n_elem_xy = infile("n_elem_xy", 1);
151 unsigned int n_elem_z = infile("n_elem_z", 1);
152
153
154 const int online_mode =
156
157
158
159
160
162
164 n_elem_xy, n_elem_xy, n_elem_z,
165 -0.2, 0.2,
166 -0.2, 0.2,
167 0., 3.,
169
170 if (!online_mode)
171 {
172
173 {
174 libMesh::out <<
"Perform EIM training" << std::endl << std::endl;
175
176
177
179
182
183
184 equation_systems.
init ();
185
186
188 equation_systems.print_info();
189
190
192
193
195
196
199
200
203
205 rb_eim_eval_writer.write_to_file("rb_eim_eval.bin");
206
207
208 eim_rb_eval.write_out_basis_functions("eim_data", false);
209 }
210
211 {
212 libMesh::out << std::endl <<
"Perform RB training" << std::endl << std::endl;
213
214
216
221
222
223 equation_systems.
init ();
224
225
226 equation_systems.print_info();
228
229
231
232
234
235
237 rb_construction.set_rb_evaluation(rb_eval);
238
240 rb_eim_eval_reader.read_from_file("rb_eim_eval.bin");
241 eim_rb_eval.read_in_basis_functions(rb_construction, "eim_data", false);
242
243
244 rb_construction.process_parameters_file(rb_parameters);
245
246
247 eim_rb_eval.initialize_eim_theta_objects();
248 rb_eval.get_rb_theta_expansion().attach_multiple_A_theta(eim_rb_eval.get_eim_theta_objects());
249
250
252 rb_construction.get_rb_assembly_expansion().attach_multiple_A_assembly(eim_construction.
get_eim_assembly_objects());
253
254
255 rb_construction.print_info();
256
257
258
259 rb_construction.initialize_rb_construction();
260 rb_construction.train_reduced_basis();
261
263 rb_eval_writer.write_to_file("rb_eval.bin");
264
265
266 rb_construction.get_rb_evaluation().write_out_basis_functions(rb_construction,
267 "rb_data");
268 }
269 }
270 else
271 {
274
276 rb_eim_eval_reader.read_from_file("rb_eim_eval.bin");
277
278
279 eim_rb_eval.initialize_eim_theta_objects();
280 rb_eval.get_rb_theta_expansion().attach_multiple_A_theta(eim_rb_eval.get_eim_theta_objects());
281
283 rb_eval_reader.read_from_file("rb_eval.bin", true);
284
285
286 Real online_curvature = infile(
"online_curvature", 0.);
287 Real online_Bi = infile(
"online_Bi", 0.);
288 Real online_kappa = infile(
"online_kappa", 0.);
290 online_mu.
set_value(
"curvature", online_curvature);
292 online_mu.
set_value(
"kappa", online_kappa);
293 rb_eval.set_parameters(online_mu);
294 rb_eval.print_parameters();
295 rb_eval.rb_solve(rb_eval.get_n_basis_functions());
296
298
301
302 equation_systems.
init ();
303
305
306
307 rb_eval.read_in_basis_functions(rb_construction, "rb_data");
309
311 }
312
313#endif
314
315 return 0;
316}
This is the EquationSystems class.
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.
const Parallel::Communicator & comm() const
void set_rb_evaluation(RBEvaluation &rb_eval_in)
Set 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.
This class de-serializes a RBEIMEvaluation object using the Cap'n Proto library.
This class de-serializes an RBEvaluation object using the Cap'n Proto library.
This class serializes an RBEIMEvaluation object using the Cap'n Proto library.
This class serializes an RBEvaluation object using the Cap'n Proto library.
void initialize_eim_construction()
Perform initialization of this object to prepare for running train_eim_approximation().
std::vector< std::unique_ptr< ElemAssembly > > & get_eim_assembly_objects()
virtual void initialize_eim_assembly_objects()
Build a vector of ElemAssembly objects that accesses the basis functions stored in this RBEIMConstruc...
void set_rb_eim_evaluation(RBEIMEvaluation &rb_eim_eval_in)
Set the RBEIMEvaluation object.
virtual Real train_eim_approximation()
Generate the EIM approximation for the specified parametrized function using either POD or the Greedy...
virtual void print_info()
Print out info that describes the current setup of this RBConstruction.
virtual void process_parameters_file(const std::string ¶meters_filename)
Read parameters in from file and set up this system accordingly.
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.
The ReplicatedMesh class is derived from the MeshBase class, and is used to store identical copies of...
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
void transform_mesh_and_plot(EquationSystems &es, Real curvature, const std::string &filename)