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:
Henry Weller
2016-05-15 16:40:01 +01:00
parent ce0cd35185
commit 78d2971b21
230 changed files with 2731 additions and 8756 deletions

View File

@ -1,61 +1,39 @@
fieldAverage/fieldAverage/fieldAverage.C
fieldAverage/fieldAverage.C
fieldAverage/fieldAverageItem/fieldAverageItem.C
fieldAverage/fieldAverageItem/fieldAverageItemIO.C
fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.C
fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C
fieldCoordinateSystemTransform/fieldCoordinateSystemTransformFunctionObject.C
fieldMinMax/fieldMinMax.C
fieldMinMax/fieldMinMaxFunctionObject.C
fieldValues/fieldValue/fieldValue.C
fieldValues/fieldValue/fieldValueNew.C
fieldValues/fieldValueDelta/fieldValueDelta.C
fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C
fieldValues/faceSource/faceSource.C
fieldValues/faceSource/faceSourceFunctionObject.C
fieldValues/cellSource/cellSource.C
fieldValues/cellSource/cellSourceFunctionObject.C
fieldValues/faceSource/faceSource.C
nearWallFields/nearWallFields.C
nearWallFields/nearWallFieldsFunctionObject.C
nearWallFields/findCellParticle.C
nearWallFields/findCellParticleCloud.C
processorField/processorField.C
processorField/processorFieldFunctionObject.C
readFields/readFields.C
readFields/readFieldsFunctionObject.C
streamLine/streamLine.C
streamLine/streamLineParticle.C
streamLine/streamLineParticleCloud.C
streamLine/streamLineFunctionObject.C
wallBoundedStreamLine/wallBoundedStreamLine.C
wallBoundedStreamLine/wallBoundedStreamLineFunctionObject.C
wallBoundedStreamLine/wallBoundedStreamLineParticle.C
wallBoundedStreamLine/wallBoundedStreamLineParticleCloud.C
wallBoundedStreamLine/wallBoundedParticle.C
surfaceInterpolateFields/surfaceInterpolateFields.C
surfaceInterpolateFields/surfaceInterpolateFieldsFunctionObject.C
regionSizeDistribution/regionSizeDistribution.C
regionSizeDistribution/regionSizeDistributionFunctionObject.C
histogram/histogram.C
histogram/histogramFunctionObject.C
div/div.C
div/divFunctionObject.C
grad/grad.C
grad/gradFunctionObject.C
mag/mag.C
mag/magFunctionObject.C
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects

View File

@ -25,8 +25,7 @@ License
#include "div.H"
#include "volFields.H"
#include "dictionary.H"
#include "div.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -35,6 +34,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(div, 0);
addToRunTimeSelectionTable(functionObject, div, dictionary);
}
}
@ -82,17 +82,22 @@ Foam::volScalarField& Foam::functionObjects::div::divField
Foam::functionObjects::div::div
(
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)
)
),
fieldName_("undefined-fieldName"),
resultName_("undefined-resultName")
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -110,7 +115,7 @@ Foam::functionObjects::div::~div()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::div::read(const dictionary& dict)
bool Foam::functionObjects::div::read(const dictionary& dict)
{
dict.lookup("fieldName") >> fieldName_;
dict.lookup("resultName") >> resultName_;
@ -119,10 +124,12 @@ void Foam::functionObjects::div::read(const dictionary& dict)
{
resultName_ = "fvc::div(" + fieldName_ + ")";
}
return true;
}
void Foam::functionObjects::div::execute()
bool Foam::functionObjects::div::execute(const bool postProcess)
{
bool processed = false;
@ -134,31 +141,25 @@ void Foam::functionObjects::div::execute()
WarningInFunction
<< "Unprocessed field " << fieldName_ << endl;
}
return true;
}
void Foam::functionObjects::div::end()
{
execute();
}
void Foam::functionObjects::div::timeSet()
{}
void Foam::functionObjects::div::write()
bool Foam::functionObjects::div::write(const bool postProcess)
{
if (obr_.foundObject<regIOobject>(resultName_))
{
const regIOobject& field =
obr_.lookupObject<regIOobject>(resultName_);
Info<< type() << " " << name_ << " output:" << nl
Info<< type() << " " << name() << " output:" << nl
<< " writing field " << field.name() << nl << endl;
field.write();
}
return true;
}

View File

@ -29,8 +29,8 @@ Group
Description
This function object calculates the divergence of a field. The operation is
limited to surfaceScalarFields and volumeVector fields, and the output is a
volume scalar field.
limited to surfaceScalarFields and volVectorFields, and the output is a
volScalarField.
SourceFiles
div.C
@ -40,11 +40,8 @@ SourceFiles
#ifndef functionObjects_div_H
#define functionObjects_div_H
#include "functionObject.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.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;
class dimensionSet;
namespace functionObjects
@ -66,13 +60,12 @@ namespace functionObjects
\*---------------------------------------------------------------------------*/
class div
:
public functionObject
{
// Private data
//- Name of this div object
word name_;
//- Reference to the database
//- Reference to the objectRegistry
const objectRegistry& obr_;
//- Name of field to process
@ -115,14 +108,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
div
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -132,34 +123,14 @@ public:
// Member Functions
//- Return name of the set of div
virtual const word& name() const
{
return name_;
}
//- Read the div data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Calculate the divergence 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 div 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 divergence field
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "divFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(divFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
divFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::divFunctionObject
Description
FunctionObject wrapper around div to allow it to be created
via the functions entry within controlDict.
SourceFiles
divFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef divFunctionObject_H
#define divFunctionObject_H
#include "div.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::div>
divFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,8 +25,8 @@ License
#include "fieldAverage.H"
#include "volFields.H"
#include "Time.H"
#include "fieldAverageItem.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -35,6 +35,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(fieldAverage, 0);
addToRunTimeSelectionTable(functionObject, fieldAverage, dictionary);
}
}
@ -68,7 +69,7 @@ void Foam::functionObjects::fieldAverage::initialize()
{
resetFields();
Info<< type() << " " << name_ << ":" << nl;
Info<< type() << " " << name() << ":" << nl;
// Add mean fields to the field lists
forAll(faItems_, fieldi)
@ -136,7 +137,7 @@ void Foam::functionObjects::fieldAverage::calcAverages()
periodIndex_++;
}
Info<< type() << " " << name_ << " output:" << nl;
Info<< type() << " " << name() << " output:" << nl;
Info<< " Calculating averages" << nl;
@ -259,13 +260,18 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
Foam::functionObjects::fieldAverage::fieldAverage
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& t,
const dictionary& dict
)
:
name_(name),
obr_(obr),
functionObject(name),
obr_
(
t.lookupObject<objectRegistry>
(
dict.lookupOrDefault("region", polyMesh::defaultRegion)
)
),
prevTimeIndex_(-1),
restartOnRestart_(false),
restartOnOutput_(false),
@ -277,7 +283,7 @@ Foam::functionObjects::fieldAverage::fieldAverage
totalTime_(),
periodIndex_(1)
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -295,11 +301,11 @@ Foam::functionObjects::fieldAverage::~fieldAverage()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::fieldAverage::read(const dictionary& dict)
bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
{
initialised_ = false;
Info<< type() << " " << name_ << ":" << nl;
Info<< type() << " " << name() << ":" << nl;
dict.readIfPresent("restartOnRestart", restartOnRestart_);
dict.readIfPresent("restartOnOutput", restartOnOutput_);
@ -314,28 +320,21 @@ void Foam::functionObjects::fieldAverage::read(const dictionary& dict)
readAveragingProperties();
Info<< endl;
return true;
}
void Foam::functionObjects::fieldAverage::execute()
bool Foam::functionObjects::fieldAverage::execute(const bool postProcess)
{
calcAverages();
Info<< endl;
return true;
}
void Foam::functionObjects::fieldAverage::end()
{
calcAverages();
Info<< endl;
}
void Foam::functionObjects::fieldAverage::timeSet()
{}
void Foam::functionObjects::fieldAverage::write()
bool Foam::functionObjects::fieldAverage::write(const bool postProcess)
{
writeAverages();
writeAveragingProperties();
@ -346,15 +345,9 @@ void Foam::functionObjects::fieldAverage::write()
}
Info<< endl;
return true;
}
void Foam::functionObjects::fieldAverage::updateMesh(const mapPolyMesh&)
{}
void Foam::functionObjects::fieldAverage::movePoints(const polyMesh&)
{}
// ************************************************************************* //

View File

@ -110,7 +110,6 @@ Note
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
SourceFiles
fieldAverage.C
@ -122,7 +121,7 @@ SourceFiles
#ifndef functionObjects_fieldAverage_H
#define functionObjects_fieldAverage_H
#include "volFieldsFwd.H"
#include "functionObject.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -132,11 +131,6 @@ namespace Foam
// Forward declaration of classes
class objectRegistry;
class dictionary;
template<class Type>
class List;
class polyMesh;
class mapPolyMesh;
namespace functionObjects
{
@ -149,15 +143,14 @@ class fieldAverageItem;
\*---------------------------------------------------------------------------*/
class fieldAverage
:
public functionObject
{
protected:
// Protected data
//- Name of this set of field averages.
word name_;
//- Database this class is registered to
//- Reference to the objectRegistry
const objectRegistry& obr_;
//- Time at last call, prevents repeated averaging
@ -291,14 +284,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
fieldAverage
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& t,
const dictionary&
);
@ -308,32 +299,14 @@ public:
// Member Functions
//- Return name of the set of field averages
virtual const word& name() const
{
return name_;
}
//- Read the field average data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute the averaging
virtual void execute();
//- Calculate the field averages
virtual bool execute(const bool postProcess = false);
//- Execute the averaging 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 average data and write
virtual void write();
//- Update mesh
virtual void updateMesh(const mapPolyMesh&);
//- Move points
virtual void movePoints(const polyMesh&);
//- Write the field averages
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "fieldAverageFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(fieldAverageFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
fieldAverageFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::fieldAverageFunctionObject
Description
FunctionObject wrapper around fieldAverage to allow them to be created
via the functions entry within controlDict.
SourceFiles
fieldAverageFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef fieldAverageFunctionObject_H
#define fieldAverageFunctionObject_H
#include "fieldAverage.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::fieldAverage>
fieldAverageFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,6 +25,7 @@ License
#include "fieldCoordinateSystemTransform.H"
#include "dictionary.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -33,6 +34,13 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0);
addToRunTimeSelectionTable
(
functionObject,
fieldCoordinateSystemTransform,
dictionary
);
}
}
@ -43,17 +51,22 @@ Foam::functionObjects::fieldCoordinateSystemTransform::
fieldCoordinateSystemTransform
(
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_(),
coordSys_(obr, dict)
coordSys_(obr_, dict)
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -61,7 +74,7 @@ fieldCoordinateSystemTransform
read(dict);
Info<< type() << " " << name_ << ":" << nl
Info<< type() << " " << name << ":" << nl
<< " Applying transformation from global Cartesian to local "
<< coordSys_ << nl << endl;
}
@ -76,18 +89,23 @@ Foam::functionObjects::fieldCoordinateSystemTransform::
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::fieldCoordinateSystemTransform::read
bool Foam::functionObjects::fieldCoordinateSystemTransform::read
(
const dictionary& dict
)
{
dict.lookup("fields") >> fieldSet_;
return true;
}
void Foam::functionObjects::fieldCoordinateSystemTransform::execute()
bool Foam::functionObjects::fieldCoordinateSystemTransform::execute
(
const bool postProcess
)
{
Info<< type() << " " << name_ << " output:" << nl;
Info<< type() << " " << name() << " output:" << nl;
forAll(fieldSet_, fieldi)
{
@ -98,22 +116,17 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::execute()
transform<symmTensor>(fieldSet_[fieldi]);
transform<tensor>(fieldSet_[fieldi]);
}
return true;
}
void Foam::functionObjects::fieldCoordinateSystemTransform::end()
bool Foam::functionObjects::fieldCoordinateSystemTransform::write
(
const bool postProcess
)
{
execute();
}
void Foam::functionObjects::fieldCoordinateSystemTransform::timeSet()
{}
void Foam::functionObjects::fieldCoordinateSystemTransform::write()
{
Info<< type() << " " << name_ << " output:" << nl;
Info<< type() << " " << name() << " output:" << nl;
forAll(fieldSet_, fieldi)
{
@ -128,6 +141,8 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::write()
}
Info<< endl;
return true;
}

View File

@ -64,7 +64,6 @@ Description
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
Foam::coordinateSystem
SourceFiles
@ -76,9 +75,8 @@ SourceFiles
#ifndef functionObjects_fieldCoordinateSystemTransform_H
#define functionObjects_fieldCoordinateSystemTransform_H
#include "OFstream.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "functionObject.H"
#include "volFieldsFwd.H"
#include "coordinateSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -88,9 +86,6 @@ namespace Foam
// Forward declaration of classes
class objectRegistry;
class dictionary;
class polyMesh;
class mapPolyMesh;
namespace functionObjects
{
@ -100,14 +95,14 @@ namespace functionObjects
\*---------------------------------------------------------------------------*/
class fieldCoordinateSystemTransform
:
public functionObject
{
protected:
// Protected data
//- Name
word name_;
//- Reference to the objectRegistry
const objectRegistry& obr_;
//- Fields to transform
@ -145,14 +140,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
fieldCoordinateSystemTransform
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -162,34 +155,14 @@ public:
// Member Functions
//- Return name of the fieldCoordinateSystemTransform object
virtual const word& name() const
{
return name_;
}
//- Read the input 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
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);
};

View File

