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