Skip to content
Snippets Groups Projects
Commit 6d4dc8c7 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

LBM: added MLUPS to the solver monitor

parent e638c8f8
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,8 @@ public: ...@@ -35,6 +35,8 @@ public:
void setResidue( const RealType& residue ); void setResidue( const RealType& residue );
void setVerbose( const Index& verbose ); void setVerbose( const Index& verbose );
void setNodesPerIteration( const IndexType& nodes );
virtual void refresh(); virtual void refresh();
...@@ -45,11 +47,13 @@ protected: ...@@ -45,11 +47,13 @@ protected:
std::atomic_bool saved; std::atomic_bool saved;
RealType time, saved_time, timeStep, saved_timeStep, residue, saved_residue; RealType time, saved_time, timeStep, saved_timeStep, residue, saved_residue, elapsed_time_before_refresh;
IndexType iterations, saved_iterations; IndexType iterations, saved_iterations, iterations_before_refresh;
IndexType verbose; IndexType verbose;
IndexType nodesPerIteration;
}; };
} // namespace Solvers } // namespace Solvers
......
...@@ -37,9 +37,12 @@ IterativeSolverMonitor< Real, Index > :: IterativeSolverMonitor() ...@@ -37,9 +37,12 @@ IterativeSolverMonitor< Real, Index > :: IterativeSolverMonitor()
saved_timeStep( 0.0 ), saved_timeStep( 0.0 ),
residue( 0.0 ), residue( 0.0 ),
saved_residue( 0.0 ), saved_residue( 0.0 ),
elapsed_time_before_refresh( 0.0 ),
iterations( 0 ), iterations( 0 ),
saved_iterations( 0 ), saved_iterations( 0 ),
verbose( 1 ) iterations_before_refresh( 0 ),
verbose( 1 ),
nodesPerIteration( 0 )
{ {
} }
...@@ -93,6 +96,12 @@ void IterativeSolverMonitor< Real, Index > :: setVerbose( const Index& verbose ) ...@@ -93,6 +96,12 @@ void IterativeSolverMonitor< Real, Index > :: setVerbose( const Index& verbose )
this->verbose = verbose; this->verbose = verbose;
} }
template< typename Real, typename Index>
void IterativeSolverMonitor< Real, Index > :: setNodesPerIteration( const IndexType& nodes )
{
this->nodesPerIteration = nodes;
}
template< typename Real, typename Index> template< typename Real, typename Index>
void IterativeSolverMonitor< Real, Index > :: refresh() void IterativeSolverMonitor< Real, Index > :: refresh()
{ {
...@@ -133,7 +142,7 @@ void IterativeSolverMonitor< Real, Index > :: refresh() ...@@ -133,7 +142,7 @@ void IterativeSolverMonitor< Real, Index > :: refresh()
if( (saved) ? saved_timeStep : timeStep > 0 ) { if( (saved) ? saved_timeStep : timeStep > 0 ) {
// print_item( " TAU:" ); // print_item( " TAU:" );
print_item( " TAU:", 0 ); print_item( " TAU:", 0 );
print_item( real_to_string( (saved) ? saved_timeStep : timeStep, 5 ), 8 ); print_item( real_to_string( (saved) ? saved_timeStep : timeStep, 5 ), 10 );
} }
const std::string displayed_stage = (saved) ? saved_stage : stage; const std::string displayed_stage = (saved) ? saved_stage : stage;
...@@ -159,6 +168,14 @@ void IterativeSolverMonitor< Real, Index > :: refresh() ...@@ -159,6 +168,14 @@ void IterativeSolverMonitor< Real, Index > :: refresh()
print_item( real_to_string( (saved) ? saved_residue : residue, 5 ), 12 ); print_item( real_to_string( (saved) ? saved_residue : residue, 5 ), 12 );
} }
if( nodesPerIteration ) {
const RealType mlups = nodesPerIteration * (iterations - iterations_before_refresh) / (getElapsedTime() - elapsed_time_before_refresh) * 1e-6;
print_item( " MLUPS:", 0 );
print_item( real_to_string( mlups, 5 ), 7 );
}
iterations_before_refresh = iterations;
elapsed_time_before_refresh = getElapsedTime();
// return to the beginning of the line // return to the beginning of the line
std::cout << "\r" << std::flush; std::cout << "\r" << std::flush;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment