https://mooseframework.inl.gov
MooseApp.h
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 #pragma once
11 
12 #ifdef MOOSE_LIBTORCH_ENABLED
13 // Libtorch includes
14 #include <torch/types.h>
15 #include <torch/mps.h>
16 #include <torch/cuda.h>
17 #include <c10/core/DeviceType.h>
18 #endif
19 
20 // MOOSE includes
21 #include "Moose.h"
22 #include "Builder.h"
23 #include "ActionWarehouse.h"
24 #include "Factory.h"
25 #include "ActionFactory.h"
26 #include "OutputWarehouse.h"
27 #include "RestartableData.h"
28 #include "RestartableDataMap.h"
29 #include "ConsoleStreamInterface.h"
30 #include "PerfGraph.h"
31 #include "PerfGraphInterface.h"
32 #include "TheWarehouse.h"
33 #include "RankMap.h"
34 #include "MeshGeneratorSystem.h"
35 #include "ChainControlDataSystem.h"
36 #include "RestartableDataReader.h"
37 #include "Backup.h"
38 #include "MooseBase.h"
39 #include "Capability.h"
40 #include "MoosePassKey.h"
41 #include "SystemInfo.h"
42 #include "Syntax.h"
43 
44 #include "libmesh/parallel_object.h"
45 #include "libmesh/mesh_base.h"
46 #include "libmesh/point.h"
47 
48 // C++ includes
49 #include <list>
50 #include <map>
51 #include <set>
52 #include <unordered_set>
53 #include <typeindex>
54 #include <filesystem>
55 #include <variant>
56 
57 // Forward declarations
58 class AppFactory;
59 class Executioner;
60 class Executor;
61 class NullExecutor;
62 class FEProblemBase;
64 class CommandLine;
66 class ReporterData;
67 class SolutionInvalidity;
68 class MultiApp;
69 class MooseMesh;
70 #ifdef MOOSE_MFEM_ENABLED
71 class MFEMProblemSolve;
72 #endif
73 
74 namespace libMesh
75 {
76 class ExodusII_IO;
77 }
78 namespace hit
79 {
80 class Node;
81 }
82 
83 #ifdef MOOSE_KOKKOS_ENABLED
84 namespace Moose::Kokkos
85 {
86 class MemoryPool;
87 }
88 #endif
89 
90 #ifdef MOOSE_UNIT_TEST
91 // forward declare unit tests
92 #include "gtest/gtest.h"
93 class GTEST_TEST_CLASS_NAME_(CapabilitiesTest, mooseAppAddBoolCapability);
94 class GTEST_TEST_CLASS_NAME_(CapabilitiesTest, mooseAppAddIntCapability);
95 class GTEST_TEST_CLASS_NAME_(CapabilitiesTest, mooseAppAddStringCapability);
96 class GTEST_TEST_CLASS_NAME_(CapabilitiesTest, mooseAppAddCapability);
97 #endif
98 
110 {
111 public:
113  std::optional<MooseEnum> getComputeDevice() const;
114 
115 #ifdef MOOSE_LIBTORCH_ENABLED
116  torch::DeviceType getLibtorchDevice() const { return _libtorch_device; }
118 #endif
119 
126  {
131  std::vector<std::string> sub_transformed_vars;
133  std::vector<PostprocessorName> sub_transformed_pps;
134  };
135 
137  static const std::string MESH_META_DATA_SUFFIX;
138 
139  static InputParameters validParams();
140 
141  virtual ~MooseApp();
142 
144 
148  virtual std::string getPrintableName() const { return "Application"; }
149 
150  virtual std::string appBinaryName() const
151  {
153  name = name.substr(0, name.find_last_of("-"));
154  if (name.find_first_of("/") != std::string::npos)
155  name = name.substr(name.find_first_of("/") + 1, std::string::npos);
156  return name;
157  }
158 
163  int exitCode() const { return _exit_code; }
164 
168  void setExitCode(const int exit_code) { _exit_code = exit_code; }
169 
174  const RankMap & rankMap() { return _rank_map; }
175 
180 
188 
192  virtual void run();
193 
197  std::string getFrameworkVersion() const;
198 
202  virtual std::string getVersion() const;
203 
207  std::string getPrintableVersion() const;
208 
212  virtual void setupOptions();
213 
222 
227 
231  Syntax & syntax() { return _syntax; }
232 
236  const std::vector<std::string> & getInputFileNames() const;
237 
241  const std::string & getLastInputFileName() const;
242 
247  void setOutputFileBase(const std::string & output_file_base);
248 
259  std::string getOutputFileBase(bool for_non_moose_build_output = false) const;
260 
264  void setOutputPosition(const Point & p);
265 
270  std::list<std::string> getCheckpointDirectories() const;
271 
276  std::list<std::string> getCheckpointFiles() const;
277 
282  bool hasOutputPosition() const { return _output_position_set; }
283 
288  Point getOutputPosition() const { return _output_position; }
289 
296  void setStartTime(Real time);
297 
301  bool hasStartTime() const { return _start_time_set; }
302 
306  Real getStartTime() const { return _start_time; }
307 
312  void setGlobalTimeOffset(Real offset) { _global_time_offset = offset; }
313 
319 
325  std::string getFileName(bool stripLeadingPath = true) const;
326 
330  void setErrorOverridden();
331 
335  void disableCheckUnusedFlag();
336 
340  Executioner * getExecutioner() const;
341  Executor * getExecutor() const { return _executor.get(); }
342  NullExecutor * getNullExecutor() const { return _null_executor.get(); }
343  bool useExecutor() const { return _use_executor; }
344  FEProblemBase & feProblem() const;
345 
349  void setExecutioner(std::shared_ptr<Executioner> && executioner) { _executioner = executioner; }
350  void setExecutor(std::shared_ptr<Executor> && executor) { _executor = executor; }
351  void
352  addExecutor(const std::string & type, const std::string & name, const InputParameters & params);
353 
358  void addExecutorParams(const std::string & type,
359  const std::string & name,
360  const InputParameters & params);
361 
365  const Parser & parser() const;
367  Parser & parser();
369 
374  void createExecutors();
375 
383  Executor & getExecutor(const std::string & name, bool fail_if_not_found = true);
384 
393 
397  bool & useNonlinear() { return _use_nonlinear; }
398 
402  bool & useEigenvalue() { return _use_eigen_value; }
403 
407  Factory & getFactory() { return _factory; }
408 
413 
417  processor_id_type processor_id() const { return _comm->rank(); }
418 
424  std::shared_ptr<CommandLine> commandLine() const { return _command_line; }
425 
430  void setExodusFileRestart(bool flag) { _initial_from_file = flag; }
431 
436  bool getExodusFileRestart() const { return _initial_from_file; }
437 
441  void setExReaderForRestart(std::shared_ptr<libMesh::ExodusII_IO> && exreader)
442  {
443  _ex_reader = exreader;
444  }
445 
450 
454  virtual void runInputFile();
455 
459  virtual void executeExecutioner();
460 
467 
473  bool isRecovering() const;
474 
481  bool isRestarting() const;
482 
486  bool isSplitMesh() const;
487 
489 
492  bool hasRestartRecoverFileBase() const;
493  bool hasRecoverFileBase() const;
495 
497 
500  std::string getRestartRecoverFileBase() const { return _restart_recover_base; }
501  std::string getRecoverFileBase() const
502  {
503  mooseDeprecated("MooseApp::getRecoverFileBase is deprecated, use "
504  "MooseApp::getRestartRecoverFileBase() instead.");
505  return _restart_recover_base;
506  }
508 
512  void setRestartRecoverFileBase(const std::string & file_base)
513  {
514  if (file_base.empty())
516  else
517  _restart_recover_base = file_base;
518  }
519 
525 
530  bool testReStep() const { return _test_restep; }
531 
540  void setOutputFileNumbers(const std::map<std::string, unsigned int> & numbers)
541  {
542  _output_file_numbers = numbers;
543  }
544 
552  const std::map<std::string, unsigned int> & getOutputFileNumbers() const
553  {
554  return _output_file_numbers;
555  }
556 
561  const OutputWarehouse & getOutputWarehouse() const;
562 
567  const SystemInfo & getSystemInfo() const { return _sys_info; }
568 
570 
575  void dynamicAllRegistration(const std::string & app_name,
576  Factory * factory,
577  ActionFactory * action_factory,
578  Syntax * syntax,
579  std::string library_path,
580  const std::string & library_name);
581  void dynamicAppRegistration(const std::string & app_name,
582  std::string library_path,
583  const std::string & library_name,
584  bool lib_load_deps);
586 
593  std::string appNameToLibName(const std::string & app_name) const;
594 
598  std::string libNameToAppName(const std::string & library_name) const;
599 
603  std::set<std::string> getLoadedLibraryPaths() const;
604 
608  std::set<std::string> getLibrarySearchPaths(const std::string & library_path_from_param) const;
609 
614 
615  /*
616  * Register a piece of restartable data. This is data that will get
617  * written / read to / from a restart file.
618  *
619  * @param data The actual data object.
620  * @param tid The thread id of the object. Use 0 if the object is not threaded.
621  * @param read_only Restrict the data for read-only
622  * @param metaname (optional) register the data to the meta data storage (tid must be 0)
623  */
624  RestartableDataValue & registerRestartableData(std::unique_ptr<RestartableDataValue> data,
625  THREAD_ID tid,
626  bool read_only,
627  const RestartableDataMapName & metaname = "");
628 
629  /*
630  * Deprecated method to register a piece of restartable data.
631  *
632  * Use the call without a data name instead.
633  */
634  RestartableDataValue & registerRestartableData(const std::string & name,
635  std::unique_ptr<RestartableDataValue> data,
636  THREAD_ID tid,
637  bool read_only,
638  const RestartableDataMapName & metaname = "");
639 
640  /*
641  * Check if a restartable meta data exists or not.
642  *
643  * @param name The full (unique) name.
644  * @param metaname The name to the meta data storage
645  */
646  bool hasRestartableMetaData(const std::string & name,
647  const RestartableDataMapName & metaname) const;
648 
649  /*
650  * Retrieve restartable meta data from restartable data map
651  *
652  * @param name The full (unique) name.
653  * @param metaname The name to the meta data storage
654  * @return A reference to the restartable meta data value
655  */
656  RestartableDataValue & getRestartableMetaData(const std::string & name,
657  const RestartableDataMapName & metaname,
658  THREAD_ID tid);
659 
665  const std::filesystem::path & folder_base);
670  void loadRestartableMetaData(const std::filesystem::path & folder_base);
671 
677  std::vector<std::filesystem::path>
679  const std::filesystem::path & folder_base);
685  std::vector<std::filesystem::path>
686  writeRestartableMetaData(const std::filesystem::path & folder_base);
687 
692  const std::vector<RestartableDataMap> & getRestartableData() const { return _restartable_data; }
694  std::vector<RestartableDataMap> & getRestartableData() { return _restartable_data; }
696 
701 
706 
716  void registerRestartableDataMapName(const RestartableDataMapName & name, std::string suffix = "");
717 
721  const std::string & getRestartableDataMapName(const RestartableDataMapName & name) const;
722 
728 
734  std::vector<std::filesystem::path> backup(const std::filesystem::path & folder_base);
740  std::unique_ptr<Backup> backup();
741 
745  bool hasInitialBackupMesh() const;
746 
751 
756 
761 
766 
770  virtual void preBackup() {}
771 
783  void restore(const std::filesystem::path & folder_base, const bool for_restart);
784 
796  void restore(std::unique_ptr<Backup> backup, const bool for_restart);
797 
804  virtual void postRestore(const bool /* for_restart */) {}
805 
818  void restoreFromInitialBackup(const bool for_restart);
819 
829  std::unique_ptr<Backup> finalizeRestore();
830 
840  const THREAD_ID tid,
842  {
843  return _rd_reader.restoreDataIfAvailable(value, tid, {});
844  }
845 
849  virtual std::string header() const;
850 
855  unsigned int multiAppLevel() const { return _multiapp_level; }
856 
861  unsigned int multiAppNumber() const { return _multiapp_number; }
862 
866  bool isUltimateMaster() const { return !_multiapp_level; }
867 
871  bool useMasterMesh() const { return _use_master_mesh; }
872 
876  const MooseMesh * masterMesh() const { return _master_mesh; }
877 
882 
887 
892 
902  void addMeshGenerator(const std::string & type,
903  const std::string & name,
904  const InputParameters & params)
905  {
907  }
908 
912  bool hasMeshGenerator(const MeshGeneratorName & name) const
913  {
915  }
916 
920  const MeshGenerator & getMeshGenerator(const std::string & name) const
921  {
923  }
924 
928  std::unique_ptr<MeshBase> getMeshGeneratorMesh()
929  {
931  }
932 
938  std::vector<std::string> getMeshGeneratorNames() const
939  {
941  }
942 
952  const MeshGenerator &
953  appendMeshGenerator(const std::string & type, const std::string & name, InputParameters params)
954  {
956  }
957 
964  virtual bool constructingMeshGenerators() const;
965 
967 
971  void setRestart(bool value);
972  void setRecover(bool value);
974 
976  bool checkInput() const { return _check_input; }
977 
979  bool getFPTrapFlag() const { return _trap_fpe; }
980 
984  bool hasRelationshipManager(const std::string & name) const;
985 
992  bool addRelationshipManager(std::shared_ptr<RelationshipManager> relationship_manager);
993 
995  static const std::string & checkpointSuffix();
997  static std::filesystem::path metaDataFolderBase(const std::filesystem::path & folder_base,
998  const std::string & map_suffix);
1000  std::filesystem::path restartFolderBase(const std::filesystem::path & folder_base) const;
1001 
1009  const hit::Node * getCurrentActionHitNode() const;
1010 
1017  bool attach_geometric_rm_final = false);
1018 
1025  void attachRelationshipManagers(MeshBase & mesh, MooseMesh & moose_mesh);
1026 
1030  const std::vector<std::shared_ptr<RelationshipManager>> & getReleationshipManagers();
1031 
1035  std::vector<std::pair<std::string, std::string>> getRelationshipManagerInfo() const;
1036 
1040  const ExecFlagEnum & getExecuteOnEnum() const { return _execute_flags; }
1041 
1047  bool hasInitialBackup() const
1048  {
1049  return _initial_backup != nullptr && *_initial_backup != nullptr;
1050  }
1051 
1056 
1057  // Return the communicator for this application
1058  const std::shared_ptr<libMesh::Parallel::Communicator> getCommunicator() const { return _comm; }
1059 
1063  const std::set<std::shared_ptr<RelationshipManager>> & relationshipManagers() const
1064  {
1065  return _relationship_managers;
1066  }
1067 
1071  void checkMetaDataIntegrity() const;
1072 
1074 
1080 
1083 
1089  virtual bool errorOnJacobianNonzeroReallocation() const { return false; }
1090 
1096  template <class T>
1097  void registerInterfaceObject(T & interface);
1098 
1104  template <class T>
1105  const std::vector<T *> & getInterfaceObjects() const;
1106 
1107  static void addAppParam(InputParameters & params);
1108  static void addInputParam(InputParameters & params);
1109 
1114  bool forceRestart() const { return _force_restart; }
1115 
1118 
1121 
1122 #ifdef MOOSE_MFEM_ENABLED
1123 
1127  void setMFEMDevice(const std::string & device_string,
1128  bool gpu_aware_mpi,
1130 
1134  std::shared_ptr<mfem::Device> getMFEMDevice(Moose::PassKey<MultiApp>) { return _mfem_device; }
1135 
1139  const std::set<std::string> & getMFEMDevices(Moose::PassKey<MultiApp>) const;
1140 #endif
1141 
1149  bool isKokkosAvailable() const
1150  {
1151 #ifdef MOOSE_KOKKOS_ENABLED
1152 #ifdef MOOSE_ENABLE_KOKKOS_GPU
1153  return _has_kokkos_gpus;
1154 #else
1155  return true;
1156 #endif
1157 #else
1158  return false;
1159 #endif
1160  }
1161 
1162 #ifdef MOOSE_KOKKOS_ENABLED
1163 
1168  void allocateKokkosMemoryPool(std::size_t size, unsigned int ways) const;
1169 
1175 #endif
1176 
1180  static bool isRelocated();
1181 
1185  static bool isInTree();
1186 
1187 protected:
1188 #ifdef MOOSE_UNIT_TEST
1189  FRIEND_TEST(::CapabilitiesTest, mooseAppAddBoolCapability);
1190  FRIEND_TEST(::CapabilitiesTest, mooseAppAddIntCapability);
1191  FRIEND_TEST(::CapabilitiesTest, mooseAppAddStringCapability);
1192  FRIEND_TEST(::CapabilitiesTest, mooseAppAddCapability);
1193 #endif
1194 
1198  void dynamicRegistration(const libMesh::Parameters & params);
1199 
1204  void loadLibraryAndDependencies(const std::string & library_filename,
1205  const libMesh::Parameters & params,
1206  bool load_dependencies = true);
1207 
1210 
1220  void registerRestartableNameWithFilter(const std::string & name,
1221  Moose::RESTARTABLE_FILTER filter);
1222 
1227  void errorCheck();
1228 
1233  void outputMachineReadableData(const std::string & param,
1234  const std::string & start_marker,
1235  const std::string & end_marker,
1236  const std::string & data) const;
1237 
1246  static Moose::Capability & addBoolCapability(const std::string_view capability,
1247  const bool value,
1248  const std::string_view doc);
1249 
1258  static Moose::Capability &
1259  addIntCapability(const std::string_view capability, const int value, const std::string_view doc);
1260 
1269  static Moose::Capability & addStringCapability(const std::string_view capability,
1270  const std::string_view value,
1271  const std::string_view doc);
1272 
1286  static Moose::Capability & addCapability(const std::string_view capability,
1287  const Moose::Capability::Value & value,
1288  const std::string_view doc);
1289 
1291  const std::string _type;
1292 
1294  const std::shared_ptr<libMesh::Parallel::Communicator> _comm;
1295 
1297  std::string _output_file_base;
1298 
1301 
1304 
1307 
1310 
1313 
1316 
1319 
1322  std::unique_ptr<InputParameterWarehouse> _input_parameter_warehouse;
1323 
1326 
1329 
1332 
1334  const std::shared_ptr<Parser> _parser;
1335 
1337  const std::shared_ptr<CommandLine> _command_line;
1338 
1341 
1344 
1346  std::vector<RestartableDataMap> _restartable_data;
1347 
1353 
1356 
1359 
1362 
1364  std::shared_ptr<Executioner> _executioner;
1365 
1367  std::shared_ptr<Executor> _executor;
1368 
1370  std::map<std::string, std::shared_ptr<Executor>> _executors;
1371 
1374  std::unordered_map<std::string, std::pair<std::string, std::unique_ptr<InputParameters>>>
1376 
1380 
1383  const bool _use_executor;
1384 
1386  std::shared_ptr<NullExecutor> _null_executor;
1387 
1390 
1393 
1396  {
1401 
1403 
1407  std::string _early_exit_param;
1411 
1414 
1416  std::shared_ptr<libMesh::ExodusII_IO> _ex_reader;
1417 
1420 
1422  bool _recover;
1423 
1425  bool _restart;
1426 
1429 
1431  const bool _use_split;
1432 
1434  const bool _force_restart;
1435 
1438 
1441 
1445  const bool _test_restep;
1446 
1448  std::map<std::string, unsigned int> _output_file_numbers;
1449 
1451  const bool _check_input;
1452 
1454  std::set<std::shared_ptr<RelationshipManager>> _relationship_managers;
1455 
1457  std::map<Moose::RelationshipManagerType, std::set<const RelationshipManager *>>
1459 
1464  std::unordered_map<RelationshipManager *, std::shared_ptr<libMesh::GhostingFunctor>>
1466 
1468  {
1470  std::string full_path;
1471  std::unordered_set<std::string> entry_symbols;
1472  };
1473 
1475  std::unordered_map<std::string, DynamicLibraryInfo> _lib_handles;
1476 
1477 private:
1486  void recursivelyCreateExecutors(const std::string & current_executor_name,
1487  std::list<std::string> & possible_roots,
1488  std::list<std::string> & current_branch);
1489 
1500  void removeRelationshipManager(std::shared_ptr<RelationshipManager> relationship_manager);
1501 
1502 #ifdef MOOSE_LIBTORCH_ENABLED
1503 
1509  torch::DeviceType determineLibtorchDeviceType(const MooseEnum & device) const;
1510 #endif
1511 
1515  {
1517  };
1518 
1519  template <class T>
1521  {
1522  std::vector<T *> _objects;
1523  };
1525 
1550  void createMinimalApp();
1551 
1556  void setCheckUnusedFlag(bool warn_is_error = false);
1557 
1565  bool hasRMClone(const RelationshipManager & template_rm, const MeshBase & mesh) const;
1566 
1571  RelationshipManager & getRMClone(const RelationshipManager & template_rm,
1572  const MeshBase & mesh) const;
1573 
1585  MooseMesh & moose_mesh,
1586  MeshBase & mesh,
1587  const libMesh::DofMap * dof_map = nullptr);
1588 
1596 
1604 
1609  bool showInputs() const;
1610 
1614  virtual std::string getInstallableInputs() const;
1615 
1622  bool copyInputs();
1623 
1629  bool runInputs();
1630 
1639  void requestCitations();
1640 
1646  void collectCitations(std::map<std::string, std::string> & citations) const;
1647 
1658  static Moose::Capability & addCapabilityInternal(const std::string_view capability,
1659  const Moose::Capability::Value & value,
1660  const std::string_view doc);
1661 
1663  std::unordered_map<RestartableDataMapName, std::pair<RestartableDataMap, std::string>>
1665 
1668  {
1671  };
1672 
1674  std::unique_ptr<TheWarehouse> _the_warehouse;
1675 
1677  const unsigned int _multiapp_level;
1678 
1680  const unsigned int _multiapp_number;
1681 
1683  const bool _use_master_mesh;
1684 
1686  const MooseMesh * const _master_mesh;
1687 
1690 
1693 
1696 
1698 
1707 
1709  std::streambuf * _output_buffer_cache;
1710 
1713 
1715  bool _cpu_profiling = false;
1716 
1718  bool _heap_profiling = false;
1719 
1722  std::map<const RelationshipManager *,
1723  std::map<const MeshBase *, std::unique_ptr<RelationshipManager>>>
1725 
1727  std::map<std::type_index, std::unique_ptr<InterfaceRegistryObjectsBase>> _interface_registry;
1728 
1733  std::unique_ptr<Backup> * const _initial_backup;
1734 
1737 
1740 
1741 #ifdef MOOSE_LIBTORCH_ENABLED
1742  const torch::DeviceType _libtorch_device;
1744 #endif
1745 
1746 #ifdef MOOSE_MFEM_ENABLED
1747  std::shared_ptr<mfem::Device> _mfem_device;
1749 
1751  std::set<std::string> _mfem_devices;
1752 #endif
1753 
1754  // Allow FEProblemBase to set the recover/restart state, so make it a friend
1755  friend class FEProblemBase;
1756  friend class Restartable;
1757  friend class SubProblem;
1758 
1759 #ifdef MOOSE_KOKKOS_ENABLED
1760 
1763  void queryKokkosGPUs();
1764 
1769 
1773  bool _has_kokkos_gpus = false;
1774 #endif
1775 };
1776 
1777 template <class T>
1778 void
1780 {
1781  static_assert(!std::is_base_of<MooseObject, T>::value, "T is not an interface");
1782 
1784  auto it = _interface_registry.find(typeid(T));
1785  if (it == _interface_registry.end())
1786  {
1787  auto new_registry = std::make_unique<InterfaceRegistryObjects<T>>();
1788  registry = new_registry.get();
1789  _interface_registry.emplace(typeid(T), std::move(new_registry));
1790  }
1791  else
1792  registry = static_cast<InterfaceRegistryObjects<T> *>(it->second.get());
1793 
1794  mooseAssert(std::count(registry->_objects.begin(), registry->_objects.end(), &interface) == 0,
1795  "Interface already registered");
1796  registry->_objects.push_back(&interface);
1797 }
1798 
1799 template <class T>
1800 const std::vector<T *> &
1802 {
1803  static_assert(!std::is_base_of<MooseObject, T>::value, "T is not an interface");
1804 
1805  const auto it = _interface_registry.find(typeid(T));
1806  if (it != _interface_registry.end())
1807  return static_cast<InterfaceRegistryObjects<T> *>(it->second.get())->_objects;
1808  const static std::vector<T *> empty;
1809  return empty;
1810 }
1811 
1812 #ifdef MOOSE_MFEM_ENABLED
1813 inline const std::set<std::string> &
1815 {
1816  return _mfem_devices;
1817 }
1818 #endif
std::list< std::string > getCheckpointFiles() const
Extract all possible checkpoint file names.
Definition: MooseApp.C:2388
virtual bool constructingMeshGenerators() const
Whether this app is constructing mesh generators.
Definition: MooseApp.C:3493
std::list< std::string > getCheckpointDirectories() const
Get all checkpoint directories.
Definition: MooseApp.C:2356
bool _use_eigen_value
Boolean to indicate whether to use an eigenvalue executioner.
Definition: MooseApp.h:1392
static const std::string & checkpointSuffix()
The file suffix for the checkpoint mesh.
Definition: MooseApp.C:3038
std::string getFileName(bool stripLeadingPath=true) const
Return the primary (first) filename that was parsed Note: When stripLeadingPath is false...
Definition: MooseApp.C:2402
void collectCitations(std::map< std::string, std::string > &citations) const
Collects the BibTeX citations for the modules/objects constructed in this app and the finite element ...
Definition: MooseApp.C:2100
void addExecutorParams(const std::string &type, const std::string &name, const InputParameters &params)
Adds the parameters for an Executor to the list of parameters.
Definition: MooseApp.C:1870
bool defaultAutomaticScaling() const
Whether to enable automatic scaling by default.
Definition: MooseApp.h:1055
bool & useNonlinear()
Returns a writable Boolean indicating whether this app will use a Nonlinear or Eigen System...
Definition: MooseApp.h:397
virtual std::string getPrintableName() const
Get printable name of the application.
Definition: MooseApp.h:148
virtual std::string getInstallableInputs() const
Method to retrieve the installable inputs from a given applications <app>Revision.h file.
Definition: MooseApp.C:2202
static bool isRelocated()
Definition: MooseApp.C:3611
PerfGraph & _perf_graph
The PerfGraph object for this application (recoverable)
Definition: MooseApp.h:1355
const std::set< std::string > & getMFEMDevices(Moose::PassKey< MultiApp >) const
Get the configured MFEM devices.
Definition: MooseApp.h:1814
void setOutputPosition(const Point &p)
Tell the app to output in a specific position.
Definition: MooseApp.C:2345
bool hasMeshGenerator(const MeshGeneratorName &name) const
Definition: MooseApp.h:912
std::vector< std::string > sub_transformed_vars
The names of variables to transform for fixed point solve algorithms (e.g. secant, etc.).
Definition: MooseApp.h:131
const std::string _type
The string representation of the type of this object as registered (see registerApp(AppName)) ...
Definition: MooseApp.h:1291
A MultiMooseEnum object to hold "execute_on" flags.
Definition: ExecFlagEnum.h:21
const bool _check_input
true if we want to just check the input file
Definition: MooseApp.h:1451
void setExecutioner(std::shared_ptr< Executioner > &&executioner)
Set the Executioner for this App.
Definition: MooseApp.h:349
std::unordered_map< std::string, std::pair< std::string, std::unique_ptr< InputParameters > > > _executor_params
Used in building the Executors Maps the name of the Executor block to the <type, params> ...
Definition: MooseApp.h:1375
A class for creating restricted objects.
Definition: Restartable.h:28
bool isUltimateMaster() const
Whether or not this app is the ultimate master app.
Definition: MooseApp.h:866
bool _initial_from_file
This variable indicates when a request has been made to restart from an Exodus file.
Definition: MooseApp.h:1413
Stores configuration options relating to the fixed-point solving capability.
Definition: MooseApp.h:125
Storage container for all InputParamter objects.
const MeshGenerator & getMeshGenerator(const std::string &name) const
Definition: MooseApp.h:920
std::map< Moose::RelationshipManagerType, std::set< const RelationshipManager * > > _attached_relationship_managers
The relationship managers that have been attached (type -> RMs)
Definition: MooseApp.h:1458
auto getRestartableDataMapBegin()
Iterator based access to the extra RestartableDataMap objects; see Checkpoint.C for use case...
Definition: MooseApp.h:1079
Reader for restartable data written by the RestartableDataWriter.
std::string _restart_recover_base
The base name to restart/recover from. If blank then we will find the newest checkpoint file...
Definition: MooseApp.h:1440
void dynamicRegistration(const libMesh::Parameters &params)
Helper method for dynamic loading of objects.
Definition: MooseApp.C:2666
bool hasRestartableMetaData(const std::string &name, const RestartableDataMapName &metaname) const
Definition: MooseApp.C:2500
std::vector< PostprocessorName > sub_transformed_pps
The names of postprocessors to transform for fixed point solve algorithms (e.g. secant, etc.).
Definition: MooseApp.h:133
virtual void setupOptions()
Setup options based on InputParameters.
Definition: MooseApp.C:1024
PerfGraph & createRecoverablePerfGraph()
Creates a recoverable PerfGraph.
Definition: MooseApp.C:3462
std::string libNameToAppName(const std::string &library_name) const
Converts a library name to an application name:
Definition: MooseApp.C:2436
RelationshipManagerType
Main types of Relationship Managers.
Definition: MooseTypes.h:1012
const std::shared_ptr< Parser > _parser
Parser for parsing the input file (owns the root hit node)
Definition: MooseApp.h:1334
std::string getFrameworkVersion() const
Returns the framework version.
Definition: MooseApp.C:1006
Base class for everything in MOOSE with a name and a type.
Definition: MooseBase.h:49
void setRecover(bool value)
Definition: MooseApp.C:2884
std::vector< std::pair< std::string, std::string > > getRelationshipManagerInfo() const
Returns the Relationship managers info suitable for printing.
Definition: MooseApp.C:3318
void setExecutor(std::shared_ptr< Executor > &&executor)
Definition: MooseApp.h:350
Real _global_time_offset
Offset of the local App time to the "global" problem time.
Definition: MooseApp.h:1315
bool _mesh_changed_for_backup
Whether mesh topology has changed and should be included in Backup objects.
Definition: MooseApp.h:1739
bool hasOutputPosition() const
Whether or not an output position has been set.
Definition: MooseApp.h:282
FRIEND_TEST(::CapabilitiesTest, mooseAppAddBoolCapability)
bool hasRMClone(const RelationshipManager &template_rm, const MeshBase &mesh) const
Definition: MooseApp.C:3069
torch::DeviceType determineLibtorchDeviceType(const MooseEnum &device) const
Function to determine the device which should be used by libtorch on this application.
Definition: MooseApp.C:3501
bool _file_base_set_by_user
Whether or not file base is set through input or setOutputFileBase by MultiApp.
Definition: MooseApp.h:1300
const std::vector< RestartableDataMap > & getRestartableData() const
Return reference to the restartable data object.
Definition: MooseApp.h:693
bool _output_position_set
Whether or not an output position has been set for this app.
Definition: MooseApp.h:1303
Generic factory class for build all sorts of objects.
Definition: Factory.h:28
const std::map< std::string, unsigned int > & getOutputFileNumbers() const
Store a map of outputter names and file numbers The MultiApp system requires this to get the file num...
Definition: MooseApp.h:552
std::unique_ptr< TheWarehouse > _the_warehouse
The combined warehouse for storing any MooseObject based object.
Definition: MooseApp.h:1674
void setCheckUnusedFlag(bool warn_is_error=false)
Set a flag so that the parser will either warn or error when unused variables are seen after parsing ...
Definition: MooseApp.C:1839
std::shared_ptr< CommandLine > commandLine() const
Get the command line.
Definition: MooseApp.h:424
std::vector< std::string > getMeshGeneratorNames() const
Definition: MooseApp.h:938
bool hasInitialBackup() const
Definition: MooseApp.h:1047
static Moose::ParameterRegistry & registry
static std::filesystem::path metaDataFolderBase(const std::filesystem::path &folder_base, const std::string &map_suffix)
The file suffix for meta data (header and data)
Definition: MooseApp.C:3045
InputParameterWarehouse & getInputParameterWarehouse()
Get the InputParameterWarehouse for MooseObjects.
Definition: MooseApp.C:2866
const ExecFlagEnum & getExecuteOnEnum() const
Return the app level ExecFlagEnum, this contains all the available flags for the app.
Definition: MooseApp.h:1040
bool _use_nonlinear
Boolean to indicate whether to use a Nonlinear or EigenSystem (inspected by actions) ...
Definition: MooseApp.h:1389
static const RestartableDataMapName MESH_META_DATA
Definition: MooseApp.h:136
std::unordered_map< RestartableDataMapName, std::pair< RestartableDataMap, std::string > > _restartable_meta_data
General storage for custom RestartableData that can be added to from outside applications.
Definition: MooseApp.h:1664
FixedPointConfig & fixedPointConfig()
This info is stored here because we need a "globalish" place to put it in order to allow communicatio...
Definition: MooseApp.h:392
virtual std::string appBinaryName() const
Definition: MooseApp.h:150
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
std::string getOutputFileBase(bool for_non_moose_build_output=false) const
Get the output file base name.
Definition: MooseApp.C:1531
const bool _use_master_mesh
Whether to use the parent app mesh for this app.
Definition: MooseApp.h:1683
static void addInputParam(InputParameters &params)
Definition: MooseApp.C:271
RelationshipManager & getRMClone(const RelationshipManager &template_rm, const MeshBase &mesh) const
Return the relationship manager clone originally created from the provided template relationship mana...
Definition: MooseApp.C:3077
void deallocateKokkosMemoryPool()
Deallocate Kokkos memory pool.
bool runInputs()
Handles the run input parameter logic: Checks to see whether a directory exists in user space and lau...
Definition: MooseApp.C:2273
void registerRestartableNameWithFilter(const std::string &name, Moose::RESTARTABLE_FILTER filter)
NOTE: This is an internal function meant for MOOSE use only!
Definition: MooseApp.C:1700
virtual void run()
Run the application.
Definition: MooseApp.C:2026
void removeRelationshipManager(std::shared_ptr< RelationshipManager > relationship_manager)
Purge this relationship manager from meshes and DofMaps and finally from us.
Definition: MooseApp.C:3092
std::unique_ptr< libMesh::MeshBase > getSavedMesh(const std::string &name)
Get the saved mesh by name.
Real _start_time
The time at which to start the simulation.
Definition: MooseApp.h:1312
void createExecutors()
After adding all of the Executor Params - this function will actually cause all of them to be built...
Definition: MooseApp.C:1943
void markMeshChangedForBackup()
Mark this app as requiring mesh topology data in its next Backup object.
Definition: MooseApp.h:755
void recursivelyCreateExecutors(const std::string &current_executor_name, std::list< std::string > &possible_roots, std::list< std::string > &current_branch)
Internal function used to recursively create the executor objects.
Definition: MooseApp.C:1891
Builds lists and maps that help in knowing which physical hardware nodes each rank is on...
Definition: RankMap.h:23
std::vector< std::string > getMeshGeneratorNames() const
Get names of all mesh generators Note: This function should be called after all mesh generators are a...
bool forceRestart() const
Whether or not we are forcefully restarting (allowing the load of potentially incompatibie checkpoint...
Definition: MooseApp.h:1114
std::filesystem::path restartFolderBase(const std::filesystem::path &folder_base) const
The file suffix for restartable data.
Definition: MooseApp.C:3053
const bool _use_split
Whether or not we are using a (pre-)split mesh (automatically DistributedMesh)
Definition: MooseApp.h:1431
unsigned int multiAppLevel() const
The MultiApp Level.
Definition: MooseApp.h:855
bool hasRelationshipManager(const std::string &name) const
Returns a Boolean indicating whether a RelationshipManater exists with the same name.
Definition: MooseApp.C:2964
Base class for MOOSE-based applications.
Definition: MooseApp.h:109
virtual ~MooseApp()
Storage for action instances.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
const std::vector< std::shared_ptr< RelationshipManager > > & getReleationshipManagers()
Retrieve the relationship managers.
static bool isInTree()
Definition: MooseApp.C:3617
static Moose::Capability & addCapability(const std::string_view capability, const Moose::Capability::Value &value, const std::string_view doc)
Deprecated method for adding a capability.
Definition: MooseApp.C:3594
bool hasRestartableDataMap(const RestartableDataMapName &name) const
Definition: MooseApp.C:3437
void restoreMeshFromInitialBackup(MooseMesh &mesh)
Restore mesh from this app&#39;s initial Backup object and consume the mesh checkpoint entries...
Definition: MooseApp.C:1748
std::set< std::string > _mfem_devices
MFEM supported devices based on user-provided config.
Definition: MooseApp.h:1751
Syntax _syntax
Syntax of the input file.
Definition: MooseApp.h:1318
Syntax & syntax()
Returns a writable reference to the syntax object.
Definition: MooseApp.h:231
std::map< std::string, std::shared_ptr< Executor > > _executors
Pointers to all of the Executors for this run.
Definition: MooseApp.h:1370
std::vector< std::filesystem::path > writeRestartableMetaData(const RestartableDataMapName &name, const std::filesystem::path &folder_base)
Writes the restartable meta data for name with a folder base of folder_base.
Definition: MooseApp.C:2551
const bool _test_restep
Whether or not this simulation should fail its middle timestep and repeat (for testing) ...
Definition: MooseApp.h:1445
bool _trap_fpe
Whether or not FPE trapping should be turned on.
Definition: MooseApp.h:1437
int exitCode() const
Get the shell exit code for the application.
Definition: MooseApp.h:163
processor_id_type processor_id() const
Returns the MPI processor ID of the current processor.
Definition: MooseApp.h:417
Real getStartTime() const
Definition: MooseApp.h:306
The following methods are specializations for using the libMesh::Parallel::packed_range_* routines fo...
std::map< std::string, unsigned int > _output_file_numbers
Map of outputer name and file number (used by MultiApps to propagate file numbers down through the mu...
Definition: MooseApp.h:1448
const hit::Node * getCurrentActionHitNode() const
Definition: MooseApp.C:3061
ActionWarehouse _action_warehouse
Where built actions are stored.
Definition: MooseApp.h:1328
RestartableDataReader _rd_reader
Definition: MooseApp.h:1697
void checkMetaDataIntegrity() const
Function to check the integrity of the restartable meta data structure.
Definition: MooseApp.C:3394
static InputParameters validParams()
Definition: MooseApp.C:278
bool isRestarting() const
Whether or not this is a "restart" calculation.
Definition: MooseApp.C:1674
unsigned int multiAppNumber() const
The MultiApp number.
Definition: MooseApp.h:861
bool isSplitMesh() const
Whether or not this is a split mesh operation.
Definition: MooseApp.C:1680
RestartableDataMap & getRestartableDataMap(const RestartableDataMapName &name)
Return a reference to restartable data for the specific type flag.
Definition: MooseApp.C:3426
bool restoredInitialBackupMesh() const
Whether this app has restored mesh topology from its initial Backup object.
Definition: MooseApp.h:750
ActionFactory & getActionFactory()
Retrieve a writable reference to the ActionFactory associated with this App.
Definition: MooseApp.h:412
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
class GTEST_TEST_CLASS_NAME_(CapabilitiesTest, mooseAppAddBoolCapability)
SolutionInvalidity & _solution_invalidity
The SolutionInvalidity object for this application.
Definition: MooseApp.h:1358
std::unordered_map< RelationshipManager *, std::shared_ptr< libMesh::GhostingFunctor > > _undisp_to_disp_rms
A map from undisplaced relationship managers to their displaced clone (stored as the base GhostingFun...
Definition: MooseApp.h:1465
std::shared_ptr< libMesh::ExodusII_IO > _ex_reader
The Exodus reader when _initial_from_file is set to true.
Definition: MooseApp.h:1416
FEProblemBase & feProblem() const
Definition: MooseApp.C:1851
Factory & getFactory()
Retrieve a writable reference to the Factory associated with this App.
Definition: MooseApp.h:407
MooseApp(const InputParameters &parameters)
Constructor is protected so that this object is constructed through the AppFactory object...
Definition: MooseApp.C:624
std::optional< MooseEnum > getComputeDevice() const
Get the device accelerated computations are supposed to be running on.
std::vector< RestartableDataMap > _restartable_data
Where the restartable data is held (indexed on tid)
Definition: MooseApp.h:1346
RelationshipManager & createRMFromTemplateAndInit(const RelationshipManager &template_rm, MooseMesh &moose_mesh, MeshBase &mesh, const libMesh::DofMap *dof_map=nullptr)
Take an input relationship manager, clone it, and then initialize it with provided mesh and optional ...
Definition: MooseApp.C:3134
void setOutputFileBase(const std::string &output_file_base)
Override the selection of the output file base name.
Definition: MooseApp.C:1540
std::string getRecoverFileBase() const
Definition: MooseApp.h:501
const RankMap _rank_map
The RankMap is a useful object for determining how the processes are laid out on the physical hardwar...
Definition: MooseApp.h:1361
This class wraps provides and tracks access to command line parameters.
Definition: CommandLine.h:29
const bool _test_checkpoint_half_transient
Whether or not this simulation should only run half its transient (useful for testing recovery) ...
Definition: MooseApp.h:1443
void addMeshGenerator(const std::string &type, const std::string &name, const InputParameters &params)
Add a mesh generator that will act on the meshes in the system.
int _exit_code
The exit code.
Definition: MooseApp.h:1410
SystemInfo _sys_info
System Information.
Definition: MooseApp.h:1340
Storage for restartable data that is ordered based on insertion order.
bool checkInput() const
Returns whether the Application is running in check input mode.
Definition: MooseApp.h:976
const MeshGenerator & appendMeshGenerator(const std::string &type, const std::string &name, InputParameters params)
Append a mesh generator that will act on the current final mesh generator in the system.
bool getExodusFileRestart() const
Whether or not we need to use a separate Exodus reader to read the mesh BEFORE we create the mesh...
Definition: MooseApp.h:436
const RankMap & rankMap()
The RankMap is a useful object for determining how the processes are laid out on the physical nodes o...
Definition: MooseApp.h:174
std::variant< bool, int, std::string > Value
A capability can have a bool, int, or string value.
Definition: Capability.h:33
MeshGeneratorSystem _mesh_generator_system
The system that manages the MeshGenerators.
Definition: MooseApp.h:1692
void attachRelationshipManagers(Moose::RelationshipManagerType rm_type, bool attach_geometric_rm_final=false)
Attach the relationship managers of the given type Note: Geometric relationship managers that are sup...
Definition: MooseApp.C:3203
uint8_t processor_id_type
bool getDistributedMeshOnCommandLine() const
Returns true if the user specified –distributed-mesh (or –parallel-mesh, for backwards compatibilit...
Definition: MooseApp.h:466
bool _start_time_set
Whether or not an start time has been set.
Definition: MooseApp.h:1309
void setRestartRecoverFileBase(const std::string &file_base)
mutator for recover_base (set by RecoverBaseAction)
Definition: MooseApp.h:512
void possiblyLoadRestartableMetaData(const RestartableDataMapName &name, const std::filesystem::path &folder_base)
Loads the restartable meta data for name if it is available with the folder base folder_base.
Definition: MooseApp.C:2529
const std::string & name() const
Get the name of the class.
Definition: MooseBase.h:103
The Kokkos class that manages memory pool for dynamically-sized temporary arrays in Kokkos parallel f...
bool showInputs() const
Prints a message showing the installable inputs for a given application (if getInstallableInputs has ...
Definition: MooseApp.C:2170
bool addRelationshipManager(std::shared_ptr< RelationshipManager > relationship_manager)
Transfers ownership of a RelationshipManager to the application for lifetime management.
Definition: MooseApp.C:2990
RestartableDataValue & getRestartableMetaData(const std::string &name, const RestartableDataMapName &metaname, THREAD_ID tid)
Definition: MooseApp.C:2510
std::vector< RestartableDataMap > & getRestartableData()
Definition: MooseApp.h:694
std::shared_ptr< NullExecutor > _null_executor
Used to return an executor that does nothing.
Definition: MooseApp.h:1386
bool & useEigenvalue()
Returns a writable Boolean indicating whether this app will use an eigenvalue executioner.
Definition: MooseApp.h:402
const std::string & getLastInputFileName() const
Definition: MooseApp.C:1524
virtual void preBackup()
Insertion point for other apps that is called before backup()
Definition: MooseApp.h:770
void setErrorOverridden()
Set a flag so that the parser will throw an error if overridden parameters are detected.
Definition: MooseApp.C:2020
const std::set< std::shared_ptr< RelationshipManager > > & relationshipManagers() const
Return the container of relationship managers.
Definition: MooseApp.h:1063
virtual void postRestore(const bool)
Insertion point for other apps that is called after restore()
Definition: MooseApp.h:804
void loadLibraryAndDependencies(const std::string &library_filename, const libMesh::Parameters &params, bool load_dependencies=true)
Recursively loads libraries and dependencies in the proper order to fully register a MOOSE applicatio...
Definition: MooseApp.C:2679
bool _restart
Whether or not this is a restart run.
Definition: MooseApp.h:1425
Real value(unsigned n, unsigned alpha, unsigned beta, Real x)
std::unique_ptr< Backup > backup()
Backs up the application memory in a Backup.
Definition: MooseApp.C:1726
Generic AppFactory class for building Application objects.
Definition: AppFactory.h:54
RESTARTABLE_FILTER
The filter type applied to a particular piece of "restartable" data.
Definition: MooseTypes.h:840
Moose::Builder & builder()
Returns a writable reference to the builder.
Definition: MooseApp.h:226
bool unusedFlagIsError() const
Returns whether the flag for unused parameters is set to throw an error.
Definition: MooseApp.h:1120
void mooseDeprecated(Args &&... args) const
Emits a deprecation warning prefixed with the object name and type, and a stack trace.
Definition: MooseBase.h:327
std::string getLatestCheckpointFilePrefix(const std::list< std::string > &checkpoint_files)
Definition: MooseUtils.C:819
void setExodusFileRestart(bool flag)
Set the flag to indicate whether or not we need to use a separate Exodus reader to read the mesh BEFO...
Definition: MooseApp.h:430
bool _has_kokkos_gpus
Flag whether every process has an associated Kokkos GPU.
Definition: MooseApp.h:1773
std::map< std::type_index, std::unique_ptr< InterfaceRegistryObjectsBase > > _interface_registry
Registration for interface objects.
Definition: MooseApp.h:1727
SolutionInvalidity & solutionInvalidity()
Get the SolutionInvalidity for this app.
Definition: MooseApp.h:185
RestartableDataValue & registerRestartableData(std::unique_ptr< RestartableDataValue > data, THREAD_ID tid, bool read_only, const RestartableDataMapName &metaname="")
Definition: MooseApp.C:2448
std::unique_ptr< MeshBase > getMeshGeneratorMesh()
Definition: MooseApp.h:928
void queryKokkosGPUs()
Query the Kokkos GPUs in the system and check whether every process has an associated GPU...
Specialized factory for generic Action System objects.
Definition: ActionFactory.h:48
void setMFEMDevice(const std::string &device_string, bool gpu_aware_mpi, Moose::PassKey< MFEMProblemSolve >)
Create/configure the MFEM device with the provided device_string.
Definition: MooseApp.C:3624
void setRestart(bool value)
Sets the restart/recover flags.
Definition: MooseApp.C:2878
TheWarehouse is a container for MooseObjects that allows querying/filtering over various customizeabl...
Definition: TheWarehouse.h:186
std::shared_ptr< Executioner > _executioner
Pointer to the executioner of this run (typically build by actions)
Definition: MooseApp.h:1364
torch::DeviceType getLibtorchDevice() const
Get the device torch is supposed to be running on.
Definition: MooseApp.h:117
void setOutputFileNumbers(const std::map< std::string, unsigned int > &numbers)
Store a map of outputter names and file numbers The MultiApp system requires this to get the file num...
Definition: MooseApp.h:540
static Moose::Capability & addIntCapability(const std::string_view capability, const int value, const std::string_view doc)
Register an integer capability.
Definition: MooseApp.C:3578
MooseMesh wraps a libMesh::Mesh object and enhances its capabilities by caching additional data and s...
Definition: MooseMesh.h:93
ActionFactory _action_factory
The Factory responsible for building Actions.
Definition: MooseApp.h:1325
const unsigned int _multiapp_number
Numbering in all the sub-apps on the same level.
Definition: MooseApp.h:1680
An entry for a single capability.
Definition: Capability.h:29
const std::string & type() const
Get the type of this class.
Definition: MooseBase.h:93
void restoreFromInitialBackup(const bool for_restart)
Restores from a "initial" backup, that is, one set in _initial_backup.
Definition: MooseApp.C:1799
const ActionWarehouse & actionWarehouse() const
Return a const reference to the ActionWarehouse associated with this app.
Definition: MooseApp.h:221
const Parser & parser() const
Definition: MooseApp.C:1878
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:54
bool isKokkosAvailable() const
Get whether Kokkos is available.
Definition: MooseApp.h:1149
ActionWarehouse & actionWarehouse()
Return a writable reference to the ActionWarehouse associated with this app.
Definition: MooseApp.h:217
RegistrationType
Enumeration for holding the valid types of dynamic registrations allowed.
Definition: MooseApp.h:1667
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:30
enum MooseApp::UNUSED_CHECK _enable_unused_check
bool _recover
Whether or not this is a recovery run.
Definition: MooseApp.h:1422
Point _output_position
The output position.
Definition: MooseApp.h:1306
const MooseMesh * masterMesh() const
Returns a pointer to the master mesh.
Definition: MooseApp.h:876
bool testReStep() const
Whether or not this simulation should fail a timestep and repeat (for testing).
Definition: MooseApp.h:530
bool testCheckpointHalfTransient() const
Whether or not this simulation should only run half its transient (useful for testing recovery) ...
Definition: MooseApp.h:524
const std::shared_ptr< CommandLine > _command_line
The CommandLine object.
Definition: MooseApp.h:1337
libMesh::ExodusII_IO * getExReaderForRestart() const
Get the Exodus reader to restart variables from an Exodus mesh file.
Definition: MooseApp.h:449
bool _error_overridden
Indicates whether warnings or errors are displayed when overridden parameters are detected...
Definition: MooseApp.h:1405
virtual std::string getVersion() const
Returns the current version of the framework or application (default: framework version).
Definition: MooseApp.C:1012
SolutionInvalidity & createRecoverableSolutionInvalidity()
Creates a recoverable SolutionInvalidity.
Definition: MooseApp.C:3480
bool _heap_profiling
Memory profiling.
Definition: MooseApp.h:1718
const MooseMesh *const _master_displaced_mesh
The displaced mesh from master app.
Definition: MooseApp.h:1689
Class for storing and utilizing output objects.
Interface for objects interacting with the PerfGraph.
const bool _force_restart
Whether or not we are forcefully attempting to load checkpoints (–force-restart) ...
Definition: MooseApp.h:1434
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
Definition: MooseApp.C:2014
std::set< std::string > getLibrarySearchPaths(const std::string &library_path_from_param) const
Return the paths searched by MOOSE when loading libraries.
Definition: MooseApp.C:2840
void setGlobalTimeOffset(Real offset)
Each App has it&#39;s own local time.
Definition: MooseApp.h:312
The SolutionInvalidity will contain all the information about the occurrence(s) of solution invalidit...
std::unordered_map< std::string, DynamicLibraryInfo > _lib_handles
The library archive (name only), registration method and the handle to the method.
Definition: MooseApp.h:1475
void outputMachineReadableData(const std::string &param, const std::string &start_marker, const std::string &end_marker, const std::string &data) const
Outputs machine readable data (JSON, YAML, etc.) either to the screen (if no filename was provided as...
Definition: MooseApp.C:3543
Point getOutputPosition() const
Get the output position.
Definition: MooseApp.h:288
Definition: Moose.h:46
const MeshGenerator & appendMeshGenerator(const std::string &type, const std::string &name, InputParameters params)
Append a mesh generator that will act on the final mesh generator in the system.
Definition: MooseApp.h:953
bool meshChangedForBackup() const
Whether this app requires mesh topology data in its next Backup object.
Definition: MooseApp.h:760
static std::string mainMeshGeneratorName()
The name reserved for the "main" mesh generator which is the one used for the numerical solver downst...
const std::string & getRestartableDataMapName(const RestartableDataMapName &name) const
Definition: MooseApp.C:3453
FixedPointConfig _fixed_point_config
Multiapp-related fixed point algorithm configuration details primarily intended to be passed to and u...
Definition: MooseApp.h:1379
bool restoreDataIfAvailable(RestartableDataValue &value, const THREAD_ID tid, Moose::PassKey< MooseApp >)
Restores value in place from the open reader if it is present in the checkpoint and has not yet been ...
const ExecFlagEnum _execute_flags
Execution flags for this App.
Definition: MooseApp.h:1706
UNUSED_CHECK
Indicates whether warnings, errors, or no output is displayed when unused parameters are detected...
Definition: MooseApp.h:1395
bool hasRecoverFileBase() const
Definition: MooseApp.C:1692
std::map< const RelationshipManager *, std::map< const MeshBase *, std::unique_ptr< RelationshipManager > > > _template_to_clones
Map from a template relationship manager to a map in which the key-value pairs represent the MeshBase...
Definition: MooseApp.h:1724
const MooseMesh * masterDisplacedMesh() const
Returns a pointer to the master displaced mesh.
Definition: MooseApp.h:881
bool hasRestartRecoverFileBase() const
Return true if the recovery file base is set.
Definition: MooseApp.C:1686
void registerRestartableDataMapName(const RestartableDataMapName &name, std::string suffix="")
Reserve a location for storing custom RestartableDataMap objects.
Definition: MooseApp.C:3443
void restore(const std::filesystem::path &folder_base, const bool for_restart)
Restore an application from file.
Definition: MooseApp.C:1755
void loadRestartableMetaData(const std::filesystem::path &folder_base)
Loads all available restartable meta data if it is available with the folder base folder_base...
Definition: MooseApp.C:2544
const bool _distributed_mesh_on_command_line
This variable indicates that DistributedMesh should be used for the libMesh mesh underlying MooseMesh...
Definition: MooseApp.h:1419
ChainControlDataSystem _chain_control_system
The system that manages the ChainControls.
Definition: MooseApp.h:1695
bool restoreDataIfAvailable(RestartableDataValue &value, const THREAD_ID tid, Moose::PassKey< ReporterData >)
Restores value in place from the checkpoint reader if it is present in the checkpoint and has not yet...
Definition: MooseApp.h:839
const SystemInfo & getSystemInfo() const
Get SystemInfo object.
Definition: MooseApp.h:567
virtual void executeExecutioner()
Execute the Executioner that was built.
Definition: MooseApp.C:1636
Real sub_relaxation_factor
relaxation factor to be used for a MultiApp&#39;s subapps.
Definition: MooseApp.h:129
void addExecutor(const std::string &type, const std::string &name, const InputParameters &params)
Definition: MooseApp.C:1858
const unsigned int _multiapp_level
Level of multiapp, the master is level 0. This used by the Console to indent output.
Definition: MooseApp.h:1677
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
RelationshipManagers are used for describing what kinds of non-local resources are needed for an obje...
NullExecutor * getNullExecutor() const
Definition: MooseApp.h:342
Generic class for solving transient nonlinear problems.
Definition: SubProblem.h:78
bool getFPTrapFlag() const
Returns whether FPE trapping is turned on (either because of debug or user requested) ...
Definition: MooseApp.h:979
Moose::Builder _builder
Builder for building app related parser tree.
Definition: MooseApp.h:1343
const torch::DeviceType _libtorch_device
The libtorch device this app is using (converted from compute_device)
Definition: MooseApp.h:1743
static Moose::Capability & addStringCapability(const std::string_view capability, const std::string_view value, const std::string_view doc)
Register a string capability.
Definition: MooseApp.C:3586
void addMeshGenerator(const std::string &type, const std::string &name, const InputParameters &params)
Add a mesh generator that will act on the meshes in the system.
Definition: MooseApp.h:902
std::string RestartableDataMapName
Definition: MooseTypes.h:242
std::set< std::shared_ptr< RelationshipManager > > _relationship_managers
The relationship managers that have been added.
Definition: MooseApp.h:1454
OutputWarehouse _output_warehouse
OutputWarehouse object for this App.
Definition: MooseApp.h:1331
std::string _output_file_base
The output file basename.
Definition: MooseApp.h:1297
std::streambuf * _output_buffer_cache
Cache output buffer so the language server can turn it off then back on.
Definition: MooseApp.h:1709
bool _restored_initial_backup_mesh
Whether mesh topology has been restored from the initial Backup object.
Definition: MooseApp.h:1736
static void addAppParam(InputParameters &params)
Definition: MooseApp.C:264
bool _cpu_profiling
CPU profiling.
Definition: MooseApp.h:1715
bool unusedFlagIsWarning() const
Returns whether the flag for unused parameters is set to throw a warning only.
Definition: MooseApp.h:1117
auto getRestartableDataMapEnd()
Definition: MooseApp.h:1081
virtual void runInputFile()
Actually build everything in the input file.
Definition: MooseApp.C:1556
bool hasStartTime() const
Definition: MooseApp.h:301
System that manages ChainControls.
virtual std::string header() const
Returns a string to be printed at the beginning of a simulation.
Definition: MooseApp.C:2872
const SolutionInvalidity & solutionInvalidity() const
Definition: MooseApp.h:186
Holding syntax for parsing input files.
Definition: Syntax.h:21
bool useMasterMesh() const
Returns whether to use the parent app mesh as the mesh for this app.
Definition: MooseApp.h:871
std::unordered_set< std::string > DataNames
static Moose::Capability & addBoolCapability(const std::string_view capability, const bool value, const std::string_view doc)
Register a boolean capability.
Definition: MooseApp.C:3570
static const std::string MESH_META_DATA_SUFFIX
Definition: MooseApp.h:137
const bool _automatic_automatic_scaling
Whether to turn on automatic scaling by default.
Definition: MooseApp.h:1712
Factory _factory
Definition: MooseApp.h:1402
ChainControlDataSystem & getChainControlDataSystem()
Gets the system that manages the ChainControls.
Definition: MooseApp.h:891
std::unique_ptr< InputParameterWarehouse > _input_parameter_warehouse
Input parameter storage structure; unique_ptr so we can control its destruction order.
Definition: MooseApp.h:1322
bool hasMeshGenerator(const MeshGeneratorName &name) const
const std::vector< std::string > & getInputFileNames() const
Definition: MooseApp.C:1517
const std::vector< T * > & getInterfaceObjects() const
Gets the registered interface objects for a given interface.
Definition: MooseApp.h:1801
TheWarehouse & theWarehouse()
Definition: MooseApp.h:143
const MeshGenerator & getMeshGenerator(const std::string &name) const
std::unique_ptr< Backup > finalizeRestore()
Finalizes (closes) the restoration process done in restore().
Definition: MooseApp.C:1806
System that manages MeshGenerators.
const Moose::Kokkos::MemoryPool & getKokkosMemoryPool() const
Get Kokkos memory pool.
void dynamicAllRegistration(const std::string &app_name, Factory *factory, ActionFactory *action_factory, Syntax *syntax, std::string library_path, const std::string &library_name)
Thes methods are called to register applications or objects on demand.
Definition: MooseApp.C:2637
void allocateKokkosMemoryPool(std::size_t size, unsigned int ways) const
Allocate Kokkos memory pool.
MeshGeneratorSystem & getMeshGeneratorSystem()
Gets the system that manages the MeshGenerators.
Definition: MooseApp.h:886
static Moose::Capability & addCapabilityInternal(const std::string_view capability, const Moose::Capability::Value &value, const std::string_view doc)
Internal method for adding a capability.
Definition: MooseApp.C:2330
const DataNames & getRecoverableData() const
Return a reference to the recoverable data object.
Definition: MooseApp.h:727
std::unordered_set< std::string > entry_symbols
Definition: MooseApp.h:1471
Parses MOOSE input using HIT/WASP.
Definition: Builder.h:56
const std::shared_ptr< libMesh::Parallel::Communicator > _comm
The MPI communicator this App is going to use.
Definition: MooseApp.h:1294
std::string getPrintableVersion() const
Non-virtual method for printing out the version string in a consistent format.
Definition: MooseApp.C:1018
std::shared_ptr< mfem::Device > _mfem_device
The MFEM Device object.
Definition: MooseApp.h:1748
A MultiApp represents one or more MOOSE applications that are running simultaneously.
Definition: MultiApp.h:112
void createMinimalApp()
Method for creating the minimum required actions for an application (no input file) ...
Definition: MooseApp.C:2890
void setExitCode(const int exit_code)
Sets the exit code that the application will exit with.
Definition: MooseApp.h:168
bool isRecovering() const
Whether or not this is a "recover" calculation.
Definition: MooseApp.C:1668
DataNames _recoverable_data_names
Data names that will only be read from the restart file during RECOVERY.
Definition: MooseApp.h:1352
Executor * getExecutor() const
Definition: MooseApp.h:341
bool _ready_to_exit
Definition: MooseApp.h:1408
The PerfGraph will hold the master list of all registered performance segments and the head PerfNode...
Definition: PerfGraph.h:43
bool copyInputs()
Handles the copy_inputs input parameter logic: Checks to see whether the passed argument is valid (a ...
Definition: MooseApp.C:2208
virtual bool errorOnJacobianNonzeroReallocation() const
Whether this application should by default error on Jacobian nonzero reallocations.
Definition: MooseApp.h:1089
Real getGlobalTimeOffset() const
Each App has it&#39;s own local time.
Definition: MooseApp.h:318
std::shared_ptr< mfem::Device > getMFEMDevice(Moose::PassKey< MultiApp >)
Get the MFEM device object.
Definition: MooseApp.h:1134
std::string getRestartRecoverFileBase() const
The file_base for the recovery file.
Definition: MooseApp.h:500
const MooseMesh *const _master_mesh
The mesh from master app.
Definition: MooseApp.h:1686
const std::shared_ptr< libMesh::Parallel::Communicator > getCommunicator() const
Definition: MooseApp.h:1058
MeshGenerators are objects that can modify or add to an existing mesh.
Definition: MeshGenerator.h:33
void disableCheckUnusedFlag()
Removes warnings and error checks for unrecognized variables in the input file.
Definition: MooseApp.C:1845
bool useExecutor() const
Definition: MooseApp.h:343
bool _split_mesh
Whether or not we are performing a split mesh operation (–split-mesh)
Definition: MooseApp.h:1428
bool hasInitialBackupMesh() const
Whether this app has an initial Backup object with mesh checkpoint entries.
Definition: MooseApp.C:1742
const bool _use_executor
Indicates whether we are operating in the new/experimental executor mode instead of using the legacy ...
Definition: MooseApp.h:1383
Abstract definition of a RestartableData value.
PerfGraph & perfGraph()
Get the PerfGraph for this app.
Definition: MooseApp.h:179
Class for parsing input files.
Definition: Parser.h:87
void requestCitations()
Handles the –citations command-line option: registers with PETSc the BibTeX entries that should be c...
Definition: MooseApp.C:2135
OutputWarehouse & getOutputWarehouse()
Get the OutputWarehouse objects.
Definition: MooseApp.C:2408
std::string getExecutableName()
Gets the name of the running executable on Mac OS X and linux.
std::string appNameToLibName(const std::string &app_name) const
Converts an application name to a library name: Examples: AnimalApp -> libanimal-oprof.la (assuming METHOD=oprof) ThreeWordAnimalApp -> libthree_word_animal-dbg.la (assuming METHOD=dbg)
Definition: MooseApp.C:2420
void registerInterfaceObject(T &interface)
Registers an interface object for accessing with getInterfaceObjects.
Definition: MooseApp.h:1779
static ParameterRegistry & get()
Get the singleton registry.
void setExReaderForRestart(std::shared_ptr< libMesh::ExodusII_IO > &&exreader)
Set the Exodus reader to restart variables from an Exodus mesh file.
Definition: MooseApp.h:441
unsigned int THREAD_ID
Definition: MooseTypes.h:237
void setStartTime(Real time)
Set the starting time for the simulation.
Definition: MooseApp.C:2395
std::shared_ptr< Executor > _executor
Pointer to the Executor of this run.
Definition: MooseApp.h:1367
The Executor class directs the execution flow of simulations.
Definition: Executor.h:26
void errorCheck()
Runs post-initialization error checking that cannot be run correctly unless the simulation has been f...
Definition: MooseApp.C:1600
std::set< std::string > getLoadedLibraryPaths() const
Return the paths of loaded libraries.
Definition: MooseApp.C:2829
std::string _early_exit_param
Indicates if simulation is ready to exit, and keeps track of which param caused it to exit...
Definition: MooseApp.h:1407
void dynamicAppRegistration(const std::string &app_name, std::string library_path, const std::string &library_name, bool lib_load_deps)
Definition: MooseApp.C:2580
std::unique_ptr< Backup > *const _initial_backup
The backup for use in initial setup; this will get set from the _initial_backup input parameter that ...
Definition: MooseApp.h:1733
This is a helper class for managing the storage of declared Reporter object values.
Definition: ReporterData.h:48