mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Added fieldCoordinateSystemTransform function object - self explanatory
This commit is contained in:
@ -3,6 +3,9 @@ fieldAverage/fieldAverageItem/fieldAverageItem.C
|
|||||||
fieldAverage/fieldAverageItem/fieldAverageItemIO.C
|
fieldAverage/fieldAverageItem/fieldAverageItemIO.C
|
||||||
fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.C
|
fieldAverage/fieldAverageFunctionObject/fieldAverageFunctionObject.C
|
||||||
|
|
||||||
|
fieldCoordinateSystemTransform/fieldCoordinateSystemTransform.C
|
||||||
|
fieldCoordinateSystemTransform/fieldCoordinateSystemTransformFunctionObject.C
|
||||||
|
|
||||||
fieldMinMax/fieldMinMax.C
|
fieldMinMax/fieldMinMax.C
|
||||||
fieldMinMax/fieldMinMaxFunctionObject.C
|
fieldMinMax/fieldMinMaxFunctionObject.C
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
Typedef
|
||||||
|
Foam::IOfieldCoordinateSystemTransform
|
||||||
|
|
||||||
|
Description
|
||||||
|
Instance of the generic IOOutputFilter for fieldCoordinateSystemTransform.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef IOfieldCoordinateSystemTransform_H
|
||||||
|
#define IOfieldCoordinateSystemTransform_H
|
||||||
|
|
||||||
|
#include "fieldCoordinateSystemTransform.H"
|
||||||
|
#include "IOOutputFilter.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
typedef IOOutputFilter<fieldCoordinateSystemTransform>
|
||||||
|
IOfieldCoordinateSystemTransform;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,118 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "fieldCoordinateSystemTransform.H"
|
||||||
|
#include "dictionary.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defineTypeNameAndDebug(Foam::fieldCoordinateSystemTransform, 0);
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fieldCoordinateSystemTransform::fieldCoordinateSystemTransform
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry& obr,
|
||||||
|
const dictionary& dict,
|
||||||
|
const bool loadFromFiles
|
||||||
|
)
|
||||||
|
:
|
||||||
|
name_(name),
|
||||||
|
obr_(obr),
|
||||||
|
active_(true),
|
||||||
|
fieldSet_(),
|
||||||
|
coordSys_(dict, obr)
|
||||||
|
{
|
||||||
|
// Check if the available mesh is an fvMesh otherise deactivate
|
||||||
|
if (!isA<fvMesh>(obr_))
|
||||||
|
{
|
||||||
|
active_ = false;
|
||||||
|
WarningIn
|
||||||
|
(
|
||||||
|
"fieldCoordinateSystemTransform::fieldCoordinateSystemTransform"
|
||||||
|
"("
|
||||||
|
"const word&, "
|
||||||
|
"const objectRegistry&, "
|
||||||
|
"const dictionary&, "
|
||||||
|
"const bool"
|
||||||
|
")"
|
||||||
|
) << "No fvMesh available, deactivating."
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
read(dict);
|
||||||
|
|
||||||
|
Info<< type() << ":" << nl
|
||||||
|
<< " Applying transformation from global Cartesian to local "
|
||||||
|
<< coordSys_ << nl << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::fieldCoordinateSystemTransform::~fieldCoordinateSystemTransform()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
void Foam::fieldCoordinateSystemTransform::read(const dictionary& dict)
|
||||||
|
{
|
||||||
|
if (active_)
|
||||||
|
{
|
||||||
|
dict.lookup("fields") >> fieldSet_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fieldCoordinateSystemTransform::execute()
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fieldCoordinateSystemTransform::end()
|
||||||
|
{
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::fieldCoordinateSystemTransform::write()
|
||||||
|
{
|
||||||
|
forAll(fieldSet_, fieldI)
|
||||||
|
{
|
||||||
|
// If necessary load field
|
||||||
|
transform<scalar>(fieldSet_[fieldI]);
|
||||||
|
transform<vector>(fieldSet_[fieldI]);
|
||||||
|
transform<sphericalTensor>(fieldSet_[fieldI]);
|
||||||
|
transform<symmTensor>(fieldSet_[fieldI]);
|
||||||
|
transform<tensor>(fieldSet_[fieldI]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,163 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::fieldCoordinateSystemTransform
|
||||||
|
|
||||||
|
Description
|
||||||
|
Transforms fields from global cartesian co-ordinates to local co-ordinate
|
||||||
|
system
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
fieldCoordinateSystemTransform.C
|
||||||
|
IOfieldCoordinateSystemTransform.H
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fieldCoordinateSystemTransform_H
|
||||||
|
#define fieldCoordinateSystemTransform_H
|
||||||
|
|
||||||
|
#include "OFstream.H"
|
||||||
|
#include "pointFieldFwd.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "coordinateSystem.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
// Forward declaration of classes
|
||||||
|
class objectRegistry;
|
||||||
|
class dictionary;
|
||||||
|
class mapPolyMesh;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class fieldCoordinateSystemTransform Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class fieldCoordinateSystemTransform
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Protected data
|
||||||
|
|
||||||
|
//- Name
|
||||||
|
word name_;
|
||||||
|
|
||||||
|
const objectRegistry& obr_;
|
||||||
|
|
||||||
|
//- on/off switch
|
||||||
|
bool active_;
|
||||||
|
|
||||||
|
//- Fields to transform
|
||||||
|
wordList fieldSet_;
|
||||||
|
|
||||||
|
//- Co-ordinate system to transform to
|
||||||
|
coordinateSystem coordSys_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- Disallow default bitwise copy construct
|
||||||
|
fieldCoordinateSystemTransform(const fieldCoordinateSystemTransform&);
|
||||||
|
|
||||||
|
//- Disallow default bitwise assignment
|
||||||
|
void operator=(const fieldCoordinateSystemTransform&);
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void transform(const word& fieldName) const;
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void transformField(const Type& field) const;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("fieldCoordinateSystemTransform");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct for given objectRegistry and dictionary.
|
||||||
|
// Allow the possibility to load fields from files
|
||||||
|
fieldCoordinateSystemTransform
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const objectRegistry&,
|
||||||
|
const dictionary&,
|
||||||
|
const bool loadFromFiles = false
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Destructor
|
||||||
|
virtual ~fieldCoordinateSystemTransform();
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Return name of the fieldCoordinateSystemTransform object
|
||||||
|
virtual const word& name() const
|
||||||
|
{
|
||||||
|
return name_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Read the input 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();
|
||||||
|
|
||||||
|
//- Write
|
||||||
|
virtual void write();
|
||||||
|
|
||||||
|
//- Update for changes of mesh
|
||||||
|
virtual void updateMesh(const mapPolyMesh&)
|
||||||
|
{}
|
||||||
|
|
||||||
|
//- Update for changes of mesh
|
||||||
|
virtual void movePoints(const pointField&)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#ifdef NoRepository
|
||||||
|
# include "fieldCoordinateSystemTransformTemplates.C"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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/>.
|
||||||
|
|
||||||
|
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<fieldCoordinateSystemTransform>
|
||||||
|
fieldCoordinateSystemTransformFunctionObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,158 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "fieldCoordinateSystemTransform.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
#include "surfaceFields.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "transformGeometricField.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::fieldCoordinateSystemTransform::transformField
|
||||||
|
(
|
||||||
|
const Type& field
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
const word& fieldName = field.name() + "Transformed";
|
||||||
|
|
||||||
|
dimensionedTensor R("R", field.dimensions(), coordSys_.R());
|
||||||
|
|
||||||
|
if (obr_.foundObject<Type>(fieldName))
|
||||||
|
{
|
||||||
|
Type& transField =
|
||||||
|
const_cast<Type&>(obr_.lookupObject<Type>(fieldName));
|
||||||
|
|
||||||
|
transField == field;
|
||||||
|
|
||||||
|
forAll(field, i)
|
||||||
|
{
|
||||||
|
Foam::transform(transField, R, transField);
|
||||||
|
}
|
||||||
|
|
||||||
|
transField.write();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Type& transField = obr_.store
|
||||||
|
(
|
||||||
|
new Type
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
obr_.time().timeName(),
|
||||||
|
obr_,
|
||||||
|
IOobject::READ_IF_PRESENT,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
field
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
forAll(field, i)
|
||||||
|
{
|
||||||
|
Foam::transform(transField, R, transField);
|
||||||
|
}
|
||||||
|
|
||||||
|
transField.write();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class Type>
|
||||||
|
void Foam::fieldCoordinateSystemTransform::transform
|
||||||
|
(
|
||||||
|
const word& fieldName
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
typedef GeometricField<Type, fvPatchField, volMesh> vfType;
|
||||||
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sfType;
|
||||||
|
|
||||||
|
if (obr_.foundObject<vfType>(fieldName))
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< type() << ": Field " << fieldName << " already in database"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
transformField<vfType>(obr_.lookupObject<vfType>(fieldName));
|
||||||
|
}
|
||||||
|
else if (obr_.foundObject<sfType>(fieldName))
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< type() << ": Field " << fieldName << " already in database"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
transformField<sfType>(obr_.lookupObject<sfType>(fieldName));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
IOobject fieldHeader
|
||||||
|
(
|
||||||
|
fieldName,
|
||||||
|
obr_.time().timeName(),
|
||||||
|
obr_,
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
);
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
fieldHeader.headerOk()
|
||||||
|
&& fieldHeader.headerClassName() == vfType::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< type() << ": Field " << fieldName << " read from file"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
transformField<vfType>(obr_.lookupObject<vfType>(fieldName));
|
||||||
|
}
|
||||||
|
else if
|
||||||
|
(
|
||||||
|
fieldHeader.headerOk()
|
||||||
|
&& fieldHeader.headerClassName() == sfType::typeName
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (debug)
|
||||||
|
{
|
||||||
|
Info<< type() << ": Field " << fieldName << " read from file"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
transformField<sfType>(obr_.lookupObject<sfType>(fieldName));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*--------------------------------*- 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
|
||||||
|
{
|
||||||
|
fieldCoordinateSystemTransform1
|
||||||
|
{
|
||||||
|
// Type of functionObject
|
||||||
|
type fieldCoordinateSystemTransform;
|
||||||
|
|
||||||
|
// Where to load it from (if not already in solver)
|
||||||
|
functionObjectLibs ("libfieldCoordinateSystemTransform.so");
|
||||||
|
|
||||||
|
// Function object enabled flag
|
||||||
|
enabled true;
|
||||||
|
|
||||||
|
// When to output the average fields
|
||||||
|
outputControl outputTime;
|
||||||
|
|
||||||
|
// Fields to be transformed - runTime modifiable
|
||||||
|
fields
|
||||||
|
(
|
||||||
|
U
|
||||||
|
UMean
|
||||||
|
UPrime2Mean
|
||||||
|
);
|
||||||
|
|
||||||
|
coordinateSystem
|
||||||
|
{
|
||||||
|
origin (0.001 0 0);
|
||||||
|
e1 (1 0.15 0);
|
||||||
|
e3 (0 0 -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user