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 \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
EXE_LIBS = \
|
||||
-lfoamToVTK \
|
||||
-lfiniteVolume \
|
||||
-ldynamicMesh \
|
||||
-llagrangian \
|
||||
-lgenericPatchFields \
|
||||
-lmeshTools
|
||||
-lgenericPatchFields
|
||||
|
||||
@ -10,6 +10,5 @@ vtkMesh.C
|
||||
vtkTopo.C
|
||||
|
||||
writeVTK/writeVTK.C
|
||||
writeVTK/writeVTKFunctionObject.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfoamToVTK
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-ldynamicMesh \
|
||||
-llagrangian \
|
||||
-lgenericPatchFields \
|
||||
-lmeshTools
|
||||
-lgenericPatchFields
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "vtkMesh.H"
|
||||
#include "internalWriter.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -36,6 +37,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(writeVTK, 0);
|
||||
addToRunTimeSelectionTable(functionObject, writeVTK, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,16 +47,22 @@ namespace functionObjects
|
||||
Foam::functionObjects::writeVTK::writeVTK
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& t,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
time_(t),
|
||||
obr_
|
||||
(
|
||||
time_.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
objectNames_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -72,27 +80,23 @@ Foam::functionObjects::writeVTK::~writeVTK()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::writeVTK::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::writeVTK::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("objectNames") >> objectNames_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeVTK::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeVTK::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeVTK::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::writeVTK::write()
|
||||
bool Foam::functionObjects::writeVTK::execute(const bool postProcess)
|
||||
{
|
||||
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_));
|
||||
|
||||
@ -162,6 +166,8 @@ void Foam::functionObjects::writeVTK::write()
|
||||
writer.write(vsptf);
|
||||
writer.write(vstf);
|
||||
writer.write(vtf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
SourceFiles
|
||||
writeVTK.C
|
||||
@ -66,8 +66,8 @@ SourceFiles
|
||||
#ifndef functionObjects_writeVTK_H
|
||||
#define functionObjects_writeVTK_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "wordReList.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -75,10 +75,8 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class Time;
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -88,13 +86,15 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class writeVTK
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of writeVTK
|
||||
word name_;
|
||||
//- Reference to the Time
|
||||
const Time& time_;
|
||||
|
||||
//- Refererence to Db
|
||||
//- Refererence to objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Names of objects
|
||||
@ -121,14 +121,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
writeVTK
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& t,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
|
||||
@ -138,34 +136,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the writeVTK
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the writeVTK data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Write the writeVTK
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -1,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 "argList.H"
|
||||
#include "Time.H"
|
||||
#include "functionObjectFiles.H"
|
||||
#include "writeFiles.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 "Time.H"
|
||||
#include "fvCFD.H"
|
||||
#include "unitConversion.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -37,6 +37,36 @@ namespace Foam
|
||||
|
||||
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 * * * * * * * * * * * * * * //
|
||||
|
||||
@ -64,13 +94,18 @@ const fvMesh& ${typeName}FunctionObject::mesh() const
|
||||
${typeName}FunctionObject::${typeName}FunctionObject
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr)
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
)
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
@ -84,7 +119,7 @@ ${typeName}FunctionObject::~${typeName}FunctionObject()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void ${typeName}FunctionObject::read(const dictionary& dict)
|
||||
bool ${typeName}FunctionObject::read(const dictionary& dict)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -94,10 +129,12 @@ void ${typeName}FunctionObject::read(const dictionary& dict)
|
||||
//{{{ begin code
|
||||
${codeRead}
|
||||
//}}} end code
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FunctionObject::execute()
|
||||
bool ${typeName}FunctionObject::execute(const bool postProcess)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -107,10 +144,12 @@ void ${typeName}FunctionObject::execute()
|
||||
//{{{ begin code
|
||||
${codeExecute}
|
||||
//}}} end code
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FunctionObject::end()
|
||||
bool ${typeName}FunctionObject::end()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -120,10 +159,12 @@ void ${typeName}FunctionObject::end()
|
||||
//{{{ begin code
|
||||
${codeEnd}
|
||||
//}}} end code
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FunctionObject::timeSet()
|
||||
bool ${typeName}FunctionObject::timeSet()
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -133,10 +174,12 @@ void ${typeName}FunctionObject::timeSet()
|
||||
//{{{ begin codeTime
|
||||
${codeTimeSet}
|
||||
//}}} end code
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void ${typeName}FunctionObject::write()
|
||||
bool ${typeName}FunctionObject::write(const bool postProcess)
|
||||
{
|
||||
if (${verbose:-false})
|
||||
{
|
||||
@ -146,11 +189,13 @@ void ${typeName}FunctionObject::write()
|
||||
//{{{ begin code
|
||||
${code}
|
||||
//}}} end code
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -33,8 +33,7 @@ SourceFiles
|
||||
#ifndef functionObjectTemplate_H
|
||||
#define functionObjectTemplate_H
|
||||
|
||||
#include "stringList.H"
|
||||
#include "pointField.H"
|
||||
#include "functionObject.H"
|
||||
|
||||
//{{{ begin codeInclude
|
||||
${codeInclude}
|
||||
@ -47,9 +46,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
@ -57,13 +53,12 @@ class fvMesh;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class ${typeName}FunctionObject
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of system calls
|
||||
word name_;
|
||||
|
||||
//- Registry
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//{{{ begin codeData
|
||||
@ -92,14 +87,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
${typeName}FunctionObject
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& unused,
|
||||
const dictionary&,
|
||||
const bool loadFromFilesUnused = false
|
||||
const Time& runTime,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
|
||||
@ -109,34 +102,20 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the system call set
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the system calls
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute the "executeCalls" at each time-step
|
||||
virtual void execute();
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute the "endCalls" at the final time-loop
|
||||
virtual void end();
|
||||
virtual bool end();
|
||||
|
||||
//- 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++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool timeSet();
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 Time& t,
|
||||
const dictionary& functionDict
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
const word functionType(functionDict.lookup("type"));
|
||||
const word functionType(dict.lookup("type"));
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -63,7 +63,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
||||
|
||||
const_cast<Time&>(t).libs().open
|
||||
(
|
||||
functionDict,
|
||||
dict,
|
||||
"functionObjectLibs",
|
||||
dictionaryConstructorTablePtr_
|
||||
);
|
||||
@ -90,7 +90,7 @@ Foam::autoPtr<Foam::functionObject> Foam::functionObject::New
|
||||
<< 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.
|
||||
|
||||
See Also
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjectList
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
SourceFiles
|
||||
functionObject.C
|
||||
@ -194,8 +195,11 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Name
|
||||
virtual const word& name() const;
|
||||
//- Return the name of this functionObject
|
||||
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.
|
||||
// postProcess overrides the usual executeControl behaviour and
|
||||
@ -217,14 +221,11 @@ public:
|
||||
//- 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&) = 0;
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh& mpm);
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh& mpm) = 0;
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh& mesh) = 0;
|
||||
virtual void movePoints(const polyMesh& mesh);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "Time.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "argList.H"
|
||||
#include "timeControlFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
@ -354,7 +355,21 @@ bool Foam::functionObjectList::read()
|
||||
FatalIOError.throwExceptions();
|
||||
try
|
||||
{
|
||||
foPtr = functionObject::New(key, time_, dict);
|
||||
if
|
||||
(
|
||||
dict.found("writeControl")
|
||||
|| dict.found("outputControl")
|
||||
)
|
||||
{
|
||||
foPtr.set
|
||||
(
|
||||
new functionObjects::timeControl(key, time_, dict)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
foPtr = functionObject::New(key, time_, dict);
|
||||
}
|
||||
}
|
||||
catch (Foam::IOerror& ioErr)
|
||||
{
|
||||
|
||||
@ -29,7 +29,8 @@ Description
|
||||
that is called for each object.
|
||||
|
||||
See Also
|
||||
Foam::functionObject and Foam::OutputFilterFunctionObject
|
||||
Foam::functionObject
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
SourceFiles
|
||||
functionObjectList.C
|
||||
@ -158,6 +159,9 @@ public:
|
||||
//- Find the ID of a given function object by name
|
||||
label findObjectID(const word& name) const;
|
||||
|
||||
//- Read and set the function objects if their data have changed
|
||||
bool read();
|
||||
|
||||
//- Switch the function objects on
|
||||
void on();
|
||||
|
||||
@ -184,9 +188,6 @@ public:
|
||||
//- Called at the end of Time::adjustDeltaT() if adjustTime is true
|
||||
bool adjustTimeStep();
|
||||
|
||||
//- Read and set the function objects if their data have changed
|
||||
bool read();
|
||||
|
||||
//- Update for changes of mesh
|
||||
void updateMesh(const mapPolyMesh& mpm);
|
||||
|
||||
|
||||
@ -23,27 +23,31 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "functionObjectFile.H"
|
||||
#include "writeFile.H"
|
||||
#include "Time.H"
|
||||
#include "polyMesh.H"
|
||||
#include "IOmanip.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::word Foam::functionObjectFile::outputPrefix = "postProcessing";
|
||||
Foam::label Foam::functionObjectFile::addChars = 7;
|
||||
const Foam::word Foam::functionObjects::writeFile::outputPrefix
|
||||
(
|
||||
"postProcessing"
|
||||
);
|
||||
|
||||
Foam::label Foam::functionObjects::writeFile::addChars = 7;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * 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.width(charWidth());
|
||||
}
|
||||
|
||||
|
||||
Foam::fileName Foam::functionObjectFile::baseFileDir() const
|
||||
Foam::fileName Foam::functionObjects::writeFile::baseFileDir() const
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
@ -90,32 +97,67 @@ Foam::Omanip<int> Foam::functionObjectFile::valueWidth(const label offset) const
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjectFile::functionObjectFile
|
||||
Foam::functionObjects::writeFile::writeFile
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& name,
|
||||
const Time& t,
|
||||
const dictionary& dict,
|
||||
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),
|
||||
prefix_(prefix)
|
||||
prefix_(prefix),
|
||||
log_(true)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjectFile::~functionObjectFile()
|
||||
Foam::functionObjects::writeFile::~writeFile()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * 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;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::writeCommented
|
||||
void Foam::functionObjects::writeFile::writeCommented
|
||||
(
|
||||
Ostream& os,
|
||||
const string& str
|
||||
@ -126,7 +168,7 @@ void Foam::functionObjectFile::writeCommented
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::writeTabbed
|
||||
void Foam::functionObjects::writeFile::writeTabbed
|
||||
(
|
||||
Ostream& os,
|
||||
const string& str
|
||||
@ -136,7 +178,7 @@ void Foam::functionObjectFile::writeTabbed
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFile::writeHeader
|
||||
void Foam::functionObjects::writeFile::writeHeader
|
||||
(
|
||||
Ostream& os,
|
||||
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();
|
||||
}
|
||||
@ -22,10 +22,10 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjectFile
|
||||
Foam::functionObjects::writeFile
|
||||
|
||||
Description
|
||||
Base class for output file data handling
|
||||
functionObject base class for writing single files
|
||||
|
||||
See Also
|
||||
Foam::functionObject
|
||||
@ -36,34 +36,45 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjectFile_H
|
||||
#define functionObjectFile_H
|
||||
#ifndef functionObjects_writeFile_H
|
||||
#define functionObjects_writeFile_H
|
||||
|
||||
#include "objectRegistry.H"
|
||||
#include "functionObject.H"
|
||||
#include "Time.H"
|
||||
#include "IOmanip.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class functionObjectFile Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class functionObjectFile
|
||||
class writeFile
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the Time
|
||||
const Time& time_;
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Prefix
|
||||
const word prefix_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
@ -83,10 +94,10 @@ protected:
|
||||
virtual Omanip<int> valueWidth(const label offset = 0) const;
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
functionObjectFile(const functionObjectFile&);
|
||||
writeFile(const writeFile&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const functionObjectFile&);
|
||||
void operator=(const writeFile&);
|
||||
|
||||
|
||||
public:
|
||||
@ -100,36 +111,42 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from objectRegistry
|
||||
functionObjectFile(const objectRegistry& obr, const word& prefix);
|
||||
//- Construct from name, Time, dictionary and 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
|
||||
virtual ~functionObjectFile();
|
||||
virtual ~writeFile();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read optional controls
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Write a commented string to stream
|
||||
void writeCommented
|
||||
(
|
||||
Ostream& os,
|
||||
const string& str
|
||||
) const;
|
||||
void writeCommented(Ostream& os, const string& str) const;
|
||||
|
||||
//- Write a tabbed string to stream
|
||||
void writeTabbed
|
||||
(
|
||||
Ostream& os,
|
||||
const string& str
|
||||
) const;
|
||||
void writeTabbed(Ostream& os, const string& str) const;
|
||||
|
||||
//- Write a commented header to stream
|
||||
void writeHeader
|
||||
(
|
||||
Ostream& os,
|
||||
const string& str
|
||||
) const;
|
||||
void writeHeader(Ostream& os, const string& str) const;
|
||||
|
||||
//- Write the current time to stream
|
||||
void writeTime(Ostream& os) const;
|
||||
@ -150,12 +167,13 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "functionObjectFileTemplates.C"
|
||||
#include "writeFileTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -26,7 +26,7 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::functionObjectFile::writeHeaderValue
|
||||
void Foam::functionObjects::writeFile::writeHeaderValue
|
||||
(
|
||||
Ostream& os,
|
||||
const string& property,
|
||||
@ -23,13 +23,13 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "functionObjectFiles.H"
|
||||
#include "writeFiles.H"
|
||||
#include "Time.H"
|
||||
#include "IFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjectFiles::createFiles()
|
||||
void Foam::functionObjects::writeFiles::createFiles()
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
@ -64,13 +64,13 @@ void Foam::functionObjectFiles::createFiles()
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFiles::write()
|
||||
void Foam::functionObjects::writeFiles::write()
|
||||
{
|
||||
createFiles();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFiles::resetNames(const wordList& names)
|
||||
void Foam::functionObjects::writeFiles::resetNames(const wordList& names)
|
||||
{
|
||||
names_.clear();
|
||||
names_.append(names);
|
||||
@ -79,13 +79,11 @@ void Foam::functionObjectFiles::resetNames(const wordList& names)
|
||||
{
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(names_.size());
|
||||
|
||||
createFiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjectFiles::resetName(const word& name)
|
||||
void Foam::functionObjects::writeFiles::resetName(const word& name)
|
||||
{
|
||||
names_.clear();
|
||||
names_.append(name);
|
||||
@ -94,87 +92,55 @@ void Foam::functionObjectFiles::resetName(const word& name)
|
||||
{
|
||||
filePtrs_.clear();
|
||||
filePtrs_.setSize(1);
|
||||
|
||||
createFiles();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjectFiles::functionObjectFiles
|
||||
Foam::functionObjects::writeFiles::writeFiles
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& name,
|
||||
const Time& time,
|
||||
const dictionary& dict,
|
||||
const word& prefix
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, prefix),
|
||||
writeFile(name, time, dict, prefix),
|
||||
names_(),
|
||||
filePtrs_()
|
||||
{}
|
||||
|
||||
|
||||
Foam::functionObjectFiles::functionObjectFiles
|
||||
Foam::functionObjects::writeFiles::writeFiles
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const word& name
|
||||
const dictionary& dict,
|
||||
const word& prefix
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, prefix),
|
||||
writeFile(name, obr, dict, prefix),
|
||||
names_(),
|
||||
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 * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjectFiles::~functionObjectFiles()
|
||||
Foam::functionObjects::writeFiles::~writeFiles()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::wordList& Foam::functionObjectFiles::names() const
|
||||
const Foam::wordList& Foam::functionObjects::writeFiles::names() const
|
||||
{
|
||||
return names_;
|
||||
}
|
||||
|
||||
|
||||
Foam::OFstream& Foam::functionObjectFiles::file()
|
||||
Foam::OFstream& Foam::functionObjects::writeFiles::file()
|
||||
{
|
||||
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())
|
||||
{
|
||||
@ -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())
|
||||
{
|
||||
@ -22,10 +22,10 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::functionObjectFiles
|
||||
Foam::functionObjects::writeFiles
|
||||
|
||||
Description
|
||||
Base class for output file data handling
|
||||
functionObject base class for writing files
|
||||
|
||||
See Also
|
||||
Foam::functionObject
|
||||
@ -36,10 +36,10 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef functionObjectFiles_H
|
||||
#define functionObjectFiles_H
|
||||
#ifndef functionObjects_writeFiles_H
|
||||
#define functionObjects_writeFiles_H
|
||||
|
||||
#include "functionObjectFile.H"
|
||||
#include "writeFile.H"
|
||||
#include "OFstream.H"
|
||||
#include "PtrList.H"
|
||||
|
||||
@ -47,15 +47,16 @@ SourceFiles
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class functionObjectFiles Declaration
|
||||
Class writeFiles Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class functionObjectFiles
|
||||
class writeFiles
|
||||
:
|
||||
public functionObjectFile
|
||||
public writeFile
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -83,38 +84,37 @@ protected:
|
||||
virtual void resetName(const word& name);
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
functionObjectFiles(const functionObjectFiles&);
|
||||
writeFiles(const writeFiles&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const functionObjectFiles&);
|
||||
void operator=(const writeFiles&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from objectRegistry
|
||||
functionObjectFiles(const objectRegistry& obr, const word& prefix);
|
||||
|
||||
//- Construct from components
|
||||
functionObjectFiles
|
||||
//- Construct from name, Time, dictionary and prefix
|
||||
writeFiles
|
||||
(
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const word& name
|
||||
const word& name,
|
||||
const Time& time,
|
||||
const dictionary& dict,
|
||||
const word& prefix
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
functionObjectFiles
|
||||
//- Construct from name, objectRegistry, dictionary and prefix
|
||||
writeFiles
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const word& prefix,
|
||||
const wordList& names
|
||||
const dictionary& dict,
|
||||
const word& prefix
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~functionObjectFiles();
|
||||
virtual ~writeFiles();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -135,6 +135,7 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -1,61 +1,39 @@
|
||||
fieldAverage/fieldAverage/fieldAverage.C
|
||||
fieldAverage/fieldAverage.C
|
||||
fieldAverage/fieldAverageItem/fieldAverageItem.C
|
||||
fieldAverage/fieldAverageItem/fieldAverageItemIO.C
|
||||
fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.C
|
||||
|
||||
fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C
|
||||
fieldCoordinateSystemTransform/fieldCoordinateSystemTransformFunctionObject.C
|
||||
|
||||
fieldMinMax/fieldMinMax.C
|
||||
fieldMinMax/fieldMinMaxFunctionObject.C
|
||||
|
||||
fieldValues/fieldValue/fieldValue.C
|
||||
fieldValues/fieldValue/fieldValueNew.C
|
||||
fieldValues/fieldValueDelta/fieldValueDelta.C
|
||||
fieldValues/fieldValueDelta/fieldValueDeltaFunctionObject.C
|
||||
fieldValues/faceSource/faceSource.C
|
||||
fieldValues/faceSource/faceSourceFunctionObject.C
|
||||
fieldValues/cellSource/cellSource.C
|
||||
fieldValues/cellSource/cellSourceFunctionObject.C
|
||||
fieldValues/faceSource/faceSource.C
|
||||
|
||||
nearWallFields/nearWallFields.C
|
||||
nearWallFields/nearWallFieldsFunctionObject.C
|
||||
nearWallFields/findCellParticle.C
|
||||
nearWallFields/findCellParticleCloud.C
|
||||
|
||||
processorField/processorField.C
|
||||
processorField/processorFieldFunctionObject.C
|
||||
|
||||
readFields/readFields.C
|
||||
readFields/readFieldsFunctionObject.C
|
||||
|
||||
streamLine/streamLine.C
|
||||
streamLine/streamLineParticle.C
|
||||
streamLine/streamLineParticleCloud.C
|
||||
streamLine/streamLineFunctionObject.C
|
||||
|
||||
wallBoundedStreamLine/wallBoundedStreamLine.C
|
||||
wallBoundedStreamLine/wallBoundedStreamLineFunctionObject.C
|
||||
wallBoundedStreamLine/wallBoundedStreamLineParticle.C
|
||||
wallBoundedStreamLine/wallBoundedStreamLineParticleCloud.C
|
||||
wallBoundedStreamLine/wallBoundedParticle.C
|
||||
|
||||
surfaceInterpolateFields/surfaceInterpolateFields.C
|
||||
surfaceInterpolateFields/surfaceInterpolateFieldsFunctionObject.C
|
||||
|
||||
regionSizeDistribution/regionSizeDistribution.C
|
||||
regionSizeDistribution/regionSizeDistributionFunctionObject.C
|
||||
|
||||
histogram/histogram.C
|
||||
histogram/histogramFunctionObject.C
|
||||
|
||||
div/div.C
|
||||
div/divFunctionObject.C
|
||||
|
||||
grad/grad.C
|
||||
grad/gradFunctionObject.C
|
||||
|
||||
mag/mag.C
|
||||
mag/magFunctionObject.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
||||
|
||||
@ -25,8 +25,7 @@ License
|
||||
|
||||
#include "div.H"
|
||||
#include "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "div.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +34,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(div, 0);
|
||||
addToRunTimeSelectionTable(functionObject, div, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -82,17 +82,22 @@ Foam::volScalarField& Foam::functionObjects::div::divField
|
||||
Foam::functionObjects::div::div
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
fieldName_("undefined-fieldName"),
|
||||
resultName_("undefined-resultName")
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -110,7 +115,7 @@ Foam::functionObjects::div::~div()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::div::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::div::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
@ -119,10 +124,12 @@ void Foam::functionObjects::div::read(const dictionary& dict)
|
||||
{
|
||||
resultName_ = "fvc::div(" + fieldName_ + ")";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::div::execute()
|
||||
bool Foam::functionObjects::div::execute(const bool postProcess)
|
||||
{
|
||||
bool processed = false;
|
||||
|
||||
@ -134,31 +141,25 @@ void Foam::functionObjects::div::execute()
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::div::end()
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::div::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::div::write()
|
||||
bool Foam::functionObjects::div::write(const bool postProcess)
|
||||
{
|
||||
if (obr_.foundObject<regIOobject>(resultName_))
|
||||
{
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
|
||||
field.write();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@ Group
|
||||
|
||||
Description
|
||||
This function object calculates the divergence of a field. The operation is
|
||||
limited to surfaceScalarFields and volumeVector fields, and the output is a
|
||||
volume scalar field.
|
||||
limited to surfaceScalarFields and volVectorFields, and the output is a
|
||||
volScalarField.
|
||||
|
||||
SourceFiles
|
||||
div.C
|
||||
@ -40,11 +40,8 @@ SourceFiles
|
||||
#ifndef functionObjects_div_H
|
||||
#define functionObjects_div_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "OFstream.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,9 +50,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
class dimensionSet;
|
||||
|
||||
namespace functionObjects
|
||||
@ -66,13 +60,12 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class div
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this div object
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Name of field to process
|
||||
@ -115,14 +108,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
div
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -132,34 +123,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of div
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the div data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate the divergence field
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the div and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Write the divergence field
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 "volFields.H"
|
||||
#include "Time.H"
|
||||
#include "fieldAverageItem.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +35,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(fieldAverage, 0);
|
||||
addToRunTimeSelectionTable(functionObject, fieldAverage, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +69,7 @@ void Foam::functionObjects::fieldAverage::initialize()
|
||||
{
|
||||
resetFields();
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl;
|
||||
Info<< type() << " " << name() << ":" << nl;
|
||||
|
||||
// Add mean fields to the field lists
|
||||
forAll(faItems_, fieldi)
|
||||
@ -136,7 +137,7 @@ void Foam::functionObjects::fieldAverage::calcAverages()
|
||||
periodIndex_++;
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
Info<< " Calculating averages" << nl;
|
||||
|
||||
@ -259,13 +260,18 @@ void Foam::functionObjects::fieldAverage::readAveragingProperties()
|
||||
Foam::functionObjects::fieldAverage::fieldAverage
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& t,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
t.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
prevTimeIndex_(-1),
|
||||
restartOnRestart_(false),
|
||||
restartOnOutput_(false),
|
||||
@ -277,7 +283,7 @@ Foam::functionObjects::fieldAverage::fieldAverage
|
||||
totalTime_(),
|
||||
periodIndex_(1)
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -295,11 +301,11 @@ Foam::functionObjects::fieldAverage::~fieldAverage()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::fieldAverage::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::fieldAverage::read(const dictionary& dict)
|
||||
{
|
||||
initialised_ = false;
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl;
|
||||
Info<< type() << " " << name() << ":" << nl;
|
||||
|
||||
dict.readIfPresent("restartOnRestart", restartOnRestart_);
|
||||
dict.readIfPresent("restartOnOutput", restartOnOutput_);
|
||||
@ -314,28 +320,21 @@ void Foam::functionObjects::fieldAverage::read(const dictionary& dict)
|
||||
readAveragingProperties();
|
||||
|
||||
Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldAverage::execute()
|
||||
bool Foam::functionObjects::fieldAverage::execute(const bool postProcess)
|
||||
{
|
||||
calcAverages();
|
||||
Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldAverage::end()
|
||||
{
|
||||
calcAverages();
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldAverage::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldAverage::write()
|
||||
bool Foam::functionObjects::fieldAverage::write(const bool postProcess)
|
||||
{
|
||||
writeAverages();
|
||||
writeAveragingProperties();
|
||||
@ -346,15 +345,9 @@ void Foam::functionObjects::fieldAverage::write()
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldAverage::updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldAverage::movePoints(const polyMesh&)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -110,7 +110,6 @@ Note
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
fieldAverage.C
|
||||
@ -122,7 +121,7 @@ SourceFiles
|
||||
#ifndef functionObjects_fieldAverage_H
|
||||
#define functionObjects_fieldAverage_H
|
||||
|
||||
#include "volFieldsFwd.H"
|
||||
#include "functionObject.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -132,11 +131,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
template<class Type>
|
||||
class List;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -149,15 +143,14 @@ class fieldAverageItem;
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fieldAverage
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of field averages.
|
||||
word name_;
|
||||
|
||||
//- Database this class is registered to
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Time at last call, prevents repeated averaging
|
||||
@ -291,14 +284,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
fieldAverage
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& t,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
|
||||
@ -308,32 +299,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of field averages
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the field average data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute the averaging
|
||||
virtual void execute();
|
||||
//- Calculate the field averages
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute the averaging at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the field average data and write
|
||||
virtual void write();
|
||||
|
||||
//- Update mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Move points
|
||||
virtual void movePoints(const polyMesh&);
|
||||
//- Write the field averages
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
@ -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 "dictionary.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -33,6 +34,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
fieldCoordinateSystemTransform,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,17 +51,22 @@ Foam::functionObjects::fieldCoordinateSystemTransform::
|
||||
fieldCoordinateSystemTransform
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
fieldSet_(),
|
||||
coordSys_(obr, dict)
|
||||
coordSys_(obr_, dict)
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -61,7 +74,7 @@ fieldCoordinateSystemTransform
|
||||
|
||||
read(dict);
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl
|
||||
Info<< type() << " " << name << ":" << nl
|
||||
<< " Applying transformation from global Cartesian to local "
|
||||
<< coordSys_ << nl << endl;
|
||||
}
|
||||
@ -76,18 +89,23 @@ Foam::functionObjects::fieldCoordinateSystemTransform::
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::read
|
||||
bool Foam::functionObjects::fieldCoordinateSystemTransform::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::execute()
|
||||
bool Foam::functionObjects::fieldCoordinateSystemTransform::execute
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldi)
|
||||
{
|
||||
@ -98,22 +116,17 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::execute()
|
||||
transform<symmTensor>(fieldSet_[fieldi]);
|
||||
transform<tensor>(fieldSet_[fieldi]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::end()
|
||||
bool Foam::functionObjects::fieldCoordinateSystemTransform::write
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldCoordinateSystemTransform::write()
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldi)
|
||||
{
|
||||
@ -128,6 +141,8 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::write()
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -64,7 +64,6 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::coordinateSystem
|
||||
|
||||
SourceFiles
|
||||
@ -76,9 +75,8 @@ SourceFiles
|
||||
#ifndef functionObjects_fieldCoordinateSystemTransform_H
|
||||
#define functionObjects_fieldCoordinateSystemTransform_H
|
||||
|
||||
#include "OFstream.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "functionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "coordinateSystem.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -88,9 +86,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -100,14 +95,14 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class fieldCoordinateSystemTransform
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name
|
||||
word name_;
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Fields to transform
|
||||
@ -145,14 +140,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
fieldCoordinateSystemTransform
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -162,34 +155,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the fieldCoordinateSystemTransform object
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the input data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 "fieldTypes.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -33,6 +34,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(fieldMinMax, 0);
|
||||
addToRunTimeSelectionTable(functionObject, fieldMinMax, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,51 +52,7 @@ const Foam::NamedEnum
|
||||
> Foam::functionObjects::fieldMinMax::modeTypeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::fieldMinMax::fieldMinMax
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
functionObjectFiles(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
log_(true),
|
||||
location_(true),
|
||||
mode_(mdMag),
|
||||
fieldSet_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::fieldMinMax::~fieldMinMax()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
|
||||
{
|
||||
log_ = dict.lookupOrDefault<Switch>("log", true);
|
||||
location_ = dict.lookupOrDefault<Switch>("location", true);
|
||||
|
||||
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::fieldMinMax::writeFileHeader(const label i)
|
||||
{
|
||||
@ -136,24 +94,64 @@ void Foam::functionObjects::fieldMinMax::writeFileHeader(const label i)
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldMinMax::execute()
|
||||
{}
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldMinMax::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldMinMax::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldMinMax::write()
|
||||
Foam::functionObjects::fieldMinMax::fieldMinMax
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
writeFiles(name, runTime, dict, name),
|
||||
location_(true),
|
||||
mode_(mdMag),
|
||||
fieldSet_()
|
||||
{
|
||||
functionObjectFiles::write();
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
resetName(typeName);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::functionObjects::fieldMinMax::~fieldMinMax()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
bool Foam::functionObjects::fieldMinMax::read(const dictionary& dict)
|
||||
{
|
||||
writeFiles::read(dict);
|
||||
|
||||
location_ = dict.lookupOrDefault<Switch>("location", true);
|
||||
|
||||
mode_ = modeTypeNames_[dict.lookupOrDefault<word>("mode", "magnitude")];
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::fieldMinMax::execute(const bool postProcess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::fieldMinMax::write(const bool postProcess)
|
||||
{
|
||||
writeFiles::write();
|
||||
|
||||
if (!location_) writeTime(file());
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
if (log_) Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
forAll(fieldSet_, fieldi)
|
||||
{
|
||||
@ -166,6 +164,8 @@ void Foam::functionObjects::fieldMinMax::write()
|
||||
|
||||
if (!location_) file()<< endl;
|
||||
if (log_) Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjects::writeFiles
|
||||
|
||||
SourceFiles
|
||||
fieldMinMax.C
|
||||
@ -77,21 +77,13 @@ SourceFiles
|
||||
#ifndef functionObjects_fieldMinMax_H
|
||||
#define functionObjects_fieldMinMax_H
|
||||
|
||||
#include "functionObjectFiles.H"
|
||||
#include "Switch.H"
|
||||
#include "writeFiles.H"
|
||||
#include "vector.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
@ -101,7 +93,7 @@ namespace functionObjects
|
||||
|
||||
class fieldMinMax
|
||||
:
|
||||
public functionObjectFiles
|
||||
public writeFiles
|
||||
{
|
||||
public:
|
||||
|
||||
@ -118,15 +110,6 @@ protected:
|
||||
//- Mode type names
|
||||
static const NamedEnum<modeType, 2> modeTypeNames_;
|
||||
|
||||
//- Name of this set of field min/max
|
||||
// Also used as the name of the output directory
|
||||
word name_;
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Switch to send output to Info as well
|
||||
Switch log_;
|
||||
|
||||
//- Switch to write location of min/max values
|
||||
Switch location_;
|
||||
|
||||
@ -159,6 +142,14 @@ protected:
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const fieldMinMax&);
|
||||
|
||||
//- Calculate the field min/max
|
||||
template<class Type>
|
||||
void calcMinMaxFields
|
||||
(
|
||||
const word& fieldName,
|
||||
const modeType& mode
|
||||
);
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
|
||||
@ -171,14 +162,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
fieldMinMax
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -188,42 +177,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of field min/max
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the field min/max data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the field min/max
|
||||
template<class Type>
|
||||
void calcMinMaxFields
|
||||
(
|
||||
const word& fieldName,
|
||||
const modeType& mode
|
||||
);
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Write the fieldMinMax
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
addToRunTimeSelectionTable(fieldValue, cellSource, dictionary);
|
||||
addToRunTimeSelectionTable(functionObject, cellSource, dictionary);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,14 +150,14 @@ void Foam::functionObjects::fieldValues::cellSource::initialise
|
||||
if (nCells_ == 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< type() << " " << name() << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " Source has no cells" << exit(FatalError);
|
||||
}
|
||||
|
||||
volume_ = volume();
|
||||
|
||||
Info<< type() << " " << name_ << ":"
|
||||
Info<< type() << " " << name() << ":"
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " total cells = " << nCells_ << nl
|
||||
<< " total volume = " << volume_
|
||||
@ -205,12 +206,11 @@ void Foam::functionObjects::fieldValues::cellSource::writeFileHeader
|
||||
Foam::functionObjects::fieldValues::cellSource::cellSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fieldValue(name, obr, dict, typeName, loadFromFiles),
|
||||
fieldValue(name, runTime, dict, typeName),
|
||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||
nCells_(0),
|
||||
@ -218,7 +218,32 @@ Foam::functionObjects::fieldValues::cellSource::cellSource
|
||||
weightFieldName_("none"),
|
||||
writeVolume_(dict.lookupOrDefault("writeVolume", false))
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
|
||||
Foam::functionObjects::fieldValues::cellSource::cellSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fieldValue(name, obr, dict, typeName),
|
||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||
nCells_(0),
|
||||
cellId_(),
|
||||
weightFieldName_("none"),
|
||||
writeVolume_(dict.lookupOrDefault("writeVolume", false))
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -236,7 +261,7 @@ Foam::functionObjects::fieldValues::cellSource::~cellSource()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::fieldValues::cellSource::read
|
||||
bool Foam::functionObjects::fieldValues::cellSource::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
@ -245,10 +270,15 @@ void Foam::functionObjects::fieldValues::cellSource::read
|
||||
|
||||
// No additional info to read
|
||||
initialise(dict);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldValues::cellSource::write()
|
||||
bool Foam::functionObjects::fieldValues::cellSource::write
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
fieldValue::write();
|
||||
|
||||
@ -293,6 +323,8 @@ void Foam::functionObjects::fieldValues::cellSource::write()
|
||||
}
|
||||
|
||||
if (log_) Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -95,7 +95,6 @@ Description
|
||||
SeeAlso
|
||||
Foam::fieldValues
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
cellSource.C
|
||||
@ -105,10 +104,8 @@ SourceFiles
|
||||
#ifndef functionObjects_cellSource_H
|
||||
#define functionObjects_cellSource_H
|
||||
|
||||
#include "NamedEnum.H"
|
||||
#include "fieldValue.H"
|
||||
#include "labelList.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -241,13 +238,20 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
//- Construct from name, Time and dictionary
|
||||
cellSource
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from name, objectRegistry and dictionary
|
||||
cellSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -257,30 +261,25 @@ public:
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
// Access
|
||||
//- Return the source type
|
||||
inline const sourceType& source() const;
|
||||
|
||||
//- Return the source type
|
||||
inline const sourceType& source() const;
|
||||
//- Return the local list of cell IDs
|
||||
inline const labelList& cellId() const;
|
||||
|
||||
//- Return the local list of cell IDs
|
||||
inline const labelList& cellId() const;
|
||||
//- Templated helper function to output field values
|
||||
template<class Type>
|
||||
bool writeValues(const word& fieldName);
|
||||
|
||||
//- Filter a field according to cellIds
|
||||
template<class Type>
|
||||
tmp<Field<Type>> filterField(const Field<Type>& field) const;
|
||||
|
||||
// Function object functions
|
||||
//- Read from dictionary
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Read from dictionary
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Calculate and write
|
||||
virtual void write();
|
||||
|
||||
//- Templated helper function to output field values
|
||||
template<class Type>
|
||||
bool writeValues(const word& fieldName);
|
||||
|
||||
//- Filter a field according to cellIds
|
||||
template<class Type>
|
||||
tmp<Field<Type>> filterField(const Field<Type>& field) const;
|
||||
//- Calculate and write
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
addToRunTimeSelectionTable(fieldValue, faceSource, dictionary);
|
||||
addToRunTimeSelectionTable(functionObject, faceSource, dictionary);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -106,7 +107,7 @@ void Foam::functionObjects::fieldValues::faceSource::setFaceZoneFaces()
|
||||
if (zoneId < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< type() << " " << name() << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " Unknown face zone name: " << sourceName_
|
||||
<< ". Valid face zones are: " << mesh().faceZones().names()
|
||||
@ -191,7 +192,7 @@ void Foam::functionObjects::fieldValues::faceSource::setPatchFaces()
|
||||
if (patchid < 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< type() << " " << name() << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " Unknown patch name: " << sourceName_
|
||||
<< ". Valid patch names are: "
|
||||
@ -228,7 +229,7 @@ void Foam::functionObjects::fieldValues::faceSource::sampledSurfaceFaces
|
||||
{
|
||||
surfacePtr_ = sampledSurface::New
|
||||
(
|
||||
name_,
|
||||
name(),
|
||||
mesh(),
|
||||
dict.subDict("sampledSurfaceDict")
|
||||
);
|
||||
@ -443,7 +444,7 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
|
||||
default:
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< type() << " " << name() << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
||||
<< nl << " Unknown source type. Valid source types are:"
|
||||
<< sourceTypeNames_.sortedToc() << nl << exit(FatalError);
|
||||
@ -453,7 +454,7 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
|
||||
if (nFaces_ == 0)
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< type() << " " << name() << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl
|
||||
<< " Source has no faces" << exit(FatalError);
|
||||
}
|
||||
@ -465,7 +466,7 @@ void Foam::functionObjects::fieldValues::faceSource::initialise
|
||||
|
||||
totalArea_ = totalArea();
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl
|
||||
Info<< type() << " " << name() << ":" << nl
|
||||
<< " total faces = " << nFaces_
|
||||
<< nl
|
||||
<< " total area = " << totalArea_
|
||||
@ -641,12 +642,11 @@ Foam::vector Foam::functionObjects::fieldValues::faceSource::processValues
|
||||
Foam::functionObjects::fieldValues::faceSource::faceSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fieldValue(name, obr, dict, typeName, loadFromFiles),
|
||||
fieldValue(name, runTime, dict, typeName),
|
||||
surfaceWriterPtr_(NULL),
|
||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||
@ -660,7 +660,37 @@ Foam::functionObjects::fieldValues::faceSource::faceSource
|
||||
facePatchId_(),
|
||||
faceSign_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
}
|
||||
|
||||
Foam::functionObjects::fieldValues::faceSource::faceSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fieldValue(name, obr, dict, typeName),
|
||||
surfaceWriterPtr_(NULL),
|
||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||
weightFieldName_("none"),
|
||||
orientWeightField_(false),
|
||||
orientedFieldsStart_(labelMax),
|
||||
scaleFactor_(1.0),
|
||||
writeArea_(dict.lookupOrDefault("writeArea", false)),
|
||||
nFaces_(0),
|
||||
faceId_(),
|
||||
facePatchId_(),
|
||||
faceSign_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -678,17 +708,22 @@ Foam::functionObjects::fieldValues::faceSource::~faceSource()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::fieldValues::faceSource::read
|
||||
bool Foam::functionObjects::fieldValues::faceSource::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
fieldValue::read(dict);
|
||||
initialise(dict);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldValues::faceSource::write()
|
||||
bool Foam::functionObjects::fieldValues::faceSource::write
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
fieldValue::write();
|
||||
|
||||
@ -757,6 +792,8 @@ void Foam::functionObjects::fieldValues::faceSource::write()
|
||||
}
|
||||
|
||||
if (log_) Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -128,7 +128,6 @@ Note
|
||||
SeeAlso
|
||||
Foam::fieldValues
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
faceSource.C
|
||||
@ -139,11 +138,8 @@ SourceFiles
|
||||
#ifndef functionObjects_faceSource_H
|
||||
#define functionObjects_faceSource_H
|
||||
|
||||
#include "NamedEnum.H"
|
||||
#include "fieldValue.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceWriter.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -151,6 +147,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
class sampledSurface;
|
||||
class surfaceWriter;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -341,13 +338,20 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
//- Construct from name, Time and dictionary
|
||||
faceSource
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
//- Construct from name, objectRegistry and dictionary
|
||||
faceSource
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -357,57 +361,52 @@ public:
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
// Access
|
||||
//- Return the source type
|
||||
inline const sourceType& source() const;
|
||||
|
||||
//- Return the source type
|
||||
inline const sourceType& source() const;
|
||||
//- Return the local list of face IDs
|
||||
inline const labelList& faceId() const;
|
||||
|
||||
//- Return the local list of face IDs
|
||||
inline const labelList& faceId() const;
|
||||
//- Return the local list of patch ID per face
|
||||
inline const labelList& facePatch() const;
|
||||
|
||||
//- Return the local list of patch ID per face
|
||||
inline const labelList& facePatch() const;
|
||||
//- Return the list of +1/-1 representing face flip map
|
||||
inline const labelList& faceSign() const;
|
||||
|
||||
//- Return the list of +1/-1 representing face flip map
|
||||
inline const labelList& faceSign() const;
|
||||
//- Templated helper function to output field values
|
||||
template<class Type>
|
||||
bool writeValues
|
||||
(
|
||||
const word& fieldName,
|
||||
const scalarField& weightField,
|
||||
const bool orient
|
||||
);
|
||||
|
||||
//- Filter a surface field according to faceIds
|
||||
template<class Type>
|
||||
tmp<Field<Type>> filterField
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
|
||||
const bool applyOrientation
|
||||
) const;
|
||||
|
||||
// Function object functions
|
||||
//- Filter a volume field according to faceIds
|
||||
template<class Type>
|
||||
tmp<Field<Type>> filterField
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& field,
|
||||
const bool applyOrientation
|
||||
) const;
|
||||
|
||||
//- Read from dictionary
|
||||
virtual void read(const dictionary&);
|
||||
//- Read from dictionary
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Calculate and write
|
||||
virtual void write();
|
||||
|
||||
//- Templated helper function to output field values
|
||||
template<class Type>
|
||||
bool writeValues
|
||||
(
|
||||
const word& fieldName,
|
||||
const scalarField& weightField,
|
||||
const bool orient
|
||||
);
|
||||
|
||||
//- Filter a surface field according to faceIds
|
||||
template<class Type>
|
||||
tmp<Field<Type>> filterField
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
|
||||
const bool applyOrientation
|
||||
) const;
|
||||
|
||||
//- Filter a volume field according to faceIds
|
||||
template<class Type>
|
||||
tmp<Field<Type>> filterField
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& field,
|
||||
const bool applyOrientation
|
||||
) const;
|
||||
//- Calculate and write
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
//- Specialisation of processing scalars
|
||||
//- Specialisation for scalar
|
||||
template<>
|
||||
scalar faceSource::processValues
|
||||
(
|
||||
@ -417,7 +416,7 @@ scalar faceSource::processValues
|
||||
) const;
|
||||
|
||||
|
||||
//- Specialisation of processing vectors
|
||||
//- Specialisation for vector
|
||||
template<>
|
||||
vector faceSource::processValues
|
||||
(
|
||||
|
||||
@ -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 "volFields.H"
|
||||
#include "sampledSurface.H"
|
||||
#include "surfaceWriter.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
@ -315,7 +316,7 @@ bool Foam::functionObjects::fieldValues::faceSource::writeValues
|
||||
if (Pstream::master())
|
||||
{
|
||||
fileName outputDir =
|
||||
baseFileDir()/name_/"surface"/obr_.time().timeName();
|
||||
baseFileDir()/name()/"surface"/obr_.time().timeName();
|
||||
|
||||
surfaceWriterPtr_->write
|
||||
(
|
||||
@ -375,7 +376,7 @@ Foam::functionObjects::fieldValues::faceSource::filterField
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< type() << " " << name_ << ": "
|
||||
<< type() << " " << name() << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
||||
<< nl
|
||||
<< " Unable to process internal faces for volume field "
|
||||
|
||||
@ -24,90 +24,96 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fieldValue.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(fieldValue, 0);
|
||||
defineRunTimeSelectionTable(fieldValue, dictionary);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValue::read(const dictionary& dict)
|
||||
{
|
||||
dict_ = dict;
|
||||
|
||||
log_ = dict.lookupOrDefault<Switch>("log", true);
|
||||
dict.lookup("fields") >> fields_;
|
||||
dict.lookup("valueOutput") >> valueOutput_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValue::write()
|
||||
{
|
||||
functionObjectFiles::write();
|
||||
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValue::fieldValue
|
||||
Foam::functionObjects::fieldValue::fieldValue
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const Time& runTime,
|
||||
const dictionary& dict,
|
||||
const word& valueType,
|
||||
const bool loadFromFiles
|
||||
const word& valueType
|
||||
)
|
||||
:
|
||||
functionObjectFiles(obr, name, valueType),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
writeFiles(name, runTime, dict, name),
|
||||
dict_(dict),
|
||||
log_(true),
|
||||
sourceName_(word::null),
|
||||
fields_(dict.lookup("fields")),
|
||||
valueOutput_(dict.lookup("valueOutput")),
|
||||
resultDict_(fileName("name"), dictionary::null)
|
||||
{
|
||||
read(dict);
|
||||
resetName(valueType);
|
||||
}
|
||||
|
||||
|
||||
Foam::functionObjects::fieldValue::fieldValue
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const word& valueType
|
||||
)
|
||||
:
|
||||
writeFiles(name, obr, dict, name),
|
||||
dict_(dict),
|
||||
sourceName_(word::null),
|
||||
fields_(dict.lookup("fields")),
|
||||
valueOutput_(dict.lookup("valueOutput")),
|
||||
resultDict_(fileName("name"), dictionary::null)
|
||||
{
|
||||
read(dict);
|
||||
resetName(valueType);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::fieldValue::~fieldValue()
|
||||
Foam::functionObjects::fieldValue::~fieldValue()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::fieldValue::execute()
|
||||
{}
|
||||
bool Foam::functionObjects::fieldValue::read(const dictionary& dict)
|
||||
{
|
||||
dict_ = dict;
|
||||
writeFiles::read(dict);
|
||||
dict.lookup("fields") >> fields_;
|
||||
dict.lookup("valueOutput") >> valueOutput_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValue::end()
|
||||
{}
|
||||
bool Foam::functionObjects::fieldValue::execute(const bool postProcess)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::fieldValue::timeSet()
|
||||
{}
|
||||
bool Foam::functionObjects::fieldValue::write(const bool postProcess)
|
||||
{
|
||||
writeFiles::write();
|
||||
|
||||
if (log_) Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
void Foam::fieldValue::updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::fieldValue::movePoints(const polyMesh&)
|
||||
{}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -38,12 +38,9 @@ SourceFiles
|
||||
#ifndef functionObjects_fieldValue_H
|
||||
#define functionObjects_fieldValue_H
|
||||
|
||||
#include "functionObjectFiles.H"
|
||||
#include "writeFiles.H"
|
||||
#include "Switch.H"
|
||||
#include "OFstream.H"
|
||||
#include "dictionary.H"
|
||||
#include "Field.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -51,10 +48,10 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class fvMesh;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class fieldValue Declaration
|
||||
@ -62,25 +59,16 @@ class mapPolyMesh;
|
||||
|
||||
class fieldValue
|
||||
:
|
||||
public functionObjectFiles
|
||||
public writeFiles
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this fieldValue object
|
||||
word name_;
|
||||
|
||||
//- Database this class is registered to
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Construction dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
//- Name of source object
|
||||
word sourceName_;
|
||||
|
||||
@ -94,6 +82,17 @@ protected:
|
||||
dictionary resultDict_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Combine fields from all processor domains into single field
|
||||
template<class Type>
|
||||
void combineFields(Field<Type>& field);
|
||||
|
||||
//- Combine fields from all processor domains into single field
|
||||
template<class Type>
|
||||
void combineFields(tmp<Field<Type>>&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Run-time type information
|
||||
@ -109,103 +108,80 @@ public:
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const dictionary& dict
|
||||
),
|
||||
(name, obr, dict, loadFromFiles)
|
||||
(name, obr, dict)
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
fieldValue
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const word& valueType,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
//- Return a reference to the selected fieldValue
|
||||
static autoPtr<fieldValue> New
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false,
|
||||
const bool output = true
|
||||
);
|
||||
// Constructors
|
||||
|
||||
//- Construct from Time and dictionary
|
||||
fieldValue
|
||||
(
|
||||
const word& name,
|
||||
const Time& runTime,
|
||||
const dictionary& dict,
|
||||
const word& valueType
|
||||
);
|
||||
|
||||
//- Construct from objectRegistry and dictionary
|
||||
fieldValue
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const word& valueType
|
||||
);
|
||||
|
||||
//- Return a reference to the selected fieldValue
|
||||
static autoPtr<fieldValue> New
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool output = true
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~fieldValue();
|
||||
|
||||
|
||||
// Public Member Functions
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
//- Return the reference to the construction dictionary
|
||||
inline const dictionary& dict() const;
|
||||
|
||||
//- Return the name of the geometric source
|
||||
inline const word& name() const;
|
||||
//- Return the source name
|
||||
inline const word& sourceName() const;
|
||||
|
||||
//- Return the reference to the object registry
|
||||
inline const objectRegistry& obr() const;
|
||||
//- Return the list of field names
|
||||
inline const wordList& fields() const;
|
||||
|
||||
//- Return the reference to the construction dictionary
|
||||
inline const dictionary& dict() const;
|
||||
//- Return the output field values flag
|
||||
inline const Switch& valueOutput() const;
|
||||
|
||||
//- Return the switch to send output to Info as well as to file
|
||||
inline const Switch& log() const;
|
||||
//- Helper function to return the reference to the mesh
|
||||
inline const fvMesh& mesh() const;
|
||||
|
||||
//- Return the source name
|
||||
inline const word& sourceName() const;
|
||||
//- Return access to the latest set of results
|
||||
inline const dictionary& resultDict() const;
|
||||
|
||||
//- Return the list of field names
|
||||
inline const wordList& fields() const;
|
||||
//- Read from dictionary
|
||||
virtual bool read(const dictionary& dict);
|
||||
|
||||
//- Return the output field values flag
|
||||
inline const Switch& valueOutput() const;
|
||||
//- Execute
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Helper function to return the reference to the mesh
|
||||
inline const fvMesh& mesh() const;
|
||||
|
||||
//- Return access to the latest set of results
|
||||
inline const dictionary& resultDict() const;
|
||||
|
||||
|
||||
// Function object functions
|
||||
|
||||
//- Read from dictionary
|
||||
virtual void read(const dictionary& dict);
|
||||
|
||||
//- Write to screen/file
|
||||
virtual void write();
|
||||
|
||||
//- Execute
|
||||
virtual void execute();
|
||||
|
||||
//- Execute the at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Update mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Move points
|
||||
virtual void movePoints(const polyMesh&);
|
||||
|
||||
//- Combine fields from all processor domains into single field
|
||||
template<class Type>
|
||||
void combineFields(Field<Type>& field);
|
||||
|
||||
//- Combine fields from all processor domains into single field
|
||||
template<class Type>
|
||||
void combineFields(tmp<Field<Type>>&);
|
||||
//- Write to screen/file
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace functionObjects
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -28,55 +28,39 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
inline const Foam::word& Foam::fieldValue::name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::objectRegistry& Foam::fieldValue::obr() const
|
||||
{
|
||||
return obr_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::dictionary& Foam::fieldValue::dict() const
|
||||
inline const Foam::dictionary& Foam::functionObjects::fieldValue::dict() const
|
||||
{
|
||||
return dict_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::Switch& Foam::fieldValue::log() const
|
||||
{
|
||||
return log_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::word& Foam::fieldValue::sourceName() const
|
||||
inline const Foam::word& Foam::functionObjects::fieldValue::sourceName() const
|
||||
{
|
||||
return sourceName_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::wordList& Foam::fieldValue::fields() const
|
||||
inline const Foam::wordList& Foam::functionObjects::fieldValue::fields() const
|
||||
{
|
||||
return fields_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::Switch& Foam::fieldValue::valueOutput() const
|
||||
inline const Foam::Switch&
|
||||
Foam::functionObjects::fieldValue::valueOutput() const
|
||||
{
|
||||
return valueOutput_;
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::fvMesh& Foam::fieldValue::mesh() const
|
||||
inline const Foam::fvMesh& Foam::functionObjects::fieldValue::mesh() const
|
||||
{
|
||||
return refCast<const fvMesh>(obr_);
|
||||
}
|
||||
|
||||
|
||||
inline const Foam::dictionary& Foam::fieldValue::resultDict() const
|
||||
inline const Foam::dictionary&
|
||||
Foam::functionObjects::fieldValue::resultDict() const
|
||||
{
|
||||
return resultDict_;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2016 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,12 +27,12 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::fieldValue> Foam::fieldValue::New
|
||||
Foam::autoPtr<Foam::functionObjects::fieldValue>
|
||||
Foam::functionObjects::fieldValue::New
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles,
|
||||
const bool output
|
||||
)
|
||||
{
|
||||
@ -56,16 +56,7 @@ Foam::autoPtr<Foam::fieldValue> Foam::fieldValue::New
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<fieldValue>
|
||||
(
|
||||
cstrIter()
|
||||
(
|
||||
name,
|
||||
obr,
|
||||
dict,
|
||||
loadFromFiles
|
||||
)
|
||||
);
|
||||
return autoPtr<fieldValue>(cstrIter()(name, obr, dict));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -30,7 +30,7 @@ License
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldValue::combineFields(Field<Type>& field)
|
||||
void Foam::functionObjects::fieldValue::combineFields(Field<Type>& field)
|
||||
{
|
||||
List<Field<Type>> allValues(Pstream::nProcs());
|
||||
|
||||
@ -51,7 +51,7 @@ void Foam::fieldValue::combineFields(Field<Type>& field)
|
||||
|
||||
|
||||
template<class Type>
|
||||
void Foam::fieldValue::combineFields(tmp<Field<Type>>& field)
|
||||
void Foam::functionObjects::fieldValue::combineFields(tmp<Field<Type>>& field)
|
||||
{
|
||||
combineFields(field());
|
||||
}
|
||||
|
||||
@ -24,10 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fieldValueDelta.H"
|
||||
#include "ListOps.H"
|
||||
#include "Time.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -38,6 +35,7 @@ namespace functionObjects
|
||||
namespace fieldValues
|
||||
{
|
||||
defineTypeNameAndDebug(fieldValueDelta, 0);
|
||||
addToRunTimeSelectionTable(functionObject, fieldValueDelta, dictionary);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -104,27 +102,23 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::writeFileHeader
|
||||
Foam::functionObjects::fieldValues::fieldValueDelta::fieldValueDelta
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObjectFiles(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
loadFromFiles_(loadFromFiles),
|
||||
log_(true),
|
||||
writeFiles(name, runTime, dict, name),
|
||||
operation_(opSubtract),
|
||||
source1Ptr_(NULL),
|
||||
source2Ptr_(NULL)
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
}
|
||||
|
||||
read(dict);
|
||||
resetName(typeName);
|
||||
}
|
||||
|
||||
|
||||
@ -136,20 +130,20 @@ Foam::functionObjects::fieldValues::fieldValueDelta::~fieldValueDelta()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::read
|
||||
bool Foam::functionObjects::fieldValues::fieldValueDelta::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
log_ = dict.lookupOrDefault<Switch>("log", true);
|
||||
writeFiles::read(dict);
|
||||
|
||||
source1Ptr_.reset
|
||||
(
|
||||
fieldValue::New
|
||||
(
|
||||
name_ + ".source1",
|
||||
name() + ".source1",
|
||||
obr_,
|
||||
dict.subDict("source1"),
|
||||
loadFromFiles_,
|
||||
false
|
||||
).ptr()
|
||||
);
|
||||
@ -157,21 +151,25 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::read
|
||||
(
|
||||
fieldValue::New
|
||||
(
|
||||
name_ + ".source2",
|
||||
name() + ".source2",
|
||||
obr_,
|
||||
dict.subDict("source2"),
|
||||
loadFromFiles_,
|
||||
false
|
||||
).ptr()
|
||||
);
|
||||
|
||||
operation_ = operationTypeNames_.read(dict.lookup("operation"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::write()
|
||||
bool Foam::functionObjects::fieldValues::fieldValueDelta::write
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
functionObjectFiles::write();
|
||||
writeFiles::write();
|
||||
|
||||
source1Ptr_->write();
|
||||
source2Ptr_->write();
|
||||
@ -181,7 +179,7 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::write()
|
||||
writeTime(file());
|
||||
}
|
||||
|
||||
if (log_) Info<< type() << " " << name_ << " output:" << endl;
|
||||
if (log_) Info<< type() << " " << name() << " output:" << endl;
|
||||
|
||||
bool found = false;
|
||||
processFields<scalar>(found);
|
||||
@ -206,33 +204,18 @@ void Foam::functionObjects::fieldValues::fieldValueDelta::write()
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::updateMesh
|
||||
bool Foam::functionObjects::fieldValues::fieldValueDelta::execute
|
||||
(
|
||||
const mapPolyMesh&
|
||||
const bool postProcess
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::fieldValues::fieldValueDelta::movePoints
|
||||
(
|
||||
const polyMesh&
|
||||
)
|
||||
{}
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -76,9 +76,8 @@ SourceFiles
|
||||
#ifndef functionObjects_fieldValueDelta_H
|
||||
#define functionObjects_fieldValueDelta_H
|
||||
|
||||
#include "functionObjectFiles.H"
|
||||
#include "writeFiles.H"
|
||||
#include "fieldValue.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -95,7 +94,7 @@ namespace fieldValues
|
||||
|
||||
class fieldValueDelta
|
||||
:
|
||||
public functionObjectFiles
|
||||
public writeFiles
|
||||
{
|
||||
public:
|
||||
//- Operation type enumeration
|
||||
@ -116,18 +115,6 @@ private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Name of this fieldValue object
|
||||
word name_;
|
||||
|
||||
//- Database this class is registered to
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Flag to indicate to load from files
|
||||
bool loadFromFiles_;
|
||||
|
||||
//- Switch to send output to Info as well as to file
|
||||
Switch log_;
|
||||
|
||||
//- Operation to apply to values
|
||||
operationType operation_;
|
||||
|
||||
@ -151,7 +138,7 @@ private:
|
||||
|
||||
protected:
|
||||
|
||||
// Functions to be over-ridden from IOoutputFilter class
|
||||
// Protected Member Functions
|
||||
|
||||
//- Output file header information
|
||||
virtual void writeFileHeader(const label i);
|
||||
@ -165,13 +152,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
//- Construct from Time and dictionary
|
||||
fieldValueDelta
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -181,28 +167,14 @@ public:
|
||||
|
||||
// Public Member Functions
|
||||
|
||||
// Function object functions
|
||||
//- Read from dictionary
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Read from dictionary
|
||||
virtual void read(const dictionary&);
|
||||
//- Do nothing
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Calculate and write
|
||||
virtual void write();
|
||||
|
||||
//- Execute
|
||||
virtual void execute();
|
||||
|
||||
//- Execute the at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Update mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
//- Move points
|
||||
virtual void movePoints(const polyMesh&);
|
||||
//- Calculate and write
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "grad.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +34,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(grad, 0);
|
||||
addToRunTimeSelectionTable(functionObject, grad, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,17 +44,22 @@ namespace functionObjects
|
||||
Foam::functionObjects::grad::grad
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
fieldName_("undefined-fieldName"),
|
||||
resultName_("undefined-resultName")
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -72,7 +77,7 @@ Foam::functionObjects::grad::~grad()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::grad::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::grad::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
@ -81,10 +86,12 @@ void Foam::functionObjects::grad::read(const dictionary& dict)
|
||||
{
|
||||
resultName_ = "fvc::grad(" + fieldName_ + ")";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::grad::execute()
|
||||
bool Foam::functionObjects::grad::execute(const bool postProcess)
|
||||
{
|
||||
bool processed = false;
|
||||
|
||||
@ -96,31 +103,25 @@ void Foam::functionObjects::grad::execute()
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::grad::end()
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::grad::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::grad::write()
|
||||
bool Foam::functionObjects::grad::write(const bool postProcess)
|
||||
{
|
||||
if (obr_.foundObject<regIOobject>(resultName_))
|
||||
{
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
|
||||
field.write();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,11 +40,8 @@ SourceFiles
|
||||
#ifndef functionObjects_grad_H
|
||||
#define functionObjects_grad_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "OFstream.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,9 +50,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
class dimensionSet;
|
||||
|
||||
namespace functionObjects
|
||||
@ -66,13 +60,12 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class grad
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this grad object
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Name of field to process
|
||||
@ -118,14 +111,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
grad
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -135,34 +126,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of grad
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the grad data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate the gradient field
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the grad and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Write the gradient field
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -33,6 +34,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(histogram, 0);
|
||||
addToRunTimeSelectionTable(functionObject, histogram, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,15 +71,13 @@ void Foam::functionObjects::histogram::writeGraph
|
||||
Foam::functionObjects::histogram::histogram
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObjectFile(obr, typeName),
|
||||
name_(name)
|
||||
writeFile(name, runTime, dict, name)
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -95,7 +95,7 @@ Foam::functionObjects::histogram::~histogram()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::histogram::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::histogram::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("field") >> fieldName_;
|
||||
dict.lookup("max") >> max_;
|
||||
@ -104,24 +104,20 @@ void Foam::functionObjects::histogram::read(const dictionary& dict)
|
||||
|
||||
word format(dict.lookup("setFormat"));
|
||||
formatterPtr_ = writer<scalar>::New(format);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::histogram::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::histogram::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::histogram::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::histogram::write()
|
||||
bool Foam::functionObjects::histogram::execute(const bool postProcess)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::histogram::write(const bool postProcess)
|
||||
{
|
||||
Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
@ -201,6 +197,8 @@ void Foam::functionObjects::histogram::write()
|
||||
writeGraph(coords, field.name(), volFrac);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjects::writeFile
|
||||
|
||||
SourceFiles
|
||||
histogram.C
|
||||
@ -70,19 +70,12 @@ SourceFiles
|
||||
#define functionObjects_histogram_H
|
||||
|
||||
#include "writer.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "functionObjectFile.H"
|
||||
#include "writeFile.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class mapPolyMesh;
|
||||
class polyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
|
||||
@ -92,13 +85,10 @@ namespace functionObjects
|
||||
|
||||
class histogram
|
||||
:
|
||||
public functionObjectFile
|
||||
public writeFile
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this histogram
|
||||
word name_;
|
||||
|
||||
//- Name of field
|
||||
word fieldName_;
|
||||
|
||||
@ -139,52 +129,31 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
histogram
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~histogram();
|
||||
virtual ~histogram();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of histogram
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the histogram data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the histogram and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Calculate the histogram and write.
|
||||
// postProcess overrides the usual writeControl behaviour and
|
||||
// forces writing always (used in post-processing mode)
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 "volFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "mag.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -35,6 +34,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(mag, 0);
|
||||
addToRunTimeSelectionTable(functionObject, mag, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -44,17 +44,22 @@ namespace functionObjects
|
||||
Foam::functionObjects::mag::mag
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
fieldName_("undefined-fieldName"),
|
||||
resultName_("undefined-resultName")
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -72,7 +77,7 @@ Foam::functionObjects::mag::~mag()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::mag::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::mag::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("fieldName") >> fieldName_;
|
||||
dict.lookup("resultName") >> resultName_;
|
||||
@ -81,10 +86,12 @@ void Foam::functionObjects::mag::read(const dictionary& dict)
|
||||
{
|
||||
resultName_ = "mag(" + fieldName_ + ")";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::mag::execute()
|
||||
bool Foam::functionObjects::mag::execute(const bool postProcess)
|
||||
{
|
||||
bool processed = false;
|
||||
|
||||
@ -99,31 +106,25 @@ void Foam::functionObjects::mag::execute()
|
||||
WarningInFunction
|
||||
<< "Unprocessed field " << fieldName_ << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::mag::end()
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::mag::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::mag::write()
|
||||
bool Foam::functionObjects::mag::write(const bool postProcess)
|
||||
{
|
||||
if (obr_.foundObject<regIOobject>(resultName_))
|
||||
{
|
||||
const regIOobject& field =
|
||||
obr_.lookupObject<regIOobject>(resultName_);
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl
|
||||
Info<< type() << " " << name() << " output:" << nl
|
||||
<< " writing field " << field.name() << nl << endl;
|
||||
|
||||
field.write();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,11 +40,8 @@ SourceFiles
|
||||
#ifndef functionObjects_mag_H
|
||||
#define functionObjects_mag_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "OFstream.H"
|
||||
#include "Switch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -53,9 +50,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
class dimensionSet;
|
||||
|
||||
namespace functionObjects
|
||||
@ -66,13 +60,12 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class mag
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this mag object
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Name of field to process
|
||||
@ -112,14 +105,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
mag
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -129,34 +120,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of mag
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the mag data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate the magnitude field
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the mag and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Write the magnitude field
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 "mappedPatchBase.H"
|
||||
#include "OBJstream.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -36,6 +37,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(nearWallFields, 0);
|
||||
addToRunTimeSelectionTable(functionObject, nearWallFields, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,16 +226,21 @@ void Foam::functionObjects::nearWallFields::calcAddressing()
|
||||
Foam::functionObjects::nearWallFields::nearWallFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
fieldSet_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -256,7 +263,7 @@ Foam::functionObjects::nearWallFields::~nearWallFields()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -295,15 +302,17 @@ void Foam::functionObjects::nearWallFields::read(const dictionary& dict)
|
||||
reverseFieldMap_.insert(sampleFldName, fldName);
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << ": Sampling " << fieldMap_.size()
|
||||
Info<< type() << " " << name() << ": Sampling " << fieldMap_.size()
|
||||
<< " fields" << endl;
|
||||
|
||||
// Do analysis
|
||||
calcAddressing();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::nearWallFields::execute()
|
||||
bool Foam::functionObjects::nearWallFields::execute(const bool postProcess)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -320,7 +329,7 @@ void Foam::functionObjects::nearWallFields::execute()
|
||||
&& vtf_.empty()
|
||||
)
|
||||
{
|
||||
Info<< type() << " " << name_ << ": Creating " << fieldMap_.size()
|
||||
Info<< type() << " " << name() << ": Creating " << fieldMap_.size()
|
||||
<< " fields" << endl;
|
||||
|
||||
createFields(vsf_);
|
||||
@ -332,7 +341,7 @@ void Foam::functionObjects::nearWallFields::execute()
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
Info<< " Sampling fields to " << obr_.time().timeName()
|
||||
<< endl;
|
||||
@ -342,25 +351,12 @@ void Foam::functionObjects::nearWallFields::execute()
|
||||
sampleFields(vSpheretf_);
|
||||
sampleFields(vSymmtf_);
|
||||
sampleFields(vtf_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::nearWallFields::end()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
InfoInFunction << endl;
|
||||
}
|
||||
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::nearWallFields::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::nearWallFields::write()
|
||||
bool Foam::functionObjects::nearWallFields::write(const bool postProcess)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
@ -392,6 +388,8 @@ void Foam::functionObjects::nearWallFields::write()
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -62,7 +62,6 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
nearWallFields.C
|
||||
@ -72,7 +71,7 @@ SourceFiles
|
||||
#ifndef functionObjects_nearWallFields_H
|
||||
#define functionObjects_nearWallFields_H
|
||||
|
||||
#include "OFstream.H"
|
||||
#include "functionObject.H"
|
||||
#include "volFields.H"
|
||||
#include "Tuple2.H"
|
||||
#include "interpolationCellPoint.H"
|
||||
@ -84,8 +83,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -95,14 +92,14 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class nearWallFields
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of nearWallFields object
|
||||
word name_;
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
// Read from dictionary
|
||||
@ -191,9 +188,8 @@ public:
|
||||
nearWallFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -203,34 +199,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the nearWallFields object
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the controls
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate the near-wall fields
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Write the near-wall fields
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 "dictionary.H"
|
||||
#include "Pstream.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -34,6 +34,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(processorField, 0);
|
||||
addToRunTimeSelectionTable(functionObject, processorField, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,15 +44,20 @@ namespace functionObjects
|
||||
Foam::functionObjects::processorField::processorField
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr)
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
)
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -90,36 +96,32 @@ Foam::functionObjects::processorField::~processorField()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::processorField::read(const dictionary& dict)
|
||||
{}
|
||||
bool Foam::functionObjects::processorField::read(const dictionary& dict)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::processorField::execute()
|
||||
bool Foam::functionObjects::processorField::execute(const bool postProcess)
|
||||
{
|
||||
const volScalarField& procField =
|
||||
obr_.lookupObject<volScalarField>("processorID");
|
||||
|
||||
const_cast<volScalarField&>(procField) ==
|
||||
dimensionedScalar("proci", dimless, Pstream::myProcNo());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::processorField::end()
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::processorField::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::processorField::write()
|
||||
bool Foam::functionObjects::processorField::write(const bool postProcess)
|
||||
{
|
||||
const volScalarField& procField =
|
||||
obr_.lookupObject<volScalarField>("processorID");
|
||||
|
||||
procField.write();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -49,7 +49,6 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
processorField.C
|
||||
@ -59,11 +58,7 @@ SourceFiles
|
||||
#ifndef functionObjects_processorField_H
|
||||
#define functionObjects_processorField_H
|
||||
|
||||
#include "OFstream.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "coordinateSystem.H"
|
||||
#include "functionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -72,8 +67,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -83,15 +76,14 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class processorField
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of nearWallFields object
|
||||
word name_;
|
||||
|
||||
//- Reference to the database
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
|
||||
@ -114,14 +106,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
processorField
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -131,34 +121,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the processorField object
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the input data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate the processorID field
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Write the processorID field
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 "dictionary.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -33,6 +35,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(readFields, 0);
|
||||
addToRunTimeSelectionTable(functionObject, readFields, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,16 +45,21 @@ namespace functionObjects
|
||||
Foam::functionObjects::readFields::readFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
fieldSet_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -69,13 +77,15 @@ Foam::functionObjects::readFields::~readFields()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::readFields::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::readFields::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::readFields::execute()
|
||||
bool Foam::functionObjects::readFields::execute(const bool postProcess)
|
||||
{
|
||||
// Clear out any previously loaded fields
|
||||
vsf_.clear();
|
||||
@ -101,21 +111,15 @@ void Foam::functionObjects::readFields::execute()
|
||||
loadField<symmTensor>(fieldName, vSymmtf_, sSymmtf_);
|
||||
loadField<tensor>(fieldName, vtf_, stf_);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::readFields::end()
|
||||
bool Foam::functionObjects::readFields::write(const bool postProcess)
|
||||
{
|
||||
execute();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::readFields::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::readFields::write()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -55,7 +55,6 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
readFields.C
|
||||
@ -65,10 +64,9 @@ SourceFiles
|
||||
#ifndef functionObjects_readFields_H
|
||||
#define functionObjects_readFields_H
|
||||
|
||||
#include "OFstream.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "functionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -77,8 +75,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -88,14 +84,14 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class readFields
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of readFields object
|
||||
word name_;
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Fields to load
|
||||
@ -150,9 +146,8 @@ public:
|
||||
readFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -162,34 +157,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the readFields object
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the set of fields from dictionary
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Read the fields
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Do nothing
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 "volFields.H"
|
||||
#include "regionSplit.H"
|
||||
#include "fvcVolumeIntegrate.H"
|
||||
#include "mathematicalConstants.H"
|
||||
#include "stringListOps.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -37,6 +34,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(regionSizeDistribution, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
regionSizeDistribution,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
//- Plus op for FixedList<scalar>
|
||||
@ -322,18 +326,15 @@ void Foam::functionObjects::regionSizeDistribution::writeGraphs
|
||||
Foam::functionObjects::regionSizeDistribution::regionSizeDistribution
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObjectFiles(obr, name, typeName),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
writeFile(name, runTime, dict, name),
|
||||
alphaName_(dict.lookup("field")),
|
||||
patchNames_(dict.lookup("patches"))
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -351,7 +352,7 @@ Foam::functionObjects::regionSizeDistribution::~regionSizeDistribution()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
|
||||
{
|
||||
dict.lookup("field") >> alphaName_;
|
||||
dict.lookup("patches") >> patchNames_;
|
||||
@ -372,24 +373,26 @@ void Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
|
||||
Info<< "Transforming all vectorFields with coordinate system "
|
||||
<< coordSysPtr_().name() << endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::regionSizeDistribution::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::regionSizeDistribution::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::regionSizeDistribution::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::regionSizeDistribution::write()
|
||||
bool Foam::functionObjects::regionSizeDistribution::execute
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::regionSizeDistribution::write
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
const fvMesh& mesh = refCast<const fvMesh>(obr_);
|
||||
|
||||
@ -846,6 +849,8 @@ void Foam::functionObjects::regionSizeDistribution::write()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjects::writeFile
|
||||
|
||||
SourceFiles
|
||||
regionSizeDistribution.C
|
||||
@ -106,8 +106,7 @@ SourceFiles
|
||||
#ifndef functionObjects_regionSizeDistribution_H
|
||||
#define functionObjects_regionSizeDistribution_H
|
||||
|
||||
#include "functionObjectFiles.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "writeFile.H"
|
||||
#include "writer.H"
|
||||
#include "Map.H"
|
||||
#include "volFieldsFwd.H"
|
||||
@ -121,10 +120,7 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
class regionSplit;
|
||||
class polyMesh;
|
||||
|
||||
namespace functionObjects
|
||||
{
|
||||
@ -135,15 +131,10 @@ namespace functionObjects
|
||||
|
||||
class regionSizeDistribution
|
||||
:
|
||||
public functionObjectFiles
|
||||
public writeFile
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of this set of regionSizeDistribution objects
|
||||
word name_;
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Name of field
|
||||
word alphaName_;
|
||||
|
||||
@ -250,9 +241,8 @@ public:
|
||||
regionSizeDistribution
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
|
||||
@ -263,34 +253,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of regionSizeDistribution
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the regionSizeDistribution data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
//- Do nothing
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Calculate the regionSizeDistribution and write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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 "PatchTools.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -44,6 +45,7 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(streamLine, 0);
|
||||
addToRunTimeSelectionTable(functionObject, streamLine, dictionary);
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,7 +103,6 @@ Foam::functionObjects::streamLine::wallPatch() const
|
||||
|
||||
void Foam::functionObjects::streamLine::track()
|
||||
{
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
|
||||
IDLList<streamLineParticle> initialParticles;
|
||||
@ -140,118 +141,76 @@ void Foam::functionObjects::streamLine::track()
|
||||
|
||||
label UIndex = -1;
|
||||
|
||||
if (loadFromFiles_)
|
||||
label nScalar = 0;
|
||||
label nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
IOobjectList allObjects(mesh, runTime.timeName());
|
||||
|
||||
IOobjectList objects(2*fields_.size());
|
||||
forAll(fields_, i)
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
objects.add(*allObjects[fields_[i]]);
|
||||
nScalar++;
|
||||
}
|
||||
|
||||
ReadFields(mesh, objects, vsFlds);
|
||||
vsInterp.setSize(vsFlds.size());
|
||||
forAll(vsFlds, i)
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
nVector++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find field " << fields_[i] << nl
|
||||
<< "Valid scalar fields are:"
|
||||
<< mesh.names(volScalarField::typeName) << nl
|
||||
<< "Valid vector fields are:"
|
||||
<< mesh.names(volVectorField::typeName)
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
vsInterp.setSize(nScalar);
|
||||
nScalar = 0;
|
||||
vvInterp.setSize(nVector);
|
||||
nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
const volScalarField& f = mesh.lookupObject<volScalarField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
vsInterp.set
|
||||
(
|
||||
i,
|
||||
nScalar++,
|
||||
interpolation<scalar>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
vsFlds[i]
|
||||
f
|
||||
)
|
||||
);
|
||||
}
|
||||
ReadFields(mesh, objects, vvFlds);
|
||||
vvInterp.setSize(vvFlds.size());
|
||||
forAll(vvFlds, i)
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
const volVectorField& f = mesh.lookupObject<volVectorField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
|
||||
if (f.name() == UName_)
|
||||
{
|
||||
UIndex = nVector;
|
||||
}
|
||||
|
||||
vvInterp.set
|
||||
(
|
||||
i,
|
||||
nVector++,
|
||||
interpolation<vector>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
vvFlds[i]
|
||||
f
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
label nScalar = 0;
|
||||
label nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
nScalar++;
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
nVector++;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "Cannot find field " << fields_[i] << nl
|
||||
<< "Valid scalar fields are:"
|
||||
<< mesh.names(volScalarField::typeName) << nl
|
||||
<< "Valid vector fields are:"
|
||||
<< mesh.names(volVectorField::typeName)
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
vsInterp.setSize(nScalar);
|
||||
nScalar = 0;
|
||||
vvInterp.setSize(nVector);
|
||||
nVector = 0;
|
||||
|
||||
forAll(fields_, i)
|
||||
{
|
||||
if (mesh.foundObject<volScalarField>(fields_[i]))
|
||||
{
|
||||
const volScalarField& f = mesh.lookupObject<volScalarField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
vsInterp.set
|
||||
(
|
||||
nScalar++,
|
||||
interpolation<scalar>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
f
|
||||
)
|
||||
);
|
||||
}
|
||||
else if (mesh.foundObject<volVectorField>(fields_[i]))
|
||||
{
|
||||
const volVectorField& f = mesh.lookupObject<volVectorField>
|
||||
(
|
||||
fields_[i]
|
||||
);
|
||||
|
||||
if (f.name() == UName_)
|
||||
{
|
||||
UIndex = nVector;
|
||||
}
|
||||
|
||||
vvInterp.set
|
||||
(
|
||||
nVector++,
|
||||
interpolation<vector>::New
|
||||
(
|
||||
interpolationScheme_,
|
||||
f
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Store the names
|
||||
scalarNames_.setSize(vsInterp.size());
|
||||
@ -327,18 +286,22 @@ void Foam::functionObjects::streamLine::track()
|
||||
Foam::functionObjects::streamLine::streamLine
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
dict_(dict),
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
loadFromFiles_(loadFromFiles),
|
||||
nSubCycle_(0)
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -356,9 +319,9 @@ Foam::functionObjects::streamLine::~streamLine()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::streamLine::read(const dictionary& dict)
|
||||
bool Foam::functionObjects::streamLine::read(const dictionary& dict)
|
||||
{
|
||||
Info<< type() << " " << name_ << ":" << nl;
|
||||
Info<< type() << " " << name() << ":" << nl;
|
||||
|
||||
dict.lookup("fields") >> fields_;
|
||||
if (dict.found("UName"))
|
||||
@ -455,24 +418,20 @@ void Foam::functionObjects::streamLine::read(const dictionary& dict)
|
||||
|
||||
scalarFormatterPtr_ = writer<scalar>::New(dict.lookup("setFormat"));
|
||||
vectorFormatterPtr_ = writer<vector>::New(dict.lookup("setFormat"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::streamLine::execute()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::streamLine::end()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::streamLine::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::streamLine::write()
|
||||
bool Foam::functionObjects::streamLine::execute(const bool postProcess)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::functionObjects::streamLine::write(const bool postProcess)
|
||||
{
|
||||
Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
const Time& runTime = obr_.time();
|
||||
const fvMesh& mesh = dynamic_cast<const fvMesh&>(obr_);
|
||||
@ -527,41 +486,54 @@ void Foam::functionObjects::streamLine::write()
|
||||
|
||||
// Distribute the track positions. Note: use scheduled comms
|
||||
// to prevent buffering.
|
||||
mapDistribute::distribute
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
allTracks_
|
||||
false,
|
||||
allTracks_,
|
||||
flipOp()
|
||||
);
|
||||
|
||||
// Distribute the scalars
|
||||
forAll(allScalars_, scalarI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
allScalars_[scalarI].shrink();
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
allScalars_[scalarI]
|
||||
false,
|
||||
allScalars_[scalarI],
|
||||
flipOp()
|
||||
);
|
||||
allScalars_[scalarI].setCapacity(allScalars_[scalarI].size());
|
||||
}
|
||||
// Distribute the vectors
|
||||
forAll(allVectors_, vectorI)
|
||||
{
|
||||
mapDistribute::distribute
|
||||
allVectors_[vectorI].shrink();
|
||||
mapDistributeBase::distribute
|
||||
(
|
||||
Pstream::scheduled,
|
||||
distMap.schedule(),
|
||||
distMap.constructSize(),
|
||||
distMap.subMap(),
|
||||
false,
|
||||
distMap.constructMap(),
|
||||
allVectors_[vectorI]
|
||||
false,
|
||||
allVectors_[vectorI],
|
||||
flipOp()
|
||||
);
|
||||
allVectors_[vectorI].setCapacity(allVectors_[vectorI].size());
|
||||
}
|
||||
}
|
||||
|
||||
@ -695,6 +667,8 @@ void Foam::functionObjects::streamLine::write()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -91,7 +91,7 @@ Note
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjects::timeControl
|
||||
Foam::sampledSet
|
||||
Foam::wallBoundedStreamLine
|
||||
|
||||
@ -103,13 +103,11 @@ SourceFiles
|
||||
#ifndef functionObjects_streamLine_H
|
||||
#define functionObjects_streamLine_H
|
||||
|
||||
#include "functionObject.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "pointFieldFwd.H"
|
||||
#include "Switch.H"
|
||||
#include "DynamicList.H"
|
||||
#include "scalarList.H"
|
||||
#include "vectorList.H"
|
||||
#include "polyMesh.H"
|
||||
#include "writer.H"
|
||||
#include "indirectPrimitivePatch.H"
|
||||
|
||||
@ -120,8 +118,6 @@ namespace Foam
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class mapPolyMesh;
|
||||
class meshSearch;
|
||||
class sampledSet;
|
||||
|
||||
@ -133,20 +129,16 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class streamLine
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Input dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- Name of this set of field averages.
|
||||
word name_;
|
||||
|
||||
//- Database this class is registered to
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Load fields from files (not from objectRegistry)
|
||||
bool loadFromFiles_;
|
||||
//- Input dictionary
|
||||
dictionary dict_;
|
||||
|
||||
//- List of fields to sample
|
||||
wordList fields_;
|
||||
@ -233,14 +225,12 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
//- Construct from Time and dictionary
|
||||
streamLine
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -250,26 +240,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the set of field averages
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the field average data
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute the averaging
|
||||
virtual void execute();
|
||||
//- Do nothing
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute the averaging at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Calculate the field average data and write
|
||||
virtual void write();
|
||||
//- Calculate and write the steamlines
|
||||
virtual bool write(const bool postProcess = false);
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&);
|
||||
|
||||
@ -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 "surfaceFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -32,6 +34,13 @@ namespace Foam
|
||||
namespace functionObjects
|
||||
{
|
||||
defineTypeNameAndDebug(surfaceInterpolateFields, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
surfaceInterpolateFields,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -41,16 +50,21 @@ namespace functionObjects
|
||||
Foam::functionObjects::surfaceInterpolateFields::surfaceInterpolateFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
functionObject(name),
|
||||
obr_
|
||||
(
|
||||
runTime.lookupObject<objectRegistry>
|
||||
(
|
||||
dict.lookupOrDefault("region", polyMesh::defaultRegion)
|
||||
)
|
||||
),
|
||||
fieldSet_()
|
||||
{
|
||||
if (!isA<fvMesh>(obr))
|
||||
if (!isA<fvMesh>(obr_))
|
||||
{
|
||||
FatalErrorInFunction
|
||||
<< "objectRegistry is not an fvMesh" << exit(FatalError);
|
||||
@ -68,18 +82,23 @@ Foam::functionObjects::surfaceInterpolateFields::~surfaceInterpolateFields()
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::functionObjects::surfaceInterpolateFields::read
|
||||
bool Foam::functionObjects::surfaceInterpolateFields::read
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
dict.lookup("fields") >> fieldSet_;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::surfaceInterpolateFields::execute()
|
||||
bool Foam::functionObjects::surfaceInterpolateFields::execute
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
// Clear out any previously loaded fields
|
||||
ssf_.clear();
|
||||
@ -95,22 +114,17 @@ void Foam::functionObjects::surfaceInterpolateFields::execute()
|
||||
interpolateFields<tensor>(stf_);
|
||||
|
||||
Info<< endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::surfaceInterpolateFields::end()
|
||||
bool Foam::functionObjects::surfaceInterpolateFields::write
|
||||
(
|
||||
const bool postProcess
|
||||
)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
|
||||
|
||||
void Foam::functionObjects::surfaceInterpolateFields::timeSet()
|
||||
{}
|
||||
|
||||
|
||||
void Foam::functionObjects::surfaceInterpolateFields::write()
|
||||
{
|
||||
Info<< type() << " " << name_ << " output:" << nl;
|
||||
Info<< type() << " " << name() << " output:" << nl;
|
||||
|
||||
Info<< " Writing interpolated surface fields to "
|
||||
<< obr_.time().timeName() << endl;
|
||||
@ -135,6 +149,8 @@ void Foam::functionObjects::surfaceInterpolateFields::write()
|
||||
{
|
||||
stf_[i].write();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ Description
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
Foam::functionObjects::timeControl
|
||||
|
||||
SourceFiles
|
||||
surfaceInterpolateFields.C
|
||||
@ -69,8 +69,8 @@ SourceFiles
|
||||
#ifndef functionObjects_surfaceInterpolateFields_H
|
||||
#define functionObjects_surfaceInterpolateFields_H
|
||||
|
||||
#include "OFstream.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "functionObject.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "Tuple2.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -91,18 +91,17 @@ namespace functionObjects
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class surfaceInterpolateFields
|
||||
:
|
||||
public functionObject
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of surfaceInterpolateFields object
|
||||
word name_;
|
||||
|
||||
//- Reference to the objectRegistry
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- Fields to process
|
||||
//wordList fieldSet_;
|
||||
List<Tuple2<word, word>> fieldSet_;
|
||||
|
||||
//- Locally constructed fields
|
||||
@ -146,9 +145,8 @@ public:
|
||||
surfaceInterpolateFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
const Time& runTime,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
@ -158,34 +156,14 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the surfaceInterpolateFields object
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the controls
|
||||
virtual void read(const dictionary&);
|
||||
virtual bool read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
//- Calculate the interpolated fields
|
||||
virtual bool execute(const bool postProcess = false);
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
//- Write the interpolated fields
|
||||
virtual bool write(const bool postProcess = false);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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