From 181b4ce5daf7eb3d6080e74bc28e1560f14672e3 Mon Sep 17 00:00:00 2001 From: Alexander Jaust <alexander.jaust@ipvs.uni-stuttgart.de> Date: Tue, 21 Apr 2020 14:34:47 +0200 Subject: [PATCH] updated main --- .../iterative-reversed/main_pm-reversed.cc | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/appl/coupling-ff-pm/iterative-reversed/main_pm-reversed.cc b/appl/coupling-ff-pm/iterative-reversed/main_pm-reversed.cc index 73f26f5..e49be8b 100644 --- a/appl/coupling-ff-pm/iterative-reversed/main_pm-reversed.cc +++ b/appl/coupling-ff-pm/iterative-reversed/main_pm-reversed.cc @@ -429,6 +429,7 @@ int main(int argc, char** argv) try auto sol_checkpoint = sol; double vtkTime = 1.0; + size_t iter = 0; while ( couplingInterface.isCouplingOngoing() ) { @@ -485,6 +486,44 @@ int main(int argc, char** argv) try const double preciceDt = couplingInterface.advance( dt ); dt = std::min( preciceDt, dt ); + { + double min = std::numeric_limits<double>::max(); + double max = std::numeric_limits<double>::min(); + double sum = 0.; + const std::string filename = getParam<std::string>("Problem.Name") + "-" + darcyProblem->name() + "-interface-velocity-" + std::to_string(iter); + std::tie(min, max, sum) = writeVelocitiesOnInterfaceToFile<FluxVariables>( filename, + *darcyProblem, + *darcyGridVariables, + sol ); + const int prec = std::cout.precision(); + std::cout << "Velocity statistics:" << std::endl + << std::setprecision(std::numeric_limits<double>::digits10 + 1) + << " min: " << min << std::endl + << " max: " << max << std::endl + << " sum: " << sum << std::endl; + std::cout.precision( prec ); + { + const std::string filenameFlow="darcy-statistics-" + std::to_string(iter); + std::ofstream ofs( filenameFlow+".txt", std::ofstream::out | std::ofstream::trunc); + const auto prec = ofs.precision(); + ofs << "Velocity statistics (free flow):" << std::endl + << std::setprecision(std::numeric_limits<double>::digits10 + 1) + << " min: " << min << std::endl + << " max: " << max << std::endl + << " sum: " << sum << std::endl; + ofs.precision( prec ); + ofs.close(); + } + } + { + const std::string filename = getParam<std::string>("Problem.Name") + "-" + darcyProblem->name() + "-interface-pressure-" + std::to_string(iter); + writePressuresOnInterfaceToFile( filename, + *darcyProblem, + *darcyGridVariables, + sol ); + } + ++iter; + if ( couplingInterface.hasToReadIterationCheckpoint() ) { //Read checkpoint -- GitLab