From 6d19668f8fe76b7439506e16cce6ee7c9497432b Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 14 Jan 2014 23:09:03 +0000 Subject: [PATCH] forces: write in OpenFOAM ListList format so they can be read by the OpenFOAM parser --- .../forces/forceCoeffs/forceCoeffs.C | 4 +- .../functionObjects/forces/forces/forces.C | 66 +++++++++---------- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C index 283a93e426..6c20c0a19b 100644 --- a/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C +++ b/src/postProcessing/functionObjects/forces/forceCoeffs/forceCoeffs.C @@ -33,7 +33,7 @@ License namespace Foam { -defineTypeNameAndDebug(forceCoeffs, 0); + defineTypeNameAndDebug(forceCoeffs, 0); } @@ -100,7 +100,7 @@ void Foam::forceCoeffs::writeFileHeader(const label i) for (label j = 0; j < nBin_; j++) { - const word jn('[' + Foam::name(j) + ']'); + const word jn('(' + Foam::name(j) + ')'); writeTabbed(file(i), "Cm" + jn); writeTabbed(file(i), "Cd" + jn); writeTabbed(file(i), "Cl" + jn); diff --git a/src/postProcessing/functionObjects/forces/forces/forces.C b/src/postProcessing/functionObjects/forces/forces/forces.C index d624554e93..84863f7f7b 100644 --- a/src/postProcessing/functionObjects/forces/forces/forces.C +++ b/src/postProcessing/functionObjects/forces/forces/forces.C @@ -39,7 +39,7 @@ License namespace Foam { -defineTypeNameAndDebug(forces, 0); + defineTypeNameAndDebug(forces, 0); } @@ -78,8 +78,8 @@ void Foam::forces::writeFileHeader(const label i) writeCommented(file(i), "Time"); file(i) - << "forces[pressure,viscous,porous] " - << "moment[pressure,viscous,porous]"; + << "forces(pressure viscous porous) " + << "moment(pressure viscous porous)"; if (localSystem_) { @@ -126,7 +126,7 @@ void Foam::forces::writeFileHeader(const label i) for (label j = 0; j < nBin_; j++) { - const word jn('[' + Foam::name(j) + ']'); + const word jn('(' + Foam::name(j) + ')'); const word f("forces" + jn + "[pressure,viscous,porous]"); const word m("moments" + jn + "[pressure,viscous,porous]"); @@ -136,7 +136,7 @@ void Foam::forces::writeFileHeader(const label i) { for (label j = 0; j < nBin_; j++) { - const word jn('[' + Foam::name(j) + ']'); + const word jn('(' + Foam::name(j) + ')'); const word f("localForces" + jn + "[pressure,viscous,porous]"); const word m("localMoments" + jn + "[pressure,viscous,porous]"); @@ -403,13 +403,13 @@ void Foam::forces::writeForces() << " porous : " << sum(moment_[2]) << endl; - file(0) << obr_.time().value() << 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) << "]" + file(0) << obr_.time().value() << 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; if (localSystem_) @@ -421,13 +421,13 @@ void Foam::forces::writeForces() vectorField localMomentT(coordSys_.localVector(moment_[1])); vectorField localMomentP(coordSys_.localVector(moment_[2])); - file(0) << obr_.time().value() << 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) << "]" + file(0) << obr_.time().value() << 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; } } @@ -462,13 +462,13 @@ void Foam::forces::writeBins() forAll(f[0], i) { file(1) - << tab << setw(1) << "[" - << f[0][i] << setw(1) << "," - << f[1][i] << setw(1) << "," - << f[2][i] << setw(3) << "] [" - << m[0][i] << setw(1) << "," - << m[1][i] << setw(1) << "," - << m[2][i] << setw(1) << "]"; + << tab << setw(1) << '(' + << f[0][i] << setw(1) << ' ' + << f[1][i] << setw(1) << ' ' + << f[2][i] << setw(3) << ") (" + << m[0][i] << setw(1) << ' ' + << m[1][i] << setw(1) << ' ' + << m[2][i] << setw(1) << ')'; } if (localSystem_) @@ -498,13 +498,13 @@ void Foam::forces::writeBins() forAll(lf[0], i) { file(1) - << tab << setw(1) << "[" - << lf[0][i] << setw(1) << "," - << lf[1][i] << setw(1) << "," - << lf[2][i] << setw(3) << "] [" - << lm[0][i] << setw(1) << "," - << lm[1][i] << setw(1) << "," - << lm[2][i] << setw(1) << "]"; + << tab << setw(1) << '(' + << lf[0][i] << setw(1) << ' ' + << lf[1][i] << setw(1) << ' ' + << lf[2][i] << setw(3) << ") (" + << lm[0][i] << setw(1) << ' ' + << lm[1][i] << setw(1) << ' ' + << lm[2][i] << setw(1) << ')'; } }