Merge remote branch 'OpenCFD/master' into olesenm
This commit is contained in:
@ -19,6 +19,6 @@ streamLine/streamLine.C
|
||||
streamLine/streamLineParticle.C
|
||||
streamLine/streamLineParticleCloud.C
|
||||
streamLine/streamLineFunctionObject.C
|
||||
|
||||
streamLine/vectorIOFieldField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfieldFunctionObjects
|
||||
|
||||
@ -80,10 +80,11 @@ void Foam::fieldValues::cellSource::setCellZoneCells()
|
||||
}
|
||||
|
||||
cellId_.setSize(count);
|
||||
nCells_ = returnReduce(cellId_.size(), sumOp<label>());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Original cell zone size = " << cZone.size()
|
||||
Pout<< "Original cell zone size = " << cZone.size()
|
||||
<< ", new size = " << count << endl;
|
||||
}
|
||||
}
|
||||
@ -109,8 +110,8 @@ void Foam::fieldValues::cellSource::initialise(const dictionary& dict)
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl
|
||||
<< " total cells = " << cellId_.size() << nl
|
||||
<< " total volume = " << sum(filterField(mesh().V()))
|
||||
<< " total cells = " << nCells_ << nl
|
||||
<< " total volume = " << gSum(filterField(mesh().V()))
|
||||
<< nl << endl;
|
||||
|
||||
if (operation_ == opWeightedAverage)
|
||||
@ -144,7 +145,7 @@ void Foam::fieldValues::cellSource::writeFileHeader()
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< "# Source : " << sourceTypeNames_[source_] << " "
|
||||
<< sourceName_ << nl << "# Cells : " << cellId_.size() << nl
|
||||
<< sourceName_ << nl << "# Cells : " << nCells_ << nl
|
||||
<< "# Time" << tab << "sum(V)";
|
||||
|
||||
forAll(fields_, i)
|
||||
@ -172,6 +173,7 @@ Foam::fieldValues::cellSource::cellSource
|
||||
fieldValue(name, obr, dict, loadFromFiles),
|
||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||
nCells_(0),
|
||||
cellId_()
|
||||
{
|
||||
read(dict);
|
||||
|
||||
@ -133,6 +133,9 @@ protected:
|
||||
//- Operation to apply to values
|
||||
operationType operation_;
|
||||
|
||||
//- Global number of cells
|
||||
label nCells_;
|
||||
|
||||
//- Local list of cell IDs
|
||||
labelList cellId_;
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
|
||||
|
||||
faceId_.setSize(fZone.size());
|
||||
facePatchId_.setSize(fZone.size());
|
||||
flipMap_.setSize(fZone.size());
|
||||
faceSign_.setSize(fZone.size());
|
||||
|
||||
label count = 0;
|
||||
forAll(fZone, i)
|
||||
@ -134,11 +134,11 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
|
||||
{
|
||||
if (fZone.flipMap()[i])
|
||||
{
|
||||
flipMap_[count] = -1;
|
||||
faceSign_[count] = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
flipMap_[count] = 1;
|
||||
faceSign_[count] = 1;
|
||||
}
|
||||
faceId_[count] = faceId;
|
||||
facePatchId_[count] = facePatchId;
|
||||
@ -148,11 +148,12 @@ void Foam::fieldValues::faceSource::setFaceZoneFaces()
|
||||
|
||||
faceId_.setSize(count);
|
||||
facePatchId_.setSize(count);
|
||||
flipMap_.setSize(count);
|
||||
faceSign_.setSize(count);
|
||||
nFaces_ = returnReduce(faceId_.size(), sumOp<label>());
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Original face zone size = " << fZone.size()
|
||||
Pout<< "Original face zone size = " << fZone.size()
|
||||
<< ", new size = " << count << endl;
|
||||
}
|
||||
}
|
||||
@ -187,13 +188,14 @@ void Foam::fieldValues::faceSource::setPatchFaces()
|
||||
|
||||
faceId_.setSize(nFaces);
|
||||
facePatchId_.setSize(nFaces);
|
||||
flipMap_.setSize(nFaces);
|
||||
faceSign_.setSize(nFaces);
|
||||
nFaces_ = returnReduce(faceId_.size(), sumOp<label>());
|
||||
|
||||
forAll(faceId_, faceI)
|
||||
{
|
||||
faceId_[faceI] = faceI;
|
||||
facePatchId_[faceI] = patchId;
|
||||
flipMap_[faceI] = 1;
|
||||
faceSign_[faceI] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,7 +218,7 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
||||
}
|
||||
default:
|
||||
{
|
||||
FatalErrorIn("faceSource::initiliase()")
|
||||
FatalErrorIn("faceSource::initialise()")
|
||||
<< type() << " " << name_ << ": "
|
||||
<< sourceTypeNames_[source_] << "(" << sourceName_ << "):"
|
||||
<< nl << " Unknown source type. Valid source types are:"
|
||||
@ -225,8 +227,10 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
|
||||
}
|
||||
|
||||
Info<< type() << " " << name_ << ":" << nl
|
||||
<< " total faces = " << faceId_.size() << nl
|
||||
<< " total area = " << sum(filterField(mesh().magSf())) << nl;
|
||||
<< " total faces = " << nFaces_
|
||||
<< nl
|
||||
<< " total area = " << gSum(filterField(mesh().magSf(), false))
|
||||
<< nl;
|
||||
|
||||
if (operation_ == opWeightedAverage)
|
||||
{
|
||||
@ -260,7 +264,7 @@ void Foam::fieldValues::faceSource::writeFileHeader()
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< "# Source : " << sourceTypeNames_[source_] << " "
|
||||
<< sourceName_ << nl << "# Faces : " << faceId_.size() << nl
|
||||
<< sourceName_ << nl << "# Faces : " << nFaces_ << nl
|
||||
<< "# Time" << tab << "sum(magSf)";
|
||||
|
||||
forAll(fields_, i)
|
||||
@ -288,9 +292,10 @@ Foam::fieldValues::faceSource::faceSource
|
||||
fieldValue(name, obr, dict, loadFromFiles),
|
||||
source_(sourceTypeNames_.read(dict.lookup("source"))),
|
||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||
nFaces_(0),
|
||||
faceId_(),
|
||||
facePatchId_(),
|
||||
flipMap_(),
|
||||
faceSign_(),
|
||||
weightFieldName_("undefinedWeightedFieldName")
|
||||
{
|
||||
read(dict);
|
||||
@ -326,7 +331,7 @@ void Foam::fieldValues::faceSource::write()
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< obr_.time().value() << tab
|
||||
<< sum(filterField(mesh().magSf()));
|
||||
<< sum(filterField(mesh().magSf(), false));
|
||||
}
|
||||
|
||||
forAll(fields_, i)
|
||||
|
||||
@ -53,6 +53,15 @@ Description
|
||||
- areaAverage
|
||||
- areaIntegrate
|
||||
- weightedAverage
|
||||
- min
|
||||
- max
|
||||
|
||||
Notes:
|
||||
- faces on empty patches get ignored
|
||||
- if the field is a volField the faceZone can only consist of boundary
|
||||
faces.
|
||||
- all fields get oriented according to the faceZone (so you might e.g. see
|
||||
negative pressure)
|
||||
|
||||
SourceFiles
|
||||
faceSource.C
|
||||
@ -64,7 +73,6 @@ SourceFiles
|
||||
|
||||
#include "NamedEnum.H"
|
||||
#include "fieldValue.H"
|
||||
#include "labelList.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
@ -136,14 +144,17 @@ protected:
|
||||
//- Operation to apply to values
|
||||
operationType operation_;
|
||||
|
||||
//- Global number of faces
|
||||
label nFaces_;
|
||||
|
||||
//- Local list of face IDs
|
||||
labelList faceId_;
|
||||
|
||||
//- Local list of patch ID per face
|
||||
labelList facePatchId_;
|
||||
|
||||
//- List of +1/-1 representing face flip map
|
||||
labelList flipMap_;
|
||||
//- List of +1/-1 representing face flip map (1 use as is, -1 negate)
|
||||
labelList faceSign_;
|
||||
|
||||
//- Weight field name - only used for opWeightedAverage mode
|
||||
word weightFieldName_;
|
||||
@ -209,7 +220,7 @@ public:
|
||||
inline const labelList& facePatch() const;
|
||||
|
||||
//- Return the list of +1/-1 representing face flip map
|
||||
inline const labelList& flipMap() const;
|
||||
inline const labelList& faceSign() const;
|
||||
|
||||
|
||||
// Function object functions
|
||||
@ -228,14 +239,16 @@ public:
|
||||
template<class Type>
|
||||
tmp<Field<Type> > filterField
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
|
||||
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 GeometricField<Type, fvPatchField, volMesh>& field,
|
||||
const bool applyOrientation
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
@ -49,9 +49,9 @@ Foam::fieldValues::faceSource::facePatch() const
|
||||
|
||||
|
||||
inline const Foam::labelList&
|
||||
Foam::fieldValues::faceSource::flipMap() const
|
||||
Foam::fieldValues::faceSource::faceSign() const
|
||||
{
|
||||
return flipMap_;
|
||||
return faceSign_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -60,14 +60,14 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::setFieldValues
|
||||
|
||||
if (obr_.foundObject<sf>(fieldName))
|
||||
{
|
||||
return filterField(obr_.lookupObject<sf>(fieldName));
|
||||
return filterField(obr_.lookupObject<sf>(fieldName), true);
|
||||
}
|
||||
else if (obr_.foundObject<vf>(fieldName))
|
||||
{
|
||||
return filterField(obr_.lookupObject<vf>(fieldName));
|
||||
return filterField(obr_.lookupObject<vf>(fieldName), true);
|
||||
}
|
||||
|
||||
return tmp<Field<Type> >(new Field<Type>(0.0));
|
||||
return tmp<Field<Type> >(new Field<Type>(0));
|
||||
}
|
||||
|
||||
|
||||
@ -131,10 +131,13 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
||||
|
||||
if (ok)
|
||||
{
|
||||
// Get (correctly oriented) field
|
||||
Field<Type> values = combineFields(setFieldValues<Type>(fieldName));
|
||||
|
||||
scalarField magSf = combineFields(filterField(mesh().magSf()));
|
||||
// Get unoriented magSf
|
||||
scalarField magSf = combineFields(filterField(mesh().magSf(), false));
|
||||
|
||||
// Get (correctly oriented) weighting field
|
||||
scalarField weightField =
|
||||
combineFields(setFieldValues<scalar>(weightFieldName_));
|
||||
|
||||
@ -177,7 +180,8 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& field
|
||||
const GeometricField<Type, fvPatchField, volMesh>& field,
|
||||
const bool applyOrientation
|
||||
) const
|
||||
{
|
||||
tmp<Field<Type> > tvalues(new Field<Type>(faceId_.size()));
|
||||
@ -205,8 +209,14 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
||||
<< " Unable to process internal faces for volume field "
|
||||
<< field.name() << nl << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
values[i] *= flipMap_[i];
|
||||
if (applyOrientation)
|
||||
{
|
||||
forAll(values, i)
|
||||
{
|
||||
values[i] *= faceSign_[i];
|
||||
}
|
||||
}
|
||||
|
||||
return tvalues;
|
||||
@ -216,7 +226,8 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
||||
(
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field
|
||||
const GeometricField<Type, fvsPatchField, surfaceMesh>& field,
|
||||
const bool applyOrientation
|
||||
) const
|
||||
{
|
||||
tmp<Field<Type> > tvalues(new Field<Type>(faceId_.size()));
|
||||
@ -234,8 +245,14 @@ Foam::tmp<Foam::Field<Type> > Foam::fieldValues::faceSource::filterField
|
||||
{
|
||||
values[i] = field[faceI];
|
||||
}
|
||||
}
|
||||
|
||||
values[i] *= flipMap_[i];
|
||||
if (applyOrientation)
|
||||
{
|
||||
forAll(values, i)
|
||||
{
|
||||
values[i] *= faceSign_[i];
|
||||
}
|
||||
}
|
||||
|
||||
return tvalues;
|
||||
|
||||
@ -32,11 +32,6 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(fieldValue, 0);
|
||||
|
||||
defineTemplateTypeNameAndDebug(IOField<vector>, 0);
|
||||
defineTemplateTypeNameAndDebug(IOField<sphericalTensor>, 0);
|
||||
defineTemplateTypeNameAndDebug(IOField<symmTensor>, 0);
|
||||
defineTemplateTypeNameAndDebug(IOField<tensor>, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -206,12 +206,6 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
//#ifdef NoRepository
|
||||
//# include "streamLineTemplates.C"
|
||||
//#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -24,22 +24,14 @@ License
|
||||
\*----------------------------------------------------------------------------*/
|
||||
|
||||
#include "streamLineParticle.H"
|
||||
#include "vectorIOFieldField.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(streamLineParticle, 0);
|
||||
|
||||
defineParticleTypeNameAndDebug(streamLineParticle, 0);
|
||||
|
||||
defineTemplateTypeNameAndDebugWithName
|
||||
(
|
||||
IOField<vectorField>,
|
||||
"vectorFieldField",
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -402,13 +394,13 @@ void Foam::streamLineParticle::readFields(Cloud<streamLineParticle>& c)
|
||||
);
|
||||
c.checkFieldIOobject(c, lifeTime);
|
||||
|
||||
IOField<pointField> sampledPositions
|
||||
vectorIOFieldField sampledPositions
|
||||
(
|
||||
c.fieldIOobject("sampledPositions", IOobject::MUST_READ)
|
||||
);
|
||||
c.checkFieldIOobject(c, sampledPositions);
|
||||
|
||||
// IOField<pointField> sampleVelocity
|
||||
// vectorIOFieldField sampleVelocity
|
||||
// (
|
||||
// c.fieldIOobject("sampleVelocity", IOobject::MUST_READ)
|
||||
// );
|
||||
@ -436,12 +428,12 @@ void Foam::streamLineParticle::writeFields(const Cloud<streamLineParticle>& c)
|
||||
c.fieldIOobject("lifeTime", IOobject::NO_READ),
|
||||
np
|
||||
);
|
||||
IOField<pointField> sampledPositions
|
||||
vectorIOFieldField sampledPositions
|
||||
(
|
||||
c.fieldIOobject("sampledPositions", IOobject::NO_READ),
|
||||
np
|
||||
);
|
||||
// IOField<pointField> sampleVelocity
|
||||
// vectorIOFieldField sampleVelocity
|
||||
// (
|
||||
// c.fieldIOobject("sampleVelocity", IOobject::NO_READ),
|
||||
// np
|
||||
|
||||
@ -134,11 +134,6 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
//- Run-time type information
|
||||
TypeName("streamLineParticle");
|
||||
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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
|
||||
vectorFieldField with IO.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "vectorIOFieldField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTemplateTypeNameAndDebugWithName
|
||||
(
|
||||
vectorIOFieldField,
|
||||
"vectorFieldField",
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,49 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
|
||||
\\/ 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::vectorIOFieldField
|
||||
|
||||
Description
|
||||
vectorField with IO.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef vectorIOFieldField_H
|
||||
#define vectorIOFieldField_H
|
||||
|
||||
#include "vectorField.H"
|
||||
#include "IOField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
typedef IOField<vectorField> vectorIOFieldField;
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user