BUG: forces FO - corrected after bugs introduced by last merging effort

This commit is contained in:
Andrew Heather
2016-11-01 16:36:15 +00:00
parent c10177fc6f
commit d3f0cb33d9

View File

@ -180,7 +180,7 @@ void Foam::functionObjects::forces::initialise()
if (!foundObject<volVectorField>(fDName_))
{
FatalErrorInFunction
<< "Could not find " << fDName_ << " in database."
<< "Could not find " << fDName_ << " in database"
<< exit(FatalError);
}
}
@ -194,14 +194,15 @@ void Foam::functionObjects::forces::initialise()
)
{
FatalErrorInFunction
<< "Could not find " << UName_ << ", " << pName_
<< "Could not find U: " << UName_ << " or p:" << pName_
<< " in database"
<< exit(FatalError);
}
if (rhoName_ != "rhoInf" && !foundObject<volScalarField>(rhoName_))
{
FatalErrorInFunction
<< "Could not find " << rhoName_
<< "Could not find rho:" << rhoName_
<< exit(FatalError);
}
}
@ -269,6 +270,7 @@ void Foam::functionObjects::forces::initialiseBins()
{
binPoints_[i] = (i + 0.5)*binDir_*binDx_;
}
}
// Allocate storage for forces and moments
forAll(force_, i)
@ -276,7 +278,6 @@ void Foam::functionObjects::forces::initialiseBins()
force_[i].setSize(nBin_, vector::zero);
moment_[i].setSize(nBin_, vector::zero);
}
}
}
@ -908,9 +909,10 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
}
else if (nBin_ == 0)
{
// Case of no bins equates to a single bin to collect all data
nBin_ = 1;
}
else if ((nBin_ == 0) || (nBin_ == 1))
else
{
binDict.lookup("cumulative") >> binCumulative_;
binDict.lookup("direction") >> binDir_;
@ -918,16 +920,6 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
}
}
if (nBin_ == 1)
{
// Allocate storage for forces and moments
forAll(force_, i)
{
force_[i].setSize(1, vector::zero);
moment_[i].setSize(1, vector::zero);
}
}
writeFields_ = dict.lookupOrDefault("writeFields", false);
if (writeFields_)