From d923beb85b2ff5146ccff5715b00b7d6a77ac12b Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Thu, 12 Oct 2017 10:18:47 +0100 Subject: [PATCH] functionObjects: forces: Write global and local values on the same line The forces function object, when specified with a full coordinate system, previously wrote forces and moments out in the following format: time-0 forces-0 moments-0 time-0 localForces-0 localMoments-0 time-1 forces-1 moments-1 time-1 localForces-1 localMoments-1 # etc ... There are two rows of values per time. This complicates the definition of the table and means that filtering has to be done before the data series can be visualised. The format has now been changed to the following form: time-0 forces-0 moments-0 localForces-0 localMoments-0 time-1 forces-1 moments-1 localForces-1 localMoments-1 # etc ... There is one row per time, and each column is therefore a continuous series of one variable that can be plotted. --- src/functionObjects/forces/forces/forces.C | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/functionObjects/forces/forces/forces.C b/src/functionObjects/forces/forces/forces.C index 9ade518a92..f1fb1e1bb4 100644 --- a/src/functionObjects/forces/forces/forces.C +++ b/src/functionObjects/forces/forces/forces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -419,14 +419,14 @@ void Foam::functionObjects::forces::writeForces() << endl; writeTime(file(MAIN_FILE)); + file(MAIN_FILE) << tab << setw(1) << '(' << sum(force_[0]) << setw(1) << ' ' << sum(force_[1]) << setw(1) << ' ' << sum(force_[2]) << setw(3) << ") (" << sum(moment_[0]) << setw(1) << ' ' << sum(moment_[1]) << setw(1) << ' ' - << sum(moment_[2]) << setw(1) << ')' - << endl; + << sum(moment_[2]) << setw(1) << ')'; if (localSystem_) { @@ -437,16 +437,16 @@ void Foam::functionObjects::forces::writeForces() vectorField localMomentT(coordSys_.localVector(moment_[1])); vectorField localMomentP(coordSys_.localVector(moment_[2])); - writeTime(file(MAIN_FILE)); file(MAIN_FILE) << tab << setw(1) << '(' << sum(localForceN) << setw(1) << ' ' << sum(localForceT) << setw(1) << ' ' << sum(localForceP) << setw(3) << ") (" << sum(localMomentN) << setw(1) << ' ' << sum(localMomentT) << setw(1) << ' ' - << sum(localMomentP) << setw(1) << ')' - << endl; + << sum(localMomentP) << setw(1) << ')'; } + + file(MAIN_FILE) << endl; }