@ -1,45 +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 "fieldCoordinateSystemTransformFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug
(
fieldCoordinateSystemTransformFunctionObject, 0
);
addToRunTimeSelectionTable
(
functionObject,
fieldCoordinateSystemTransformFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -1,56 +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::fieldCoordinateSystemTransformFunctionObject
Description
FunctionObject wrapper around fieldCoordinateSystemTransform to allow
them to be created via the functions entry within controlDict.
SourceFiles
fieldCoordinateSystemTransformFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef fieldCoordinateSystemTransformFunctionObject_H
#define fieldCoordinateSystemTransformFunctionObject_H
#include "fieldCoordinateSystemTransform.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject
<
functionObjects::fieldCoordinateSystemTransform
> fieldCoordinateSystemTransformFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,6 +25,7 @@ License
#include "fieldMinMax.H"
#include "fieldTypes.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -33,6 +34,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(fieldMinMax, 0);
addToRunTimeSelectionTable(functionObject, fieldMinMax, dictionary);
}
}
@ -50,51 +52,7 @@ const Foam::NamedEnum
> Foam::functionObjects::fieldMinMax::modeTypeNames_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::fieldMinMax::fieldMinMax
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
)
:
functionObjectFiles(obr, name, typeName),
name_(name),
obr_(obr),
log_(true),
location_(true),
mode_(mdMag),
fieldSet_()
{
if (!isA<fvMesh>(obr))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
}
read(dict);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldMinMax::~fieldMinMax()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
{
log_ = dict.lookupOrDefault<Switch>("log", true);
location_ = dict.lookupOrDefault<Switch>("location", true);
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
dict.lookup("fields") >> fieldSet_;
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::functionObjects::fieldMinMax::writeFileHeader(const label i)
{
@ -136,24 +94,64 @@ void Foam::functionObjects::fieldMinMax::writeFileHeader(const label i)
}
void Foam::functionObjects::fieldMinMax::execute()
{}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
void Foam::functionObjects::fieldMinMax::end()
{}
void Foam::functionObjects::fieldMinMax::timeSet()
{}
void Foam::functionObjects::fieldMinMax::write()
Foam::functionObjects::fieldMinMax::fieldMinMax
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
writeFiles(name, runTime, dict, name),
location_(true),
mode_(mdMag),
fieldSet_()
{
functionObjectFiles::write();
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
}
read(dict);
resetName(typeName);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldMinMax::~fieldMinMax()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
{
writeFiles::read(dict);
location_ = dict.lookupOrDefault<Switch>("location", true);
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
dict.lookup("fields") >> fieldSet_;
return true;
}
bool Foam::functionObjects::fieldMinMax::execute(const bool postProcess)
{
return true;
}
bool Foam::functionObjects::fieldMinMax::write(const bool postProcess)
{
writeFiles::write();
if (!location_) writeTime(file());
if (log_) Info<< type() << " " << name_ << " output:" << nl;
if (log_) Info<< type() << " " << name() << " output:" << nl;
forAll(fieldSet_, fieldi)
{
@ -166,6 +164,8 @@ void Foam::functionObjects::fieldMinMax::write()
if (!location_) file()<< endl;
if (log_) Info<< endl;
return true;
}

View File

@ -67,7 +67,7 @@ Description
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
Foam::functionObjects::writeFiles
SourceFiles
fieldMinMax.C
@ -77,21 +77,13 @@ SourceFiles
#ifndef functionObjects_fieldMinMax_H
#define functionObjects_fieldMinMax_H
#include "functionObjectFiles.H"
#include "Switch.H"
#include "writeFiles.H"
#include "vector.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class polyMesh;
class mapPolyMesh;
namespace functionObjects
{
@ -101,7 +93,7 @@ namespace functionObjects
class fieldMinMax
:
public functionObjectFiles
public writeFiles
{
public:
@ -118,15 +110,6 @@ protected:
//- Mode type names
static const NamedEnum<modeType, 2> modeTypeNames_;
//- Name of this set of field min/max
// Also used as the name of the output directory
word name_;
const objectRegistry& obr_;
//- Switch to send output to Info as well
Switch log_;
//- Switch to write location of min/max values
Switch location_;
@ -159,6 +142,14 @@ protected:
//- Disallow default bitwise assignment
void operator=(const fieldMinMax&);
//- Calculate the field min/max
template<class Type>
void calcMinMaxFields
(
const word& fieldName,
const modeType& mode
);
//- Output file header information
virtual void writeFileHeader(const label i);
@ -171,14 +162,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
fieldMinMax
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -188,42 +177,14 @@ public:
// Member Functions
//- Return name of the set of field min/max
virtual const word& name() const
{
return name_;
}
//- Read the field min/max 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();
//- Calculate the field min/max
template<class Type>
void calcMinMaxFields
(
const word& fieldName,
const modeType& mode
);
virtual bool execute(const bool postProcess = false);
//- Write the fieldMinMax
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);
};

View File

@ -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 "fieldMinMaxFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(fieldMinMaxFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
fieldMinMaxFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::fieldMinMaxFunctionObject
Description
FunctionObject wrapper around fieldMinMax to allow them to be created via
the functions entry within controlDict.
SourceFiles
fieldMinMaxFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef fieldMinMaxFunctionObject_H
#define fieldMinMaxFunctionObject_H
#include "fieldMinMax.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::fieldMinMax>
fieldMinMaxFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -38,6 +38,7 @@ namespace fieldValues
{
defineTypeNameAndDebug(cellSource, 0);
addToRunTimeSelectionTable(fieldValue, cellSource, dictionary);
addToRunTimeSelectionTable(functionObject, cellSource, dictionary);
}
}
}
@ -149,14 +150,14 @@ void Foam::functionObjects::fieldValues::cellSource::initialise
if (nCells_ == 0)
{
FatalErrorInFunction
<< type() << " " << name_ << ": "
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Source has no cells" << exit(FatalError);
}
volume_ = volume();
Info<< type() << " " << name_ << ":"
Info<< type() << " " << name() << ":"
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " total cells = " << nCells_ << nl
<< " total volume = " << volume_
@ -205,12 +206,11 @@ void Foam::functionObjects::fieldValues::cellSource::writeFileHeader
Foam::functionObjects::fieldValues::cellSource::cellSource
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& runTime,
const dictionary& dict
)
:
fieldValue(name, obr, dict, typeName, loadFromFiles),
fieldValue(name, runTime, dict, typeName),
source_(sourceTypeNames_.read(dict.lookup("source"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
nCells_(0),
@ -218,7 +218,32 @@ Foam::functionObjects::fieldValues::cellSource::cellSource
weightFieldName_("none"),
writeVolume_(dict.lookupOrDefault("writeVolume", false))
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
}
read(dict);
}
Foam::functionObjects::fieldValues::cellSource::cellSource
(
const word& name,
const objectRegistry& obr,
const dictionary& dict
)
:
fieldValue(name, obr, dict, typeName),
source_(sourceTypeNames_.read(dict.lookup("source"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
nCells_(0),
cellId_(),
weightFieldName_("none"),
writeVolume_(dict.lookupOrDefault("writeVolume", false))
{
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -236,7 +261,7 @@ Foam::functionObjects::fieldValues::cellSource::~cellSource()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::cellSource::read
bool Foam::functionObjects::fieldValues::cellSource::read
(
const dictionary& dict
)
@ -245,10 +270,15 @@ void Foam::functionObjects::fieldValues::cellSource::read
// No additional info to read
initialise(dict);
return true;
}
void Foam::functionObjects::fieldValues::cellSource::write()
bool Foam::functionObjects::fieldValues::cellSource::write
(
const bool postProcess
)
{
fieldValue::write();
@ -293,6 +323,8 @@ void Foam::functionObjects::fieldValues::cellSource::write()
}
if (log_) Info<< endl;
return true;
}

View File

@ -95,7 +95,6 @@ Description
SeeAlso
Foam::fieldValues
Foam::functionObject
Foam::OutputFilterFunctionObject
SourceFiles
cellSource.C
@ -105,10 +104,8 @@ SourceFiles
#ifndef functionObjects_cellSource_H
#define functionObjects_cellSource_H
#include "NamedEnum.H"
#include "fieldValue.H"
#include "labelList.H"
#include "volFieldsFwd.H"
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -241,13 +238,20 @@ public:
// Constructors
//- Construct from components
//- Construct from name, Time and dictionary
cellSource
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Construct from name, objectRegistry and dictionary
cellSource
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles = false
const dictionary& dict
);
@ -257,30 +261,25 @@ public:
// Public Member Functions
// Access
//- Return the source type
inline const sourceType& source() const;
//- Return the source type
inline const sourceType& source() const;
//- Return the local list of cell IDs
inline const labelList& cellId() const;
//- Return the local list of cell IDs
inline const labelList& cellId() const;
//- Templated helper function to output field values
template<class Type>
bool writeValues(const word& fieldName);
//- Filter a field according to cellIds
template<class Type>
tmp<Field<Type>> filterField(const Field<Type>& field) const;
// Function object functions
//- Read from dictionary
virtual bool read(const dictionary&);
//- Read from dictionary
virtual void read(const dictionary&);
//- Calculate and write
virtual void write();
//- Templated helper function to output field values
template<class Type>
bool writeValues(const word& fieldName);
//- Filter a field according to cellIds
template<class Type>
tmp<Field<Type>> filterField(const Field<Type>& field) const;
//- Calculate and write
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "cellSourceFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug
(
cellSourceFunctionObject,
0
);
addToRunTimeSelectionTable
(
functionObject,
cellSourceFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -1,56 +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::cellSourceFunctionObject
Description
FunctionObject wrapper around cellSource to allow it to be
created via the functions entry within controlDict.
SourceFiles
cellSourceFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef cellSourceFunctionObject_H
#define cellSourceFunctionObject_H
#include "cellSource.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject
<
functionObjects::fieldValues::cellSource
> cellSourceFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -44,6 +44,7 @@ namespace fieldValues
{
defineTypeNameAndDebug(faceSource, 0);
addToRunTimeSelectionTable(fieldValue, faceSource, dictionary);
addToRunTimeSelectionTable(functionObject, faceSource, dictionary);
}
}
}
@ -106,7 +107,7 @@ void Foam::functionObjects::fieldValues::faceSource::setFaceZoneFaces()
if (zoneId < 0)
{
FatalErrorInFunction
<< type() << " " << name_ << ": "
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Unknown face zone name: " << sourceName_
<< ". Valid face zones are: " << mesh().faceZones().names()
@ -191,7 +192,7 @@ void Foam::functionObjects::fieldValues::faceSource::setPatchFaces()
if (patchid < 0)
{
FatalErrorInFunction
<< type() << " " << name_ << ": "
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Unknown patch name: " << sourceName_
<< ". Valid patch names are: "
@ -228,7 +229,7 @@ void Foam::functionObjects::fieldValues::faceSource::sampledSurfaceFaces
{
surfacePtr_ = sampledSurface::New
(
name_,
name(),
mesh(),
dict.subDict("sampledSurfaceDict")
);
@ -443,7 +444,7 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
default:
{
FatalErrorInFunction
<< type() << " " << name_ << ": "
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
<< nl << " Unknown source type. Valid source types are:"
<< sourceTypeNames_.sortedToc() << nl << exit(FatalError);
@ -453,7 +454,7 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
if (nFaces_ == 0)
{
FatalErrorInFunction
<< type() << " " << name_ << ": "
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
<< " Source has no faces" << exit(FatalError);
}
@ -465,7 +466,7 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
totalArea_ = totalArea();
Info<< type() << " " << name_ << ":" << nl
Info<< type() << " " << name() << ":" << nl
<< " total faces = " << nFaces_
<< nl
<< " total area = " << totalArea_
@ -641,12 +642,11 @@ Foam::vector Foam::functionObjects::fieldValues::faceSource::processValues
Foam::functionObjects::fieldValues::faceSource::faceSource
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& runTime,
const dictionary& dict
)
:
fieldValue(name, obr, dict, typeName, loadFromFiles),
fieldValue(name, runTime, dict, typeName),
surfaceWriterPtr_(NULL),
source_(sourceTypeNames_.read(dict.lookup("source"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
@ -660,7 +660,37 @@ Foam::functionObjects::fieldValues::faceSource::faceSource
facePatchId_(),
faceSign_()
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
}
read(dict);
}
Foam::functionObjects::fieldValues::faceSource::faceSource
(
const word& name,
const objectRegistry& obr,
const dictionary& dict
)
:
fieldValue(name, obr, dict, typeName),
surfaceWriterPtr_(NULL),
source_(sourceTypeNames_.read(dict.lookup("source"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
weightFieldName_("none"),
orientWeightField_(false),
orientedFieldsStart_(labelMax),
scaleFactor_(1.0),
writeArea_(dict.lookupOrDefault("writeArea", false)),
nFaces_(0),
faceId_(),
facePatchId_(),
faceSign_()
{
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -678,17 +708,22 @@ Foam::functionObjects::fieldValues::faceSource::~faceSource()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::faceSource::read
bool Foam::functionObjects::fieldValues::faceSource::read
(
const dictionary& dict
)
{
fieldValue::read(dict);
initialise(dict);
return true;
}
void Foam::functionObjects::fieldValues::faceSource::write()
bool Foam::functionObjects::fieldValues::faceSource::write
(
const bool postProcess
)
{
fieldValue::write();
@ -757,6 +792,8 @@ void Foam::functionObjects::fieldValues::faceSource::write()
}
if (log_) Info<< endl;
return true;
}

View File

@ -128,7 +128,6 @@ Note
SeeAlso
Foam::fieldValues
Foam::functionObject
Foam::OutputFilterFunctionObject
SourceFiles
faceSource.C
@ -139,11 +138,8 @@ SourceFiles
#ifndef functionObjects_faceSource_H
#define functionObjects_faceSource_H
#include "NamedEnum.H"
#include "fieldValue.H"
#include "surfaceFieldsFwd.H"
#include "volFieldsFwd.H"
#include "surfaceWriter.H"
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -151,6 +147,7 @@ namespace Foam
{
class sampledSurface;
class surfaceWriter;
namespace functionObjects
{
@ -341,13 +338,20 @@ public:
// Constructors
//- Construct from components
//- Construct from name, Time and dictionary
faceSource
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Construct from name, objectRegistry and dictionary
faceSource
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles = false
const dictionary& dict
);
@ -357,57 +361,52 @@ public:
// Public Member Functions
// Access
//- Return the source type
inline const sourceType& source() const;
//- Return the source type
inline const sourceType& source() const;
//- Return the local list of face IDs
inline const labelList& faceId() const;
//- Return the local list of face IDs
inline const labelList& faceId() const;
//- Return the local list of patch ID per face
inline const labelList& facePatch() const;
//- Return the local list of patch ID per face
inline const labelList& facePatch() const;
//- Return the list of +1/-1 representing face flip map
inline const labelList& faceSign() const;
//- Return the list of +1/-1 representing face flip map
inline const labelList& faceSign() const;
//- Templated helper function to output field values
template<class Type>
bool writeValues
(
const word& fieldName,
const scalarField& weightField,
const bool orient
);
//- Filter a surface field according to faceIds
template<class Type>
tmp<Field<Type>> filterField
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
const bool applyOrientation
) const;
// Function object functions
//- Filter a volume field according to faceIds
template<class Type>
tmp<Field<Type>> filterField
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const bool applyOrientation
) const;
//- Read from dictionary
virtual void read(const dictionary&);
//- Read from dictionary
virtual bool read(const dictionary&);
//- Calculate and write
virtual void write();
//- Templated helper function to output field values
template<class Type>
bool writeValues
(
const word& fieldName,
const scalarField& weightField,
const bool orient
);
//- Filter a surface field according to faceIds
template<class Type>
tmp<Field<Type>> filterField
(
const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
const bool applyOrientation
) const;
//- Filter a volume field according to faceIds
template<class Type>
tmp<Field<Type>> filterField
(
const GeometricField<Type, fvPatchField, volMesh>& field,
const bool applyOrientation
) const;
//- Calculate and write
virtual bool write(const bool postProcess = false);
};
//- Specialisation of processing scalars
//- Specialisation for scalar
template<>
scalar faceSource::processValues
(
@ -417,7 +416,7 @@ scalar faceSource::processValues
) const;
//- Specialisation of processing vectors
//- Specialisation for vector
template<>
vector faceSource::processValues
(

View File

@ -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 "faceSourceFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug
(
faceSourceFunctionObject,
0
);
addToRunTimeSelectionTable
(
functionObject,
faceSourceFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -1,56 +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::faceSourceFunctionObject
Description
FunctionObject wrapper around faceSource to allow it to be
created via the functions entry within controlDict.
SourceFiles
faceSourceFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef faceSourceFunctionObject_H
#define faceSourceFunctionObject_H
#include "faceSource.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject
<
functionObjects::fieldValues::faceSource
> faceSourceFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -27,6 +27,7 @@ License
#include "surfaceFields.H"
#include "volFields.H"
#include "sampledSurface.H"
#include "surfaceWriter.H"
#include "interpolationCellPoint.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -315,7 +316,7 @@ bool Foam::functionObjects::fieldValues::faceSource::writeValues
if (Pstream::master())
{
fileName outputDir =
baseFileDir()/name_/"surface"/obr_.time().timeName();
baseFileDir()/name()/"surface"/obr_.time().timeName();
surfaceWriterPtr_->write
(
@ -375,7 +376,7 @@ Foam::functionObjects::fieldValues::faceSource::filterField
else
{
FatalErrorInFunction
<< type() << " " << name_ << ": "
<< type() << " " << name() << ": "
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
<< nl
<< " Unable to process internal faces for volume field "

View File

@ -24,90 +24,96 @@ License
\*---------------------------------------------------------------------------*/
#include "fieldValue.H"
#include "fvMesh.H"
#include "Time.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(fieldValue, 0);
defineRunTimeSelectionTable(fieldValue, dictionary);
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
void Foam::fieldValue::read(const dictionary& dict)
{
dict_ = dict;
log_ = dict.lookupOrDefault<Switch>("log", true);
dict.lookup("fields") >> fields_;
dict.lookup("valueOutput") >> valueOutput_;
}
void Foam::fieldValue::write()
{
functionObjectFiles::write();
if (log_) Info<< type() << " " << name_ << " output:" << nl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fieldValue::fieldValue
Foam::functionObjects::fieldValue::fieldValue
(
const word& name,
const objectRegistry& obr,
const Time& runTime,
const dictionary& dict,
const word& valueType,
const bool loadFromFiles
const word& valueType
)
:
functionObjectFiles(obr, name, valueType),
name_(name),
obr_(obr),
writeFiles(name, runTime, dict, name),
dict_(dict),
log_(true),
sourceName_(word::null),
fields_(dict.lookup("fields")),
valueOutput_(dict.lookup("valueOutput")),
resultDict_(fileName("name"), dictionary::null)
{
read(dict);
resetName(valueType);
}
Foam::functionObjects::fieldValue::fieldValue
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const word& valueType
)
:
writeFiles(name, obr, dict, name),
dict_(dict),
sourceName_(word::null),
fields_(dict.lookup("fields")),
valueOutput_(dict.lookup("valueOutput")),
resultDict_(fileName("name"), dictionary::null)
{
read(dict);
resetName(valueType);
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::fieldValue::~fieldValue()
Foam::functionObjects::fieldValue::~fieldValue()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::fieldValue::execute()
{}
bool Foam::functionObjects::fieldValue::read(const dictionary& dict)
{
dict_ = dict;
writeFiles::read(dict);
dict.lookup("fields") >> fields_;
dict.lookup("valueOutput") >> valueOutput_;
return true;
}
void Foam::fieldValue::end()
{}
bool Foam::functionObjects::fieldValue::execute(const bool postProcess)
{
return true;
}
void Foam::fieldValue::timeSet()
{}
bool Foam::functionObjects::fieldValue::write(const bool postProcess)
{
writeFiles::write();
if (log_) Info<< type() << " " << name() << " output:" << nl;
void Foam::fieldValue::updateMesh(const mapPolyMesh&)
{}
void Foam::fieldValue::movePoints(const polyMesh&)
{}
return true;
}
// ************************************************************************* //

View File

@ -38,12 +38,9 @@ SourceFiles
#ifndef functionObjects_fieldValue_H
#define functionObjects_fieldValue_H
#include "functionObjectFiles.H"
#include "writeFiles.H"
#include "Switch.H"
#include "OFstream.H"
#include "dictionary.H"
#include "Field.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -51,10 +48,10 @@ namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class fvMesh;
class polyMesh;
class mapPolyMesh;
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class fieldValue Declaration
@ -62,25 +59,16 @@ class mapPolyMesh;
class fieldValue
:
public functionObjectFiles
public writeFiles
{
protected:
// Protected data
//- Name of this fieldValue object
word name_;
//- Database this class is registered to
const objectRegistry& obr_;
//- Construction dictionary
dictionary dict_;
//- Switch to send output to Info as well as to file
Switch log_;
//- Name of source object
word sourceName_;
@ -94,6 +82,17 @@ protected:
dictionary resultDict_;
// Protected Member Functions
//- Combine fields from all processor domains into single field
template<class Type>
void combineFields(Field<Type>& field);
//- Combine fields from all processor domains into single field
template<class Type>
void combineFields(tmp<Field<Type>>&);
public:
//- Run-time type information
@ -109,103 +108,80 @@ public:
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const dictionary& dict
),
(name, obr, dict, loadFromFiles)
(name, obr, dict)
);
//- Construct from components
fieldValue
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const word& valueType,
const bool loadFromFiles = false
);
//- Return a reference to the selected fieldValue
static autoPtr<fieldValue> New
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles = false,
const bool output = true
);
// Constructors
//- Construct from Time and dictionary
fieldValue
(
const word& name,
const Time& runTime,
const dictionary& dict,
const word& valueType
);
//- Construct from objectRegistry and dictionary
fieldValue
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const word& valueType
);
//- Return a reference to the selected fieldValue
static autoPtr<fieldValue> New
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool output = true
);
//- Destructor
virtual ~fieldValue();
// Public Member Functions
// Member Functions
// Access
//- Return the reference to the construction dictionary
inline const dictionary& dict() const;
//- Return the name of the geometric source
inline const word& name() const;
//- Return the source name
inline const word& sourceName() const;
//- Return the reference to the object registry
inline const objectRegistry& obr() const;
//- Return the list of field names
inline const wordList& fields() const;
//- Return the reference to the construction dictionary
inline const dictionary& dict() const;
//- Return the output field values flag
inline const Switch& valueOutput() const;
//- Return the switch to send output to Info as well as to file
inline const Switch& log() const;
//- Helper function to return the reference to the mesh
inline const fvMesh& mesh() const;
//- Return the source name
inline const word& sourceName() const;
//- Return access to the latest set of results
inline const dictionary& resultDict() const;
//- Return the list of field names
inline const wordList& fields() const;
//- Read from dictionary
virtual bool read(const dictionary& dict);
//- Return the output field values flag
inline const Switch& valueOutput() const;
//- Execute
virtual bool execute(const bool postProcess = false);
//- Helper function to return the reference to the mesh
inline const fvMesh& mesh() const;
//- Return access to the latest set of results
inline const dictionary& resultDict() const;
// Function object functions
//- Read from dictionary
virtual void read(const dictionary& dict);
//- Write to screen/file
virtual void write();
//- Execute
virtual void execute();
//- Execute the 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();
//- Update mesh
virtual void updateMesh(const mapPolyMesh&);
//- Move points
virtual void movePoints(const polyMesh&);
//- Combine fields from all processor domains into single field
template<class Type>
void combineFields(Field<Type>& field);
//- Combine fields from all processor domains into single field
template<class Type>
void combineFields(tmp<Field<Type>>&);
//- Write to screen/file
virtual bool write(const bool postProcess = false);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,55 +28,39 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::word& Foam::fieldValue::name() const
{
return name_;
}
inline const Foam::objectRegistry& Foam::fieldValue::obr() const
{
return obr_;
}
inline const Foam::dictionary& Foam::fieldValue::dict() const
inline const Foam::dictionary& Foam::functionObjects::fieldValue::dict() const
{
return dict_;
}
inline const Foam::Switch& Foam::fieldValue::log() const
{
return log_;
}
inline const Foam::word& Foam::fieldValue::sourceName() const
inline const Foam::word& Foam::functionObjects::fieldValue::sourceName() const
{
return sourceName_;
}
inline const Foam::wordList& Foam::fieldValue::fields() const
inline const Foam::wordList& Foam::functionObjects::fieldValue::fields() const
{
return fields_;
}
inline const Foam::Switch& Foam::fieldValue::valueOutput() const
inline const Foam::Switch&
Foam::functionObjects::fieldValue::valueOutput() const
{
return valueOutput_;
}
inline const Foam::fvMesh& Foam::fieldValue::mesh() const
inline const Foam::fvMesh& Foam::functionObjects::fieldValue::mesh() const
{
return refCast<const fvMesh>(obr_);
}
inline const Foam::dictionary& Foam::fieldValue::resultDict() const
inline const Foam::dictionary&
Foam::functionObjects::fieldValue::resultDict() const
{
return resultDict_;
}

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -27,12 +27,12 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::autoPtr<Foam::fieldValue> Foam::fieldValue::New
Foam::autoPtr<Foam::functionObjects::fieldValue>
Foam::functionObjects::fieldValue::New
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles,
const bool output
)
{
@ -56,16 +56,7 @@ Foam::autoPtr<Foam::fieldValue> Foam::fieldValue::New
<< exit(FatalError);
}
return autoPtr<fieldValue>
(
cstrIter()
(
name,
obr,
dict,
loadFromFiles
)
);
return autoPtr<fieldValue>(cstrIter()(name, obr, dict));
}

View File

@ -30,7 +30,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::fieldValue::combineFields(Field<Type>& field)
void Foam::functionObjects::fieldValue::combineFields(Field<Type>& field)
{
List<Field<Type>> allValues(Pstream::nProcs());
@ -51,7 +51,7 @@ void Foam::fieldValue::combineFields(Field<Type>& field)
template<class Type>
void Foam::fieldValue::combineFields(tmp<Field<Type>>& field)
void Foam::functionObjects::fieldValue::combineFields(tmp<Field<Type>>& field)
{
combineFields(field());
}

View File

@ -24,10 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "fieldValueDelta.H"
#include "ListOps.H"
#include "Time.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -38,6 +35,7 @@ namespace functionObjects
namespace fieldValues
{
defineTypeNameAndDebug(fieldValueDelta, 0);
addToRunTimeSelectionTable(functionObject, fieldValueDelta, dictionary);
}
}
}
@ -104,27 +102,23 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::writeFileHeader
Foam::functionObjects::fieldValues::fieldValueDelta::fieldValueDelta
(
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),
loadFromFiles_(loadFromFiles),
log_(true),
writeFiles(name, runTime, dict, name),
operation_(opSubtract),
source1Ptr_(NULL),
source2Ptr_(NULL)
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
}
read(dict);
resetName(typeName);
}
@ -136,20 +130,20 @@ Foam::functionObjects::fieldValues::fieldValueDelta::~fieldValueDelta()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::fieldValues::fieldValueDelta::read
bool Foam::functionObjects::fieldValues::fieldValueDelta::read
(
const dictionary& dict
)
{
log_ = dict.lookupOrDefault<Switch>("log", true);
writeFiles::read(dict);
source1Ptr_.reset
(
fieldValue::New
(
name_ + ".source1",
name() + ".source1",
obr_,
dict.subDict("source1"),
loadFromFiles_,
false
).ptr()
);
@ -157,21 +151,25 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::read
(
fieldValue::New
(
name_ + ".source2",
name() + ".source2",
obr_,
dict.subDict("source2"),
loadFromFiles_,
false
).ptr()
);
operation_ = operationTypeNames_.read(dict.lookup("operation"));
return true;
}
void Foam::functionObjects::fieldValues::fieldValueDelta::write()
bool Foam::functionObjects::fieldValues::fieldValueDelta::write
(
const bool postProcess
)
{
functionObjectFiles::write();
writeFiles::write();
source1Ptr_->write();
source2Ptr_->write();
@ -181,7 +179,7 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::write()
writeTime(file());
}
if (log_) Info<< type() << " " << name_ << " output:" << endl;
if (log_) Info<< type() << " " << name() << " output:" << endl;
bool found = false;
processFields<scalar>(found);
@ -206,33 +204,18 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::write()
Info<< endl;
}
}
return true;
}
void Foam::functionObjects::fieldValues::fieldValueDelta::execute()
{}
void Foam::functionObjects::fieldValues::fieldValueDelta::end()
{}
void Foam::functionObjects::fieldValues::fieldValueDelta::timeSet()
{}
void Foam::functionObjects::fieldValues::fieldValueDelta::updateMesh
bool Foam::functionObjects::fieldValues::fieldValueDelta::execute
(
const mapPolyMesh&
const bool postProcess
)
{}
void Foam::functionObjects::fieldValues::fieldValueDelta::movePoints
(
const polyMesh&
)
{}
{
return true;
}
// ************************************************************************* //

