https://mooseframework.inl.gov
Moose.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "libmesh/petsc_macro.h"
11 #include "libmesh/libmesh_config.h"
12 
13 #include "Moose.h"
14 #include "MooseApp.h"
15 
16 #include "ActionWarehouse.h"
17 #include "ActionFactory.h"
18 #include "AuxiliarySystem.h"
19 #include "Factory.h"
20 #include "PetscSupport.h"
21 #include "Syntax.h"
22 #include "MooseSyntax.h"
23 #include "ExecFlagRegistry.h"
24 
25 #include "hit/parse.h"
26 
27 #include <unistd.h>
28 
29 const ExecFlagType EXEC_NONE = registerDefaultExecFlag("NONE");
30 const ExecFlagType EXEC_INITIAL = registerDefaultExecFlag("INITIAL");
31 const ExecFlagType EXEC_LINEAR = registerDefaultExecFlag("LINEAR");
32 const ExecFlagType EXEC_LINEAR_CONVERGENCE = registerDefaultExecFlag("LINEAR_CONVERGENCE");
33 const ExecFlagType EXEC_NONLINEAR = registerDefaultExecFlag("NONLINEAR");
34 const ExecFlagType EXEC_NONLINEAR_CONVERGENCE = registerDefaultExecFlag("NONLINEAR_CONVERGENCE");
35 const ExecFlagType EXEC_POSTCHECK = registerDefaultExecFlag("POSTCHECK");
36 const ExecFlagType EXEC_TIMESTEP_END = registerDefaultExecFlag("TIMESTEP_END");
37 const ExecFlagType EXEC_TIMESTEP_BEGIN = registerDefaultExecFlag("TIMESTEP_BEGIN");
39  registerExecFlag("MULTIAPP_FIXED_POINT_ITERATION_END");
41  registerDefaultExecFlag("MULTIAPP_FIXED_POINT_END");
43  registerDefaultExecFlag("MULTIAPP_FIXED_POINT_BEGIN");
45  registerDefaultExecFlag("MULTIAPP_FIXED_POINT_CONVERGENCE");
46 const ExecFlagType EXEC_FINAL = registerDefaultExecFlag("FINAL");
47 const ExecFlagType EXEC_FORCED = registerExecFlag("FORCED");
48 const ExecFlagType EXEC_FAILED = registerExecFlag("FAILED");
49 const ExecFlagType EXEC_CUSTOM = registerDefaultExecFlag("CUSTOM");
50 const ExecFlagType EXEC_SUBDOMAIN = registerExecFlag("SUBDOMAIN");
51 const ExecFlagType EXEC_ALWAYS = registerExecFlag("ALWAYS");
52 const ExecFlagType EXEC_PRE_DISPLACE = registerExecFlag("PRE_DISPLACE");
53 const ExecFlagType EXEC_SAME_AS_MULTIAPP = registerExecFlag("SAME_AS_MULTIAPP");
54 const ExecFlagType EXEC_PRE_MULTIAPP_SETUP = registerExecFlag("PRE_MULTIAPP_SETUP");
55 const ExecFlagType EXEC_TRANSFER = registerExecFlag("TRANSFER");
56 const ExecFlagType EXEC_PRE_KERNELS = registerExecFlag("PRE_KERNELS");
57 #ifdef LIBMESH_ENABLE_AMR
58 const ExecFlagType EXEC_POST_ADAPTIVITY = registerExecFlag("POST_ADAPTIVITY");
59 #endif
60 
61 namespace Moose
62 {
63 
64 void associateSyntaxInner(Syntax & syntax, ActionFactory & action_factory);
65 
66 void
68 {
69  registerObjects(f, {"MooseApp"});
70  associateSyntaxInner(s, af);
71  registerActions(s, af, {"MooseApp"});
72  registerAppDataFilePath("moose");
73  registerRepository("moose", "github.com/idaholab/moose");
74 }
75 
76 void
77 registerObjects(Factory & factory, const std::set<std::string> & obj_labels)
78 {
79  Registry::registerObjectsTo(factory, obj_labels);
80 }
81 
82 void
84 {
97  // clang-format off
98  /**************************/
99  /**** Register Actions ****/
100  /**************************/
101  registerMooseObjectTask("create_problem", Problem, false);
102  registerMooseObjectTask("setup_executioner", Executioner, false);
103  registerMooseObjectTask("read_executor", Executor, false);
104  registerTask("add_executor", true);
105 
106  // TODO Organize these somewhere
107  registerTask("init_physics", false);
108  registerTask("init_component_physics", false);
109  registerTask("meta_action_component", false);
110  registerTask("setup_component", false);
111  // 'list_component' is used to retrieve ActionComponents for the syntax JSON
112  registerTask("list_component", false);
113 
114  // This task does not construct an object, but it needs all of the parameters that
115  // would normally be used to construct an object.
116  registerMooseObjectTask("determine_system_type", Executioner, true);
117 
118  registerMooseObjectTask("setup_mesh", MooseMesh, false);
119  registerMooseObjectTask("set_mesh_base", MooseMesh, false);
120  registerMooseObjectTask("init_mesh", MooseMesh, false);
121  registerMooseObjectTask("add_mesh_generator", MeshGenerator, false);
122  registerTask("create_added_mesh_generators", true);
123  registerMooseObjectTask("append_mesh_generator", MeshGenerator, false);
124 
125  registerMooseObjectTask("add_kernel", Kernel, false);
126  appendMooseObjectTask ("add_kernel", EigenKernel);
127  appendMooseObjectTask ("add_kernel", VectorKernel);
128  appendMooseObjectTask ("add_kernel", ArrayKernel);
129  appendMooseObjectTask ("add_kernel", ADArrayKernel);
130 
131  registerMooseObjectTask("add_variable", MooseVariableBase, false);
132  registerMooseObjectTask("add_aux_variable", MooseVariableBase, false);
133  registerMooseObjectTask("add_elemental_field_variable", MooseVariableBase, false);
134 
135  registerMooseObjectTask("add_nodal_kernel", NodalKernel, false);
136 
137  registerMooseObjectTask("add_functor_material", FunctorMaterial, false);
138  registerMooseObjectTask("add_material", MaterialBase, false);
139  appendDeprecatedMooseObjectTask("add_material", FunctorMaterial);
140 
141  registerMooseObjectTask("add_bc", BoundaryCondition, false);
142 
143  registerMooseObjectTask("add_function", Function, false);
144 
145  registerMooseObjectTask("add_distribution", Distribution, false);
146  registerMooseObjectTask("add_sampler", Sampler, false);
147 
148  registerMooseObjectTask("add_aux_kernel", AuxKernel, false);
149  appendMooseObjectTask ("add_aux_kernel", VectorAuxKernel);
150  appendMooseObjectTask ("add_aux_kernel", ArrayAuxKernel);
151 
152  registerMooseObjectTask("add_bound", Bounds, false);
153 
154  registerMooseObjectTask("add_scalar_kernel", ScalarKernel, false);
155  registerMooseObjectTask("add_aux_scalar_kernel", AuxScalarKernel, false);
156  registerMooseObjectTask("add_dirac_kernel", DiracKernel, false);
157  appendMooseObjectTask ("add_dirac_kernel", VectorDiracKernel);
158  registerMooseObjectTask("add_dg_kernel", DGKernel, false);
159  registerMooseObjectTask("add_fv_kernel", FVKernel, false);
160  registerMooseObjectTask("add_linear_fv_kernel", LinearFVKernel, false);
161  registerMooseObjectTask("add_fv_bc", FVBoundaryCondition, false);
162  registerMooseObjectTask("add_linear_fv_bc", LinearFVBoundaryCondition, false);
163  registerMooseObjectTask("add_fv_ik", FVInterfaceKernel, false);
164  registerMooseObjectTask("add_interface_kernel", InterfaceKernel, false);
165  appendMooseObjectTask ("add_interface_kernel", VectorInterfaceKernel);
166  registerMooseObjectTask("add_constraint", Constraint, false);
167  registerMooseObjectTask("add_hybridized_kernel", HDGKernel, false);
168  registerMooseObjectTask("add_hybridized_integrated_bc", HDGIntegratedBC, false);
169 
170  registerMooseObjectTask("add_ic", InitialCondition, false);
171  appendMooseObjectTask ("add_ic", ScalarInitialCondition);
172 
173  registerMooseObjectTask("add_fv_ic", FVInitialCondition, false);
174 
175  registerMooseObjectTask("add_damper", Damper, false);
176  registerMooseObjectTask("setup_predictor", Predictor, false);
177  registerMooseObjectTask("add_time_steppers", TimeStepper, false);
178  registerMooseObjectTask("add_time_stepper", TimeStepper, false);
179  registerTask ("compose_time_stepper", true);
180  registerMooseObjectTask("setup_time_integrators", TimeIntegrator, false);
181  registerMooseObjectTask("setup_time_integrator", TimeIntegrator, false);
182  registerMooseObjectTask("add_convergence", Convergence, false);
183 
184  registerMooseObjectTask("add_preconditioning", MoosePreconditioner, false);
185  registerMooseObjectTask("add_field_split", Split, false);
186 
187  registerMooseObjectTask("add_mesh_division", MeshDivision, false);
188  registerMooseObjectTask("add_user_object", UserObject, false);
189  appendMooseObjectTask ("add_user_object", Postprocessor);
190  appendDeprecatedMooseObjectTask("add_user_object", Corrector);
191  registerMooseObjectTask("add_corrector", Corrector, false);
192  appendDeprecatedMooseObjectTask("add_user_object", MeshModifier);
193  registerMooseObjectTask("add_mesh_modifier", MeshModifier, false);
194 
195  registerMooseObjectTask("add_postprocessor", Postprocessor, false);
196  registerMooseObjectTask("add_vector_postprocessor", VectorPostprocessor, false);
197  registerMooseObjectTask("add_reporter", Reporter, false);
198  registerMooseObjectTask("add_positions", Positions, false);
199  registerMooseObjectTask("add_times", Times, false);
200 
201  registerMooseObjectTask("add_indicator", Indicator, false);
202  registerMooseObjectTask("add_marker", Marker, false);
203 
204  registerMooseObjectTask("add_multi_app", MultiApp, false);
205  registerMooseObjectTask("add_transfer", Transfer, false);
206 
207  registerMooseObjectTask("add_output", Output, false);
208 
209  registerMooseObjectTask("add_control", Control, false);
210  registerMooseObjectTask("add_chain_control", ChainControl, false);
211  registerMooseObjectTask("add_partitioner", MoosePartitioner, false);
212 
213  // clang-format on
214 
215  registerTask("dynamic_object_registration", false);
216  registerTask("common_output", true);
217  registerTask("setup_recover_file_base", true);
218  registerTask("recover_meta_data", true);
219 
220  registerTask("add_bounds_vectors", false);
221  registerTask("add_periodic_bc", false);
222  registerTask("add_aux_variable", false);
223  registerTask("add_external_aux_variables", true);
224  registerTask("add_variable", false);
225  registerTask("add_mortar_variable", false);
226 
227  registerTask("execute_mesh_generators", true);
228  registerTask("uniform_refine_mesh", false);
229  registerTask("prepare_mesh", false);
230  registerTask("delete_remote_elements_after_late_geometric_ghosting", false);
231  registerTask("setup_mesh_complete", true); // calls prepare
232  registerTask("post_mesh_prepared", false);
233  registerTask("add_geometric_rm", false);
234  registerTask("attach_geometric_rm", true);
235  registerTask("attach_geometric_rm_final", true);
236 
237  registerTask("init_displaced_problem", false);
238 
239  registerTask("add_algebraic_rm", false);
240  registerTask("attach_algebraic_rm", true);
241  registerTask("add_coupling_rm", false);
242  registerTask("attach_coupling_rm", true);
243  registerTask("init_problem", true);
244  registerTask("check_copy_nodal_vars", true);
245  registerTask("copy_nodal_vars", true);
246  registerTask("copy_nodal_aux_vars", true);
247  registerTask("copy_vars_physics", false);
248  registerTask("setup_postprocessor_data", false);
249  registerTask("setup_time_steppers", true);
250 
251  registerTask("setup_dampers", true);
252  registerTask("check_integrity", true);
253  registerTask("resolve_optional_materials", true);
254  registerTask("check_integrity_early", true);
255  registerTask("check_integrity_early_physics", false);
256  registerTask("setup_quadrature", true);
257  registerTask("create_tagged_matrices", true);
258 
259  registerTask("mesh_modifiers", false);
260 
262  registerTask("no_action", false); // Used for Empty Action placeholders
263  registerTask("set_global_params", false);
264  registerTask("setup_adaptivity", false);
265  registerTask("meta_action", false);
266  registerTask("setup_residual_debug", false);
267  registerTask("setup_oversampling", false);
268  registerTask("deprecated_block", false);
269  registerTask("set_adaptivity_options", false);
270  registerTask("add_mortar_interface", false);
271  registerTask("coupling_functor_check", true);
272  registerTask("add_master_action_material", false);
273  registerTask("setup_projected_properties", false);
274  registerTask("create_application_block", false);
275 
276  // Dummy Actions (useful for sync points in the dependencies)
277  registerTask("setup_function_complete", false);
278  registerTask("setup_variable_complete", false);
279  registerTask("setup_executioner_complete", false);
280  registerTask("ready_to_init", true);
281 
282  // Output related actions
283  registerTask("add_output_aux_variables", true);
284  registerTask("check_output", true);
285  registerTask("declare_late_reporters", true);
286 
287  registerTask("create_problem_default", true);
288  registerTask("create_problem_custom", false);
289  registerTask("create_problem_complete", false);
290 
291  registerTask("add_default_nonlinear_convergence", true);
292  registerTask("add_default_multiapp_fixed_point_convergence", true);
293  registerTask("add_default_steady_state_convergence", true);
294 
295  registerTask("chain_control_setup", true);
296  registerTask("start_webservercontrol", true);
297 
298  // Action for setting up the signal-based checkpoint
299  registerTask("auto_checkpoint_action", true);
300  /**************************/
301  /****** Dependencies ******/
302  /**************************/
313  // clang-format off
314  syntax.addDependencySets("(meta_action)"
315  "(meta_action_component)"
316  "(dynamic_object_registration)"
317  "(common_output)"
318  "(set_global_params)"
319  "(setup_recover_file_base)"
320  "(check_copy_nodal_vars)"
321  "(setup_mesh)"
322  "(add_geometric_rm)"
323  "(add_partitioner)"
324  "(add_mesh_generator)"
325  "(create_added_mesh_generators)"
326  "(append_mesh_generator)"
327  "(execute_mesh_generators)"
328  "(recover_meta_data)"
329  "(set_mesh_base)"
330  "(attach_geometric_rm)"
331  "(init_mesh)"
332  "(prepare_mesh)"
333  "(add_mortar_interface)"
334  "(uniform_refine_mesh)"
335  "(setup_mesh_complete)"
336  "(post_mesh_prepared)"
337  "(determine_system_type)"
338  "(create_problem)"
339  "(create_problem_custom)"
340  "(create_problem_default)"
341  "(create_problem_complete)"
342  "(init_displaced_problem)" // Problem must be init-ed before we start adding functors
343  "(add_function)" // Functions can depend on scalar variables & PPs, but this dependence can be
344  // added on initialSetup() rather than construction
345  "(init_component_physics)" // components must add their blocks to physics before init_physics
346  "(init_physics)"
347  "(setup_postprocessor_data)"
348  "(setup_time_integrator, setup_time_integrators)"
349  "(setup_executioner)"
350  "(setup_executioner_complete)"
351  "(setup_component)" // no particular reason for that placement
352  "(read_executor)"
353  "(add_executor)"
354  "(check_integrity_early)"
355  "(setup_predictor)"
356  "(add_aux_variable, add_variable, add_elemental_field_variable,"
357  " add_external_aux_variables)"
358  "(add_mortar_variable)"
359  "(setup_variable_complete)"
360  "(check_integrity_early_physics)" // checks that systems and variables are consistent
361  "(setup_quadrature)"
362  "(add_convergence)"
363  "(add_default_nonlinear_convergence,"
364  " add_default_multiapp_fixed_point_convergence,"
365  " add_default_steady_state_convergence)"
366  "(add_positions)"
367  "(add_periodic_bc)"
368  "(add_user_object, add_corrector, add_mesh_modifier)"
369  "(add_field_split)" // split objects required before field split preconditioner itself
370  "(add_preconditioning)" // preconditioner may introduce objects such as static condensation which influence the underlying types of tagged matrices
371  "(create_tagged_matrices)"
372  "(add_distribution)"
373  "(add_sampler)"
374  "(setup_function_complete)"
375  "(setup_adaptivity)"
376  "(set_adaptivity_options)"
377  "(add_ic, add_fv_ic)"
378  "(add_constraint)"
379  "(add_times)"
380  "(add_time_stepper, add_time_steppers)"
381  "(compose_time_stepper)"
382  "(setup_time_steppers)"
383  "(ready_to_init)"
384  "(setup_dampers)"
385  "(setup_residual_debug)"
386  "(add_bounds_vectors)"
387  "(add_mesh_division)" // NearestPositionsDivision uses a Positions
388  "(add_multi_app)"
389  "(add_transfer)"
390  "(copy_nodal_vars, copy_nodal_aux_vars, copy_vars_physics)"
391  "(add_material)"
392  "(add_master_action_material)"
393  "(add_functor_material)"
394  "(setup_projected_properties)"
395  "(add_output_aux_variables)"
396  "(add_output)"
397  "(auto_checkpoint_action)"
398  "(add_postprocessor)"
399  "(add_vector_postprocessor)" // MaterialVectorPostprocessor requires this
400  // to be after material objects are created.
401  "(add_reporter)"
402  "(declare_late_reporters)"
403  "(add_aux_kernel, add_bc, add_damper, add_dirac_kernel, add_kernel,"
404  " add_nodal_kernel, add_dg_kernel, add_fv_kernel, add_linear_fv_kernel,"
405  " add_fv_bc, add_linear_fv_bc, add_fv_ik, add_interface_kernel,"
406  " add_scalar_kernel, add_aux_scalar_kernel, add_indicator, add_marker,"
407  " add_bound, add_hybridized_kernel, add_hybridized_integrated_bc)"
408  "(resolve_optional_materials)"
409  "(add_algebraic_rm)"
410  "(add_coupling_rm)"
411  "(attach_geometric_rm_final)"
412  "(attach_algebraic_rm)"
413  "(attach_coupling_rm)"
414  "(coupling_functor_check)"
415  "(delete_remote_elements_after_late_geometric_ghosting)"
416  "(init_problem)"
417  "(add_control, add_chain_control)"
418  "(chain_control_setup)"
419  "(start_webservercontrol)"
420  "(check_output)"
421  "(check_integrity)"
422  "(create_application_block)");
423  // clang-format on
424 
425 #ifdef MOOSE_MFEM_ENABLED
426  registerTask("add_mfem_problem_operator", true);
427  addTaskDependency("add_mfem_problem_operator", "init_mesh");
428  addTaskDependency("add_variable", "add_mfem_problem_operator");
429  addTaskDependency("add_aux_variable", "add_mfem_problem_operator");
430  addTaskDependency("add_elemental_field_variable", "add_mfem_problem_operator");
431  addTaskDependency("add_bc", "add_mfem_problem_operator");
432  addTaskDependency("add_kernel", "add_mfem_problem_operator");
433 
434  // add SubMeshes
435  registerMooseObjectTask("add_mfem_submeshes", MFEMSubMesh, false);
436  addTaskDependency("add_mfem_submeshes", "create_problem_complete");
437 
438  // add SubMesh transfers
439  appendMooseObjectTask("add_transfer", MFEMSubMeshTransfer);
440 
441  // add FESpaces
442  registerMooseObjectTask("add_mfem_fespaces", MFEMFESpace, false);
443  appendMooseObjectTask("add_mfem_fespaces", MFEMFECollection);
444  addTaskDependency("add_mfem_fespaces", "add_mfem_submeshes");
445  addTaskDependency("add_variable", "add_mfem_fespaces");
446  addTaskDependency("add_aux_variable", "add_mfem_fespaces");
447  addTaskDependency("add_elemental_field_variable", "add_mfem_fespaces");
448  addTaskDependency("add_kernel", "add_mfem_fespaces");
449 
450  // set mesh FE space
451  registerTask("set_mesh_fe_space", true);
452  addTaskDependency("set_mesh_fe_space", "add_variable");
453  addTaskDependency("set_mesh_fe_space", "init_mesh");
454 
455  // add preconditioning.
456  registerMooseObjectTask("add_mfem_preconditioner", MFEMSolverBase, false);
457  addTaskDependency("add_mfem_preconditioner", "add_mfem_problem_operator");
458  addTaskDependency("add_mfem_preconditioner", "add_variable");
459 
460  // add solver.
461  registerMooseObjectTask("add_mfem_solver", MFEMSolverBase, true);
462  addTaskDependency("add_mfem_solver", "add_mfem_preconditioner");
463  addTaskDependency("add_mfem_solver", "add_mfem_problem_operator");
464 #endif
465 
466  registerTask("parse_neml2", /*required=*/false);
467  addTaskDependency("add_material", "parse_neml2");
468  addTaskDependency("add_user_object", "parse_neml2");
469 }
470 
499 void
500 registerActions(Syntax & syntax, ActionFactory & action_factory)
501 {
502  mooseDeprecated("use registerAll instead of registerActions");
503  registerActions(syntax, action_factory, {"MooseApp"});
504 }
505 
506 void
508  ActionFactory & action_factory,
509  const std::set<std::string> & obj_labels)
510 {
511  Registry::registerActionsTo(action_factory, obj_labels);
512 
513  // Add these actions here so they are always executed last, without setting any dependency
514  registerTask("dump_objects", false);
515  registerTask("finish_input_file_output", false);
516 }
517 
518 void
519 associateSyntaxInner(Syntax & syntax, ActionFactory & /*action_factory*/)
520 {
526  registerSyntax("DiffusionCG", "Physics/Diffusion/ContinuousGalerkin/*");
527  registerSyntax("DiffusionFV", "Physics/Diffusion/FiniteVolume/*");
528 
529  registerSyntax("AddActionComponentAction", "ActionComponents/*");
530  registerSyntax("CombineComponentsMeshes", "ActionComponents");
531 
532  registerSyntaxTask("CopyNodalVarsAction", "Variables/*", "check_copy_nodal_vars");
533  registerSyntaxTask("CopyNodalVarsAction", "Variables/*", "copy_nodal_vars");
534  registerSyntaxTask("CopyNodalVarsAction", "AuxVariables/*", "check_copy_nodal_vars");
535  registerSyntaxTask("CopyNodalVarsAction", "AuxVariables/*", "copy_nodal_aux_vars");
536 
537  registerSyntaxTask("AddKernelAction", "Kernels/*", "add_kernel");
538  registerSyntaxTask("AddNodalKernelAction", "NodalKernels/*", "add_nodal_kernel");
539  registerSyntaxTask("AddKernelAction", "AuxKernels/*", "add_aux_kernel");
540 
541  registerSyntaxTask("AddHDGKernelAction", "HDGKernels/*", "add_hybridized_kernel");
542 
543  registerSyntax("AddAuxKernelAction", "AuxVariables/*/AuxKernel");
544 
545  registerSyntaxTask("AddScalarKernelAction", "ScalarKernels/*", "add_scalar_kernel");
546  registerSyntaxTask("AddScalarKernelAction", "AuxScalarKernels/*", "add_aux_scalar_kernel");
547 
548  registerSyntaxTask("AddBCAction", "BCs/*", "add_bc");
549 
550  registerSyntax("CreateProblemAction", "Problem");
551  registerSyntax("DynamicObjectRegistrationAction", "Problem");
552 
553  registerSyntax("SetupMeshAction", "Mesh");
554  registerSyntax("SetupMeshCompleteAction", "Mesh");
555  // Components should be able create a Mesh without a Mesh block
556  registerSyntax("CreateMeshSetupActionsForComponents", "ActionComponents");
557  registerSyntax("CreateDisplacedProblemAction", "Mesh");
558  registerSyntax("DisplayGhostingAction", "Mesh");
559  registerSyntax("AddMeshGeneratorAction", "Mesh/*");
560  registerSyntaxTask("EmptyAction", "Mesh/BatchMeshGeneratorAction", "no_action");
561  registerSyntax("BatchMeshGeneratorAction", "Mesh/BatchMeshGeneratorAction/*");
562  registerSyntax("ElementIDOutputAction", "Mesh");
563  syntax.registerSyntaxType("Mesh/*", "MeshGeneratorName");
564 
565  registerSyntax("AddFunctionAction", "Functions/*");
566  syntax.registerSyntaxType("Functions/*", "FunctionName");
567 
568  registerSyntax("AddMeshDivisionAction", "MeshDivisions/*");
569  syntax.registerSyntaxType("MeshDivisions/*", "MeshDivisionName");
570  registerSyntax("AddConvergenceAction", "Convergence/*");
571  syntax.registerSyntaxType("Convergence/*", "ConvergenceName");
572 
573  registerSyntax("GlobalParamsAction", "GlobalParams");
574 
575  registerSyntax("AddDistributionAction", "Distributions/*");
576  syntax.registerSyntaxType("Distributions/*", "DistributionName");
577 
578  registerSyntax("AddSamplerAction", "Samplers/*");
579  syntax.registerSyntaxType("Samplers/*", "SamplerName");
580 
581  registerSyntax("SetupDebugAction", "Debug");
582  registerSyntax("SetupResidualDebugAction", "Debug");
583 
585  registerSyntax("AddVariableAction", "Variables/*");
586  syntax.registerSyntaxType("Variables/*", "VariableName");
587  syntax.registerSyntaxType("Variables/*", "NonlinearVariableName");
588 
589  registerSyntax("AddICAction", "Variables/*/InitialCondition");
590  registerSyntax("AddFVICAction", "Variables/*/FVInitialCondition");
591 
592  registerSyntax("AddAuxVariableAction", "AuxVariables/*");
593  syntax.registerSyntaxType("AuxVariables/*", "VariableName");
594  syntax.registerSyntaxType("AuxVariables/*", "AuxVariableName");
595 
596  registerSyntax("AddICAction", "AuxVariables/*/InitialCondition");
597  registerSyntax("AddFVICAction", "AuxVariables/*/FVInitialCondition");
598 
599  registerSyntaxTask("EmptyAction", "BCs/Periodic", "no_action"); // placeholder
600  registerSyntax("AddPeriodicBCAction", "BCs/Periodic/*");
601 
602  registerSyntaxTask("AddInitialConditionAction", "ICs/*", "add_ic");
603  registerSyntaxTask("AddFVInitialConditionAction", "FVICs/*", "add_fv_ic");
604 
605  registerSyntax("AddMaterialAction", "Materials/*");
606  syntax.registerSyntaxType("Materials/*", "MaterialName");
607 
608  registerSyntax("AddFunctorMaterialAction", "FunctorMaterials/*");
609  syntax.registerSyntaxType("FunctorMaterials/*", "MaterialName");
610 
611  registerSyntax("AddPostprocessorAction", "Postprocessors/*");
612  syntax.registerSyntaxType("Postprocessors/*", "PostprocessorName");
613  syntax.registerSyntaxType("Postprocessors/*", "UserObjectName");
614 
615  registerSyntax("AddVectorPostprocessorAction", "VectorPostprocessors/*");
616  syntax.registerSyntaxType("VectorPostprocessors/*", "VectorPostprocessorName");
617 
618  registerSyntax("AddReporterAction", "Reporters/*");
619  syntax.registerSyntaxType("Reporters/*", "ReporterName");
620 
621  registerSyntax("AddPositionsAction", "Positions/*");
622  syntax.registerSyntaxType("Positions/*", "PositionsName");
623 
624  registerSyntax("AddTimesAction", "Times/*");
625  syntax.registerSyntaxType("Times/*", "TimesName");
626 
627  registerSyntax("AddDamperAction", "Dampers/*");
628 
629  registerSyntax("AddOutputAction", "Outputs/*");
630  registerSyntax("CommonOutputAction", "Outputs");
631  registerSyntax("MaterialOutputAction", "Outputs");
632  registerSyntax("AutoCheckpointAction", "Outputs");
633  syntax.registerSyntaxType("Outputs/*", "OutputName");
634 
635  // Note: Preconditioner Actions will be built by this setup action
636  registerSyntax("SetupPreconditionerAction", "Preconditioning/*");
637  registerSyntax("AddFieldSplitAction", "Preconditioning/*/*");
638 
639  registerSyntax("CreateExecutionerAction", "Executioner");
640  registerSyntax("ReadExecutorParamsAction", "Executors/*");
641 
642  registerSyntaxTask("AddTimeStepperAction", "Executioner/TimeSteppers/*", "add_time_steppers");
643  registerSyntaxTask("AddTimeStepperAction", "Executioner/TimeStepper", "add_time_stepper");
644  registerSyntaxTask(
645  "ComposeTimeStepperAction", "Executioner/TimeSteppers", "compose_time_stepper");
646  registerSyntaxTask(
647  "SetupTimeIntegratorAction", "Executioner/TimeIntegrators/*", "setup_time_integrators");
648  registerSyntaxTask(
649  "SetupTimeIntegratorAction", "Executioner/TimeIntegrator", "setup_time_integrator");
650  syntax.registerSyntaxType("Executors/*", "ExecutorName");
651 
652  registerSyntax("SetupQuadratureAction", "Executioner/Quadrature");
653  registerSyntax("SetupPredictorAction", "Executioner/Predictor");
654 #ifdef LIBMESH_ENABLE_AMR
655  registerSyntax("AdaptivityAction", "Executioner/Adaptivity");
656 #endif
657 
658  registerSyntax("PartitionerAction", "Mesh/Partitioner");
659 
660  registerSyntax("AddDiracKernelAction", "DiracKernels/*");
661 
662  registerSyntax("AddDGKernelAction", "DGKernels/*");
663  registerSyntax("AddFVKernelAction", "FVKernels/*");
664  registerSyntax("AddFVBCAction", "FVBCs/*");
665  registerSyntax("AddLinearFVBCAction", "LinearFVBCs/*");
666  registerSyntax("AddFVInterfaceKernelAction", "FVInterfaceKernels/*");
667  registerSyntax("CheckFVBCAction", "FVBCs");
668 
669  registerSyntax("AddLinearFVKernelAction", "LinearFVKernels/*");
670 
671  registerSyntax("AddInterfaceKernelAction", "InterfaceKernels/*");
672 
673  registerSyntax("AddConstraintAction", "Constraints/*");
674 
675  registerSyntax("AddControlAction", "Controls/*");
676  registerSyntax("AddChainControlAction", "ChainControls/*");
677  registerSyntax("AddBoundAction", "Bounds/*");
678  registerSyntax("AddBoundsVectorsAction", "Bounds");
679 
680  // UserObject and some derived classes
681  registerSyntax("AddUserObjectAction", "UserObjects/*");
682  syntax.registerSyntaxType("UserObjects/*", "UserObjectName");
683  registerSyntax("AddCorrectorAction", "Correctors/*");
684  syntax.registerSyntaxType("Correctors/*", "UserObjectName");
685  registerSyntax("AddMeshModifiersAction", "MeshModifiers/*");
686  syntax.registerSyntaxType("MeshModifiers/*", "UserObjectName");
687 
688  registerSyntax("AddNodalNormalsAction", "NodalNormals");
689 
690  // Indicator
691  registerSyntax("AddElementalFieldAction", "Adaptivity/Indicators/*");
692  registerSyntax("AddIndicatorAction", "Adaptivity/Indicators/*");
693  syntax.registerSyntaxType("Adaptivity/Indicators/*", "IndicatorName");
694 
695  // Marker
696  registerSyntax("AddElementalFieldAction", "Adaptivity/Markers/*");
697  registerSyntax("AddMarkerAction", "Adaptivity/Markers/*");
698  syntax.registerSyntaxType("Adaptivity/Markers/*", "MarkerName");
699 
700  // New Adaptivity System
701  registerSyntax("SetAdaptivityOptionsAction", "Adaptivity");
702 
703  // Deprecated Block
704  registerSyntax("DeprecatedBlockAction", "DeprecatedBlock");
705 
706  // Multi Apps
707  registerSyntax("AddMultiAppAction", "MultiApps/*");
708  syntax.registerSyntaxType("MultiApps/*", "MultiAppName");
709 
710  // Transfers
711  registerSyntax("AddTransferAction", "Transfers/*");
712 
713  // Material derivative test
714  registerSyntaxTask("EmptyAction", "Debug/MaterialDerivativeTest", "no_action"); // placeholder
715  registerSyntax("MaterialDerivativeTestAction", "Debug/MaterialDerivativeTest/*");
716 
717  registerSyntax("ProjectedStatefulMaterialStorageAction", "ProjectedStatefulMaterialStorage/*");
718 
719  // Application Block System
720  registerSyntax("CreateApplicationBlockAction", "Application");
721 
722 #ifdef MOOSE_MFEM_ENABLED
723  registerSyntaxTask("AddMFEMSubMeshAction", "SubMeshes/*", "add_mfem_submeshes");
724  registerSyntaxTask("AddMFEMFESpaceAction", "FESpaces/*", "add_mfem_fespaces");
725  registerSyntaxTask("AddMFEMPreconditionerAction", "Preconditioner/*", "add_mfem_preconditioner");
726  registerSyntaxTask("AddMFEMSolverAction", "Solver", "add_mfem_solver");
727 #endif
728 
729  registerSyntax("NEML2ActionCommon", "NEML2");
730  registerSyntax("NEML2Action", "NEML2/*");
731 
732  addActionTypes(syntax);
733 }
734 
735 void
736 associateSyntax(Syntax & syntax, ActionFactory & action_factory)
737 {
738  associateSyntaxInner(syntax, action_factory);
739  registerActions(syntax, action_factory);
740 }
741 
742 void
744 {
745  // May be a touch expensive to create a new DM every time, but probably safer to do it this way
747 }
748 
749 MPI_Comm
750 swapLibMeshComm(MPI_Comm new_comm)
751 {
752  MPI_Comm old_comm = PETSC_COMM_WORLD;
753  PETSC_COMM_WORLD = new_comm;
754  return old_comm;
755 }
756 
757 static bool _color_console = isatty(fileno(stdout));
758 
759 bool
761 {
762  return _color_console;
763 }
764 
765 bool
766 setColorConsole(bool use_color, bool force)
767 {
768  _color_console = (isatty(fileno(stdout)) || force) && use_color;
769  return _color_console;
770 }
771 
772 ScopedThrowOnError::ScopedThrowOnError(const bool throw_on_error)
773  : _throw_on_error_before(Moose::_throw_on_error)
774 {
775  mooseAssert(!libMesh::Threads::in_threads, "Cannot be used in threads");
776  Moose::_throw_on_error = throw_on_error;
777 }
778 
780 
782 
783 std::string
784 hitMessagePrefix(const hit::Node & node)
785 {
786  // Strip meaningless line and column number for CLI args
787  if (node.filename() == "CLI_ARGS")
788  return "CLI_ARGS:\n";
789  // If using the root node, don't add line info
790  if (node.isRoot())
791  return node.filename() + ":\n";
792  return node.fileLocation() + ":\n";
793 }
794 
795 bool _warnings_are_errors = false;
796 bool _deprecated_is_error = false;
797 bool _throw_on_error = false;
798 bool _throw_on_warning = false;
800 bool show_trace = true;
801 bool show_multiple = false;
802 
803 } // namespace Moose
const ExecFlagType EXEC_LINEAR_CONVERGENCE
Definition: Moose.C:32
bool show_trace
Set to true (the default) to print the stack trace with error and warning messages - false to omit it...
Definition: Moose.C:800
Base class for function objects.
Definition: Function.h:29
A kernel for hybridized finite element formulations.
Definition: HDGKernel.h:17
Base class for boundary conditions for linear FV systems.
bool colorConsole()
Returns whether Console coloring is turned on (default: true).
Definition: Moose.C:760
Base class for split-based preconditioners.
Definition: Split.h:25
Base class for finite volume kernels that contribute to a linear systems.
MPI_Comm swapLibMeshComm(MPI_Comm new_comm)
Swap the libMesh MPI communicator out for ours.
Definition: Moose.C:750
const ExecFlagType EXEC_PRE_KERNELS
Definition: Moose.C:56
Generic factory class for build all sorts of objects.
Definition: Factory.h:28
void setSolverDefaults(FEProblemBase &problem)
Definition: Moose.C:743
This is the base class for Samplers as used within the Stochastic Tools module.
Definition: Sampler.h:43
Base class for predictors.
Definition: Predictor.h:28
void petscSetDefaults(FEProblemBase &problem)
Sets the default options for PETSc.
Definition: PetscSupport.C:450
Base class for creating new types of boundary conditions.
bool _warnings_are_errors
Variable to toggle any warning into an error (includes deprecated code warnings)
Definition: Moose.C:795
InterfaceKernel and VectorInterfaceKernel is responsible for interfacing physics across subdomains...
void registerActions(Syntax &syntax, ActionFactory &action_factory)
Multiple Action class can be associated with a single input file section, in which case all associate...
Definition: Moose.C:500
This is a template class that implements the workhorse compute and computeNodal methods.
Base class for all Constraint types.
Definition: Constraint.h:19
const ExecFlagType EXEC_PRE_MULTIAPP_SETUP
Definition: Moose.C:54
Positions objects are under the hood Reporters.
Definition: Positions.h:20
Class that hold the whole problem being solved.
Definition: Problem.h:19
Definition: Marker.h:41
const bool _throw_on_error_before
The value of Moose::_throw_on_error at construction.
Definition: Moose.h:319
Base class for time stepping.
Definition: TimeStepper.h:22
Times objects are under the hood Reporters, but limited to a vector of Real.
Definition: Times.h:18
void associateSyntax(Syntax &syntax, ActionFactory &action_factory)
Definition: Moose.C:736
static void registerObjectsTo(Factory &f, const std::set< std::string > &labels)
This registers all MooseObjects known to the registry that have the given label(s) with the factory f...
Definition: Registry.C:34
const ExecFlagType EXEC_POST_ADAPTIVITY
Definition: Moose.C:58
All Distributions should inherit from this class.
Definition: Distribution.h:18
Class to transfer MFEM variable data to or from a restricted copy of the variable defined on an a sub...
Base class for MeshDivision objects.
Definition: MeshDivision.h:35
Reporter objects allow for the declaration of arbitrary data types that are aggregate values for a si...
Definition: Reporter.h:47
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
Base class for MOOSE preconditioners.
Based class for output objects.
Definition: Output.h:43
ScopedThrowOnError()
Default constructor, which sets Moose::_throw_on_error = true.
Definition: Moose.C:779
FunctorMaterials compute functor material properties.
const ExecFlagType EXEC_ALWAYS
Definition: Moose.C:51
static void registerActionsTo(ActionFactory &f, const std::set< std::string > &labels)
This registers all Actions known to the registry that have the given label(s) with the factory f...
Definition: Registry.C:68
Base class for convergence criteria.
Definition: Convergence.h:21
The DGKernel class is responsible for calculating the residuals for various physics on internal sides...
Definition: DGKernel.h:18
bool _deprecated_is_error
Variable to toggle only deprecated warnings as errors.
Definition: Moose.C:796
static bool _color_console
Definition: Moose.C:757
Base class for making kernels that work on auxiliary scalar variables.
const ExecFlagType EXEC_MULTIAPP_FIXED_POINT_ITERATION_END
Definition: Moose.C:38
Base class for construction of a mfem::ParSubMesh object.
Definition: MFEMSubMesh.h:22
const ExecFlagType EXEC_TRANSFER
Definition: Moose.C:55
~ScopedThrowOnError()
Destructor, which sets Moose::_throw_on_error to what it was upon construction.
Definition: Moose.C:781
Base class for array variable (equation) kernels using automatic differentiation. ...
Definition: ADArrayKernel.h:19
Specialized factory for generic Action System objects.
Definition: ActionFactory.h:48
Base class for creating kernels that interface physics between subdomains.
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:92
const ExecFlagType EXEC_LINEAR
Definition: Moose.C:31
const ExecFlagType EXEC_FAILED
Definition: Moose.C:48
const ExecFlagType EXEC_NONLINEAR
Definition: Moose.C:33
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:30
void mooseDeprecated(Args &&... args)
Emit a deprecated code/feature message with the given stringified, concatenated args.
Definition: MooseError.h:374
Base class for all Postprocessors.
Definition: Postprocessor.h:23
The behavior of this kernel is controlled by one problem-wise global parameter eigen_on_current - boo...
Definition: EigenKernel.h:23
const ExecFlagType EXEC_MULTIAPP_FIXED_POINT_BEGIN
Definition: Moose.C:42
const ExecFlagType EXEC_TIMESTEP_END
Definition: Moose.C:36
InitialConditions are objects that set the initial value of variables.
A DiracKernel is used when you need to add contributions to the residual by means of multiplying some...
Definition: DiracKernel.h:19
Constructs and stores an mfem::ParFiniteElementSpace object.
Definition: MFEMFESpace.h:22
void addDependencySets(const std::string &action_sets)
Adds all dependencies in a single call.
Definition: Syntax.C:69
FVKernel is a base class for all finite volume method kernels.
Definition: FVKernel.h:32
Base class for creating new types of boundary conditions.
Base class for time integrators.
bool show_multiple
Set to false (the default) to display an error message only once for each error call code location (a...
Definition: Moose.C:801
Class for containing MooseEnum item information.
Definition: MooseEnumItem.h:18
Base class for Control objects.
Definition: Control.h:34
bool _throw_on_warning
Variable to turn on exceptions during mooseWarning(), should only be used in MOOSE unit tests...
Definition: Moose.C:798
void registerSyntaxType(const std::string &syntax, const std::string &type)
Register a type with a block.
Definition: Syntax.C:362
void registerAll(Factory &f, ActionFactory &af, Syntax &s)
Register objects that are in MOOSE.
Definition: Moose.C:67
void registerObjects(Factory &factory, const std::set< std::string > &obj_labels)
Definition: Moose.C:77
Base class for MOOSE partitioner.
bool setColorConsole(bool use_color, bool force=false)
Turns color escape sequences on/off for info written to stdout.
Definition: Moose.C:766
Base class for wrapping mfem::Solver-derived classes.
Base class for deriving dampers.
Definition: Damper.h:24
Scoped helper for setting Moose::_throw_on_error during this scope.
Definition: Moose.h:297
Holding syntax for parsing input files.
Definition: Syntax.h:21
const ExecFlagType EXEC_MULTIAPP_FIXED_POINT_END
Definition: Moose.C:40
const ExecFlagType EXEC_CUSTOM
Definition: Moose.C:49
Definition: Kernel.h:15
const ExecFlagType EXEC_SUBDOMAIN
Definition: Moose.C:50
int interrupt_signal_number
Used by the signal handler to determine if we should write a checkpoint file out at any point during ...
Definition: Moose.C:799
const ExecFlagType EXEC_TIMESTEP_BEGIN
Definition: Moose.C:37
const ExecFlagType EXEC_POSTCHECK
Definition: Moose.C:35
const ExecFlagType EXEC_FORCED
Definition: Moose.C:47
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
const ExecFlagType EXEC_SAME_AS_MULTIAPP
Definition: Moose.C:53
const ExecFlagType EXEC_FINAL
Definition: Moose.C:46
const ExecFlagType EXEC_INITIAL
Definition: Moose.C:30
const ExecFlagType EXEC_NONE
Definition: Moose.C:29
Base class for creating nodal kernels with hand-coded Jacobians.
Definition: NodalKernel.h:18
A MultiApp represents one or more MOOSE applications that are running simultaneously.
Definition: MultiApp.h:112
std::string hitMessagePrefix(const hit::Node &node)
Get the prefix to be associated with a hit node for a message.
Definition: Moose.C:784
Base class for Postprocessors that produce a vector of values.
bool _throw_on_error
Variable to turn on exceptions during mooseError(), should only be used within MOOSE unit tests or wh...
Definition: Moose.C:797
MaterialBases compute MaterialProperties.
Definition: MaterialBase.h:62
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:33
This is a template class that implements the workhorse compute and computeNodal methods.
Base class for user-specific data.
Definition: UserObject.h:40
void addActionTypes(Syntax &syntax)
Definition: Moose.C:83
Base variable class.
The Executor class directs the execution flow of simulations.
Definition: Executor.h:26
const ExecFlagType EXEC_NONLINEAR_CONVERGENCE
Definition: Moose.C:34
void associateSyntaxInner(Syntax &syntax, ActionFactory &action_factory)
Definition: Moose.C:519
Control that additionally provides the capability to produce/consume data values, to allow control op...
Definition: ChainControl.h:21
const ExecFlagType EXEC_MULTIAPP_FIXED_POINT_CONVERGENCE
Definition: Moose.C:44
Base class for all Transfer objects.
Definition: Transfer.h:36
const ExecFlagType EXEC_PRE_DISPLACE
Definition: Moose.C:52