diff --git a/src/coreComponents/integrationTests/testingUtilities/TestingTasks.cpp b/src/coreComponents/integrationTests/testingUtilities/TestingTasks.cpp index 0a1e4644f97..aed24fe516d 100644 --- a/src/coreComponents/integrationTests/testingUtilities/TestingTasks.cpp +++ b/src/coreComponents/integrationTests/testingUtilities/TestingTasks.cpp @@ -43,6 +43,13 @@ bool TimeStepChecker::execute( real64 const time_n, return false; } +void TimeStepChecker::cleanup( real64 time_n, integer cycleNumber, + integer eventCounter, real64 eventProgress, + DomainPartition & domain ) +{ + execute( time_n, 0.0, cycleNumber, eventCounter, eventProgress, domain ); +} + REGISTER_CATALOG_ENTRY( TaskBase, TimeStepChecker, string const &, geos::dataRepository::Group * const ) diff --git a/src/coreComponents/integrationTests/testingUtilities/TestingTasks.hpp b/src/coreComponents/integrationTests/testingUtilities/TestingTasks.hpp index fb4dfa359f8..712ba347aae 100644 --- a/src/coreComponents/integrationTests/testingUtilities/TestingTasks.hpp +++ b/src/coreComponents/integrationTests/testingUtilities/TestingTasks.hpp @@ -20,6 +20,7 @@ #ifndef GEOS_EVENTS_TASKS_TESTINGTASKS_HPP_ #define GEOS_EVENTS_TASKS_TESTINGTASKS_HPP_ +#include "common/DataTypes.hpp" #include "events/tasks/TaskBase.hpp" #include "codingUtilities/UnitTestUtilities.hpp" @@ -68,6 +69,10 @@ class TimeStepChecker : public TaskBase integer eventCounter, real64 eventProgress, DomainPartition & domain ); + virtual void cleanup( real64 time_n, integer cycleNumber, + integer eventCounter, real64 eventProgress, + DomainPartition & domain ); + private: std::function< void(real64) > m_checkTimeStepFunction; int m_timestepId = 0; diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp index c83695e5a98..7797b9329dd 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.cpp @@ -192,29 +192,38 @@ bool CompositionalMultiphaseStatistics::execute( real64 const time_n, real64 const dt, integer const GEOS_UNUSED_PARAM( cycleNumber ), integer const GEOS_UNUSED_PARAM( eventCounter ), - real64 const GEOS_UNUSED_PARAM( eventProgress ), + real64 const eventProgress, DomainPartition & domain ) { + real64 const time = time_n + dt * eventProgress; m_solver->forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) { if( m_computeRegionStatistics ) { - // current time is time_n + dt - computeRegionStatistics( time_n + dt, mesh, regionNames ); + computeRegionStatistics( time, mesh, regionNames ); } } ); if( m_computeCFLNumbers ) { - // current time is time_n + dt - computeCFLNumbers( time_n + dt, dt, domain ); + computeCFLNumbers( time, dt, domain ); } return false; } +void CompositionalMultiphaseStatistics::cleanup( real64 const time_n, + integer const cycleNumber, + integer const eventCounter, + real64 const eventProgress, + DomainPartition & domain ) +{ + execute( time_n, 0.0, cycleNumber, eventCounter, eventProgress, domain ); +} + + void CompositionalMultiphaseStatistics::computeRegionStatistics( real64 const time, MeshLevel & mesh, string_array const & regionNames ) const diff --git a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.hpp b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.hpp index dbe275b7b6f..9996a96210a 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/CompositionalMultiphaseStatistics.hpp @@ -65,6 +65,15 @@ class CompositionalMultiphaseStatistics : public FieldStatisticsBase< Compositio real64 const eventProgress, DomainPartition & domain ) override; + /** + * @copydoc ExecutableGroup::cleanup() + */ + virtual void cleanup( real64 const time_n, + integer const cycleNumber, + integer const eventCounter, + real64 const eventProgress, + DomainPartition & domain ) override; + /**@}*/ struct RegionStatistics diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp index 31cfee04b70..af2bedfd34d 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.cpp @@ -96,19 +96,28 @@ bool SinglePhaseStatistics::execute( real64 const time_n, real64 const dt, integer const GEOS_UNUSED_PARAM( cycleNumber ), integer const GEOS_UNUSED_PARAM( eventCounter ), - real64 const GEOS_UNUSED_PARAM( eventProgress ), + real64 const eventProgress, DomainPartition & domain ) { + real64 const time = time_n + dt * eventProgress; m_solver->forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & regionNames ) { - // current time is time_n + dt - computeRegionStatistics( time_n + dt, mesh, regionNames ); + computeRegionStatistics( time, mesh, regionNames ); } ); return false; } +void SinglePhaseStatistics::cleanup( real64 const time_n, + integer const cycleNumber, + integer const eventCounter, + real64 const eventProgress, + DomainPartition & domain ) +{ + execute( time_n, 0.0, cycleNumber, eventCounter, eventProgress, domain ); +} + void SinglePhaseStatistics::computeRegionStatistics( real64 const time, MeshLevel & mesh, string_array const & regionNames ) const diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.hpp b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.hpp index 4906790b026..6f88ca6409d 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SinglePhaseStatistics.hpp @@ -63,6 +63,15 @@ class SinglePhaseStatistics : public FieldStatisticsBase< SinglePhaseBase > real64 const eventProgress, DomainPartition & domain ) override; + /** + * @copydoc ExecutableGroup::cleanup() + */ + virtual void cleanup( real64 const time_n, + integer const cycleNumber, + integer const eventCounter, + real64 const eventProgress, + DomainPartition & domain ) override; + /**@}*/ diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp b/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp index 26f734efd64..262bf21580a 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.cpp @@ -282,6 +282,15 @@ bool SourceFluxStatsAggregator::execute( real64 const GEOS_UNUSED_PARAM( time_n return false; } +void SourceFluxStatsAggregator::cleanup( real64 const time_n, + integer const cycleNumber, + integer const eventCounter, + real64 const eventProgress, + DomainPartition & domain ) +{ + execute( time_n, 0.0, cycleNumber, eventCounter, eventProgress, domain ); +} + void SourceFluxStatsAggregator::StatData::allocate( integer phaseCount ) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.hpp b/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.hpp index b777cd3ba07..226c8c4a742 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/SourceFluxStatistics.hpp @@ -223,6 +223,15 @@ class SourceFluxStatsAggregator final : public FieldStatisticsBase< FlowSolverBa real64 const eventProgress, DomainPartition & domain ) override; + /** + * @copydoc ExecutableGroup::cleanup() + */ + virtual void cleanup( real64 const time_n, + integer const cycleNumber, + integer const eventCounter, + real64 const eventProgress, + DomainPartition & domain ) override; + /** * @brief Apply a functor to WrappedStats that combines all stats for each target solver * discretization mesh levels. diff --git a/src/coreComponents/physicsSolvers/fluidFlow/unitTests/testFlowStatistics.cpp b/src/coreComponents/physicsSolvers/fluidFlow/unitTests/testFlowStatistics.cpp index 356661e434e..ad4f74a4833 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/unitTests/testFlowStatistics.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/unitTests/testFlowStatistics.cpp @@ -469,12 +469,7 @@ TestSet getTestSet() xMax="{ 10.01, 10.01, 0.01 }" /> - - - - + @@ -482,13 +477,17 @@ TestSet getTestSet() timeFrequency="500.0" target="/Tasks/timeStepReservoirStats" /> + + - + @@ -514,8 +513,8 @@ TestSet getTestSet() name="FluxRate" inputVarNames="{ time }" interpolation="lower" - coordinates="{ 0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0, 3000.0, 3500.0, 4000.0, 4500.0, 5000.0, 5500.0 }" - values="{ 0.000, 0.000, 0.767, 0.894, 0.561, 0.234, 0.194, 0.178, 0.162, 0.059, 0.000, 0.000 }" + coordinates="{ 0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0, 3000.0, 3500.0, 4000.0, 4500.0, 5000.0 }" + values="{ 0.000, 0.767, 0.894, 0.561, 0.234, 0.194, 0.178, 0.162, 0.059, 0.000, 0.000 }" /> @@ -714,12 +713,7 @@ TestSet getTestSet() xMax="{ 10.01, 10.01, 0.01 }" /> - - - - + @@ -727,13 +721,17 @@ TestSet getTestSet() timeFrequency="500.0" target="/Tasks/timeStepReservoirStats" /> + + - + @@ -759,16 +757,16 @@ TestSet getTestSet() name="FluxInjectionRate" inputVarNames="{ time }" interpolation="lower" - coordinates="{ 0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0, 3000.0, 3500.0, 4000.0, 4500.0, 5000.0, 5500.0 }" - values="{ 0.000, 0.000, 0.267, 0.561, 0.194, 0.102, 0.059, 0.000, 0.000, 0.000, 0.000, 0.000 }" + coordinates="{ 0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0, 3000.0, 3500.0, 4000.0, 4500.0, 5000.0 }" + values="{ 0.000, 0.267, 0.561, 0.194, 0.102, 0.059, 0.000, 0.000, 0.000, 0.000, 0.000 }" /> - - - - + @@ -999,13 +992,17 @@ TestSet getTestSet() timeFrequency="500.0" target="/Tasks/timeStepReservoirStats" /> + + - + @@ -1031,16 +1028,16 @@ TestSet getTestSet() name="FluxInjectionRate" inputVarNames="{ time }" interpolation="lower" - coordinates="{ 0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0, 3000.0, 3500.0, 4000.0, 4500.0, 5000.0, 5500.0 }" - values="{ 0.000, 0.000, 0.267, 0.561, 0.194, 0.102, 0.059, 0.000, 0.000, 0.000, 0.000, 0.000 }" + coordinates="{ 0.0, 500.0, 1000.0, 1500.0, 2000.0, 2500.0, 3000.0, 3500.0, 4000.0, 4500.0, 5000.0 }" + values="{ 0.000, 0.267, 0.561, 0.194, 0.102, 0.059, 0.000, 0.000, 0.000, 0.000, 0.000 }" /> forDiscretizationOnMeshTargets( domain.getMeshBodies(), [&] ( string const &, MeshLevel & mesh, string_array const & ) { - // current time is time_n + dt - computeNodeStatistics( mesh, time_n + dt ); + computeNodeStatistics( mesh, time ); } ); return false; } +void SolidMechanicsStatistics::cleanup( real64 const time_n, + integer const cycleNumber, + integer const eventCounter, + real64 const eventProgress, + DomainPartition & domain ) +{ + execute( time_n, 0.0, cycleNumber, eventCounter, eventProgress, domain ); +} + void SolidMechanicsStatistics::computeNodeStatistics( MeshLevel & mesh, real64 const time ) const { GEOS_MARK_FUNCTION; diff --git a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.hpp b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.hpp index 975c057b075..7873491e9c6 100644 --- a/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.hpp +++ b/src/coreComponents/physicsSolvers/solidMechanics/SolidMechanicsStatistics.hpp @@ -61,6 +61,15 @@ class SolidMechanicsStatistics : public FieldStatisticsBase< SolidMechanicsLagra real64 const eventProgress, DomainPartition & domain ) override; + /** + * @copydoc ExecutableGroup::cleanup() + */ + virtual void cleanup( real64 const time_n, + integer const cycleNumber, + integer const eventCounter, + real64 const eventProgress, + DomainPartition & domain ) override; + /**@}*/ /**