Skip to content

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

Merged
victorapm merged 412 commits into
developfrom
feature/rey/arbitrary-regions-stats
Oct 24, 2026
Merged

victorapm merged 412 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.

Comment thread src/coreComponents/physicsSolvers/StatisticsAggregatorBaseHelpers.hpp Outdated
Comment thread src/coreComponents/physicsSolvers/StatisticsAggregatorBaseHelpers.hpp Outdated

@OmarDuran OmarDuran left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @MelReyCG, I left two minor suggestions

@MelReyCG MelReyCG added the ci: run device builds Allows to run the device (CUDA/HIP) builds label Aug 31, 2026
@victorapm

Copy link
Copy Markdown
Contributor

@jhuang2601 and/or @joshua-white could you take a look as code owners?

auto const * const subRegionSetWrapper = subRegion.sets().getWrapperPointer< SetType >( setName );
if( subRegionSetWrapper != nullptr )
{
if( subRegionSetWrapper->reference().empty() )

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if( subRegionSetWrapper->reference().empty() )
if( !subRegionSetWrapper->reference().empty() )

A requested set should be considered valid if at least one rank reports it as found and non-empty, right?

@victorapm
victorapm merged commit 6d64693 into develop Oct 24, 2026
22 checks passed
@victorapm
victorapm deleted the feature/rey/arbitrary-regions-stats branch October 24, 2026 05:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci: run device builds Allows to run the device (CUDA/HIP) builds 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.

8 participants