mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
functionObjects: rewritten to all be derived from 'functionObject'
- Avoids the need for the 'OutputFilterFunctionObject' wrapper
- Time-control for execution and writing is now provided by the
'timeControlFunctionObject' which instantiates the processing
'functionObject' and controls its operation.
- Alternative time-control functionObjects can now be written and
selected at run-time without the need to compile wrapped version of
EVERY existing functionObject which would have been required in the
old structure.
- The separation of 'execute' and 'write' functions is now formalized in the
'functionObject' base-class and all derived classes implement the
two functions.
- Unnecessary implementations of functions with appropriate defaults
in the 'functionObject' base-class have been removed reducing
clutter and simplifying implementation of new functionObjects.
- The 'coded' 'functionObject' has also been updated, simplified and tested.
- Further simplification is now possible by creating some general
intermediate classes derived from 'functionObject'.
This commit is contained in:
@ -27,6 +27,7 @@ License
|
||||
#include "surfaceFields.H"
|
||||
#include "fvcSurfaceIntegrate.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +36,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(CourantNo, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
CourantNo,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,17 +71,22 @@ Foam::functionObjects::CourantNo::byRho
|
||||
Foam::functionObjects::CourantNo::CourantNo
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho")
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -113,14 +126,16 @@ Foam::functionObjects::CourantNo::~CourantNo()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::CourantNo::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::CourantNo::read(const dictionary& dict)
|
||||
{
|
||||
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
|
||||
rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::CourantNo::execute()
|
||||
bool Foam::functionObjects::CourantNo::execute(const bool postProcess)
|
||||
{
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
@ -139,29 +154,23 @@ void Foam::functionObjects::CourantNo::execute()
|
||||
/mesh.V()
|
||||
);
|
||||
Co.correctBoundaryConditions();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::CourantNo::end()
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::CourantNo::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::CourantNo::write()
|
||||
bool Foam::functionObjects::CourantNo::write(const bool postProcess)
|
||||
{
|
||||
const volScalarField& CourantNo =
|
||||
obr_.lookupObject<volScalarField>(type());
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << CourantNo.name() << nl
|
||||
<< endl;
|
||||
|
||||
CourantNo.write();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,19 +40,13 @@ SourceFiles
|
||||
#ifndef functionObjects_CourantNo_H
|
||||
#define functionObjects_CourantNo_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
@ -61,12 +55,11 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class CourantNo
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of CourantNo objects
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
@ -100,14 +93,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
CourantNo
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
|
||||
@ -117,34 +108,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of CourantNo
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the CourantNo data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Calculate the CourantNo and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "CourantNoFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(CourantNoFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
CourantNoFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::CourantNoFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around CourantNo to allow it to be created
|
||||
via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
CourantNoFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef CourantNoFunctionObject_H
|
||||
#define CourantNoFunctionObject_H
|
||||
|
||||
#include "CourantNo.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::CourantNo>
|
||||
CourantNoFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -25,9 +25,9 @@ License
|
||||
|
||||
#include "Lambda2.H"
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -36,6 +36,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(Lambda2, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
Lambda2,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,16 +52,21 @@ namespace functionObjects
|
||||
Foam::functionObjects::Lambda2::Lambda2
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
UName_("U")
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -93,13 +105,15 @@ Foam::functionObjects::Lambda2::~Lambda2()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::Lambda2::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::Lambda2::read(const dictionary& dict)
|
||||
{
|
||||
UName_ = dict.lookupOrDefault<word>("UName", "U");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::Lambda2::execute()
|
||||
bool Foam::functionObjects::Lambda2::execute(const bool postProcess)
|
||||
{
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
@ -121,29 +135,23 @@ void Foam::functionObjects::Lambda2::execute()
|
||||
);
|
||||
|
||||
Lambda2 = -eigenValues(SSplusWW)().component(vector::Y);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::Lambda2::end()
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::Lambda2::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::Lambda2::write()
|
||||
bool Foam::functionObjects::Lambda2::write(const bool postProcess)
|
||||
{
|
||||
const volScalarField& Lambda2 =
|
||||
obr_.lookupObject<volScalarField>(type());
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << Lambda2.name() << nl
|
||||
<< endl;
|
||||
|
||||
Lambda2.write();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,10 +40,8 @@ SourceFiles
|
||||
#ifndef functionObjects_Lambda2_H
|
||||
#define functionObjects_Lambda2_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "OFstream.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -52,9 +50,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -64,12 +59,11 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class Lambda2
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of Lambda2 objects
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
@ -94,14 +88,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
Lambda2
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -111,34 +103,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of Lambda2
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the Lambda2 data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate Lambda2
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the Lambda2 and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Write Lambda2
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Lambda2FunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(Lambda2FunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
Lambda2FunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::Lambda2FunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around Lambda2 to allow it to be created
|
||||
via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
Lambda2FunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Lambda2FunctionObject_H
|
||||
#define Lambda2FunctionObject_H
|
||||
|
||||
#include "Lambda2.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::Lambda2>
|
||||
Lambda2FunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,58 +1,22 @@
|
||||
codedFunctionObject/codedFunctionObject.C
|
||||
|
||||
CourantNo/CourantNo.C
|
||||
CourantNo/CourantNoFunctionObject.C
|
||||
|
||||
Lambda2/Lambda2.C
|
||||
Lambda2/Lambda2FunctionObject.C
|
||||
|
||||
Peclet/Peclet.C
|
||||
Peclet/PecletFunctionObject.C
|
||||
|
||||
Q/Q.C
|
||||
Q/QFunctionObject.C
|
||||
|
||||
blendingFactor/blendingFactor.C
|
||||
blendingFactor/blendingFactorFunctionObject.C
|
||||
|
||||
dsmcFields/dsmcFields.C
|
||||
dsmcFields/dsmcFieldsFunctionObject.C
|
||||
|
||||
residuals/residuals.C
|
||||
residuals/residualsFunctionObject.C
|
||||
|
||||
scalarTransport/scalarTransport.C
|
||||
scalarTransport/scalarTransportFunctionObject.C
|
||||
|
||||
timeActivatedFileUpdate/timeActivatedFileUpdate.C
|
||||
timeActivatedFileUpdate/timeActivatedFileUpdateFunctionObject.C
|
||||
|
||||
turbulenceFields/turbulenceFields.C
|
||||
turbulenceFields/turbulenceFieldsFunctionObject.C
|
||||
|
||||
vorticity/vorticity.C
|
||||
vorticity/vorticityFunctionObject.C
|
||||
|
||||
yPlus/yPlus.C
|
||||
yPlus/yPlusFunctionObject.C
|
||||
|
||||
setTimeStep/setTimeStepFunctionObject.C
|
||||
|
||||
systemCall/systemCall.C
|
||||
systemCall/systemCallFunctionObject.C
|
||||
|
||||
abort/abort.C
|
||||
|
||||
partialWrite/partialWrite.C
|
||||
partialWrite/partialWriteFunctionObject.C
|
||||
|
||||
removeRegisteredObject/removeRegisteredObject.C
|
||||
removeRegisteredObject/removeRegisteredObjectFunctionObject.C
|
||||
|
||||
writeDictionary/writeDictionary.C
|
||||
writeDictionary/writeDictionaryFunctionObject.C
|
||||
|
||||
writeRegisteredObject/writeRegisteredObject.C
|
||||
writeRegisteredObject/writeRegisteredObjectFunctionObject.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects
|
||||
|
||||
@ -30,6 +30,7 @@ License
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "surfaceInterpolate.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -38,6 +39,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(Peclet, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
Peclet,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,17 +55,22 @@ namespace functionObjects
|
||||
Foam::functionObjects::Peclet::Peclet
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho")
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -96,14 +109,16 @@ Foam::functionObjects::Peclet::~Peclet()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::Peclet::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::Peclet::read(const dictionary& dict)
|
||||
{
|
||||
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
|
||||
rhoName_ = dict.lookupOrDefault<word>("rhoName", "rho");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::Peclet::execute()
|
||||
bool Foam::functionObjects::Peclet::execute(const bool postProcess)
|
||||
{
|
||||
typedef compressible::turbulenceModel cmpTurbModel;
|
||||
typedef incompressible::turbulenceModel icoTurbModel;
|
||||
@ -183,28 +198,23 @@ void Foam::functionObjects::Peclet::execute()
|
||||
*mesh.surfaceInterpolation::deltaCoeffs()
|
||||
*fvc::interpolate(nuEff)
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::Peclet::end()
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
void Foam::functionObjects::Peclet::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::Peclet::write()
|
||||
bool Foam::functionObjects::Peclet::write(const bool postProcess)
|
||||
{
|
||||
const surfaceScalarField& Peclet =
|
||||
obr_.lookupObject<surfaceScalarField>(type());
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << Peclet.name() << nl
|
||||
<< endl;
|
||||
|
||||
Peclet.write();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -39,10 +39,8 @@ SourceFiles
|
||||
#ifndef functionObjects_Peclet_H
|
||||
#define functionObjects_Peclet_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "OFstream.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -51,9 +49,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -63,12 +58,11 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class Peclet
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of Peclet objects
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
@ -101,9 +95,8 @@ public:
|
||||
Peclet
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -113,34 +106,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of Peclet
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the Peclet data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate the Peclet number field
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the Peclet and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Write the Peclet number field
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "PecletFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(PecletFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
PecletFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::PecletFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around Peclet to allow it to be created
|
||||
via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
PecletFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef PecletFunctionObject_H
|
||||
#define PecletFunctionObject_H
|
||||
|
||||
#include "Peclet.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::Peclet>
|
||||
PecletFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -25,8 +25,8 @@ License
|
||||
|
||||
#include "Q.H"
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +35,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(Q, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
Q,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,16 +51,21 @@ namespace functionObjects
|
||||
Foam::functionObjects::Q::Q
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
UName_("U")
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -92,13 +104,15 @@ Foam::functionObjects::Q::~Q()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::Q::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::Q::read(const dictionary& dict)
|
||||
{
|
||||
UName_ = dict.lookupOrDefault<word>("UName", "U");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::Q::execute()
|
||||
bool Foam::functionObjects::Q::execute(const bool postProcess)
|
||||
{
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
@ -114,29 +128,23 @@ void Foam::functionObjects::Q::execute()
|
||||
);
|
||||
|
||||
Q = 0.5*(sqr(tr(gradU)) - tr(((gradU) & (gradU))));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::Q::end()
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::Q::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::Q::write()
|
||||
bool Foam::functionObjects::Q::write(const bool postProcess)
|
||||
{
|
||||
const volScalarField& Q =
|
||||
obr_.lookupObject<volScalarField>(type());
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << Q.name() << nl
|
||||
<< endl;
|
||||
|
||||
Q.write();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -43,10 +43,8 @@ SourceFiles
|
||||
#ifndef functionObjects_Q_H
|
||||
#define functionObjects_Q_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "OFstream.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -55,9 +53,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -67,12 +62,11 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class Q
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of Q objects
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
@ -97,14 +91,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
Q
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -114,34 +106,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of Q
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the Q data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate the Q-field
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the Q and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Write the Q-field
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "QFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(QFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
QFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::QFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around Q to allow it to be created
|
||||
via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
QFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef QFunctionObject_H
|
||||
#define QFunctionObject_H
|
||||
|
||||
#include "Q.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::Q>
|
||||
QFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "OSspecific.H"
|
||||
#include "PstreamReduceOps.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -37,6 +38,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(abort, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
abort,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +76,7 @@ void Foam::functionObjects::abort::removeFile() const
|
||||
|
||||
if (hasAbort && Pstream::master())
|
||||
{
|
||||
// cleanup ABORT file (on master only)
|
||||
// Cleanup ABORT file (on master only)
|
||||
rm(abortFile_);
|
||||
}
|
||||
}
|
||||
@ -79,20 +87,19 @@ void Foam::functionObjects::abort::removeFile() const
|
||||
Foam::functionObjects::abort::abort
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
time_(runTime),
|
||||
abortFile_("$FOAM_CASE/" + name),
|
||||
action_(nextWrite)
|
||||
{
|
||||
abortFile_.expand();
|
||||
read(dict);
|
||||
|
||||
// remove any old files from previous runs
|
||||
// Remove any old files from previous runs
|
||||
removeFile();
|
||||
}
|
||||
|
||||
@ -105,7 +112,7 @@ Foam::functionObjects::abort::~abort()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::abort::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::abort::read(const dictionary& dict)
|
||||
{
|
||||
if (dict.found("action"))
|
||||
{
|
||||
@ -120,10 +127,12 @@ void Foam::functionObjects::abort::read(const dictionary& dict)
|
||||
{
|
||||
abortFile_.expand();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::abort::execute()
|
||||
bool Foam::functionObjects::abort::execute(const bool postProcess)
|
||||
{
|
||||
bool hasAbort = isFile(abortFile_);
|
||||
reduce(hasAbort, orOp<bool>());
|
||||
@ -134,10 +143,10 @@ void Foam::functionObjects::abort::execute()
|
||||
{
|
||||
case noWriteNow :
|
||||
{
|
||||
if (obr_.time().stopAt(Time::saNoWriteNow))
|
||||
if (time_.stopAt(Time::saNoWriteNow))
|
||||
{
|
||||
Info<< "USER REQUESTED ABORT (timeIndex="
|
||||
<< obr_.time().timeIndex()
|
||||
<< time_.timeIndex()
|
||||
<< "): stop without writing data"
|
||||
<< endl;
|
||||
}
|
||||
@ -146,10 +155,10 @@ void Foam::functionObjects::abort::execute()
|
||||
|
||||
case writeNow :
|
||||
{
|
||||
if (obr_.time().stopAt(Time::saWriteNow))
|
||||
if (time_.stopAt(Time::saWriteNow))
|
||||
{
|
||||
Info<< "USER REQUESTED ABORT (timeIndex="
|
||||
<< obr_.time().timeIndex()
|
||||
<< time_.timeIndex()
|
||||
<< "): stop+write data"
|
||||
<< endl;
|
||||
}
|
||||
@ -158,10 +167,10 @@ void Foam::functionObjects::abort::execute()
|
||||
|
||||
case nextWrite :
|
||||
{
|
||||
if (obr_.time().stopAt(Time::saNextWrite))
|
||||
if (time_.stopAt(Time::saNextWrite))
|
||||
{
|
||||
Info<< "USER REQUESTED ABORT (timeIndex="
|
||||
<< obr_.time().timeIndex()
|
||||
<< time_.timeIndex()
|
||||
<< "): stop after next data write"
|
||||
<< endl;
|
||||
}
|
||||
@ -169,21 +178,22 @@ void Foam::functionObjects::abort::execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::abort::end()
|
||||
bool Foam::functionObjects::abort::write(const bool postProcess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::abort::end()
|
||||
{
|
||||
removeFile();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::abort::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::abort::write()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -44,19 +44,13 @@ SourceFiles
|
||||
#ifndef functionObjects_abort_H
|
||||
#define functionObjects_abort_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
@ -65,6 +59,8 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class abort
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
public:
|
||||
|
||||
@ -82,10 +78,8 @@ private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Name of the abort file unless otherwise specified
|
||||
word name_;
|
||||
|
||||
const objectRegistry& obr_;
|
||||
//- Reference to the Time
|
||||
const Time& time_;
|
||||
|
||||
//- The fully-qualified name of the abort file
|
||||
fileName abortFile_;
|
||||
@ -117,13 +111,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
//- Construct from Time and dictionary
|
||||
abort
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFilesUnused = false
|
||||
const Time& runTime,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
|
||||
@ -133,34 +126,17 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the abort file
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the dictionary settings
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, check existence of abort file and take action
|
||||
virtual void execute();
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute, check existence of abort file and take action
|
||||
virtual bool write(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, used for cleanup
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Execute, check existence of abort file and take action
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh - does nothing
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh - does nothing
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool end();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "abortFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(abortFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
abortFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::abortFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around abort to allow it to be created via
|
||||
the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
abortFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef abortFunctionObject_H
|
||||
#define abortFunctionObject_H
|
||||
|
||||
#include "abort.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::abort>
|
||||
abortFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,7 +24,8 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "blendingFactor.H"
|
||||
#include "dictionary.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -33,6 +34,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(blendingFactor, 0);
|
||||
addToRunTimeSelectionTable(functionObject, blendingFactor, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,17 +44,22 @@ namespace functionObjects
|
||||
Foam::functionObjects::blendingFactor::blendingFactor
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
phiName_("unknown-phiName"),
|
||||
fieldName_("unknown-fieldName")
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -70,41 +77,38 @@ Foam::functionObjects::blendingFactor::~blendingFactor()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::blendingFactor::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::blendingFactor::read(const dictionary& dict)
|
||||
{
|
||||
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::blendingFactor::execute()
|
||||
bool Foam::functionObjects::blendingFactor::execute(const bool postProcess)
|
||||
{
|
||||
calc<scalar>();
|
||||
calc<vector>();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::blendingFactor::end()
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
void Foam::functionObjects::blendingFactor::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::blendingFactor::write()
|
||||
bool Foam::functionObjects::blendingFactor::write(const bool postProcess)
|
||||
{
|
||||
const word fieldName = "blendingFactor:" + fieldName_;
|
||||
|
||||
const volScalarField& blendingFactor =
|
||||
obr_.lookupObject<volScalarField>(fieldName);
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << blendingFactor.name() << nl
|
||||
<< endl;
|
||||
|
||||
blendingFactor.write();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -32,7 +32,6 @@ Description
|
||||
the bended convection schemes. The output is a volume field (cells) whose
|
||||
value is calculated via the maximum blending factor for any cell face.
|
||||
|
||||
|
||||
SourceFiles
|
||||
blendingFactor.C
|
||||
|
||||
@ -41,10 +40,8 @@ SourceFiles
|
||||
#ifndef functionObjects_blendingFactor_H
|
||||
#define functionObjects_blendingFactor_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "OFstream.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,9 +50,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -65,13 +59,12 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class blendingFactor
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of blendingFactor objects
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Name of flux field, default is "phi"
|
||||
@ -109,14 +102,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
blendingFactor
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -126,34 +117,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of blendingFactor
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the blendingFactor data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate the blending-factor
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the blendingFactor and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Write the blending-factor
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "blendingFactorFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(blendingFactorFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
blendingFactorFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::blendingFactorFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around blendingFactor to allow it to be created
|
||||
via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
blendingFactorFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef blendingFactorFunctionObject_H
|
||||
#define blendingFactorFunctionObject_H
|
||||
|
||||
#include "blendingFactor.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::blendingFactor>
|
||||
blendingFactorFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -64,32 +64,30 @@ void Foam::codedFunctionObject::prepare
|
||||
dynCode.setFilterVariable("codeTimeSet", codeTimeSet_);
|
||||
//dynCode.setFilterVariable("codeWrite", codeWrite_);
|
||||
|
||||
// compile filtered C template
|
||||
// Compile filtered C template
|
||||
dynCode.addCompileFile("functionObjectTemplate.C");
|
||||
dynCode.addCompileFile("FilterFunctionObjectTemplate.C");
|
||||
|
||||
// copy filtered H template
|
||||
dynCode.addCopyFile("FilterFunctionObjectTemplate.H");
|
||||
// Copy filtered H template
|
||||
dynCode.addCopyFile("functionObjectTemplate.H");
|
||||
|
||||
// debugging: make BC verbose
|
||||
// Debugging: make BC verbose
|
||||
// dynCode.setFilterVariable("verbose", "true");
|
||||
// Info<<"compile " << redirectType_ << " sha1: "
|
||||
// << context.sha1() << endl;
|
||||
|
||||
// define Make/options
|
||||
// Define Make/options
|
||||
dynCode.setMakeOptions
|
||||
(
|
||||
"EXE_INC = -g \\\n"
|
||||
"-I$(LIB_SRC)/finiteVolume/lnInclude \\\n"
|
||||
"-I$(LIB_SRC)/meshTools/lnInclude \\\n"
|
||||
+ context.options()
|
||||
+ "\n\nLIB_LIBS = \\\n"
|
||||
+ " -lOpenFOAM \\\n"
|
||||
+ " -lfiniteVolume \\\n"
|
||||
+ " -lmeshTools \\\n"
|
||||
+ context.libs()
|
||||
);
|
||||
(
|
||||
"EXE_INC = -g \\\n"
|
||||
"-I$(LIB_SRC)/finiteVolume/lnInclude \\\n"
|
||||
"-I$(LIB_SRC)/meshTools/lnInclude \\\n"
|
||||
+ context.options()
|
||||
+ "\n\nLIB_LIBS = \\\n"
|
||||
+ " -lOpenFOAM \\\n"
|
||||
+ " -lfiniteVolume \\\n"
|
||||
+ " -lmeshTools \\\n"
|
||||
+ context.libs()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -123,8 +121,7 @@ Foam::codedFunctionObject::codedFunctionObject
|
||||
(
|
||||
const word& name,
|
||||
const Time& time,
|
||||
const dictionary& dict,
|
||||
bool readNow
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject(name),
|
||||
@ -132,10 +129,7 @@ Foam::codedFunctionObject::codedFunctionObject
|
||||
time_(time),
|
||||
dict_(dict)
|
||||
{
|
||||
if (readNow)
|
||||
{
|
||||
read(dict_);
|
||||
}
|
||||
read(dict_);
|
||||
|
||||
updateLibrary(redirectType_);
|
||||
redirectFunctionObject();
|
||||
@ -295,12 +289,4 @@ bool Foam::codedFunctionObject::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void Foam::codedFunctionObject::updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::codedFunctionObject::movePoints(const polyMesh&)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -66,7 +66,6 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::codedBase
|
||||
|
||||
SourceFiles
|
||||
@ -151,14 +150,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
codedFunctionObject
|
||||
(
|
||||
const word& name,
|
||||
const Time& time,
|
||||
const dictionary& dict,
|
||||
bool readNow=true // allow child-classes to avoid compilation
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -190,12 +187,6 @@ public:
|
||||
|
||||
//- Read and set the function object if its data have changed
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Update mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Move points
|
||||
virtual void movePoints(const polyMesh&);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -27,8 +27,8 @@ License
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "dsmcCloud.H"
|
||||
|
||||
#include "constants.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
@ -39,6 +39,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(dsmcFields, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
dsmcFields,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,15 +55,20 @@ namespace functionObjects
|
||||
Foam::functionObjects::dsmcFields::dsmcFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr)
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
)
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -74,23 +86,19 @@ Foam::functionObjects::dsmcFields::~dsmcFields()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::dsmcFields::read(const dictionary& dict)
|
||||
{}
|
||||
bool Foam::functionObjects::dsmcFields::read(const dictionary& dict)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::dsmcFields::execute()
|
||||
{}
|
||||
bool Foam::functionObjects::dsmcFields::execute(const bool postProcess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::dsmcFields::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::dsmcFields::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::dsmcFields::write()
|
||||
bool Foam::functionObjects::dsmcFields::write(const bool postProcess)
|
||||
{
|
||||
word rhoNMeanName = "rhoNMean";
|
||||
word rhoMMeanName = "rhoMMean";
|
||||
@ -254,6 +262,8 @@ void Foam::functionObjects::dsmcFields::write()
|
||||
p.write();
|
||||
|
||||
Info<< "dsmcFields written." << nl << endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -261,6 +271,8 @@ void Foam::functionObjects::dsmcFields::write()
|
||||
<< ") found in rhoNMean field. "
|
||||
<< "Not calculating dsmcFields to avoid division by zero."
|
||||
<< endl;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -43,8 +43,7 @@ SourceFiles
|
||||
#ifndef functionObjects_dsmcFields_H
|
||||
#define functionObjects_dsmcFields_H
|
||||
|
||||
#include "typeInfo.H"
|
||||
#include "autoPtr.H"
|
||||
#include "functionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,9 +52,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -65,12 +61,11 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class dsmcFields
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of dsmcFields objects
|
||||
word name_;
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
|
||||
@ -91,14 +86,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
dsmcFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -108,34 +101,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of dsmcFields
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the dsmcFields data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Do nothing
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the dsmcFields and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Calculate and write the DSMC fields
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "dsmcFieldsFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(dsmcFieldsFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
dsmcFieldsFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::dsmcFieldsFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around dsmcFields to allow it to be created via
|
||||
the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
dsmcFieldsFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef dsmcFieldsFunctionObject_H
|
||||
#define dsmcFieldsFunctionObject_H
|
||||
|
||||
#include "dsmcFields.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::dsmcFields>
|
||||
dsmcFieldsFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,11 +24,9 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "partialWrite.H"
|
||||
#include "dictionary.H"
|
||||
#include "Time.H"
|
||||
#include "IOobjectList.H"
|
||||
#include "polyMesh.H"
|
||||
#include "cloud.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -37,6 +35,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(partialWrite, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
partialWrite,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,13 +51,18 @@ namespace functionObjects
|
||||
Foam::functionObjects::partialWrite::partialWrite
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr)
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
@ -66,7 +76,7 @@ Foam::functionObjects::partialWrite::~partialWrite()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::partialWrite::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::partialWrite::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("objectNames") >> objectNames_;
|
||||
dict.lookup("writeInterval") >> writeInterval_;
|
||||
@ -110,18 +120,18 @@ void Foam::functionObjects::partialWrite::read(const dictionary& dict)
|
||||
loadField<symmTensor>(iter.key(), vSymmtf_, sSymmtf_);
|
||||
loadField<tensor>(iter.key(), vtf_, stf_);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::partialWrite::execute()
|
||||
{}
|
||||
bool Foam::functionObjects::partialWrite::execute(const bool postProcess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::partialWrite::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::partialWrite::timeSet()
|
||||
bool Foam::functionObjects::partialWrite::timeSet()
|
||||
{
|
||||
if (obr_.time().writeTime())
|
||||
{
|
||||
@ -168,12 +178,14 @@ void Foam::functionObjects::partialWrite::timeSet()
|
||||
changeWriteOptions<tensor>(vtf_, stf_, IOobject::NO_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::partialWrite::write()
|
||||
bool Foam::functionObjects::partialWrite::write(const bool postProcess)
|
||||
{
|
||||
// Fields are written in the standard manner
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -54,7 +54,7 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
SourceFiles
|
||||
partialWrite.C
|
||||
@ -64,8 +64,8 @@ SourceFiles
|
||||
#ifndef functionObjects_partialWrite_H
|
||||
#define functionObjects_partialWrite_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "HashSet.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
@ -73,13 +73,6 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
@ -88,14 +81,14 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class partialWrite
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Name of this partialWrite functionObject
|
||||
word name_;
|
||||
// Protected data
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Loaded fields
|
||||
@ -111,6 +104,7 @@ protected:
|
||||
UPtrList<surfaceSymmTensorField> sSymmtf_;
|
||||
UPtrList<surfaceTensorField> stf_;
|
||||
|
||||
|
||||
// Read from dictionary
|
||||
|
||||
//- Names of objects to dump always
|
||||
@ -120,11 +114,12 @@ protected:
|
||||
label writeInterval_;
|
||||
|
||||
|
||||
|
||||
//- Current dump instance. If reaches writeInterval do a full write.
|
||||
label writeInstance_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
@ -160,14 +155,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
partialWrite
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -177,34 +170,18 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the partialWrite
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the partialWrite data
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Execute
|
||||
virtual void execute();
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
virtual bool timeSet();
|
||||
|
||||
//- Write the partialWrite
|
||||
virtual void write();
|
||||
//- Execute
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Do nothing.
|
||||
// The fields are registered and written automatically
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "partialWriteFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug
|
||||
(
|
||||
partialWriteFunctionObject,
|
||||
0
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
partialWriteFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -21,34 +21,26 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::partialWriteFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around partialWrite to allow them to be
|
||||
created via the functions list within controlDict.
|
||||
|
||||
SourceFiles
|
||||
partialWriteFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef partialWriteFunctionObject_H
|
||||
#define partialWriteFunctionObject_H
|
||||
#include "partialWriteFunctionObject.H"
|
||||
|
||||
#include "partialWrite.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::partialWrite>
|
||||
partialWriteFunctionObject;
|
||||
defineNamedTemplateTypeNameAndDebug
|
||||
(
|
||||
partialWriteFunctionObject,
|
||||
0
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
partialWriteFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -24,8 +24,9 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "removeRegisteredObject.H"
|
||||
#include "dictionary.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -34,6 +35,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(removeRegisteredObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
removeRegisteredObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,13 +51,18 @@ namespace functionObjects
|
||||
Foam::functionObjects::removeRegisteredObject::removeRegisteredObject
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
objectNames_()
|
||||
{
|
||||
read(dict);
|
||||
@ -64,13 +77,18 @@ Foam::functionObjects::removeRegisteredObject::~removeRegisteredObject()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::removeRegisteredObject::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("objectNames") >> objectNames_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::removeRegisteredObject::execute()
|
||||
bool Foam::functionObjects::removeRegisteredObject::execute
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
forAll(objectNames_, i)
|
||||
{
|
||||
@ -81,7 +99,7 @@ void Foam::functionObjects::removeRegisteredObject::execute()
|
||||
|
||||
if (obj.ownedByRegistry())
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " removing object " << obj.name() << nl
|
||||
<< endl;
|
||||
|
||||
@ -90,21 +108,18 @@ void Foam::functionObjects::removeRegisteredObject::execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::removeRegisteredObject::end()
|
||||
bool Foam::functionObjects::removeRegisteredObject::write
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
execute();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::removeRegisteredObject::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::removeRegisteredObject::write()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -50,7 +50,6 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
removeRegisteredObject.C
|
||||
@ -60,8 +59,8 @@ SourceFiles
|
||||
#ifndef functionObjects_removeRegisteredObject_H
|
||||
#define functionObjects_removeRegisteredObject_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "wordList.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -70,9 +69,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -82,23 +78,17 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class removeRegisteredObject
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Name of this set of removeRegisteredObject
|
||||
word name_;
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
// Read from dictionary
|
||||
//- Names of objects to control
|
||||
wordList objectNames_;
|
||||
|
||||
//- Names of objects to control
|
||||
wordList objectNames_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
@ -117,14 +107,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
removeRegisteredObject
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -134,34 +122,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the removeRegisteredObject
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the removeRegisteredObject data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Remove the registered objects
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Write the removeRegisteredObject
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Do nothing
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "removeRegisteredObjectFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug
|
||||
(
|
||||
removeRegisteredObjectFunctionObject,
|
||||
0
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
removeRegisteredObjectFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::removeRegisteredObjectFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around removeRegisteredObject to allow them to be
|
||||
created via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
removeRegisteredObjectFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef removeRegisteredObjectFunctionObject_H
|
||||
#define removeRegisteredObjectFunctionObject_H
|
||||
|
||||
#include "removeRegisteredObject.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::removeRegisteredObject>
|
||||
removeRegisteredObjectFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,9 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "residuals.H"
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "Time.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +33,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(residuals, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
residuals,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,23 +49,21 @@ namespace functionObjects
|
||||
Foam::functionObjects::residuals::residuals
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObjectFiles(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
writeFiles(name, runTime, dict, name),
|
||||
fieldSet_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
resetName(typeName);
|
||||
}
|
||||
|
||||
|
||||
@ -72,9 +75,11 @@ Foam::functionObjects::residuals::~residuals()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::residuals::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::residuals::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -101,21 +106,16 @@ void Foam::functionObjects::residuals::writeFileHeader(const label i)
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::residuals::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::residuals::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::residuals::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::residuals::write()
|
||||
bool Foam::functionObjects::residuals::execute(const bool postProcess)
|
||||
{
|
||||
functionObjectFiles::write();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::residuals::write(const bool postProcess)
|
||||
{
|
||||
writeFiles::write();
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
@ -134,6 +134,8 @@ void Foam::functionObjects::residuals::write()
|
||||
|
||||
file() << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -51,7 +51,8 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjects::writeFiles
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
SourceFiles
|
||||
residuals.C
|
||||
@ -61,26 +62,12 @@ SourceFiles
|
||||
#ifndef functionObjects_residuals_H
|
||||
#define functionObjects_residuals_H
|
||||
|
||||
#include "functionObjectFiles.H"
|
||||
#include "primitiveFieldsFwd.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "HashSet.H"
|
||||
#include "OFstream.H"
|
||||
#include "Switch.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "solverPerformance.H"
|
||||
#include "writeFiles.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
@ -90,23 +77,17 @@ namespace functionObjects
|
||||
|
||||
class residuals
|
||||
:
|
||||
public functionObjectFiles
|
||||
public writeFiles
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of residuals
|
||||
// Also used as the name of the output directory
|
||||
word name_;
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Fields to write residuals
|
||||
wordList fieldSet_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
// Protected Member Functions
|
||||
|
||||
//- Output field header information
|
||||
template<class Type>
|
||||
@ -115,6 +96,10 @@ protected:
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
//- Calculate the field min/max
|
||||
template<class Type>
|
||||
void writeResidual(const word& fieldName);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -135,14 +120,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
residuals
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -152,38 +135,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the functionObject
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the controls
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the field min/max
|
||||
template<class Type>
|
||||
void writeResidual(const word& fieldName);
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Write the residuals
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "residualsFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(residualsFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
residualsFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::residualsFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around residuals to allow them to be created via
|
||||
the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
residualsFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef residualsFunctionObject_H
|
||||
#define residualsFunctionObject_H
|
||||
|
||||
#include "residuals.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::residuals>
|
||||
residualsFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -25,8 +25,6 @@ License
|
||||
|
||||
#include "residuals.H"
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "Time.H"
|
||||
#include "ListOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -36,6 +36,7 @@ License
|
||||
#include "fvmSup.H"
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -44,6 +45,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(scalarTransport, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
scalarTransport,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,13 +153,21 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::DT
|
||||
Foam::functionObjects::scalarTransport::scalarTransport
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
mesh_(refCast<const fvMesh>(obr)),
|
||||
functionObject(name),
|
||||
mesh_
|
||||
(
|
||||
refCast<const fvMesh>
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
)
|
||||
),
|
||||
phiName_(dict.lookupOrDefault<word>("phiName", "phi")),
|
||||
UName_(dict.lookupOrDefault<word>("UName", "U")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rhoName", "rho")),
|
||||
@ -176,12 +192,6 @@ Foam::functionObjects::scalarTransport::scalarTransport
|
||||
boundaryTypes()
|
||||
)
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
|
||||
if (resetOnStartUp_)
|
||||
@ -199,7 +209,7 @@ Foam::functionObjects::scalarTransport::~scalarTransport()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::scalarTransport::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::scalarTransport::read(const dictionary& dict)
|
||||
{
|
||||
Info<< type() << ":" << nl;
|
||||
|
||||
@ -220,10 +230,12 @@ void Foam::functionObjects::scalarTransport::read(const dictionary& dict)
|
||||
dict.lookup("autoSchemes") >> autoSchemes_;
|
||||
|
||||
fvOptions_.reset(dict.subDict("fvOptions"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::scalarTransport::execute()
|
||||
bool Foam::functionObjects::scalarTransport::execute(const bool postProcess)
|
||||
{
|
||||
Info<< type() << " output:" << endl;
|
||||
|
||||
@ -304,21 +316,15 @@ void Foam::functionObjects::scalarTransport::execute()
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::scalarTransport::end()
|
||||
bool Foam::functionObjects::scalarTransport::write(const bool postProcess)
|
||||
{
|
||||
execute();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::scalarTransport::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::scalarTransport::write()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -47,10 +47,9 @@ SourceFiles
|
||||
#ifndef functionObjects_scalarTransport_H
|
||||
#define functionObjects_scalarTransport_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "fvMatricesFwd.H"
|
||||
#include "fvOptionList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -60,8 +59,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -71,12 +68,11 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class scalarTransport
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of scalarTransport objects
|
||||
word name_;
|
||||
|
||||
//- Reference to the mesh database
|
||||
const fvMesh& mesh_;
|
||||
|
||||
@ -134,14 +130,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
scalarTransport
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -151,34 +145,15 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of scalarTransport
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the scalarTransport data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate the scalarTransport
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the scalarTransport and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Do nothing.
|
||||
// The volScalarField is registered and written automatically
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "scalarTransportFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(scalarTransportFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
scalarTransportFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::scalarTransportFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around scalarTransport to allow it to be
|
||||
created via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
scalarTransportFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef scalarTransportFunctionObject_H
|
||||
#define scalarTransportFunctionObject_H
|
||||
|
||||
#include "scalarTransport.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::scalarTransport>
|
||||
scalarTransportFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -75,36 +75,6 @@ Foam::functionObjects::setTimeStepFunctionObject::time() const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::setTimeStepFunctionObject::execute
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::setTimeStepFunctionObject::write
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::setTimeStepFunctionObject::end()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::setTimeStepFunctionObject::timeSet()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::setTimeStepFunctionObject::adjustTimeStep()
|
||||
{
|
||||
const_cast<Time&>(time()).setDeltaT
|
||||
@ -143,18 +113,22 @@ bool Foam::functionObjects::setTimeStepFunctionObject::read
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::setTimeStepFunctionObject::updateMesh
|
||||
bool Foam::functionObjects::setTimeStepFunctionObject::execute
|
||||
(
|
||||
const mapPolyMesh&
|
||||
const bool postProcess
|
||||
)
|
||||
{}
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::setTimeStepFunctionObject::movePoints
|
||||
bool Foam::functionObjects::setTimeStepFunctionObject::write
|
||||
(
|
||||
const polyMesh&
|
||||
const bool postProcess
|
||||
)
|
||||
{}
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -101,41 +101,24 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
//- Return time database
|
||||
const Time& time() const;
|
||||
|
||||
//- Return time database
|
||||
const Time& time() const;
|
||||
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
||||
virtual bool adjustTimeStep();
|
||||
|
||||
//- Read and set the function object if its data have changed
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
// Function object control
|
||||
//- Called at each ++ or += of the time-loop.
|
||||
// postProcess overrides the usual executeControl behaviour and
|
||||
// forces execution (used in post-processing mode)
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Called at each ++ or += of the time-loop.
|
||||
// postProcess overrides the usual executeControl behaviour and
|
||||
// forces execution (used in post-processing mode)
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Called at each ++ or += of the time-loop.
|
||||
// postProcess overrides the usual writeControl behaviour and
|
||||
// forces writing always (used in post-processing mode)
|
||||
virtual bool write(const bool postProcess = false);
|
||||
|
||||
//- Called when Time::run() determines that the time-loop exits
|
||||
virtual bool end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual bool timeSet();
|
||||
|
||||
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
||||
virtual bool adjustTimeStep();
|
||||
|
||||
//- Read and set the function object if its data have changed
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&);
|
||||
//- Called at each ++ or += of the time-loop.
|
||||
// postProcess overrides the usual writeControl behaviour and
|
||||
// forces writing always (used in post-processing mode)
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -26,6 +26,7 @@ License
|
||||
#include "systemCall.H"
|
||||
#include "Time.H"
|
||||
#include "dynamicCode.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -34,6 +35,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(systemCall, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
systemCall,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,12 +51,11 @@ namespace functionObjects
|
||||
Foam::functionObjects::systemCall::systemCall
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary& dict,
|
||||
const bool
|
||||
const Time&,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
functionObject(name),
|
||||
executeCalls_(),
|
||||
endCalls_(),
|
||||
writeCalls_()
|
||||
@ -65,7 +72,7 @@ Foam::functionObjects::systemCall::~systemCall()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::systemCall::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::systemCall::read(const dictionary& dict)
|
||||
{
|
||||
dict.readIfPresent("executeCalls", executeCalls_);
|
||||
dict.readIfPresent("endCalls", endCalls_);
|
||||
@ -93,37 +100,41 @@ void Foam::functionObjects::systemCall::read(const dictionary& dict)
|
||||
<< " $WM_PROJECT_DIR/etc/controlDict" << nl << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::systemCall::execute()
|
||||
bool Foam::functionObjects::systemCall::execute(const bool postProcess)
|
||||
{
|
||||
forAll(executeCalls_, callI)
|
||||
{
|
||||
Foam::system(executeCalls_[callI]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::systemCall::end()
|
||||
bool Foam::functionObjects::systemCall::end()
|
||||
{
|
||||
forAll(endCalls_, callI)
|
||||
{
|
||||
Foam::system(endCalls_[callI]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::systemCall::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::systemCall::write()
|
||||
bool Foam::functionObjects::systemCall::write(const bool postProcess)
|
||||
{
|
||||
forAll(writeCalls_, callI)
|
||||
{
|
||||
Foam::system(writeCalls_[callI]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -76,7 +76,7 @@ Note
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
SourceFiles
|
||||
systemCall.C
|
||||
@ -86,19 +86,13 @@ SourceFiles
|
||||
#ifndef functionObjects_systemCall_H
|
||||
#define functionObjects_systemCall_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "stringList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
@ -107,14 +101,13 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class systemCall
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Name of this set of system calls
|
||||
word name_;
|
||||
|
||||
//- List of calls to execute - every step
|
||||
stringList executeCalls_;
|
||||
|
||||
@ -144,14 +137,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
systemCall
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& unused,
|
||||
const dictionary&,
|
||||
const bool loadFromFilesUnused = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -161,34 +152,17 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the system call set
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the system calls
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute the "executeCalls" at each time-step
|
||||
virtual void execute();
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute the "endCalls" at the final time-loop
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
virtual bool end();
|
||||
|
||||
//- Write, execute the "writeCalls"
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "systemCallFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(systemCallFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
systemCallFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::systemCallFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around systemCall to allow them to be created via
|
||||
the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
systemCallFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef systemCallFunctionObject_H
|
||||
#define systemCallFunctionObject_H
|
||||
|
||||
#include "systemCall.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::systemCall>
|
||||
systemCallFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,9 +24,9 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "timeActivatedFileUpdate.H"
|
||||
#include "objectRegistry.H"
|
||||
#include "Time.H"
|
||||
#include "dictionary.H"
|
||||
#include "polyMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +35,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(timeActivatedFileUpdate, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
timeActivatedFileUpdate,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,7 +54,7 @@ void Foam::functionObjects::timeActivatedFileUpdate::updateFile()
|
||||
while
|
||||
(
|
||||
i < timeVsFile_.size()-1
|
||||
&& timeVsFile_[i+1].first() < obr_.time().value()
|
||||
&& timeVsFile_[i+1].first() < time_.value()
|
||||
)
|
||||
{
|
||||
i++;
|
||||
@ -69,13 +76,12 @@ void Foam::functionObjects::timeActivatedFileUpdate::updateFile()
|
||||
Foam::functionObjects::timeActivatedFileUpdate::timeActivatedFileUpdate
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
time_(runTime),
|
||||
fileToUpdate_(dict.lookup("fileToUpdate")),
|
||||
timeVsFile_(),
|
||||
lastIndex_(-1)
|
||||
@ -92,7 +98,7 @@ Foam::functionObjects::timeActivatedFileUpdate::~timeActivatedFileUpdate()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::timeActivatedFileUpdate::read
|
||||
bool Foam::functionObjects::timeActivatedFileUpdate::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
@ -120,27 +126,29 @@ void Foam::functionObjects::timeActivatedFileUpdate::read
|
||||
Info<< endl;
|
||||
|
||||
updateFile();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::timeActivatedFileUpdate::execute()
|
||||
bool Foam::functionObjects::timeActivatedFileUpdate::execute
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
updateFile();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::timeActivatedFileUpdate::end()
|
||||
bool Foam::functionObjects::timeActivatedFileUpdate::write
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
execute();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::timeActivatedFileUpdate::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::timeActivatedFileUpdate::write()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -59,6 +59,7 @@ SourceFiles
|
||||
#ifndef functionObjects_timeActivatedFileUpdate_H
|
||||
#define functionObjects_timeActivatedFileUpdate_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "Tuple2.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -67,10 +68,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
class Time;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -80,14 +78,13 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class timeActivatedFileUpdate
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of timeActivatedFileUpdate objects
|
||||
word name_;
|
||||
|
||||
//- Owner database
|
||||
const objectRegistry& obr_;
|
||||
//- Reference to Time
|
||||
const Time& time_;
|
||||
|
||||
//- Name of file to update
|
||||
fileName fileToUpdate_;
|
||||
@ -119,14 +116,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
timeActivatedFileUpdate
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -136,34 +131,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of timeActivatedFileUpdate
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the timeActivatedFileUpdate data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Execute file updates
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the timeActivatedFileUpdate and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Do nothing
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "timeActivatedFileUpdateFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug
|
||||
(
|
||||
timeActivatedFileUpdateFunctionObject,
|
||||
0
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
timeActivatedFileUpdateFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::timeActivatedFileUpdateFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around timeActivatedFileUpdate to allow it to be
|
||||
created via the functions list within controlDict.
|
||||
|
||||
SourceFiles
|
||||
timeActivatedFileUpdateFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef timeActivatedFileUpdateFunctionObject_H
|
||||
#define timeActivatedFileUpdateFunctionObject_H
|
||||
|
||||
#include "timeActivatedFileUpdate.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::timeActivatedFileUpdate>
|
||||
timeActivatedFileUpdateFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,9 +24,9 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "turbulenceFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +35,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(turbulenceFields, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
turbulenceFields,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,16 +123,21 @@ bool Foam::functionObjects::turbulenceFields::compressible()
|
||||
Foam::functionObjects::turbulenceFields::turbulenceFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
fieldSet_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -133,8 +145,8 @@ Foam::functionObjects::turbulenceFields::turbulenceFields
|
||||
|
||||
if
|
||||
(
|
||||
!obr.foundObject<compressible::turbulenceModel>(modelName)
|
||||
&& !obr.foundObject<incompressible::turbulenceModel>(modelName)
|
||||
!obr_.foundObject<compressible::turbulenceModel>(modelName)
|
||||
&& !obr_.foundObject<incompressible::turbulenceModel>(modelName)
|
||||
)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
@ -154,11 +166,11 @@ Foam::functionObjects::turbulenceFields::~turbulenceFields()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
|
||||
{
|
||||
fieldSet_.insert(wordList(dict.lookup("fields")));
|
||||
|
||||
Info<< type() << " " << name_ << ": ";
|
||||
Info<< type() << " " << name() << ": ";
|
||||
if (fieldSet_.size())
|
||||
{
|
||||
Info<< "storing fields:" << nl;
|
||||
@ -172,10 +184,12 @@ void Foam::functionObjects::turbulenceFields::read(const dictionary& dict)
|
||||
{
|
||||
Info<< "no fields requested to be stored" << nl << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::turbulenceFields::execute()
|
||||
bool Foam::functionObjects::turbulenceFields::execute(const bool postProcess)
|
||||
{
|
||||
bool comp = compressible();
|
||||
|
||||
@ -285,21 +299,15 @@ void Foam::functionObjects::turbulenceFields::execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::turbulenceFields::end()
|
||||
bool Foam::functionObjects::turbulenceFields::write(const bool postProcess)
|
||||
{
|
||||
execute();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::turbulenceFields::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::turbulenceFields::write()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -77,7 +77,7 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
SourceFiles
|
||||
turbulenceFields.C
|
||||
@ -87,6 +87,7 @@ SourceFiles
|
||||
#ifndef functionObjects_turbulenceFields_H
|
||||
#define functionObjects_turbulenceFields_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "HashSet.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "volFieldsFwd.H"
|
||||
@ -98,9 +99,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -110,6 +108,8 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class turbulenceFields
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
public:
|
||||
|
||||
@ -144,9 +144,7 @@ protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of turbulenceFields object
|
||||
word name_;
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Fields to load
|
||||
@ -186,14 +184,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
turbulenceFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -203,34 +199,15 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the turbulenceFields object
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the controls
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate turbulence fields
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Do nothing.
|
||||
// The turbulence fields are registered and written automatically
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "turbulenceFieldsFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(turbulenceFieldsFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
turbulenceFieldsFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::turbulenceFieldsFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around turbulenceFields to allow them to be created
|
||||
via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
turbulenceFieldsFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef turbulenceFieldsFunctionObject_H
|
||||
#define turbulenceFieldsFunctionObject_H
|
||||
|
||||
#include "turbulenceFields.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::turbulenceFields>
|
||||
turbulenceFieldsFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -25,8 +25,8 @@ License
|
||||
|
||||
#include "vorticity.H"
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "fvcCurl.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +35,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(vorticity, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
vorticity,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,17 +51,22 @@ namespace functionObjects
|
||||
Foam::functionObjects::vorticity::vorticity
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
UName_("U"),
|
||||
outputName_(typeName)
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -93,17 +105,19 @@ Foam::functionObjects::vorticity::~vorticity()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::vorticity::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::vorticity::read(const dictionary& dict)
|
||||
{
|
||||
UName_ = dict.lookupOrDefault<word>("UName", "U");
|
||||
if (UName_ != "U")
|
||||
{
|
||||
outputName_ = typeName + "(" + UName_ + ")";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::vorticity::execute()
|
||||
bool Foam::functionObjects::vorticity::execute(const bool postProcess)
|
||||
{
|
||||
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
|
||||
|
||||
@ -113,29 +127,23 @@ void Foam::functionObjects::vorticity::execute()
|
||||
);
|
||||
|
||||
vorticity = fvc::curl(U);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::vorticity::end()
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::vorticity::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::vorticity::write()
|
||||
bool Foam::functionObjects::vorticity::write(const bool postProcess)
|
||||
{
|
||||
const volVectorField& vorticity =
|
||||
obr_.lookupObject<volVectorField>(outputName_);
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << vorticity.name() << nl
|
||||
<< endl;
|
||||
|
||||
vorticity.write();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
#ifndef functionObjects_vorticity_H
|
||||
#define functionObjects_vorticity_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -47,9 +48,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -59,12 +57,11 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class vorticity
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of vorticity objects
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
@ -92,14 +89,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
vorticity
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -109,34 +104,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of vorticity
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the vorticity data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Calculate the vorticity and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "vorticityFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(vorticityFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
vorticityFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2014-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::vorticityFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around vorticity to allow it to be created
|
||||
via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
vorticityFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef vorticityFunctionObject_H
|
||||
#define vorticityFunctionObject_H
|
||||
|
||||
#include "vorticity.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::vorticity>
|
||||
vorticityFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,9 +24,9 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "writeDictionary.H"
|
||||
#include "dictionary.H"
|
||||
#include "Time.H"
|
||||
#include "HashSet.H"
|
||||
#include "polyMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +35,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(writeDictionary, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
writeDictionary,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +73,7 @@ bool Foam::functionObjects::writeDictionary::tryDirectory
|
||||
{
|
||||
if (firstDict)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl << endl;
|
||||
Info<< type() << " " << name() << " output:" << nl << endl;
|
||||
|
||||
IOobject::writeDivider(Info);
|
||||
Info<< endl;
|
||||
@ -92,13 +99,18 @@ bool Foam::functionObjects::writeDictionary::tryDirectory
|
||||
Foam::functionObjects::writeDictionary::writeDictionary
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
dictNames_(),
|
||||
digests_()
|
||||
{
|
||||
@ -115,7 +127,7 @@ Foam::functionObjects::writeDictionary::~writeDictionary()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::writeDictionary::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::writeDictionary::read(const dictionary& dict)
|
||||
{
|
||||
wordList dictNames(dict.lookup("dictNames"));
|
||||
HashSet<word> uniqueNames(dictNames);
|
||||
@ -123,7 +135,7 @@ void Foam::functionObjects::writeDictionary::read(const dictionary& dict)
|
||||
|
||||
digests_.setSize(dictNames_.size(), SHA1Digest());
|
||||
|
||||
Info<< type() << " " << name_ << ": monitoring dictionaries:" << nl;
|
||||
Info<< type() << " " << name() << ": monitoring dictionaries:" << nl;
|
||||
if (dictNames_.size())
|
||||
{
|
||||
forAll(dictNames_, i)
|
||||
@ -136,10 +148,12 @@ void Foam::functionObjects::writeDictionary::read(const dictionary& dict)
|
||||
Info<< " none" << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeDictionary::execute()
|
||||
bool Foam::functionObjects::writeDictionary::execute(const bool postProcess)
|
||||
{
|
||||
bool firstDict = true;
|
||||
forAll(dictNames_, i)
|
||||
@ -153,7 +167,7 @@ void Foam::functionObjects::writeDictionary::execute()
|
||||
{
|
||||
if (firstDict)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl << endl;
|
||||
Info<< type() << " " << name() << " output:" << nl << endl;
|
||||
|
||||
IOobject::writeDivider(Info);
|
||||
Info<< endl;
|
||||
@ -192,21 +206,15 @@ void Foam::functionObjects::writeDictionary::execute()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeDictionary::end()
|
||||
bool Foam::functionObjects::writeDictionary::write(const bool postProcess)
|
||||
{
|
||||
execute();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeDictionary::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeDictionary::write()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -38,8 +38,8 @@ SourceFiles
|
||||
#ifndef functionObjects_writeDictionary_H
|
||||
#define functionObjects_writeDictionary_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "wordList.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "SHA1Digest.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -49,9 +49,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -61,14 +58,11 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class writeDictionary
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Name of this set of writeDictionary
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
const objectRegistry& obr_;
|
||||
|
||||
@ -109,14 +103,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
writeDictionary
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -126,34 +118,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the writeDictionary
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the writeDictionary data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Write the writeDictionary
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "writeDictionaryFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(writeDictionaryFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
writeDictionaryFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::writeDictionaryFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around writeDictionary to allow them to be
|
||||
created via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
writeDictionaryFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef writeDictionaryFunctionObject_H
|
||||
#define writeDictionaryFunctionObject_H
|
||||
|
||||
#include "writeDictionary.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::writeDictionary>
|
||||
writeDictionaryFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,8 +24,9 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "writeRegisteredObject.H"
|
||||
#include "dictionary.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -34,6 +35,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(writeRegisteredObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
writeRegisteredObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,14 +51,19 @@ namespace functionObjects
|
||||
Foam::functionObjects::writeRegisteredObject::writeRegisteredObject
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
exclusiveWriting_(false),
|
||||
obr_(obr),
|
||||
objectNames_()
|
||||
{
|
||||
read(dict);
|
||||
@ -65,28 +78,30 @@ Foam::functionObjects::writeRegisteredObject::~writeRegisteredObject()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::writeRegisteredObject::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::writeRegisteredObject::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("objectNames") >> objectNames_;
|
||||
dict.readIfPresent("exclusiveWriting", exclusiveWriting_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeRegisteredObject::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeRegisteredObject::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeRegisteredObject::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeRegisteredObject::write()
|
||||
bool Foam::functionObjects::writeRegisteredObject::execute
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::writeRegisteredObject::write
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
DynamicList<word> allNames(obr_.toc().size());
|
||||
forAll(objectNames_, i)
|
||||
@ -124,6 +139,8 @@ void Foam::functionObjects::writeRegisteredObject::write()
|
||||
|
||||
obj.write();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
SourceFiles
|
||||
writeRegisteredObject.C
|
||||
@ -74,8 +74,8 @@ SourceFiles
|
||||
#ifndef functionObjects_writeRegisteredObject_H
|
||||
#define functionObjects_writeRegisteredObject_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "wordReList.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -84,9 +84,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -96,27 +93,23 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class writeRegisteredObject
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of writeRegisteredObject
|
||||
word name_;
|
||||
|
||||
//- Takes over the writing from Db
|
||||
bool exclusiveWriting_;
|
||||
|
||||
//- Refererence to Db
|
||||
const objectRegistry& obr_;
|
||||
|
||||
// Read from dictionary
|
||||
//- Takes over the writing from Db
|
||||
bool exclusiveWriting_;
|
||||
|
||||
//- Names of objects to control
|
||||
wordReList objectNames_;
|
||||
//- Names of objects to control
|
||||
wordReList objectNames_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
writeRegisteredObject(const writeRegisteredObject&);
|
||||
|
||||
@ -132,14 +125,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
writeRegisteredObject
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -149,34 +140,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the writeRegisteredObject
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the writeRegisteredObject data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Do nothing
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Write the writeRegisteredObject
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Write the registered objects
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,46 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "writeRegisteredObjectFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug
|
||||
(
|
||||
writeRegisteredObjectFunctionObject,
|
||||
0
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
writeRegisteredObjectFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::writeRegisteredObjectFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around writeRegisteredObject to allow them to be
|
||||
created via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
writeRegisteredObjectFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef writeRegisteredObjectFunctionObject_H
|
||||
#define writeRegisteredObjectFunctionObject_H
|
||||
|
||||
#include "writeRegisteredObject.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::writeRegisteredObject>
|
||||
writeRegisteredObjectFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "volFields.H"
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "turbulentFluidThermoModel.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +36,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(yPlus, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
yPlus,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,18 +67,14 @@ void Foam::functionObjects::yPlus::writeFileHeader(const label i)
|
||||
Foam::functionObjects::yPlus::yPlus
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObjectFiles(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
log_(true),
|
||||
writeFiles(name, runTime, dict, name),
|
||||
phiName_("phi")
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -96,6 +100,8 @@ Foam::functionObjects::yPlus::yPlus
|
||||
);
|
||||
|
||||
mesh.objectRegistry::store(yPlusPtr);
|
||||
|
||||
resetName(typeName);
|
||||
}
|
||||
|
||||
|
||||
@ -107,19 +113,21 @@ Foam::functionObjects::yPlus::~yPlus()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::yPlus::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::yPlus::read(const dictionary& dict)
|
||||
{
|
||||
log_ = dict.lookupOrDefault<Switch>("log", true);
|
||||
writeFiles::read(dict);
|
||||
phiName_ = dict.lookupOrDefault<word>("phiName", "phi");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::yPlus::execute()
|
||||
bool Foam::functionObjects::yPlus::execute(const bool postProcess)
|
||||
{
|
||||
typedef compressible::turbulenceModel cmpModel;
|
||||
typedef incompressible::turbulenceModel icoModel;
|
||||
|
||||
functionObjectFiles::write();
|
||||
writeFiles::write();
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
@ -129,7 +137,7 @@ void Foam::functionObjects::yPlus::execute()
|
||||
mesh.lookupObject<volScalarField>(type())
|
||||
);
|
||||
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
if (log_) Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
tmp<volSymmTensorField> Reff;
|
||||
if (mesh.foundObject<cmpModel>(turbulenceModel::propertiesName))
|
||||
@ -152,22 +160,14 @@ void Foam::functionObjects::yPlus::execute()
|
||||
<< "Unable to find turbulence model in the "
|
||||
<< "database" << exit(FatalError);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::yPlus::end()
|
||||
bool Foam::functionObjects::yPlus::write(const bool postProcess)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::yPlus::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::yPlus::write()
|
||||
{
|
||||
functionObjectFiles::write();
|
||||
writeFiles::write();
|
||||
|
||||
const volScalarField& yPlus =
|
||||
obr_.lookupObject<volScalarField>(type());
|
||||
@ -175,6 +175,8 @@ void Foam::functionObjects::yPlus::write()
|
||||
if (log_) Info<< " writing field " << yPlus.name() << nl << endl;
|
||||
|
||||
yPlus.write();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -31,6 +31,11 @@ Description
|
||||
Evaluates and outputs turbulence y+ for models. Values written to
|
||||
time directories as field 'yPlus'
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::writeFiles
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
SourceFiles
|
||||
yPlus.C
|
||||
|
||||
@ -39,10 +44,8 @@ SourceFiles
|
||||
#ifndef functionObjects_yPlus_H
|
||||
#define functionObjects_yPlus_H
|
||||
|
||||
#include "functionObjectFiles.H"
|
||||
#include "writeFiles.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "Switch.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -51,9 +54,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
class fvMesh;
|
||||
|
||||
namespace functionObjects
|
||||
@ -65,18 +65,10 @@ namespace functionObjects
|
||||
|
||||
class yPlus
|
||||
:
|
||||
public functionObjectFiles
|
||||
public writeFiles
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of yPlus objects
|
||||
word name_;
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
//- Name of mass/volume flux field (optional, default = phi)
|
||||
word phiName_;
|
||||
|
||||
@ -110,14 +102,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
yPlus
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -127,34 +117,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of yPlus
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the yPlus data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Calculate the yPlus and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "yPlusFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(yPlusFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
yPlusFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::yPlusFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around yPlus to allow it to be created
|
||||
via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
yPlusFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef yPlusFunctionObject_H
|
||||
#define yPlusFunctionObject_H
|
||||
|
||||
#include "yPlus.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<functionObjects::yPlus>
|
||||
yPlusFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user