View File

@ -76,9 +76,8 @@ SourceFiles
#ifndef functionObjects_fieldValueDelta_H
#define functionObjects_fieldValueDelta_H
#include "functionObjectFiles.H"
#include "writeFiles.H"
#include "fieldValue.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -95,7 +94,7 @@ namespace fieldValues
class fieldValueDelta
:
public functionObjectFiles
public writeFiles
{
public:
//- Operation type enumeration
@ -116,18 +115,6 @@ private:
// Private data
//- Name of this fieldValue object
word name_;
//- Database this class is registered to
const objectRegistry& obr_;
//- Flag to indicate to load from files
bool loadFromFiles_;
//- Switch to send output to Info as well as to file
Switch log_;
//- Operation to apply to values
operationType operation_;
@ -151,7 +138,7 @@ private:
protected:
// Functions to be over-ridden from IOoutputFilter class
// Protected Member Functions
//- Output file header information
virtual void writeFileHeader(const label i);
@ -165,13 +152,12 @@ public:
// Constructors
//- Construct from components
//- Construct from Time and dictionary
fieldValueDelta
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -181,28 +167,14 @@ public:
// Public Member Functions
// Function object functions
//- Read from dictionary
virtual bool read(const dictionary&);
//- Read from dictionary
virtual void read(const dictionary&);
//- Do nothing
virtual bool execute(const bool postProcess = false);
//- Calculate and write
virtual void write();
//- Execute
virtual void execute();
//- Execute the 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();
//- Update mesh
virtual void updateMesh(const mapPolyMesh&);
//- Move points
virtual void movePoints(const polyMesh&);
//- Calculate and write
virtual bool write(const bool postProcess = false);
};

