ENH: Function object updates

This commit is contained in:
andy
2014-01-03 10:37:08 +00:00
parent f724ce787e
commit 659249064f
36 changed files with 378 additions and 386 deletions

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -185,7 +185,10 @@ void Foam::CourantNo::execute()
void Foam::CourantNo::end()
{
// Do nothing
if (active_)
{
execute();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -142,10 +142,7 @@ void Foam::DESModelRegions::execute()
const fvMesh& mesh = refCast<const fvMesh>(obr_);
if (log_)
{
Info<< type() << " " << name_ << " output:" << nl;
}
Info(log_)<< type() << " " << name_ << " output:" << nl;
volScalarField& DESModelRegions =
const_cast<volScalarField&>
@ -196,19 +193,14 @@ void Foam::DESModelRegions::execute()
<< endl;
}
if (log_)
{
Info<< " LES = " << prc << " % (volume)" << nl
<< " RAS = " << 100.0 - prc << " % (volume)" << endl;
}
Info(log_)
<< " LES = " << prc << " % (volume)" << nl
<< " RAS = " << 100.0 - prc << " % (volume)" << endl;
}
else
{
if (log_)
{
Info<< " No DES turbulence model found in database" << nl
<< endl;
}
Info(log_)<< " No DES turbulence model found in database" << nl
<< endl;
}
}
}
@ -216,7 +208,10 @@ void Foam::DESModelRegions::execute()
void Foam::DESModelRegions::end()
{
// Do nothing
if (active_)
{
execute();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -144,7 +144,10 @@ void Foam::Lambda2::execute()
void Foam::Lambda2::end()
{
// Do nothing
if (active_)
{
execute();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -197,7 +197,10 @@ void Foam::Peclet::execute()
void Foam::Peclet::end()
{
// Do nothing
if (active_)
{
execute();
}
}
void Foam::Peclet::timeSet()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -137,7 +137,10 @@ void Foam::Q::execute()
void Foam::Q::end()
{
// Do nothing
if (active_)
{
execute();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -101,7 +101,10 @@ void Foam::blendingFactor::execute()
void Foam::blendingFactor::end()
{
// Do nothing
if (active_)
{
execute();
}
}
void Foam::blendingFactor::timeSet()

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -309,7 +309,10 @@ void Foam::pressureTools::execute()
void Foam::pressureTools::end()
{
// Do nothing
if (active_)
{
execute();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -214,92 +214,97 @@ void Foam::scalarTransport::read(const dictionary& dict)
void Foam::scalarTransport::execute()
{
Info<< type() << " output:" << endl;
const surfaceScalarField& phi =
mesh_.lookupObject<surfaceScalarField>(phiName_);
// calculate the diffusivity
volScalarField DT(this->DT(phi));
// set schemes
word schemeVar = T_.name();
if (autoSchemes_)
if (active_)
{
schemeVar = UName_;
}
Info<< type() << " output:" << endl;
word divScheme("div(phi," + schemeVar + ")");
word laplacianScheme("laplacian(" + DT.name() + "," + schemeVar + ")");
const surfaceScalarField& phi =
mesh_.lookupObject<surfaceScalarField>(phiName_);
// set under-relaxation coeff
scalar relaxCoeff = 0.0;
if (mesh_.relaxEquation(schemeVar))
{
relaxCoeff = mesh_.equationRelaxationFactor(schemeVar);
}
// calculate the diffusivity
volScalarField DT(this->DT(phi));
if (phi.dimensions() == dimMass/dimTime)
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
// solve
for (label i = 0; i <= nCorr_; i++)
// set schemes
word schemeVar = T_.name();
if (autoSchemes_)
{
fvScalarMatrix TEqn
(
fvm::ddt(rho, T_)
+ fvm::div(phi, T_, divScheme)
- fvm::laplacian(DT, T_, laplacianScheme)
==
fvOptions_(rho, T_)
);
TEqn.relax(relaxCoeff);
fvOptions_.constrain(TEqn);
TEqn.solve(mesh_.solverDict(schemeVar));
schemeVar = UName_;
}
}
else if (phi.dimensions() == dimVolume/dimTime)
{
// solve
for (label i = 0; i <= nCorr_; i++)
word divScheme("div(phi," + schemeVar + ")");
word laplacianScheme("laplacian(" + DT.name() + "," + schemeVar + ")");
// set under-relaxation coeff
scalar relaxCoeff = 0.0;
if (mesh_.relaxEquation(schemeVar))
{
fvScalarMatrix TEqn
(
fvm::ddt(T_)
+ fvm::div(phi, T_, divScheme)
- fvm::laplacian(DT, T_, laplacianScheme)
==
fvOptions_(T_)
);
TEqn.relax(relaxCoeff);
fvOptions_.constrain(TEqn);
TEqn.solve(mesh_.solverDict(schemeVar));
relaxCoeff = mesh_.equationRelaxationFactor(schemeVar);
}
}
else
{
FatalErrorIn("void Foam::scalarTransport::execute()")
<< "Incompatible dimensions for phi: " << phi.dimensions() << nl
<< "Dimensions should be " << dimMass/dimTime << " or "
<< dimVolume/dimTime << endl;
}
if (phi.dimensions() == dimMass/dimTime)
{
const volScalarField& rho =
mesh_.lookupObject<volScalarField>(rhoName_);
Info<< endl;
// solve
for (label i = 0; i <= nCorr_; i++)
{
fvScalarMatrix TEqn
(
fvm::ddt(rho, T_)
+ fvm::div(phi, T_, divScheme)
- fvm::laplacian(DT, T_, laplacianScheme)
==
fvOptions_(rho, T_)
);
TEqn.relax(relaxCoeff);
fvOptions_.constrain(TEqn);
TEqn.solve(mesh_.solverDict(schemeVar));
}
}
else if (phi.dimensions() == dimVolume/dimTime)
{
// solve
for (label i = 0; i <= nCorr_; i++)
{
fvScalarMatrix TEqn
(
fvm::ddt(T_)
+ fvm::div(phi, T_, divScheme)
- fvm::laplacian(DT, T_, laplacianScheme)
==
fvOptions_(T_)
);
TEqn.relax(relaxCoeff);
fvOptions_.constrain(TEqn);
TEqn.solve(mesh_.solverDict(schemeVar));
}
}
else
{
FatalErrorIn("void Foam::scalarTransport::execute()")
<< "Incompatible dimensions for phi: " << phi.dimensions() << nl
<< "Dimensions should be " << dimMass/dimTime << " or "
<< dimVolume/dimTime << endl;
}
Info<< endl;
}
}
void Foam::scalarTransport::end()
{
// Do nothing
if (active_)
{
execute();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -132,7 +132,10 @@ void Foam::timeActivatedFileUpdate::execute()
void Foam::timeActivatedFileUpdate::end()
{
// Do nothing
if (active_)
{
execute();
}
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -82,11 +82,8 @@ void Foam::wallShearStress::calcShearStress
<< endl;
}
if (log_)
{
Info<< " min/max(" << pp.name() << ") = "
<< minSsp << ", " << maxSsp << endl;
}
Info(log_)<< " min/max(" << pp.name() << ") = "
<< minSsp << ", " << maxSsp << endl;
}
}
@ -240,10 +237,7 @@ void Foam::wallShearStress::execute()
mesh.lookupObject<volVectorField>(type())
);
if (log_)
{
Info<< type() << " " << name_ << " output:" << nl;
}
Info(log_)<< type() << " " << name_ << " output:" << nl;
tmp<volSymmTensorField> Reff;
@ -275,7 +269,10 @@ void Foam::wallShearStress::execute()
void Foam::wallShearStress::end()
{
// Do nothing
if (active_)
{
execute();
}
}
@ -294,12 +291,9 @@ void Foam::wallShearStress::write()
const volVectorField& wallShearStress =
obr_.lookupObject<volVectorField>(type());
if (log_)
{
Info<< type() << " " << name_ << " output:" << nl
<< " writing field " << wallShearStress.name() << nl
<< endl;
}
Info(log_)<< type() << " " << name_ << " output:" << nl
<< " writing field " << wallShearStress.name() << nl
<< endl;
wallShearStress.write();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -94,15 +94,12 @@ void Foam::yPlusLES::calcIncompressibleYPlus
scalar maxYp = gMax(Yp);
scalar avgYp = gAverage(Yp);
if (log_)
{
Info<< " patch " << currPatch.name()
<< " y+ : min = " << minYp << ", max = " << maxYp
<< ", average = " << avgYp << nl;
}
if (Pstream::master())
{
Info(log_)<< " patch " << currPatch.name()
<< " y+ : min = " << minYp << ", max = " << maxYp
<< ", average = " << avgYp << nl;
file() << obr_.time().value()
<< token::TAB << currPatch.name()
<< token::TAB << minYp
@ -162,15 +159,12 @@ void Foam::yPlusLES::calcCompressibleYPlus
scalar maxYp = gMax(Yp);
scalar avgYp = gAverage(Yp);
if (log_)
{
Info<< " patch " << currPatch.name()
<< " y+ : min = " << minYp << ", max = " << maxYp
<< ", average = " << avgYp << nl;
}
if (Pstream::master())
{
Info(log_)<< " patch " << currPatch.name()
<< " y+ : min = " << minYp << ", max = " << maxYp
<< ", average = " << avgYp << nl;
file() << obr_.time().value()
<< token::TAB << currPatch.name()
<< token::TAB << minYp
@ -286,10 +280,7 @@ void Foam::yPlusLES::execute()
mesh.lookupObject<volScalarField>(type())
);
if (log_)
{
Info<< type() << " " << name_ << " output:" << nl;
}
Info(log_)<< type() << " " << name_ << " output:" << nl;
if (phi.dimensions() == dimMass/dimTime)
{
@ -305,7 +296,10 @@ void Foam::yPlusLES::execute()
void Foam::yPlusLES::end()
{
// Do nothing
if (active_)
{
execute();
}
}
@ -324,10 +318,7 @@ void Foam::yPlusLES::write()
const volScalarField& yPlusLES =
obr_.lookupObject<volScalarField>(type());
if (log_)
{
Info<< " writing field " << yPlusLES.name() << nl << endl;
}
Info(log_)<< " writing field " << yPlusLES.name() << nl << endl;
yPlusLES.write();
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -89,15 +89,12 @@ void Foam::yPlusRAS::calcIncompressibleYPlus
scalar maxYp = gMax(Yp);
scalar avgYp = gAverage(Yp);
if (log_)
{
Info<< " patch " << nutPw.patch().name()
<< " y+ : min = " << minYp << ", max = " << maxYp
<< ", average = " << avgYp << nl;
}
if (Pstream::master())
{
Info(log_)<< " patch " << nutPw.patch().name()
<< " y+ : min = " << minYp << ", max = " << maxYp
<< ", average = " << avgYp << nl;
file() << obr_.time().value()
<< token::TAB << nutPw.patch().name()
<< token::TAB << minYp
@ -149,15 +146,12 @@ void Foam::yPlusRAS::calcCompressibleYPlus
scalar maxYp = gMax(Yp);
scalar avgYp = gAverage(Yp);
if (log_)
{
Info<< " patch " << mutPw.patch().name()
<< " y+ : min = " << minYp << ", max = " << maxYp
<< ", average = " << avgYp << nl;
}
if (Pstream::master())
{
Info(log_)<< " patch " << mutPw.patch().name()
<< " y+ : min = " << minYp << ", max = " << maxYp
<< ", average = " << avgYp << nl;
file() << obr_.time().value()
<< token::TAB << mutPw.patch().name()
<< token::TAB << minYp
@ -271,10 +265,7 @@ void Foam::yPlusRAS::execute()
mesh.lookupObject<volScalarField>(type())
);
if (log_)
{
Info<< type() << " " << name_ << " output:" << nl;
}
Info(log_)<< type() << " " << name_ << " output:" << nl;
if (phi.dimensions() == dimMass/dimTime)
{
@ -290,7 +281,10 @@ void Foam::yPlusRAS::execute()
void Foam::yPlusRAS::end()
{
// Do nothing
if (active_)
{
execute();
}
}
@ -309,10 +303,7 @@ void Foam::yPlusRAS::write()
const volScalarField& yPlusRAS =
obr_.lookupObject<volScalarField>(type());
if (log_)
{
Info<< " writing field " << yPlusRAS.name() << nl << endl;
}
Info(log_)<< " writing field " << yPlusRAS.name() << nl << endl;
yPlusRAS.write();
}