mirror of
https://github.com/OpenFOAM/OpenFOAM-6.git
synced 2025-12-08 06:57:46 +00:00
functionObjects: rewritten to all be derived from 'functionObject'
- Avoids the need for the 'OutputFilterFunctionObject' wrapper
- Time-control for execution and writing is now provided by the
'timeControlFunctionObject' which instantiates the processing
'functionObject' and controls its operation.
- Alternative time-control functionObjects can now be written and
selected at run-time without the need to compile wrapped version of
EVERY existing functionObject which would have been required in the
old structure.
- The separation of 'execute' and 'write' functions is now formalized in the
'functionObject' base-class and all derived classes implement the
two functions.
- Unnecessary implementations of functions with appropriate defaults
in the 'functionObject' base-class have been removed reducing
clutter and simplifying implementation of new functionObjects.
- The 'coded' 'functionObject' has also been updated, simplified and tested.
- Further simplification is now possible by creating some general
intermediate classes derived from 'functionObject'.
This commit is contained in:
@ -2,11 +2,11 @@ EXE_INC = \
|
|||||||
-IfoamToVTK/lnInclude \
|
-IfoamToVTK/lnInclude \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
EXE_LIBS = \
|
EXE_LIBS = \
|
||||||
-lfoamToVTK \
|
-lfoamToVTK \
|
||||||
-lfiniteVolume \
|
-ldynamicMesh \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-lgenericPatchFields \
|
-lgenericPatchFields
|
||||||
-lmeshTools
|
|
||||||
|
|||||||
@ -10,6 +10,5 @@ vtkMesh.C
|
|||||||
vtkTopo.C
|
vtkTopo.C
|
||||||
|
|
||||||
writeVTK/writeVTK.C
|
writeVTK/writeVTK.C
|
||||||
writeVTK/writeVTKFunctionObject.C
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libfoamToVTK
|
LIB = $(FOAM_LIBBIN)/libfoamToVTK
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
EXE_INC = \
|
EXE_INC = \
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||||
|
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude
|
-I$(LIB_SRC)/meshTools/lnInclude
|
||||||
|
|
||||||
LIB_LIBS = \
|
LIB_LIBS = \
|
||||||
-lfiniteVolume \
|
-ldynamicMesh \
|
||||||
-llagrangian \
|
-llagrangian \
|
||||||
-lgenericPatchFields \
|
-lgenericPatchFields
|
||||||
-lmeshTools
|
|
||||||
|
|||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "vtkMesh.H"
|
#include "vtkMesh.H"
|
||||||
#include "internalWriter.H"
|
#include "internalWriter.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(writeVTK, 0);
|
defineTypeNameAndDebug(writeVTK, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, writeVTK, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -45,16 +47,22 @@ namespace functionObjects
|
|||||||
Foam::functionObjects::writeVTK::writeVTK
|
Foam::functionObjects::writeVTK::writeVTK
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& t,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
functionObject(name),
|
||||||
obr_(obr),
|
time_(t),
|
||||||
|
obr_
|
||||||
|
(
|
||||||
|
time_.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
),
|
||||||
objectNames_()
|
objectNames_()
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -72,27 +80,23 @@ Foam::functionObjects::writeVTK::~writeVTK()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::writeVTK::read(const dictionary& dict)
|
bool Foam::functionObjects::writeVTK::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup("objectNames") >> objectNames_;
|
dict.lookup("objectNames") >> objectNames_;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::writeVTK::execute()
|
bool Foam::functionObjects::writeVTK::execute(const bool postProcess)
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::writeVTK::end()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::writeVTK::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::writeVTK::write()
|
|
||||||
{
|
{
|
||||||
Info<< type() << " " << name_ << " output:" << nl;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::writeVTK::write(const bool postProcess)
|
||||||
|
{
|
||||||
|
Info<< type() << " " << name() << " output:" << nl;
|
||||||
|
|
||||||
fvMesh& mesh = const_cast<fvMesh&>(refCast<const fvMesh>(obr_));
|
fvMesh& mesh = const_cast<fvMesh&>(refCast<const fvMesh>(obr_));
|
||||||
|
|
||||||
@ -162,6 +166,8 @@ void Foam::functionObjects::writeVTK::write()
|
|||||||
writer.write(vsptf);
|
writer.write(vsptf);
|
||||||
writer.write(vstf);
|
writer.write(vstf);
|
||||||
writer.write(vtf);
|
writer.write(vtf);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -55,7 +55,7 @@ Description
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
Foam::functionObjects::timeControl
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
writeVTK.C
|
writeVTK.C
|
||||||
@ -66,8 +66,8 @@ SourceFiles
|
|||||||
#ifndef functionObjects_writeVTK_H
|
#ifndef functionObjects_writeVTK_H
|
||||||
#define functionObjects_writeVTK_H
|
#define functionObjects_writeVTK_H
|
||||||
|
|
||||||
|
#include "functionObject.H"
|
||||||
#include "wordReList.H"
|
#include "wordReList.H"
|
||||||
#include "runTimeSelectionTables.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -75,10 +75,8 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
|
class Time;
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
class polyMesh;
|
|
||||||
class mapPolyMesh;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
@ -88,13 +86,15 @@ namespace functionObjects
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class writeVTK
|
class writeVTK
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of this set of writeVTK
|
//- Reference to the Time
|
||||||
word name_;
|
const Time& time_;
|
||||||
|
|
||||||
//- Refererence to Db
|
//- Refererence to objectRegistry
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- Names of objects
|
//- Names of objects
|
||||||
@ -121,14 +121,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
//- Construct from Time and dictionary
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
writeVTK
|
writeVTK
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& t,
|
||||||
const dictionary&,
|
const dictionary&
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -138,34 +136,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the writeVTK
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the writeVTK data
|
//- Read the writeVTK data
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- 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();
|
|
||||||
|
|
||||||
//- Write the writeVTK
|
//- Write the writeVTK
|
||||||
virtual void write();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void updateMesh(const mapPolyMesh&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void movePoints(const polyMesh&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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 "writeVTKFunctionObject.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
defineNamedTemplateTypeNameAndDebug
|
|
||||||
(
|
|
||||||
writeVTKFunctionObject,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
|
|
||||||
addToRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
functionObject,
|
|
||||||
writeVTKFunctionObject,
|
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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::writeVTKFunctionObject
|
|
||||||
|
|
||||||
Description
|
|
||||||
FunctionObject wrapper around writeVTK to allow them to be
|
|
||||||
created via the functions entry within controlDict.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
writeVTKFunctionObject.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef writeVTKFunctionObject_H
|
|
||||||
#define writeVTKFunctionObject_H
|
|
||||||
|
|
||||||
#include "writeVTK.H"
|
|
||||||
#include "OutputFilterFunctionObject.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
typedef OutputFilterFunctionObject<functionObjects::writeVTK>
|
|
||||||
writeVTKFunctionObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
dsmcFieldsCalc.C
|
|
||||||
|
|
||||||
EXE = $(FOAM_APPBIN)/dsmcFieldsCalc
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
EXE_INC = \
|
|
||||||
-I$(LIB_SRC)/postProcessing/postCalc \
|
|
||||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
|
||||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
|
||||||
-I$(LIB_SRC)/postProcessing/functionObjects/utilities/lnInclude \
|
|
||||||
-I$(LIB_SRC)/lagrangian/DSMC/lnInclude \
|
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude
|
|
||||||
|
|
||||||
EXE_LIBS = \
|
|
||||||
$(FOAM_LIBBIN)/postCalc.o \
|
|
||||||
-lmeshTools \
|
|
||||||
-lfiniteVolume \
|
|
||||||
-lutilityFunctionObjects \
|
|
||||||
-llagrangian \
|
|
||||||
-lDSMC
|
|
||||||
@ -1,155 +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/>.
|
|
||||||
|
|
||||||
Application
|
|
||||||
dsmcFieldsCalc
|
|
||||||
|
|
||||||
Description
|
|
||||||
Calculate intensive fields (U and T) from averaged extensive fields from a
|
|
||||||
DSMC calculation.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "calc.H"
|
|
||||||
#include "fvc.H"
|
|
||||||
#include "dsmcCloud.H"
|
|
||||||
#include "dsmcFields.H"
|
|
||||||
#include "IOobjectList.H"
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
template<class Type>
|
|
||||||
bool addFieldsToList
|
|
||||||
(
|
|
||||||
const fvMesh& mesh,
|
|
||||||
PtrList<GeometricField<Type, fvPatchField, volMesh>>& list,
|
|
||||||
const wordList& fieldNames
|
|
||||||
)
|
|
||||||
{
|
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
|
|
||||||
|
|
||||||
label index = 0;
|
|
||||||
forAll(fieldNames, i)
|
|
||||||
{
|
|
||||||
IOobject obj
|
|
||||||
(
|
|
||||||
fieldNames[i],
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::MUST_READ
|
|
||||||
);
|
|
||||||
|
|
||||||
if (obj.headerOk() && obj.headerClassName() == fieldType::typeName)
|
|
||||||
{
|
|
||||||
list.set(index++, new fieldType(obj, mesh));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info<< "Could not find " << fieldNames[i] << endl;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh)
|
|
||||||
{
|
|
||||||
bool writeResults = !args.optionFound("noWrite");
|
|
||||||
|
|
||||||
wordList extensiveVSFNames
|
|
||||||
(
|
|
||||||
IStringStream
|
|
||||||
(
|
|
||||||
"( \
|
|
||||||
rhoNMean \
|
|
||||||
rhoMMean \
|
|
||||||
linearKEMean \
|
|
||||||
internalEMean \
|
|
||||||
iDofMean \
|
|
||||||
)"
|
|
||||||
)()
|
|
||||||
);
|
|
||||||
|
|
||||||
PtrList<volScalarField> extensiveVSFs(extensiveVSFNames.size());
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!addFieldsToList
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
extensiveVSFs,
|
|
||||||
extensiveVSFNames
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wordList extensiveVVFNames
|
|
||||||
(
|
|
||||||
IStringStream
|
|
||||||
(
|
|
||||||
"( \
|
|
||||||
momentumMean \
|
|
||||||
fDMean \
|
|
||||||
)"
|
|
||||||
)()
|
|
||||||
);
|
|
||||||
|
|
||||||
PtrList<volVectorField> extensiveVVFs(extensiveVVFNames.size());
|
|
||||||
|
|
||||||
if
|
|
||||||
(
|
|
||||||
!addFieldsToList
|
|
||||||
(
|
|
||||||
mesh,
|
|
||||||
extensiveVVFs,
|
|
||||||
extensiveVVFNames
|
|
||||||
)
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
functionObjects::dsmcFields dF
|
|
||||||
(
|
|
||||||
"dsmcFieldsUtility",
|
|
||||||
mesh,
|
|
||||||
dictionary::null,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
|
|
||||||
if (writeResults)
|
|
||||||
{
|
|
||||||
dF.write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -82,7 +82,7 @@ SeeAlso
|
|||||||
#include "noiseFFT.H"
|
#include "noiseFFT.H"
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "functionObjectFiles.H"
|
#include "writeFiles.H"
|
||||||
#include "CSV.H"
|
#include "CSV.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -1,65 +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 "FilterFunctionObjectTemplate.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
// dynamicCode:
|
|
||||||
// SHA1 = ${SHA1sum}
|
|
||||||
//
|
|
||||||
// unique function name that can be checked if the correct library version
|
|
||||||
// has been loaded
|
|
||||||
void ${typeName}_${SHA1sum}(bool load)
|
|
||||||
{
|
|
||||||
if (load)
|
|
||||||
{
|
|
||||||
// code that can be explicitly executed after loading
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// code that can be explicitly executed before unloading
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
defineNamedTemplateTypeNameAndDebug(${typeName}FilterFunctionObject, 0);
|
|
||||||
|
|
||||||
//addToRunTimeSelectionTable
|
|
||||||
addRemovableToRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
functionObject,
|
|
||||||
${typeName}FilterFunctionObject,
|
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,51 +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/>.
|
|
||||||
|
|
||||||
Description
|
|
||||||
FunctionObject wrapper around functionObjectTemplate to allow them
|
|
||||||
to be created via the functions entry within controlDict.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
FilterFunctionObject.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef FilterFunctionObject_H
|
|
||||||
#define FilterFunctionObject_H
|
|
||||||
|
|
||||||
#include "functionObjectTemplate.H"
|
|
||||||
#include "OutputFilterFunctionObject.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
typedef OutputFilterFunctionObject<${typeName}FunctionObject>
|
|
||||||
${typeName}FilterFunctionObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -24,9 +24,9 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "functionObjectTemplate.H"
|
#include "functionObjectTemplate.H"
|
||||||
#include "Time.H"
|
|
||||||
#include "fvCFD.H"
|
#include "fvCFD.H"
|
||||||
#include "unitConversion.H"
|
#include "unitConversion.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -37,6 +37,36 @@ namespace Foam
|
|||||||
|
|
||||||
defineTypeNameAndDebug(${typeName}FunctionObject, 0);
|
defineTypeNameAndDebug(${typeName}FunctionObject, 0);
|
||||||
|
|
||||||
|
addRemovableToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
${typeName}FunctionObject,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
// dynamicCode:
|
||||||
|
// SHA1 = ${SHA1sum}
|
||||||
|
//
|
||||||
|
// unique function name that can be checked if the correct library version
|
||||||
|
// has been loaded
|
||||||
|
void ${typeName}_${SHA1sum}(bool load)
|
||||||
|
{
|
||||||
|
if (load)
|
||||||
|
{
|
||||||
|
// code that can be explicitly executed after loading
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// code that can be explicitly executed before unloading
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Local Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -64,13 +94,18 @@ const fvMesh& ${typeName}FunctionObject::mesh() const
|
|||||||
${typeName}FunctionObject::${typeName}FunctionObject
|
${typeName}FunctionObject::${typeName}FunctionObject
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
functionObject(name),
|
||||||
obr_(obr)
|
obr_
|
||||||
|
(
|
||||||
|
runTime.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
}
|
}
|
||||||
@ -84,7 +119,7 @@ ${typeName}FunctionObject::~${typeName}FunctionObject()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void ${typeName}FunctionObject::read(const dictionary& dict)
|
bool ${typeName}FunctionObject::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose:-false})
|
||||||
{
|
{
|
||||||
@ -94,10 +129,12 @@ void ${typeName}FunctionObject::read(const dictionary& dict)
|
|||||||
//{{{ begin code
|
//{{{ begin code
|
||||||
${codeRead}
|
${codeRead}
|
||||||
//}}} end code
|
//}}} end code
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ${typeName}FunctionObject::execute()
|
bool ${typeName}FunctionObject::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose:-false})
|
||||||
{
|
{
|
||||||
@ -107,10 +144,12 @@ void ${typeName}FunctionObject::execute()
|
|||||||
//{{{ begin code
|
//{{{ begin code
|
||||||
${codeExecute}
|
${codeExecute}
|
||||||
//}}} end code
|
//}}} end code
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ${typeName}FunctionObject::end()
|
bool ${typeName}FunctionObject::end()
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose:-false})
|
||||||
{
|
{
|
||||||
@ -120,10 +159,12 @@ void ${typeName}FunctionObject::end()
|
|||||||
//{{{ begin code
|
//{{{ begin code
|
||||||
${codeEnd}
|
${codeEnd}
|
||||||
//}}} end code
|
//}}} end code
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ${typeName}FunctionObject::timeSet()
|
bool ${typeName}FunctionObject::timeSet()
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose:-false})
|
||||||
{
|
{
|
||||||
@ -133,10 +174,12 @@ void ${typeName}FunctionObject::timeSet()
|
|||||||
//{{{ begin codeTime
|
//{{{ begin codeTime
|
||||||
${codeTimeSet}
|
${codeTimeSet}
|
||||||
//}}} end code
|
//}}} end code
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ${typeName}FunctionObject::write()
|
bool ${typeName}FunctionObject::write(const bool postProcess)
|
||||||
{
|
{
|
||||||
if (${verbose:-false})
|
if (${verbose:-false})
|
||||||
{
|
{
|
||||||
@ -146,11 +189,13 @@ void ${typeName}FunctionObject::write()
|
|||||||
//{{{ begin code
|
//{{{ begin code
|
||||||
${code}
|
${code}
|
||||||
//}}} end code
|
//}}} end code
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -33,8 +33,7 @@ SourceFiles
|
|||||||
#ifndef functionObjectTemplate_H
|
#ifndef functionObjectTemplate_H
|
||||||
#define functionObjectTemplate_H
|
#define functionObjectTemplate_H
|
||||||
|
|
||||||
#include "stringList.H"
|
#include "functionObject.H"
|
||||||
#include "pointField.H"
|
|
||||||
|
|
||||||
//{{{ begin codeInclude
|
//{{{ begin codeInclude
|
||||||
${codeInclude}
|
${codeInclude}
|
||||||
@ -47,9 +46,6 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
class polyMesh;
|
|
||||||
class mapPolyMesh;
|
|
||||||
class fvMesh;
|
class fvMesh;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
@ -57,13 +53,12 @@ class fvMesh;
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class ${typeName}FunctionObject
|
class ${typeName}FunctionObject
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of this set of system calls
|
//- Reference to the objectRegistry
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Registry
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//{{{ begin codeData
|
//{{{ begin codeData
|
||||||
@ -92,14 +87,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
//- Construct from Time and dictionary
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
${typeName}FunctionObject
|
${typeName}FunctionObject
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& unused,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary&
|
||||||
const bool loadFromFilesUnused = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -109,34 +102,20 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the system call set
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the system calls
|
//- Read the system calls
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute the "executeCalls" at each time-step
|
//- Execute the "executeCalls" at each time-step
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute the "endCalls" at the final time-loop
|
//- Execute the "endCalls" at the final time-loop
|
||||||
virtual void end();
|
virtual bool end();
|
||||||
|
|
||||||
//- Write, execute the "writeCalls"
|
//- Write, execute the "writeCalls"
|
||||||
virtual void write();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- Called when time was set at the end of the Time::operator++
|
//- Called when time was set at the end of the Time::operator++
|
||||||
virtual void timeSet();
|
virtual bool timeSet();
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void updateMesh(const mapPolyMesh&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void movePoints(const polyMesh&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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::FUNCTIONOBJECTFunctionObject
|
|
||||||
|
|
||||||
Description
|
|
||||||
FunctionObject wrapper around FUNCTIONOBJECT to allow them to be
|
|
||||||
created via the functions entry within controlDict.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
FUNCTIONOBJECTFunctionObject.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef FUNCTIONOBJECTFunctionObject_H
|
|
||||||
#define FUNCTIONOBJECTFunctionObject_H
|
|
||||||
|
|
||||||
#include "FUNCTIONOBJECT.H"
|
|
||||||
#include "OutputFilterFunctionObject.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
typedef OutputFilterFunctionObject<FUNCTIONOBJECT>
|
|
||||||
FUNCTIONOBJECTFunctionObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,245 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "OutputFilterFunctionObject.H"
|
|
||||||
#include "polyMesh.H"
|
|
||||||
#include "mapPolyMesh.H"
|
|
||||||
#include "addToRunTimeSelectionTable.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Private Members * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
void Foam::OutputFilterFunctionObject<OutputFilter>::readControls()
|
|
||||||
{
|
|
||||||
dict_.readIfPresent("timeStart", timeStart_);
|
|
||||||
dict_.readIfPresent("timeEnd", timeEnd_);
|
|
||||||
dict_.readIfPresent("nStepsToStartTimeChange", nStepsToStartTimeChange_);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::active() const
|
|
||||||
{
|
|
||||||
return
|
|
||||||
time_.value() >= timeStart_
|
|
||||||
&& time_.value() <= timeEnd_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
Foam::OutputFilterFunctionObject<OutputFilter>::OutputFilterFunctionObject
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Time& t,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
functionObject(name),
|
|
||||||
time_(t),
|
|
||||||
dict_(dict),
|
|
||||||
timeStart_(-VGREAT),
|
|
||||||
timeEnd_(VGREAT),
|
|
||||||
nStepsToStartTimeChange_
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("nStepsToStartTimeChange", 3)
|
|
||||||
),
|
|
||||||
writeControl_(t, dict, "write"),
|
|
||||||
evaluateControl_(t, dict, "evaluate"),
|
|
||||||
filter_
|
|
||||||
(
|
|
||||||
name,
|
|
||||||
time_.lookupObject<objectRegistry>
|
|
||||||
(
|
|
||||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
|
||||||
),
|
|
||||||
dict_
|
|
||||||
)
|
|
||||||
{
|
|
||||||
readControls();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::execute
|
|
||||||
(
|
|
||||||
const bool postProcess
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (active())
|
|
||||||
{
|
|
||||||
if (postProcess || evaluateControl_.execute())
|
|
||||||
{
|
|
||||||
filter_.execute();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::write
|
|
||||||
(
|
|
||||||
const bool postProcess
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (active())
|
|
||||||
{
|
|
||||||
if (postProcess || writeControl_.execute())
|
|
||||||
{
|
|
||||||
filter_.write();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::end()
|
|
||||||
{
|
|
||||||
filter_.end();
|
|
||||||
|
|
||||||
if (writeControl_.execute())
|
|
||||||
{
|
|
||||||
filter_.write();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::timeSet()
|
|
||||||
{
|
|
||||||
if (active())
|
|
||||||
{
|
|
||||||
filter_.timeSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::adjustTimeStep()
|
|
||||||
{
|
|
||||||
if
|
|
||||||
(
|
|
||||||
active()
|
|
||||||
&& writeControl_.control()
|
|
||||||
== timeControl::ocAdjustableRunTime
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const label writeTimeIndex = writeControl_.executionIndex();
|
|
||||||
const scalar writeInterval = writeControl_.interval();
|
|
||||||
|
|
||||||
scalar timeToNextWrite = max
|
|
||||||
(
|
|
||||||
0.0,
|
|
||||||
(writeTimeIndex + 1)*writeInterval
|
|
||||||
- (time_.value() - time_.startTime().value())
|
|
||||||
);
|
|
||||||
|
|
||||||
scalar deltaT = time_.deltaTValue();
|
|
||||||
|
|
||||||
scalar nSteps = timeToNextWrite/deltaT - SMALL;
|
|
||||||
|
|
||||||
// functionObjects modify deltaT within nStepsToStartTimeChange
|
|
||||||
// NOTE: Potential problems arise if two function objects dump within
|
|
||||||
// the same interval
|
|
||||||
if (nSteps < nStepsToStartTimeChange_)
|
|
||||||
{
|
|
||||||
label nStepsToNextWrite = label(nSteps) + 1;
|
|
||||||
|
|
||||||
scalar newDeltaT = timeToNextWrite/nStepsToNextWrite;
|
|
||||||
|
|
||||||
// Adjust time step
|
|
||||||
if (newDeltaT < deltaT)
|
|
||||||
{
|
|
||||||
deltaT = max(newDeltaT, 0.2*deltaT);
|
|
||||||
const_cast<Time&>(time_).setDeltaT(deltaT, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
bool Foam::OutputFilterFunctionObject<OutputFilter>::read
|
|
||||||
(
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (dict != dict_)
|
|
||||||
{
|
|
||||||
dict_ = dict;
|
|
||||||
|
|
||||||
writeControl_.read(dict);
|
|
||||||
evaluateControl_.read(dict);
|
|
||||||
readControls();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
void Foam::OutputFilterFunctionObject<OutputFilter>::updateMesh
|
|
||||||
(
|
|
||||||
const mapPolyMesh& mpm
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (active())
|
|
||||||
{
|
|
||||||
filter_.updateMesh(mpm);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
void Foam::OutputFilterFunctionObject<OutputFilter>::movePoints
|
|
||||||
(
|
|
||||||
const polyMesh& mesh
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if (active())
|
|
||||||
{
|
|
||||||
filter_.movePoints(mesh);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,197 +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/>.
|
|
||||||
|
|
||||||
Class
|
|
||||||
Foam::OutputFilterFunctionObject
|
|
||||||
|
|
||||||
Description
|
|
||||||
A functionObject wrapper around OutputFilter to allow them to be
|
|
||||||
created via the functions entry within controlDict.
|
|
||||||
|
|
||||||
Note
|
|
||||||
Since the timeIndex is used directly from Foam::Time, it is unaffected
|
|
||||||
by user-time conversions. For example, Foam::engineTime might cause \a
|
|
||||||
writeInterval to be degrees crank angle, but the functionObject
|
|
||||||
execution \a interval would still be in timestep.
|
|
||||||
|
|
||||||
SourceFiles
|
|
||||||
OutputFilterFunctionObject.C
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#ifndef OutputFilterFunctionObject_H
|
|
||||||
#define OutputFilterFunctionObject_H
|
|
||||||
|
|
||||||
#include "functionObject.H"
|
|
||||||
#include "dictionary.H"
|
|
||||||
#include "timeControl.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
Class OutputFilterFunctionObject Declaration
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
class OutputFilterFunctionObject
|
|
||||||
:
|
|
||||||
public functionObject
|
|
||||||
{
|
|
||||||
// Private data
|
|
||||||
|
|
||||||
//- Reference to the time database
|
|
||||||
const Time& time_;
|
|
||||||
|
|
||||||
//- Input dictionary
|
|
||||||
dictionary dict_;
|
|
||||||
|
|
||||||
|
|
||||||
// Optional user inputs
|
|
||||||
|
|
||||||
//- Activation time - defaults to -VGREAT
|
|
||||||
scalar timeStart_;
|
|
||||||
|
|
||||||
//- De-activation time - defaults to VGREAT
|
|
||||||
scalar timeEnd_;
|
|
||||||
|
|
||||||
//- Number of steps before the dump-time during which deltaT
|
|
||||||
// may be changed (valid for adjustableRunTime)
|
|
||||||
label nStepsToStartTimeChange_;
|
|
||||||
|
|
||||||
|
|
||||||
//- Output controls
|
|
||||||
timeControl writeControl_;
|
|
||||||
|
|
||||||
//- Evaluate controls
|
|
||||||
timeControl evaluateControl_;
|
|
||||||
|
|
||||||
//- The output filter
|
|
||||||
OutputFilter filter_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
|
||||||
|
|
||||||
//- Read relevant dictionary entries
|
|
||||||
void readControls();
|
|
||||||
|
|
||||||
//- Returns true if within time bounds
|
|
||||||
bool active() const;
|
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
|
||||||
OutputFilterFunctionObject(const OutputFilterFunctionObject&);
|
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
|
||||||
void operator=(const OutputFilterFunctionObject&);
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
//- Runtime type information
|
|
||||||
TypeName(OutputFilter::typeName_());
|
|
||||||
|
|
||||||
|
|
||||||
// Constructors
|
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
OutputFilterFunctionObject
|
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const Time&,
|
|
||||||
const dictionary&
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return time database
|
|
||||||
inline const Time& time() const;
|
|
||||||
|
|
||||||
//- Return the input dictionary
|
|
||||||
inline const dictionary& dict() const;
|
|
||||||
|
|
||||||
//- Return the region name
|
|
||||||
inline const word& regionName() const;
|
|
||||||
|
|
||||||
//- Return the output control object
|
|
||||||
inline const timeControl& writeControl() const;
|
|
||||||
|
|
||||||
//- Return the output filter
|
|
||||||
inline const OutputFilter& outputFilter() const;
|
|
||||||
|
|
||||||
|
|
||||||
// Function object control
|
|
||||||
|
|
||||||
//- Called at each ++ or += of the time-loop.
|
|
||||||
// postProcess overrides the usual executeControl behaviour and
|
|
||||||
// forces execution (used in post-processing mode)
|
|
||||||
virtual bool execute(const bool postProcess = false);
|
|
||||||
|
|
||||||
//- Called at each ++ or += of the time-loop.
|
|
||||||
// postProcess overrides the usual writeControl behaviour and
|
|
||||||
// forces writing (used in post-processing mode)
|
|
||||||
virtual bool write(const bool postProcess = false);
|
|
||||||
|
|
||||||
//- Called when Time::run() determines that the time-loop exits
|
|
||||||
virtual bool end();
|
|
||||||
|
|
||||||
//- Called when time was set at the end of the Time::operator++
|
|
||||||
virtual bool timeSet();
|
|
||||||
|
|
||||||
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
|
||||||
virtual bool adjustTimeStep();
|
|
||||||
|
|
||||||
//- Read and set the function object if its data have changed
|
|
||||||
virtual bool read(const dictionary&);
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void updateMesh(const mapPolyMesh& mpm);
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void movePoints(const polyMesh& mesh);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
} // End namespace Foam
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#include "OutputFilterFunctionObjectI.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#ifdef NoRepository
|
|
||||||
#include "OutputFilterFunctionObject.C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -1,60 +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/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
inline const Foam::Time&
|
|
||||||
Foam::OutputFilterFunctionObject<OutputFilter>::time() const
|
|
||||||
{
|
|
||||||
return time_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
inline const Foam::dictionary&
|
|
||||||
Foam::OutputFilterFunctionObject<OutputFilter>::dict() const
|
|
||||||
{
|
|
||||||
return dict_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
inline const Foam::timeControl&
|
|
||||||
Foam::OutputFilterFunctionObject<OutputFilter>::writeControl() const
|
|
||||||
{
|
|
||||||
return writeControl_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class OutputFilter>
|
|
||||||
inline const OutputFilter&
|
|
||||||
Foam::OutputFilterFunctionObject<OutputFilter>::outputFilter() const
|
|
||||||
{
|
|
||||||
return filter_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -51,10 +51,10 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
|||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const Time& t,
|
const Time& t,
|
||||||
const dictionary& functionDict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const word functionType(functionDict.lookup("type"));
|
const word functionType(dict.lookup("type"));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
|||||||
|
|
||||||
const_cast<Time&>(t).libs().open
|
const_cast<Time&>(t).libs().open
|
||||||
(
|
(
|
||||||
functionDict,
|
dict,
|
||||||
"functionObjectLibs",
|
"functionObjectLibs",
|
||||||
dictionaryConstructorTablePtr_
|
dictionaryConstructorTablePtr_
|
||||||
);
|
);
|
||||||
@ -90,7 +90,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<functionObject>(cstrIter()(name, t, functionDict));
|
return autoPtr<functionObject>(cstrIter()(name, t, dict));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -126,4 +126,12 @@ bool Foam::functionObject::adjustTimeStep()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObject::updateMesh(const mapPolyMesh&)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::functionObject::movePoints(const polyMesh&)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -99,7 +99,8 @@ Description
|
|||||||
Abstract base-class for Time/database function objects.
|
Abstract base-class for Time/database function objects.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
Foam::OutputFilterFunctionObject
|
Foam::functionObjectList
|
||||||
|
Foam::functionObjects::timeControl
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
functionObject.C
|
functionObject.C
|
||||||
@ -194,8 +195,11 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Name
|
//- Return the name of this functionObject
|
||||||
virtual const word& name() const;
|
const word& name() const;
|
||||||
|
|
||||||
|
//- Read and set the function object if its data have changed
|
||||||
|
virtual bool read(const dictionary&) = 0;
|
||||||
|
|
||||||
//- Called at each ++ or += of the time-loop.
|
//- Called at each ++ or += of the time-loop.
|
||||||
// postProcess overrides the usual executeControl behaviour and
|
// postProcess overrides the usual executeControl behaviour and
|
||||||
@ -217,14 +221,11 @@ public:
|
|||||||
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
||||||
virtual bool adjustTimeStep();
|
virtual bool adjustTimeStep();
|
||||||
|
|
||||||
//- Read and set the function object if its data have changed
|
//- Update for changes of mesh
|
||||||
virtual bool read(const dictionary&) = 0;
|
virtual void updateMesh(const mapPolyMesh& mpm);
|
||||||
|
|
||||||
//- Update for changes of mesh
|
//- Update for changes of mesh
|
||||||
virtual void updateMesh(const mapPolyMesh& mpm) = 0;
|
virtual void movePoints(const polyMesh& mesh);
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void movePoints(const polyMesh& mesh) = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "mapPolyMesh.H"
|
#include "mapPolyMesh.H"
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
|
#include "timeControlFunctionObject.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -353,9 +354,23 @@ bool Foam::functionObjectList::read()
|
|||||||
FatalError.throwExceptions();
|
FatalError.throwExceptions();
|
||||||
FatalIOError.throwExceptions();
|
FatalIOError.throwExceptions();
|
||||||
try
|
try
|
||||||
|
{
|
||||||
|
if
|
||||||
|
(
|
||||||
|
dict.found("writeControl")
|
||||||
|
|| dict.found("outputControl")
|
||||||
|
)
|
||||||
|
{
|
||||||
|
foPtr.set
|
||||||
|
(
|
||||||
|
new functionObjects::timeControl(key, time_, dict)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
foPtr = functionObject::New(key, time_, dict);
|
foPtr = functionObject::New(key, time_, dict);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (Foam::IOerror& ioErr)
|
catch (Foam::IOerror& ioErr)
|
||||||
{
|
{
|
||||||
Info<< ioErr << nl << endl;
|
Info<< ioErr << nl << endl;
|
||||||
|
|||||||
@ -29,7 +29,8 @@ Description
|
|||||||
that is called for each object.
|
that is called for each object.
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
Foam::functionObject and Foam::OutputFilterFunctionObject
|
Foam::functionObject
|
||||||
|
Foam::functionObjects::timeControl
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
functionObjectList.C
|
functionObjectList.C
|
||||||
@ -158,6 +159,9 @@ public:
|
|||||||
//- Find the ID of a given function object by name
|
//- Find the ID of a given function object by name
|
||||||
label findObjectID(const word& name) const;
|
label findObjectID(const word& name) const;
|
||||||
|
|
||||||
|
//- Read and set the function objects if their data have changed
|
||||||
|
bool read();
|
||||||
|
|
||||||
//- Switch the function objects on
|
//- Switch the function objects on
|
||||||
void on();
|
void on();
|
||||||
|
|
||||||
@ -184,9 +188,6 @@ public:
|
|||||||
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
||||||
bool adjustTimeStep();
|
bool adjustTimeStep();
|
||||||
|
|
||||||
//- Read and set the function objects if their data have changed
|
|
||||||
bool read();
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
//- Update for changes of mesh
|
||||||
void updateMesh(const mapPolyMesh& mpm);
|
void updateMesh(const mapPolyMesh& mpm);
|
||||||
|
|
||||||
|
|||||||
@ -23,27 +23,31 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "writeFile.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "polyMesh.H"
|
#include "polyMesh.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::word Foam::functionObjectFile::outputPrefix = "postProcessing";
|
const Foam::word Foam::functionObjects::writeFile::outputPrefix
|
||||||
Foam::label Foam::functionObjectFile::addChars = 7;
|
(
|
||||||
|
"postProcessing"
|
||||||
|
);
|
||||||
|
|
||||||
|
Foam::label Foam::functionObjects::writeFile::addChars = 7;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjectFile::initStream(Ostream& os) const
|
void Foam::functionObjects::writeFile::initStream(Ostream& os) const
|
||||||
{
|
{
|
||||||
os.setf(ios_base::scientific, ios_base::floatfield);
|
os.setf(ios_base::scientific, ios_base::floatfield);
|
||||||
os.width(charWidth());
|
os.width(charWidth());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName Foam::functionObjectFile::baseFileDir() const
|
Foam::fileName Foam::functionObjects::writeFile::baseFileDir() const
|
||||||
{
|
{
|
||||||
fileName baseDir = obr_.time().path();
|
fileName baseDir = obr_.time().path();
|
||||||
|
|
||||||
@ -72,17 +76,20 @@ Foam::fileName Foam::functionObjectFile::baseFileDir() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::fileName Foam::functionObjectFile::baseTimeDir() const
|
Foam::fileName Foam::functionObjects::writeFile::baseTimeDir() const
|
||||||
{
|
{
|
||||||
return baseFileDir()/prefix_/obr_.time().timeName();
|
return baseFileDir()/prefix_/obr_.time().timeName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFile::writeFileHeader(const label i)
|
void Foam::functionObjects::writeFile::writeFileHeader(const label i)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::Omanip<int> Foam::functionObjectFile::valueWidth(const label offset) const
|
Foam::Omanip<int> Foam::functionObjects::writeFile::valueWidth
|
||||||
|
(
|
||||||
|
const label offset
|
||||||
|
) const
|
||||||
{
|
{
|
||||||
return setw(IOstream::defaultPrecision() + addChars + offset);
|
return setw(IOstream::defaultPrecision() + addChars + offset);
|
||||||
}
|
}
|
||||||
@ -90,32 +97,67 @@ Foam::Omanip<int> Foam::functionObjectFile::valueWidth(const label offset) const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjectFile::functionObjectFile
|
Foam::functionObjects::writeFile::writeFile
|
||||||
(
|
(
|
||||||
const objectRegistry& obr,
|
const word& name,
|
||||||
|
const Time& t,
|
||||||
|
const dictionary& dict,
|
||||||
const word& prefix
|
const word& prefix
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
functionObject(name),
|
||||||
|
time_(t),
|
||||||
|
obr_
|
||||||
|
(
|
||||||
|
time_.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
prefix_(prefix),
|
||||||
|
log_(true)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::functionObjects::writeFile::writeFile
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const dictionary& dict,
|
||||||
|
const word& prefix
|
||||||
|
)
|
||||||
|
:
|
||||||
|
functionObject(name),
|
||||||
|
time_(obr.time()),
|
||||||
obr_(obr),
|
obr_(obr),
|
||||||
prefix_(prefix)
|
prefix_(prefix),
|
||||||
|
log_(true)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjectFile::~functionObjectFile()
|
Foam::functionObjects::writeFile::~writeFile()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::label Foam::functionObjectFile::charWidth() const
|
bool Foam::functionObjects::writeFile::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
log_ = dict.lookupOrDefault<Switch>("log", true);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::label Foam::functionObjects::writeFile::charWidth() const
|
||||||
{
|
{
|
||||||
return IOstream::defaultPrecision() + addChars;
|
return IOstream::defaultPrecision() + addChars;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFile::writeCommented
|
void Foam::functionObjects::writeFile::writeCommented
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const string& str
|
const string& str
|
||||||
@ -126,7 +168,7 @@ void Foam::functionObjectFile::writeCommented
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFile::writeTabbed
|
void Foam::functionObjects::writeFile::writeTabbed
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const string& str
|
const string& str
|
||||||
@ -136,7 +178,7 @@ void Foam::functionObjectFile::writeTabbed
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFile::writeHeader
|
void Foam::functionObjects::writeFile::writeHeader
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const string& str
|
const string& str
|
||||||
@ -147,7 +189,7 @@ void Foam::functionObjectFile::writeHeader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFile::writeTime(Ostream& os) const
|
void Foam::functionObjects::writeFile::writeTime(Ostream& os) const
|
||||||
{
|
{
|
||||||
os << setw(charWidth()) << obr_.time().timeName();
|
os << setw(charWidth()) << obr_.time().timeName();
|
||||||
}
|
}
|
||||||
@ -22,10 +22,10 @@ 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::functionObjectFile
|
Foam::functionObjects::writeFile
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Base class for output file data handling
|
functionObject base class for writing single files
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
@ -36,34 +36,45 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef functionObjectFile_H
|
#ifndef functionObjects_writeFile_H
|
||||||
#define functionObjectFile_H
|
#define functionObjects_writeFile_H
|
||||||
|
|
||||||
#include "objectRegistry.H"
|
#include "functionObject.H"
|
||||||
|
#include "Time.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class functionObjectFile Declaration
|
Class functionObjectFile Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class functionObjectFile
|
class writeFile
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
|
//- Reference to the Time
|
||||||
|
const Time& time_;
|
||||||
|
|
||||||
//- Reference to the objectRegistry
|
//- Reference to the objectRegistry
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- Prefix
|
//- Prefix
|
||||||
const word prefix_;
|
const word prefix_;
|
||||||
|
|
||||||
|
//- Switch to send output to Info as well as to file
|
||||||
|
Switch log_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
@ -83,10 +94,10 @@ protected:
|
|||||||
virtual Omanip<int> valueWidth(const label offset = 0) const;
|
virtual Omanip<int> valueWidth(const label offset = 0) const;
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
functionObjectFile(const functionObjectFile&);
|
writeFile(const writeFile&);
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const functionObjectFile&);
|
void operator=(const writeFile&);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -100,36 +111,42 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from objectRegistry
|
//- Construct from name, Time, dictionary and prefix
|
||||||
functionObjectFile(const objectRegistry& obr, const word& prefix);
|
writeFile
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const Time& t,
|
||||||
|
const dictionary& dict,
|
||||||
|
const word& prefix
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from name, objectRegistry, dictionary and prefix
|
||||||
|
writeFile
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const dictionary& dict,
|
||||||
|
const word& prefix
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~functionObjectFile();
|
virtual ~writeFile();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
|
//- Read optional controls
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Write a commented string to stream
|
//- Write a commented string to stream
|
||||||
void writeCommented
|
void writeCommented(Ostream& os, const string& str) const;
|
||||||
(
|
|
||||||
Ostream& os,
|
|
||||||
const string& str
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Write a tabbed string to stream
|
//- Write a tabbed string to stream
|
||||||
void writeTabbed
|
void writeTabbed(Ostream& os, const string& str) const;
|
||||||
(
|
|
||||||
Ostream& os,
|
|
||||||
const string& str
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Write a commented header to stream
|
//- Write a commented header to stream
|
||||||
void writeHeader
|
void writeHeader(Ostream& os, const string& str) const;
|
||||||
(
|
|
||||||
Ostream& os,
|
|
||||||
const string& str
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Write the current time to stream
|
//- Write the current time to stream
|
||||||
void writeTime(Ostream& os) const;
|
void writeTime(Ostream& os) const;
|
||||||
@ -150,12 +167,13 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace functionObjects
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
#include "functionObjectFileTemplates.C"
|
#include "writeFileTemplates.C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -26,7 +26,7 @@ License
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::functionObjectFile::writeHeaderValue
|
void Foam::functionObjects::writeFile::writeHeaderValue
|
||||||
(
|
(
|
||||||
Ostream& os,
|
Ostream& os,
|
||||||
const string& property,
|
const string& property,
|
||||||
@ -23,13 +23,13 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "functionObjectFiles.H"
|
#include "writeFiles.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "IFstream.H"
|
#include "IFstream.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjectFiles::createFiles()
|
void Foam::functionObjects::writeFiles::createFiles()
|
||||||
{
|
{
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
@ -64,13 +64,13 @@ void Foam::functionObjectFiles::createFiles()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFiles::write()
|
void Foam::functionObjects::writeFiles::write()
|
||||||
{
|
{
|
||||||
createFiles();
|
createFiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFiles::resetNames(const wordList& names)
|
void Foam::functionObjects::writeFiles::resetNames(const wordList& names)
|
||||||
{
|
{
|
||||||
names_.clear();
|
names_.clear();
|
||||||
names_.append(names);
|
names_.append(names);
|
||||||
@ -79,13 +79,11 @@ void Foam::functionObjectFiles::resetNames(const wordList& names)
|
|||||||
{
|
{
|
||||||
filePtrs_.clear();
|
filePtrs_.clear();
|
||||||
filePtrs_.setSize(names_.size());
|
filePtrs_.setSize(names_.size());
|
||||||
|
|
||||||
createFiles();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjectFiles::resetName(const word& name)
|
void Foam::functionObjects::writeFiles::resetName(const word& name)
|
||||||
{
|
{
|
||||||
names_.clear();
|
names_.clear();
|
||||||
names_.append(name);
|
names_.append(name);
|
||||||
@ -94,87 +92,55 @@ void Foam::functionObjectFiles::resetName(const word& name)
|
|||||||
{
|
{
|
||||||
filePtrs_.clear();
|
filePtrs_.clear();
|
||||||
filePtrs_.setSize(1);
|
filePtrs_.setSize(1);
|
||||||
|
|
||||||
createFiles();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjectFiles::functionObjectFiles
|
Foam::functionObjects::writeFiles::writeFiles
|
||||||
(
|
(
|
||||||
const objectRegistry& obr,
|
const word& name,
|
||||||
|
const Time& time,
|
||||||
|
const dictionary& dict,
|
||||||
const word& prefix
|
const word& prefix
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, prefix),
|
writeFile(name, time, dict, prefix),
|
||||||
names_(),
|
names_(),
|
||||||
filePtrs_()
|
filePtrs_()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
Foam::functionObjectFiles::functionObjectFiles
|
Foam::functionObjects::writeFiles::writeFiles
|
||||||
(
|
(
|
||||||
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const word& prefix,
|
const dictionary& dict,
|
||||||
const word& name
|
const word& prefix
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, prefix),
|
writeFile(name, obr, dict, prefix),
|
||||||
names_(),
|
names_(),
|
||||||
filePtrs_()
|
filePtrs_()
|
||||||
{
|
{}
|
||||||
names_.clear();
|
|
||||||
names_.append(name);
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
filePtrs_.clear();
|
|
||||||
filePtrs_.setSize(1);
|
|
||||||
|
|
||||||
// Cannot create files - need to access virtual function
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::functionObjectFiles::functionObjectFiles
|
|
||||||
(
|
|
||||||
const objectRegistry& obr,
|
|
||||||
const word& prefix,
|
|
||||||
const wordList& names
|
|
||||||
)
|
|
||||||
:
|
|
||||||
functionObjectFile(obr, prefix),
|
|
||||||
names_(names),
|
|
||||||
filePtrs_()
|
|
||||||
{
|
|
||||||
names_.clear();
|
|
||||||
names_.append(names);
|
|
||||||
if (Pstream::master())
|
|
||||||
{
|
|
||||||
filePtrs_.clear();
|
|
||||||
filePtrs_.setSize(names_.size());
|
|
||||||
|
|
||||||
// Cannot create files - need to access virtual function
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjectFiles::~functionObjectFiles()
|
Foam::functionObjects::writeFiles::~writeFiles()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::wordList& Foam::functionObjectFiles::names() const
|
const Foam::wordList& Foam::functionObjects::writeFiles::names() const
|
||||||
{
|
{
|
||||||
return names_;
|
return names_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::OFstream& Foam::functionObjectFiles::file()
|
Foam::OFstream& Foam::functionObjects::writeFiles::file()
|
||||||
{
|
{
|
||||||
if (!Pstream::master())
|
if (!Pstream::master())
|
||||||
{
|
{
|
||||||
@ -201,7 +167,7 @@ Foam::OFstream& Foam::functionObjectFiles::file()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::PtrList<Foam::OFstream>& Foam::functionObjectFiles::files()
|
Foam::PtrList<Foam::OFstream>& Foam::functionObjects::writeFiles::files()
|
||||||
{
|
{
|
||||||
if (!Pstream::master())
|
if (!Pstream::master())
|
||||||
{
|
{
|
||||||
@ -214,7 +180,7 @@ Foam::PtrList<Foam::OFstream>& Foam::functionObjectFiles::files()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::OFstream& Foam::functionObjectFiles::file(const label i)
|
Foam::OFstream& Foam::functionObjects::writeFiles::file(const label i)
|
||||||
{
|
{
|
||||||
if (!Pstream::master())
|
if (!Pstream::master())
|
||||||
{
|
{
|
||||||
@ -22,10 +22,10 @@ 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::functionObjectFiles
|
Foam::functionObjects::writeFiles
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Base class for output file data handling
|
functionObject base class for writing files
|
||||||
|
|
||||||
See Also
|
See Also
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
@ -36,10 +36,10 @@ SourceFiles
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef functionObjectFiles_H
|
#ifndef functionObjects_writeFiles_H
|
||||||
#define functionObjectFiles_H
|
#define functionObjects_writeFiles_H
|
||||||
|
|
||||||
#include "functionObjectFile.H"
|
#include "writeFile.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "PtrList.H"
|
#include "PtrList.H"
|
||||||
|
|
||||||
@ -47,15 +47,16 @@ SourceFiles
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class functionObjectFiles Declaration
|
Class writeFiles Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class functionObjectFiles
|
class writeFiles
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public writeFile
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
@ -83,38 +84,37 @@ protected:
|
|||||||
virtual void resetName(const word& name);
|
virtual void resetName(const word& name);
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
functionObjectFiles(const functionObjectFiles&);
|
writeFiles(const writeFiles&);
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const functionObjectFiles&);
|
void operator=(const writeFiles&);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from objectRegistry
|
//- Construct from name, Time, dictionary and prefix
|
||||||
functionObjectFiles(const objectRegistry& obr, const word& prefix);
|
writeFiles
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
functionObjectFiles
|
|
||||||
(
|
(
|
||||||
const objectRegistry& obr,
|
const word& name,
|
||||||
const word& prefix,
|
const Time& time,
|
||||||
const word& name
|
const dictionary& dict,
|
||||||
|
const word& prefix
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from name, objectRegistry, dictionary and prefix
|
||||||
functionObjectFiles
|
writeFiles
|
||||||
(
|
(
|
||||||
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const word& prefix,
|
const dictionary& dict,
|
||||||
const wordList& names
|
const word& prefix
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~functionObjectFiles();
|
virtual ~writeFiles();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -135,6 +135,7 @@ public:
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace functionObjects
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -1,61 +1,39 @@
|
|||||||
fieldAverage/fieldAverage/fieldAverage.C
|
fieldAverage/fieldAverage.C
|
||||||
fieldAverage/fieldAverageItem/fieldAverageItem.C
|
fieldAverage/fieldAverageItem/fieldAverageItem.C
|
||||||
fieldAverage/fieldAverageItem/fieldAverageItemIO.C
|
fieldAverage/fieldAverageItem/fieldAverageItemIO.C
|
||||||
fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.C
|
|
||||||
|
|
||||||
fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C
|
fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C
|
||||||
fieldCoordinateSystemTransform/fieldCoordinateSystemTransformFunctionObject.C
|
|
||||||
|
|
||||||
fieldMinMax/fieldMinMax.C
|
fieldMinMax/fieldMinMax.C
|
||||||
fieldMinMax/fieldMinMaxFunctionObject.C
|
|
||||||
|
|
||||||
fieldValues/fieldValue/fieldValue.C
|
fieldValues/fieldValue/fieldValue.C
|
||||||
fieldValues/fieldValue/fieldValueNew.C
|
fieldValues/fieldValue/fieldValueNew.C
|
||||||
fieldValues/fieldValueDelta/fieldValueDelta.C
|
fieldValues/fieldValueDelta/fieldValueDelta.C
|
||||||
fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C
|
|
||||||
fieldValues/faceSource/faceSource.C
|
|
||||||
fieldValues/faceSource/faceSourceFunctionObject.C
|
|
||||||
fieldValues/cellSource/cellSource.C
|
fieldValues/cellSource/cellSource.C
|
||||||
fieldValues/cellSource/cellSourceFunctionObject.C
|
fieldValues/faceSource/faceSource.C
|
||||||
|
|
||||||
nearWallFields/nearWallFields.C
|
nearWallFields/nearWallFields.C
|
||||||
nearWallFields/nearWallFieldsFunctionObject.C
|
|
||||||
nearWallFields/findCellParticle.C
|
nearWallFields/findCellParticle.C
|
||||||
nearWallFields/findCellParticleCloud.C
|
nearWallFields/findCellParticleCloud.C
|
||||||
|
|
||||||
processorField/processorField.C
|
processorField/processorField.C
|
||||||
processorField/processorFieldFunctionObject.C
|
|
||||||
|
|
||||||
readFields/readFields.C
|
readFields/readFields.C
|
||||||
readFields/readFieldsFunctionObject.C
|
|
||||||
|
|
||||||
streamLine/streamLine.C
|
streamLine/streamLine.C
|
||||||
streamLine/streamLineParticle.C
|
streamLine/streamLineParticle.C
|
||||||
streamLine/streamLineParticleCloud.C
|
streamLine/streamLineParticleCloud.C
|
||||||
streamLine/streamLineFunctionObject.C
|
|
||||||
|
|
||||||
wallBoundedStreamLine/wallBoundedStreamLine.C
|
wallBoundedStreamLine/wallBoundedStreamLine.C
|
||||||
wallBoundedStreamLine/wallBoundedStreamLineFunctionObject.C
|
|
||||||
wallBoundedStreamLine/wallBoundedStreamLineParticle.C
|
wallBoundedStreamLine/wallBoundedStreamLineParticle.C
|
||||||
wallBoundedStreamLine/wallBoundedStreamLineParticleCloud.C
|
wallBoundedStreamLine/wallBoundedStreamLineParticleCloud.C
|
||||||
wallBoundedStreamLine/wallBoundedParticle.C
|
wallBoundedStreamLine/wallBoundedParticle.C
|
||||||
|
|
||||||
surfaceInterpolateFields/surfaceInterpolateFields.C
|
surfaceInterpolateFields/surfaceInterpolateFields.C
|
||||||
surfaceInterpolateFields/surfaceInterpolateFieldsFunctionObject.C
|
|
||||||
|
|
||||||
regionSizeDistribution/regionSizeDistribution.C
|
regionSizeDistribution/regionSizeDistribution.C
|
||||||
regionSizeDistribution/regionSizeDistributionFunctionObject.C
|
|
||||||
|
|
||||||
histogram/histogram.C
|
histogram/histogram.C
|
||||||
histogram/histogramFunctionObject.C
|
|
||||||
|
|
||||||
div/div.C
|
div/div.C
|
||||||
div/divFunctionObject.C
|
|
||||||
|
|
||||||
grad/grad.C
|
grad/grad.C
|
||||||
grad/gradFunctionObject.C
|
|
||||||
|
|
||||||
mag/mag.C
|
mag/mag.C
|
||||||
mag/magFunctionObject.C
|
|
||||||
|
|
||||||
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
||||||
|
|||||||
@ -25,8 +25,7 @@ License
|
|||||||
|
|
||||||
#include "div.H"
|
#include "div.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "dictionary.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "div.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -35,6 +34,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(div, 0);
|
defineTypeNameAndDebug(div, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, div, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -82,17 +82,22 @@ Foam::volScalarField& Foam::functionObjects::div::divField
|
|||||||
Foam::functionObjects::div::div
|
Foam::functionObjects::div::div
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
functionObject(name),
|
||||||
obr_(obr),
|
obr_
|
||||||
|
(
|
||||||
|
runTime.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
),
|
||||||
fieldName_("undefined-fieldName"),
|
fieldName_("undefined-fieldName"),
|
||||||
resultName_("undefined-resultName")
|
resultName_("undefined-resultName")
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -110,7 +115,7 @@ Foam::functionObjects::div::~div()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::div::read(const dictionary& dict)
|
bool Foam::functionObjects::div::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup("fieldName") >> fieldName_;
|
dict.lookup("fieldName") >> fieldName_;
|
||||||
dict.lookup("resultName") >> resultName_;
|
dict.lookup("resultName") >> resultName_;
|
||||||
@ -119,10 +124,12 @@ void Foam::functionObjects::div::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
resultName_ = "fvc::div(" + fieldName_ + ")";
|
resultName_ = "fvc::div(" + fieldName_ + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::div::execute()
|
bool Foam::functionObjects::div::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
bool processed = false;
|
bool processed = false;
|
||||||
|
|
||||||
@ -134,31 +141,25 @@ void Foam::functionObjects::div::execute()
|
|||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Unprocessed field " << fieldName_ << endl;
|
<< "Unprocessed field " << fieldName_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::div::end()
|
bool Foam::functionObjects::div::write(const bool postProcess)
|
||||||
{
|
|
||||||
execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::div::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::div::write()
|
|
||||||
{
|
{
|
||||||
if (obr_.foundObject<regIOobject>(resultName_))
|
if (obr_.foundObject<regIOobject>(resultName_))
|
||||||
{
|
{
|
||||||
const regIOobject& field =
|
const regIOobject& field =
|
||||||
obr_.lookupObject<regIOobject>(resultName_);
|
obr_.lookupObject<regIOobject>(resultName_);
|
||||||
|
|
||||||
Info<< type() << " " << name_ << " output:" << nl
|
Info<< type() << " " << name() << " output:" << nl
|
||||||
<< " writing field " << field.name() << nl << endl;
|
<< " writing field " << field.name() << nl << endl;
|
||||||
|
|
||||||
field.write();
|
field.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -29,8 +29,8 @@ Group
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
This function object calculates the divergence of a field. The operation is
|
This function object calculates the divergence of a field. The operation is
|
||||||
limited to surfaceScalarFields and volumeVector fields, and the output is a
|
limited to surfaceScalarFields and volVectorFields, and the output is a
|
||||||
volume scalar field.
|
volScalarField.
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
div.C
|
div.C
|
||||||
@ -40,11 +40,8 @@ SourceFiles
|
|||||||
#ifndef functionObjects_div_H
|
#ifndef functionObjects_div_H
|
||||||
#define functionObjects_div_H
|
#define functionObjects_div_H
|
||||||
|
|
||||||
|
#include "functionObject.H"
|
||||||
#include "volFieldsFwd.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
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
class polyMesh;
|
|
||||||
class mapPolyMesh;
|
|
||||||
class dimensionSet;
|
class dimensionSet;
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
@ -66,13 +60,12 @@ namespace functionObjects
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class div
|
class div
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of this div object
|
//- Reference to the objectRegistry
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Reference to the database
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- Name of field to process
|
//- Name of field to process
|
||||||
@ -115,14 +108,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
//- Construct from Time and dictionary
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
div
|
div
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -132,34 +123,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the set of div
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the div data
|
//- Read the div data
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Calculate the divergence field
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute at the final time-loop, currently does nothing
|
//- Write the divergence field
|
||||||
virtual void end();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- 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&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -25,8 +25,8 @@ License
|
|||||||
|
|
||||||
#include "fieldAverage.H"
|
#include "fieldAverage.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "Time.H"
|
|
||||||
#include "fieldAverageItem.H"
|
#include "fieldAverageItem.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -35,6 +35,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(fieldAverage, 0);
|
defineTypeNameAndDebug(fieldAverage, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, fieldAverage, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +69,7 @@ void Foam::functionObjects::fieldAverage::initialize()
|
|||||||
{
|
{
|
||||||
resetFields();
|
resetFields();
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ":" << nl;
|
Info<< type() << " " << name() << ":" << nl;
|
||||||
|
|
||||||
// Add mean fields to the field lists
|
// Add mean fields to the field lists
|
||||||
forAll(faItems_, fieldi)
|
forAll(faItems_, fieldi)
|
||||||
@ -136,7 +137,7 @@ void Foam::functionObjects::fieldAverage::calcAverages()
|
|||||||
periodIndex_++;
|
periodIndex_++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< type() << " " << name_ << " output:" << nl;
|
Info<< type() << " " << name() << " output:" << nl;
|
||||||
|
|
||||||
Info<< " Calculating averages" << nl;
|
Info<< " Calculating averages" << nl;
|
||||||
|
|
||||||
@ -259,13 +260,18 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
|
|||||||
Foam::functionObjects::fieldAverage::fieldAverage
|
Foam::functionObjects::fieldAverage::fieldAverage
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& t,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
functionObject(name),
|
||||||
obr_(obr),
|
obr_
|
||||||
|
(
|
||||||
|
t.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
),
|
||||||
prevTimeIndex_(-1),
|
prevTimeIndex_(-1),
|
||||||
restartOnRestart_(false),
|
restartOnRestart_(false),
|
||||||
restartOnOutput_(false),
|
restartOnOutput_(false),
|
||||||
@ -277,7 +283,7 @@ Foam::functionObjects::fieldAverage::fieldAverage
|
|||||||
totalTime_(),
|
totalTime_(),
|
||||||
periodIndex_(1)
|
periodIndex_(1)
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -295,11 +301,11 @@ Foam::functionObjects::fieldAverage::~fieldAverage()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::fieldAverage::read(const dictionary& dict)
|
bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
initialised_ = false;
|
initialised_ = false;
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ":" << nl;
|
Info<< type() << " " << name() << ":" << nl;
|
||||||
|
|
||||||
dict.readIfPresent("restartOnRestart", restartOnRestart_);
|
dict.readIfPresent("restartOnRestart", restartOnRestart_);
|
||||||
dict.readIfPresent("restartOnOutput", restartOnOutput_);
|
dict.readIfPresent("restartOnOutput", restartOnOutput_);
|
||||||
@ -314,28 +320,21 @@ void Foam::functionObjects::fieldAverage::read(const dictionary& dict)
|
|||||||
readAveragingProperties();
|
readAveragingProperties();
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldAverage::execute()
|
bool Foam::functionObjects::fieldAverage::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
calcAverages();
|
calcAverages();
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldAverage::end()
|
bool Foam::functionObjects::fieldAverage::write(const bool postProcess)
|
||||||
{
|
|
||||||
calcAverages();
|
|
||||||
Info<< endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldAverage::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldAverage::write()
|
|
||||||
{
|
{
|
||||||
writeAverages();
|
writeAverages();
|
||||||
writeAveragingProperties();
|
writeAveragingProperties();
|
||||||
@ -346,15 +345,9 @@ void Foam::functionObjects::fieldAverage::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldAverage::updateMesh(const mapPolyMesh&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldAverage::movePoints(const polyMesh&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
@ -110,7 +110,6 @@ Note
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
fieldAverage.C
|
fieldAverage.C
|
||||||
@ -122,7 +121,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_fieldAverage_H
|
#ifndef functionObjects_fieldAverage_H
|
||||||
#define functionObjects_fieldAverage_H
|
#define functionObjects_fieldAverage_H
|
||||||
|
|
||||||
#include "volFieldsFwd.H"
|
#include "functionObject.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -132,11 +131,6 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
template<class Type>
|
|
||||||
class List;
|
|
||||||
class polyMesh;
|
|
||||||
class mapPolyMesh;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
@ -149,15 +143,14 @@ class fieldAverageItem;
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class fieldAverage
|
class fieldAverage
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of this set of field averages.
|
//- Reference to the objectRegistry
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Database this class is registered to
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- Time at last call, prevents repeated averaging
|
//- Time at last call, prevents repeated averaging
|
||||||
@ -291,14 +284,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
//- Construct from Time and dictionary
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
fieldAverage
|
fieldAverage
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& t,
|
||||||
const dictionary&,
|
const dictionary&
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -308,32 +299,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the set of field averages
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the field average data
|
//- Read the field average data
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute the averaging
|
//- Calculate the field averages
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute the averaging at the final time-loop, currently does nothing
|
//- Write the field averages
|
||||||
virtual void end();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- 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&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "fieldCoordinateSystemTransform.H"
|
#include "fieldCoordinateSystemTransform.H"
|
||||||
#include "dictionary.H"
|
#include "dictionary.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -33,6 +34,13 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0);
|
defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
fieldCoordinateSystemTransform,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,17 +51,22 @@ Foam::functionObjects::fieldCoordinateSystemTransform::
|
|||||||
fieldCoordinateSystemTransform
|
fieldCoordinateSystemTransform
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
functionObject(name),
|
||||||
obr_(obr),
|
obr_
|
||||||
|
(
|
||||||
|
runTime.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
),
|
||||||
fieldSet_(),
|
fieldSet_(),
|
||||||
coordSys_(obr, dict)
|
coordSys_(obr_, dict)
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -61,7 +74,7 @@ fieldCoordinateSystemTransform
|
|||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ":" << nl
|
Info<< type() << " " << name << ":" << nl
|
||||||
<< " Applying transformation from global Cartesian to local "
|
<< " Applying transformation from global Cartesian to local "
|
||||||
<< coordSys_ << nl << endl;
|
<< coordSys_ << nl << endl;
|
||||||
}
|
}
|
||||||
@ -76,18 +89,23 @@ Foam::functionObjects::fieldCoordinateSystemTransform::
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::fieldCoordinateSystemTransform::read
|
bool Foam::functionObjects::fieldCoordinateSystemTransform::read
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
dict.lookup("fields") >> fieldSet_;
|
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)
|
forAll(fieldSet_, fieldi)
|
||||||
{
|
{
|
||||||
@ -98,22 +116,17 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::execute()
|
|||||||
transform<symmTensor>(fieldSet_[fieldi]);
|
transform<symmTensor>(fieldSet_[fieldi]);
|
||||||
transform<tensor>(fieldSet_[fieldi]);
|
transform<tensor>(fieldSet_[fieldi]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldCoordinateSystemTransform::end()
|
bool Foam::functionObjects::fieldCoordinateSystemTransform::write
|
||||||
|
(
|
||||||
|
const bool postProcess
|
||||||
|
)
|
||||||
{
|
{
|
||||||
execute();
|
Info<< type() << " " << name() << " output:" << nl;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldCoordinateSystemTransform::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldCoordinateSystemTransform::write()
|
|
||||||
{
|
|
||||||
Info<< type() << " " << name_ << " output:" << nl;
|
|
||||||
|
|
||||||
forAll(fieldSet_, fieldi)
|
forAll(fieldSet_, fieldi)
|
||||||
{
|
{
|
||||||
@ -128,6 +141,8 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -64,7 +64,6 @@ Description
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
|
||||||
Foam::coordinateSystem
|
Foam::coordinateSystem
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
@ -76,9 +75,8 @@ SourceFiles
|
|||||||
#ifndef functionObjects_fieldCoordinateSystemTransform_H
|
#ifndef functionObjects_fieldCoordinateSystemTransform_H
|
||||||
#define functionObjects_fieldCoordinateSystemTransform_H
|
#define functionObjects_fieldCoordinateSystemTransform_H
|
||||||
|
|
||||||
#include "OFstream.H"
|
#include "functionObject.H"
|
||||||
#include "volFields.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "surfaceFields.H"
|
|
||||||
#include "coordinateSystem.H"
|
#include "coordinateSystem.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -88,9 +86,6 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
class polyMesh;
|
|
||||||
class mapPolyMesh;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
@ -100,14 +95,14 @@ namespace functionObjects
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class fieldCoordinateSystemTransform
|
class fieldCoordinateSystemTransform
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name
|
//- Reference to the objectRegistry
|
||||||
word name_;
|
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- Fields to transform
|
//- Fields to transform
|
||||||
@ -145,14 +140,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
//- Construct from Time and dictionary
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
fieldCoordinateSystemTransform
|
fieldCoordinateSystemTransform
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -162,34 +155,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the fieldCoordinateSystemTransform object
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the input data
|
//- Read the input data
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- 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();
|
|
||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
virtual void write();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void updateMesh(const mapPolyMesh&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void movePoints(const polyMesh&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "fieldMinMax.H"
|
#include "fieldMinMax.H"
|
||||||
#include "fieldTypes.H"
|
#include "fieldTypes.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(fieldMinMax, 0);
|
defineTypeNameAndDebug(fieldMinMax, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, fieldMinMax, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,51 +52,7 @@ const Foam::NamedEnum
|
|||||||
> Foam::functionObjects::fieldMinMax::modeTypeNames_;
|
> Foam::functionObjects::fieldMinMax::modeTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
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_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldMinMax::writeFileHeader(const label i)
|
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 * * * * * * * * * * * * * * //
|
||||||
{}
|
|
||||||
|
|
||||||
|
Foam::functionObjects::fieldMinMax::fieldMinMax
|
||||||
void Foam::functionObjects::fieldMinMax::end()
|
(
|
||||||
{}
|
const word& name,
|
||||||
|
const Time& runTime,
|
||||||
|
const dictionary& dict
|
||||||
void Foam::functionObjects::fieldMinMax::timeSet()
|
)
|
||||||
{}
|
:
|
||||||
|
writeFiles(name, runTime, dict, name),
|
||||||
|
location_(true),
|
||||||
void Foam::functionObjects::fieldMinMax::write()
|
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 (!location_) writeTime(file());
|
||||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
if (log_) Info<< type() << " " << name() << " output:" << nl;
|
||||||
|
|
||||||
forAll(fieldSet_, fieldi)
|
forAll(fieldSet_, fieldi)
|
||||||
{
|
{
|
||||||
@ -166,6 +164,8 @@ void Foam::functionObjects::fieldMinMax::write()
|
|||||||
|
|
||||||
if (!location_) file()<< endl;
|
if (!location_) file()<< endl;
|
||||||
if (log_) Info<< endl;
|
if (log_) Info<< endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,7 @@ Description
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
Foam::functionObjects::writeFiles
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
fieldMinMax.C
|
fieldMinMax.C
|
||||||
@ -77,21 +77,13 @@ SourceFiles
|
|||||||
#ifndef functionObjects_fieldMinMax_H
|
#ifndef functionObjects_fieldMinMax_H
|
||||||
#define functionObjects_fieldMinMax_H
|
#define functionObjects_fieldMinMax_H
|
||||||
|
|
||||||
#include "functionObjectFiles.H"
|
#include "writeFiles.H"
|
||||||
#include "Switch.H"
|
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
class dictionary;
|
|
||||||
class polyMesh;
|
|
||||||
class mapPolyMesh;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -101,7 +93,7 @@ namespace functionObjects
|
|||||||
|
|
||||||
class fieldMinMax
|
class fieldMinMax
|
||||||
:
|
:
|
||||||
public functionObjectFiles
|
public writeFiles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -118,15 +110,6 @@ protected:
|
|||||||
//- Mode type names
|
//- Mode type names
|
||||||
static const NamedEnum<modeType, 2> modeTypeNames_;
|
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 to write location of min/max values
|
||||||
Switch location_;
|
Switch location_;
|
||||||
|
|
||||||
@ -159,6 +142,14 @@ protected:
|
|||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const fieldMinMax&);
|
void operator=(const fieldMinMax&);
|
||||||
|
|
||||||
|
//- Calculate the field min/max
|
||||||
|
template<class Type>
|
||||||
|
void calcMinMaxFields
|
||||||
|
(
|
||||||
|
const word& fieldName,
|
||||||
|
const modeType& mode
|
||||||
|
);
|
||||||
|
|
||||||
//- Output file header information
|
//- Output file header information
|
||||||
virtual void writeFileHeader(const label i);
|
virtual void writeFileHeader(const label i);
|
||||||
|
|
||||||
@ -171,14 +162,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
//- Construct from Time and dictionary
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
fieldMinMax
|
fieldMinMax
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -188,42 +177,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the set of field min/max
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the field min/max data
|
//- Read the field min/max data
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- 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 field min/max
|
|
||||||
template<class Type>
|
|
||||||
void calcMinMaxFields
|
|
||||||
(
|
|
||||||
const word& fieldName,
|
|
||||||
const modeType& mode
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Write the fieldMinMax
|
//- Write the fieldMinMax
|
||||||
virtual void write();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void updateMesh(const mapPolyMesh&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void movePoints(const polyMesh&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -38,6 +38,7 @@ namespace fieldValues
|
|||||||
{
|
{
|
||||||
defineTypeNameAndDebug(cellSource, 0);
|
defineTypeNameAndDebug(cellSource, 0);
|
||||||
addToRunTimeSelectionTable(fieldValue, cellSource, dictionary);
|
addToRunTimeSelectionTable(fieldValue, cellSource, dictionary);
|
||||||
|
addToRunTimeSelectionTable(functionObject, cellSource, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,14 +150,14 @@ void Foam::functionObjects::fieldValues::cellSource::initialise
|
|||||||
if (nCells_ == 0)
|
if (nCells_ == 0)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< type() << " " << name_ << ": "
|
<< type() << " " << name() << ": "
|
||||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||||
<< " Source has no cells" << exit(FatalError);
|
<< " Source has no cells" << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
volume_ = volume();
|
volume_ = volume();
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ":"
|
Info<< type() << " " << name() << ":"
|
||||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||||
<< " total cells = " << nCells_ << nl
|
<< " total cells = " << nCells_ << nl
|
||||||
<< " total volume = " << volume_
|
<< " total volume = " << volume_
|
||||||
@ -205,12 +206,11 @@ void Foam::functionObjects::fieldValues::cellSource::writeFileHeader
|
|||||||
Foam::functionObjects::fieldValues::cellSource::cellSource
|
Foam::functionObjects::fieldValues::cellSource::cellSource
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fieldValue(name, obr, dict, typeName, loadFromFiles),
|
fieldValue(name, runTime, dict, typeName),
|
||||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||||
nCells_(0),
|
nCells_(0),
|
||||||
@ -218,7 +218,32 @@ Foam::functionObjects::fieldValues::cellSource::cellSource
|
|||||||
weightFieldName_("none"),
|
weightFieldName_("none"),
|
||||||
writeVolume_(dict.lookupOrDefault("writeVolume", false))
|
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
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -236,7 +261,7 @@ Foam::functionObjects::fieldValues::cellSource::~cellSource()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::cellSource::read
|
bool Foam::functionObjects::fieldValues::cellSource::read
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
@ -245,10 +270,15 @@ void Foam::functionObjects::fieldValues::cellSource::read
|
|||||||
|
|
||||||
// No additional info to read
|
// No additional info to read
|
||||||
initialise(dict);
|
initialise(dict);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::cellSource::write()
|
bool Foam::functionObjects::fieldValues::cellSource::write
|
||||||
|
(
|
||||||
|
const bool postProcess
|
||||||
|
)
|
||||||
{
|
{
|
||||||
fieldValue::write();
|
fieldValue::write();
|
||||||
|
|
||||||
@ -293,6 +323,8 @@ void Foam::functionObjects::fieldValues::cellSource::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (log_) Info<< endl;
|
if (log_) Info<< endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -95,7 +95,6 @@ Description
|
|||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::fieldValues
|
Foam::fieldValues
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
cellSource.C
|
cellSource.C
|
||||||
@ -105,10 +104,8 @@ SourceFiles
|
|||||||
#ifndef functionObjects_cellSource_H
|
#ifndef functionObjects_cellSource_H
|
||||||
#define functionObjects_cellSource_H
|
#define functionObjects_cellSource_H
|
||||||
|
|
||||||
#include "NamedEnum.H"
|
|
||||||
#include "fieldValue.H"
|
#include "fieldValue.H"
|
||||||
#include "labelList.H"
|
#include "NamedEnum.H"
|
||||||
#include "volFieldsFwd.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -241,13 +238,20 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// 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
|
cellSource
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -257,23 +261,12 @@ public:
|
|||||||
|
|
||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return the source type
|
//- Return the source type
|
||||||
inline const sourceType& source() const;
|
inline const sourceType& source() const;
|
||||||
|
|
||||||
//- Return the local list of cell IDs
|
//- Return the local list of cell IDs
|
||||||
inline const labelList& cellId() const;
|
inline const labelList& cellId() const;
|
||||||
|
|
||||||
|
|
||||||
// Function object functions
|
|
||||||
|
|
||||||
//- Read from dictionary
|
|
||||||
virtual void read(const dictionary&);
|
|
||||||
|
|
||||||
//- Calculate and write
|
|
||||||
virtual void write();
|
|
||||||
|
|
||||||
//- Templated helper function to output field values
|
//- Templated helper function to output field values
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool writeValues(const word& fieldName);
|
bool writeValues(const word& fieldName);
|
||||||
@ -281,6 +274,12 @@ public:
|
|||||||
//- Filter a field according to cellIds
|
//- Filter a field according to cellIds
|
||||||
template<class Type>
|
template<class Type>
|
||||||
tmp<Field<Type>> filterField(const Field<Type>& field) const;
|
tmp<Field<Type>> filterField(const Field<Type>& field) const;
|
||||||
|
|
||||||
|
//- Read from dictionary
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
|
//- Calculate and write
|
||||||
|
virtual bool write(const bool postProcess = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,46 +0,0 @@
|
|||||||
/*---------------------------------------------------------------------------*\
|
|
||||||
========= |
|
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
|
||||||
\\ / O peration |
|
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
|
||||||
\\/ M anipulation |
|
|
||||||
-------------------------------------------------------------------------------
|
|
||||||
License
|
|
||||||
This file is part of OpenFOAM.
|
|
||||||
|
|
||||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU General Public License as published by
|
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
|
||||||
(at your option) any later version.
|
|
||||||
|
|
||||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
|
||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include "cellSourceFunctionObject.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
|
||||||
|
|
||||||
namespace Foam
|
|
||||||
{
|
|
||||||
defineNamedTemplateTypeNameAndDebug
|
|
||||||
(
|
|
||||||
cellSourceFunctionObject,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
|
|
||||||
addToRunTimeSelectionTable
|
|
||||||
(
|
|
||||||
functionObject,
|
|
||||||
cellSourceFunctionObject,
|
|
||||||
dictionary
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -44,6 +44,7 @@ namespace fieldValues
|
|||||||
{
|
{
|
||||||
defineTypeNameAndDebug(faceSource, 0);
|
defineTypeNameAndDebug(faceSource, 0);
|
||||||
addToRunTimeSelectionTable(fieldValue, faceSource, dictionary);
|
addToRunTimeSelectionTable(fieldValue, faceSource, dictionary);
|
||||||
|
addToRunTimeSelectionTable(functionObject, faceSource, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -106,7 +107,7 @@ void Foam::functionObjects::fieldValues::faceSource::setFaceZoneFaces()
|
|||||||
if (zoneId < 0)
|
if (zoneId < 0)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< type() << " " << name_ << ": "
|
<< type() << " " << name() << ": "
|
||||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||||
<< " Unknown face zone name: " << sourceName_
|
<< " Unknown face zone name: " << sourceName_
|
||||||
<< ". Valid face zones are: " << mesh().faceZones().names()
|
<< ". Valid face zones are: " << mesh().faceZones().names()
|
||||||
@ -191,7 +192,7 @@ void Foam::functionObjects::fieldValues::faceSource::setPatchFaces()
|
|||||||
if (patchid < 0)
|
if (patchid < 0)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< type() << " " << name_ << ": "
|
<< type() << " " << name() << ": "
|
||||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||||
<< " Unknown patch name: " << sourceName_
|
<< " Unknown patch name: " << sourceName_
|
||||||
<< ". Valid patch names are: "
|
<< ". Valid patch names are: "
|
||||||
@ -228,7 +229,7 @@ void Foam::functionObjects::fieldValues::faceSource::sampledSurfaceFaces
|
|||||||
{
|
{
|
||||||
surfacePtr_ = sampledSurface::New
|
surfacePtr_ = sampledSurface::New
|
||||||
(
|
(
|
||||||
name_,
|
name(),
|
||||||
mesh(),
|
mesh(),
|
||||||
dict.subDict("sampledSurfaceDict")
|
dict.subDict("sampledSurfaceDict")
|
||||||
);
|
);
|
||||||
@ -443,7 +444,7 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
|
|||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< type() << " " << name_ << ": "
|
<< type() << " " << name() << ": "
|
||||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
||||||
<< nl << " Unknown source type. Valid source types are:"
|
<< nl << " Unknown source type. Valid source types are:"
|
||||||
<< sourceTypeNames_.sortedToc() << nl << exit(FatalError);
|
<< sourceTypeNames_.sortedToc() << nl << exit(FatalError);
|
||||||
@ -453,7 +454,7 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
|
|||||||
if (nFaces_ == 0)
|
if (nFaces_ == 0)
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< type() << " " << name_ << ": "
|
<< type() << " " << name() << ": "
|
||||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||||
<< " Source has no faces" << exit(FatalError);
|
<< " Source has no faces" << exit(FatalError);
|
||||||
}
|
}
|
||||||
@ -465,7 +466,7 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
|
|||||||
|
|
||||||
totalArea_ = totalArea();
|
totalArea_ = totalArea();
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ":" << nl
|
Info<< type() << " " << name() << ":" << nl
|
||||||
<< " total faces = " << nFaces_
|
<< " total faces = " << nFaces_
|
||||||
<< nl
|
<< nl
|
||||||
<< " total area = " << totalArea_
|
<< " total area = " << totalArea_
|
||||||
@ -641,12 +642,11 @@ Foam::vector Foam::functionObjects::fieldValues::faceSource::processValues
|
|||||||
Foam::functionObjects::fieldValues::faceSource::faceSource
|
Foam::functionObjects::fieldValues::faceSource::faceSource
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
fieldValue(name, obr, dict, typeName, loadFromFiles),
|
fieldValue(name, runTime, dict, typeName),
|
||||||
surfaceWriterPtr_(NULL),
|
surfaceWriterPtr_(NULL),
|
||||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||||
@ -660,7 +660,37 @@ Foam::functionObjects::fieldValues::faceSource::faceSource
|
|||||||
facePatchId_(),
|
facePatchId_(),
|
||||||
faceSign_()
|
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
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -678,17 +708,22 @@ Foam::functionObjects::fieldValues::faceSource::~faceSource()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::faceSource::read
|
bool Foam::functionObjects::fieldValues::faceSource::read
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
fieldValue::read(dict);
|
fieldValue::read(dict);
|
||||||
initialise(dict);
|
initialise(dict);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::faceSource::write()
|
bool Foam::functionObjects::fieldValues::faceSource::write
|
||||||
|
(
|
||||||
|
const bool postProcess
|
||||||
|
)
|
||||||
{
|
{
|
||||||
fieldValue::write();
|
fieldValue::write();
|
||||||
|
|
||||||
@ -757,6 +792,8 @@ void Foam::functionObjects::fieldValues::faceSource::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (log_) Info<< endl;
|
if (log_) Info<< endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -128,7 +128,6 @@ Note
|
|||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::fieldValues
|
Foam::fieldValues
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
faceSource.C
|
faceSource.C
|
||||||
@ -139,11 +138,8 @@ SourceFiles
|
|||||||
#ifndef functionObjects_faceSource_H
|
#ifndef functionObjects_faceSource_H
|
||||||
#define functionObjects_faceSource_H
|
#define functionObjects_faceSource_H
|
||||||
|
|
||||||
#include "NamedEnum.H"
|
|
||||||
#include "fieldValue.H"
|
#include "fieldValue.H"
|
||||||
#include "surfaceFieldsFwd.H"
|
#include "NamedEnum.H"
|
||||||
#include "volFieldsFwd.H"
|
|
||||||
#include "surfaceWriter.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -151,6 +147,7 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
class sampledSurface;
|
class sampledSurface;
|
||||||
|
class surfaceWriter;
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
@ -341,13 +338,20 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// 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
|
faceSource
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -357,8 +361,6 @@ public:
|
|||||||
|
|
||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return the source type
|
//- Return the source type
|
||||||
inline const sourceType& source() const;
|
inline const sourceType& source() const;
|
||||||
|
|
||||||
@ -371,15 +373,6 @@ public:
|
|||||||
//- Return the list of +1/-1 representing face flip map
|
//- Return the list of +1/-1 representing face flip map
|
||||||
inline const labelList& faceSign() const;
|
inline const labelList& faceSign() const;
|
||||||
|
|
||||||
|
|
||||||
// Function object functions
|
|
||||||
|
|
||||||
//- Read from dictionary
|
|
||||||
virtual void read(const dictionary&);
|
|
||||||
|
|
||||||
//- Calculate and write
|
|
||||||
virtual void write();
|
|
||||||
|
|
||||||
//- Templated helper function to output field values
|
//- Templated helper function to output field values
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool writeValues
|
bool writeValues
|
||||||
@ -404,10 +397,16 @@ public:
|
|||||||
const GeometricField<Type, fvPatchField, volMesh>& field,
|
const GeometricField<Type, fvPatchField, volMesh>& field,
|
||||||
const bool applyOrientation
|
const bool applyOrientation
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Read from dictionary
|
||||||
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
|
//- Calculate and write
|
||||||
|
virtual bool write(const bool postProcess = false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Specialisation of processing scalars
|
//- Specialisation for scalar
|
||||||
template<>
|
template<>
|
||||||
scalar faceSource::processValues
|
scalar faceSource::processValues
|
||||||
(
|
(
|
||||||
@ -417,7 +416,7 @@ scalar faceSource::processValues
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Specialisation of processing vectors
|
//- Specialisation for vector
|
||||||
template<>
|
template<>
|
||||||
vector faceSource::processValues
|
vector faceSource::processValues
|
||||||
(
|
(
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -27,6 +27,7 @@ License
|
|||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "sampledSurface.H"
|
#include "sampledSurface.H"
|
||||||
|
#include "surfaceWriter.H"
|
||||||
#include "interpolationCellPoint.H"
|
#include "interpolationCellPoint.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
@ -315,7 +316,7 @@ bool Foam::functionObjects::fieldValues::faceSource::writeValues
|
|||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
fileName outputDir =
|
fileName outputDir =
|
||||||
baseFileDir()/name_/"surface"/obr_.time().timeName();
|
baseFileDir()/name()/"surface"/obr_.time().timeName();
|
||||||
|
|
||||||
surfaceWriterPtr_->write
|
surfaceWriterPtr_->write
|
||||||
(
|
(
|
||||||
@ -375,7 +376,7 @@ Foam::functionObjects::fieldValues::faceSource::filterField
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< type() << " " << name_ << ": "
|
<< type() << " " << name() << ": "
|
||||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
||||||
<< nl
|
<< nl
|
||||||
<< " Unable to process internal faces for volume field "
|
<< " Unable to process internal faces for volume field "
|
||||||
|
|||||||
@ -24,90 +24,96 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fieldValue.H"
|
#include "fieldValue.H"
|
||||||
#include "fvMesh.H"
|
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(fieldValue, 0);
|
defineTypeNameAndDebug(fieldValue, 0);
|
||||||
defineRunTimeSelectionTable(fieldValue, dictionary);
|
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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fieldValue::fieldValue
|
Foam::functionObjects::fieldValue::fieldValue
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& valueType,
|
const word& valueType
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFiles(obr, name, valueType),
|
writeFiles(name, runTime, dict, name),
|
||||||
name_(name),
|
|
||||||
obr_(obr),
|
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
log_(true),
|
|
||||||
sourceName_(word::null),
|
sourceName_(word::null),
|
||||||
fields_(dict.lookup("fields")),
|
fields_(dict.lookup("fields")),
|
||||||
valueOutput_(dict.lookup("valueOutput")),
|
valueOutput_(dict.lookup("valueOutput")),
|
||||||
resultDict_(fileName("name"), dictionary::null)
|
resultDict_(fileName("name"), dictionary::null)
|
||||||
{
|
{
|
||||||
read(dict);
|
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 * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::fieldValue::~fieldValue()
|
Foam::functionObjects::fieldValue::~fieldValue()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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&)
|
return true;
|
||||||
{}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::fieldValue::movePoints(const polyMesh&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -38,12 +38,9 @@ SourceFiles
|
|||||||
#ifndef functionObjects_fieldValue_H
|
#ifndef functionObjects_fieldValue_H
|
||||||
#define functionObjects_fieldValue_H
|
#define functionObjects_fieldValue_H
|
||||||
|
|
||||||
#include "functionObjectFiles.H"
|
#include "writeFiles.H"
|
||||||
#include "Switch.H"
|
#include "Switch.H"
|
||||||
#include "OFstream.H"
|
|
||||||
#include "dictionary.H"
|
|
||||||
#include "Field.H"
|
#include "Field.H"
|
||||||
#include "runTimeSelectionTables.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -51,10 +48,10 @@ namespace Foam
|
|||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
|
||||||
class fvMesh;
|
class fvMesh;
|
||||||
class polyMesh;
|
|
||||||
class mapPolyMesh;
|
namespace functionObjects
|
||||||
|
{
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class fieldValue Declaration
|
Class fieldValue Declaration
|
||||||
@ -62,25 +59,16 @@ class mapPolyMesh;
|
|||||||
|
|
||||||
class fieldValue
|
class fieldValue
|
||||||
:
|
:
|
||||||
public functionObjectFiles
|
public writeFiles
|
||||||
{
|
{
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of this fieldValue object
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Database this class is registered to
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- Construction dictionary
|
//- Construction dictionary
|
||||||
dictionary dict_;
|
dictionary dict_;
|
||||||
|
|
||||||
//- Switch to send output to Info as well as to file
|
|
||||||
Switch log_;
|
|
||||||
|
|
||||||
//- Name of source object
|
//- Name of source object
|
||||||
word sourceName_;
|
word sourceName_;
|
||||||
|
|
||||||
@ -94,6 +82,17 @@ protected:
|
|||||||
dictionary resultDict_;
|
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:
|
public:
|
||||||
|
|
||||||
//- Run-time type information
|
//- Run-time type information
|
||||||
@ -109,20 +108,30 @@ public:
|
|||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
),
|
),
|
||||||
(name, obr, dict, loadFromFiles)
|
(name, obr, dict)
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from components
|
|
||||||
|
// 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
|
fieldValue
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const word& valueType,
|
const word& valueType
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return a reference to the selected fieldValue
|
//- Return a reference to the selected fieldValue
|
||||||
@ -131,30 +140,19 @@ public:
|
|||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const bool loadFromFiles = false,
|
|
||||||
const bool output = true
|
const bool output = true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
virtual ~fieldValue();
|
virtual ~fieldValue();
|
||||||
|
|
||||||
|
|
||||||
// Public Member Functions
|
// Member Functions
|
||||||
|
|
||||||
// Access
|
|
||||||
|
|
||||||
//- Return the name of the geometric source
|
|
||||||
inline const word& name() const;
|
|
||||||
|
|
||||||
//- Return the reference to the object registry
|
|
||||||
inline const objectRegistry& obr() const;
|
|
||||||
|
|
||||||
//- Return the reference to the construction dictionary
|
//- Return the reference to the construction dictionary
|
||||||
inline const dictionary& dict() const;
|
inline const dictionary& dict() const;
|
||||||
|
|
||||||
//- Return the switch to send output to Info as well as to file
|
|
||||||
inline const Switch& log() const;
|
|
||||||
|
|
||||||
//- Return the source name
|
//- Return the source name
|
||||||
inline const word& sourceName() const;
|
inline const word& sourceName() const;
|
||||||
|
|
||||||
@ -170,42 +168,20 @@ public:
|
|||||||
//- Return access to the latest set of results
|
//- Return access to the latest set of results
|
||||||
inline const dictionary& resultDict() const;
|
inline const dictionary& resultDict() const;
|
||||||
|
|
||||||
|
|
||||||
// Function object functions
|
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual void read(const dictionary& dict);
|
virtual bool read(const dictionary& dict);
|
||||||
|
|
||||||
//- Write to screen/file
|
|
||||||
virtual void write();
|
|
||||||
|
|
||||||
//- Execute
|
//- Execute
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute the at the final time-loop, currently does nothing
|
//- Write to screen/file
|
||||||
virtual void end();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- 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>>&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace functionObjects
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -28,55 +28,39 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
inline const Foam::word& Foam::fieldValue::name() const
|
inline const Foam::dictionary& Foam::functionObjects::fieldValue::dict() const
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::objectRegistry& Foam::fieldValue::obr() const
|
|
||||||
{
|
|
||||||
return obr_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::dictionary& Foam::fieldValue::dict() const
|
|
||||||
{
|
{
|
||||||
return dict_;
|
return dict_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::Switch& Foam::fieldValue::log() const
|
inline const Foam::word& Foam::functionObjects::fieldValue::sourceName() const
|
||||||
{
|
|
||||||
return log_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::word& Foam::fieldValue::sourceName() const
|
|
||||||
{
|
{
|
||||||
return sourceName_;
|
return sourceName_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::wordList& Foam::fieldValue::fields() const
|
inline const Foam::wordList& Foam::functionObjects::fieldValue::fields() const
|
||||||
{
|
{
|
||||||
return fields_;
|
return fields_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::Switch& Foam::fieldValue::valueOutput() const
|
inline const Foam::Switch&
|
||||||
|
Foam::functionObjects::fieldValue::valueOutput() const
|
||||||
{
|
{
|
||||||
return valueOutput_;
|
return valueOutput_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::fvMesh& Foam::fieldValue::mesh() const
|
inline const Foam::fvMesh& Foam::functionObjects::fieldValue::mesh() const
|
||||||
{
|
{
|
||||||
return refCast<const fvMesh>(obr_);
|
return refCast<const fvMesh>(obr_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::dictionary& Foam::fieldValue::resultDict() const
|
inline const Foam::dictionary&
|
||||||
|
Foam::functionObjects::fieldValue::resultDict() const
|
||||||
{
|
{
|
||||||
return resultDict_;
|
return resultDict_;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -27,12 +27,12 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::autoPtr<Foam::fieldValue> Foam::fieldValue::New
|
Foam::autoPtr<Foam::functionObjects::fieldValue>
|
||||||
|
Foam::functionObjects::fieldValue::New
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const objectRegistry& obr,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
const bool loadFromFiles,
|
|
||||||
const bool output
|
const bool output
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -56,16 +56,7 @@ Foam::autoPtr<Foam::fieldValue> Foam::fieldValue::New
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
return autoPtr<fieldValue>
|
return autoPtr<fieldValue>(cstrIter()(name, obr, dict));
|
||||||
(
|
|
||||||
cstrIter()
|
|
||||||
(
|
|
||||||
name,
|
|
||||||
obr,
|
|
||||||
dict,
|
|
||||||
loadFromFiles
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ License
|
|||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fieldValue::combineFields(Field<Type>& field)
|
void Foam::functionObjects::fieldValue::combineFields(Field<Type>& field)
|
||||||
{
|
{
|
||||||
List<Field<Type>> allValues(Pstream::nProcs());
|
List<Field<Type>> allValues(Pstream::nProcs());
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ void Foam::fieldValue::combineFields(Field<Type>& field)
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::fieldValue::combineFields(tmp<Field<Type>>& field)
|
void Foam::functionObjects::fieldValue::combineFields(tmp<Field<Type>>& field)
|
||||||
{
|
{
|
||||||
combineFields(field());
|
combineFields(field());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,10 +24,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "fieldValueDelta.H"
|
#include "fieldValueDelta.H"
|
||||||
#include "ListOps.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "Time.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "surfaceFields.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -38,6 +35,7 @@ namespace functionObjects
|
|||||||
namespace fieldValues
|
namespace fieldValues
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(fieldValueDelta, 0);
|
defineTypeNameAndDebug(fieldValueDelta, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, fieldValueDelta, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -104,27 +102,23 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::writeFileHeader
|
|||||||
Foam::functionObjects::fieldValues::fieldValueDelta::fieldValueDelta
|
Foam::functionObjects::fieldValues::fieldValueDelta::fieldValueDelta
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFiles(obr, name, typeName),
|
writeFiles(name, runTime, dict, name),
|
||||||
name_(name),
|
|
||||||
obr_(obr),
|
|
||||||
loadFromFiles_(loadFromFiles),
|
|
||||||
log_(true),
|
|
||||||
operation_(opSubtract),
|
operation_(opSubtract),
|
||||||
source1Ptr_(NULL),
|
source1Ptr_(NULL),
|
||||||
source2Ptr_(NULL)
|
source2Ptr_(NULL)
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
read(dict);
|
read(dict);
|
||||||
|
resetName(typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -136,20 +130,20 @@ Foam::functionObjects::fieldValues::fieldValueDelta::~fieldValueDelta()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::fieldValueDelta::read
|
bool Foam::functionObjects::fieldValues::fieldValueDelta::read
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
log_ = dict.lookupOrDefault<Switch>("log", true);
|
writeFiles::read(dict);
|
||||||
|
|
||||||
source1Ptr_.reset
|
source1Ptr_.reset
|
||||||
(
|
(
|
||||||
fieldValue::New
|
fieldValue::New
|
||||||
(
|
(
|
||||||
name_ + ".source1",
|
name() + ".source1",
|
||||||
obr_,
|
obr_,
|
||||||
dict.subDict("source1"),
|
dict.subDict("source1"),
|
||||||
loadFromFiles_,
|
|
||||||
false
|
false
|
||||||
).ptr()
|
).ptr()
|
||||||
);
|
);
|
||||||
@ -157,21 +151,25 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::read
|
|||||||
(
|
(
|
||||||
fieldValue::New
|
fieldValue::New
|
||||||
(
|
(
|
||||||
name_ + ".source2",
|
name() + ".source2",
|
||||||
obr_,
|
obr_,
|
||||||
dict.subDict("source2"),
|
dict.subDict("source2"),
|
||||||
loadFromFiles_,
|
|
||||||
false
|
false
|
||||||
).ptr()
|
).ptr()
|
||||||
);
|
);
|
||||||
|
|
||||||
operation_ = operationTypeNames_.read(dict.lookup("operation"));
|
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();
|
source1Ptr_->write();
|
||||||
source2Ptr_->write();
|
source2Ptr_->write();
|
||||||
@ -181,7 +179,7 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::write()
|
|||||||
writeTime(file());
|
writeTime(file());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (log_) Info<< type() << " " << name_ << " output:" << endl;
|
if (log_) Info<< type() << " " << name() << " output:" << endl;
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
processFields<scalar>(found);
|
processFields<scalar>(found);
|
||||||
@ -206,33 +204,18 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::write()
|
|||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::fieldValueDelta::execute()
|
bool Foam::functionObjects::fieldValues::fieldValueDelta::execute
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::fieldValueDelta::end()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::fieldValueDelta::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::fieldValueDelta::updateMesh
|
|
||||||
(
|
(
|
||||||
const mapPolyMesh&
|
const bool postProcess
|
||||||
)
|
)
|
||||||
{}
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
void Foam::functionObjects::fieldValues::fieldValueDelta::movePoints
|
|
||||||
(
|
|
||||||
const polyMesh&
|
|
||||||
)
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -76,9 +76,8 @@ SourceFiles
|
|||||||
#ifndef functionObjects_fieldValueDelta_H
|
#ifndef functionObjects_fieldValueDelta_H
|
||||||
#define functionObjects_fieldValueDelta_H
|
#define functionObjects_fieldValueDelta_H
|
||||||
|
|
||||||
#include "functionObjectFiles.H"
|
#include "writeFiles.H"
|
||||||
#include "fieldValue.H"
|
#include "fieldValue.H"
|
||||||
#include "autoPtr.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ namespace fieldValues
|
|||||||
|
|
||||||
class fieldValueDelta
|
class fieldValueDelta
|
||||||
:
|
:
|
||||||
public functionObjectFiles
|
public writeFiles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//- Operation type enumeration
|
//- Operation type enumeration
|
||||||
@ -116,18 +115,6 @@ private:
|
|||||||
|
|
||||||
// Private data
|
// 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
|
//- Operation to apply to values
|
||||||
operationType operation_;
|
operationType operation_;
|
||||||
|
|
||||||
@ -151,7 +138,7 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Functions to be over-ridden from IOoutputFilter class
|
// Protected Member Functions
|
||||||
|
|
||||||
//- Output file header information
|
//- Output file header information
|
||||||
virtual void writeFileHeader(const label i);
|
virtual void writeFileHeader(const label i);
|
||||||
@ -165,13 +152,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from Time and dictionary
|
||||||
fieldValueDelta
|
fieldValueDelta
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -181,28 +167,14 @@ public:
|
|||||||
|
|
||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
// Function object functions
|
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
|
//- Do nothing
|
||||||
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Calculate and write
|
//- Calculate and write
|
||||||
virtual void write();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- 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&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -25,8 +25,7 @@ License
|
|||||||
|
|
||||||
#include "grad.H"
|
#include "grad.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "dictionary.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "grad.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -35,6 +34,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(grad, 0);
|
defineTypeNameAndDebug(grad, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, grad, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,17 +44,22 @@ namespace functionObjects
|
|||||||
Foam::functionObjects::grad::grad
|
Foam::functionObjects::grad::grad
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
functionObject(name),
|
||||||
obr_(obr),
|
obr_
|
||||||
|
(
|
||||||
|
runTime.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
),
|
||||||
fieldName_("undefined-fieldName"),
|
fieldName_("undefined-fieldName"),
|
||||||
resultName_("undefined-resultName")
|
resultName_("undefined-resultName")
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -72,7 +77,7 @@ Foam::functionObjects::grad::~grad()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::grad::read(const dictionary& dict)
|
bool Foam::functionObjects::grad::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup("fieldName") >> fieldName_;
|
dict.lookup("fieldName") >> fieldName_;
|
||||||
dict.lookup("resultName") >> resultName_;
|
dict.lookup("resultName") >> resultName_;
|
||||||
@ -81,10 +86,12 @@ void Foam::functionObjects::grad::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
resultName_ = "fvc::grad(" + fieldName_ + ")";
|
resultName_ = "fvc::grad(" + fieldName_ + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::grad::execute()
|
bool Foam::functionObjects::grad::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
bool processed = false;
|
bool processed = false;
|
||||||
|
|
||||||
@ -96,31 +103,25 @@ void Foam::functionObjects::grad::execute()
|
|||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Unprocessed field " << fieldName_ << endl;
|
<< "Unprocessed field " << fieldName_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::grad::end()
|
bool Foam::functionObjects::grad::write(const bool postProcess)
|
||||||
{
|
|
||||||
execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::grad::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::grad::write()
|
|
||||||
{
|
{
|
||||||
if (obr_.foundObject<regIOobject>(resultName_))
|
if (obr_.foundObject<regIOobject>(resultName_))
|
||||||
{
|
{
|
||||||
const regIOobject& field =
|
const regIOobject& field =
|
||||||
obr_.lookupObject<regIOobject>(resultName_);
|
obr_.lookupObject<regIOobject>(resultName_);
|
||||||
|
|
||||||
Info<< type() << " " << name_ << " output:" << nl
|
Info<< type() << " " << name() << " output:" << nl
|
||||||
<< " writing field " << field.name() << nl << endl;
|
<< " writing field " << field.name() << nl << endl;
|
||||||
|
|
||||||
field.write();
|
field.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -40,11 +40,8 @@ SourceFiles
|
|||||||
#ifndef functionObjects_grad_H
|
#ifndef functionObjects_grad_H
|
||||||
#define functionObjects_grad_H
|
#define functionObjects_grad_H
|
||||||
|
|
||||||
|
#include "functionObject.H"
|
||||||
#include "volFieldsFwd.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
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
class polyMesh;
|
|
||||||
class mapPolyMesh;
|
|
||||||
class dimensionSet;
|
class dimensionSet;
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
@ -66,13 +60,12 @@ namespace functionObjects
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class grad
|
class grad
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of this grad object
|
//- Reference to the objectRegistry
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Reference to the database
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- Name of field to process
|
//- Name of field to process
|
||||||
@ -118,14 +111,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
//- Construct from Time and dictionary
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
grad
|
grad
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -135,34 +126,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the set of grad
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the grad data
|
//- Read the grad data
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Calculate the gradient field
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute at the final time-loop, currently does nothing
|
//- Write the gradient field
|
||||||
virtual void end();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- 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&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "histogram.H"
|
#include "histogram.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -33,6 +34,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(histogram, 0);
|
defineTypeNameAndDebug(histogram, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, histogram, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,15 +71,13 @@ void Foam::functionObjects::histogram::writeGraph
|
|||||||
Foam::functionObjects::histogram::histogram
|
Foam::functionObjects::histogram::histogram
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFile(obr, typeName),
|
writeFile(name, runTime, dict, name)
|
||||||
name_(name)
|
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -95,7 +95,7 @@ Foam::functionObjects::histogram::~histogram()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::histogram::read(const dictionary& dict)
|
bool Foam::functionObjects::histogram::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup("field") >> fieldName_;
|
dict.lookup("field") >> fieldName_;
|
||||||
dict.lookup("max") >> max_;
|
dict.lookup("max") >> max_;
|
||||||
@ -104,24 +104,20 @@ void Foam::functionObjects::histogram::read(const dictionary& dict)
|
|||||||
|
|
||||||
word format(dict.lookup("setFormat"));
|
word format(dict.lookup("setFormat"));
|
||||||
formatterPtr_ = writer<scalar>::New(format);
|
formatterPtr_ = writer<scalar>::New(format);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::histogram::execute()
|
bool Foam::functionObjects::histogram::execute(const bool postProcess)
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::histogram::end()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::histogram::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::histogram::write()
|
|
||||||
{
|
{
|
||||||
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_);
|
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||||
|
|
||||||
@ -201,6 +197,8 @@ void Foam::functionObjects::histogram::write()
|
|||||||
writeGraph(coords, field.name(), volFrac);
|
writeGraph(coords, field.name(), volFrac);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@ Description
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
Foam::functionObjects::writeFile
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
histogram.C
|
histogram.C
|
||||||
@ -70,19 +70,12 @@ SourceFiles
|
|||||||
#define functionObjects_histogram_H
|
#define functionObjects_histogram_H
|
||||||
|
|
||||||
#include "writer.H"
|
#include "writer.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "writeFile.H"
|
||||||
#include "functionObjectFile.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
|
|
||||||
// Forward declaration of classes
|
|
||||||
class objectRegistry;
|
|
||||||
class mapPolyMesh;
|
|
||||||
class polyMesh;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -92,13 +85,10 @@ namespace functionObjects
|
|||||||
|
|
||||||
class histogram
|
class histogram
|
||||||
:
|
:
|
||||||
public functionObjectFile
|
public writeFile
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of this histogram
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Name of field
|
//- Name of field
|
||||||
word fieldName_;
|
word fieldName_;
|
||||||
|
|
||||||
@ -139,52 +129,31 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
//- Construct from Time and dictionary
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
histogram
|
histogram
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
|
|
||||||
virtual ~histogram();
|
virtual ~histogram();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the set of histogram
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the histogram data
|
//- Read the histogram data
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Execute, currently does nothing
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute at the final time-loop, currently does nothing
|
//- Calculate the histogram and write.
|
||||||
virtual void end();
|
// postProcess overrides the usual writeControl behaviour and
|
||||||
|
// forces writing always (used in post-processing mode)
|
||||||
//- Called when time was set at the end of the Time::operator++
|
virtual bool write(const bool postProcess = false);
|
||||||
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&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -25,8 +25,7 @@ License
|
|||||||
|
|
||||||
#include "mag.H"
|
#include "mag.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "dictionary.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "mag.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -35,6 +34,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(mag, 0);
|
defineTypeNameAndDebug(mag, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, mag, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,17 +44,22 @@ namespace functionObjects
|
|||||||
Foam::functionObjects::mag::mag
|
Foam::functionObjects::mag::mag
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
functionObject(name),
|
||||||
obr_(obr),
|
obr_
|
||||||
|
(
|
||||||
|
runTime.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
),
|
||||||
fieldName_("undefined-fieldName"),
|
fieldName_("undefined-fieldName"),
|
||||||
resultName_("undefined-resultName")
|
resultName_("undefined-resultName")
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -72,7 +77,7 @@ Foam::functionObjects::mag::~mag()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::mag::read(const dictionary& dict)
|
bool Foam::functionObjects::mag::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup("fieldName") >> fieldName_;
|
dict.lookup("fieldName") >> fieldName_;
|
||||||
dict.lookup("resultName") >> resultName_;
|
dict.lookup("resultName") >> resultName_;
|
||||||
@ -81,10 +86,12 @@ void Foam::functionObjects::mag::read(const dictionary& dict)
|
|||||||
{
|
{
|
||||||
resultName_ = "mag(" + fieldName_ + ")";
|
resultName_ = "mag(" + fieldName_ + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::mag::execute()
|
bool Foam::functionObjects::mag::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
bool processed = false;
|
bool processed = false;
|
||||||
|
|
||||||
@ -99,31 +106,25 @@ void Foam::functionObjects::mag::execute()
|
|||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Unprocessed field " << fieldName_ << endl;
|
<< "Unprocessed field " << fieldName_ << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::mag::end()
|
bool Foam::functionObjects::mag::write(const bool postProcess)
|
||||||
{
|
|
||||||
execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::mag::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::mag::write()
|
|
||||||
{
|
{
|
||||||
if (obr_.foundObject<regIOobject>(resultName_))
|
if (obr_.foundObject<regIOobject>(resultName_))
|
||||||
{
|
{
|
||||||
const regIOobject& field =
|
const regIOobject& field =
|
||||||
obr_.lookupObject<regIOobject>(resultName_);
|
obr_.lookupObject<regIOobject>(resultName_);
|
||||||
|
|
||||||
Info<< type() << " " << name_ << " output:" << nl
|
Info<< type() << " " << name() << " output:" << nl
|
||||||
<< " writing field " << field.name() << nl << endl;
|
<< " writing field " << field.name() << nl << endl;
|
||||||
|
|
||||||
field.write();
|
field.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -40,11 +40,8 @@ SourceFiles
|
|||||||
#ifndef functionObjects_mag_H
|
#ifndef functionObjects_mag_H
|
||||||
#define functionObjects_mag_H
|
#define functionObjects_mag_H
|
||||||
|
|
||||||
|
#include "functionObject.H"
|
||||||
#include "volFieldsFwd.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
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
class polyMesh;
|
|
||||||
class mapPolyMesh;
|
|
||||||
class dimensionSet;
|
class dimensionSet;
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
@ -66,13 +60,12 @@ namespace functionObjects
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class mag
|
class mag
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of this mag object
|
//- Reference to the objectRegistry
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Reference to the database
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- Name of field to process
|
//- Name of field to process
|
||||||
@ -112,14 +105,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
//- Construct from Time and dictionary
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
mag
|
mag
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -129,34 +120,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the set of mag
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the mag data
|
//- Read the mag data
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Calculate the magnitude field
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute at the final time-loop, currently does nothing
|
//- Write the magnitude field
|
||||||
virtual void end();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- 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&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -28,6 +28,7 @@ License
|
|||||||
#include "findCellParticle.H"
|
#include "findCellParticle.H"
|
||||||
#include "mappedPatchBase.H"
|
#include "mappedPatchBase.H"
|
||||||
#include "OBJstream.H"
|
#include "OBJstream.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -36,6 +37,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(nearWallFields, 0);
|
defineTypeNameAndDebug(nearWallFields, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, nearWallFields, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,16 +226,21 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
|||||||
Foam::functionObjects::nearWallFields::nearWallFields
|
Foam::functionObjects::nearWallFields::nearWallFields
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
functionObject(name),
|
||||||
obr_(obr),
|
obr_
|
||||||
|
(
|
||||||
|
runTime.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
),
|
||||||
fieldSet_()
|
fieldSet_()
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -256,7 +263,7 @@ Foam::functionObjects::nearWallFields::~nearWallFields()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -295,15 +302,17 @@ void Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
|||||||
reverseFieldMap_.insert(sampleFldName, fldName);
|
reverseFieldMap_.insert(sampleFldName, fldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< type() << " " << name_ << ": Sampling " << fieldMap_.size()
|
Info<< type() << " " << name() << ": Sampling " << fieldMap_.size()
|
||||||
<< " fields" << endl;
|
<< " fields" << endl;
|
||||||
|
|
||||||
// Do analysis
|
// Do analysis
|
||||||
calcAddressing();
|
calcAddressing();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::nearWallFields::execute()
|
bool Foam::functionObjects::nearWallFields::execute(const bool postProcess)
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -320,7 +329,7 @@ void Foam::functionObjects::nearWallFields::execute()
|
|||||||
&& vtf_.empty()
|
&& vtf_.empty()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Info<< type() << " " << name_ << ": Creating " << fieldMap_.size()
|
Info<< type() << " " << name() << ": Creating " << fieldMap_.size()
|
||||||
<< " fields" << endl;
|
<< " fields" << endl;
|
||||||
|
|
||||||
createFields(vsf_);
|
createFields(vsf_);
|
||||||
@ -332,7 +341,7 @@ void Foam::functionObjects::nearWallFields::execute()
|
|||||||
Info<< endl;
|
Info<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< type() << " " << name_ << " output:" << nl;
|
Info<< type() << " " << name() << " output:" << nl;
|
||||||
|
|
||||||
Info<< " Sampling fields to " << obr_.time().timeName()
|
Info<< " Sampling fields to " << obr_.time().timeName()
|
||||||
<< endl;
|
<< endl;
|
||||||
@ -342,25 +351,12 @@ void Foam::functionObjects::nearWallFields::execute()
|
|||||||
sampleFields(vSpheretf_);
|
sampleFields(vSpheretf_);
|
||||||
sampleFields(vSymmtf_);
|
sampleFields(vSymmtf_);
|
||||||
sampleFields(vtf_);
|
sampleFields(vtf_);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::nearWallFields::end()
|
bool Foam::functionObjects::nearWallFields::write(const bool postProcess)
|
||||||
{
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
InfoInFunction << endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::nearWallFields::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::nearWallFields::write()
|
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
@ -392,6 +388,8 @@ void Foam::functionObjects::nearWallFields::write()
|
|||||||
}
|
}
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -62,7 +62,6 @@ Description
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
nearWallFields.C
|
nearWallFields.C
|
||||||
@ -72,7 +71,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_nearWallFields_H
|
#ifndef functionObjects_nearWallFields_H
|
||||||
#define functionObjects_nearWallFields_H
|
#define functionObjects_nearWallFields_H
|
||||||
|
|
||||||
#include "OFstream.H"
|
#include "functionObject.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "Tuple2.H"
|
#include "Tuple2.H"
|
||||||
#include "interpolationCellPoint.H"
|
#include "interpolationCellPoint.H"
|
||||||
@ -84,8 +83,6 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
class mapPolyMesh;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
@ -95,14 +92,14 @@ namespace functionObjects
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class nearWallFields
|
class nearWallFields
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of this set of nearWallFields object
|
//- Reference to the objectRegistry
|
||||||
word name_;
|
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
// Read from dictionary
|
// Read from dictionary
|
||||||
@ -191,9 +188,8 @@ public:
|
|||||||
nearWallFields
|
nearWallFields
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -203,34 +199,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the nearWallFields object
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the controls
|
//- Read the controls
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Calculate the near-wall fields
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute at the final time-loop, currently does nothing
|
//- Write the near-wall fields
|
||||||
virtual void end();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- 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&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -24,8 +24,8 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "processorField.H"
|
#include "processorField.H"
|
||||||
#include "dictionary.H"
|
#include "volFields.H"
|
||||||
#include "Pstream.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -34,6 +34,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(processorField, 0);
|
defineTypeNameAndDebug(processorField, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, processorField, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,15 +44,20 @@ namespace functionObjects
|
|||||||
Foam::functionObjects::processorField::processorField
|
Foam::functionObjects::processorField::processorField
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
functionObject(name),
|
||||||
obr_(obr)
|
obr_
|
||||||
|
(
|
||||||
|
runTime.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
)
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -90,36 +96,32 @@ Foam::functionObjects::processorField::~processorField()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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 =
|
const volScalarField& procField =
|
||||||
obr_.lookupObject<volScalarField>("processorID");
|
obr_.lookupObject<volScalarField>("processorID");
|
||||||
|
|
||||||
const_cast<volScalarField&>(procField) ==
|
const_cast<volScalarField&>(procField) ==
|
||||||
dimensionedScalar("proci", dimless, Pstream::myProcNo());
|
dimensionedScalar("proci", dimless, Pstream::myProcNo());
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::processorField::end()
|
bool Foam::functionObjects::processorField::write(const bool postProcess)
|
||||||
{
|
|
||||||
execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::processorField::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::processorField::write()
|
|
||||||
{
|
{
|
||||||
const volScalarField& procField =
|
const volScalarField& procField =
|
||||||
obr_.lookupObject<volScalarField>("processorID");
|
obr_.lookupObject<volScalarField>("processorID");
|
||||||
|
|
||||||
procField.write();
|
procField.write();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -49,7 +49,6 @@ Description
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
processorField.C
|
processorField.C
|
||||||
@ -59,11 +58,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_processorField_H
|
#ifndef functionObjects_processorField_H
|
||||||
#define functionObjects_processorField_H
|
#define functionObjects_processorField_H
|
||||||
|
|
||||||
#include "OFstream.H"
|
#include "functionObject.H"
|
||||||
#include "pointFieldFwd.H"
|
|
||||||
#include "volFields.H"
|
|
||||||
#include "surfaceFields.H"
|
|
||||||
#include "coordinateSystem.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -72,8 +67,6 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
class mapPolyMesh;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
@ -83,15 +76,14 @@ namespace functionObjects
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class processorField
|
class processorField
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of this set of nearWallFields object
|
//- Reference to the objectRegistry
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Reference to the database
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
|
|
||||||
@ -114,14 +106,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
//- Construct from Time and dictionary
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
processorField
|
processorField
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -131,34 +121,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the processorField object
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the input data
|
//- Read the input data
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Calculate the processorID field
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute at the final time-loop, currently does nothing
|
//- Write the processorID field
|
||||||
virtual void end();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- 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&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -24,7 +24,9 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "readFields.H"
|
#include "readFields.H"
|
||||||
#include "dictionary.H"
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -33,6 +35,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(readFields, 0);
|
defineTypeNameAndDebug(readFields, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, readFields, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -42,16 +45,21 @@ namespace functionObjects
|
|||||||
Foam::functionObjects::readFields::readFields
|
Foam::functionObjects::readFields::readFields
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
functionObject(name),
|
||||||
obr_(obr),
|
obr_
|
||||||
|
(
|
||||||
|
runTime.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
),
|
||||||
fieldSet_()
|
fieldSet_()
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -69,13 +77,15 @@ Foam::functionObjects::readFields::~readFields()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::readFields::read(const dictionary& dict)
|
bool Foam::functionObjects::readFields::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup("fields") >> fieldSet_;
|
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
|
// Clear out any previously loaded fields
|
||||||
vsf_.clear();
|
vsf_.clear();
|
||||||
@ -101,21 +111,15 @@ void Foam::functionObjects::readFields::execute()
|
|||||||
loadField<symmTensor>(fieldName, vSymmtf_, sSymmtf_);
|
loadField<symmTensor>(fieldName, vSymmtf_, sSymmtf_);
|
||||||
loadField<tensor>(fieldName, vtf_, stf_);
|
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()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -55,7 +55,6 @@ Description
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
readFields.C
|
readFields.C
|
||||||
@ -65,10 +64,9 @@ SourceFiles
|
|||||||
#ifndef functionObjects_readFields_H
|
#ifndef functionObjects_readFields_H
|
||||||
#define functionObjects_readFields_H
|
#define functionObjects_readFields_H
|
||||||
|
|
||||||
#include "OFstream.H"
|
#include "functionObject.H"
|
||||||
#include "pointFieldFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "volFields.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
#include "surfaceFields.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -77,8 +75,6 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
class mapPolyMesh;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
@ -88,14 +84,14 @@ namespace functionObjects
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class readFields
|
class readFields
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of this set of readFields object
|
//- Reference to the objectRegistry
|
||||||
word name_;
|
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- Fields to load
|
//- Fields to load
|
||||||
@ -150,9 +146,8 @@ public:
|
|||||||
readFields
|
readFields
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -162,34 +157,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the readFields object
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the set of fields from dictionary
|
//- Read the set of fields from dictionary
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Read the fields
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute at the final time-loop, currently does nothing
|
//- Do nothing
|
||||||
virtual void end();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- 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&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -24,11 +24,8 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "regionSizeDistribution.H"
|
#include "regionSizeDistribution.H"
|
||||||
#include "volFields.H"
|
|
||||||
#include "regionSplit.H"
|
|
||||||
#include "fvcVolumeIntegrate.H"
|
#include "fvcVolumeIntegrate.H"
|
||||||
#include "mathematicalConstants.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
#include "stringListOps.H"
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -37,6 +34,13 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(regionSizeDistribution, 0);
|
defineTypeNameAndDebug(regionSizeDistribution, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
regionSizeDistribution,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
//- Plus op for FixedList<scalar>
|
//- Plus op for FixedList<scalar>
|
||||||
@ -322,18 +326,15 @@ void Foam::functionObjects::regionSizeDistribution::writeGraphs
|
|||||||
Foam::functionObjects::regionSizeDistribution::regionSizeDistribution
|
Foam::functionObjects::regionSizeDistribution::regionSizeDistribution
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
functionObjectFiles(obr, name, typeName),
|
writeFile(name, runTime, dict, name),
|
||||||
name_(name),
|
|
||||||
obr_(obr),
|
|
||||||
alphaName_(dict.lookup("field")),
|
alphaName_(dict.lookup("field")),
|
||||||
patchNames_(dict.lookup("patches"))
|
patchNames_(dict.lookup("patches"))
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -351,7 +352,7 @@ Foam::functionObjects::regionSizeDistribution::~regionSizeDistribution()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
|
bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
|
||||||
{
|
{
|
||||||
dict.lookup("field") >> alphaName_;
|
dict.lookup("field") >> alphaName_;
|
||||||
dict.lookup("patches") >> patchNames_;
|
dict.lookup("patches") >> patchNames_;
|
||||||
@ -372,24 +373,26 @@ void Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
|
|||||||
Info<< "Transforming all vectorFields with coordinate system "
|
Info<< "Transforming all vectorFields with coordinate system "
|
||||||
<< coordSysPtr_().name() << endl;
|
<< coordSysPtr_().name() << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::regionSizeDistribution::execute()
|
bool Foam::functionObjects::regionSizeDistribution::execute
|
||||||
{}
|
(
|
||||||
|
const bool postProcess
|
||||||
|
)
|
||||||
void Foam::functionObjects::regionSizeDistribution::end()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::regionSizeDistribution::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::regionSizeDistribution::write()
|
|
||||||
{
|
{
|
||||||
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_);
|
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||||
|
|
||||||
@ -846,6 +849,8 @@ void Foam::functionObjects::regionSizeDistribution::write()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,7 @@ Description
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
Foam::functionObjects::writeFile
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
regionSizeDistribution.C
|
regionSizeDistribution.C
|
||||||
@ -106,8 +106,7 @@ SourceFiles
|
|||||||
#ifndef functionObjects_regionSizeDistribution_H
|
#ifndef functionObjects_regionSizeDistribution_H
|
||||||
#define functionObjects_regionSizeDistribution_H
|
#define functionObjects_regionSizeDistribution_H
|
||||||
|
|
||||||
#include "functionObjectFiles.H"
|
#include "writeFile.H"
|
||||||
#include "pointFieldFwd.H"
|
|
||||||
#include "writer.H"
|
#include "writer.H"
|
||||||
#include "Map.H"
|
#include "Map.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
@ -121,10 +120,7 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
class mapPolyMesh;
|
|
||||||
class regionSplit;
|
class regionSplit;
|
||||||
class polyMesh;
|
|
||||||
|
|
||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
@ -135,15 +131,10 @@ namespace functionObjects
|
|||||||
|
|
||||||
class regionSizeDistribution
|
class regionSizeDistribution
|
||||||
:
|
:
|
||||||
public functionObjectFiles
|
public writeFile
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Name of this set of regionSizeDistribution objects
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
|
||||||
|
|
||||||
//- Name of field
|
//- Name of field
|
||||||
word alphaName_;
|
word alphaName_;
|
||||||
|
|
||||||
@ -250,9 +241,8 @@ public:
|
|||||||
regionSizeDistribution
|
regionSizeDistribution
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary&
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -263,34 +253,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the set of regionSizeDistribution
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the regionSizeDistribution data
|
//- Read the regionSizeDistribution data
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Do 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 regionSizeDistribution and write
|
//- Calculate the regionSizeDistribution and write
|
||||||
virtual void write();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void updateMesh(const mapPolyMesh&)
|
|
||||||
{}
|
|
||||||
|
|
||||||
//- Update for changes of mesh
|
|
||||||
virtual void movePoints(const polyMesh&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -36,6 +36,7 @@ License
|
|||||||
#include "interpolationCellPoint.H"
|
#include "interpolationCellPoint.H"
|
||||||
#include "PatchTools.H"
|
#include "PatchTools.H"
|
||||||
#include "mapPolyMesh.H"
|
#include "mapPolyMesh.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -44,6 +45,7 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(streamLine, 0);
|
defineTypeNameAndDebug(streamLine, 0);
|
||||||
|
addToRunTimeSelectionTable(functionObject, streamLine, dictionary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +103,6 @@ Foam::functionObjects::streamLine::wallPatch() const
|
|||||||
|
|
||||||
void Foam::functionObjects::streamLine::track()
|
void Foam::functionObjects::streamLine::track()
|
||||||
{
|
{
|
||||||
const Time& runTime = obr_.time();
|
|
||||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||||
|
|
||||||
IDLList<streamLineParticle> initialParticles;
|
IDLList<streamLineParticle> initialParticles;
|
||||||
@ -140,47 +141,6 @@ void Foam::functionObjects::streamLine::track()
|
|||||||
|
|
||||||
label UIndex = -1;
|
label UIndex = -1;
|
||||||
|
|
||||||
if (loadFromFiles_)
|
|
||||||
{
|
|
||||||
IOobjectList allObjects(mesh, runTime.timeName());
|
|
||||||
|
|
||||||
IOobjectList objects(2*fields_.size());
|
|
||||||
forAll(fields_, i)
|
|
||||||
{
|
|
||||||
objects.add(*allObjects[fields_[i]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
ReadFields(mesh, objects, vsFlds);
|
|
||||||
vsInterp.setSize(vsFlds.size());
|
|
||||||
forAll(vsFlds, i)
|
|
||||||
{
|
|
||||||
vsInterp.set
|
|
||||||
(
|
|
||||||
i,
|
|
||||||
interpolation<scalar>::New
|
|
||||||
(
|
|
||||||
interpolationScheme_,
|
|
||||||
vsFlds[i]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
ReadFields(mesh, objects, vvFlds);
|
|
||||||
vvInterp.setSize(vvFlds.size());
|
|
||||||
forAll(vvFlds, i)
|
|
||||||
{
|
|
||||||
vvInterp.set
|
|
||||||
(
|
|
||||||
i,
|
|
||||||
interpolation<vector>::New
|
|
||||||
(
|
|
||||||
interpolationScheme_,
|
|
||||||
vvFlds[i]
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
label nScalar = 0;
|
label nScalar = 0;
|
||||||
label nVector = 0;
|
label nVector = 0;
|
||||||
|
|
||||||
@ -251,7 +211,6 @@ void Foam::functionObjects::streamLine::track()
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Store the names
|
// Store the names
|
||||||
scalarNames_.setSize(vsInterp.size());
|
scalarNames_.setSize(vsInterp.size());
|
||||||
@ -327,18 +286,22 @@ void Foam::functionObjects::streamLine::track()
|
|||||||
Foam::functionObjects::streamLine::streamLine
|
Foam::functionObjects::streamLine::streamLine
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
|
functionObject(name),
|
||||||
|
obr_
|
||||||
|
(
|
||||||
|
runTime.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
),
|
||||||
dict_(dict),
|
dict_(dict),
|
||||||
name_(name),
|
|
||||||
obr_(obr),
|
|
||||||
loadFromFiles_(loadFromFiles),
|
|
||||||
nSubCycle_(0)
|
nSubCycle_(0)
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -356,9 +319,9 @@ Foam::functionObjects::streamLine::~streamLine()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * 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_;
|
dict.lookup("fields") >> fields_;
|
||||||
if (dict.found("UName"))
|
if (dict.found("UName"))
|
||||||
@ -455,24 +418,20 @@ void Foam::functionObjects::streamLine::read(const dictionary& dict)
|
|||||||
|
|
||||||
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
||||||
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::streamLine::execute()
|
bool Foam::functionObjects::streamLine::execute(const bool postProcess)
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::streamLine::end()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::streamLine::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::streamLine::write()
|
|
||||||
{
|
{
|
||||||
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 Time& runTime = obr_.time();
|
||||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
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
|
// Distribute the track positions. Note: use scheduled comms
|
||||||
// to prevent buffering.
|
// to prevent buffering.
|
||||||
mapDistribute::distribute
|
mapDistributeBase::distribute
|
||||||
(
|
(
|
||||||
Pstream::scheduled,
|
Pstream::scheduled,
|
||||||
distMap.schedule(),
|
distMap.schedule(),
|
||||||
distMap.constructSize(),
|
distMap.constructSize(),
|
||||||
distMap.subMap(),
|
distMap.subMap(),
|
||||||
|
false,
|
||||||
distMap.constructMap(),
|
distMap.constructMap(),
|
||||||
allTracks_
|
false,
|
||||||
|
allTracks_,
|
||||||
|
flipOp()
|
||||||
);
|
);
|
||||||
|
|
||||||
// Distribute the scalars
|
// Distribute the scalars
|
||||||
forAll(allScalars_, scalarI)
|
forAll(allScalars_, scalarI)
|
||||||
{
|
{
|
||||||
mapDistribute::distribute
|
allScalars_[scalarI].shrink();
|
||||||
|
mapDistributeBase::distribute
|
||||||
(
|
(
|
||||||
Pstream::scheduled,
|
Pstream::scheduled,
|
||||||
distMap.schedule(),
|
distMap.schedule(),
|
||||||
distMap.constructSize(),
|
distMap.constructSize(),
|
||||||
distMap.subMap(),
|
distMap.subMap(),
|
||||||
|
false,
|
||||||
distMap.constructMap(),
|
distMap.constructMap(),
|
||||||
allScalars_[scalarI]
|
false,
|
||||||
|
allScalars_[scalarI],
|
||||||
|
flipOp()
|
||||||
);
|
);
|
||||||
|
allScalars_[scalarI].setCapacity(allScalars_[scalarI].size());
|
||||||
}
|
}
|
||||||
// Distribute the vectors
|
// Distribute the vectors
|
||||||
forAll(allVectors_, vectorI)
|
forAll(allVectors_, vectorI)
|
||||||
{
|
{
|
||||||
mapDistribute::distribute
|
allVectors_[vectorI].shrink();
|
||||||
|
mapDistributeBase::distribute
|
||||||
(
|
(
|
||||||
Pstream::scheduled,
|
Pstream::scheduled,
|
||||||
distMap.schedule(),
|
distMap.schedule(),
|
||||||
distMap.constructSize(),
|
distMap.constructSize(),
|
||||||
distMap.subMap(),
|
distMap.subMap(),
|
||||||
|
false,
|
||||||
distMap.constructMap(),
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -91,7 +91,7 @@ Note
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
Foam::functionObjects::timeControl
|
||||||
Foam::sampledSet
|
Foam::sampledSet
|
||||||
Foam::wallBoundedStreamLine
|
Foam::wallBoundedStreamLine
|
||||||
|
|
||||||
@ -103,13 +103,11 @@ SourceFiles
|
|||||||
#ifndef functionObjects_streamLine_H
|
#ifndef functionObjects_streamLine_H
|
||||||
#define functionObjects_streamLine_H
|
#define functionObjects_streamLine_H
|
||||||
|
|
||||||
|
#include "functionObject.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
#include "pointFieldFwd.H"
|
|
||||||
#include "Switch.H"
|
|
||||||
#include "DynamicList.H"
|
#include "DynamicList.H"
|
||||||
#include "scalarList.H"
|
#include "scalarList.H"
|
||||||
#include "vectorList.H"
|
#include "vectorList.H"
|
||||||
#include "polyMesh.H"
|
|
||||||
#include "writer.H"
|
#include "writer.H"
|
||||||
#include "indirectPrimitivePatch.H"
|
#include "indirectPrimitivePatch.H"
|
||||||
|
|
||||||
@ -120,8 +118,6 @@ namespace Foam
|
|||||||
|
|
||||||
// Forward declaration of classes
|
// Forward declaration of classes
|
||||||
class objectRegistry;
|
class objectRegistry;
|
||||||
class dictionary;
|
|
||||||
class mapPolyMesh;
|
|
||||||
class meshSearch;
|
class meshSearch;
|
||||||
class sampledSet;
|
class sampledSet;
|
||||||
|
|
||||||
@ -133,20 +129,16 @@ namespace functionObjects
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class streamLine
|
class streamLine
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Input dictionary
|
|
||||||
dictionary dict_;
|
|
||||||
|
|
||||||
//- Name of this set of field averages.
|
|
||||||
word name_;
|
|
||||||
|
|
||||||
//- Database this class is registered to
|
//- Database this class is registered to
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- Load fields from files (not from objectRegistry)
|
//- Input dictionary
|
||||||
bool loadFromFiles_;
|
dictionary dict_;
|
||||||
|
|
||||||
//- List of fields to sample
|
//- List of fields to sample
|
||||||
wordList fields_;
|
wordList fields_;
|
||||||
@ -233,14 +225,12 @@ public:
|
|||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct for given objectRegistry and dictionary.
|
//- Construct from Time and dictionary
|
||||||
// Allow the possibility to load fields from files
|
|
||||||
streamLine
|
streamLine
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -250,26 +240,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the set of field averages
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the field average data
|
//- Read the field average data
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute the averaging
|
//- Do nothing
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute the averaging at the final time-loop, currently does nothing
|
//- Calculate and write the steamlines
|
||||||
virtual void end();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- 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 for changes of mesh
|
//- Update for changes of mesh
|
||||||
virtual void updateMesh(const mapPolyMesh&);
|
virtual void updateMesh(const mapPolyMesh&);
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -24,6 +24,8 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "surfaceInterpolateFields.H"
|
#include "surfaceInterpolateFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -32,6 +34,13 @@ namespace Foam
|
|||||||
namespace functionObjects
|
namespace functionObjects
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(surfaceInterpolateFields, 0);
|
defineTypeNameAndDebug(surfaceInterpolateFields, 0);
|
||||||
|
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
functionObject,
|
||||||
|
surfaceInterpolateFields,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,16 +50,21 @@ namespace functionObjects
|
|||||||
Foam::functionObjects::surfaceInterpolateFields::surfaceInterpolateFields
|
Foam::functionObjects::surfaceInterpolateFields::surfaceInterpolateFields
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry& obr,
|
const Time& runTime,
|
||||||
const dictionary& dict,
|
const dictionary& dict
|
||||||
const bool loadFromFiles
|
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
name_(name),
|
functionObject(name),
|
||||||
obr_(obr),
|
obr_
|
||||||
|
(
|
||||||
|
runTime.lookupObject<objectRegistry>
|
||||||
|
(
|
||||||
|
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||||
|
)
|
||||||
|
),
|
||||||
fieldSet_()
|
fieldSet_()
|
||||||
{
|
{
|
||||||
if (!isA<fvMesh>(obr))
|
if (!isA<fvMesh>(obr_))
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||||
@ -68,18 +82,23 @@ Foam::functionObjects::surfaceInterpolateFields::~surfaceInterpolateFields()
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::functionObjects::surfaceInterpolateFields::read
|
bool Foam::functionObjects::surfaceInterpolateFields::read
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
dict.lookup("fields") >> fieldSet_;
|
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
|
// Clear out any previously loaded fields
|
||||||
ssf_.clear();
|
ssf_.clear();
|
||||||
@ -95,22 +114,17 @@ void Foam::functionObjects::surfaceInterpolateFields::execute()
|
|||||||
interpolateFields<tensor>(stf_);
|
interpolateFields<tensor>(stf_);
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::surfaceInterpolateFields::end()
|
bool Foam::functionObjects::surfaceInterpolateFields::write
|
||||||
|
(
|
||||||
|
const bool postProcess
|
||||||
|
)
|
||||||
{
|
{
|
||||||
execute();
|
Info<< type() << " " << name() << " output:" << nl;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::surfaceInterpolateFields::timeSet()
|
|
||||||
{}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::surfaceInterpolateFields::write()
|
|
||||||
{
|
|
||||||
Info<< type() << " " << name_ << " output:" << nl;
|
|
||||||
|
|
||||||
Info<< " Writing interpolated surface fields to "
|
Info<< " Writing interpolated surface fields to "
|
||||||
<< obr_.time().timeName() << endl;
|
<< obr_.time().timeName() << endl;
|
||||||
@ -135,6 +149,8 @@ void Foam::functionObjects::surfaceInterpolateFields::write()
|
|||||||
{
|
{
|
||||||
stf_[i].write();
|
stf_[i].write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -59,7 +59,7 @@ Description
|
|||||||
|
|
||||||
SeeAlso
|
SeeAlso
|
||||||
Foam::functionObject
|
Foam::functionObject
|
||||||
Foam::OutputFilterFunctionObject
|
Foam::functionObjects::timeControl
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
surfaceInterpolateFields.C
|
surfaceInterpolateFields.C
|
||||||
@ -69,8 +69,8 @@ SourceFiles
|
|||||||
#ifndef functionObjects_surfaceInterpolateFields_H
|
#ifndef functionObjects_surfaceInterpolateFields_H
|
||||||
#define functionObjects_surfaceInterpolateFields_H
|
#define functionObjects_surfaceInterpolateFields_H
|
||||||
|
|
||||||
#include "OFstream.H"
|
#include "functionObject.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFieldsFwd.H"
|
||||||
#include "Tuple2.H"
|
#include "Tuple2.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -91,18 +91,17 @@ namespace functionObjects
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class surfaceInterpolateFields
|
class surfaceInterpolateFields
|
||||||
|
:
|
||||||
|
public functionObject
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Name of this set of surfaceInterpolateFields object
|
//- Reference to the objectRegistry
|
||||||
word name_;
|
|
||||||
|
|
||||||
const objectRegistry& obr_;
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
//- Fields to process
|
//- Fields to process
|
||||||
//wordList fieldSet_;
|
|
||||||
List<Tuple2<word, word>> fieldSet_;
|
List<Tuple2<word, word>> fieldSet_;
|
||||||
|
|
||||||
//- Locally constructed fields
|
//- Locally constructed fields
|
||||||
@ -146,9 +145,8 @@ public:
|
|||||||
surfaceInterpolateFields
|
surfaceInterpolateFields
|
||||||
(
|
(
|
||||||
const word& name,
|
const word& name,
|
||||||
const objectRegistry&,
|
const Time& runTime,
|
||||||
const dictionary&,
|
const dictionary& dict
|
||||||
const bool loadFromFiles = false
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@ -158,34 +156,14 @@ public:
|
|||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Return name of the surfaceInterpolateFields object
|
|
||||||
virtual const word& name() const
|
|
||||||
{
|
|
||||||
return name_;
|
|
||||||
}
|
|
||||||
|
|
||||||
//- Read the controls
|
//- Read the controls
|
||||||
virtual void read(const dictionary&);
|
virtual bool read(const dictionary&);
|
||||||
|
|
||||||
//- Execute, currently does nothing
|
//- Calculate the interpolated fields
|
||||||
virtual void execute();
|
virtual bool execute(const bool postProcess = false);
|
||||||
|
|
||||||
//- Execute at the final time-loop, currently does nothing
|
//- Write the interpolated fields
|
||||||
virtual void end();
|
virtual bool write(const bool postProcess = false);
|
||||||
|
|
||||||
//- 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&)
|
|
||||||
{}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -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
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
@ -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
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user