GEOS
CompositionalMultiphaseStatisticsTask.hpp
Go to the documentation of this file.
1 /*
2  * ------------------------------------------------------------------------------------------------------------
3  * SPDX-License-Identifier: LGPL-2.1-only
4  *
5  * Copyright (c) 2016-2024 Lawrence Livermore National Security LLC
6  * Copyright (c) 2018-2024 TotalEnergies
7  * Copyright (c) 2018-2024 The Board of Trustees of the Leland Stanford Junior University
8  * Copyright (c) 2023-2024 Chevron
9  * Copyright (c) 2019- GEOS/GEOSX Contributors
10  * All rights reserved
11  *
12  * See top level LICENSE, COPYRIGHT, CONTRIBUTORS, NOTICE, and ACKNOWLEDGEMENTS files for details.
13  * ------------------------------------------------------------------------------------------------------------
14  */
15 
20 #ifndef SRC_CORECOMPONENTS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONALMULTIPHASESTATISTICSTASK_HPP_
21 #define SRC_CORECOMPONENTS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONALMULTIPHASESTATISTICSTASK_HPP_
22 
23 #include "common/DataTypes.hpp"
27 #include <memory>
28 
29 namespace geos
30 {
31 
32 class CompositionalMultiphaseBase;
33 
34 namespace compositionalMultiphaseStatistics
35 {
36 
40 class StatsTask : public FieldStatisticsBase< CompositionalMultiphaseBase >
41 {
42 public:
43 
49  StatsTask( const string & name, dataRepository::Group * const parent );
50 
52  static string catalogName() { return "CompositionalMultiphaseStatistics"; }
53 
61  virtual bool execute( real64 const time_n,
62  real64 const dt,
63  integer const cycleNumber,
64  integer const eventCounter,
65  real64 const eventProgress,
66  DomainPartition & domain ) override;
67 
70  StatsAggregator & getStatisticsAggregator()
71  { return *m_aggregator; }
72 
73  StatsAggregator const & getStatisticsAggregator() const
74  { return *m_aggregator; }
75 
76 private:
77 
79 
83  struct viewKeyStruct
84  {
86  constexpr static char const * computeCFLNumbersString() { return "computeCFLNumbers"; }
88  constexpr static char const * computeRegionStatisticsString() { return "computeRegionStatistics"; }
90  constexpr static char const * relpermThresholdString() { return "relpermThreshold"; }
91  };
92 
93  void postInputInitialization() override;
94 
95  void registerDataOnMesh( Group & meshBodies ) override;
96 
97  void prepareFluidMetaData();
98 
99  void prepareLogTableLayouts( string_view tableName );
100 
101  void prepareCsvTableLayouts( string_view tableName );
102 
103  string getCsvFileName( string_view meshName ) const;
104 
105  void outputLogStats( real64 statsTime,
106  MeshLevel & mesh,
107  RegionStatistics & meshRegionsStatistics );
108 
109  void outputCsvStats( real64 statsTime,
110  MeshLevel & mesh,
111  RegionStatistics & meshRegionsStatistics );
112 
114  stdMap< string, std::unique_ptr< TableTextFormatter > > m_logFormatters;
115 
117  stdMap< string, std::unique_ptr< TableCSVFormatter > > m_csvFormatters;
118 
119  // mesh statistics aggregator
120  std::unique_ptr< StatsAggregator > m_aggregator;
121 
123  integer m_computeCFLNumbers;
124 
126  integer m_computeRegionStatistics;
127 
129  real64 m_relpermThreshold;
130 
131  struct FluidMetaData
132  {
133  integer m_numPhases;
134  integer m_numComps;
135  stdVector< string > m_phaseNames;
136  stdVector< string > m_compNames;
137  stdVector< string > m_phaseCompNames;
138 
144  string & phaseCompName( integer phaseId, integer compId )
145  { return m_phaseCompNames[phaseId * m_numComps + compId]; }
146 
147  } m_fluid;
148 
149 };
150 
151 } /* namespace compositionalMultiphaseStatistics */
152 
153 } /* namespace geos */
154 
155 #endif /* SRC_CORECOMPONENTS_PHYSICSSOLVERS_FLUIDFLOW_COMPOSITIONALMULTIPHASESTATISTICSTASK_HPP_ */
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
Reponsible of computing physical statistics over the grid, registering the result in the data reposit...
StatsTask(const string &name, dataRepository::Group *const parent)
Constructor for the statistics class.
Group()=delete
Deleted default constructor.
virtual bool execute(real64 const time_n, real64 const dt, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition &domain) override
Main extension point of executable targets.
double real64
64-bit floating point type.
Definition: DataTypes.hpp:98
int integer
Signed integer type.
Definition: DataTypes.hpp:81
std::string_view string_view
String type.
Definition: DataTypes.hpp:93