Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 )


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**@}*/


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,26 +469,25 @@ TestSet getTestSet()
xMax="{ 10.01, 10.01, 0.01 }" />
</Geometry>

<!-- We are adding 500s to the whole sim time to force the wholeSimStatsEvent to be executed -->
<Events maxTime="5500.0">
<PeriodicEvent name="solverApplications"
forceDt="500.0"
target="/Solvers/testSolver" />

<Events maxTime="5000.0">
<PeriodicEvent name="timestepStatsEvent"
timeFrequency="500.0"
target="/Tasks/timeStepFluxStats" />
<PeriodicEvent name="timestepReservoirStatsEvent"
timeFrequency="500.0"
target="/Tasks/timeStepReservoirStats" />

<PeriodicEvent name="wholeSimStatsEvent"
timeFrequency="5000.0"
target="/Tasks/wholeSimFluxStats" />

<PeriodicEvent name="timestepsCheckEvent"
timeFrequency="500.0"
target="/Tasks/timeStepChecker" />

<PeriodicEvent name="wholeSimStatsEvent"
timeFrequency="5000.0"
target="/Tasks/wholeSimFluxStats" />
<PeriodicEvent name="solverApplications"
forceDt="500.0"
target="/Solvers/testSolver" />
</Events>

<Tasks>
Expand All @@ -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 }"
/>
</Functions>

Expand Down Expand Up @@ -714,26 +713,25 @@ TestSet getTestSet()
xMax="{ 10.01, 10.01, 0.01 }" />
</Geometry>

<!-- We are adding 500s to the whole sim time to force the wholeSimStatsEvent to be executed -->
<Events maxTime="5500.0">
<PeriodicEvent name="solverApplications"
forceDt="500.0"
target="/Solvers/testSolver" />

<Events maxTime="5000.0">
<PeriodicEvent name="timestepFluxStatsEvent"
timeFrequency="500.0"
target="/Tasks/timeStepFluxStats" />
<PeriodicEvent name="timestepReservoirStatsEvent"
timeFrequency="500.0"
target="/Tasks/timeStepReservoirStats" />

<PeriodicEvent name="wholeSimStatsEvent"
timeFrequency="5000.0"
target="/Tasks/wholeSimFluxStats" />

<PeriodicEvent name="timestepsCheckEvent"
timeFrequency="500.0"
target="/Tasks/timeStepChecker" />

<PeriodicEvent name="wholeSimStatsEvent"
timeFrequency="5000.0"
target="/Tasks/wholeSimFluxStats" />
<PeriodicEvent name="solverApplications"
forceDt="500.0"
target="/Solvers/testSolver" />
</Events>

<Tasks>
Expand All @@ -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 }"
/>
<!-- water depletion rates in mol/s -->
<TableFunction
name="FluxProductionRate"
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.003, 0.062, 0.121, 0.427, 0.502, 0.199, 0.083, 0.027, 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.003, 0.062, 0.121, 0.427, 0.502, 0.199, 0.083, 0.027, 0.000, 0.000 }"
/>

<TableFunction name="initGasCompFracTable"
Expand Down Expand Up @@ -986,26 +984,25 @@ TestSet getTestSet()
xMax="{ 10.01, 10.01, 0.01 }" />
</Geometry>

<!-- We are adding 500s to the whole sim time to force the wholeSimStatsEvent to be executed -->
<Events maxTime="5500.0">
<PeriodicEvent name="solverApplications"
forceDt="500.0"
target="/Solvers/testSolver" />

<Events maxTime="5000.0">
<PeriodicEvent name="timestepFluxStatsEvent"
timeFrequency="500.0"
target="/Tasks/timeStepFluxStats" />
<PeriodicEvent name="timestepReservoirStatsEvent"
timeFrequency="500.0"
target="/Tasks/timeStepReservoirStats" />

<PeriodicEvent name="wholeSimStatsEvent"
timeFrequency="5000.0"
target="/Tasks/wholeSimFluxStats" />

<PeriodicEvent name="timestepsCheckEvent"
timeFrequency="500.0"
target="/Tasks/timeStepChecker" />

<PeriodicEvent name="wholeSimStatsEvent"
timeFrequency="5000.0"
target="/Tasks/wholeSimFluxStats" />
<PeriodicEvent name="solverApplications"
forceDt="500.0"
target="/Solvers/testSolver" />
</Events>

<Tasks>
Expand All @@ -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 }"
/>
<!-- water depletion rates in mol/s -->
<TableFunction
name="FluxProductionRate"
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.003, 0.062, 0.121, 0.427, 0.502, 0.199, 0.083, 0.027, 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.003, 0.062, 0.121, 0.427, 0.502, 0.199, 0.083, 0.027, 0.000, 0.000 }"
/>

<TableFunction name="initGasCompFracTable"
Expand Down Expand Up @@ -1159,4 +1156,4 @@ int main( int argc, char * * argv )
int const result = RUN_ALL_TESTS();
geos::basicCleanup();
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,28 @@ bool SolidMechanicsStatistics::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 & )
{
// 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**@}*/

/**
Expand Down
Loading