Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .integrated_tests.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
baselines:
bucket: geosx
baseline: integratedTests/baseline_integratedTests-pr4005-17824-bac337a
baseline: integratedTests/baseline_integratedTests-pr4164-17838-91151f5

allow_fail:
all: ''
Expand Down
4 changes: 4 additions & 0 deletions BASELINE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ This file is designed to track changes to the integrated test baselines.
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.
These notes should be in reverse-chronological order, and use the following time format: (YYYY-MM-DD).

PR #4164 (2026-10-26) <https://storage.googleapis.com/geosx/integratedTests/baseline_integratedTests-pr4164-17838-91151f5.tar.gz>
=====================
Add a `Group` statistics layer for fracture surfaces.

PR #4005 (2026-10-23) <https://storage.googleapis.com/geosx/integratedTests/baseline_integratedTests-pr4005-17824-bac337a.tar.gz>
=====================
Added a `Group` statistics layer for sets statistics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
<CompositionalMultiphaseStatistics
name="compflowStatistics"
flowSolverName="flowSolver"
logLevel="1"
logLevel="2"
computeRegionStatistics="1"/>

</Tasks>
Expand Down
12 changes: 6 additions & 6 deletions src/coreComponents/physicsSolvers/StatisticsAggregatorBase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include "common/DataTypes.hpp"
#include "dataRepository/DataContext.hpp"
#include "dataRepository/Group.hpp"
#include "mesh/CellElementRegion.hpp"
#include "mesh/ElementRegionBase.hpp"
#include "mesh/MeshBody.hpp"
#include "mesh/MeshLevel.hpp"

Expand Down Expand Up @@ -102,7 +102,7 @@ class StatsAggregatorBase
/**
* @brief Standard function signature for any functor that applies on statistics group instances (StatsGroupType)
* - param 0: OwnerType &, the group instance containing the data for which we want to aggregate the statistics (MeshLevel,
* CellElementRegion...)
* ElementRegionBase...)
* - param 1: StatsAggregateGroupType &, the statistics aggregate Group where to store the data
* @tparam OwnerType the concrete type of the OwnerType param
*/
Expand Down Expand Up @@ -209,17 +209,17 @@ class StatsAggregatorBase
*/
void forRegionStatistics( MeshLevelSet meshSet,
StatsGroupType & setStats,
RegionStatsFunc< CellElementRegion & > const & functor ) const;
RegionStatsFunc< ElementRegionBase & > const & functor ) const;

/**
* @brief Execute the given functor on each sub-region available in the given region for the given set.
* @param meshSet the target region set.
* @param setRegionStats the region statistics data structure for the given set.
* @param functor the function to execute.
*/
void forRegionStatistics( CellElementRegion & region,
void forRegionStatistics( ElementRegionBase & region,
StatsGroupType & setRegionStats,
RegionStatsFunc< CellElementSubRegion & > const & functor ) const;
RegionStatsFunc< ElementSubRegionBase & > const & functor ) const;

