Skip to content

feat: Adding flow statistics for arbitrary mesh cell element sets#4005

Open
MelReyCG wants to merge 386 commits into
developfrom
feature/rey/arbitrary-regions-stats
Open

feat: Adding flow statistics for arbitrary mesh cell element sets#4005
MelReyCG wants to merge 386 commits into
developfrom
feature/rey/arbitrary-regions-stats

Conversation

@MelReyCG

@MelReyCG MelReyCG commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

This PR aims at extending the flow statistics components by introducing an optional setNames parameter to SinglePhaseStatistics and CompositionalMultiphaseStatistics, allowing users to obtain statistics computation from arbitrary mesh element sets instead of being forced to process solver regions.

Sets can already be defined with Geometry objects like Box.

Multiple set can be provided for a given statistics component, and in that case, statistics over all provided sets are also logged. To support intersecting sets and give valid statistics, they are computed on a compound set (union of all selected set).
Here is an example:

    <!-- stats table to compare the domain element set with the well surroundings element set -->
    <CompositionalMultiphaseStatistics 
      name="domainAndInjectorFlowStats"
      flowSolverName="compositionalMultiphaseFlow"
      setNames="{all, injectorSurrounding}"
      logLevel="1"
      writeCSV="1"/>
--------------------------------------------------------------------------------------------------------------
|                  Statistics: domainAndInjectorFlowStats / Discretization: fluidTPFA                        |
|------------------------------------------------------------------------------------------------------------|
|                         Statistics time  |                                                      496000000  |
|------------------------------------------------------------------------------------------------------------|
|                                                                                                            |
|                                               Discretization: 'fluidTPFA' / Selected sets (7500 elements)  |
|------------------------------------------------------------------------------------------------------------|
|                              statistics  |            min  |                average  |                max  |
|------------------------------------------|-----------------|-------------------------|---------------------|
|                           Pressure [Pa]  |   39856089.824  |                  7.599  |       51367844.277  |
|                     Delta pressure [Pa]  |   27356089.824  |                      /  |       38867844.277  |
|                         Temperature [K]  |         368.15  |              6.135e-05  |             368.15  |
|------------------------------------------|-----------------|-----------------------------------------------|
|         Total dynamic pore volume [rm3]  |            all  |                                  6096116.064  |
|         Phase dynamic pore volume [rm3]  |            gas  |                                       119209  |
|                                          |          water  |                                  5.97691e+06  |
|------------------------------------------|-----------------|-----------------------------------------------|
|                   Total fluid mass [kg]  |            all  |                               5978216181.947  |
|                         Phase mass [kg]  |            gas  |                                  9.50193e+07  |
|                                          |          water  |                                   5.8832e+09  |
|------------------------------------------|-----------------|-----------------------------------------------|
|      Trapped phase mass (metric 1) [kg]  |            gas  |                                  4.71814e+07  |
|                                          |          water  |                                  1.80049e+09  |
|  Non-trapped phase mass (metric 1) [kg]  |            gas  |                                  4.78379e+07  |
|                                          |          water  |                                  4.08271e+09  |
|------------------------------------------|-----------------|-----------------------------------------------|
|     Immobile phase mass (metric 2) [kg]  |            gas  |                                            0  |
|                                          |          water  |                                            0  |
|       Mobile phase mass (metric 2) [kg]  |            gas  |                                  9.50193e+07  |
|                                          |          water  |                                   5.8832e+09  |
|------------------------------------------|-----------------|-----------------------------------------------|
|                     Component mass [kg]  |      gas / co2  |                                  9.50193e+07  |
|                                          |    gas / water  |                                            0  |
|                                          |    water / co2  |                                  7.33584e+07  |
|                                          |  water / water  |                                  5.80984e+09  |
|------------------------------------------------------------------------------------------------------------|
|                                                                                                            |
|                                          Discretization: 'fluidTPFA' / Element set: 'all' (7500 elements)  |
|------------------------------------------------------------------------------------------------------------|
|                              statistics  |            min  |                average  |                max  |
|------------------------------------------|-----------------|-------------------------|---------------------|
|                           Pressure [Pa]  |   39856089.824  |           45598543.119  |       51367844.277  |
|                     Delta pressure [Pa]  |   27356089.824  |                      /  |       38867844.277  |
|                         Temperature [K]  |         368.15  |                368.149  |             368.15  |
|------------------------------------------|-----------------|-----------------------------------------------|
|         Total dynamic pore volume [rm3]  |            all  |                                  6096116.064  |
|         Phase dynamic pore volume [rm3]  |            gas  |                                       119209  |
|                                          |          water  |                                  5.97691e+06  |
|------------------------------------------|-----------------|-----------------------------------------------|
|                   Total fluid mass [kg]  |            all  |                               5978216181.947  |
|                         Phase mass [kg]  |            gas  |                                  9.50193e+07  |
|                                          |          water  |                                   5.8832e+09  |
|------------------------------------------|-----------------|-----------------------------------------------|
|      Trapped phase mass (metric 1) [kg]  |            gas  |                                  4.71814e+07  |
|                                          |          water  |                                  1.80049e+09  |
|  Non-trapped phase mass (metric 1) [kg]  |            gas  |                                  4.78379e+07  |
|                                          |          water  |                                  4.08271e+09  |
|------------------------------------------|-----------------|-----------------------------------------------|
|     Immobile phase mass (metric 2) [kg]  |            gas  |                                            0  |
|                                          |          water  |                                            0  |
|       Mobile phase mass (metric 2) [kg]  |            gas  |                                  9.50193e+07  |
|                                          |          water  |                                   5.8832e+09  |
|------------------------------------------|-----------------|-----------------------------------------------|
|                     Component mass [kg]  |      gas / co2  |                                  9.50193e+07  |
|                                          |    gas / water  |                                            0  |
|                                          |    water / co2  |                                  7.33584e+07  |
|                                          |  water / water  |                                  5.80984e+09  |
|------------------------------------------------------------------------------------------------------------|
|                                                                                                            |
|                            Discretization: 'fluidTPFA' / Element set: 'injectorSurrounding' (25 elements)  |
|------------------------------------------------------------------------------------------------------------|
|                              statistics  |            min  |                average  |                max  |
|------------------------------------------|-----------------|-------------------------|---------------------|
|                           Pressure [Pa]  |   50203624.560  |           50359670.971  |       50515575.020  |
|                     Delta pressure [Pa]  |   37703624.560  |                      /  |       38015575.020  |
|                         Temperature [K]  |         368.15  |      368.1499906997449  |             368.15  |
|------------------------------------------|-----------------|-----------------------------------------------|
|         Total dynamic pore volume [rm3]  |            all  |                                    20363.237  |
|         Phase dynamic pore volume [rm3]  |            gas  |                                      1199.65  |
|                                          |          water  |                                      19163.6  |
|------------------------------------------|-----------------|-----------------------------------------------|
|                   Total fluid mass [kg]  |            all  |                                 20103033.517  |
|                         Phase mass [kg]  |            gas  |                                  1.00122e+06  |
|                                          |          water  |                                  1.91018e+07  |
|------------------------------------------|-----------------|-----------------------------------------------|
|      Trapped phase mass (metric 1) [kg]  |            gas  |                                       842127  |
|                                          |          water  |                                  6.08927e+06  |
|  Non-trapped phase mass (metric 1) [kg]  |            gas  |                                       159097  |
|                                          |          water  |                                  1.30125e+07  |
|------------------------------------------|-----------------|-----------------------------------------------|
|     Immobile phase mass (metric 2) [kg]  |            gas  |                                            0  |
|                                          |          water  |                                            0  |
|       Mobile phase mass (metric 2) [kg]  |            gas  |                                  1.00122e+06  |
|                                          |          water  |                                  1.91018e+07  |
|------------------------------------------|-----------------|-----------------------------------------------|
|                     Component mass [kg]  |      gas / co2  |                                  1.00122e+06  |
|                                          |    gas / water  |                                            0  |
|                                          |    water / co2  |                                  1.18866e+06  |
|                                          |  water / water  |                                  1.79132e+07  |
--------------------------------------------------------------------------------------------------------------

