mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Generalised faceSourceDelta function object to use any pair of field value function objects
This commit is contained in:
@ -10,12 +10,13 @@ fieldMinMax/fieldMinMax.C
|
|||||||
fieldMinMax/fieldMinMaxFunctionObject.C
|
fieldMinMax/fieldMinMaxFunctionObject.C
|
||||||
|
|
||||||
fieldValues/fieldValue/fieldValue.C
|
fieldValues/fieldValue/fieldValue.C
|
||||||
|
fieldValues/fieldValue/fieldValueNew.C
|
||||||
|
fieldValues/fieldValueDelta/fieldValueDelta.C
|
||||||
|
fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C
|
||||||
fieldValues/faceSource/faceSource.C
|
fieldValues/faceSource/faceSource.C
|
||||||
fieldValues/faceSource/faceSourceFunctionObject.C
|
fieldValues/faceSource/faceSourceFunctionObject.C
|
||||||
fieldValues/cellSource/cellSource.C
|
fieldValues/cellSource/cellSource.C
|
||||||
fieldValues/cellSource/cellSourceFunctionObject.C
|
fieldValues/cellSource/cellSourceFunctionObject.C
|
||||||
fieldValues/faceSourceDelta/faceSourceDelta.C
|
|
||||||
fieldValues/faceSourceDelta/faceSourceDeltaFunctionObject.C
|
|
||||||
|
|
||||||
nearWallFields/nearWallFields.C
|
nearWallFields/nearWallFields.C
|
||||||
nearWallFields/nearWallFieldsFunctionObject.C
|
nearWallFields/nearWallFieldsFunctionObject.C
|
||||||
|
|||||||
@ -22,25 +22,25 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Typedef
|
Typedef
|
||||||
Foam::IOfaceSourceDelta
|
Foam::IOfieldValueDelta
|
||||||
|
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Instance of the generic IOOutputFilter for faceSourceDelta.
|
Instance of the generic IOOutputFilter for fieldValueDelta.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef IOfaceSourceDelta_H
|
#ifndef IOfieldValueDelta_H
|
||||||
#define IOfaceSourceDelta_H
|
#define IOfieldValueDelta_H
|
||||||
|
|
||||||
#include "faceSourceDelta.H"
|
#include "fieldValueDelta.H"
|
||||||
#include "IOOutputFilter.H"
|
#include "IOOutputFilter.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
typedef IOOutputFilter<faceSourceDelta> IOfaceSourceDelta;
|
typedef IOOutputFilter<fieldValueDelta> IOfieldValueDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -23,22 +23,23 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "faceSourceDelta.H"
|
#include "fieldValueDelta.H"
|
||||||
#include "ListOps.H"
|
#include "ListOps.H"
|
||||||
|
#include "Time.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
defineTypeNameAndDebug(Foam::fieldValues::faceSourceDelta, 0);
|
defineTypeNameAndDebug(Foam::fieldValues::fieldValueDelta, 0);
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::fieldValues::faceSourceDelta::updateMesh(const mapPolyMesh&)
|
void Foam::fieldValues::fieldValueDelta::updateMesh(const mapPolyMesh&)
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldValues::faceSourceDelta::movePoints(const Field<point>&)
|
void Foam::fieldValues::fieldValueDelta::movePoints(const Field<point>&)
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
@ -46,7 +47,7 @@ void Foam::fieldValues::faceSourceDelta::movePoints(const Field<point>&)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fieldValues::faceSourceDelta::faceSourceDelta
|
Foam::fieldValues::fieldValueDelta::fieldValueDelta
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
@ -55,31 +56,21 @@ Foam::fieldValues::faceSourceDelta::faceSourceDelta
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, name, typeName),
|
functionObjectFile(obr, name, typeName),
|
||||||
|
name_(name),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
|
loadFromFiles_(loadFromFiles),
|
||||||
log_(false),
|
log_(false),
|
||||||
faceSource1_
|
source1Ptr_(NULL),
|
||||||
(
|
source2Ptr_(NULL)
|
||||||
name + ".faceSource1",
|
|
||||||
obr,
|
|
||||||
dict.subDict("faceSource1"),
|
|
||||||
loadFromFiles
|
|
||||||
),
|
|
||||||
faceSource2_
|
|
||||||
(
|
|
||||||
name + ".faceSource2",
|
|
||||||
obr,
|
|
||||||
dict.subDict("faceSource2"),
|
|
||||||
loadFromFiles
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldValues::faceSourceDelta::writeFileHeader(const label i)
|
void Foam::fieldValues::fieldValueDelta::writeFileHeader(const label i)
|
||||||
{
|
{
|
||||||
const wordList& fields1 = faceSource1_.fields();
|
const wordList& fields1 = source1Ptr_->fields();
|
||||||
const wordList& fields2 = faceSource2_.fields();
|
const wordList& fields2 = source2Ptr_->fields();
|
||||||
|
|
||||||
DynamicList<word> commonFields(fields1.size());
|
DynamicList<word> commonFields(fields1.size());
|
||||||
forAll(fields1, i)
|
forAll(fields1, i)
|
||||||
@ -104,26 +95,46 @@ void Foam::fieldValues::faceSourceDelta::writeFileHeader(const label i)
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fieldValues::faceSourceDelta::~faceSourceDelta()
|
Foam::fieldValues::fieldValueDelta::~fieldValueDelta()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::fieldValues::faceSourceDelta::read(const dictionary& dict)
|
void Foam::fieldValues::fieldValueDelta::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
log_ = dict.lookupOrDefault<Switch>("log", false);
|
log_ = dict.lookupOrDefault<Switch>("log", false);
|
||||||
faceSource1_.read(dict.subDict("faceSource1"));
|
source1Ptr_.reset
|
||||||
faceSource2_.read(dict.subDict("faceSource2"));
|
(
|
||||||
|
fieldValue::New
|
||||||
|
(
|
||||||
|
name_ + ".source1",
|
||||||
|
obr_,
|
||||||
|
dict.subDict("source1"),
|
||||||
|
loadFromFiles_,
|
||||||
|
false
|
||||||
|
).ptr()
|
||||||
|
);
|
||||||
|
source2Ptr_.reset
|
||||||
|
(
|
||||||
|
fieldValue::New
|
||||||
|
(
|
||||||
|
name_ + ".source2",
|
||||||
|
obr_,
|
||||||
|
dict.subDict("source2"),
|
||||||
|
loadFromFiles_,
|
||||||
|
false
|
||||||
|
).ptr()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldValues::faceSourceDelta::write()
|
void Foam::fieldValues::fieldValueDelta::write()
|
||||||
{
|
{
|
||||||
functionObjectFile::write();
|
functionObjectFile::write();
|
||||||
|
|
||||||
faceSource1_.write();
|
source1Ptr_->write();
|
||||||
faceSource2_.write();
|
source2Ptr_->write();
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
@ -161,13 +172,13 @@ void Foam::fieldValues::faceSourceDelta::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldValues::faceSourceDelta::execute()
|
void Foam::fieldValues::fieldValueDelta::execute()
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldValues::faceSourceDelta::end()
|
void Foam::fieldValues::fieldValueDelta::end()
|
||||||
{
|
{
|
||||||
// Do nothing
|
// Do nothing
|
||||||
}
|
}
|
||||||
@ -22,26 +22,26 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::fieldValues::faceSourceDelta
|
Foam::fieldValues::fieldValueDelta
|
||||||
|
|
||||||
Group
|
Group
|
||||||
grpFieldFunctionObjects
|
grpFieldFunctionObjects
|
||||||
|
|
||||||
Description
|
Description
|
||||||
This function object provides a differencing option between two 'face
|
This function object provides a differencing option between two 'field
|
||||||
source' function objects.
|
value' function objects.
|
||||||
|
|
||||||
Example of function object specification:
|
Example of function object specification:
|
||||||
\verbatim
|
\verbatim
|
||||||
faceSourceDelta1
|
fieldValueDelta1
|
||||||
{
|
{
|
||||||
type faceSourceDelta;
|
type fieldValueDelta;
|
||||||
functionObjectLibs ("libfieldFunctionObjects.so");
|
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||||
faceSource1
|
fieldValue1
|
||||||
{
|
{
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
faceSource2
|
fieldValue2
|
||||||
{
|
{
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
@ -51,22 +51,23 @@ Description
|
|||||||
\heading Function object usage
|
\heading Function object usage
|
||||||
\table
|
\table
|
||||||
Property | Description | Required | Default value
|
Property | Description | Required | Default value
|
||||||
type | type name: faceSourceDelta | yes |
|
type | type name: fieldValueDelta | yes |
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::faceSource
|
Foam::fieldValue
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faceSourceDelta.C
|
fieldValueDelta.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef faceSourceDelta_H
|
#ifndef fieldValueDelta_H
|
||||||
#define faceSourceDelta_H
|
#define fieldValueDelta_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "functionObjectFile.H"
|
||||||
#include "faceSource.H"
|
#include "fieldValue.H"
|
||||||
|
#include "autoPtr.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -77,10 +78,10 @@ namespace fieldValues
|
|||||||
{
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class faceSourceDelta Declaration
|
Class fieldValueDelta Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class faceSourceDelta
|
class fieldValueDelta
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public functionObjectFile
|
||||||
{
|
{
|
||||||
@ -89,17 +90,23 @@ private:
|
|||||||
|
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
//- Name of this fieldValue object
|
||||||
|
word name_;
|
||||||
|
|
||||||
//- Database this class is registered to
|
//- Database this class is registered to
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
|
//- Flag to indicate to load from files
|
||||||
|
bool loadFromFiles_;
|
||||||
|
|
||||||
//- Switch to send output to Info as well as to file
|
//- Switch to send output to Info as well as to file
|
||||||
Switch log_;
|
Switch log_;
|
||||||
|
|
||||||
//- Face source 1
|
//- Field value source object 1
|
||||||
faceSource faceSource1_;
|
autoPtr<fieldValue> source1Ptr_;
|
||||||
|
|
||||||
//- Face source 2
|
//- Field value source object 2
|
||||||
faceSource faceSource2_;
|
autoPtr<fieldValue> source2Ptr_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -126,11 +133,11 @@ protected:
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
//- Run-time type information
|
//- Run-time type information
|
||||||
TypeName("faceSourceDelta");
|
TypeName("fieldValueDelta");
|
||||||
|
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
faceSourceDelta
|
fieldValueDelta
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
@ -140,7 +147,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~faceSourceDelta();
|
virtual ~fieldValueDelta();
|
||||||
|
|
||||||
|
|
||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
@ -169,7 +176,7 @@ public:
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "faceSourceDeltaTemplates.C"
|
#include "fieldValueDeltaTemplates.C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "faceSourceDeltaFunctionObject.H"
|
#include "fieldValueDeltaFunctionObject.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -31,14 +31,14 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
defineNamedTemplateTypeNameAndDebug
|
defineNamedTemplateTypeNameAndDebug
|
||||||
(
|
(
|
||||||
faceSourceDeltaFunctionObject,
|
fieldValueDeltaFunctionObject,
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
addToRunTimeSelectionTable
|
addToRunTimeSelectionTable
|
||||||
(
|
(
|
||||||
functionObject,
|
functionObject,
|
||||||
faceSourceDeltaFunctionObject,
|
fieldValueDeltaFunctionObject,
|
||||||
dictionary
|
dictionary
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -22,29 +22,29 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Typedef
|
Typedef
|
||||||
Foam::faceSourceDeltaFunctionObject
|
Foam::fieldValueDeltaFunctionObject
|
||||||
|
|
||||||
Description
|
Description
|
||||||
FunctionObject wrapper around faceSourceDelta to allow it to be
|
FunctionObject wrapper around fieldValueDelta to allow it to be
|
||||||
created via the functions entry within controlDict.
|
created via the functions entry within controlDict.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faceSourceDeltaFunctionObject.C
|
fieldValueDeltaFunctionObject.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef faceSourceDeltaFunctionObject_H
|
#ifndef fieldValueDeltaFunctionObject_H
|
||||||
#define faceSourceDeltaFunctionObject_H
|
#define fieldValueDeltaFunctionObject_H
|
||||||
|
|
||||||
#include "faceSourceDelta.H"
|
#include "fieldValueDelta.H"
|
||||||
#include "OutputFilterFunctionObject.H"
|
#include "OutputFilterFunctionObject.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
typedef OutputFilterFunctionObject<fieldValues::faceSourceDelta>
|
typedef OutputFilterFunctionObject<fieldValues::fieldValueDelta>
|
||||||
faceSourceDeltaFunctionObject;
|
fieldValueDeltaFunctionObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -23,17 +23,20 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "GeometricField.H"
|
||||||
|
#include "volMesh.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fieldValues::faceSourceDelta::processFields(bool& found)
|
void Foam::fieldValues::fieldValueDelta::processFields(bool& found)
|
||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||||
|
|
||||||
const wordList& fields1 = faceSource1_.fields();
|
const wordList& fields1 = source1Ptr_->fields();
|
||||||
|
|
||||||
const dictionary& results1 = faceSource1_.resultDict();
|
const dictionary& results1 = source1Ptr_->resultDict();
|
||||||
const dictionary& results2 = faceSource2_.resultDict();
|
const dictionary& results2 = source2Ptr_->resultDict();
|
||||||
|
|
||||||
Type r1(pTraits<Type>::zero);
|
Type r1(pTraits<Type>::zero);
|
||||||
Type r2(pTraits<Type>::zero);
|
Type r2(pTraits<Type>::zero);
|
||||||
Reference in New Issue
Block a user