View File

@ -1,46 +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 "fieldValueDeltaFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug
(
fieldValueDeltaFunctionObject,
0
);
addToRunTimeSelectionTable
(
functionObject,
fieldValueDeltaFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -1,56 +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::fieldValueDeltaFunctionObject
Description
FunctionObject wrapper around fieldValueDelta to allow it to be
created via the functions entry within controlDict.
SourceFiles
fieldValueDeltaFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef fieldValueDeltaFunctionObject_H
#define fieldValueDeltaFunctionObject_H
#include "fieldValueDelta.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject
<
functionObjects::fieldValues::fieldValueDelta
> fieldValueDeltaFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,8 +25,7 @@ License
#include "grad.H"
#include "volFields.H"
#include "dictionary.H"
#include "grad.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -35,6 +34,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(grad, 0);
addToRunTimeSelectionTable(functionObject, grad, dictionary);
}
}
@ -44,17 +44,22 @@ namespace functionObjects
Foam::functionObjects::grad::grad
(
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)
)
),
fieldName_("undefined-fieldName"),
resultName_("undefined-resultName")
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -72,7 +77,7 @@ Foam::functionObjects::grad::~grad()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::grad::read(const dictionary& dict)
bool Foam::functionObjects::grad::read(const dictionary& dict)
{
dict.lookup("fieldName") >> fieldName_;
dict.lookup("resultName") >> resultName_;
@ -81,10 +86,12 @@ void Foam::functionObjects::grad::read(const dictionary& dict)
{
resultName_ = "fvc::grad(" + fieldName_ + ")";
}
return true;
}
void Foam::functionObjects::grad::execute()
bool Foam::functionObjects::grad::execute(const bool postProcess)
{
bool processed = false;
@ -96,31 +103,25 @@ void Foam::functionObjects::grad::execute()
WarningInFunction
<< "Unprocessed field " << fieldName_ << endl;
}
return true;
}
void Foam::functionObjects::grad::end()
{
execute();
}
void Foam::functionObjects::grad::timeSet()
{}
void Foam::functionObjects::grad::write()
bool Foam::functionObjects::grad::write(const bool postProcess)
{
if (obr_.foundObject<regIOobject>(resultName_))
{
const regIOobject& field =
obr_.lookupObject<regIOobject>(resultName_);
Info<< type() << " " << name_ << " output:" << nl
Info<< type() << " " << name() << " output:" << nl
<< " writing field " << field.name() << nl << endl;
field.write();
}
return true;
}

View File

@ -40,11 +40,8 @@ SourceFiles
#ifndef functionObjects_grad_H
#define functionObjects_grad_H
#include "functionObject.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.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;
class dimensionSet;
namespace functionObjects
@ -66,13 +60,12 @@ namespace functionObjects
\*---------------------------------------------------------------------------*/
class grad
:
public functionObject
{
// Private data
//- Name of this grad object
word name_;
//- Reference to the database
//- Reference to the objectRegistry
const objectRegistry& obr_;
//- Name of field to process
@ -118,14 +111,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
grad
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -135,34 +126,14 @@ public:
// Member Functions
//- Return name of the set of grad
virtual const word& name() const
{
return name_;
}
//- Read the grad data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Calculate the gradient 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 grad 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 gradient field
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "gradFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(gradFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
gradFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::gradFunctionObject
Description
FunctionObject wrapper around grad to allow it to be created
via the functions entry within controlDict.
SourceFiles
gradFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef gradFunctionObject_H
#define gradFunctionObject_H
#include "grad.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::grad>
gradFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,6 +25,7 @@ License
#include "histogram.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -33,6 +34,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(histogram, 0);
addToRunTimeSelectionTable(functionObject, histogram, dictionary);
}
}
@ -69,15 +71,13 @@ void Foam::functionObjects::histogram::writeGraph
Foam::functionObjects::histogram::histogram
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& runTime,
const dictionary& dict
)
:
functionObjectFile(obr, typeName),
name_(name)
writeFile(name, runTime, dict, name)
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -95,7 +95,7 @@ Foam::functionObjects::histogram::~histogram()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::histogram::read(const dictionary& dict)
bool Foam::functionObjects::histogram::read(const dictionary& dict)
{
dict.lookup("field") >> fieldName_;
dict.lookup("max") >> max_;
@ -104,24 +104,20 @@ void Foam::functionObjects::histogram::read(const dictionary& dict)
word format(dict.lookup("setFormat"));
formatterPtr_ = writer<scalar>::New(format);
return true;
}
void Foam::functionObjects::histogram::execute()
{}
void Foam::functionObjects::histogram::end()
{}
void Foam::functionObjects::histogram::timeSet()
{}
void Foam::functionObjects::histogram::write()
bool Foam::functionObjects::histogram::execute(const bool postProcess)
{
Info<< type() << " " << name_ << " output:" << nl;
return true;
}
bool Foam::functionObjects::histogram::write(const bool postProcess)
{
Info<< type() << " " << name() << " output:" << nl;
const fvMesh& mesh = refCast<const fvMesh>(obr_);
@ -201,6 +197,8 @@ void Foam::functionObjects::histogram::write()
writeGraph(coords, field.name(), volFrac);
}
}
return true;
}

View File

@ -59,7 +59,7 @@ Description
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
Foam::functionObjects::writeFile
SourceFiles
histogram.C
@ -70,19 +70,12 @@ SourceFiles
#define functionObjects_histogram_H
#include "writer.H"
#include "volFieldsFwd.H"
#include "functionObjectFile.H"
#include "writeFile.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class mapPolyMesh;
class polyMesh;
namespace functionObjects
{
@ -92,13 +85,10 @@ namespace functionObjects
class histogram
:
public functionObjectFile
public writeFile
{
// Private data
//- Name of this histogram
word name_;
//- Name of field
word fieldName_;
@ -139,52 +129,31 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
histogram
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
// Destructor
virtual ~histogram();
virtual ~histogram();
// Member Functions
//- Return name of the set of histogram
virtual const word& name() const
{
return name_;
}
//- Read the histogram data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
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 histogram 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 the histogram and write.
// postProcess overrides the usual writeControl behaviour and
// forces writing always (used in post-processing mode)
virtual bool write(const bool postProcess = false);
};

View File

@ -1,46 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 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 "histogramFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug
(
histogramFunctionObject,
0
);
addToRunTimeSelectionTable
(
functionObject,
histogramFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -1,54 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 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::histogramFunctionObject
Description
FunctionObject wrapper around histogram to allow it to be
created via the functions list within controlDict.
SourceFiles
histogramFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef histogramFunctionObject_H
#define histogramFunctionObject_H
#include "histogram.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::histogram>
histogramFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,8 +25,7 @@ License
#include "mag.H"
#include "volFields.H"
#include "dictionary.H"
#include "mag.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -35,6 +34,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(mag, 0);
addToRunTimeSelectionTable(functionObject, mag, dictionary);
}
}
@ -44,17 +44,22 @@ namespace functionObjects
Foam::functionObjects::mag::mag
(
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)
)
),
fieldName_("undefined-fieldName"),
resultName_("undefined-resultName")
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -72,7 +77,7 @@ Foam::functionObjects::mag::~mag()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::mag::read(const dictionary& dict)
bool Foam::functionObjects::mag::read(const dictionary& dict)
{
dict.lookup("fieldName") >> fieldName_;
dict.lookup("resultName") >> resultName_;
@ -81,10 +86,12 @@ void Foam::functionObjects::mag::read(const dictionary& dict)
{
resultName_ = "mag(" + fieldName_ + ")";
}
return true;
}
void Foam::functionObjects::mag::execute()
bool Foam::functionObjects::mag::execute(const bool postProcess)
{
bool processed = false;
@ -99,31 +106,25 @@ void Foam::functionObjects::mag::execute()
WarningInFunction
<< "Unprocessed field " << fieldName_ << endl;
}
return true;
}
void Foam::functionObjects::mag::end()
{
execute();
}
void Foam::functionObjects::mag::timeSet()
{}
void Foam::functionObjects::mag::write()
bool Foam::functionObjects::mag::write(const bool postProcess)
{
if (obr_.foundObject<regIOobject>(resultName_))
{
const regIOobject& field =
obr_.lookupObject<regIOobject>(resultName_);
Info<< type() << " " << name_ << " output:" << nl
Info<< type() << " " << name() << " output:" << nl
<< " writing field " << field.name() << nl << endl;
field.write();
}
return true;
}

View File

@ -40,11 +40,8 @@ SourceFiles
#ifndef functionObjects_mag_H
#define functionObjects_mag_H
#include "functionObject.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
#include "pointFieldFwd.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;
class dimensionSet;
namespace functionObjects
@ -66,13 +60,12 @@ namespace functionObjects
\*---------------------------------------------------------------------------*/
class mag
:
public functionObject
{
// Private data
//- Name of this mag object
word name_;
//- Reference to the database
//- Reference to the objectRegistry
const objectRegistry& obr_;
//- Name of field to process
@ -112,14 +105,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
mag
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -129,34 +120,14 @@ public:
// Member Functions
//- Return name of the set of mag
virtual const word& name() const
{
return name_;
}
//- Read the mag data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Calculate the magnitude 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 mag 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 magnitude field
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "magFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(magFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
magFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::magFunctionObject
Description
FunctionObject wrapper around mag to allow it to be created
via the functions entry within controlDict.
SourceFiles
magFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef magFunctionObject_H
#define magFunctionObject_H
#include "mag.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::mag>
magFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -28,6 +28,7 @@ License
#include "findCellParticle.H"
#include "mappedPatchBase.H"
#include "OBJstream.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -36,6 +37,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(nearWallFields, 0);
addToRunTimeSelectionTable(functionObject, nearWallFields, dictionary);
}
}
@ -224,16 +226,21 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
Foam::functionObjects::nearWallFields::nearWallFields
(
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);
@ -256,7 +263,7 @@ Foam::functionObjects::nearWallFields::~nearWallFields()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::nearWallFields::read(const dictionary& dict)
bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
{
if (debug)
{
@ -295,15 +302,17 @@ void Foam::functionObjects::nearWallFields::read(const dictionary& dict)
reverseFieldMap_.insert(sampleFldName, fldName);
}
Info<< type() << " " << name_ << ": Sampling " << fieldMap_.size()
Info<< type() << " " << name() << ": Sampling " << fieldMap_.size()
<< " fields" << endl;
// Do analysis
calcAddressing();
return true;
}
void Foam::functionObjects::nearWallFields::execute()
bool Foam::functionObjects::nearWallFields::execute(const bool postProcess)
{
if (debug)
{
@ -320,7 +329,7 @@ void Foam::functionObjects::nearWallFields::execute()
&& vtf_.empty()
)
{
Info<< type() << " " << name_ << ": Creating " << fieldMap_.size()
Info<< type() << " " << name() << ": Creating " << fieldMap_.size()
<< " fields" << endl;
createFields(vsf_);
@ -332,7 +341,7 @@ void Foam::functionObjects::nearWallFields::execute()
Info<< endl;
}
Info<< type() << " " << name_ << " output:" << nl;
Info<< type() << " " << name() << " output:" << nl;
Info<< " Sampling fields to " << obr_.time().timeName()
<< endl;
@ -342,25 +351,12 @@ void Foam::functionObjects::nearWallFields::execute()
sampleFields(vSpheretf_);
sampleFields(vSymmtf_);
sampleFields(vtf_);
return true;
}
void Foam::functionObjects::nearWallFields::end()
{
if (debug)
{
InfoInFunction << endl;
}
execute();
}
void Foam::functionObjects::nearWallFields::timeSet()
{}
void Foam::functionObjects::nearWallFields::write()
bool Foam::functionObjects::nearWallFields::write(const bool postProcess)
{
if (debug)
{
@ -392,6 +388,8 @@ void Foam::functionObjects::nearWallFields::write()
}
Info<< endl;
return true;
}

View File

@ -62,7 +62,6 @@ Description
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
SourceFiles
nearWallFields.C
@ -72,7 +71,7 @@ SourceFiles
#ifndef functionObjects_nearWallFields_H
#define functionObjects_nearWallFields_H
#include "OFstream.H"
#include "functionObject.H"
#include "volFields.H"
#include "Tuple2.H"
#include "interpolationCellPoint.H"
@ -84,8 +83,6 @@ namespace Foam
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
namespace functionObjects
{
@ -95,14 +92,14 @@ namespace functionObjects
\*---------------------------------------------------------------------------*/
class nearWallFields
:
public functionObject
{
protected:
// Protected data
//- Name of this set of nearWallFields object
word name_;
//- Reference to the objectRegistry
const objectRegistry& obr_;
// Read from dictionary
@ -191,9 +188,8 @@ public:
nearWallFields
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -203,34 +199,14 @@ public:
// Member Functions
//- Return name of the nearWallFields 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 the near-wall 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&)
{}
//- Write the near-wall fields
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "nearWallFieldsFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug
(
nearWallFieldsFunctionObject,
0
);
addToRunTimeSelectionTable
(
functionObject,
nearWallFieldsFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::nearWallFieldsFunctionObject
Description
FunctionObject wrapper around nearWallFields to allow
them to be created via the functions entry within controlDict.
SourceFiles
nearWallFieldsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef nearWallFieldsFunctionObject_H
#define nearWallFieldsFunctionObject_H
#include "nearWallFields.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::nearWallFields>
nearWallFieldsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,8 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "processorField.H"
#include "dictionary.H"
#include "Pstream.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -34,6 +34,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(processorField, 0);
addToRunTimeSelectionTable(functionObject, processorField, dictionary);
}
}
@ -43,15 +44,20 @@ namespace functionObjects
Foam::functionObjects::processorField::processorField
(
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);
@ -90,36 +96,32 @@ Foam::functionObjects::processorField::~processorField()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::processorField::read(const dictionary& dict)
{}
bool Foam::functionObjects::processorField::read(const dictionary& dict)
{
return true;
}
void Foam::functionObjects::processorField::execute()
bool Foam::functionObjects::processorField::execute(const bool postProcess)
{
const volScalarField& procField =
obr_.lookupObject<volScalarField>("processorID");
const_cast<volScalarField&>(procField) ==
dimensionedScalar("proci", dimless, Pstream::myProcNo());
return true;
}
void Foam::functionObjects::processorField::end()
{
execute();
}
void Foam::functionObjects::processorField::timeSet()
{}
void Foam::functionObjects::processorField::write()
bool Foam::functionObjects::processorField::write(const bool postProcess)
{
const volScalarField& procField =
obr_.lookupObject<volScalarField>("processorID");
procField.write();
return true;
}

View File

@ -49,7 +49,6 @@ Description
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
SourceFiles
processorField.C
@ -59,11 +58,7 @@ SourceFiles
#ifndef functionObjects_processorField_H
#define functionObjects_processorField_H
#include "OFstream.H"
#include "pointFieldFwd.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "coordinateSystem.H"
#include "functionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,8 +67,6 @@ namespace Foam
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
namespace functionObjects
{
@ -83,15 +76,14 @@ namespace functionObjects
\*---------------------------------------------------------------------------*/
class processorField
:
public functionObject
{
protected:
// Protected data
//- Name of this set of nearWallFields object
word name_;
//- Reference to the database
//- Reference to the objectRegistry
const objectRegistry& obr_;
@ -114,14 +106,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
processorField
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -131,34 +121,14 @@ public:
// Member Functions
//- Return name of the processorField object
virtual const word& name() const
{
return name_;
}
//- Read the input data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Calculate the processorID 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();
//- 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 processorID field
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "processorFieldFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(processorFieldFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
processorFieldFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::processorFieldFunctionObject
Description
FunctionObject wrapper around processorField to allow
them to be created via the functions entry within controlDict.
SourceFiles
processorFieldFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef processorFieldFunctionObject_H
#define processorFieldFunctionObject_H
#include "processorField.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::processorField>
processorFieldFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,7 +24,9 @@ License
\*---------------------------------------------------------------------------*/
#include "readFields.H"
#include "dictionary.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -33,6 +35,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(readFields, 0);
addToRunTimeSelectionTable(functionObject, readFields, dictionary);
}
}
@ -42,16 +45,21 @@ namespace functionObjects
Foam::functionObjects::readFields::readFields
(
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);
@ -69,13 +77,15 @@ Foam::functionObjects::readFields::~readFields()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::readFields::read(const dictionary& dict)
bool Foam::functionObjects::readFields::read(const dictionary& dict)
{
dict.lookup("fields") >> fieldSet_;
return true;
}
void Foam::functionObjects::readFields::execute()
bool Foam::functionObjects::readFields::execute(const bool postProcess)
{
// Clear out any previously loaded fields
vsf_.clear();
@ -101,21 +111,15 @@ void Foam::functionObjects::readFields::execute()
loadField<symmTensor>(fieldName, vSymmtf_, sSymmtf_);
loadField<tensor>(fieldName, vtf_, stf_);
}
return true;
}
void Foam::functionObjects::readFields::end()
bool Foam::functionObjects::readFields::write(const bool postProcess)
{
execute();
return true;
}
void Foam::functionObjects::readFields::timeSet()
{}
void Foam::functionObjects::readFields::write()
{}
// ************************************************************************* //

View File

@ -55,7 +55,6 @@ Description
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
SourceFiles
readFields.C
@ -65,10 +64,9 @@ SourceFiles
#ifndef functionObjects_readFields_H
#define functionObjects_readFields_H
#include "OFstream.H"
#include "pointFieldFwd.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "functionObject.H"
#include "volFieldsFwd.H"
#include "surfaceFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -77,8 +75,6 @@ namespace Foam
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
namespace functionObjects
{
@ -88,14 +84,14 @@ namespace functionObjects
\*---------------------------------------------------------------------------*/
class readFields
:
public functionObject
{
protected:
// Protected data
//- Name of this set of readFields object
word name_;
//- Reference to the objectRegistry
const objectRegistry& obr_;
//- Fields to load
@ -150,9 +146,8 @@ public:
readFields
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -162,34 +157,14 @@ public:
// Member Functions
//- Return name of the readFields object
virtual const word& name() const
{
return name_;
}
//- Read the set of fields from dictionary
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Read the 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
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "readFieldsFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(readFieldsFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
readFieldsFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::readFieldsFunctionObject
Description
FunctionObject wrapper around readFields to allow them to be created via
the functions entry within controlDict.
SourceFiles
readFieldsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef readFieldsFunctionObject_H
#define readFieldsFunctionObject_H
#include "readFields.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::readFields>
readFieldsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,11 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "regionSizeDistribution.H"
#include "volFields.H"
#include "regionSplit.H"
#include "fvcVolumeIntegrate.H"
#include "mathematicalConstants.H"
#include "stringListOps.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -37,6 +34,13 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(regionSizeDistribution, 0);
addToRunTimeSelectionTable
(
functionObject,
regionSizeDistribution,
dictionary
);
}
//- Plus op for FixedList<scalar>
@ -322,18 +326,15 @@ void Foam::functionObjects::regionSizeDistribution::writeGraphs
Foam::functionObjects::regionSizeDistribution::regionSizeDistribution
(
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),
writeFile(name, runTime, dict, name),
alphaName_(dict.lookup("field")),
patchNames_(dict.lookup("patches"))
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -351,7 +352,7 @@ Foam::functionObjects::regionSizeDistribution::~regionSizeDistribution()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
{
dict.lookup("field") >> alphaName_;
dict.lookup("patches") >> patchNames_;
@ -372,24 +373,26 @@ void Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
Info<< "Transforming all vectorFields with coordinate system "
<< coordSysPtr_().name() << endl;
}
return true;
}
void Foam::functionObjects::regionSizeDistribution::execute()
{}
void Foam::functionObjects::regionSizeDistribution::end()
{}
void Foam::functionObjects::regionSizeDistribution::timeSet()
{}
void Foam::functionObjects::regionSizeDistribution::write()
bool Foam::functionObjects::regionSizeDistribution::execute
(
const bool postProcess
)
{
Info<< type() << " " << name_ << " output:" << nl;
return true;
}
bool Foam::functionObjects::regionSizeDistribution::write
(
const bool postProcess
)
{
Info<< type() << " " << name() << " output:" << nl;
const fvMesh& mesh = refCast<const fvMesh>(obr_);
@ -846,6 +849,8 @@ void Foam::functionObjects::regionSizeDistribution::write()
}
}
}
return true;
}

View File

@ -96,7 +96,7 @@ Description
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
Foam::functionObjects::writeFile
SourceFiles
regionSizeDistribution.C
@ -106,8 +106,7 @@ SourceFiles
#ifndef functionObjects_regionSizeDistribution_H
#define functionObjects_regionSizeDistribution_H
#include "functionObjectFiles.H"
#include "pointFieldFwd.H"
#include "writeFile.H"
#include "writer.H"
#include "Map.H"
#include "volFieldsFwd.H"
@ -121,10 +120,7 @@ namespace Foam
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
class regionSplit;
class polyMesh;
namespace functionObjects
{
@ -135,15 +131,10 @@ namespace functionObjects
class regionSizeDistribution
:
public functionObjectFiles
public writeFile
{
// Private data
//- Name of this set of regionSizeDistribution objects
word name_;
const objectRegistry& obr_;
//- Name of field
word alphaName_;
@ -250,9 +241,8 @@ public:
regionSizeDistribution
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary&
);
@ -263,34 +253,14 @@ public:
// Member Functions
//- Return name of the set of regionSizeDistribution
virtual const word& name() const
{
return name_;
}
//- Read the regionSizeDistribution 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();
//- Do nothing
virtual bool execute(const bool postProcess = false);
//- Calculate the regionSizeDistribution 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);
};

View File

@ -1,46 +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 "regionSizeDistributionFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug
(
regionSizeDistributionFunctionObject,
0
);
addToRunTimeSelectionTable
(
functionObject,
regionSizeDistributionFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::regionSizeDistributionFunctionObject
Description
FunctionObject wrapper around regionSizeDistribution to allow it to be
created via the functions list within controlDict.
SourceFiles
regionSizeDistributionFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef regionSizeDistributionFunctionObject_H
#define regionSizeDistributionFunctionObject_H
#include "regionSizeDistribution.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::regionSizeDistribution>
regionSizeDistributionFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -36,6 +36,7 @@ License
#include "interpolationCellPoint.H"
#include "PatchTools.H"
#include "mapPolyMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -44,6 +45,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(streamLine, 0);
addToRunTimeSelectionTable(functionObject, streamLine, dictionary);
}
}
@ -101,7 +103,6 @@ Foam::functionObjects::streamLine::wallPatch() const
void Foam::functionObjects::streamLine::track()
{
const Time& runTime = obr_.time();
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
IDLList<streamLineParticle> initialParticles;
@ -140,118 +141,76 @@ void Foam::functionObjects::streamLine::track()
label UIndex = -1;
if (loadFromFiles_)
label nScalar = 0;
label nVector = 0;
forAll(fields_, i)
{
IOobjectList allObjects(mesh, runTime.timeName());
IOobjectList objects(2*fields_.size());
forAll(fields_, i)
if (mesh.foundObject<volScalarField>(fields_[i]))
{
objects.add(*allObjects[fields_[i]]);
nScalar++;
}
ReadFields(mesh, objects, vsFlds);
vsInterp.setSize(vsFlds.size());
forAll(vsFlds, i)
else if (mesh.foundObject<volVectorField>(fields_[i]))
{
nVector++;
}
else
{
FatalErrorInFunction
<< "Cannot find field " << fields_[i] << nl
<< "Valid scalar fields are:"
<< mesh.names(volScalarField::typeName) << nl
<< "Valid vector fields are:"
<< mesh.names(volVectorField::typeName)
<< exit(FatalError);
}
}
vsInterp.setSize(nScalar);
nScalar = 0;
vvInterp.setSize(nVector);
nVector = 0;
forAll(fields_, i)
{
if (mesh.foundObject<volScalarField>(fields_[i]))
{
const volScalarField& f = mesh.lookupObject<volScalarField>
(
fields_[i]
);
vsInterp.set
(
i,
nScalar++,
interpolation<scalar>::New
(
interpolationScheme_,
vsFlds[i]
f
)
);
}
ReadFields(mesh, objects, vvFlds);
vvInterp.setSize(vvFlds.size());
forAll(vvFlds, i)
else if (mesh.foundObject<volVectorField>(fields_[i]))
{
const volVectorField& f = mesh.lookupObject<volVectorField>
(
fields_[i]
);
if (f.name() == UName_)
{
UIndex = nVector;
}
vvInterp.set
(
i,
nVector++,
interpolation<vector>::New
(
interpolationScheme_,
vvFlds[i]
f
)
);
}
}
else
{
label nScalar = 0;
label nVector = 0;
forAll(fields_, i)
{
if (mesh.foundObject<volScalarField>(fields_[i]))
{
nScalar++;
}
else if (mesh.foundObject<volVectorField>(fields_[i]))
{
nVector++;
}
else
{
FatalErrorInFunction
<< "Cannot find field " << fields_[i] << nl
<< "Valid scalar fields are:"
<< mesh.names(volScalarField::typeName) << nl
<< "Valid vector fields are:"
<< mesh.names(volVectorField::typeName)
<< exit(FatalError);
}
}
vsInterp.setSize(nScalar);
nScalar = 0;
vvInterp.setSize(nVector);
nVector = 0;
forAll(fields_, i)
{
if (mesh.foundObject<volScalarField>(fields_[i]))
{
const volScalarField& f = mesh.lookupObject<volScalarField>
(
fields_[i]
);
vsInterp.set
(
nScalar++,
interpolation<scalar>::New
(
interpolationScheme_,
f
)
);
}
else if (mesh.foundObject<volVectorField>(fields_[i]))
{
const volVectorField& f = mesh.lookupObject<volVectorField>
(
fields_[i]
);
if (f.name() == UName_)
{
UIndex = nVector;
}
vvInterp.set
(
nVector++,
interpolation<vector>::New
(
interpolationScheme_,
f
)
);
}
}
}
// Store the names
scalarNames_.setSize(vsInterp.size());
@ -327,18 +286,22 @@ void Foam::functionObjects::streamLine::track()
Foam::functionObjects::streamLine::streamLine
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& runTime,
const dictionary& dict
)
:
functionObject(name),
obr_
(
runTime.lookupObject<objectRegistry>
(
dict.lookupOrDefault("region", polyMesh::defaultRegion)
)
),
dict_(dict),
name_(name),
obr_(obr),
loadFromFiles_(loadFromFiles),
nSubCycle_(0)
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -356,9 +319,9 @@ Foam::functionObjects::streamLine::~streamLine()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::streamLine::read(const dictionary& dict)
bool Foam::functionObjects::streamLine::read(const dictionary& dict)
{
Info<< type() << " " << name_ << ":" << nl;
Info<< type() << " " << name() << ":" << nl;
dict.lookup("fields") >> fields_;
if (dict.found("UName"))
@ -455,24 +418,20 @@ void Foam::functionObjects::streamLine::read(const dictionary& dict)
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
return true;
}
void Foam::functionObjects::streamLine::execute()
{}
void Foam::functionObjects::streamLine::end()
{}
void Foam::functionObjects::streamLine::timeSet()
{}
void Foam::functionObjects::streamLine::write()
bool Foam::functionObjects::streamLine::execute(const bool postProcess)
{
Info<< type() << " " << name_ << " output:" << nl;
return true;
}
bool Foam::functionObjects::streamLine::write(const bool postProcess)
{
Info<< type() << " " << name() << " output:" << nl;
const Time& runTime = obr_.time();
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
@ -527,41 +486,54 @@ void Foam::functionObjects::streamLine::write()
// Distribute the track positions. Note: use scheduled comms
// to prevent buffering.
mapDistribute::distribute
mapDistributeBase::distribute
(
Pstream::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
false,
distMap.constructMap(),
allTracks_
false,
allTracks_,
flipOp()
);
// Distribute the scalars
forAll(allScalars_, scalarI)
{
mapDistribute::distribute
allScalars_[scalarI].shrink();
mapDistributeBase::distribute
(
Pstream::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
false,
distMap.constructMap(),
allScalars_[scalarI]
false,
allScalars_[scalarI],
flipOp()
);
allScalars_[scalarI].setCapacity(allScalars_[scalarI].size());
}
// Distribute the vectors
forAll(allVectors_, vectorI)
{
mapDistribute::distribute
allVectors_[vectorI].shrink();
mapDistributeBase::distribute
(
Pstream::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
false,
distMap.constructMap(),
allVectors_[vectorI]
false,
allVectors_[vectorI],
flipOp()
);
allVectors_[vectorI].setCapacity(allVectors_[vectorI].size());
}
}
@ -695,6 +667,8 @@ void Foam::functionObjects::streamLine::write()
);
}
}
return true;
}

