GEOS-DEV / GEOS

GEOS Simulation Framework
GNU Lesser General Public License v2.1
203 stars 80 forks source link

Statistics output refactoring #3145

Open arng40 opened 1 month ago

arng40 commented 1 month ago

Describe the issue

In the future, outputs of the statistics classes would be done with PackCollection & TimeHistory & 2 events (3 in total), which is quite verbose and inconvenient for the user to maintain.

Proposed cleanup

I propose 2 alternatives but these suggestions could change:

Main Proposal: We could only have 2 node to ask When and What is to output.

CompositionalMultiphaseStatistics would now be an output, with two optional attributes:

Within the code, we would have:

<Outputs>
  <CompositionalMultiphaseStatistics
     name="compflowStatistics"
     flowSolverName="compositionalMultiphaseFVMSolver"
     logLevel="1"
     computeCFLNumbers="1"
     computeRegionStatistics="1" 
     outputFile="singlePhaseStats.hdf" />
</Outputs>

<Events>
  <PeriodicEvent
    name="myStatsOutputEvent"
    timeFrequency="1e5"
    targetExactTimestep="1"
    target="/Outputs/compflowStatistics" />
</Events>

Alternative Proposal

Separate the output file from the statistics declaration, therefore we can have multiple statistics output files inside <Outputs>. StatsOutput would be an observer of the statistics classes and wouldn't require additional events.

<Tasks>
  <CompositionalMultiphaseStatistics
     name="compflowStatistics"
     flowSolverName="compositionalMultiphaseFVMSolver"
     logLevel="1"
     computeCFLNumbers="1"
     computeRegionStatistics="1" />
</Tasks>

<Outputs>
  <StatsOutput
    name="myStatsOutput"
    source="compflowStatistics"
    outputFile="sourceFluxStats.csv" />
</Outputs>

<Events>
  <PeriodicEvent
    name="myStatsOutputEvent"
    timeFrequency="1e5"
    targetExactTimestep="1"
    target="/Tasks/compflowStatistics" />
</Events>

co-authored with @MelReyCG.