Merge branch 'feature-coordinateSystem' into 'develop'

coordinate system improvements

See merge request Development/OpenFOAM-plus!211
This commit is contained in:
Mattijs Janssens
2018-10-11 16:32:03 +01:00
147 changed files with 4849 additions and 3350 deletions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,23 +56,19 @@ fieldCoordinateSystemTransform
:
fvMeshFunctionObject(name, runTime, dict),
fieldSet_(mesh_),
coordSys_(mesh_, dict.subDict("coordinateSystem"))
csysPtr_
(
coordinateSystem::New(mesh_, dict, coordinateSystem::typeName_())
)
{
read(dict);
Info<< type() << " " << name << ":" << nl
<< " Applying transformation from global Cartesian to local "
<< coordSys_ << nl << endl;
<< *csysPtr_ << nl << endl;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::functionObjects::fieldCoordinateSystemTransform::
~fieldCoordinateSystemTransform()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::word

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -29,7 +29,7 @@ Group
Description
Transforms a user-specified selection of fields from global Cartesian
co-ordinates to a local co-ordinate system. The fields are run-time
coordinates to a local coordinate system. The fields are run-time
modifiable.
Usage
@ -50,11 +50,11 @@ Usage
coordinateSystem
{
origin (0.001 0 0);
coordinateRotation
rotation
{
type axesRotation;
e1 (1 0.15 0);
e3 (0 0 -1);
type axes;
e1 (1 0.15 0);
e3 (0 0 -1);
}
}
}
@ -65,7 +65,7 @@ Usage
Property | Description | Required | Default value
type | type name: fieldCoordinateSystemTransform | yes |
fields | list of fields to be transformed |yes |
coordinateSystem | local co-ordinate system | yes |
coordinateSystem | local coordinate system | yes |
\endtable
See also
@ -107,8 +107,8 @@ protected:
//- Fields to transform
volFieldSelection fieldSet_;
//- Co-ordinate system to transform to
coordinateSystem coordSys_;
//- Coordinate system to transform to
autoPtr<coordinateSystem> csysPtr_;
// Protected Member Functions
@ -143,7 +143,7 @@ public:
//- Destructor
virtual ~fieldCoordinateSystemTransform();
virtual ~fieldCoordinateSystemTransform() = default;
// Member Functions

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2016-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -41,7 +41,7 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transformField
store
(
transFieldName,
Foam::transform(dimensionedTensor(coordSys_.R().R()), field)
Foam::transform(dimensionedTensor(csysPtr_->R()), field)
);
}
@ -61,7 +61,10 @@ void Foam::functionObjects::fieldCoordinateSystemTransform::transform
<< type() << ": Field " << fieldName << " already in database"
<< endl;
transformField<VolFieldType>(lookupObject<VolFieldType>(fieldName));
transformField<VolFieldType>
(
lookupObject<VolFieldType>(fieldName)
);
}
else if (foundObject<SurfaceFieldType>(fieldName))
{

View File

@ -41,12 +41,8 @@ functions
coordinateSystem
{
origin (0 0 0);
coordinateRotation
{
type axesRotation;
e1 (1 0.15 0);
e3 (0 0 -1);
}
e1 (1 0.15 0);
e3 (0 0 -1);
}
}
}

View File

@ -350,12 +350,19 @@ bool Foam::functionObjects::regionSizeDistribution::read(const dictionary& dict)
const word format(dict.get<word>("setFormat"));
formatterPtr_ = writer<scalar>::New(format);
if (dict.found("coordinateSystem"))
if (dict.found(coordinateSystem::typeName_()))
{
coordSysPtr_.reset(new coordinateSystem(obr_, dict));
csysPtr_.reset
(
coordinateSystem::New(obr_, dict, coordinateSystem::typeName_())
);
Info<< "Transforming all vectorFields with coordinate system "
<< coordSysPtr_().name() << endl;
<< csysPtr_->name() << endl;
}
else
{
csysPtr_.clear();
}
if (isoPlanes_)
@ -897,14 +904,14 @@ bool Foam::functionObjects::regionSizeDistribution::write()
volVectorField
>(fldName).primitiveField();
if (coordSysPtr_.valid())
if (csysPtr_.valid())
{
Log << "Transforming vector field " << fldName
<< " with coordinate system "
<< coordSysPtr_().name()
<< csysPtr_->name()
<< endl;
fld = coordSysPtr_().localVector(fld);
fld = csysPtr_->localVector(fld);
}

View File