View File

@ -91,7 +91,7 @@ Note
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
Foam::functionObjects::timeControl
Foam::sampledSet
Foam::wallBoundedStreamLine
@ -103,13 +103,11 @@ SourceFiles
#ifndef functionObjects_streamLine_H
#define functionObjects_streamLine_H
#include "functionObject.H"
#include "volFieldsFwd.H"
#include "pointFieldFwd.H"
#include "Switch.H"
#include "DynamicList.H"
#include "scalarList.H"
#include "vectorList.H"
#include "polyMesh.H"
#include "writer.H"
#include "indirectPrimitivePatch.H"
@ -120,8 +118,6 @@ namespace Foam
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
class meshSearch;
class sampledSet;
@ -133,20 +129,16 @@ namespace functionObjects
\*---------------------------------------------------------------------------*/
class streamLine
:
public functionObject
{
// Private data
//- Input dictionary
dictionary dict_;
//- Name of this set of field averages.
word name_;
//- Database this class is registered to
const objectRegistry& obr_;
//- Load fields from files (not from objectRegistry)
bool loadFromFiles_;
//- Input dictionary
dictionary dict_;
//- List of fields to sample
wordList fields_;
@ -233,14 +225,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
streamLine
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -250,26 +240,14 @@ public:
// Member Functions
//- Return name of the set of field averages
virtual const word& name() const
{
return name_;
}
//- Read the field average data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute the averaging
virtual void execute();
//- Do nothing
virtual bool execute(const bool postProcess = false);
//- Execute the averaging 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 average data and write
virtual void write();
//- Calculate and write the steamlines
virtual bool write(const bool postProcess = false);
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&);

View File

@ -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 "streamLineFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(streamLineFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
streamLineFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::streamLineFunctionObject
Description
FunctionObject wrapper around streamLines to allow them to be created via
the functions entry within controlDict.
SourceFiles
streamLineFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef streamLineFunctionObject_H
#define streamLineFunctionObject_H
#include "streamLine.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::streamLine>
streamLineFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,6 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "surfaceInterpolateFields.H"
#include "surfaceFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -32,6 +34,13 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(surfaceInterpolateFields, 0);
addToRunTimeSelectionTable
(
functionObject,
surfaceInterpolateFields,
dictionary
);
}
}
@ -41,16 +50,21 @@ namespace functionObjects
Foam::functionObjects::surfaceInterpolateFields::surfaceInterpolateFields
(
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);
@ -68,18 +82,23 @@ Foam::functionObjects::surfaceInterpolateFields::~surfaceInterpolateFields()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::surfaceInterpolateFields::read
bool Foam::functionObjects::surfaceInterpolateFields::read
(
const dictionary& dict
)
{
dict.lookup("fields") >> fieldSet_;
return true;
}
void Foam::functionObjects::surfaceInterpolateFields::execute()
bool Foam::functionObjects::surfaceInterpolateFields::execute
(
const bool postProcess
)
{
Info<< type() << " " << name_ << " output:" << nl;
Info<< type() << " " << name() << " output:" << nl;
// Clear out any previously loaded fields
ssf_.clear();
@ -95,22 +114,17 @@ void Foam::functionObjects::surfaceInterpolateFields::execute()
interpolateFields<tensor>(stf_);
Info<< endl;
return true;
}
void Foam::functionObjects::surfaceInterpolateFields::end()
bool Foam::functionObjects::surfaceInterpolateFields::write
(
const bool postProcess
)
{
execute();
}
void Foam::functionObjects::surfaceInterpolateFields::timeSet()
{}
void Foam::functionObjects::surfaceInterpolateFields::write()
{
Info<< type() << " " << name_ << " output:" << nl;
Info<< type() << " " << name() << " output:" << nl;
Info<< " Writing interpolated surface fields to "
<< obr_.time().timeName() << endl;
@ -135,6 +149,8 @@ void Foam::functionObjects::surfaceInterpolateFields::write()
{
stf_[i].write();
}
return true;
}

View File

@ -59,7 +59,7 @@ Description
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
Foam::functionObjects::timeControl
SourceFiles
surfaceInterpolateFields.C
@ -69,8 +69,8 @@ SourceFiles
#ifndef functionObjects_surfaceInterpolateFields_H
#define functionObjects_surfaceInterpolateFields_H
#include "OFstream.H"
#include "surfaceFields.H"
#include "functionObject.H"
#include "surfaceFieldsFwd.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -91,18 +91,17 @@ namespace functionObjects
\*---------------------------------------------------------------------------*/
class surfaceInterpolateFields
:
public functionObject
{
protected:
// Protected data
//- Name of this set of surfaceInterpolateFields object
word name_;
//- Reference to the objectRegistry
const objectRegistry& obr_;
//- Fields to process
//wordList fieldSet_;
List<Tuple2<word, word>> fieldSet_;
//- Locally constructed fields
@ -146,9 +145,8 @@ public:
surfaceInterpolateFields
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -158,34 +156,14 @@ public:
// Member Functions
//- Return name of the surfaceInterpolateFields 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 the interpolated 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&)
{}
//- Write the interpolated fields
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "surfaceInterpolateFieldsFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug
(
surfaceInterpolateFieldsFunctionObject,
0
);
addToRunTimeSelectionTable
(
functionObject,
surfaceInterpolateFieldsFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -1,56 +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::surfaceInterpolateFieldsFunctionObject
Description
FunctionObject wrapper around surfaceInterpolateFields to allow
them to be created via the functions entry within controlDict.
SourceFiles
surfaceInterpolateFieldsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef surfaceInterpolateFieldsFunctionObject_H
#define surfaceInterpolateFieldsFunctionObject_H
#include "surfaceInterpolateFields.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject
<
functionObjects::surfaceInterpolateFields
> surfaceInterpolateFieldsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -38,6 +38,7 @@ License
#include "meshSearchMeshObject.H"
#include "faceSet.H"
#include "mapPolyMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -46,6 +47,13 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(wallBoundedStreamLine, 0);
addToRunTimeSelectionTable
(
functionObject,
wallBoundedStreamLine,
dictionary
);
}
}
@ -162,7 +170,6 @@ Foam::tetIndices Foam::functionObjects::wallBoundedStreamLine::findNearestTet
void Foam::functionObjects::wallBoundedStreamLine::track()
{
const Time& runTime = obr_.time();
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
@ -250,118 +257,77 @@ void Foam::functionObjects::wallBoundedStreamLine::track()
label UIndex = -1;
if (loadFromFiles_)
label nScalar = 0;
label nVector = 0;
forAll(fields_, i)
{
IOobjectList allObjects(mesh, runTime.timeName());
IOobjectList objects(2*fields_.size());
forAll(fields_, i)
if (mesh.foundObject<volScalarField>(fields_[i]))
{
objects.add(*allObjects[fields_[i]]);
nScalar++;
}
ReadFields(mesh, objects, vsFlds);
vsInterp.setSize(vsFlds.size());
forAll(vsFlds, i)
else if (mesh.foundObject<volVectorField>(fields_[i]))
{
nVector++;
}
else
{
FatalErrorInFunction
<< "Cannot find field " << fields_[i] << endl
<< "Valid scalar fields are:"
<< mesh.names(volScalarField::typeName) << endl
<< "Valid vector fields are:"
<< mesh.names(volVectorField::typeName)
<< exit(FatalError);
}
}
vsInterp.setSize(nScalar);
nScalar = 0;
vvInterp.setSize(nVector);
nVector = 0;
forAll(fields_, i)
{
if (mesh.foundObject<volScalarField>(fields_[i]))
{
const volScalarField& f = mesh.lookupObject<volScalarField>
(
fields_[i]
);
vsInterp.set
(
i,
nScalar++,
interpolation<scalar>::New
(
interpolationScheme_,
vsFlds[i]
f
)
);
}
ReadFields(mesh, objects, vvFlds);
vvInterp.setSize(vvFlds.size());
forAll(vvFlds, i)
else if (mesh.foundObject<volVectorField>(fields_[i]))
{
const volVectorField& f = mesh.lookupObject<volVectorField>
(
fields_[i]
);
if (f.name() == UName_)
{
UIndex = nVector;
}
vvInterp.set
(
i,
nVector++,
interpolation<vector>::New
(
interpolationScheme_,
vvFlds[i]
f
)
);
}
}
else
{
label nScalar = 0;
label nVector = 0;
forAll(fields_, i)
{
if (mesh.foundObject<volScalarField>(fields_[i]))
{
nScalar++;
}
else if (mesh.foundObject<volVectorField>(fields_[i]))
{
nVector++;
}
else
{
FatalErrorInFunction
<< "Cannot find field " << fields_[i] << endl
<< "Valid scalar fields are:"
<< mesh.names(volScalarField::typeName) << endl
<< "Valid vector fields are:"
<< mesh.names(volVectorField::typeName)
<< exit(FatalError);
}
}
vsInterp.setSize(nScalar);
nScalar = 0;
vvInterp.setSize(nVector);
nVector = 0;
forAll(fields_, i)
{
if (mesh.foundObject<volScalarField>(fields_[i]))
{
const volScalarField& f = mesh.lookupObject<volScalarField>
(
fields_[i]
);
vsInterp.set
(
nScalar++,
interpolation<scalar>::New
(
interpolationScheme_,
f
)
);
}
else if (mesh.foundObject<volVectorField>(fields_[i]))
{
const volVectorField& f = mesh.lookupObject<volVectorField>
(
fields_[i]
);
if (f.name() == UName_)
{
UIndex = nVector;
}
vvInterp.set
(
nVector++,
interpolation<vector>::New
(
interpolationScheme_,
f
)
);
}
}
}
// Store the names
scalarNames_.setSize(vsInterp.size());
@ -439,17 +405,21 @@ void Foam::functionObjects::wallBoundedStreamLine::track()
Foam::functionObjects::wallBoundedStreamLine::wallBoundedStreamLine
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& runTime,
const dictionary& dict
)
:
dict_(dict),
name_(name),
obr_(obr),
loadFromFiles_(loadFromFiles)
functionObject(name),
obr_
(
runTime.lookupObject<objectRegistry>
(
dict.lookupOrDefault("region", polyMesh::defaultRegion)
)
),
dict_(dict)
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -467,7 +437,7 @@ Foam::functionObjects::wallBoundedStreamLine::~wallBoundedStreamLine()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::wallBoundedStreamLine::read(const dictionary& dict)
bool Foam::functionObjects::wallBoundedStreamLine::read(const dictionary& dict)
{
//dict_ = dict;
dict.lookup("fields") >> fields_;
@ -613,22 +583,21 @@ void Foam::functionObjects::wallBoundedStreamLine::read(const dictionary& dict)
}
}
}
return true;
}
void Foam::functionObjects::wallBoundedStreamLine::execute()
{}
bool Foam::functionObjects::wallBoundedStreamLine::execute
(
const bool postProcess
)
{
return true;
}
void Foam::functionObjects::wallBoundedStreamLine::end()
{}
void Foam::functionObjects::wallBoundedStreamLine::timeSet()
{}
void Foam::functionObjects::wallBoundedStreamLine::write()
bool Foam::functionObjects::wallBoundedStreamLine::write(const bool postProcess)
{
const Time& runTime = obr_.time();
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
@ -680,44 +649,57 @@ void Foam::functionObjects::wallBoundedStreamLine::write()
recvMap.xfer()
);
// Distribute the track positions. Note: use scheduled comms
// to prevent buffering.
mapDistribute::distribute
allTracks_.shrink();
mapDistributeBase::distribute
(
Pstream::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
false,
distMap.constructMap(),
allTracks_
false,
allTracks_,
flipOp()
);
// Distribute the scalars
forAll(allScalars_, scalarI)
{
mapDistribute::distribute
allScalars_[scalarI].shrink();
mapDistributeBase::distribute
(
Pstream::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
false,
distMap.constructMap(),
allScalars_[scalarI]
false,
allScalars_[scalarI],
flipOp()
);
allScalars_[scalarI].setCapacity(allScalars_[scalarI].size());
}
// Distribute the vectors
forAll(allVectors_, vectorI)
{
mapDistribute::distribute
allVectors_[vectorI].shrink();
mapDistributeBase::distribute
(
Pstream::scheduled,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
false,
distMap.constructMap(),
allVectors_[vectorI]
false,
allVectors_[vectorI],
flipOp()
);
allVectors_[vectorI].setCapacity(allVectors_[vectorI].size());
}
}
@ -850,6 +832,8 @@ void Foam::functionObjects::wallBoundedStreamLine::write()
);
}
}
return true;
}

