mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -68,12 +68,6 @@ void Foam::fieldAverage::initialize()
|
||||
resetFields(prime2MeanScalarFields_);
|
||||
resetFields(prime2MeanSymmTensorFields_);
|
||||
|
||||
totalIter_.clear();
|
||||
totalIter_.setSize(faItems_.size(), 1);
|
||||
|
||||
totalTime_.clear();
|
||||
totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
|
||||
|
||||
|
||||
// Add mean fields to the field lists
|
||||
forAll(faItems_, fieldI)
|
||||
@ -150,11 +144,21 @@ void Foam::fieldAverage::initialize()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ensure first averaging works unconditionally
|
||||
prevTimeIndex_ = -1;
|
||||
|
||||
initialised_ = true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldAverage::calcAverages()
|
||||
{
|
||||
if (!initialised_)
|
||||
{
|
||||
initialize();
|
||||
}
|
||||
|
||||
const label currentTimeIndex =
|
||||
static_cast<const fvMesh&>(obr_).time().timeIndex();
|
||||
|
||||
@ -248,6 +252,12 @@ void Foam::fieldAverage::writeAveragingProperties() const
|
||||
|
||||
void Foam::fieldAverage::readAveragingProperties()
|
||||
{
|
||||
totalIter_.clear();
|
||||
totalIter_.setSize(faItems_.size(), 1);
|
||||
|
||||
totalTime_.clear();
|
||||
totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
|
||||
|
||||
if (resetOnRestart_)
|
||||
{
|
||||
Info<< "fieldAverage: starting averaging at time "
|
||||
@ -258,7 +268,7 @@ void Foam::fieldAverage::readAveragingProperties()
|
||||
IOobject propsDictHeader
|
||||
(
|
||||
"fieldAveragingProperties",
|
||||
obr_.time().timeName(),
|
||||
obr_.time().timeName(obr_.time().startTime().value()),
|
||||
"uniform",
|
||||
obr_,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
@ -290,6 +300,7 @@ void Foam::fieldAverage::readAveragingProperties()
|
||||
<< " time = " << totalTime_[fieldI] << endl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
@ -358,6 +369,8 @@ void Foam::fieldAverage::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
initialised_ = false;
|
||||
|
||||
dict.readIfPresent("resetOnRestart", resetOnRestart_);
|
||||
dict.readIfPresent("resetOnOutput", resetOnOutput_);
|
||||
dict.lookup("fields") >> faItems_;
|
||||
@ -371,16 +384,6 @@ void Foam::fieldAverage::execute()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
if (!initialised_)
|
||||
{
|
||||
initialize();
|
||||
|
||||
// ensure first averaging works unconditionally
|
||||
prevTimeIndex_ = -1;
|
||||
|
||||
initialised_ = true;
|
||||
}
|
||||
|
||||
calcAverages();
|
||||
}
|
||||
}
|
||||
|
||||
@ -423,7 +423,13 @@ Foam::forces::forces
|
||||
binPoints_(),
|
||||
binFormat_("undefined"),
|
||||
binCumulative_(true)
|
||||
{}
|
||||
{
|
||||
forAll(force_, i)
|
||||
{
|
||||
force_[i].setSize(nBin_);
|
||||
moment_[i].setSize(nBin_);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -218,6 +218,37 @@ Foam::pressureTools::pressureTools
|
||||
}
|
||||
|
||||
read(dict);
|
||||
|
||||
if (active_)
|
||||
{
|
||||
dimensionSet pDims(dimPressure);
|
||||
|
||||
if (calcCoeff_)
|
||||
{
|
||||
pDims /= dimPressure;
|
||||
}
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
volScalarField* pPtr
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
pName(),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("0", pDims, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
mesh.objectRegistry::store(pPtr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -285,17 +316,13 @@ void Foam::pressureTools::write()
|
||||
{
|
||||
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
|
||||
|
||||
volScalarField pResult
|
||||
(
|
||||
IOobject
|
||||
volScalarField& pResult =
|
||||
const_cast<volScalarField&>
|
||||
(
|
||||
pName(),
|
||||
obr_.time().timeName(),
|
||||
obr_,
|
||||
IOobject::NO_READ
|
||||
),
|
||||
convertToCoeff(rhoScale(p)*p + pDyn(p) + pRef())
|
||||
);
|
||||
obr_.lookupObject<volScalarField>(pName())
|
||||
);
|
||||
|
||||
pResult == convertToCoeff(rhoScale(p)*p + pDyn(p) + pRef());
|
||||
|
||||
pResult.write();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user