@ -113,8 +113,8 @@ Usage
maxDiameter | maximum region equivalent diameter | yes |
minDiameter | minimum region equivalent diameter | no | 0
setFormat | writing format | yes |
origin | origin of local co-ordinate system | yes |
coordinateRoation | orientation of local co-ordinate system | no
origin | origin of local coordinate system | yes |
coordinateRoation | orientation of local coordinate system | no
log | Log to standard output | no | yes
isoPlanes | switch for isoPlanes | no | false
origin | origin of the plane when isoPlanes is used | no | none
@ -198,7 +198,7 @@ class regionSizeDistribution
autoPtr<writer<scalar>> formatterPtr_;
//- Optional coordinate system
autoPtr<coordinateSystem> coordSysPtr_;
autoPtr<coordinateSystem> csysPtr_;
// Optional extra definition of bins on planes downstream to the origin
// point and maximum diameter

View File

@ -29,6 +29,7 @@ License
#include "turbulentTransportModel.H"
#include "turbulentFluidThermoModel.H"
#include "addToRunTimeSelectionTable.H"
#include "cartesianCS.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -37,7 +38,6 @@ namespace Foam
namespace functionObjects
{
defineTypeNameAndDebug(forces, 0);
addToRunTimeSelectionTable(functionObject, forces, dictionary);
}
}
@ -857,7 +857,23 @@ bool Foam::functionObjects::forces::read(const dictionary& dict)
// specified directly, from coordinate system, or implicitly (0 0 0)
if (!dict.readIfPresent<point>("CofR", coordSys_.origin()))
{
coordSys_ = coordinateSystem(obr_, dict);
// The 'coordinateSystem' sub-dictionary is optional,
// but enforce use of a cartesian system.
if (dict.found(coordinateSystem::typeName_()))
{
// New() for access to indirect (global) coordinate system
coordSys_ =
coordinateSystem::New
(
obr_, dict, coordinateSystem::typeName_()
);
}
else
{
coordSys_ = coordSystem::cartesian(dict);
}
localSystem_ = true;
}

View File

@ -3,7 +3,7 @@
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
\\/ M anipulation | Copyright (C) 2015-2018 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -32,21 +32,21 @@ Description
skin-friction forces over a given list of patches, and the resistance
from porous zones.
Forces and moments are calculated, with optional co-ordinate system and
Forces and moments are calculated, with optional coordinate system and
writing of binned data, where force and moment contributions are collected
into a user-defined number of bins that span the input geometries for a
user-defined direction vector.
Data is written into multiple files in the
postProcessing/\<functionObjectName\> directory:
- force.dat : forces in global Cartesian co-ordinate system
- moment.dat : moments in global Cartesian co-ordinate system
- forceBin.dat : force bins in global Cartesian co-ordinate system
- momentBin.dat : moment bins in global Cartesian co-ordinate system
- localForce.dat : forces in local co-ordinate system
- localMoment.dat : moments in local co-ordinate system
- localForceBin.dat : force bins in local co-ordinate system
- localMomentBin.dat : moment bins in local co-ordinate system
- force.dat : forces in global Cartesian coordinate system
- moment.dat : moments in global Cartesian coordinate system
- forceBin.dat : force bins in global Cartesian coordinate system
- momentBin.dat : moment bins in global Cartesian coordinate system
- localForce.dat : forces in local Cartesian coordinate system
- localMoment.dat : moments in local Cartesian coordinate system
- localForceBin.dat : force bins in local Cartesian coordinate system
- localMomentBin.dat : moment bins in local Cartesian coordinate system
Usage
Example of function object specification:
@ -107,13 +107,19 @@ Note
CofR (0 0 0);
\endverbatim
or
\verbatim
origin (0 0 0);
e1 (0 1 0);
e3 (0 0 1);
\endverbatim
or
\verbatim
coordinateSystem
{
origin (0 0 0);
coordinateRotation
rotation
{
type axesRotation;
type axes;
e3 (0 0 1);
e1 (1 0 0);
}
@ -136,7 +142,7 @@ SourceFiles
#include "fvMeshFunctionObject.H"
#include "writeFile.H"
#include "coordinateSystem.H"
#include "cartesianCS.H"
#include "volFieldsFwd.H"
#include "HashSet.H"
#include "Tuple2.H"
@ -224,9 +230,9 @@ protected:
scalar pRef_;
//- Coordinate system used when evaluting forces/moments
coordinateSystem coordSys_;
coordSystem::cartesian coordSys_;
//- Flag to indicate whether we are using a local co-ordinate sys
//- Flag to indicate whether we are using a local coordinates
bool localSystem_;
//- Flag to include porosity effects