GEOSX
ProblemManager.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2018-2020 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2020 The Board of Trustees of the Leland Stanford Junior University
7  * Copyright (c) 2018-2020 Total, S.A
8  * Copyright (c) 2019- GEOSX Contributors
9  * All rights reserved
10  *
11  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
12  * ------------------------------------------------------------------------------------------------------------
13  */
14 
20 #ifndef GEOSX_MANAGERS_PROBLEMMANAGER_HPP_
21 #define GEOSX_MANAGERS_PROBLEMMANAGER_HPP_
22 
23 #ifdef GEOSX_USE_PYTHON
24 // Note: the python header must be included first to avoid conflicting
25 // definitions of _posix_c_source
26 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
27 #include <Python.h>
28 #include <numpy/arrayobject.h>
29 #endif
30 
31 #include "EventManager.hpp"
34 
35 namespace geosx
36 {
37 
38 class PhysicsSolverManager;
39 class DomainPartition;
40 namespace constitutive
41 {
42 class ConstitutiveManager;
43 }
49 {
50 public:
51 
56  explicit ProblemManager( const std::string & name,
57  Group * const parent );
58 
62  ~ProblemManager() override;
63 
74  virtual void SetSchemaDeviations( xmlWrapper::xmlNode schemaRoot,
75  xmlWrapper::xmlNode schemaParent,
76  integer documentationType ) override;
77 
86  virtual Group * CreateChild( string const & childKey, string const & childName ) override;
87 
91  void ParseCommandLineInput();
92 
98  static bool ParseRestart( std::string & restartFileName );
99 
105  void InitializePythonInterpreter();
106 
112  void ClosePythonInterpreter();
113 
122  void GenerateDocumentation();
123 
128  void ParseInputFile();
129 
133  void GenerateMesh();
134 
139  void ApplyNumericalMethods();
140 
145  void InitializationOrder( string_array & order ) override final;
146 
150  void ProblemSetup();
151 
155  void RunSimulation();
156 
160  void ReadRestartOverwrite();
161 
165  void ApplyInitialConditions();
166 
171  DomainPartition * getDomainPartition();
172 
177  DomainPartition const * getDomainPartition() const;
178 
183  const string & getProblemName() const
184  { return GetGroup< Group >( groupKeys.commandLine )->getReference< string >( viewKeys.problemName ); }
185 
190  const string & getInputFileName() const
191  { return GetGroup< Group >( groupKeys.commandLine )->getReference< string >( viewKeys.inputFileName ); }
192 
197  const string & getRestartFileName() const
198  { return GetGroup< Group >( groupKeys.commandLine )->getReference< string >( viewKeys.restartFileName ); }
199 
204  const string & getSchemaFileName() const
205  { return GetGroup< Group >( groupKeys.commandLine )->getReference< string >( viewKeys.schemaFileName ); }
206 
209 
212 
215 
218  {
219  dataRepository::ViewKey inputFileName = {"inputFileName"};
220  dataRepository::ViewKey restartFileName = {"restartFileName"};
221  dataRepository::ViewKey beginFromRestart = {"beginFromRestart"};
222  dataRepository::ViewKey xPartitionsOverride = {"xPartitionsOverride"};
223  dataRepository::ViewKey yPartitionsOverride = {"yPartitionsOverride"};
225  dataRepository::ViewKey zPartitionsOverride = {"zPartitionsOverride"};
227  dataRepository::ViewKey overridePartitionNumbers = {"overridePartitionNumbers"};
229  dataRepository::ViewKey schemaFileName = {"schemaFileName"};
231  dataRepository::ViewKey problemName = {"problemName"};
232  dataRepository::ViewKey outputDirectory = {"outputDirectory"};
233  dataRepository::ViewKey useNonblockingMPI = {"useNonblockingMPI"};
234  dataRepository::ViewKey suppressPinned = {"suppressPinned"};
235  } viewKeys;
237 
240  {
241  static constexpr auto numericalMethodsManagerString = "NumericalMethods";
242  dataRepository::GroupKey commandLine = { "commandLine" };
243  dataRepository::GroupKey constitutiveManager = { "Constitutive" };
244  dataRepository::GroupKey domain = { "domain" };
245  dataRepository::GroupKey eventManager = { "Events" };
246  dataRepository::GroupKey fieldSpecificationManager = { "FieldSpecifications" };
247  dataRepository::GroupKey functionManager = { "Functions" };
248  dataRepository::GroupKey geometricObjectManager = { "Geometry" };
249  dataRepository::GroupKey meshManager = { "Mesh" };
250  dataRepository::GroupKey numericalMethodsManager = { numericalMethodsManagerString };
251  dataRepository::GroupKey outputManager = { "Outputs" };
252  dataRepository::GroupKey physicsSolverManager = { "Solvers" };
253  dataRepository::GroupKey tasksManager = { "Tasks" };
254  } groupKeys;
255 
260  PhysicsSolverManager & GetPhysicsSolverManager()
261  {
262  return *m_physicsSolverManager;
263  }
264 
269  PhysicsSolverManager const & GetPhysicsSolverManager() const
270  {
271  return *m_physicsSolverManager;
272  }
273 
274 protected:
278  virtual void PostProcessInput() override final;
279 
280 private:
281 
292  map< std::pair< string, string >, localIndex > calculateRegionQuadrature( Group & meshBodies );
293 
301  void setRegionQuadrature( Group & meshBodies,
302  constitutive::ConstitutiveManager const & constitutiveManager,
303  map< std::pair< string, string >, localIndex > const & regionQuadrature );
304 
306  PhysicsSolverManager * m_physicsSolverManager;
307 
309  EventManager * m_eventManager;
310 
312  FunctionManager * m_functionManager;
313 };
314 
315 } /* namespace geosx */
316 
317 #endif /* GEOSX_MANAGERS_PROBLEMMANAGER_HPP_ */
pugi::xml_document xmlDocument
Alias for the type of xml document.
Definition: xmlWrapper.hpp:54
pugi::xml_node xmlNode
Alias for the type of an xml node.
Definition: xmlWrapper.hpp:60
Command line input viewKeys.
Base template for ordered and unordered maps.
Definition: DataTypes.hpp:349
const string & getSchemaFileName() const
Returns the schema file name.
xmlWrapper::xmlNode xmlProblemNode
Input file Problem node handle.
xmlWrapper::xmlDocument xmlDocument
Input file xml document handle.
const string & getInputFileName() const
Returns the input file name.
PhysicsSolverManager & GetPhysicsSolverManager()
Returns the PhysicsSolverManager.
Group::wrapperMap::KeyIndex ViewKey
Type alias for KeyIndexT type used for wrapper lookups.
Definition: Group.hpp:1545
std::int32_t integer
Signed integer type.
Definition: DataTypes.hpp:122
contains the added group access keys to be bound with class in group hierarchy
pugi::xml_parse_result xmlResult
Alias for the type of the result from an xml parse attempt.
Definition: xmlWrapper.hpp:57
const string & getRestartFileName() const
Returns the restart file name.
xmlWrapper::xmlResult xmlResult
Input file parsing results.
std::ptrdiff_t localIndex
Local index type (for indexing objects within an MPI partition).
Definition: DataTypes.hpp:125
This is the class handling the operation flow of the problem being ran in GEOSX.
std::string string
String type.
Definition: DataTypes.hpp:131
This class provides a fixed dimensional resizeable array interface in addition to an interface simila...
Definition: Array.hpp:55
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
const string & getProblemName() const
Returns the problem name.
PhysicsSolverManager const & GetPhysicsSolverManager() const
Returns the PhysicsSolverManager.