View File

@ -91,7 +91,7 @@ Note
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
Foam::functionObjects::timeControl
Foam::sampledSet
Foam::streamLine
@ -103,18 +103,15 @@ SourceFiles
#ifndef functionObjects_wallBoundedStreamLine_H
#define functionObjects_wallBoundedStreamLine_H
#include "functionObject.H"
#include "volFieldsFwd.H"
#include "pointFieldFwd.H"
#include "Switch.H"
#include "DynamicList.H"
#include "scalarList.H"
#include "vectorList.H"
#include "polyMesh.H"
#include "writer.H"
#include "indirectPrimitivePatch.H"
#include "tetIndices.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@ -122,8 +119,6 @@ namespace Foam
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
class meshSearch;
class sampledSet;
@ -135,20 +130,16 @@ namespace functionObjects
\*---------------------------------------------------------------------------*/
class wallBoundedStreamLine
:
public functionObject
{
// Private data
//- Input dictionary
dictionary dict_;
//- Name of this set of field averages.
word name_;
//- Database this class is registered to
const objectRegistry& obr_;
//- Load fields from files (not from objectRegistry)
bool loadFromFiles_;
//- Input dictionary
dictionary dict_;
//- List of fields to sample
wordList fields_;
@ -239,14 +230,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
wallBoundedStreamLine
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary& dict
);
@ -256,26 +245,14 @@ public:
// Member Functions
//- Return name of the set of field averages
virtual const word& name() const
{
return name_;
}
//- Read the field average data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute the averaging
virtual void execute();
//- Do nothing
virtual bool execute(const bool postProcess = false);
//- Execute the averaging 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 average data and write
virtual void write();
//- Calculate and write the wall-bounded streamlines
virtual bool write(const bool postProcess = false);
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&);

View File

@ -1,42 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-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 "wallBoundedStreamLineFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(wallBoundedStreamLineFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
wallBoundedStreamLineFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -1,55 +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::wallBoundedStreamLineFunctionObject
Description
FunctionObject wrapper around wallBoundedStreamLines
to allow them to be created via
the functions entry within controlDict.
SourceFiles
wallBoundedStreamLineFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef wallBoundedStreamLineFunctionObject_H
#define wallBoundedStreamLineFunctionObject_H
#include "wallBoundedStreamLine.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::wallBoundedStreamLine>
wallBoundedStreamLineFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,13 +1,6 @@
pressureTools/pressureTools.C
pressureTools/pressureToolsFunctionObject.C
wallShearStress/wallShearStress.C
wallShearStress/wallShearStressFunctionObject.C
forces/forces.C
forces/forcesFunctionObject.C
forceCoeffs/forceCoeffs.C
forceCoeffs/forceCoeffsFunctionObject.C
LIB = $(FOAM_LIBBIN)/libforces

View File

@ -24,11 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "forceCoeffs.H"
#include "dictionary.H"
#include "Time.H"
#include "fvMesh.H"
#include "Pstream.H"
#include "IOmanip.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -37,6 +33,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(forceCoeffs, 0);
addToRunTimeSelectionTable(functionObject, forceCoeffs, dictionary);
}
}
@ -126,12 +123,11 @@ void Foam::functionObjects::forceCoeffs::writeFileHeader(const label i)
Foam::functionObjects::forceCoeffs::forceCoeffs
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& runTime,
const dictionary& dict
)
:
forces(name, obr, dict, loadFromFiles, false),
forces(name, runTime, dict),
liftDir_(Zero),
dragDir_(Zero),
pitchAxis_(Zero),
@ -139,12 +135,6 @@ Foam::functionObjects::forceCoeffs::forceCoeffs
lRef_(0.0),
Aref_(0.0)
{
if (!isA<fvMesh>(obr))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
}
read(dict);
}
@ -157,7 +147,7 @@ Foam::functionObjects::forceCoeffs::~forceCoeffs()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
bool Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
{
forces::read(dict);
@ -172,28 +162,24 @@ void Foam::functionObjects::forceCoeffs::read(const dictionary& dict)
// Reference length and area scales
dict.lookup("lRef") >> lRef_;
dict.lookup("Aref") >> Aref_;
return true;
}
void Foam::functionObjects::forceCoeffs::execute()
{}
bool Foam::functionObjects::forceCoeffs::execute(const bool postProcess)
{
return true;
}
void Foam::functionObjects::forceCoeffs::end()
{}
void Foam::functionObjects::forceCoeffs::timeSet()
{}
void Foam::functionObjects::forceCoeffs::write()
bool Foam::functionObjects::forceCoeffs::write(const bool postProcess)
{
forces::calcForcesMoment();
if (Pstream::master())
{
functionObjectFiles::write();
writeFiles::write();
scalar pDyn = 0.5*rhoRef_*magUInf_*magUInf_;
@ -222,7 +208,7 @@ void Foam::functionObjects::forceCoeffs::write()
<< tab << Cm << tab << Cd
<< tab << Cl << tab << Clf << tab << Clr << endl;
if (log_) Info<< type() << " " << name_ << " output:" << nl
if (log_) Info<< type() << " " << name() << " output:" << nl
<< " Cm = " << Cm << nl
<< " Cd = " << Cd << nl
<< " Cl = " << Cl << nl
@ -256,6 +242,8 @@ void Foam::functionObjects::forceCoeffs::write()
if (log_) Info<< endl;
}
return true;
}

View File

@ -81,8 +81,8 @@ Description
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
Foam::forces
Foam::functionObjects::timeControl
Foam::functionObjects::forces
SourceFiles
forceCoeffs.C
@ -161,14 +161,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
forceCoeffs
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary&
);
@ -179,19 +177,13 @@ public:
// Member Functions
//- Read the forces 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 forces
virtual void write();
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "forceCoeffsFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(forceCoeffsFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
forceCoeffsFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::forceCoeffsFunctionObject
Description
FunctionObject wrapper around forceCoeffs to allow them to be created via
the functions entry within controlDict.
SourceFiles
forceCoeffsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef forceCoeffsFunctionObject_H
#define forceCoeffsFunctionObject_H
#include "forceCoeffs.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::forceCoeffs>
forceCoeffsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,14 +24,11 @@ License
\*---------------------------------------------------------------------------*/
#include "forces.H"
#include "volFields.H"
#include "dictionary.H"
#include "Time.H"
#include "wordReList.H"
#include "fvcGrad.H"
#include "porosityModel.H"
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -40,6 +37,8 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(forces, 0);
addToRunTimeSelectionTable(functionObject, forces, dictionary);
}
}
@ -395,7 +394,7 @@ void Foam::functionObjects::forces::applyBins
void Foam::functionObjects::forces::writeForces()
{
if (log_) Info
<< type() << " " << name_ << " output:" << nl
<< type() << " " << name() << " output:" << nl
<< " sum of forces:" << nl
<< " pressure : " << sum(force_[0]) << nl
<< " viscous : " << sum(force_[1]) << nl
@ -522,16 +521,11 @@ void Foam::functionObjects::forces::writeBins()
Foam::functionObjects::forces::forces
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles,
const bool readFields
const Time& runTime,
const dictionary& dict
)
:
functionObjectFiles(obr, name, createFileNames(dict)),
name_(name),
obr_(obr),
log_(true),
writeFiles(name, runTime, dict, name),
force_(3),
moment_(3),
patchSet_(),
@ -553,16 +547,14 @@ Foam::functionObjects::forces::forces
binCumulative_(true),
initialised_(false)
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
}
if (readFields)
{
read(dict);
}
read(dict);
resetNames(createFileNames(dict));
}
@ -570,30 +562,21 @@ Foam::functionObjects::forces::forces
(
const word& name,
const objectRegistry& obr,
const labelHashSet& patchSet,
const word& pName,
const word& UName,
const word& rhoName,
const scalar rhoInf,
const scalar pRef,
const coordinateSystem& coordSys
const dictionary& dict
)
:
functionObjectFiles(obr, name, typeName),
name_(name),
obr_(obr),
log_(true),
writeFiles(name, obr, dict, name),
force_(3),
moment_(3),
patchSet_(patchSet),
pName_(pName),
UName_(UName),
rhoName_(rhoName),
patchSet_(),
pName_(word::null),
UName_(word::null),
rhoName_(word::null),
directForceDensity_(false),
fDName_(""),
rhoRef_(rhoInf),
pRef_(pRef),
coordSys_(coordSys),
rhoRef_(VGREAT),
pRef_(0),
coordSys_(),
localSystem_(false),
porosity_(false),
nBin_(1),
@ -604,11 +587,14 @@ Foam::functionObjects::forces::forces
binCumulative_(true),
initialised_(false)
{
forAll(force_, i)
if (!isA<fvMesh>(obr_))
{
force_[i].setSize(nBin_);
moment_[i].setSize(nBin_);
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
}
read(dict);
resetNames(createFileNames(dict));
}
@ -620,13 +606,13 @@ Foam::functionObjects::forces::~forces()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::forces::read(const dictionary& dict)
bool Foam::functionObjects::forces::read(const dictionary& dict)
{
writeFiles::read(dict);
initialised_ = false;
log_ = dict.lookupOrDefault<Switch>("log", false);
if (log_) Info<< type() << " " << name_ << ":" << nl;
if (log_) Info<< type() << " " << name() << ":" << nl;
directForceDensity_ = dict.lookupOrDefault("directForceDensity", false);
@ -747,35 +733,8 @@ void Foam::functionObjects::forces::read(const dictionary& dict)
moment_[1].setSize(1);
moment_[2].setSize(1);
}
}
void Foam::functionObjects::forces::execute()
{}
void Foam::functionObjects::forces::end()
{}
void Foam::functionObjects::forces::timeSet()
{}
void Foam::functionObjects::forces::write()
{
calcForcesMoment();
if (Pstream::master())
{
functionObjectFiles::write();
writeForces();
writeBins();
if (log_) Info<< endl;
}
return true;
}
@ -931,4 +890,29 @@ Foam::vector Foam::functionObjects::forces::momentEff() const
}
bool Foam::functionObjects::forces::execute(const bool postProcess)
{
return true;
}
bool Foam::functionObjects::forces::write(const bool postProcess)
{
calcForcesMoment();
if (Pstream::master())
{
writeFiles::write();
writeForces();
writeBins();
if (log_) Info<< endl;
}
return true;
}
// ************************************************************************* //

View File

