mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: function objects - move turbulenceFields into utilities
This commit is contained in:
@ -34,9 +34,6 @@ streamLine/streamLineParticle.C
|
||||
streamLine/streamLineParticleCloud.C
|
||||
streamLine/streamLineFunctionObject.C
|
||||
|
||||
turbulenceFields/turbulenceFields.C
|
||||
turbulenceFields/turbulenceFieldsFunctionObject.C
|
||||
|
||||
wallBoundedStreamLine/wallBoundedStreamLine.C
|
||||
wallBoundedStreamLine/wallBoundedStreamLineFunctionObject.C
|
||||
wallBoundedStreamLine/wallBoundedStreamLineParticle.C
|
||||
|
||||
@ -3,11 +3,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
@ -16,8 +12,5 @@ LIB_LIBS = \
|
||||
-lsurfMesh \
|
||||
-llagrangian \
|
||||
-lfileFormats \
|
||||
-lsurfMesh \
|
||||
-lsampling \
|
||||
-lincompressibleTransportModels \
|
||||
-lcompressibleTurbulenceModel \
|
||||
-lincompressibleTurbulenceModel
|
||||
-lsurfMesh
|
||||
|
||||
@ -1,49 +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/>.
|
||||
|
||||
Typedef
|
||||
Foam::IOturbulenceFields
|
||||
|
||||
Description
|
||||
Instance of the generic IOOutputFilter for turbulenceFields.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef IOturbulenceFields_H
|
||||
#define IOturbulenceFields_H
|
||||
|
||||
#include "turbulenceFields.H"
|
||||
#include "IOOutputFilter.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef IOOutputFilter<turbulenceFields> IOturbulenceFields;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,34 +0,0 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: dev |
|
||||
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
version 2.0;
|
||||
format ascii;
|
||||
class dictionary;
|
||||
object postProcessingDict;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
functions
|
||||
{
|
||||
turbulenceFields1
|
||||
{
|
||||
type turbulenceFields;
|
||||
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||
enabled true;
|
||||
outputControl timeStep;
|
||||
outputInterval 1;
|
||||
|
||||
fields
|
||||
(
|
||||
R
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,279 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "turbulenceFields.H"
|
||||
#include "dictionary.H"
|
||||
#include "compressible/turbulenceModel/turbulenceModel.H"
|
||||
#include "incompressible/turbulenceModel/turbulenceModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(turbulenceFields, 0);
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<turbulenceFields::compressibleField, 6>::names[] =
|
||||
{
|
||||
"R",
|
||||
"devRhoReff",
|
||||
"mut",
|
||||
"muEff",
|
||||
"alphat",
|
||||
"alphaEff"
|
||||
};
|
||||
const NamedEnum<turbulenceFields::compressibleField, 6>
|
||||
turbulenceFields::compressibleFieldNames_;
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<turbulenceFields::incompressibleField, 4>::names[] =
|
||||
{
|
||||
"R",
|
||||
"devReff",
|
||||
"nut",
|
||||
"nuEff"
|
||||
};
|
||||
const NamedEnum<turbulenceFields::incompressibleField, 4>
|
||||
turbulenceFields::incompressibleFieldNames_;
|
||||
|
||||
const word turbulenceFields::modelName = "turbulenceModel";
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool Foam::turbulenceFields::compressible()
|
||||
{
|
||||
if (obr_.foundObject<compressible::turbulenceModel>(modelName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (obr_.foundObject<incompressible::turbulenceModel>(modelName))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningIn("Foam::word& Foam::turbulenceFields::compressible() const")
|
||||
<< "Turbulence model not found in database, deactivating";
|
||||
active_ = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::turbulenceFields::turbulenceFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obr,
|
||||
const dictionary& dict,
|
||||
const bool loadFromFiles
|
||||
)
|
||||
:
|
||||
name_(name),
|
||||
obr_(obr),
|
||||
active_(true),
|
||||
fieldSet_()
|
||||
{
|
||||
// Check if the available mesh is an fvMesh otherise deactivate
|
||||
if (isA<fvMesh>(obr_))
|
||||
{
|
||||
read(dict);
|
||||
}
|
||||
else
|
||||
{
|
||||
active_ = false;
|
||||
WarningIn
|
||||
(
|
||||
"turbulenceFields::turbulenceFields"
|
||||
"("
|
||||
"const word&, "
|
||||
"const objectRegistry&, "
|
||||
"const dictionary&, "
|
||||
"const bool"
|
||||
")"
|
||||
) << "No fvMesh available, deactivating " << name_
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::turbulenceFields::~turbulenceFields()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::turbulenceFields::read(const dictionary& dict)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
fieldSet_.insert(wordList(dict.lookup("fields")));
|
||||
|
||||
Info<< type() << " " << name_ << ": ";
|
||||
if (fieldSet_.size())
|
||||
{
|
||||
Info<< "storing fields:" << nl;
|
||||
forAllConstIter(wordHashSet, fieldSet_, iter)
|
||||
{
|
||||
Info<< " " << modelName << '.' << iter.key() << nl;
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "no fields requested to be stored" << nl << endl;
|
||||
}
|
||||
|
||||
execute();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::turbulenceFields::execute()
|
||||
{
|
||||
bool comp = compressible();
|
||||
|
||||
if (!active_)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (comp)
|
||||
{
|
||||
const compressible::turbulenceModel& model =
|
||||
obr_.lookupObject<compressible::turbulenceModel>(modelName);
|
||||
|
||||
forAllConstIter(wordHashSet, fieldSet_, iter)
|
||||
{
|
||||
const word& f = iter.key();
|
||||
switch (compressibleFieldNames_[f])
|
||||
{
|
||||
case cfR:
|
||||
{
|
||||
processField<symmTensor>(f, model.R());
|
||||
break;
|
||||
}
|
||||
case cfDevRhoReff:
|
||||
{
|
||||
processField<symmTensor>(f, model.devRhoReff());
|
||||
break;
|
||||
}
|
||||
case cfMut:
|
||||
{
|
||||
processField<scalar>(f, model.mut());
|
||||
break;
|
||||
}
|
||||
case cfMuEff:
|
||||
{
|
||||
processField<scalar>(f, model.muEff());
|
||||
break;
|
||||
}
|
||||
case cfAlphat:
|
||||
{
|
||||
processField<scalar>(f, model.alphat());
|
||||
break;
|
||||
}
|
||||
case cfAlphaEff:
|
||||
{
|
||||
processField<scalar>(f, model.alphaEff());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn("void Foam::turbulenceFields::execute()")
|
||||
<< "Invalid field selection" << abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
const incompressible::turbulenceModel& model =
|
||||
obr_.lookupObject<incompressible::turbulenceModel>(modelName);
|
||||
|
||||
forAllConstIter(wordHashSet, fieldSet_, iter)
|
||||
{
|
||||
const word& f = iter.key();
|
||||
switch (incompressibleFieldNames_[f])
|
||||
{
|
||||
case ifR:
|
||||
{
|
||||
processField<symmTensor>(f, model.R());
|
||||
break;
|
||||
}
|
||||
case ifDevReff:
|
||||
{
|
||||
processField<symmTensor>(f, model.devReff());
|
||||
break;
|
||||
}
|
||||
case ifNut:
|
||||
{
|
||||
processField<scalar>(f, model.nut());
|
||||
break;
|
||||
}
|
||||
case ifNuEff:
|
||||
{
|
||||
processField<scalar>(f, model.nuEff());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn("void Foam::turbulenceFields::execute()")
|
||||
<< "Invalid field selection" << abort(FatalError);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::turbulenceFields::end()
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
execute();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::turbulenceFields::timeSet()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
void Foam::turbulenceFields::write()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,239 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::turbulenceFields
|
||||
|
||||
Group
|
||||
grpFieldFunctionObjects
|
||||
|
||||
Description
|
||||
This function object stores turbulence fields on the mesh database for
|
||||
further manipulation.
|
||||
|
||||
Fields are stored as copies of the original, with the prefix
|
||||
"tubulenceModel::", e.g.
|
||||
|
||||
turbulenceModel::R
|
||||
|
||||
Example of function object specification:
|
||||
\verbatim
|
||||
turbulenceFields1
|
||||
{
|
||||
type turbulenceFields;
|
||||
functionObjectLibs ("libfieldFunctionObjects.so");
|
||||
...
|
||||
fields
|
||||
(
|
||||
R
|
||||
devRhoReff
|
||||
);
|
||||
}
|
||||
\endverbatim
|
||||
|
||||
\heading Function object usage
|
||||
\table
|
||||
Property | Description | Required | Default value
|
||||
type | type name: processorField | yes |
|
||||
fields | fields to store (see below) | yes |
|
||||
\endtable
|
||||
|
||||
Where \c fields can include:
|
||||
\plaintable
|
||||
R | Stress tensor
|
||||
devRhoReff |
|
||||
mut | turbulence viscosity (compressible)
|
||||
muEff | effective turbulence viscosity (compressible)
|
||||
alphat | turbulence thermal diffusivity (compressible)
|
||||
alphaEff | effective turbulence thermal diffusivity (compressible)
|
||||
devReff |
|
||||
nut | turbulence viscosity (incompressible)
|
||||
nuEff | effective turbulence viscosity (incompressible)
|
||||
\endplaintable
|
||||
|
||||
SeeAlso
|
||||
Foam::functionObject
|
||||
Foam::OutputFilterFunctionObject
|
||||
|
||||
SourceFiles
|
||||
turbulenceFields.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef turbulenceFields_H
|
||||
#define turbulenceFields_H
|
||||
|
||||
#include "HashSet.H"
|
||||
#include "IOobject.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class objectRegistry;
|
||||
class dictionary;
|
||||
class polyMesh;
|
||||
class mapPolyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class turbulenceFields Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class turbulenceFields
|
||||
{
|
||||
public:
|
||||
|
||||
enum compressibleField
|
||||
{
|
||||
cfR,
|
||||
cfDevRhoReff,
|
||||
cfMut,
|
||||
cfMuEff,
|
||||
cfAlphat,
|
||||
cfAlphaEff
|
||||
};
|
||||
static const NamedEnum<compressibleField, 6> compressibleFieldNames_;
|
||||
|
||||
enum incompressibleField
|
||||
{
|
||||
ifR,
|
||||
ifDevReff,
|
||||
ifNut,
|
||||
ifNuEff
|
||||
};
|
||||
static const NamedEnum<incompressibleField, 4> incompressibleFieldNames_;
|
||||
|
||||
static const word modelName;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Name of this set of turbulenceFields object
|
||||
word name_;
|
||||
|
||||
const objectRegistry& obr_;
|
||||
|
||||
//- on/off switch
|
||||
bool active_;
|
||||
|
||||
//- Fields to load
|
||||
wordHashSet fieldSet_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
turbulenceFields(const turbulenceFields&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const turbulenceFields&);
|
||||
|
||||
//- Return true if compressible turbulence model is identified
|
||||
bool compressible();
|
||||
|
||||
//- Process the turbulence field
|
||||
template<class Type>
|
||||
void processField
|
||||
(
|
||||
const word& fieldName,
|
||||
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvalue
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("turbulenceFields");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct for given objectRegistry and dictionary.
|
||||
// Allow the possibility to load fields from files
|
||||
turbulenceFields
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry&,
|
||||
const dictionary&,
|
||||
const bool loadFromFiles = false
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~turbulenceFields();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return name of the turbulenceFields object
|
||||
virtual const word& name() const
|
||||
{
|
||||
return name_;
|
||||
}
|
||||
|
||||
//- Read the field min/max data
|
||||
virtual void read(const dictionary&);
|
||||
|
||||
//- Execute, currently does nothing
|
||||
virtual void execute();
|
||||
|
||||
//- Execute at the final time-loop, currently does nothing
|
||||
virtual void end();
|
||||
|
||||
//- Called when time was set at the end of the Time::operator++
|
||||
virtual void timeSet();
|
||||
|
||||
//- Write
|
||||
virtual void write();
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void updateMesh(const mapPolyMesh&)
|
||||
{}
|
||||
|
||||
//- Update for changes of mesh
|
||||
virtual void movePoints(const polyMesh&)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
#include "turbulenceFieldsTemplates.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,42 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "turbulenceFieldsFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineNamedTemplateTypeNameAndDebug(turbulenceFieldsFunctionObject, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
functionObject,
|
||||
turbulenceFieldsFunctionObject,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,54 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Typedef
|
||||
Foam::turbulenceFieldsFunctionObject
|
||||
|
||||
Description
|
||||
FunctionObject wrapper around turbulenceFields to allow them to be created
|
||||
via the functions entry within controlDict.
|
||||
|
||||
SourceFiles
|
||||
turbulenceFieldsFunctionObject.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef turbulenceFieldsFunctionObject_H
|
||||
#define turbulenceFieldsFunctionObject_H
|
||||
|
||||
#include "turbulenceFields.H"
|
||||
#include "OutputFilterFunctionObject.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef OutputFilterFunctionObject<turbulenceFields>
|
||||
turbulenceFieldsFunctionObject;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,81 +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 "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
void Foam::turbulenceFields::processField
|
||||
(
|
||||
const word& fieldName,
|
||||
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvalue
|
||||
)
|
||||
{
|
||||
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
|
||||
|
||||
const word scopedName = modelName + '.' + fieldName;
|
||||
|
||||
if (obr_.foundObject<FieldType>(scopedName))
|
||||
{
|
||||
FieldType& fld =
|
||||
const_cast<FieldType&>(obr_.lookupObject<FieldType>(scopedName));
|
||||
fld == tvalue();
|
||||
}
|
||||
else if (obr_.found(scopedName))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"void Foam::turbulenceFields::processField"
|
||||
"("
|
||||
"const word&, "
|
||||
"const tmp<GeometricField<Type, fvPatchField, volMesh> >&"
|
||||
")"
|
||||
) << "Cannot store turbulence field " << scopedName
|
||||
<< " since an object with that name already exists"
|
||||
<< nl << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
obr_.store
|
||||
(
|
||||
new FieldType
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
scopedName,
|
||||
obr_.time().timeName(),
|
||||
obr_,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
tvalue
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user