mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
GIT: Resolve merge conflict
This commit is contained in:
@ -69,9 +69,9 @@ dimensionedScalar rhoMin
|
||||
);
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<compressible::RASModel> turbulence
|
||||
autoPtr<compressible::turbulenceModel> turbulence
|
||||
(
|
||||
compressible::New<compressible::RASModel>
|
||||
compressible::turbulenceModel::New
|
||||
(
|
||||
rho,
|
||||
U,
|
||||
|
||||
@ -47,9 +47,9 @@ volVectorField U
|
||||
#include "readTransportProperties.H"
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<incompressible::RASModel> turbulence
|
||||
autoPtr<incompressible::turbulenceModel> turbulence
|
||||
(
|
||||
incompressible::New<incompressible::RASModel>(U, phi, laminarTransport)
|
||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
// Kinematic density for buoyancy force
|
||||
|
||||
@ -47,9 +47,9 @@ volVectorField U
|
||||
#include "readTransportProperties.H"
|
||||
|
||||
Info<< "Creating turbulence model\n" << endl;
|
||||
autoPtr<incompressible::RASModel> turbulence
|
||||
autoPtr<incompressible::turbulenceModel> turbulence
|
||||
(
|
||||
incompressible::New<incompressible::RASModel>(U, phi, laminarTransport)
|
||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
// Kinematic density for buoyancy force
|
||||
|
||||
@ -45,13 +45,41 @@ Description
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "wallDist.H"
|
||||
#include "processorFvPatchField.H"
|
||||
#include "zeroGradientFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// turbulence constants - file-scope
|
||||
// Turbulence constants - file-scope
|
||||
static const scalar Cmu(0.09);
|
||||
static const scalar kappa(0.41);
|
||||
|
||||
|
||||
Foam::tmp<Foam::volVectorField> createSimplifiedU(const volVectorField& U)
|
||||
{
|
||||
tmp<volVectorField> tU
|
||||
(
|
||||
new volVectorField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Udash",
|
||||
U.mesh().time().timeName(),
|
||||
U.mesh(),
|
||||
IOobject::NO_READ
|
||||
),
|
||||
U.mesh(),
|
||||
dimensionedVector("0", dimVelocity, vector::zero),
|
||||
zeroGradientFvPatchField<vector>::typeName
|
||||
)
|
||||
);
|
||||
|
||||
// Assign the internal value to the original field
|
||||
tU() = U;
|
||||
|
||||
return tU;
|
||||
}
|
||||
|
||||
|
||||
void correctProcessorPatches(volScalarField& vf)
|
||||
{
|
||||
if (!Pstream::parRun())
|
||||
@ -62,7 +90,6 @@ void correctProcessorPatches(volScalarField& vf)
|
||||
// Not possible to use correctBoundaryConditions on fields as they may
|
||||
// use local info as opposed to the constraint values employed here,
|
||||
// but still need to update processor patches
|
||||
|
||||
volScalarField::GeometricBoundaryField& bf = vf.boundaryField();
|
||||
|
||||
forAll(bf, patchI)
|
||||
@ -83,73 +110,49 @@ void correctProcessorPatches(volScalarField& vf)
|
||||
}
|
||||
|
||||
|
||||
template<class TurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField> calcK
|
||||
void blendField
|
||||
(
|
||||
TurbulenceModel& turbulence,
|
||||
const volScalarField& mask,
|
||||
const volScalarField& nut,
|
||||
const volScalarField& y,
|
||||
const dimensionedScalar& ybl,
|
||||
const scalar Cmu,
|
||||
const scalar kappa
|
||||
const word& fieldName,
|
||||
const fvMesh& mesh,
|
||||
const scalarField& mask,
|
||||
const scalarField& boundaryLayerField
|
||||
)
|
||||
{
|
||||
// Turbulence k
|
||||
tmp<volScalarField> tk = turbulence->k();
|
||||
volScalarField& k = tk();
|
||||
scalar ck0 = pow025(Cmu)*kappa;
|
||||
k = (1 - mask)*k + mask*sqr(nut/(ck0*min(y, ybl)));
|
||||
IOobject fieldHeader
|
||||
(
|
||||
fieldName,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
);
|
||||
|
||||
if (fieldHeader.headerOk())
|
||||
{
|
||||
volScalarField fld(fieldHeader, mesh);
|
||||
scalarField& internalField = fld.internalField();
|
||||
internalField = (1 - mask)*internalField + mask*boundaryLayerField;
|
||||
fld.max(SMALL);
|
||||
|
||||
// Do not correct BC
|
||||
// - operation may use inconsistent fields wrt these local manipulations
|
||||
// k.correctBoundaryConditions();
|
||||
correctProcessorPatches(k);
|
||||
// - operation may use inconsistent fields wrt these local
|
||||
// manipulations
|
||||
//fld.correctBoundaryConditions();
|
||||
correctProcessorPatches(fld);
|
||||
|
||||
Info<< "Writing k\n" << endl;
|
||||
k.write();
|
||||
|
||||
return tk;
|
||||
Info<< "Writing " << fieldName << nl << endl;
|
||||
fld.write();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class TurbulenceModel>
|
||||
Foam::tmp<Foam::volScalarField> calcEpsilon
|
||||
(
|
||||
TurbulenceModel& turbulence,
|
||||
const volScalarField& mask,
|
||||
const volScalarField& k,
|
||||
const volScalarField& y,
|
||||
const dimensionedScalar& ybl,
|
||||
const scalar Cmu,
|
||||
const scalar kappa
|
||||
)
|
||||
{
|
||||
// Turbulence epsilon
|
||||
tmp<volScalarField> tepsilon = turbulence->epsilon();
|
||||
volScalarField& epsilon = tepsilon();
|
||||
scalar ce0 = ::pow(Cmu, 0.75)/kappa;
|
||||
epsilon = (1 - mask)*epsilon + mask*ce0*k*sqrt(k)/min(y, ybl);
|
||||
epsilon.max(SMALL);
|
||||
|
||||
// Do not correct BC
|
||||
// - operation may use inconsistent fields wrt these local manipulations
|
||||
// epsilon.correctBoundaryConditions();
|
||||
correctProcessorPatches(epsilon);
|
||||
|
||||
Info<< "Writing epsilon\n" << endl;
|
||||
epsilon.write();
|
||||
|
||||
return tepsilon;
|
||||
}
|
||||
|
||||
|
||||
void calcOmega
|
||||
void calcOmegaField
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const volScalarField& mask,
|
||||
const volScalarField& k,
|
||||
const volScalarField& epsilon
|
||||
const scalarField& mask,
|
||||
const scalarField& kBL,
|
||||
const scalarField& epsilonBL
|
||||
)
|
||||
{
|
||||
// Turbulence omega
|
||||
@ -166,9 +169,10 @@ void calcOmega
|
||||
if (omegaHeader.typeHeaderOk<volScalarField>(true))
|
||||
{
|
||||
volScalarField omega(omegaHeader, mesh);
|
||||
dimensionedScalar k0("SMALL", k.dimensions(), SMALL);
|
||||
scalarField& internalField = omega.internalField();
|
||||
|
||||
omega = (1 - mask)*omega + mask*epsilon/(Cmu*k + k0);
|
||||
internalField =
|
||||
(1 - mask)*internalField + mask*epsilonBL/(Cmu*kBL + SMALL);
|
||||
omega.max(SMALL);
|
||||
|
||||
// Do not correct BC
|
||||
@ -217,17 +221,25 @@ void setField
|
||||
}
|
||||
|
||||
|
||||
void calcCompressible
|
||||
tmp<volScalarField> calcNut
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const volScalarField& mask,
|
||||
const volVectorField& U,
|
||||
const volScalarField& y,
|
||||
const dimensionedScalar& ybl
|
||||
const volVectorField& U
|
||||
)
|
||||
{
|
||||
const Time& runTime = mesh.time();
|
||||
|
||||
if
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
basicThermo::dictName,
|
||||
runTime.constant(),
|
||||
mesh
|
||||
).headerOk()
|
||||
)
|
||||
{
|
||||
// Compressible
|
||||
autoPtr<fluidThermo> pThermo(fluidThermo::New(mesh));
|
||||
fluidThermo& thermo = pThermo();
|
||||
volScalarField rho(thermo.rho());
|
||||
@ -247,38 +259,19 @@ void calcCompressible
|
||||
)
|
||||
);
|
||||
|
||||
// Calculate nut - reference nut is calculated by the turbulence model
|
||||
// on its construction
|
||||
tmp<volScalarField> tnut = turbulence->nut();
|
||||
// Hack to correct nut
|
||||
// Note: in previous versions of the code, nut was initialised on
|
||||
// construction of the turbulence model. This is no longer the
|
||||
// case for the Templated Turbulence models. The call to correct
|
||||
// below will evolve the turbulence model equations and update nut,
|
||||
// whereas only nut update is required. Need to revisit.
|
||||
turbulence->correct();
|
||||
|
||||
volScalarField& nut = tnut();
|
||||
volScalarField S(mag(dev(symm(fvc::grad(U)))));
|
||||
nut = (1 - mask)*nut + mask*sqr(kappa*min(y, ybl))*::sqrt(2)*S;
|
||||
|
||||
// Do not correct BC - wall functions will 'undo' manipulation above
|
||||
// by using nut from turbulence model
|
||||
correctProcessorPatches(nut);
|
||||
nut.write();
|
||||
|
||||
tmp<volScalarField> k =
|
||||
calcK(turbulence, mask, nut, y, ybl, Cmu, kappa);
|
||||
tmp<volScalarField> epsilon =
|
||||
calcEpsilon(turbulence, mask, k, y, ybl, Cmu, kappa);
|
||||
calcOmega(mesh, mask, k, epsilon);
|
||||
setField(mesh, "nuTilda", nut);
|
||||
}
|
||||
|
||||
|
||||
void calcIncompressible
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const volScalarField& mask,
|
||||
const volVectorField& U,
|
||||
const volScalarField& y,
|
||||
const dimensionedScalar& ybl
|
||||
)
|
||||
{
|
||||
const Time& runTime = mesh.time();
|
||||
return tmp<volScalarField>(new volScalarField(turbulence->nut()));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Incompressible
|
||||
|
||||
// Update/re-write phi
|
||||
#include "createPhi.H"
|
||||
@ -291,25 +284,16 @@ void calcIncompressible
|
||||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
tmp<volScalarField> tnut = turbulence->nut();
|
||||
// Hack to correct nut
|
||||
// Note: in previous versions of the code, nut was initialised on
|
||||
// construction of the turbulence model. This is no longer the
|
||||
// case for the Templated Turbulence models. The call to correct
|
||||
// below will evolve the turbulence model equations and update nut,
|
||||
// whereas only nut update is required. Need to revisit.
|
||||
turbulence->correct();
|
||||
|
||||
// Calculate nut - reference nut is calculated by the turbulence model
|
||||
// on its construction
|
||||
volScalarField& nut = tnut();
|
||||
volScalarField S(mag(dev(symm(fvc::grad(U)))));
|
||||
nut = (1 - mask)*nut + mask*sqr(kappa*min(y, ybl))*::sqrt(2)*S;
|
||||
|
||||
// Do not correct BC - wall functions will 'undo' manipulation above
|
||||
// by using nut from turbulence model
|
||||
correctProcessorPatches(nut);
|
||||
nut.write();
|
||||
|
||||
tmp<volScalarField> k =
|
||||
calcK(turbulence, mask, nut, y, ybl, Cmu, kappa);
|
||||
tmp<volScalarField> epsilon =
|
||||
calcEpsilon(turbulence, mask, k, y, ybl, Cmu, kappa);
|
||||
calcOmega(mesh, mask, k, epsilon);
|
||||
setField(mesh, "nuTilda", nut);
|
||||
return tmp<volScalarField>(new volScalarField(turbulence->nut()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -361,44 +345,60 @@ int main(int argc, char *argv[])
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Create a copy of the U field where BCs are simplified to zeroGradient
|
||||
// to enable boundary condition update without requiring other fields,
|
||||
// e.g. phi. We can then call correctBoundaryConditions on this field to
|
||||
// enable appropriate behaviour for processor patches.
|
||||
volVectorField Udash(createSimplifiedU(U));
|
||||
|
||||
// Modify velocity by applying a 1/7th power law boundary-layer
|
||||
// u/U0 = (y/ybl)^(1/7)
|
||||
// assumes U0 is the same as the current cell velocity
|
||||
|
||||
Info<< "Setting boundary layer velocity" << nl << endl;
|
||||
scalar yblv = ybl.value();
|
||||
forAll(U, cellI)
|
||||
forAll(Udash, cellI)
|
||||
{
|
||||
if (y[cellI] <= yblv)
|
||||
{
|
||||
mask[cellI] = 1;
|
||||
U[cellI] *= ::pow(y[cellI]/yblv, (1.0/7.0));
|
||||
Udash[cellI] *= ::pow(y[cellI]/yblv, (1.0/7.0));
|
||||
}
|
||||
}
|
||||
mask.correctBoundaryConditions();
|
||||
Udash.correctBoundaryConditions();
|
||||
|
||||
// Retrieve nut from turbulence model
|
||||
volScalarField nut(calcNut(mesh, Udash));
|
||||
|
||||
// Blend nut using boundary layer profile
|
||||
volScalarField S("S", mag(dev(symm(fvc::grad(Udash)))));
|
||||
nut = (1 - mask)*nut + mask*sqr(kappa*min(y, ybl))*::sqrt(2)*S;
|
||||
|
||||
// Do not correct BC - wall functions will 'undo' manipulation above
|
||||
// by using nut from turbulence model
|
||||
correctProcessorPatches(nut);
|
||||
nut.write();
|
||||
|
||||
// Boundary layer turbulence kinetic energy
|
||||
scalar ck0 = pow025(Cmu)*kappa;
|
||||
scalarField kBL(sqr(nut/(ck0*min(y, ybl))));
|
||||
|
||||
// Boundary layer turbulence dissipation
|
||||
scalar ce0 = ::pow(Cmu, 0.75)/kappa;
|
||||
scalarField epsilonBL(ce0*kBL*sqrt(kBL)/min(y, ybl));
|
||||
|
||||
// Process fields if they are present
|
||||
blendField("k", mesh, mask, kBL);
|
||||
blendField("epsilon", mesh, mask, epsilonBL);
|
||||
calcOmegaField(mesh, mask, kBL, epsilonBL);
|
||||
setField(mesh, "nuTilda", nut);
|
||||
|
||||
|
||||
// Copy internal field Udash into U before writing
|
||||
Info<< "Writing U\n" << endl;
|
||||
U = Udash;
|
||||
U.write();
|
||||
|
||||
|
||||
if
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
basicThermo::dictName,
|
||||
runTime.constant(),
|
||||
mesh
|
||||
).typeHeaderOk<IOdictionary>(true)
|
||||
)
|
||||
{
|
||||
calcCompressible(mesh, mask, U, y, ybl);
|
||||
}
|
||||
else
|
||||
{
|
||||
calcIncompressible(mesh, mask, U, y, ybl);
|
||||
}
|
||||
|
||||
|
||||
Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
|
||||
<< nl << endl;
|
||||
|
||||
@ -38,7 +38,23 @@ volVectorField U
|
||||
);
|
||||
|
||||
Info<< "Calculating wall distance field" << endl;
|
||||
const volScalarField& y(wallDist::New(mesh).y());
|
||||
volScalarField y
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"y",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh,
|
||||
dimensionedScalar("zero", dimLength, 0.0),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
y.internalField() = wallDist::New(mesh).y().internalField();
|
||||
y.correctBoundaryConditions();
|
||||
|
||||
|
||||
// Set the mean boundary-layer thickness
|
||||
dimensionedScalar ybl("ybl", dimLength, 0);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -66,7 +66,7 @@ Foam::functionObject* Foam::functionObjectList::remove
|
||||
{
|
||||
oldIndex = fnd();
|
||||
|
||||
// retrieve the pointer and remove it from the old list
|
||||
// Retrieve the pointer and remove it from the old list
|
||||
ptr = this->set(oldIndex, 0).ptr();
|
||||
indices_.erase(fnd);
|
||||
}
|
||||
@ -124,6 +124,14 @@ Foam::functionObjectList::~functionObjectList()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjectList::resetState()
|
||||
{
|
||||
// Reset (re-read) the state dictionary
|
||||
stateDictPtr_.clear();
|
||||
createStateDict();
|
||||
}
|
||||
|
||||
|
||||
Foam::IOdictionary& Foam::functionObjectList::stateDict()
|
||||
{
|
||||
if (!stateDictPtr_.valid())
|
||||
@ -177,7 +185,7 @@ void Foam::functionObjectList::on()
|
||||
|
||||
void Foam::functionObjectList::off()
|
||||
{
|
||||
// for safety, also force a read() when execution is turned back on
|
||||
// For safety, also force a read() when execution is turned back on
|
||||
updated_ = execution_ = false;
|
||||
}
|
||||
|
||||
@ -200,6 +208,11 @@ bool Foam::functionObjectList::execute(const bool forceWrite)
|
||||
|
||||
if (execution_)
|
||||
{
|
||||
if (forceWrite)
|
||||
{
|
||||
resetState();
|
||||
}
|
||||
|
||||
if (!updated_)
|
||||
{
|
||||
read();
|
||||
@ -304,7 +317,7 @@ bool Foam::functionObjectList::read()
|
||||
bool ok = true;
|
||||
updated_ = execution_;
|
||||
|
||||
// avoid reading/initializing if execution is off
|
||||
// Avoid reading/initializing if execution is off
|
||||
if (!execution_)
|
||||
{
|
||||
return ok;
|
||||
@ -328,7 +341,7 @@ bool Foam::functionObjectList::read()
|
||||
|
||||
if (entryPtr->isDict())
|
||||
{
|
||||
// a dictionary of functionObjects
|
||||
// A dictionary of functionObjects
|
||||
const dictionary& functionDicts = entryPtr->dict();
|
||||
|
||||
newPtrs.setSize(functionDicts.size());
|
||||
@ -336,7 +349,7 @@ bool Foam::functionObjectList::read()
|
||||
|
||||
forAllConstIter(dictionary, functionDicts, iter)
|
||||
{
|
||||
// safety:
|
||||
// Safety:
|
||||
if (!iter().isDict())
|
||||
{
|
||||
continue;
|
||||
@ -350,7 +363,7 @@ bool Foam::functionObjectList::read()
|
||||
functionObject* objPtr = remove(key, oldIndex);
|
||||
if (objPtr)
|
||||
{
|
||||
// an existing functionObject, and dictionary changed
|
||||
// An existing functionObject, and dictionary changed
|
||||
if (newDigs[nFunc] != digests_[oldIndex])
|
||||
{
|
||||
ok = objPtr->read(dict) && ok;
|
||||
@ -358,7 +371,7 @@ bool Foam::functionObjectList::read()
|
||||
}
|
||||
else
|
||||
{
|
||||
// new functionObject
|
||||
// New functionObject
|
||||
objPtr = functionObject::New(key, time_, dict).ptr();
|
||||
ok = objPtr->start() && ok;
|
||||
}
|
||||
@ -370,7 +383,7 @@ bool Foam::functionObjectList::read()
|
||||
}
|
||||
else
|
||||
{
|
||||
// a list of functionObjects
|
||||
// A list of functionObjects
|
||||
PtrList<entry> functionDicts(entryPtr->stream());
|
||||
|
||||
newPtrs.setSize(functionDicts.size());
|
||||
@ -378,7 +391,7 @@ bool Foam::functionObjectList::read()
|
||||
|
||||
forAllIter(PtrList<entry>, functionDicts, iter)
|
||||
{
|
||||
// safety:
|
||||
// Safety:
|
||||
if (!iter().isDict())
|
||||
{
|
||||
continue;
|
||||
@ -392,7 +405,7 @@ bool Foam::functionObjectList::read()
|
||||
functionObject* objPtr = remove(key, oldIndex);
|
||||
if (objPtr)
|
||||
{
|
||||
// an existing functionObject, and dictionary changed
|
||||
// An existing functionObject, and dictionary changed
|
||||
if (newDigs[nFunc] != digests_[oldIndex])
|
||||
{
|
||||
ok = objPtr->read(dict) && ok;
|
||||
@ -400,7 +413,7 @@ bool Foam::functionObjectList::read()
|
||||
}
|
||||
else
|
||||
{
|
||||
// new functionObject
|
||||
// New functionObject
|
||||
objPtr = functionObject::New(key, time_, dict).ptr();
|
||||
ok = objPtr->start() && ok;
|
||||
}
|
||||
@ -411,11 +424,11 @@ bool Foam::functionObjectList::read()
|
||||
}
|
||||
}
|
||||
|
||||
// safety:
|
||||
// Safety:
|
||||
newPtrs.setSize(nFunc);
|
||||
newDigs.setSize(nFunc);
|
||||
|
||||
// updating the PtrList of functionObjects also deletes any existing,
|
||||
// Updating the PtrList of functionObjects also deletes any existing,
|
||||
// but unused functionObjects
|
||||
PtrList<functionObject>::transfer(newPtrs);
|
||||
digests_.transfer(newDigs);
|
||||
|
||||
@ -143,11 +143,14 @@ public:
|
||||
//- Access to the functionObjects
|
||||
using PtrList<functionObject>::operator[];
|
||||
|
||||
//- Reset/read state dictionary for current time
|
||||
virtual void resetState();
|
||||
|
||||
//- Return the state dictionary
|
||||
IOdictionary& stateDict();
|
||||
virtual IOdictionary& stateDict();
|
||||
|
||||
//- Return const access to the state dictionary
|
||||
const IOdictionary& stateDict() const;
|
||||
virtual const IOdictionary& stateDict() const;
|
||||
|
||||
//- Clear the list of function objects
|
||||
virtual void clear();
|
||||
@ -164,7 +167,6 @@ public:
|
||||
//- Return the execution status (on/off) of the function objects
|
||||
virtual bool status() const;
|
||||
|
||||
|
||||
//- Called at the start of the time-loop
|
||||
virtual bool start();
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -28,6 +28,19 @@ License
|
||||
|
||||
const Foam::word Foam::functionObjectState::resultsName_ = "results";
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
const Foam::IOdictionary& Foam::functionObjectState::stateDict() const
|
||||
{
|
||||
return obr_.time().functionObjects().stateDict();
|
||||
}
|
||||
|
||||
|
||||
Foam::IOdictionary& Foam::functionObjectState::stateDict()
|
||||
{
|
||||
return const_cast<IOdictionary&>(obr_.time().functionObjects().stateDict());
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -39,11 +52,7 @@ Foam::functionObjectState::functionObjectState
|
||||
:
|
||||
obr_(obr),
|
||||
name_(name),
|
||||
active_(true),
|
||||
stateDict_
|
||||
(
|
||||
const_cast<IOdictionary&>(obr.time().functionObjects().stateDict())
|
||||
)
|
||||
active_(true)
|
||||
{}
|
||||
|
||||
|
||||
@ -67,28 +76,26 @@ bool Foam::functionObjectState::active() const
|
||||
}
|
||||
|
||||
|
||||
const Foam::IOdictionary& Foam::functionObjectState::stateDict() const
|
||||
{
|
||||
return stateDict_;
|
||||
}
|
||||
|
||||
|
||||
Foam::dictionary& Foam::functionObjectState::propertyDict()
|
||||
{
|
||||
if (!stateDict_.found(name_))
|
||||
IOdictionary& stateDict = this->stateDict();
|
||||
|
||||
if (!stateDict.found(name_))
|
||||
{
|
||||
stateDict_.add(name_, dictionary());
|
||||
stateDict.add(name_, dictionary());
|
||||
}
|
||||
|
||||
return stateDict_.subDict(name_);
|
||||
return stateDict.subDict(name_);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjectState::foundProperty(const word& entryName) const
|
||||
{
|
||||
if (stateDict_.found(name_))
|
||||
const IOdictionary& stateDict = this->stateDict();
|
||||
|
||||
if (stateDict.found(name_))
|
||||
{
|
||||
const dictionary& baseDict = stateDict_.subDict(name_);
|
||||
const dictionary& baseDict = stateDict.subDict(name_);
|
||||
return baseDict.found(entryName);
|
||||
}
|
||||
|
||||
@ -109,10 +116,11 @@ Foam::word Foam::functionObjectState::objectResultType
|
||||
) const
|
||||
{
|
||||
word result = word::null;
|
||||
const IOdictionary& stateDict = this->stateDict();
|
||||
|
||||
if (stateDict_.found(resultsName_))
|
||||
if (stateDict.found(resultsName_))
|
||||
{
|
||||
const dictionary& resultsDict = stateDict_.subDict(resultsName_);
|
||||
const dictionary& resultsDict = stateDict.subDict(resultsName_);
|
||||
|
||||
if (resultsDict.found(objectName))
|
||||
{
|
||||
@ -147,9 +155,11 @@ Foam::List<Foam::word> Foam::functionObjectState::objectResultEntries
|
||||
{
|
||||
DynamicList<word> result(2);
|
||||
|
||||
if (stateDict_.found(resultsName_))
|
||||
const IOdictionary& stateDict = this->stateDict();
|
||||
|
||||
if (stateDict.found(resultsName_))
|
||||
{
|
||||
const dictionary& resultsDict = stateDict_.subDict(resultsName_);
|
||||
const dictionary& resultsDict = stateDict.subDict(resultsName_);
|
||||
|
||||
if (resultsDict.found(objectName))
|
||||
{
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -65,6 +65,15 @@ private:
|
||||
const objectRegistry& obr_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
functionObjectState(const functionObjectState&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const functionObjectState&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
@ -75,19 +84,15 @@ protected:
|
||||
//- Flag to indicate whether the object is active
|
||||
bool active_;
|
||||
|
||||
//- Reference to the state dictionary
|
||||
IOdictionary& stateDict_;
|
||||
|
||||
// Protacted Member Functions
|
||||
|
||||
protected:
|
||||
//- Return a const reference to the state dictionary
|
||||
const IOdictionary& stateDict() const;
|
||||
|
||||
// Protected Member Functions
|
||||
//- Return non-const access to the state dictionary
|
||||
IOdictionary& stateDict();
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
functionObjectState(const functionObjectState&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const functionObjectState&);
|
||||
|
||||
|
||||
public:
|
||||
@ -95,11 +100,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
functionObjectState
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& name
|
||||
);
|
||||
functionObjectState(const objectRegistry& obr, const word& name);
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -114,9 +115,6 @@ public:
|
||||
//- Return the active flag
|
||||
bool active() const;
|
||||
|
||||
//- Return access to the state dictionary
|
||||
const IOdictionary& stateDict() const;
|
||||
|
||||
//- Return access to the property dictionary
|
||||
dictionary& propertyDict();
|
||||
|
||||
|
||||
@ -100,9 +100,11 @@ void Foam::functionObjectState::getObjectProperty
|
||||
Type& value
|
||||
) const
|
||||
{
|
||||
if (stateDict_.found(objectName))
|
||||
const IOdictionary& stateDict = this->stateDict();
|
||||
|
||||
if (stateDict.found(objectName))
|
||||
{
|
||||
const dictionary& baseDict = stateDict_.subDict(objectName);
|
||||
const dictionary& baseDict = stateDict.subDict(objectName);
|
||||
if (baseDict.found(entryName))
|
||||
{
|
||||
if (baseDict.isDict(entryName))
|
||||
@ -126,12 +128,14 @@ void Foam::functionObjectState::setObjectProperty
|
||||
const Type& value
|
||||
)
|
||||
{
|
||||
if (!stateDict_.found(objectName))
|
||||
IOdictionary& stateDict = this->stateDict();
|
||||
|
||||
if (!stateDict.found(objectName))
|
||||
{
|
||||
stateDict_.add(objectName, dictionary());
|
||||
stateDict.add(objectName, dictionary());
|
||||
}
|
||||
|
||||
dictionary& baseDict = stateDict_.subDict(objectName);
|
||||
dictionary& baseDict = stateDict.subDict(objectName);
|
||||
baseDict.add(entryName, value, true);
|
||||
}
|
||||
|
||||
@ -155,12 +159,14 @@ void Foam::functionObjectState::setObjectResult
|
||||
const Type& value
|
||||
)
|
||||
{
|
||||
if (!stateDict_.found(resultsName_))
|
||||
IOdictionary& stateDict = this->stateDict();
|
||||
|
||||
if (!stateDict.found(resultsName_))
|
||||
{
|
||||
stateDict_.add(resultsName_, dictionary());
|
||||
stateDict.add(resultsName_, dictionary());
|
||||
}
|
||||
|
||||
dictionary& resultsDict = stateDict_.subDict(resultsName_);
|
||||
dictionary& resultsDict = stateDict.subDict(resultsName_);
|
||||
|
||||
if (!resultsDict.found(objectName))
|
||||
{
|
||||
@ -215,9 +221,11 @@ void Foam::functionObjectState::getObjectResult
|
||||
Type& value
|
||||
) const
|
||||
{
|
||||
if (stateDict_.found(resultsName_))
|
||||
const IOdictionary& stateDict = this->stateDict();
|
||||
|
||||
if (stateDict.found(resultsName_))
|
||||
{
|
||||
const dictionary& resultsDict = stateDict_.subDict(resultsName_);
|
||||
const dictionary& resultsDict = stateDict.subDict(resultsName_);
|
||||
|
||||
if (resultsDict.found(objectName))
|
||||
{
|
||||
|
||||
@ -62,9 +62,9 @@ Description
|
||||
type compressible::turbulentTemperatureCoupledBaffleMixed;
|
||||
Tnbr T;
|
||||
kappa lookup;
|
||||
KappaName kappa;
|
||||
kappaName kappa;
|
||||
thicknessLayers (0.1 0.2 0.3 0.4);
|
||||
kappaLayers (1 2 3 4)
|
||||
kappaLayers (1 2 3 4);
|
||||
value uniform 300;
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
@ -55,7 +55,7 @@ Description
|
||||
type compressible::turbulentTemperatureRadCoupledMixed;
|
||||
Tnbr T;
|
||||
kappa lookup;
|
||||
KappaName kappa;
|
||||
kappaName kappa;
|
||||
QrNbr Qr; // or none. Name of Qr field on neighbour region
|
||||
Qr Qr; // or none. Name of Qr field on local region
|
||||
thicknessLayers (0.1 0.2 0.3 0.4);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -457,7 +457,29 @@ tmp<volScalarField> SpalartAllmarasDES<BasicTurbulenceModel>::k() const
|
||||
{
|
||||
const volScalarField chi(this->chi());
|
||||
const volScalarField fv1(this->fv1(chi));
|
||||
return sqr(this->nut()/ck_/dTilda(chi, fv1, fvc::grad(this->U_)));
|
||||
|
||||
tmp<volScalarField> tdTilda
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dTilda",
|
||||
this->mesh_.time().timeName(),
|
||||
this->mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("0", dimLength, 0.0),
|
||||
zeroGradientFvPatchField<vector>::typeName
|
||||
)
|
||||
);
|
||||
volScalarField& dTildaF = tdTilda();
|
||||
dTildaF = dTilda(chi, fv1, fvc::grad(this->U_));
|
||||
dTildaF.correctBoundaryConditions();
|
||||
|
||||
return sqr(this->nut()/ck_/dTildaF);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -94,7 +94,7 @@ tmp<volScalarField> LESeddyViscosity<BasicTurbulenceModel>::epsilon() const
|
||||
{
|
||||
tmp<volScalarField> tk(this->k());
|
||||
|
||||
return tmp<volScalarField>
|
||||
tmp<volScalarField> tepsilon
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
@ -106,9 +106,14 @@ tmp<volScalarField> LESeddyViscosity<BasicTurbulenceModel>::epsilon() const
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
Ce_*tk()*sqrt(tk())/this->delta()
|
||||
Ce_*tk()*sqrt(tk())/this->delta(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
volScalarField& epsilon = tepsilon();
|
||||
epsilon.correctBoundaryConditions();
|
||||
|
||||
return tepsilon;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -300,6 +300,11 @@ tmp<volScalarField> SpalartAllmaras<BasicTurbulenceModel>::DnuTildaEff() const
|
||||
template<class BasicTurbulenceModel>
|
||||
tmp<volScalarField> SpalartAllmaras<BasicTurbulenceModel>::k() const
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Turbulence kinetic energy not defined for "
|
||||
<< "Spalart-Allmaras model. Returning zero field"
|
||||
<< endl;
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
@ -311,7 +316,8 @@ tmp<volScalarField> SpalartAllmaras<BasicTurbulenceModel>::k() const
|
||||
this->mesh_
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("0", dimensionSet(0, 2, -2, 0, 0), 0)
|
||||
dimensionedScalar("0", dimensionSet(0, 2, -2, 0, 0), 0),
|
||||
zeroGradientFvPatchField<vector>::typeName
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -336,7 +342,8 @@ tmp<volScalarField> SpalartAllmaras<BasicTurbulenceModel>::epsilon() const
|
||||
this->mesh_
|
||||
),
|
||||
this->mesh_,
|
||||
dimensionedScalar("0", dimensionSet(0, 2, -3, 0, 0), 0)
|
||||
dimensionedScalar("0", dimensionSet(0, 2, -3, 0, 0), 0),
|
||||
zeroGradientFvPatchField<vector>::typeName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -46,7 +46,9 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
uniformJumpFvPatchField<Type>(p, iF)
|
||||
uniformJumpFvPatchField<Type>(p, iF),
|
||||
phiName_("phi"),
|
||||
rhoName_("none")
|
||||
{}
|
||||
|
||||
|
||||
@ -59,7 +61,9 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
uniformJumpFvPatchField<Type>(ptf, p, iF, mapper)
|
||||
uniformJumpFvPatchField<Type>(ptf, p, iF, mapper),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -71,7 +75,9 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
uniformJumpFvPatchField<Type>(p, iF, dict)
|
||||
uniformJumpFvPatchField<Type>(p, iF, dict),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "none"))
|
||||
{}
|
||||
|
||||
|
||||
@ -81,7 +87,9 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
|
||||
const fanFvPatchField<Type>& ptf
|
||||
)
|
||||
:
|
||||
uniformJumpFvPatchField<Type>(ptf)
|
||||
uniformJumpFvPatchField<Type>(ptf),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -92,7 +100,9 @@ Foam::fanFvPatchField<Type>::fanFvPatchField
|
||||
const DimensionedField<Type, volMesh>& iF
|
||||
)
|
||||
:
|
||||
uniformJumpFvPatchField<Type>(ptf, iF)
|
||||
uniformJumpFvPatchField<Type>(ptf, iF),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
@ -113,4 +123,13 @@ void Foam::fanFvPatchField<Type>::updateCoeffs()
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fanFvPatchField<Type>::write(Ostream& os) const
|
||||
{
|
||||
this->template writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
this->template writeEntryIfDifferent<word>(os, "rho", "none", rhoName_);
|
||||
uniformJumpFvPatchField<Type>::write(os);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -187,6 +187,9 @@ public:
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -62,4 +62,8 @@ $(derivedConstraints)/fixedTemperatureConstraint/fixedTemperatureConstraint.C
|
||||
$(derivedConstraints)/velocityDampingConstraint/velocityDampingConstraint.C
|
||||
|
||||
|
||||
/* Corrections */
|
||||
|
||||
corrections/limitTemperature/limitTemperature.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfvOptions
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -348,7 +348,14 @@ bool Foam::scene::loop(vtkRenderer* renderer)
|
||||
|
||||
currentFrameI_++;
|
||||
|
||||
position_ += currentFrameI_*dPosition_;
|
||||
if (position_ > (1 + 0.5*dPosition_))
|
||||
{
|
||||
WarningInFunction
|
||||
<< "Current position exceeded 1 - please check your setup"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
position_ += dPosition_;
|
||||
|
||||
if (currentFrameI_ < nFrameTotal_)
|
||||
{
|
||||
|
||||
@ -27,6 +27,9 @@ pressureTools/pressureToolsFunctionObject.C
|
||||
Q/Q.C
|
||||
Q/QFunctionObject.C
|
||||
|
||||
residuals/residuals.C
|
||||
residuals/residualsFunctionObject.C
|
||||
|
||||
scalarTransport/scalarTransport.C
|
||||
scalarTransport/scalarTransportFunctionObject.C
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -142,6 +142,14 @@ Foam::incompressibleTwoPhaseMixture::mu() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::incompressibleTwoPhaseMixture::mu(const label patchI) const
|
||||
{
|
||||
|
||||
return mu()().boundaryField()[patchI];
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::incompressibleTwoPhaseMixture::muf() const
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -133,6 +133,9 @@ public:
|
||||
//- Return the dynamic laminar viscosity
|
||||
tmp<volScalarField> mu() const;
|
||||
|
||||
//- Return the dynamic laminar viscosity on patch
|
||||
tmp<scalarField> mu(const label patchI) const;
|
||||
|
||||
//- Return the face-interpolated dynamic laminar viscosity
|
||||
tmp<surfaceScalarField> muf() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user