@ -101,7 +101,8 @@ Note
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
Foam::functionObjects::writeFiles
Foam::functionObjects::timeControl
Foam::forceCoeffs
SourceFiles
@ -112,28 +113,15 @@ SourceFiles
#ifndef functionObjects_forces_H
#define functionObjects_forces_H
#include "functionObjectFiles.H"
#include "writeFiles.H"
#include "coordinateSystem.H"
#include "coordinateSystems.H"
#include "primitiveFieldsFwd.H"
#include "volFieldsFwd.H"
#include "HashSet.H"
#include "Tuple2.H"
#include "OFstream.H"
#include "Switch.H"
#include "writer.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class polyMesh;
class mapPolyMesh;
namespace functionObjects
{
@ -143,21 +131,12 @@ namespace functionObjects
class forces
:
public functionObjectFiles
public writeFiles
{
protected:
// Protected data
//- Name of this set of forces,
// Also used as the name of the probes directory.
word name_;
const objectRegistry& obr_;
//- Switch to send output to Info as well as to file
Switch log_;
//- Pressure, viscous and porous force per bin
List<Field<vector>> force_;
@ -281,29 +260,20 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
forces
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false,
const bool readFields = true
const Time& runTime,
const dictionary& dict
);
//- Construct from components
//- Construct from objectRegistry and dictionary
forces
(
const word& name,
const objectRegistry&,
const labelHashSet& patchSet,
const word& pName,
const word& UName,
const word& rhoName,
const scalar rhoInf,
const scalar pRef,
const coordinateSystem& coordSys
const objectRegistry& obr,
const dictionary&
);
@ -313,26 +283,8 @@ public:
// Member Functions
//- Return name of the set of forces
virtual const word& name() const
{
return name_;
}
//- Read the forces data
virtual void 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();
//- Write the forces
virtual void write();
virtual bool read(const dictionary&);
//- Calculate the forces and moments
virtual void calcForcesMoment();
@ -343,13 +295,11 @@ public:
//- Return the total moment
virtual vector momentEff() const;
//- Update for changes of mesh
virtual void updateMesh(const mapPolyMesh&)
{}
//- Execute, currently does nothing
virtual bool execute(const bool postProcess = false);
//- Update for changes of mesh
virtual void movePoints(const polyMesh&)
{}
//- Write the forces
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "forcesFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(forcesFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
forcesFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::forcesFunctionObject
Description
FunctionObject wrapper around forces to allow them to be created via the
functions entry within controlDict.
SourceFiles
forcesFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef forcesFunctionObject_H
#define forcesFunctionObject_H
#include "forces.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::forces>
forcesFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,7 +25,7 @@ License
#include "pressureTools.H"
#include "volFields.H"
#include "dictionary.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -34,6 +34,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(pressureTools, 0);
addToRunTimeSelectionTable(functionObject, pressureTools, dictionary);
}
}
@ -186,13 +187,18 @@ Foam::functionObjects::pressureTools::convertToCoeff
Foam::functionObjects::pressureTools::pressureTools
(
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)
)
),
pName_("p"),
UName_("U"),
rhoName_("rho"),
@ -203,7 +209,7 @@ Foam::functionObjects::pressureTools::pressureTools
UInf_(Zero),
rhoInf_(0.0)
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -249,7 +255,7 @@ Foam::functionObjects::pressureTools::~pressureTools()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::pressureTools::read(const dictionary& dict)
bool Foam::functionObjects::pressureTools::read(const dictionary& dict)
{
dict.readIfPresent("pName", pName_);
dict.readIfPresent("UName", UName_);
@ -278,16 +284,18 @@ void Foam::functionObjects::pressureTools::read(const dictionary& dict)
if (mag(zeroCheck) < ROOTVSMALL)
{
WarningInFunction
<< type() << " " << name_ << ": "
<< type() << " " << name() << ": "
<< "Coefficient calculation requested, but reference "
<< "pressure level is zero. Please check the supplied "
<< "values of pInf, UInf and rhoInf" << endl;
}
}
return true;
}
void Foam::functionObjects::pressureTools::execute()
bool Foam::functionObjects::pressureTools::execute(const bool postProcess)
{
const volScalarField& p = obr_.lookupObject<volScalarField>(pName_);
@ -297,29 +305,23 @@ void Foam::functionObjects::pressureTools::execute()
);
pResult == convertToCoeff(rhoScale(p)*p + pDyn(p) + pRef());
return true;
}
void Foam::functionObjects::pressureTools::end()
{
execute();
}
void Foam::functionObjects::pressureTools::timeSet()
{}
void Foam::functionObjects::pressureTools::write()
bool Foam::functionObjects::pressureTools::write(const bool postProcess)
{
const volScalarField& pResult =
obr_.lookupObject<volScalarField>(pName());
Info<< type() << " " << name_ << " output:" << nl
Info<< type() << " " << name() << " output:" << nl
<< " writing field " << pResult.name() << nl
<< endl;
pResult.write();
return true;
}

View File

@ -108,6 +108,7 @@ SourceFiles
#ifndef functionObjects_pressureTools_H
#define functionObjects_pressureTools_H
#include "functionObject.H"
#include "volFieldsFwd.H"
#include "dimensionedScalar.H"
@ -118,9 +119,6 @@ namespace Foam
// Forward declaration of classes
class objectRegistry;
class dictionary;
class polyMesh;
class mapPolyMesh;
namespace functionObjects
{
@ -130,13 +128,12 @@ namespace functionObjects
\*---------------------------------------------------------------------------*/
class pressureTools
:
public functionObject
{
// Private data
//- Name of this set of pressureTools objects
word name_;
//- Reference to the database
//- Reference to the objectRegistry
const objectRegistry& obr_;
//- Name of pressure field, default is "p"
@ -208,14 +205,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
pressureTools
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary&
);
@ -225,34 +220,14 @@ public:
// Member Functions
//- Return name of the set of pressureTools
virtual const word& name() const
{
return name_;
}
//- Read the pressureTools 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 pressureTools 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);
};

View File

@ -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 "pressureToolsFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(pressureToolsFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
pressureToolsFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::pressureToolsFunctionObject
Description
FunctionObject wrapper around pressureTools to allow it to be created via
the functions entry within controlDict.
SourceFiles
pressureToolsFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef pressureToolsFunctionObject_H
#define pressureToolsFunctionObject_H
#include "pressureTools.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::pressureTools>
pressureToolsFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -29,6 +29,7 @@ License
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "wallPolyPatch.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -37,6 +38,7 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(wallShearStress, 0);
addToRunTimeSelectionTable(functionObject, wallShearStress, dictionary);
}
}
@ -97,18 +99,14 @@ void Foam::functionObjects::wallShearStress::calcShearStress
Foam::functionObjects::wallShearStress::wallShearStress
(
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),
patchSet_()
{
if (!isA<fvMesh>(obr))
if (!isA<fvMesh>(obr_))
{
FatalErrorInFunction
<< "objectRegistry is not an fvMesh" << exit(FatalError);
@ -141,6 +139,7 @@ Foam::functionObjects::wallShearStress::wallShearStress
mesh.objectRegistry::store(wallShearStressPtr);
read(dict);
resetName(typeName);
}
@ -152,9 +151,9 @@ Foam::functionObjects::wallShearStress::~wallShearStress()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::wallShearStress::read(const dictionary& dict)
bool Foam::functionObjects::wallShearStress::read(const dictionary& dict)
{
log_ = dict.lookupOrDefault<Switch>("log", true);
writeFiles::read(dict);
const fvMesh& mesh = refCast<const fvMesh>(obr_);
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
@ -165,7 +164,7 @@ void Foam::functionObjects::wallShearStress::read(const dictionary& dict)
wordReList(dict.lookupOrDefault("patches", wordReList()))
);
Info<< type() << " " << name_ << ":" << nl;
Info<< type() << " " << name() << ":" << nl;
if (patchSet_.empty())
{
@ -203,15 +202,17 @@ void Foam::functionObjects::wallShearStress::read(const dictionary& dict)
patchSet_ = filteredPatchSet;
}
return true;
}
void Foam::functionObjects::wallShearStress::execute()
bool Foam::functionObjects::wallShearStress::execute(const bool postProcess)
{
typedef compressible::turbulenceModel cmpModel;
typedef incompressible::turbulenceModel icoModel;
functionObjectFiles::write();
writeFiles::write();
const fvMesh& mesh = refCast<const fvMesh>(obr_);
@ -221,7 +222,7 @@ void Foam::functionObjects::wallShearStress::execute()
mesh.lookupObject<volVectorField>(type())
);
if (log_) Info<< type() << " " << name_ << " output:" << nl;
if (log_) Info<< type() << " " << name() << " output:" << nl;
tmp<volSymmTensorField> Reff;
@ -247,31 +248,25 @@ void Foam::functionObjects::wallShearStress::execute()
}
calcShearStress(mesh, Reff(), wallShearStress);
return true;
}
void Foam::functionObjects::wallShearStress::end()
bool Foam::functionObjects::wallShearStress::write(const bool postProcess)
{
execute();
}
void Foam::functionObjects::wallShearStress::timeSet()
{}
void Foam::functionObjects::wallShearStress::write()
{
functionObjectFiles::write();
writeFiles::write();
const volVectorField& wallShearStress =
obr_.lookupObject<volVectorField>(type());
if (log_) Info<< type() << " " << name_ << " output:" << nl
if (log_) Info<< type() << " " << name() << " output:" << nl
<< " writing field " << wallShearStress.name() << nl
<< endl;
wallShearStress.write();
return true;
}

View File

@ -64,6 +64,12 @@ Description
patches | list of patches to process | no | all wall patches
\endtable
SeeAlso
Foam::functionObject
Foam::functionObjects::writeFiles
Foam::functionObjects::pressureTools
Foam::functionObjects::timeControl
SourceFiles
wallShearStress.C
@ -72,9 +78,8 @@ SourceFiles
#ifndef functionObjects_wallShearStress_H
#define functionObjects_wallShearStress_H
#include "functionObjectFiles.H"
#include "writeFiles.H"
#include "volFieldsFwd.H"
#include "Switch.H"
#include "HashSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -83,10 +88,6 @@ namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class polyMesh;
class mapPolyMesh;
class fvMesh;
namespace functionObjects
@ -98,20 +99,12 @@ namespace functionObjects
class wallShearStress
:
public functionObjectFiles
public writeFiles
{
protected:
// Protected data
//- Name of this set of wallShearStress object
word name_;
const objectRegistry& obr_;
//- Switch to send output to Info as well as to file
Switch log_;
//- Optional list of patches to process
labelHashSet patchSet_;
@ -149,14 +142,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
wallShearStress
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary&
);
@ -166,34 +157,14 @@ public:
// Member Functions
//- Return name of the set of wallShearStress
virtual const word& name() const
{
return name_;
}
//- Read the wallShearStress data
virtual void read(const dictionary&);
virtual bool read(const dictionary&);
//- Execute, currently does nothing
virtual void execute();
//- Calculate the wall shear-stress
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 wallShearStress 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 wall shear-stress
virtual bool write(const bool postProcess = false);
};

View File

@ -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 "wallShearStressFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(wallShearStressFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
wallShearStressFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::wallShearStressFunctionObject
Description
FunctionObject wrapper around wallShearStress to allow it to be created
via the functions entry within controlDict.
SourceFiles
wallShearStressFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef wallShearStressFunctionObject_H
#define wallShearStressFunctionObject_H
#include "wallShearStress.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::wallShearStress>
wallShearStressFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,4 +1,3 @@
cloudInfo/cloudInfo.C
cloudInfo/cloudInfoFunctionObject.C
LIB = $(FOAM_LIBBIN)/liblagrangianFunctionObjects

View File

@ -24,8 +24,8 @@ License
\*---------------------------------------------------------------------------*/
#include "cloudInfo.H"
#include "dictionary.H"
#include "kinematicCloud.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -34,6 +34,13 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(cloudInfo, 0);
addToRunTimeSelectionTable
(
functionObject,
cloudInfo,
dictionary
);
}
}
@ -55,14 +62,11 @@ void Foam::functionObjects::cloudInfo::writeFileHeader(const label i)
Foam::functionObjects::cloudInfo::cloudInfo
(
const word& name,
const objectRegistry& obr,
const dictionary& dict,
const bool loadFromFiles
const Time& runTime,
const dictionary& dict
)
:
functionObjectFiles(obr, name),
name_(name),
obr_(obr)
writeFiles(name, runTime, dict, name)
{
read(dict);
}
@ -76,11 +80,11 @@ Foam::functionObjects::cloudInfo::~cloudInfo()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void Foam::functionObjects::cloudInfo::read(const dictionary& dict)
bool Foam::functionObjects::cloudInfo::read(const dictionary& dict)
{
functionObjectFiles::resetNames(dict.lookup("clouds"));
writeFiles::resetNames(dict.lookup("clouds"));
Info<< type() << " " << name_ << ": ";
Info<< type() << " " << name() << ": ";
if (names().size())
{
Info<< "applying to clouds:" << nl;
@ -94,24 +98,20 @@ void Foam::functionObjects::cloudInfo::read(const dictionary& dict)
{
Info<< "no clouds to be processed" << nl << endl;
}
return true;
}
void Foam::functionObjects::cloudInfo::execute()
{}
void Foam::functionObjects::cloudInfo::end()
{}
void Foam::functionObjects::cloudInfo::timeSet()
{}
void Foam::functionObjects::cloudInfo::write()
bool Foam::functionObjects::cloudInfo::execute(const bool postProcess)
{
functionObjectFiles::write();
return true;
}
bool Foam::functionObjects::cloudInfo::write(const bool postProcess)
{
writeFiles::write();
forAll(names(), i)
{
@ -133,6 +133,8 @@ void Foam::functionObjects::cloudInfo::write()
<< massInSystem << endl;
}
}
return true;
}

View File

@ -61,7 +61,7 @@ Description
SeeAlso
Foam::functionObject
Foam::OutputFilterFunctionObject
Foam::functionObjects::writeFiles
SourceFiles
cloudInfo.C
@ -71,22 +71,12 @@ SourceFiles
#ifndef functionObjects_cloudInfo_H
#define functionObjects_cloudInfo_H
#include "functionObjectFiles.H"
#include "PtrList.H"
#include "pointFieldFwd.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "writeFiles.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class objectRegistry;
class dictionary;
class mapPolyMesh;
namespace functionObjects
{
@ -96,19 +86,10 @@ namespace functionObjects
class cloudInfo
:
public functionObjectFiles
public writeFiles
{
protected:
// Protected data
//- Name of this set of cloudInfo object
word name_;
//- Reference to the database
const objectRegistry& obr_;
// Protected Member Functions
//- File header information
@ -134,14 +115,12 @@ public:
// Constructors
//- Construct for given objectRegistry and dictionary.
// Allow the possibility to load fields from files
//- Construct from Time and dictionary
cloudInfo
(
const word& name,
const objectRegistry&,
const dictionary&,
const bool loadFromFiles = false
const Time& runTime,
const dictionary&
);
@ -151,34 +130,14 @@ public:
// Member Functions
//- Return name of the cloudInfo 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();
//- 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
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);
};

View File

@ -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 "cloudInfoFunctionObject.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineNamedTemplateTypeNameAndDebug(cloudInfoFunctionObject, 0);
addToRunTimeSelectionTable
(
functionObject,
cloudInfoFunctionObject,
dictionary
);
}
// ************************************************************************* //

View File

@ -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::cloudInfoFunctionObject
Description
FunctionObject wrapper around cloudInfo to allow them to be created via
the functions entry within controlDict.
SourceFiles
cloudInfoFunctionObject.C
\*---------------------------------------------------------------------------*/
#ifndef cloudInfoFunctionObject_H
#define cloudInfoFunctionObject_H
#include "cloudInfo.H"
#include "OutputFilterFunctionObject.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef OutputFilterFunctionObject<functionObjects::cloudInfo>
cloudInfoFunctionObject;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -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;
}

View File

@ -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);
};

Some files were not shown because too many files have changed in this diff Show More