The infrastructure proposed here can be re-used for new statistics components which would process cell elements, and is implemented at the StatisticsAggregatorBase level, introduced in the PR #3836 .

The parameter has been used in the simpleCo2InjTutorial example to test that functionnality.

@MelReyCG MelReyCG added the flag: requires rebaseline Requires rebaseline branch in integratedTests label Apr 8, 2026
@MelReyCG MelReyCG added ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI labels May 21, 2026
Base automatically changed from bugfix/rey/split-statistics-components to develop July 7, 2026 12:46
@MelReyCG MelReyCG requested a review from joshua-white as a code owner July 7, 2026 12:46
@MelReyCG MelReyCG removed ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI labels Jul 9, 2026
@MelReyCG

MelReyCG commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

⚠️ Known issue I want to fix and include to this PR:
Fault regions are giving false positive errors

Details

Error message:

***** Exception
***** LOCATION: /.../GEOS/src/coreComponents/dataRepository/Group.hpp:326
***** Error cause: castedChild == nullptr
***** Rank 42
***** Message from Fault (Case.xml, l.123):
'elementRegionsGroup' was expected to be a 'geos::CellElementRegion'.

***** StackTrace of 21 frames
  - Frame  0:  geos::CellElementRegion& geos::dataRepository::Group::getGroup<geos::CellElementRegion, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
  - Frame  1:  geos::StatsAggregatorBase<geos::compositionalMultiphaseStatistics::StatsAggregator>::enableRegionStatisticsAggregation(std::function<geos::compositionalMultiphaseStatistics::RegionStatistics& (geos::dataRepository::Group&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&&)
  - Frame  2:  geos::compositionalMultiphaseStatistics::StatsAggregator::enableRegionStatisticsAggregation()
  - Frame  3:  geos::compositionalMultiphaseStatistics::StatsTask::registerDataOnMesh(geos::dataRepository::Group&)
  - Frame  4:  geos::dataRepository::Group::registerDataOnMeshRecursive(geos::dataRepository::Group&)
  - Frame  5:  geos::ProblemManager::problemSetup()
  - Frame  6:  geos::GeosxState::initializeDataRepository()
  - Frame  7:  main
  - Frame  8:  /lib64/libc.so.6
  - Frame  9:  __libc_start_main
  - Frame 10:  _start
  - Frame 11:  geos::StatsAggregatorBase<geos::compositionalMultiphaseStatistics::StatsAggregator>::enableRegionStatisticsAggregation(std::function<geos::compositionalMultiphaseStatistics::RegionStatistics& (geos::dataRepository::Group&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)>&&)
  - Frame 12:  geos::compositionalMultiphaseStatistics::StatsAggregator::enableRegionStatisticsAggregation()
  - Frame 13:  geos::compositionalMultiphaseStatistics::StatsTask::registerDataOnMesh(geos::dataRepository::Group&)
  - Frame 14:  geos::dataRepository::Group::registerDataOnMeshRecursive(geos::dataRepository::Group&)
  - Frame 15:  geos::ProblemManager::problemSetup()
  - Frame 16:  geos::GeosxState::initializeDataRepository()
  - Frame 17:  main
  - Frame 18:  /lib64/libc.so.6
  - Frame 19:  __libc_start_main
  - Frame 20:  _start
*****

@MelReyCG MelReyCG requested a review from castelletto1 as a code owner July 9, 2026 16:24
@MelReyCG MelReyCG added ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI labels Jul 9, 2026
@MelReyCG

MelReyCG commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: run CUDA builds Allows to triggers (costly) CUDA jobs ci: run integrated tests Allows to run the integrated tests in GEOS CI flag: ready for review flag: requires rebaseline Requires rebaseline branch in integratedTests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants