mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: Corrected forces function object calc and file output on change - mantis #773
This commit is contained in:
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -26,6 +26,7 @@ License
|
|||||||
#include "functionObjectFile.H"
|
#include "functionObjectFile.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
|
#include "IFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -84,7 +85,16 @@ void Foam::functionObjectFile::createFiles()
|
|||||||
|
|
||||||
mkDir(outputDir);
|
mkDir(outputDir);
|
||||||
|
|
||||||
filePtrs_.set(i, new OFstream(outputDir/(iter.key() + ".dat")));
|
word fName(iter.key());
|
||||||
|
|
||||||
|
// check if file already exists
|
||||||
|
IFstream is(outputDir/(fName + ".dat"));
|
||||||
|
if (is.good())
|
||||||
|
{
|
||||||
|
fName = fName + "_" + obr_.time().timeName();
|
||||||
|
}
|
||||||
|
|
||||||
|
filePtrs_.set(i, new OFstream(outputDir/(fName + ".dat")));
|
||||||
|
|
||||||
writeFileHeader(i);
|
writeFileHeader(i);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -198,10 +198,10 @@ void Foam::forces::applyBins
|
|||||||
{
|
{
|
||||||
if (nBin_ == 1)
|
if (nBin_ == 1)
|
||||||
{
|
{
|
||||||
force_[0][0] = sum(fN);
|
force_[0][0] += sum(fN);
|
||||||
force_[1][0] = sum(fT);
|
force_[1][0] += sum(fT);
|
||||||
moment_[0][0] = sum(Md ^ fN);
|
moment_[0][0] += sum(Md ^ fN);
|
||||||
moment_[1][0] = sum(Md ^ fT);
|
moment_[1][0] += sum(Md ^ fT);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -471,7 +471,7 @@ void Foam::forces::read(const dictionary& dict)
|
|||||||
// specified directly, from coordinate system, or implicitly (0 0 0)
|
// specified directly, from coordinate system, or implicitly (0 0 0)
|
||||||
if (!dict.readIfPresent<point>("CofR", coordSys_.origin()))
|
if (!dict.readIfPresent<point>("CofR", coordSys_.origin()))
|
||||||
{
|
{
|
||||||
coordSys_ = coordinateSystem(obr_, dict);
|
coordSys_ = coordinateSystem(dict, obr_);
|
||||||
localSystem_ = true;
|
localSystem_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user