Skip to content

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

Open
MelReyCG wants to merge 24 commits intobugfix/rey/split-statistics-componentsfrom
feature/rey/arbitrary-regions-stats
Open

feat: Adding flow statistics for arbitrary mesh element sets#4005
MelReyCG wants to merge 24 commits intobugfix/rey/split-statistics-componentsfrom
feature/rey/arbitrary-regions-stats

Conversation

@MelReyCG
Copy link
Copy Markdown
Contributor

@MelReyCG MelReyCG commented Mar 26, 2026

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 changed the title feat: Adding statistics for given mesh element sets feat: Adding flow statistics for arbitrary mesh element sets Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant