GIT: Initial state after latest Foundation merge

This commit is contained in:
Andrew Heather
2016-09-20 14:49:08 +01:00
4571 changed files with 115696 additions and 74609 deletions

View File

@ -0,0 +1,127 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "fieldCoordinateSystemTransform.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
defineTypeNameAndDebug(fieldCoordinateSystemTransform, 0);
addToRunTimeSelectionTable
(
functionObject,
fieldCoordinateSystemTransform,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::functionObjects::fieldCoordinateSystemTransform::
fieldCoordinateSystemTransform
(
const word& name,
const Time& runTime,
const dictionary& dict
)
:
fvMeshFunctionObject(name, runTime, dict),
fieldSet_(),
coordSys_(mesh_, dict)
{
read(dict);
Log << type() << " " << name << ":" << nl
<< " Applying transformation from global Cartesian to local "
<< coordSys_ << nl << endl;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldCoordinateSystemTransform::
~fieldCoordinateSystemTransform()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::word
Foam::functionObjects::fieldCoordinateSystemTransform::transformFieldName
(
const word& fieldName
) const
{
return fieldName + ":Transformed";
}
bool Foam::functionObjects::fieldCoordinateSystemTransform::read
(
const dictionary& dict
)
{
fvMeshFunctionObject::read(dict);
dict.lookup("fields") >> fieldSet_;
return true;
}
bool Foam::functionObjects::fieldCoordinateSystemTransform::execute()
{
forAll(fieldSet_, fieldi)
{
transform<scalar>(fieldSet_[fieldi]);
transform<vector>(fieldSet_[fieldi]);
transform<sphericalTensor>(fieldSet_[fieldi]);
transform<symmTensor>(fieldSet_[fieldi]);
transform<tensor>(fieldSet_[fieldi]);
}
return true;
}
bool Foam::functionObjects::fieldCoordinateSystemTransform::write()
{
forAll(fieldSet_, fieldi)
{
writeObject(transformFieldName(fieldSet_[fieldi]));
}
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,177 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::functionObjects::fieldCoordinateSystemTransform
Group
grpFieldFunctionObjects
Description
Transforms a user-specified selection of fields from global Cartesian
co-ordinates to a local co-ordinate system. The fields are run-time
modifiable.
Example of function object specification:
\verbatim
fieldCoordinateSystemTransform1
{
type fieldCoordinateSystemTransform;
libs ("libfieldFunctionObjects.so");
...
fields
(
U
UMean
UPrime2Mean
);
origin (0.001 0 0);
coordinateRotation
{
type axesRotation;
e1 (1 0.15 0);
e3 (0 0 -1);
}
}
\endverbatim
Usage
\table
Property | Description | Required | Default value
type | type name: fieldCoordinateSystemTransform | yes |
fields | list of fields to be transformed |yes |
origin | origin of local co-ordinate system | yes |
coordinateRotation | orientation of local co-ordinate system | yes |
log | Log to standard output | no | yes
\endtable
See also
Foam::functionObjects::fvMeshFunctionObject
Foam::coordinateSystem
SourceFiles
fieldCoordinateSystemTransform.C
fieldCoordinateSystemTransformTemplates.C
\*---------------------------------------------------------------------------*/
#ifndef functionObjects_fieldCoordinateSystemTransform_H
#define functionObjects_fieldCoordinateSystemTransform_H
#include "fvMeshFunctionObject.H"
#include "coordinateSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace functionObjects
{
/*---------------------------------------------------------------------------*\
Class fieldCoordinateSystemTransform Declaration
\*---------------------------------------------------------------------------*/
class fieldCoordinateSystemTransform
:
public fvMeshFunctionObject
{
protected:
// Protected data
//- Fields to transform
wordList fieldSet_;
//- Co-ordinate system to transform to
coordinateSystem coordSys_;
//- Switch to send output to Info as well as to file
Switch log_;
// Protected Member Functions
//- Return the name of the transformed field
word transformFieldName(const word& fieldName) const;
//- Transform the given field
template<class FieldType>
void transformField(const FieldType& field);
//- Transform the given field if has the specified element type
template<class Type>
void transform(const word& fieldName);
public:
//- Runtime type information
TypeName("fieldCoordinateSystemTransform");
// Constructors
//- Construct from Time and dictionary
fieldCoordinateSystemTransform
(
const word& name,
const Time& runTime,
const dictionary& dict
);
//- Destructor
virtual ~fieldCoordinateSystemTransform();
// Member Functions
//- Read the input data
virtual bool read(const dictionary&);
//- Calculate the transformed fields
virtual bool execute();
//- Write the transformed fields
virtual bool write();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace functionObjects
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
#include "fieldCoordinateSystemTransformTemplates.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,125 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "fieldCoordinateSystemTransform.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "transformGeometricField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class FieldType>
void Foam::functionObjects::fieldCoordinateSystemTransform::transformField
(
const FieldType& field
)
{
word transFieldName(transformFieldName(field.name()));
store
(
transFieldName,
Foam::transform(dimensionedTensor(coordSys_.R().R()), field)
);
}
template<class Type>
void Foam::functionObjects::fieldCoordinateSystemTransform::transform
(
const word& fieldName
)
{
typedef GeometricField<Type, fvPatchField, volMesh> VolFieldType;
typedef GeometricField<Type, fvsPatchField, surfaceMesh> SurfaceFieldType;
if (mesh_.foundObject<VolFieldType>(fieldName))
{
DebugInfo
<< type() << ": Field " << fieldName << " already in database"
<< endl;
transformField<VolFieldType>
(
mesh_.lookupObject<VolFieldType>(fieldName)
);
}
else if (mesh_.foundObject<SurfaceFieldType>(fieldName))
{
DebugInfo
<< type() << ": Field " << fieldName << " already in database"
<< endl;
transformField<SurfaceFieldType>
(
mesh_.lookupObject<SurfaceFieldType>(fieldName)
);
}
else
{
IOobject fieldHeader
(
fieldName,
mesh_.time().timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if
(
fieldHeader.headerOk()
&& fieldHeader.headerClassName() == VolFieldType::typeName
)
{
DebugInfo
<< type() << ": Field " << fieldName << " read from file"
<< endl;
transformField<VolFieldType>
(
mesh_.lookupObject<VolFieldType>(fieldName)
);
}
else if
(
fieldHeader.headerOk()
&& fieldHeader.headerClassName() == SurfaceFieldType::typeName
)
{
DebugInfo
<< type() << ": Field " << fieldName << " read from file"
<< endl;
transformField<SurfaceFieldType>
(
mesh_.lookupObject<SurfaceFieldType>(fieldName)
);
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ 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)
libs ("libfieldFunctionObjects.so");
// Function object enabled flag
enabled true;
// When to output the average fields
writeControl writeTime;
// Fields to be transformed - runTime modifiable
fields
(
U
UMean
UPrime2Mean
);
origin (0.001 0 0);
coordinateRotation
{
type axesRotation;
e1 (1 0.15 0);
e3 (0 0 -1);
}
}
}
// ************************************************************************* //