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  registerMooseObjectTask("add_variables_physics", MooseVariableBase, false);
135 
136  registerMooseObjectTask("add_nodal_kernel", NodalKernel, false);
137 
138  registerMooseObjectTask("add_functor_material", FunctorMaterial, false);
139  registerMooseObjectTask("add_material", MaterialBase, false);
140  appendDeprecatedMooseObjectTask("add_material", FunctorMaterial);
141  registerMooseObjectTask("add_materials_physics", FunctorMaterial, false);
142  appendMooseObjectTask ("add_materials_physics", MaterialBase);
143 
144  registerMooseObjectTask("add_bc", BoundaryCondition, false);
145 
146  registerMooseObjectTask("add_function", Function, false);
147 
148  registerMooseObjectTask("add_distribution", Distribution, false);
149  registerMooseObjectTask("add_sampler", Sampler, false);
150 
151  registerMooseObjectTask("add_aux_kernel", AuxKernel, false);
152  appendMooseObjectTask ("add_aux_kernel", VectorAuxKernel);
153  appendMooseObjectTask ("add_aux_kernel", ArrayAuxKernel);
154 
155  registerMooseObjectTask("add_bound", Bounds, false);
156 
157  registerMooseObjectTask("add_scalar_kernel", ScalarKernel, false);
158  registerMooseObjectTask("add_aux_scalar_kernel", AuxScalarKernel, false);
159  registerMooseObjectTask("add_dirac_kernel", DiracKernel, false);
160  appendMooseObjectTask ("add_dirac_kernel", VectorDiracKernel);
161  registerMooseObjectTask("add_dg_kernel", DGKernel, false);
162  registerMooseObjectTask("add_fv_kernel", FVKernel, false);
163  registerMooseObjectTask("add_interpolation_method", FVInterpolationMethod, false);
164  registerMooseObjectTask("add_linear_fv_kernel", LinearFVKernel, false);
165  registerMooseObjectTask("add_fv_bc", FVBoundaryCondition, false);
166  registerMooseObjectTask("add_linear_fv_bc", LinearFVBoundaryCondition, false);
167  registerMooseObjectTask("add_fv_ik", FVInterfaceKernel, false);
168  registerMooseObjectTask("add_interface_kernel", InterfaceKernel, false);
169  appendMooseObjectTask ("add_interface_kernel", VectorInterfaceKernel);
170  registerMooseObjectTask("add_constraint", Constraint, false);
171  registerMooseObjectTask("add_hybridized_kernel", HDGKernel, false);
172  registerMooseObjectTask("add_hybridized_integrated_bc", HDGIntegratedBC, false);
173 
174  registerMooseObjectTask("add_ic", InitialCondition, false);
175  appendMooseObjectTask ("add_ic", ScalarInitialCondition);
176  registerMooseObjectTask("add_fv_ic", FVInitialCondition, false);
177  registerMooseObjectTask("add_ics_physics", InitialCondition, false);
178  appendMooseObjectTask ("add_ics_physics", FVInitialCondition);
179  appendMooseObjectTask ("add_ics_physics", ScalarInitialCondition);
180 
181  registerMooseObjectTask("add_damper", Damper, false);
182  registerMooseObjectTask("setup_predictor", Predictor, false);
183  registerMooseObjectTask("add_time_steppers", TimeStepper, false);
184  registerMooseObjectTask("add_time_stepper", TimeStepper, false);
185  registerTask ("compose_time_stepper", true);
186  registerMooseObjectTask("setup_time_integrators", TimeIntegrator, false);
187  registerMooseObjectTask("setup_time_integrator", TimeIntegrator, false);
188  registerMooseObjectTask("add_convergence", Convergence, false);
189 
190  registerMooseObjectTask("add_preconditioning", MoosePreconditioner, false);
191  registerMooseObjectTask("add_field_split", Split, false);
192 
193  registerMooseObjectTask("add_mesh_division", MeshDivision, false);
194  registerMooseObjectTask("add_user_object", UserObject, false);
195  appendMooseObjectTask ("add_user_object", Postprocessor);
196 
197  appendDeprecatedMooseObjectTask("add_user_object", Corrector);
198  registerMooseObjectTask("add_corrector", Corrector, false);
199  appendDeprecatedMooseObjectTask("add_user_object", MeshModifier);
200  registerMooseObjectTask("add_mesh_modifier", MeshModifier, false);
201 
202  registerMooseObjectTask("add_postprocessor", Postprocessor, false);
203  registerMooseObjectTask("add_vector_postprocessor", VectorPostprocessor, false);
204  registerMooseObjectTask("add_reporter", Reporter, false);
205 
206  registerMooseObjectTask("add_positions", Positions, false);
207  registerMooseObjectTask("add_times", Times, false);
208 
209  registerMooseObjectTask("add_indicator", Indicator, false);
210  registerMooseObjectTask("add_marker", Marker, false);
211 
212  registerMooseObjectTask("add_multi_app", MultiApp, false);
213  registerMooseObjectTask("add_transfer", Transfer, false);
214 
215  registerMooseObjectTask("add_output", Output, false);
216 
217  registerMooseObjectTask("add_control", Control, false);
218  registerMooseObjectTask("add_chain_control", ChainControl, false);
219  registerMooseObjectTask("add_partitioner", MoosePartitioner, false);
220 
221  // clang-format on
222 
223  registerTask("dynamic_object_registration", false);
224  registerTask("common_output", true);
225  registerTask("setup_recover_file_base", true);
226  registerTask("recover_meta_data", true);
227 
228  registerTask("add_bounds_vectors", false);
229  registerTask("add_periodic_bc", false);
230  registerTask("add_aux_variable", false);
231  registerTask("add_external_aux_variables", true);
232  registerTask("add_variable", false);
233  registerTask("add_mortar_variable", false);
234 
235  registerTask("execute_mesh_generators", true);
236  registerTask("uniform_refine_mesh", false);
237  registerTask("prepare_mesh", false);
238  registerTask("delete_remote_elements_after_late_geometric_ghosting", false);
239  registerTask("setup_mesh_complete", true); // calls prepare
240  registerTask("post_mesh_prepared", false);
241  registerTask("add_geometric_rm", false);
242  registerTask("attach_geometric_rm", true);
243  registerTask("attach_geometric_rm_final", true);
244 
245  registerTask("init_displaced_problem", false);
246 
247  registerTask("add_algebraic_rm", false);
248  registerTask("attach_algebraic_rm", true);
249  registerTask("add_coupling_rm", false);
250  registerTask("attach_coupling_rm", true);
251  registerTask("init_problem", true);
252  registerTask("check_copy_nodal_vars", true);
253  registerTask("copy_nodal_vars", true);
254  registerTask("copy_nodal_aux_vars", true);
255  registerTask("copy_vars_physics", false);
256  registerTask("setup_postprocessor_data", false);
257  registerTask("setup_time_steppers", true);
258 
259  registerTask("setup_dampers", true);
260  registerTask("check_integrity", true);
261  registerTask("resolve_optional_materials", true);
262  registerTask("check_integrity_early", true);
263  registerTask("check_integrity_early_physics", false);
264  registerTask("setup_quadrature", true);
265  registerTask("create_tagged_matrices", true);
266 
267  registerTask("mesh_modifiers", false);
268 
270  registerTask("no_action", false); // Used for Empty Action placeholders
271  registerTask("set_global_params", false);
272  registerTask("setup_adaptivity", false);
273  registerTask("meta_action", false);
274  registerTask("setup_residual_debug", false);
275  registerTask("setup_oversampling", false);
276  registerTask("deprecated_block", false);
277  registerTask("set_adaptivity_options", false);
278  registerTask("add_mortar_interface", false);
279  registerTask("coupling_functor_check", true);
280  registerTask("add_master_action_material", false);
281  registerTask("setup_projected_properties", false);
282  registerTask("create_application_block", false);
283 
284  // Dummy Actions (useful for sync points in the dependencies)
285  registerTask("setup_function_complete", false);
286  registerTask("setup_variable_complete", false);
287  registerTask("setup_executioner_complete", false);
288  registerTask("ready_to_init", true);
289 
290  // Output related actions
291  registerTask("add_output_aux_variables", true);
292  registerTask("check_output", true);
293  registerTask("declare_late_reporters", true);
294 
295  registerTask("create_problem_default", true);
296  registerTask("create_problem_custom", false);
297  registerTask("create_problem_complete", false);
298 
299  registerTask("add_default_nonlinear_convergence", true);
300  registerTask("add_default_multiapp_fixed_point_convergence", true);
301  registerTask("add_default_steady_state_convergence", true);
302 
303  registerTask("chain_control_setup", true);
304  registerTask("start_webservercontrol", true);
305 
306  // Action for setting up the signal-based checkpoint
307  registerTask("auto_checkpoint_action", true);
308  /**************************/
309  /****** Dependencies ******/
310  /**************************/
321  // clang-format off
322  syntax.addDependencySets("(meta_action)"
323  "(meta_action_component)"
324  "(dynamic_object_registration)"
325  "(common_output)"
326  "(set_global_params)"
327  "(setup_recover_file_base)"
328  "(check_copy_nodal_vars)"
329  "(setup_mesh)"
330  "(add_geometric_rm)"
331  "(add_partitioner)"
332  "(add_mesh_generator)"
333  "(create_added_mesh_generators)"
334  "(append_mesh_generator)"
335  "(execute_mesh_generators)"
336  "(recover_meta_data)"
337  "(set_mesh_base)"
338  "(attach_geometric_rm)"
339  "(init_mesh)"
340  "(prepare_mesh)"
341  "(add_mortar_interface)"
342  "(uniform_refine_mesh)"
343  "(setup_mesh_complete)"
344  "(post_mesh_prepared)"
345  "(determine_system_type)"
346  "(create_problem)"
347  "(create_problem_custom)"
348  "(create_problem_default)"
349  "(create_problem_complete)"
350  "(init_displaced_problem)" // Problem must be init-ed before we start adding functors
351  "(add_function)" // Functions can depend on scalar variables & PPs, but this dependence can be
352  // added on initialSetup() rather than construction
353  "(init_component_physics)" // components must add their blocks to physics before init_physics
354  "(init_physics)"
355  "(setup_postprocessor_data)"
356  "(setup_time_integrator, setup_time_integrators)"
357  "(setup_executioner)"
358  "(setup_executioner_complete)"
359  "(setup_component)" // no particular reason for that placement
360  "(read_executor)"
361  "(add_executor)"
362  "(check_integrity_early)"
363  "(setup_predictor)"
364  "(add_aux_variable, add_variable, add_elemental_field_variable,"
365  " add_external_aux_variables)"
366  "(add_variables_physics)" // physics can skip adding variables if they already exist
367  "(add_mortar_variable)"
368  "(setup_variable_complete)"
369  "(check_integrity_early_physics)" // checks that systems and variables are consistent
370  "(setup_quadrature)"
371  "(add_convergence)"
372  "(add_default_nonlinear_convergence,"
373  " add_default_multiapp_fixed_point_convergence,"
374  " add_default_steady_state_convergence)"
375  "(add_positions)"
376  "(add_periodic_bc)"
377  "(add_user_object, add_corrector, add_mesh_modifier)"
378  "(add_field_split)" // split objects required before field split preconditioner itself
379  "(add_preconditioning)" // preconditioner may introduce objects such as static condensation which influence the underlying types of tagged matrices
380  "(create_tagged_matrices)"
381  "(add_distribution)"
382  "(add_sampler)"
383  "(setup_function_complete)"
384  "(setup_adaptivity)"
385  "(set_adaptivity_options)"
386  "(add_ic, add_fv_ic)"
387  "(add_ics_physics)" // physics can skip adding initial conditions if they already exist
388  "(add_constraint)"
389  "(add_times)"
390  "(add_time_stepper, add_time_steppers)"
391  "(compose_time_stepper)"
392  "(setup_time_steppers)"
393  "(ready_to_init)"
394  "(setup_dampers)"
395  "(setup_residual_debug)"
396  "(add_bounds_vectors)"
397  "(add_mesh_division)" // NearestPositionsDivision uses a Positions
398  "(add_multi_app)"
399  "(add_transfer)"
400  "(copy_nodal_vars, copy_nodal_aux_vars, copy_vars_physics)"
401  "(add_material)"
402  "(add_master_action_material)"
403  "(add_functor_material)"
404  "(add_materials_physics)"
405  "(setup_projected_properties)"
406  "(add_output_aux_variables)"
407  "(add_output)"
408  "(auto_checkpoint_action)"
409  "(add_postprocessor)"
410  "(add_vector_postprocessor)" // MaterialVectorPostprocessor requires this
411  // to be after material objects are created.
412  "(add_reporter)"
413  "(declare_late_reporters)"
414  "(add_aux_kernel, add_bc, add_damper, add_dirac_kernel, add_kernel,"
415  " add_nodal_kernel, add_dg_kernel, add_fv_kernel, add_interpolation_method,"
416  " add_linear_fv_kernel,"
417  " add_fv_bc, add_linear_fv_bc, add_fv_ik, add_interface_kernel,"
418  " add_scalar_kernel, add_aux_scalar_kernel, add_indicator, add_marker,"
419  " add_bound, add_hybridized_kernel, add_hybridized_integrated_bc)"
420  "(resolve_optional_materials)"
421  "(add_algebraic_rm)"
422  "(add_coupling_rm)"
423  "(attach_geometric_rm_final)"
424  "(attach_algebraic_rm)"
425  "(attach_coupling_rm)"
426  "(coupling_functor_check)"
427  "(delete_remote_elements_after_late_geometric_ghosting)"
428  "(init_problem)"
429  "(add_control, add_chain_control)"
430  "(chain_control_setup)"
431  "(start_webservercontrol)"
432  "(check_output)"
433  "(check_integrity)"
434  "(create_application_block)");
435  // clang-format on
436 
437 #ifdef MOOSE_MFEM_ENABLED
438  registerTask("add_mfem_problem_operator", true);
439  addTaskDependency("add_mfem_problem_operator", "init_mesh");
440  addTaskDependency("add_variable", "add_mfem_problem_operator");
441  addTaskDependency("add_aux_variable", "add_mfem_problem_operator");
442  addTaskDependency("add_elemental_field_variable", "add_mfem_problem_operator");
443  addTaskDependency("add_bc", "add_mfem_problem_operator");
444  addTaskDependency("add_kernel", "add_mfem_problem_operator");
445 
446  // add SubMeshes
447  registerMooseObjectTask("add_mfem_submeshes", MFEMSubMesh, false);
448  addTaskDependency("add_mfem_submeshes", "create_problem_complete");
449 
450  // add SubMesh transfers
451  appendMooseObjectTask("add_transfer", MFEMSubMeshTransfer);
452 
453  // add FESpaces
454  registerMooseObjectTask("add_mfem_fespaces", MFEMFESpace, false);
455  appendMooseObjectTask("add_mfem_fespaces", MFEMFECollection);
456  addTaskDependency("add_mfem_fespaces", "add_mfem_submeshes");
457  addTaskDependency("add_variable", "add_mfem_fespaces");
458  addTaskDependency("add_aux_variable", "add_mfem_fespaces");
459  addTaskDependency("add_elemental_field_variable", "add_mfem_fespaces");
460  addTaskDependency("add_kernel", "add_mfem_fespaces");
461 
462  // add complex kernels
463  registerMooseObjectTask("add_mfem_complex_kernel_components", Kernel, false);
464  registerMooseObjectTask("add_mfem_complex_bc_components", BoundaryCondition, false);
465  addTaskDependency("add_mfem_complex_kernel_components", "add_mfem_fespaces");
466  addTaskDependency("add_mfem_complex_bc_components", "add_mfem_fespaces");
467  addTaskDependency("add_mfem_complex_kernel_components", "add_kernel");
468  addTaskDependency("add_mfem_complex_bc_components", "add_bc");
469 
470  // set mesh FE space
471  registerTask("set_mesh_fe_space", true);
472  addTaskDependency("set_mesh_fe_space", "add_variable");
473  addTaskDependency("set_mesh_fe_space", "init_mesh");
474 
475  // add preconditioning.
476  registerMooseObjectTask("add_mfem_preconditioner", Moose::MFEM::SolverBase, false);
477  addTaskDependency("add_mfem_preconditioner", "add_mfem_problem_operator");
478  addTaskDependency("add_mfem_preconditioner", "add_variable");
479 
480  // add solver objects.
481  registerMooseObjectTask("add_mfem_solver", Moose::MFEM::SolverBase, true);
482  addTaskDependency("add_mfem_solver", "add_mfem_preconditioner");
483  addTaskDependency("add_mfem_solver", "add_mfem_problem_operator");
484 #endif
485 
486  // Linear FV kernels fetch FVInterpolationMethod instances in their constructors
487  addTaskDependency("add_linear_fv_kernel", "add_interpolation_method");
488 
489  registerTask("parse_neml2", /*required=*/false);
490  addTaskDependency("add_material", "parse_neml2");
491  addTaskDependency("add_user_object", "parse_neml2");
492 }
493 
522 void
523 registerActions(Syntax & syntax, ActionFactory & action_factory)
524 {
525  mooseDeprecated("use registerAll instead of registerActions");
526  registerActions(syntax, action_factory, {"MooseApp"});
527 }
528 
529 void
531  ActionFactory & action_factory,
532  const std::set<std::string> & obj_labels)
533 {
534  Registry::registerActionsTo(action_factory, obj_labels);
535 
536  // Add these actions here so they are always executed last, without setting any dependency
537  registerTask("dump_objects", false);
538  registerTask("finish_input_file_output", false);
539 }
540 
541 void
542 associateSyntaxInner(Syntax & syntax, ActionFactory & /*action_factory*/)
543 {
549  registerSyntax("DiffusionCG", "Physics/Diffusion/ContinuousGalerkin/*");
550  registerSyntax("DiffusionFV", "Physics/Diffusion/FiniteVolume/*");
551 
552  registerSyntax("AddActionComponentAction", "ActionComponents/*");
553  registerSyntax("CombineComponentsMeshes", "ActionComponents");
554 
555  registerSyntaxTask("CopyNodalVarsAction", "Variables/*", "check_copy_nodal_vars");
556  registerSyntaxTask("CopyNodalVarsAction", "Variables/*", "copy_nodal_vars");
557  registerSyntaxTask("CopyNodalVarsAction", "AuxVariables/*", "check_copy_nodal_vars");
558  registerSyntaxTask("CopyNodalVarsAction", "AuxVariables/*", "copy_nodal_aux_vars");
559 
560  registerSyntaxTask("AddKernelAction", "Kernels/*", "add_kernel");
561  registerSyntaxTask("AddNodalKernelAction", "NodalKernels/*", "add_nodal_kernel");
562  registerSyntaxTask("AddKernelAction", "AuxKernels/*", "add_aux_kernel");
563 
564  registerSyntaxTask("AddHDGKernelAction", "HDGKernels/*", "add_hybridized_kernel");
565 
566  registerSyntax("AddAuxKernelAction", "AuxVariables/*/AuxKernel");
567 
568  registerSyntaxTask("AddScalarKernelAction", "ScalarKernels/*", "add_scalar_kernel");
569  registerSyntaxTask("AddScalarKernelAction", "AuxScalarKernels/*", "add_aux_scalar_kernel");
570 
571  registerSyntaxTask("AddBCAction", "BCs/*", "add_bc");
572 
573  registerSyntax("CreateProblemAction", "Problem");
574  registerSyntax("DynamicObjectRegistrationAction", "Problem");
575 
576  registerSyntax("SetupMeshAction", "Mesh");
577  registerSyntax("SetupMeshCompleteAction", "Mesh");
578  // Components should be able create a Mesh without a Mesh block
579  registerSyntax("CreateMeshSetupActionsForComponents", "ActionComponents");
580  registerSyntax("CreateDisplacedProblemAction", "Mesh");
581  registerSyntax("DisplayGhostingAction", "Mesh");
582  registerSyntax("AddMeshGeneratorAction", "Mesh/*");
583  registerSyntaxTask("EmptyAction", "Mesh/BatchMeshGeneratorAction", "no_action");
584  registerSyntax("BatchMeshGeneratorAction", "Mesh/BatchMeshGeneratorAction/*");
585  registerSyntax("ElementIDOutputAction", "Mesh");
586  syntax.registerSyntaxType("Mesh/*", "MeshGeneratorName");
587 
588  registerSyntax("AddFunctionAction", "Functions/*");
589  syntax.registerSyntaxType("Functions/*", "FunctionName");
590 
591  registerSyntax("AddMeshDivisionAction", "MeshDivisions/*");
592  syntax.registerSyntaxType("MeshDivisions/*", "MeshDivisionName");
593  registerSyntax("AddConvergenceAction", "Convergence/*");
594  syntax.registerSyntaxType("Convergence/*", "ConvergenceName");
595 
596  registerSyntax("GlobalParamsAction", "GlobalParams");
597 
598  registerSyntax("AddDistributionAction", "Distributions/*");
599  syntax.registerSyntaxType("Distributions/*", "DistributionName");
600 
601  registerSyntax("AddSamplerAction", "Samplers/*");
602  syntax.registerSyntaxType("Samplers/*", "SamplerName");
603 
604  registerSyntax("SetupDebugAction", "Debug");
605  registerSyntax("SetupResidualDebugAction", "Debug");
606 
608  registerSyntax("AddVariableAction", "Variables/*");
609  syntax.registerSyntaxType("Variables/*", "VariableName");
610  syntax.registerSyntaxType("Variables/*", "NonlinearVariableName");
611 
612  registerSyntax("AddICAction", "Variables/*/InitialCondition");
613  registerSyntax("AddFVICAction", "Variables/*/FVInitialCondition");
614 
615  registerSyntax("AddAuxVariableAction", "AuxVariables/*");
616  syntax.registerSyntaxType("AuxVariables/*", "VariableName");
617  syntax.registerSyntaxType("AuxVariables/*", "AuxVariableName");
618 
619  registerSyntax("AddICAction", "AuxVariables/*/InitialCondition");
620  registerSyntax("AddFVICAction", "AuxVariables/*/FVInitialCondition");
621 
622  registerSyntaxTask("EmptyAction", "BCs/Periodic", "no_action"); // placeholder
623  registerSyntax("AddPeriodicBCAction", "BCs/Periodic/*");
624 
625  registerSyntaxTask("AddInitialConditionAction", "ICs/*", "add_ic");
626  registerSyntaxTask("AddFVInitialConditionAction", "FVICs/*", "add_fv_ic");
627 
628  registerSyntax("AddMaterialAction", "Materials/*");
629  syntax.registerSyntaxType("Materials/*", "MaterialName");
630 
631  registerSyntax("AddFunctorMaterialAction", "FunctorMaterials/*");
632  syntax.registerSyntaxType("FunctorMaterials/*", "MaterialName");
633 
634  registerSyntax("AddPostprocessorAction", "Postprocessors/*");
635  syntax.registerSyntaxType("Postprocessors/*", "PostprocessorName");
636  syntax.registerSyntaxType("Postprocessors/*", "UserObjectName");
637 
638  registerSyntax("AddVectorPostprocessorAction", "VectorPostprocessors/*");
639  syntax.registerSyntaxType("VectorPostprocessors/*", "VectorPostprocessorName");
640 
641  registerSyntax("AddReporterAction", "Reporters/*");
642  syntax.registerSyntaxType("Reporters/*", "ReporterName");
643 
644  registerSyntax("AddPositionsAction", "Positions/*");
645  syntax.registerSyntaxType("Positions/*", "PositionsName");
646 
647  registerSyntax("AddTimesAction", "Times/*");
648  syntax.registerSyntaxType("Times/*", "TimesName");
649 
650  registerSyntax("AddDamperAction", "Dampers/*");
651 
652  registerSyntax("AddOutputAction", "Outputs/*");
653  registerSyntax("CommonOutputAction", "Outputs");
654  registerSyntax("MaterialOutputAction", "Outputs");
655  registerSyntax("AutoCheckpointAction", "Outputs");
656  syntax.registerSyntaxType("Outputs/*", "OutputName");
657 
658  // Note: Preconditioner Actions will be built by this setup action
659  registerSyntax("SetupPreconditionerAction", "Preconditioning/*");
660  registerSyntax("AddFieldSplitAction", "Preconditioning/*/*");
661 
662  registerSyntax("CreateExecutionerAction", "Executioner");
663  registerSyntax("ReadExecutorParamsAction", "Executors/*");
664 
665  registerSyntaxTask("AddTimeStepperAction", "Executioner/TimeSteppers/*", "add_time_steppers");
666  registerSyntaxTask("AddTimeStepperAction", "Executioner/TimeStepper", "add_time_stepper");
667  registerSyntaxTask(
668  "ComposeTimeStepperAction", "Executioner/TimeSteppers", "compose_time_stepper");
669  registerSyntaxTask(
670  "SetupTimeIntegratorAction", "Executioner/TimeIntegrators/*", "setup_time_integrators");
671  registerSyntaxTask(
672  "SetupTimeIntegratorAction", "Executioner/TimeIntegrator", "setup_time_integrator");
673  syntax.registerSyntaxType("Executors/*", "ExecutorName");
674 
675  registerSyntax("SetupQuadratureAction", "Executioner/Quadrature");
676  registerSyntax("SetupPredictorAction", "Executioner/Predictor");
677 #ifdef LIBMESH_ENABLE_AMR
678  registerSyntax("AdaptivityAction", "Executioner/Adaptivity");
679 #endif
680 
681  registerSyntax("PartitionerAction", "Mesh/Partitioner");
682 
683  registerSyntax("AddDiracKernelAction", "DiracKernels/*");
684 
685  registerSyntax("AddDGKernelAction", "DGKernels/*");
686  registerSyntax("AddFVKernelAction", "FVKernels/*");
687  registerSyntax("AddFVBCAction", "FVBCs/*");
688  registerSyntax("AddLinearFVBCAction", "LinearFVBCs/*");
689  registerSyntax("AddFVInterfaceKernelAction", "FVInterfaceKernels/*");
690  registerSyntax("CheckFVBCAction", "FVBCs");
691 
692  registerSyntax("AddLinearFVKernelAction", "LinearFVKernels/*");
693 
694  registerSyntax("AddInterfaceKernelAction", "InterfaceKernels/*");
695 
696  registerSyntax("AddConstraintAction", "Constraints/*");
697 
698  registerSyntax("AddControlAction", "Controls/*");
699  registerSyntax("AddChainControlAction", "ChainControls/*");
700  registerSyntax("AddBoundAction", "Bounds/*");
701  registerSyntax("AddBoundsVectorsAction", "Bounds");
702 
703  // UserObject and some derived classes
704  registerSyntax("AddUserObjectAction", "UserObjects/*");
705  syntax.registerSyntaxType("UserObjects/*", "UserObjectName");
706 
707  registerSyntax("AddCorrectorAction", "Correctors/*");
708  syntax.registerSyntaxType("Correctors/*", "UserObjectName");
709 
710  registerSyntax("AddMeshModifiersAction", "MeshModifiers/*");
711  syntax.registerSyntaxType("MeshModifiers/*", "UserObjectName");
712 
713  registerSyntax("AddNodalNormalsAction", "NodalNormals");
714 
715  // FVInterpolationMethods
716  registerSyntax("AddFVInterpolationMethodAction", "FVInterpolationMethods/*");
717  syntax.registerSyntaxType("FVInterpolationMethods/*", "InterpolationMethodName");
718 
719  // Indicator
720  registerSyntax("AddElementalFieldAction", "Adaptivity/Indicators/*");
721  registerSyntax("AddIndicatorAction", "Adaptivity/Indicators/*");
722  syntax.registerSyntaxType("Adaptivity/Indicators/*", "IndicatorName");
723 
724  // Marker
725  registerSyntax("AddElementalFieldAction", "Adaptivity/Markers/*");
726  registerSyntax("AddMarkerAction", "Adaptivity/Markers/*");
727  syntax.registerSyntaxType("Adaptivity/Markers/*", "MarkerName");
728 
729  // New Adaptivity System
730  registerSyntax("SetAdaptivityOptionsAction", "Adaptivity");
731 
732  // Deprecated Block
733  registerSyntax("DeprecatedBlockAction", "DeprecatedBlock");
734 
735  // Multi Apps
736  registerSyntax("AddMultiAppAction", "MultiApps/*");
737  syntax.registerSyntaxType("MultiApps/*", "MultiAppName");
738 
739  // Transfers
740  registerSyntax("AddTransferAction", "Transfers/*");
741 
742  // Material derivative test
743  registerSyntaxTask("EmptyAction", "Debug/MaterialDerivativeTest", "no_action"); // placeholder
744  registerSyntax("MaterialDerivativeTestAction", "Debug/MaterialDerivativeTest/*");
745 
746  registerSyntax("ProjectedStatefulMaterialStorageAction", "ProjectedStatefulMaterialStorage/*");
747 
748  // Application Block System
749  registerSyntax("CreateApplicationBlockAction", "Application");
750 
751 #ifdef MOOSE_MFEM_ENABLED
752  registerSyntaxTask("AddMFEMSubMeshAction", "SubMeshes/*", "add_mfem_submeshes");
753  registerSyntaxTask("AddMFEMFESpaceAction", "FESpaces/*", "add_mfem_fespaces");
754  registerSyntaxTask(
755  "AddMFEMComplexKernelComponentAction", "Kernels/*/*", "add_mfem_complex_kernel_components");
756  registerSyntaxTask(
757  "AddMFEMComplexBCComponentAction", "BCs/*/*", "add_mfem_complex_bc_components");
758  registerSyntaxTask("AddMFEMPreconditionerAction", "Preconditioner/*", "add_mfem_preconditioner");
759  registerSyntaxTask("AddMFEMSolverAction", "Solvers/*", "add_mfem_solver");
760  syntax.registerSyntaxType("Solvers/*", "MFEMSolverName");
761 #endif
762 
763  registerSyntax("NEML2ActionCommon", "NEML2");
764  registerSyntax("NEML2Action", "NEML2/*");
765 
766  addActionTypes(syntax);
767 }
768 
769 void
770 associateSyntax(Syntax & syntax, ActionFactory & action_factory)
771 {
772  associateSyntaxInner(syntax, action_factory);
773  registerActions(syntax, action_factory);
774 }
775 
776 void
778 {
779  // May be a touch expensive to create a new DM every time, but probably safer to do it this way
781 }
782 
783 MPI_Comm
784 swapLibMeshComm(MPI_Comm new_comm)
785 {
786  MPI_Comm old_comm = PETSC_COMM_WORLD;
787  PETSC_COMM_WORLD = new_comm;
788  return old_comm;
789 }
790 
791 static bool _color_console = isatty(fileno(stdout));
792 
793 bool
795 {
796  return _color_console;
797 }
798 
799 bool
800 setColorConsole(bool use_color, bool force)
801 {
802  _color_console = (isatty(fileno(stdout)) || force) && use_color;
803  return _color_console;
804 }
805 
806 ScopedThrowOnError::ScopedThrowOnError(const bool throw_on_error)
807  : _throw_on_error_before(Moose::_throw_on_error)
808 {
809  mooseAssert(!libMesh::Threads::in_threads, "Cannot be used in threads");
810  Moose::_throw_on_error = throw_on_error;
811 }
812 
814 
816 
818  : _deprecated_is_error_before(Moose::_deprecated_is_error)
819 {
820  mooseAssert(!libMesh::Threads::in_threads, "Cannot be used in threads");
821  Moose::_deprecated_is_error = deprecated_is_error;
822 }
823 
825 
827 {
829 }
830 
831 std::string
832 hitMessagePrefix(const hit::Node & node)
833 {
834  // Strip meaningless line and column number for CLI args
835  if (node.filename() == "CLI_ARGS")
836  return "CLI_ARGS:\n";
837  // If using the root node, don't add line info
838  if (node.isRoot())
839  return node.filename() + ":\n";
840  return node.fileLocation() + ":\n";
841 }
842 
843 bool _warnings_are_errors = false;
844 bool _deprecated_is_error = false;
845 bool _throw_on_error = false;
846 bool _throw_on_warning = false;
848 bool show_multiple = false;
849 
850 } // namespace Moose
const ExecFlagType EXEC_LINEAR_CONVERGENCE
Definition: Moose.C:32
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:794
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:784
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:777
This is the base class for Samplers as used within the Stochastic Tools module.
Definition: Sampler.h:45
Base class for predictors.
Definition: Predictor.h:28
void petscSetDefaults(FEProblemBase &problem)
Sets the default options for PETSc.
Definition: PetscSupport.C:598
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:843
~ScopedDeprecatedIsError()
Destructor, which sets Moose::_deprecated_is_error to what it was upon construction.
Definition: Moose.C:826
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:523
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:317
ScopedDeprecatedIsError()
Default constructor, which sets Moose::_deprecated_is_error = true.
Definition: Moose.C:824
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:770
const bool _deprecated_is_error_before
The value of Moose::_throw_on_error at construction.
Definition: Moose.h:347
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:35
const ExecFlagType EXEC_POST_ADAPTIVITY
Definition: Moose.C:58
Registered base class for linear FV interpolation objects.
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:813
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:69
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:844
static bool _color_console
Definition: Moose.C:791
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:20
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:815
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:93
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:363
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:20
void addDependencySets(const std::string &action_sets)
Adds all dependencies in a single call.
Definition: Syntax.C:69
Base class for wrapping mfem::Solver-derived classes.
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:848
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:846
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:800
Base class for deriving dampers.
Definition: Damper.h:24
Scoped helper for setting Moose::_throw_on_error during this scope.
Definition: Moose.h:295
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:847
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:832
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:845
MaterialBases compute MaterialProperties.
Definition: MaterialBase.h:62
Scoped helper for setting Moose::_deprecated_is_error during this scope.
Definition: Moose.h:325
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:19
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:542
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