/**
* @brief Get the Instance Statistics Group for the given mesh-level.
Expand Down Expand Up @@ -399,7 +399,7 @@ class StatsAggregatorBase
* @param targetSet
* @note Must be implemented for each type that implements this template (CRTP).
*/
void computeSubRegionRankStats( CellElementSubRegion & subRegion,
void computeSubRegionRankStats( ElementSubRegionBase & subRegion,
StatsGroupType & subRegionStats,
SetType const & targetSet ) const
{ static_cast< Impl const * >(this)->computeSubRegionRankStats( subRegion, subRegionStats, targetSet ); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,31 @@
#include "dataRepository/DataContext.hpp"
#include "dataRepository/Group.hpp"
#include "mesh/CellElementRegion.hpp"
#include "mesh/CellElementSubRegion.hpp"
#include "mesh/ElementRegionBase.hpp"
#include "mesh/SurfaceElementRegion.hpp"
#include "mesh/ElementRegionManager.hpp"
#include "mesh/MeshLevel.hpp"

namespace geos
{

namespace internal
{

/**
* @return true if statistics are computed on this region: cell regions and surface (fracture) regions.
* Well regions are skipped.
* @param region the region to test
*/
inline bool isStatisticsRegion( ElementRegionBase const & region )
{
// we only process cell and surface regions (wells are skipped)
return dynamic_cast< CellElementRegion const * >( &region ) != nullptr ||
dynamic_cast< SurfaceElementRegion const * >( &region ) != nullptr;
}

} // namespace internal

inline RegionStatisticsBase::RegionStatisticsBase( string const & targetName,
dataRepository::Group * const parent,
string_view setName,
Expand Down Expand Up @@ -63,11 +81,14 @@ StatsAggregatorBase< Impl >::getMeshLevelPartialSetNames( MeshLevel const & mesh
{
std::set< string > foundSetNames;

mesh.getElemManager().forElementRegions< CellElementRegion >( regionNames,
mesh.getElemManager().forElementRegions< ElementRegionBase >( regionNames,
[&] ( localIndex &,
CellElementRegion const & region )
ElementRegionBase const & region )
{
region.forElementSubRegions< CellElementSubRegion >( [&] ( CellElementSubRegion const & subRegion ) {
if( !internal::isStatisticsRegion( region ) )
return;

region.forElementSubRegions< ElementSubRegionBase >( [&] ( ElementSubRegionBase const & subRegion ) {
dataRepository::Group const & sets = subRegion.sets();
sets.forWrappers< SetType >( [&] ( dataRepository::Wrapper< SetType > const & set )
{
Expand Down Expand Up @@ -150,14 +171,14 @@ StatsAggregatorBase< Impl >::enableRegionStatisticsAggregation( RegionStatsRegis
for( size_t regionId = 0; regionId < path.m_regionNames.size(); ++regionId )
{
ElementRegionBase & region = elemManager.getRegion< ElementRegionBase >( path.m_regionNames[regionId] );
if( dynamic_cast< CellElementRegion * >(&region) != nullptr )
{ // we only process cell regions
if( internal::isStatisticsRegion( region ) )
{
StatsGroupType & setRegionStats = registerStatsFunc( meshSetStats, region.getName(),
setName, m_dataOutputEnabled );
stdMap< string, SetType > & regionSetsCompounds = meshSetsCompounds.get_inserted( region.getName() );
regionFound = true;

region.forElementSubRegions< CellElementSubRegion >( [&] ( CellElementSubRegion & subRegion )
region.forElementSubRegions< ElementSubRegionBase >( [&] ( ElementSubRegionBase & subRegion )
{
registerStatsFunc( setRegionStats, subRegion.getName(),
setName, false );
Expand Down Expand Up @@ -198,12 +219,12 @@ StatsAggregatorBase< Impl >::enableRegionStatisticsAggregation( RegionStatsRegis
for( size_t regionId = 0; regionId < path.m_regionNames.size(); ++regionId )
{
ElementRegionBase & region = elemManager.getRegion< ElementRegionBase >( path.m_regionNames[regionId] );
if( dynamic_cast< CellElementRegion * >(&region) != nullptr )
{ // we only process cell regions
if( internal::isStatisticsRegion( region ) )
{
StatsGroupType & setRegionStats = registerStatsFunc( meshSetStats, region.getName(),
setName, false );

region.forElementSubRegions< CellElementSubRegion >( [&] ( CellElementSubRegion & subRegion )
region.forElementSubRegions< ElementSubRegionBase >( [&] ( ElementSubRegionBase & subRegion )
{
registerStatsFunc( setRegionStats, subRegion.getName(),
setName, false );
Expand Down Expand Up @@ -366,30 +387,28 @@ template< typename Impl >
void
StatsAggregatorBase< Impl >::forRegionStatistics( MeshLevelSet const meshSet,
StatsGroupType & setStats,
RegionStatsFunc< CellElementRegion & > const & func ) const
RegionStatsFunc< ElementRegionBase & > const & func ) const
{
ElementRegionManager & elemManager = meshSet.mesh.getElemManager();
setStats.template forSubGroups< StatsGroupType >( [&] ( StatsGroupType & setRegionStats )
{
string_view regionName = setRegionStats.getTargetName();
ElementRegionBase & region = elemManager.getRegion< ElementRegionBase >( string( regionName ) );
CellElementRegion * cellRegion = dynamic_cast< CellElementRegion * >(&region); // we only process cell regions

if( cellRegion != nullptr )
func( *cellRegion, setRegionStats );
if( internal::isStatisticsRegion( region ) ) // we only process cell and surface regions (wells are skipped)
func( region, setRegionStats );
} );
}

template< typename Impl >
void
StatsAggregatorBase< Impl >::forRegionStatistics( CellElementRegion & setRegion,
StatsAggregatorBase< Impl >::forRegionStatistics( ElementRegionBase & setRegion,
StatsGroupType & setRegionStats,
RegionStatsFunc< CellElementSubRegion & > const & func ) const
RegionStatsFunc< ElementSubRegionBase & > const & func ) const
{
setRegionStats.template forSubGroups< StatsGroupType >( [&] ( StatsGroupType & subRegionStatistics )
{
string_view subRegionName = subRegionStatistics.getTargetName();
CellElementSubRegion & subRegion = setRegion.getSubRegion< CellElementSubRegion >( string( subRegionName ) );
ElementSubRegionBase & subRegion = setRegion.getSubRegion< ElementSubRegionBase >( string( subRegionName ) );

func( subRegion, subRegionStatistics );
} );
Expand Down Expand Up @@ -436,11 +455,11 @@ StatsAggregatorBase< Impl >::computeRegionsStatistics( real64 const timeRequest
{
initStats( setStats, timeRequest );
forRegionStatistics( meshSet, setStats,
[&, timeRequest] ( CellElementRegion & region, StatsGroupType & regionStats )
[&, timeRequest] ( ElementRegionBase & region, StatsGroupType & regionStats )
{
initStats( regionStats, timeRequest );
forRegionStatistics( region, regionStats,
[&, timeRequest] ( CellElementSubRegion & subRegion, StatsGroupType & subRegionStats )
[&, timeRequest] ( ElementSubRegionBase & subRegion, StatsGroupType & subRegionStats )
{
initStats( subRegionStats, timeRequest );

Expand All @@ -457,10 +476,10 @@ StatsAggregatorBase< Impl >::computeRegionsStatistics( real64 const timeRequest
[&] ( MeshLevelSet meshSet, StatsGroupType & setStats )
{
forRegionStatistics( meshSet, setStats,
[&] ( CellElementRegion & region, StatsGroupType & regionStats )
[&] ( ElementRegionBase & region, StatsGroupType & regionStats )
{
forRegionStatistics( region, regionStats,
[&] ( CellElementSubRegion &, StatsGroupType & subRegionStats )
[&] ( ElementSubRegionBase &, StatsGroupType & subRegionStats )
{
aggregateStats( regionStats, subRegionStats );
// sub-region stats finalization is disabled, it does not seem useful
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void StatsAggregator::initStats( RegionStatistics & stats, real64 const time ) c
stats.m_componentMass.setValues< serialPolicy >( 0.0 );
}

void StatsAggregator::computeSubRegionRankStats( CellElementSubRegion & subRegion,
void StatsAggregator::computeSubRegionRankStats( ElementSubRegionBase & subRegion,
RegionStatistics & subRegionStats,
SetType const & targetSet ) const
{
Expand Down Expand Up @@ -328,7 +328,7 @@ void StatsAggregator::postAggregateStats( RegionStatistics & stats )
{
if( stats.m_totalUncompactedPoreVolume > 0 )
{
float invTotalUncompactedPoreVolume = 1.0 / stats.m_totalUncompactedPoreVolume;
real64 const invTotalUncompactedPoreVolume = 1.0 / stats.m_totalUncompactedPoreVolume;
stats.m_averagePressure *= invTotalUncompactedPoreVolume;
stats.m_averageTemperature *= invTotalUncompactedPoreVolume;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
* |-> Level0 : MeshLevel
* | |-> ElementRegions : ElementRegionManager
* | | |-> elementRegionsGroup : Group
* | | |-> "Channel" : CellElementRegion
* | | |-> "Channel" : ElementRegionBase
* | | | |-> elementSubRegions : Group
* | | | |-> "cb-0_0_0" : CellElementSubRegion
* | | | |-> "cb-0_0_0" : ElementSubRegionBase
* | | | | | * pressure : Wrapper< real64 array >
* | | | | | * temperature : Wrapper< real64 array >
* | | | | |-> sets : Group
Expand All @@ -37,7 +37,7 @@
* | | | | |
* | | | | [...] (other fields)
* | | | |
* | | | |-> "cb-0_0_1" : CellElementSubRegion
* | | | |-> "cb-0_0_1" : ElementSubRegionBase
* | | | | | * pressure : Wrapper< real64 array >
* | | | | | * temperature : Wrapper< real64 array >
* | | | | |-> sets : Group
Expand All @@ -49,9 +49,9 @@
* | | | |
* | | | [...] (other sub-regions)
* | | |
* | | |-> "Barrier" : CellElementRegion
* | | |-> "cb-1_0_0" : CellElementSubRegion
* | | |-> "cb-1_0_1" : CellElementSubRegion
* | | |-> "Barrier" : ElementRegionBase
* | | |-> "cb-1_0_0" : ElementSubRegionBase
* | | |-> "cb-1_0_1" : ElementSubRegionBase
* | | [...] (other sub-regions)
* | |
* | |-> nodeManager : NodeManager
Expand Down Expand Up @@ -159,7 +159,7 @@ class RegionStatistics : public RegionStatisticsBase

/// total region pore volume
real64 m_totalPoreVolume;
/// total region uncompacted pore volume (not necessarily output, useful for weighting cell pressure data)
/// total region uncompacted pore volume (not necessarily output, useful for weighting element pressure data)
real64 m_totalUncompactedPoreVolume;
/// phase region dynamic pore volume
array1d< real64 > const m_phaseDynamicPoreVolume;
Expand Down Expand Up @@ -311,7 +311,7 @@ class StatsAggregator : public StatsAggregatorBase< StatsAggregator >
/// @cond DO_NOT_DOCUMENT

void initStats( RegionStatistics & stats, real64 time ) const;
void computeSubRegionRankStats( CellElementSubRegion & subRegion,
void computeSubRegionRankStats( ElementSubRegionBase & subRegion,
RegionStatistics & subRegionStats,
SetType const & targetSet ) const;
void aggregateStats( RegionStatistics & stats, RegionStatistics const & other ) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ void StatsTask::outputLogStats( real64 const statsTime,
if( logPerRegion )
{
m_aggregator->forRegionStatistics( meshSet, meshSetStats,
[&] ( CellElementRegion & region,
[&] ( ElementRegionBase & region,
RegionStatistics & setRegionStats )
{
outputRegionStats( GEOS_FMT( "{} / {} / Region: '{}' ({} elements)",
Expand Down Expand Up @@ -450,7 +450,7 @@ void StatsTask::outputCsvStats( real64 statsTime,
outputRegionStats( meshSet.mesh.getName(), meshSet.setName, meshSetStats );

m_aggregator->forRegionStatistics( meshSet, meshSetStats,
[&] ( CellElementRegion & region,
[&] ( ElementRegionBase & region,
RegionStatistics & setRegionStats )
{
outputRegionStats( region.getName(), setRegionStats.getSetName(), setRegionStats );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void StatsAggregator::initStats( RegionStatistics & stats, real64 const time ) c
stats.m_totalMass = 0.0;
}

void StatsAggregator::computeSubRegionRankStats( CellElementSubRegion & subRegion,
void StatsAggregator::computeSubRegionRankStats( ElementSubRegionBase & subRegion,
RegionStatistics & subRegionStats,
SetType const & targetSet ) const
{
Expand Down Expand Up @@ -186,7 +186,7 @@ void StatsAggregator::postAggregateStats( RegionStatistics & stats )
{
if( stats.m_totalUncompactedPoreVolume > 0 )
{
float invTotalUncompactedPoreVolume = 1.0 / stats.m_totalUncompactedPoreVolume;
real64 const invTotalUncompactedPoreVolume = 1.0 / stats.m_totalUncompactedPoreVolume;
stats.m_averagePressure *= invTotalUncompactedPoreVolume;
stats.m_averageTemperature *= invTotalUncompactedPoreVolume;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ class StatsAggregator : public StatsAggregatorBase< StatsAggregator >
/// @cond DO_NOT_DOCUMENT

void initStats( RegionStatistics & stats, real64 time ) const;
void computeSubRegionRankStats( CellElementSubRegion & subRegion,
void computeSubRegionRankStats( ElementSubRegionBase & subRegion,
RegionStatistics & subRegionStats,
SetType const & targetSet ) const;
void aggregateStats( RegionStatistics & stats, RegionStatistics const & other ) const;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ void StatsTask::outputLogStats( real64 const statsTime,
if( logPerRegion )
{
m_aggregator->forRegionStatistics( meshSet, meshSetStats,
[&] ( CellElementRegion & region,
[&] ( ElementRegionBase & region,
RegionStatistics & setRegionStats )
{
outputRegionStats( GEOS_FMT( "{} / {} / Region: '{}' ({} elements)",
Expand Down Expand Up @@ -308,7 +308,7 @@ void StatsTask::outputCsvStats( real64 statsTime,
outputRegionStats( meshSet.mesh.getName(), meshSet.setName, meshSetStats );

m_aggregator->forRegionStatistics( meshSet, meshSetStats,
[&] ( CellElementRegion & region,
[&] ( ElementRegionBase & region,
RegionStatistics & setRegionStats )
{
outputRegionStats( region.getName(), setRegionStats.getSetName(), setRegionStats );
Expand Down
Loading