Skip to content

Commit 8536462

Browse files
authored
feat: Split statistics components computation & output (#3836)
Allow to query statistics computation for solver (for reservoir reference pressure for wells), without needing an output statistics component. Statistics are no longer recomputed for each convergence step but only at iteration start. - `RegionStatistics` classes for resulting data storages at different levels: - sub-regions mpi-local kernel compute read-backs, - (cell element) regions, - solver discretisation `MeshLevel`, - `StatsAggregator` classes to compute & reduce the statistics to rank 0, - `StatsTask` `Group`, the user component to schedule flow statistics computation & output to log & CSV.
1 parent 04701ec commit 8536462

30 files changed

Lines changed: 2951 additions & 1241 deletions

.integrated_tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
baselines:
22
bucket: geosx
3-
baseline: integratedTests/baseline_integratedTests-pr4040-16993-1393f80
3+
baseline: integratedTests/baseline_integratedTests-pr3836-17046-2e89f64
44

55
allow_fail:
66
all: ''

BASELINE_NOTES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ This file is designed to track changes to the integrated test baselines.
55
Any developer who updates the baseline ID in the .integrated_tests.yaml file is expected to create an entry in this file with the pull request number, date, and their justification for rebaselining.
66
These notes should be in reverse-chronological order, and use the following time format: (YYYY-MM-DD).
77

8+
PR #3836 (2026-05-20) <https://storage.googleapis.com/geosx/integratedTests/baseline_integratedTests-pr3836-17046-2e89f64.tar.gz>
9+
=====================
10+
Added statistics `Group` objects for each statistics `Task` instance
11+
812
PR #4040 (2026-06-16) <https://storage.googleapis.com/geosx/integratedTests/baseline_integratedTests-pr4040-16993-1393f80.tar.gz>
913
Move relperm driver to use new constitutive driver framework
1014

src/coreComponents/common/format/table/TableFormatter.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ class TableFormatter
5757
TableErrorListing & getErrorsList() const
5858
{ return *m_errors; }
5959

60+
/**
61+
* @return The prepared table layout
62+
*/
63+
PreparedTableLayout const & getLayout() const
64+
{ return m_tableLayout; }
65+
6066
protected:
6167

6268
/// Layout for a table

src/coreComponents/common/format/table/TableTypes.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class TableErrorListing
8282
* @brief Append a vector of string to the errors vector.
8383
* @param errors A vector of string to append
8484
*/
85-
void appendErrors( stdVector< string > & errors )
85+
void appendErrors( stdVector< string > const & errors )
8686
{ m_errorList.insert( m_errorList.end(), errors.begin(), errors.end() );}
8787

8888
/**

src/coreComponents/dataRepository/DataContext.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class DataContext
7878
/**
7979
* @return Get the target object name
8080
*/
81-
string getTargetName() const
81+
string const & getTargetName() const
8282
{ return m_targetName; }
8383
/**
8484
* @brief Insert contextual information in the provided stream.
@@ -179,13 +179,13 @@ class DataFileContext final : public DataContext
179179
/**
180180
* @return the type name in the source file (XML node tag name / attribute name).
181181
*/
182-
string getTypeName() const
182+
string const & getTypeName() const
183183
{ return m_typeName; }
184184

185185
/**
186186
* @return the source file path where the target object has been declared.
187187
*/
188-
string getFilePath() const
188+
string const & getFilePath() const
189189
{ return m_filePath; }
190190

191191
/**

src/coreComponents/mesh/MeshBody.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ class MeshBody : public dataRepository::Group
9696
* @param[in] level The lookup key of the MeshLevel
9797
* @return const reference to the MeshLevel
9898
*/
99-
template< typename T, std::enable_if_t< std::is_same< T, string >::value ||
100-
std::is_same< T, const char * >::value, bool > = false >
99+
template< typename T >
101100
MeshLevel & getMeshLevel( T const & level ) const
102101
{ return m_meshLevels.getGroup< MeshLevel >( level ); }
103102

@@ -108,8 +107,7 @@ class MeshBody : public dataRepository::Group
108107
* @param[in] level The lookup key of the MeshLevel
109108
* @return Reference to the MeshLevel
110109
*/
111-
template< typename T, std::enable_if_t< std::is_same< T, string >::value ||
112-
std::is_same< T, const char * >::value, bool > = false >
110+
template< typename T >
113111
MeshLevel & getMeshLevel( T const & level )
114112
{ return m_meshLevels.getGroup< MeshLevel >( level ); }
115113

src/coreComponents/physicsSolvers/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ set( physicsSolversBase_headers
2929
NonlinearSolverParameters.hpp
3030
PhysicsSolverBase.hpp
3131
PhysicsSolverBaseKernels.hpp
32-
SolverStatistics.hpp )
32+
SolverStatistics.hpp
33+
StatisticsAggregatorBase.hpp
34+
StatisticsAggregatorBaseHelpers.hpp )
3335
#
3436
# Specify solver sources
3537
#

src/coreComponents/physicsSolvers/FieldStatisticsBase.hpp

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ class FieldStatisticsBase : public TaskBase
5050
m_outputDir( joinPath( OutputBase::getOutputDirectory(), name ) )
5151
{
5252

53-
string const key = SOLVER::coupledSolverAttributePrefix() + "SolverName";
54-
registerWrapper( key, &m_solverName ).
53+
registerWrapper( getSolverWrapperKey(), &m_solverName ).
5554
setRTTypeName( rtTypes::CustomTypes::groupNameRef ).
5655
setInputFlag( dataRepository::InputFlags::REQUIRED ).
5756
setDescription( "Name of the " + SOLVER::coupledSolverAttributePrefix() + " solver" );
@@ -80,6 +79,20 @@ class FieldStatisticsBase : public TaskBase
8079

8180
protected:
8281

82+
struct viewKeyStruct
83+
{
84+
static constexpr char const * writeCSVFlagString() { return "writeCSV"; }
85+
};
86+
87+
/// Pointer to the physics solver
88+
SOLVER * m_solver;
89+
90+
// Output directory
91+
string const m_outputDir;
92+
93+
// Flag to enable writing CSV output
94+
integer m_writeCSV;
95+
8396
void postInputInitialization() override
8497
{
8598
Group & problemManager = this->getGroupByPath( "/Problem" );
@@ -103,19 +116,8 @@ class FieldStatisticsBase : public TaskBase
103116
}
104117
}
105118

106-
struct viewKeyStruct
107-
{
108-
static constexpr char const * writeCSVFlagString() { return "writeCSV"; }
109-
};
110-
111-
/// Pointer to the physics solver
112-
SOLVER * m_solver;
113-
114-
// Output directory
115-
string const m_outputDir;
116-
117-
// Flag to enable writing CSV output
118-
integer m_writeCSV;
119+
string getSolverWrapperKey() const
120+
{ return SOLVER::coupledSolverAttributePrefix() + "SolverName"; }
119121

120122
private:
121123

0 commit comments

Comments
 (0)