20 #ifndef SRC_CORECOMPONENTS_PHYSICSSOLVERS_FLUIDFLOW_SOURCEFLUXSTATISTICS_HPP_
21 #define SRC_CORECOMPONENTS_PHYSICSSOLVERS_FLUIDFLOW_SOURCEFLUXSTATISTICS_HPP_
139 {
return m_statsPeriodStart; }
145 {
return m_statsPeriodDT; }
151 {
return m_aggregatorName; }
157 {
return m_fluxName; }
162 real64 m_statsPeriodStart{-LvArray::NumericLimits< real64 >::max};
176 real64 m_timeStepStart = 0.0;
178 real64 m_timeStepDeltaTime = 0.0;
180 real64 m_periodStart = -LvArray::NumericLimits< real64 >::max;
182 real64 m_periodPendingDeltaTime = 0.0;
186 bool m_isGathering =
false;
192 void allocate(
integer phaseCount );
201 {
return m_timeStepMass.size(); }
205 string m_aggregatorName;
217 Group *
const parent );
231 real64 const eventProgress,
244 template<
typename LAMBDA >
255 template<
typename LAMBDA >
268 template<
typename LAMBDA >
280 template<
typename LAMBDA >
295 template<
typename LAMBDA >
329 string m_csvFilename;
335 void registerDataOnMesh(
Group & meshBodies )
override;
340 void postInputInitialization()
override;
353 void gatherStatsForLog(
bool logLevelActive,
357 WrappedStats
const & wrappedStats );
366 WrappedStats
const & stats );
374 void outputStatsToLog(
bool logLevelActive,
string_view fluxesStr,
TableData const & tableMeshData );
380 void outputStatsToCSV(
TableData & csvData );
385 template<
typename LAMBDA >
392 if( statsWrapper.referenceAsView().getFluxName() == fluxName )
394 lambda( statsWrapper.reference() );
399 template<
typename LAMBDA >
404 [&] (
string const &,
408 string const wrapperName = getStatWrapperName( viewKeyStruct::fluxSetWrapperString() );
409 WrappedStats & stats = meshLevel.getWrapper< WrappedStats >( wrapperName ).reference();
411 lambda( meshLevel, stats );
414 template<
typename LAMBDA >
418 for(
string const & fluxName : m_fluxNames )
423 lambda( meshLevel, stats );
426 template<
typename LAMBDA >
436 lambda( region, stats );
439 template<
typename LAMBDA >
449 lambda( subRegion, stats );
454 {
return GEOS_FMT(
"{}_region_stats_for_{}", fluxName,
getName() ); }
Partition of the decomposed physical domain. It also manages the connexion information to its neighbo...
Group const & getMeshBodies() const
Get the mesh bodies, const version.
The ElementRegionBase is the base class to manage the data stored at the element level.
void forElementSubRegions(LAMBDA &&lambda) const
Apply a lambda to all subregions.
void forElementRegions(LAMBDA &&lambda)
This function is used to launch kernel function over all the element regions with region type = Eleme...
FlowSolverBase * m_solver
Pointer to the physics solver.
Class facilitating the representation of a multi-level discretization of a MeshBody.
ElementRegionManager const & getElemManager() const
Get the element region manager.
void forDiscretizationOnMeshTargets(Group const &meshBodies, LAMBDA &&lambda) const
Loop over the target discretization on all mesh targets and apply callback.
Class that aggregate statistics of a flux over multiple time-steps for a given SourceFluxStatsAggrega...
real64 getStatsPeriodStart() const
void gatherTimeStepStats(real64 currentTime, real64 dt, arrayView1d< real64 const > const &producedMass, integer elementCount)
Set the current time step stats. Accumulate the statistics only if the time is strictly after the pre...
string_view getFluxName() const
void combine(WrappedStats const &other)
Aggregate the statistics of the instance with those of another one.
real64 getStatsPeriodDuration() const
void finalizePeriod()
Finalize the period statistics of each timestep gathering and render data over all mpi ranks....
void setTarget(string_view aggregatorName, string_view fluxName)
Set the subjects targeted by the stats.
string_view getAggregatorName() const
StatData const & stats() const
string getStatWrapperName(string_view fluxName) const
virtual bool execute(real64 const time_n, real64 const dt, integer const cycleNumber, integer const eventCounter, real64 const eventProgress, DomainPartition &domain) override
Main extension point of executable targets.
void forAllSubRegionStatsWrappers(ElementRegionBase ®ion, string_view fluxName, LAMBDA &&lambda)
Apply a functor to all subregion WrappedStats (of the given region) that target a given flux.
void forAllFluxStatsWrappers(MeshLevel &meshLevel, LAMBDA &&lambda)
Apply a functor to each WrappedStats that combines the stats over all region for a flux.
static string catalogName()
static void forAllFluxStatWrappers(Group &container, string_view fluxName, LAMBDA &&lambda)
Apply a functor to all WrappedStats of the given group that target a given flux (and potentially mult...
void forAllRegionStatsWrappers(MeshLevel &meshLevel, string_view fluxName, LAMBDA &&lambda)
Apply a functor to all simulated region WrappedStats (of the given MeshLevel) that target a given flu...
SourceFluxStatsAggregator(const string &name, Group *const parent)
Constructor for the statistics class.
void forMeshLevelStatsWrapper(DomainPartition &domain, LAMBDA &&lambda)
Apply a functor to WrappedStats that combines all stats for each target solver discretization mesh le...
Class for managing table data.
Class for setup the table layout.
string const & getName() const
Get group name.
Wrapper< T > const & getWrapper(LOOKUP_TYPE const &index) const
Retrieve a Wrapper stored in this group.
void forWrappers(LAMBDA &&lambda)
Apply the given functor to wrappers.
ArrayView< T, 1 > arrayView1d
Alias for 1D array view.
stdVector< string > string_array
A 1-dimensional array of geos::string types.
double real64
64-bit floating point type.
int integer
Signed integer type.
Array< T, 1 > array1d
Alias for 1D array.
std::string_view string_view
String type.
Aggregated flux statistics data.
void reset()
reset the stats to 0.0
integer getPhaseCount() const
void allocate(integer phaseCount)
resize the phase data arrays if needed
void mpiReduce()
Aggregate the statistics of the instance with those from all instances from other MPI ranks....
array1d< real64 > m_producedMass
array1d< real64 > m_productionRate
void combine(StatData const &other)
Aggregate the statistics of the instance with those of another one.
integer m_elementCount
Owned cells producing/injecting. Local until mpiReduce()/finalizePeriod(), then global.
constexpr static string_view fluxNamesString()
constexpr static string_view fluxSetWrapperString()
constexpr static string_view allRegionWrapperString()