forces: write in OpenFOAM ListList format so they can be read by the OpenFOAM parser

This commit is contained in:
Henry
2014-01-14 23:09:03 +00:00
parent 238c8b234d
commit 6d19668f8f
2 changed files with 35 additions and 35 deletions

View File

@ -33,7 +33,7 @@ License
namespace Foam 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++) 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), "Cm" + jn);
writeTabbed(file(i), "Cd" + jn); writeTabbed(file(i), "Cd" + jn);
writeTabbed(file(i), "Cl" + jn); writeTabbed(file(i), "Cl" + jn);

View File

@ -39,7 +39,7 @@ License
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(forces, 0); defineTypeNameAndDebug(forces, 0);
} }
@ -78,8 +78,8 @@ void Foam::forces::writeFileHeader(const label i)
writeCommented(file(i), "Time"); writeCommented(file(i), "Time");
file(i) file(i)
<< "forces[pressure,viscous,porous] " << "forces(pressure viscous porous) "
<< "moment[pressure,viscous,porous]"; << "moment(pressure viscous porous)";
if (localSystem_) if (localSystem_)
{ {
@ -126,7 +126,7 @@ void Foam::forces::writeFileHeader(const label i)
for (label j = 0; j < nBin_; j++) 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 f("forces" + jn + "[pressure,viscous,porous]");
const word m("moments" + 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++) 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 f("localForces" + jn + "[pressure,viscous,porous]");
const word m("localMoments" + jn + "[pressure,viscous,porous]"); const word m("localMoments" + jn + "[pressure,viscous,porous]");
@ -403,13 +403,13 @@ void Foam::forces::writeForces()
<< " porous : " << sum(moment_[2]) << " porous : " << sum(moment_[2])
<< endl; << endl;
file(0) << obr_.time().value() << tab << setw(1) << '[' file(0) << obr_.time().value() << tab << setw(1) << '('
<< sum(force_[0]) << setw(1) << ',' << sum(force_[0]) << setw(1) << ' '
<< sum(force_[1]) << setw(1) << "," << sum(force_[1]) << setw(1) << ' '
<< sum(force_[2]) << setw(3) << "] [" << sum(force_[2]) << setw(3) << ") ("
<< sum(moment_[0]) << setw(1) << "," << sum(moment_[0]) << setw(1) << ' '
<< sum(moment_[1]) << setw(1) << "," << sum(moment_[1]) << setw(1) << ' '
<< sum(moment_[2]) << setw(1) << "]" << sum(moment_[2]) << setw(1) << ')'
<< endl; << endl;
if (localSystem_) if (localSystem_)
@ -421,13 +421,13 @@ void Foam::forces::writeForces()
vectorField localMomentT(coordSys_.localVector(moment_[1])); vectorField localMomentT(coordSys_.localVector(moment_[1]));
vectorField localMomentP(coordSys_.localVector(moment_[2])); vectorField localMomentP(coordSys_.localVector(moment_[2]));
file(0) << obr_.time().value() << tab << setw(1) << "[" file(0) << obr_.time().value() << tab << setw(1) << '('
<< sum(localForceN) << setw(1) << "," << sum(localForceN) << setw(1) << ' '
<< sum(localForceT) << setw(1) << "," << sum(localForceT) << setw(1) << ' '
<< sum(localForceP) << setw(3) << "] [" << sum(localForceP) << setw(3) << ") ("
<< sum(localMomentN) << setw(1) << "," << sum(localMomentN) << setw(1) << ' '
<< sum(localMomentT) << setw(1) << "," << sum(localMomentT) << setw(1) << ' '
<< sum(localMomentP) << setw(1) << "]" << sum(localMomentP) << setw(1) << ')'
<< endl; << endl;
} }
} }
@ -462,13 +462,13 @@ void Foam::forces::writeBins()
forAll(f[0], i) forAll(f[0], i)
{ {
file(1) file(1)
<< tab << setw(1) << "[" << tab << setw(1) << '('
<< f[0][i] << setw(1) << "," << f[0][i] << setw(1) << ' '
<< f[1][i] << setw(1) << "," << f[1][i] << setw(1) << ' '
<< f[2][i] << setw(3) << "] [" << f[2][i] << setw(3) << ") ("
<< m[0][i] << setw(1) << "," << m[0][i] << setw(1) << ' '
<< m[1][i] << setw(1) << "," << m[1][i] << setw(1) << ' '
<< m[2][i] << setw(1) << "]"; << m[2][i] << setw(1) << ')';
} }
if (localSystem_) if (localSystem_)
@ -498,13 +498,13 @@ void Foam::forces::writeBins()
forAll(lf[0], i) forAll(lf[0], i)
{ {
file(1) file(1)
<< tab << setw(1) << "[" << tab << setw(1) << '('
<< lf[0][i] << setw(1) << "," << lf[0][i] << setw(1) << ' '
<< lf[1][i] << setw(1) << "," << lf[1][i] << setw(1) << ' '
<< lf[2][i] << setw(3) << "] [" << lf[2][i] << setw(3) << ") ("
<< lm[0][i] << setw(1) << "," << lm[0][i] << setw(1) << ' '
<< lm[1][i] << setw(1) << "," << lm[1][i] << setw(1) << ' '
<< lm[2][i] << setw(1) << "]"; << lm[2][i] << setw(1) << ')';
} }
} }