mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support operations on surfFields in surfaceFieldValue
- this makes it possible to perform additional operations on surface values that have been previously sampled. - support vectorField for weighting operations. - reduce overhead by avoiding creation of weight fields, Sf fields and combined surface geometries unless they are actually required. - extend some similar concepts and operations to volFieldValue
This commit is contained in:
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -87,7 +87,7 @@ protected:
|
|||||||
);
|
);
|
||||||
|
|
||||||
//- The region or sub-region registry being used
|
//- The region or sub-region registry being used
|
||||||
const objectRegistry& obr() const;
|
virtual const objectRegistry& obr() const;
|
||||||
|
|
||||||
|
|
||||||
//- Find object (eg, a field) in the (sub) objectRegistry
|
//- Find object (eg, a field) in the (sub) objectRegistry
|
||||||
@ -176,7 +176,7 @@ public:
|
|||||||
// Member Functions
|
// Member Functions
|
||||||
|
|
||||||
//- Read optional controls
|
//- Read optional controls
|
||||||
virtual bool read(const dictionary&);
|
virtual bool read(const dictionary& dict) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -31,6 +31,7 @@ License
|
|||||||
#include "mergePoints.H"
|
#include "mergePoints.H"
|
||||||
#include "indirectPrimitivePatch.H"
|
#include "indirectPrimitivePatch.H"
|
||||||
#include "PatchTools.H"
|
#include "PatchTools.H"
|
||||||
|
#include "meshedSurfRef.H"
|
||||||
#include "addToRunTimeSelectionTable.H"
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
@ -52,11 +53,12 @@ template<>
|
|||||||
const char* Foam::NamedEnum
|
const char* Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes,
|
Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes,
|
||||||
3
|
4
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"faceZone",
|
"faceZone",
|
||||||
"patch",
|
"patch",
|
||||||
|
"surface",
|
||||||
"sampledSurface"
|
"sampledSurface"
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -64,12 +66,13 @@ template<>
|
|||||||
const char* Foam::NamedEnum
|
const char* Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
||||||
16
|
17
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"none",
|
"none",
|
||||||
"sum",
|
"sum",
|
||||||
"sumMag",
|
"sumMag",
|
||||||
|
"weightedSum",
|
||||||
"sumDirection",
|
"sumDirection",
|
||||||
"sumDirectionBalance",
|
"sumDirectionBalance",
|
||||||
"average",
|
"average",
|
||||||
@ -100,13 +103,13 @@ const char* Foam::NamedEnum
|
|||||||
const Foam::NamedEnum
|
const Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes,
|
Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes,
|
||||||
3
|
4
|
||||||
> Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypeNames_;
|
> Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypeNames_;
|
||||||
|
|
||||||
const Foam::NamedEnum
|
const Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
|
||||||
16
|
17
|
||||||
> Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_;
|
> Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_;
|
||||||
|
|
||||||
const Foam::NamedEnum
|
const Foam::NamedEnum
|
||||||
@ -119,9 +122,23 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::postOperationTypeNames_;
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
const Foam::objectRegistry&
|
||||||
|
Foam::functionObjects::fieldValues::surfaceFieldValue::obr() const
|
||||||
|
{
|
||||||
|
if (regionType_ == stSurface)
|
||||||
|
{
|
||||||
|
return mesh_.lookupObject<objectRegistry>(regionName_);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return mesh_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
|
void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
|
||||||
{
|
{
|
||||||
label zoneId = mesh_.faceZones().findZoneID(regionName_);
|
const label zoneId = mesh_.faceZones().findZoneID(regionName_);
|
||||||
|
|
||||||
if (zoneId < 0)
|
if (zoneId < 0)
|
||||||
{
|
{
|
||||||
@ -137,11 +154,11 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
|
|||||||
|
|
||||||
DynamicList<label> faceIds(fZone.size());
|
DynamicList<label> faceIds(fZone.size());
|
||||||
DynamicList<label> facePatchIds(fZone.size());
|
DynamicList<label> facePatchIds(fZone.size());
|
||||||
DynamicList<label> faceSigns(fZone.size());
|
DynamicList<bool> faceFlip(fZone.size());
|
||||||
|
|
||||||
forAll(fZone, i)
|
forAll(fZone, i)
|
||||||
{
|
{
|
||||||
label facei = fZone[i];
|
const label facei = fZone[i];
|
||||||
|
|
||||||
label faceId = -1;
|
label faceId = -1;
|
||||||
label facePatchId = -1;
|
label facePatchId = -1;
|
||||||
@ -178,22 +195,15 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setFaceZoneFaces()
|
|||||||
|
|
||||||
if (faceId >= 0)
|
if (faceId >= 0)
|
||||||
{
|
{
|
||||||
if (fZone.flipMap()[i])
|
|
||||||
{
|
|
||||||
faceSigns.append(-1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
faceSigns.append(1);
|
|
||||||
}
|
|
||||||
faceIds.append(faceId);
|
faceIds.append(faceId);
|
||||||
facePatchIds.append(facePatchId);
|
facePatchIds.append(facePatchId);
|
||||||
|
faceFlip.append(fZone.flipMap()[i] ? true : false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
faceId_.transfer(faceIds);
|
faceId_.transfer(faceIds);
|
||||||
facePatchId_.transfer(facePatchIds);
|
facePatchId_.transfer(facePatchIds);
|
||||||
faceSign_.transfer(faceSigns);
|
faceFlip_.transfer(faceFlip);
|
||||||
nFaces_ = returnReduce(faceId_.size(), sumOp<label>());
|
nFaces_ = returnReduce(faceId_.size(), sumOp<label>());
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -229,34 +239,18 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::setPatchFaces()
|
|||||||
|
|
||||||
faceId_.setSize(nFaces);
|
faceId_.setSize(nFaces);
|
||||||
facePatchId_.setSize(nFaces);
|
facePatchId_.setSize(nFaces);
|
||||||
faceSign_.setSize(nFaces);
|
faceFlip_.setSize(nFaces);
|
||||||
nFaces_ = returnReduce(faceId_.size(), sumOp<label>());
|
nFaces_ = returnReduce(faceId_.size(), sumOp<label>());
|
||||||
|
|
||||||
forAll(faceId_, facei)
|
forAll(faceId_, facei)
|
||||||
{
|
{
|
||||||
faceId_[facei] = facei;
|
faceId_[facei] = facei;
|
||||||
facePatchId_[facei] = patchid;
|
facePatchId_[facei] = patchid;
|
||||||
faceSign_[facei] = 1;
|
faceFlip_[facei] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::surfaceFieldValue::sampledSurfaceFaces
|
|
||||||
(
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
{
|
|
||||||
surfacePtr_ = sampledSurface::New
|
|
||||||
(
|
|
||||||
name(),
|
|
||||||
mesh_,
|
|
||||||
dict.subDict("sampledSurfaceDict")
|
|
||||||
);
|
|
||||||
surfacePtr_().update();
|
|
||||||
nFaces_ = returnReduce(surfacePtr_().faces().size(), sumOp<label>());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::surfaceFieldValue::combineMeshGeometry
|
void Foam::functionObjects::fieldValues::surfaceFieldValue::combineMeshGeometry
|
||||||
(
|
(
|
||||||
faceList& faces,
|
faceList& faces,
|
||||||
@ -385,14 +379,44 @@ combineSurfaceGeometry
|
|||||||
pointField& points
|
pointField& points
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
if (surfacePtr_.valid())
|
if (regionType_ == stSurface)
|
||||||
|
{
|
||||||
|
const surfMesh& s = dynamicCast<const surfMesh>(obr());
|
||||||
|
|
||||||
|
if (Pstream::parRun())
|
||||||
|
{
|
||||||
|
// Dimension as fraction of surface
|
||||||
|
const scalar mergeDim = 1e-10*boundBox(s.points(), true).mag();
|
||||||
|
|
||||||
|
labelList pointsMap;
|
||||||
|
|
||||||
|
PatchTools::gatherAndMerge
|
||||||
|
(
|
||||||
|
mergeDim,
|
||||||
|
primitivePatch
|
||||||
|
(
|
||||||
|
SubList<face>(s.faces(), s.faces().size()),
|
||||||
|
s.points()
|
||||||
|
),
|
||||||
|
points,
|
||||||
|
faces,
|
||||||
|
pointsMap
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
faces = s.faces();
|
||||||
|
points = s.points();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (surfacePtr_.valid())
|
||||||
{
|
{
|
||||||
const sampledSurface& s = surfacePtr_();
|
const sampledSurface& s = surfacePtr_();
|
||||||
|
|
||||||
if (Pstream::parRun())
|
if (Pstream::parRun())
|
||||||
{
|
{
|
||||||
// Dimension as fraction of mesh bounding box
|
// Dimension as fraction of mesh bounding box
|
||||||
scalar mergeDim = 1e-10*mesh_.bounds().mag();
|
const scalar mergeDim = 1e-10*mesh_.bounds().mag();
|
||||||
|
|
||||||
labelList pointsMap;
|
labelList pointsMap;
|
||||||
|
|
||||||
@ -423,7 +447,13 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const
|
|||||||
{
|
{
|
||||||
scalar totalArea;
|
scalar totalArea;
|
||||||
|
|
||||||
if (surfacePtr_.valid())
|
if (regionType_ == stSurface)
|
||||||
|
{
|
||||||
|
const surfMesh& s = dynamicCast<const surfMesh>(obr());
|
||||||
|
|
||||||
|
totalArea = gSum(s.magSf());
|
||||||
|
}
|
||||||
|
else if (surfacePtr_.valid())
|
||||||
{
|
{
|
||||||
totalArea = gSum(surfacePtr_().magSf());
|
totalArea = gSum(surfacePtr_().magSf());
|
||||||
}
|
}
|
||||||
@ -438,6 +468,42 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::totalArea() const
|
|||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::functionObjects::fieldValues::surfaceFieldValue::needsSf() const
|
||||||
|
{
|
||||||
|
// Many operations use the Sf field
|
||||||
|
switch (operation_)
|
||||||
|
{
|
||||||
|
case opNone:
|
||||||
|
case opSum:
|
||||||
|
case opSumMag:
|
||||||
|
case opAverage:
|
||||||
|
case opMin:
|
||||||
|
case opMax:
|
||||||
|
return false;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::fieldValues::surfaceFieldValue::needsWeight() const
|
||||||
|
{
|
||||||
|
// Only a few operations use weight field
|
||||||
|
switch (operation_)
|
||||||
|
{
|
||||||
|
case opWeightedSum:
|
||||||
|
case opWeightedAverage:
|
||||||
|
case opWeightedAreaAverage:
|
||||||
|
case opWeightedAreaIntegrate:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
|
void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
@ -450,16 +516,42 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
|
|||||||
case stFaceZone:
|
case stFaceZone:
|
||||||
{
|
{
|
||||||
setFaceZoneFaces();
|
setFaceZoneFaces();
|
||||||
|
surfacePtr_.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case stPatch:
|
case stPatch:
|
||||||
{
|
{
|
||||||
setPatchFaces();
|
setPatchFaces();
|
||||||
|
surfacePtr_.clear();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case stSurface:
|
||||||
|
{
|
||||||
|
const surfMesh& s = dynamicCast<const surfMesh>(obr());
|
||||||
|
nFaces_ = returnReduce(s.size(), sumOp<label>());
|
||||||
|
|
||||||
|
faceId_.clear();
|
||||||
|
facePatchId_.clear();
|
||||||
|
faceFlip_.clear();
|
||||||
|
surfacePtr_.clear();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case stSampledSurface:
|
case stSampledSurface:
|
||||||
{
|
{
|
||||||
sampledSurfaceFaces(dict);
|
faceId_.clear();
|
||||||
|
facePatchId_.clear();
|
||||||
|
faceFlip_.clear();
|
||||||
|
|
||||||
|
surfacePtr_ = sampledSurface::New
|
||||||
|
(
|
||||||
|
name(),
|
||||||
|
mesh_,
|
||||||
|
dict.subDict("sampledSurfaceDict")
|
||||||
|
);
|
||||||
|
surfacePtr_().update();
|
||||||
|
nFaces_ =
|
||||||
|
returnReduce(surfacePtr_().faces().size(), sumOp<label>());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -488,61 +580,93 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::initialise
|
|||||||
totalArea_ = totalArea();
|
totalArea_ = totalArea();
|
||||||
|
|
||||||
Info<< type() << " " << name() << ":" << nl
|
Info<< type() << " " << name() << ":" << nl
|
||||||
<< " total faces = " << nFaces_ << nl
|
<< " operation = ";
|
||||||
<< " total area = " << totalArea_ << nl;
|
|
||||||
|
|
||||||
if (dict.readIfPresent("weightField", weightFieldName_))
|
if (postOperation_ != postOpNone)
|
||||||
{
|
{
|
||||||
Info<< " weight field = " << weightFieldName_ << nl;
|
Info<< postOperationTypeNames_[postOperation_] << '('
|
||||||
|
<< operationTypeNames_[operation_] << ')' << nl;
|
||||||
if (regionType_ == stSampledSurface)
|
|
||||||
{
|
|
||||||
FatalIOErrorInFunction(dict)
|
|
||||||
<< "Cannot use weightField for a sampledSurface"
|
|
||||||
<< exit(FatalIOError);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
if (dict.found("orientedWeightField"))
|
|
||||||
{
|
{
|
||||||
if (weightFieldName_ == "none")
|
Info<< operationTypeNames_[operation_] << nl;
|
||||||
|
}
|
||||||
|
Info<< " total faces = " << nFaces_ << nl
|
||||||
|
<< " total area = " << totalArea_ << nl;
|
||||||
|
|
||||||
|
|
||||||
|
weightFieldName_ = "none";
|
||||||
|
orientWeightField_ = false;
|
||||||
|
if (needsWeight())
|
||||||
|
{
|
||||||
|
if (dict.readIfPresent("weightField", weightFieldName_))
|
||||||
{
|
{
|
||||||
dict.lookup("orientedWeightField") >> weightFieldName_;
|
if (regionType_ == stSampledSurface)
|
||||||
Info<< " weight field = " << weightFieldName_ << nl;
|
{
|
||||||
orientWeightField_ = true;
|
FatalIOErrorInFunction(dict)
|
||||||
|
<< "Cannot use weightField for sampledSurface"
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
Info<< " weight field = " << weightFieldName_ << nl;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (dict.found("orientedWeightField"))
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction(dict)
|
if (regionType_ == stSurface || regionType_ == stSampledSurface)
|
||||||
<< "Either weightField or orientedWeightField can be supplied, "
|
{
|
||||||
<< "but not both"
|
FatalIOErrorInFunction(dict)
|
||||||
<< exit(FatalIOError);
|
<< "Cannot use orientedWeightField "
|
||||||
|
<< "for surface/sampledSurface"
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (weightFieldName_ == "none")
|
||||||
|
{
|
||||||
|
dict.lookup("orientedWeightField") >> weightFieldName_;
|
||||||
|
orientWeightField_ = true;
|
||||||
|
|
||||||
|
Info<< " weight field = " << weightFieldName_ << nl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalIOErrorInFunction(dict)
|
||||||
|
<< "Cannot specify both weightField and orientedWeightField"
|
||||||
|
<< exit(FatalIOError);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<word> orientedFields;
|
List<word> orientedFields;
|
||||||
|
orientedFieldsStart_ = labelMax;
|
||||||
if (dict.readIfPresent("orientedFields", orientedFields))
|
if (dict.readIfPresent("orientedFields", orientedFields))
|
||||||
{
|
{
|
||||||
orientedFieldsStart_ = fields_.size();
|
orientedFieldsStart_ = fields_.size();
|
||||||
fields_.append(orientedFields);
|
fields_.append(orientedFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl << endl;
|
surfaceWriterPtr_.clear();
|
||||||
|
|
||||||
if (writeFields_)
|
if (writeFields_)
|
||||||
{
|
{
|
||||||
const word surfaceFormat(dict.lookup("surfaceFormat"));
|
const word surfaceFormat(dict.lookup("surfaceFormat"));
|
||||||
|
|
||||||
surfaceWriterPtr_.reset
|
if (surfaceFormat != "none")
|
||||||
(
|
{
|
||||||
surfaceWriter::New
|
surfaceWriterPtr_.reset
|
||||||
(
|
(
|
||||||
surfaceFormat,
|
surfaceWriter::New
|
||||||
dict.subOrEmptyDict("formatOptions").
|
(
|
||||||
subOrEmptyDict(surfaceFormat)
|
surfaceFormat,
|
||||||
).ptr()
|
dict.subOrEmptyDict("formatOptions").
|
||||||
);
|
subOrEmptyDict(surfaceFormat)
|
||||||
|
).ptr()
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< " surfaceFormat = " << surfaceFormat << nl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Info<< nl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -583,8 +707,8 @@ void Foam::functionObjects::fieldValues::surfaceFieldValue::writeFileHeader
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
Foam::scalar Foam::functionObjects::fieldValues::surfaceFieldValue::
|
Foam::scalar
|
||||||
processValues
|
Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
|
||||||
(
|
(
|
||||||
const Field<scalar>& values,
|
const Field<scalar>& values,
|
||||||
const vectorField& Sf,
|
const vectorField& Sf,
|
||||||
@ -615,8 +739,8 @@ processValues
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
Foam::vector Foam::functionObjects::fieldValues::surfaceFieldValue::
|
Foam::vector
|
||||||
processValues
|
Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
|
||||||
(
|
(
|
||||||
const Field<vector>& values,
|
const Field<vector>& values,
|
||||||
const vectorField& Sf,
|
const vectorField& Sf,
|
||||||
@ -629,27 +753,27 @@ processValues
|
|||||||
{
|
{
|
||||||
vector n(dict_.lookup("direction"));
|
vector n(dict_.lookup("direction"));
|
||||||
n /= mag(n) + ROOTVSMALL;
|
n /= mag(n) + ROOTVSMALL;
|
||||||
const scalarField nv(n & values);
|
|
||||||
|
|
||||||
|
const scalarField nv(n & values);
|
||||||
return gSum(pos(nv)*n*(nv));
|
return gSum(pos(nv)*n*(nv));
|
||||||
}
|
}
|
||||||
case opSumDirectionBalance:
|
case opSumDirectionBalance:
|
||||||
{
|
{
|
||||||
vector n(dict_.lookup("direction"));
|
vector n(dict_.lookup("direction"));
|
||||||
n /= mag(n) + ROOTVSMALL;
|
n /= mag(n) + ROOTVSMALL;
|
||||||
const scalarField nv(n & values);
|
|
||||||
|
|
||||||
|
const scalarField nv(n & values);
|
||||||
return gSum(pos(nv)*n*(nv));
|
return gSum(pos(nv)*n*(nv));
|
||||||
}
|
}
|
||||||
case opAreaNormalAverage:
|
case opAreaNormalAverage:
|
||||||
{
|
{
|
||||||
scalar result = gSum(values & Sf)/gSum(mag(Sf));
|
const scalar val = gSum(values & Sf)/gSum(mag(Sf));
|
||||||
return vector(result, 0.0, 0.0);
|
return vector(val, 0, 0);
|
||||||
}
|
}
|
||||||
case opAreaNormalIntegrate:
|
case opAreaNormalIntegrate:
|
||||||
{
|
{
|
||||||
scalar result = gSum(values & Sf);
|
const scalar val = gSum(values & Sf);
|
||||||
return vector(result, 0.0, 0.0);
|
return vector(val, 0, 0);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -660,6 +784,58 @@ processValues
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
Foam::tmp<Foam::scalarField>
|
||||||
|
Foam::functionObjects::fieldValues::surfaceFieldValue::weightingFactor
|
||||||
|
(
|
||||||
|
const Field<scalar>& weightField
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// pass through
|
||||||
|
return weightField;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
Foam::tmp<Foam::scalarField>
|
||||||
|
Foam::functionObjects::fieldValues::surfaceFieldValue::weightingFactor
|
||||||
|
(
|
||||||
|
const Field<scalar>& weightField,
|
||||||
|
const vectorField& Sf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// scalar * Area
|
||||||
|
if (returnReduce(weightField.empty(), andOp<bool>()))
|
||||||
|
{
|
||||||
|
return mag(Sf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return weightField * mag(Sf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<>
|
||||||
|
Foam::tmp<Foam::scalarField>
|
||||||
|
Foam::functionObjects::fieldValues::surfaceFieldValue::weightingFactor
|
||||||
|
(
|
||||||
|
const Field<vector>& weightField,
|
||||||
|
const vectorField& Sf
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// vector (dot) Area
|
||||||
|
if (returnReduce(weightField.empty(), andOp<bool>()))
|
||||||
|
{
|
||||||
|
return mag(Sf);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return weightField & Sf;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
|
Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
|
||||||
@ -670,7 +846,6 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fieldValue(name, runTime, dict, typeName),
|
fieldValue(name, runTime, dict, typeName),
|
||||||
surfaceWriterPtr_(nullptr),
|
|
||||||
regionType_(regionTypeNames_.read(dict.lookup("regionType"))),
|
regionType_(regionTypeNames_.read(dict.lookup("regionType"))),
|
||||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||||
postOperation_
|
postOperation_
|
||||||
@ -685,7 +860,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
|
|||||||
nFaces_(0),
|
nFaces_(0),
|
||||||
faceId_(),
|
faceId_(),
|
||||||
facePatchId_(),
|
facePatchId_(),
|
||||||
faceSign_()
|
faceFlip_()
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
writeFileHeader(file());
|
writeFileHeader(file());
|
||||||
@ -700,7 +875,6 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fieldValue(name, obr, dict, typeName),
|
fieldValue(name, obr, dict, typeName),
|
||||||
surfaceWriterPtr_(nullptr),
|
|
||||||
regionType_(regionTypeNames_.read(dict.lookup("regionType"))),
|
regionType_(regionTypeNames_.read(dict.lookup("regionType"))),
|
||||||
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
operation_(operationTypeNames_.read(dict.lookup("operation"))),
|
||||||
postOperation_
|
postOperation_
|
||||||
@ -715,7 +889,7 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::surfaceFieldValue
|
|||||||
nFaces_(0),
|
nFaces_(0),
|
||||||
faceId_(),
|
faceId_(),
|
||||||
facePatchId_(),
|
facePatchId_(),
|
||||||
faceSign_()
|
faceFlip_()
|
||||||
{
|
{
|
||||||
read(dict);
|
read(dict);
|
||||||
writeFileHeader(file());
|
writeFileHeader(file());
|
||||||
@ -744,66 +918,111 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::read
|
|||||||
|
|
||||||
bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
|
bool Foam::functionObjects::fieldValues::surfaceFieldValue::write()
|
||||||
{
|
{
|
||||||
if (operation_ != opNone)
|
|
||||||
{
|
|
||||||
fieldValue::write();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (surfacePtr_.valid())
|
if (surfacePtr_.valid())
|
||||||
{
|
{
|
||||||
surfacePtr_().update();
|
surfacePtr_().update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation_ != opNone && Pstream::master())
|
if (operation_ != opNone)
|
||||||
{
|
{
|
||||||
writeTime(file());
|
fieldValue::write();
|
||||||
|
|
||||||
|
if (Pstream::master())
|
||||||
|
{
|
||||||
|
writeTime(file());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (writeArea_)
|
if (writeArea_)
|
||||||
{
|
{
|
||||||
totalArea_ = totalArea();
|
totalArea_ = totalArea();
|
||||||
|
Log << " total area = " << totalArea_ << endl;
|
||||||
|
|
||||||
if (operation_ != opNone && Pstream::master())
|
if (operation_ != opNone && Pstream::master())
|
||||||
{
|
{
|
||||||
file() << tab << totalArea_;
|
file() << tab << totalArea_;
|
||||||
}
|
}
|
||||||
Log << " total area = " << totalArea_ << endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct weight field. Note: zero size means weight = 1
|
// Many operations use the Sf field
|
||||||
scalarField weightField;
|
vectorField Sf;
|
||||||
|
if (needsSf())
|
||||||
|
{
|
||||||
|
if (regionType_ == stSurface)
|
||||||
|
{
|
||||||
|
const surfMesh& s = dynamicCast<const surfMesh>(obr());
|
||||||
|
Sf = s.Sf();
|
||||||
|
}
|
||||||
|
else if (surfacePtr_.valid())
|
||||||
|
{
|
||||||
|
Sf = surfacePtr_().Sf();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Sf = filterField(mesh_.Sf(), true); // Oriented Sf
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Faces and points for surface format (if specified)
|
||||||
|
faceList faces;
|
||||||
|
pointField points;
|
||||||
|
|
||||||
|
if (surfaceWriterPtr_.valid())
|
||||||
|
{
|
||||||
|
if (regionType_ == stSurface || surfacePtr_.valid())
|
||||||
|
{
|
||||||
|
combineSurfaceGeometry(faces, points);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
combineMeshGeometry(faces, points);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
meshedSurfRef surfToWrite(points, faces);
|
||||||
|
|
||||||
|
// Only a few weight types (scalar, vector)
|
||||||
if (weightFieldName_ != "none")
|
if (weightFieldName_ != "none")
|
||||||
{
|
{
|
||||||
weightField =
|
if (validField<scalar>(weightFieldName_))
|
||||||
getFieldValues<scalar>
|
{
|
||||||
|
scalarField weightField = getFieldValues<scalar>
|
||||||
(
|
(
|
||||||
weightFieldName_,
|
weightFieldName_,
|
||||||
true,
|
true,
|
||||||
orientWeightField_
|
orientWeightField_
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
|
// Process the fields
|
||||||
// Process the fields
|
writeAll(Sf, weightField, surfToWrite);
|
||||||
forAll(fields_, i)
|
|
||||||
{
|
|
||||||
const word& fieldName = fields_[i];
|
|
||||||
bool ok = false;
|
|
||||||
|
|
||||||
bool orient = i >= orientedFieldsStart_;
|
|
||||||
ok = ok || writeValues<scalar>(fieldName, weightField, orient);
|
|
||||||
ok = ok || writeValues<vector>(fieldName, weightField, orient);
|
|
||||||
ok = ok
|
|
||||||
|| writeValues<sphericalTensor>(fieldName, weightField, orient);
|
|
||||||
ok = ok || writeValues<symmTensor>(fieldName, weightField, orient);
|
|
||||||
ok = ok || writeValues<tensor>(fieldName, weightField, orient);
|
|
||||||
|
|
||||||
if (!ok)
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Requested field " << fieldName
|
|
||||||
<< " not found in database and not processed"
|
|
||||||
<< endl;
|
|
||||||
}
|
}
|
||||||
|
else if (validField<vector>(weightFieldName_))
|
||||||
|
{
|
||||||
|
vectorField weightField = getFieldValues<vector>
|
||||||
|
(
|
||||||
|
weightFieldName_,
|
||||||
|
true,
|
||||||
|
orientWeightField_
|
||||||
|
);
|
||||||
|
|
||||||
|
// Process the fields
|
||||||
|
writeAll(Sf, weightField, surfToWrite);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorInFunction
|
||||||
|
<< "weightField " << weightFieldName_
|
||||||
|
<< " not found or an unsupported type"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Default is a zero-size scalar weight field (ie, weight = 1)
|
||||||
|
scalarField weightField;
|
||||||
|
|
||||||
|
// Process the fields
|
||||||
|
writeAll(Sf, weightField, surfToWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (operation_ != opNone && Pstream::master())
|
if (operation_ != opNone && Pstream::master())
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -98,6 +98,7 @@ Usage
|
|||||||
\plaintable
|
\plaintable
|
||||||
faceZone | requires a 'name' entry to specify the faceZone
|
faceZone | requires a 'name' entry to specify the faceZone
|
||||||
patch | requires a 'name' entry to specify the patch
|
patch | requires a 'name' entry to specify the patch
|
||||||
|
surface | requires a 'name' entry to specify the surfMesh
|
||||||
sampledSurface | requires a 'sampledSurfaceDict' sub-dictionary
|
sampledSurface | requires a 'sampledSurfaceDict' sub-dictionary
|
||||||
\endplaintable
|
\endplaintable
|
||||||
|
|
||||||
@ -105,6 +106,7 @@ Usage
|
|||||||
\plaintable
|
\plaintable
|
||||||
none | no operation
|
none | no operation
|
||||||
sum | sum
|
sum | sum
|
||||||
|
weightedSum | weighted sum
|
||||||
sumMag | sum of component magnitudes
|
sumMag | sum of component magnitudes
|
||||||
sumDirection | sum values which are positive in given direction
|
sumDirection | sum values which are positive in given direction
|
||||||
sumDirectionBalance | sum of balance of values in given direction
|
sumDirectionBalance | sum of balance of values in given direction
|
||||||
@ -130,6 +132,9 @@ Note
|
|||||||
faces
|
faces
|
||||||
- the `oriented' entries relate to mesh-oriented fields, such as the
|
- the `oriented' entries relate to mesh-oriented fields, such as the
|
||||||
flux, phi. These fields will be oriented according to the face normals.
|
flux, phi. These fields will be oriented according to the face normals.
|
||||||
|
- Using \c surface:
|
||||||
|
- The keyword %subRegion should not be used to select surfaces.
|
||||||
|
Specify instead the regionType 'surface' and provide the surface name.
|
||||||
- using \c sampledSurface:
|
- using \c sampledSurface:
|
||||||
- not available for surface fields
|
- not available for surface fields
|
||||||
- if interpolate=true they use \c interpolationCellPoint
|
- if interpolate=true they use \c interpolationCellPoint
|
||||||
@ -155,7 +160,7 @@ SourceFiles
|
|||||||
|
|
||||||
#include "fieldValue.H"
|
#include "fieldValue.H"
|
||||||
#include "NamedEnum.H"
|
#include "NamedEnum.H"
|
||||||
#include "faceList.H"
|
#include "meshedSurf.H"
|
||||||
#include "surfaceMesh.H"
|
#include "surfaceMesh.H"
|
||||||
#include "fvsPatchField.H"
|
#include "fvsPatchField.H"
|
||||||
#include "volFieldsFwd.H"
|
#include "volFieldsFwd.H"
|
||||||
@ -182,21 +187,21 @@ class surfaceFieldValue
|
|||||||
:
|
:
|
||||||
public fieldValue
|
public fieldValue
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Public data types
|
// Public data types
|
||||||
|
|
||||||
//- region type enumeration
|
//- Region type enumeration
|
||||||
enum regionTypes
|
enum regionTypes
|
||||||
{
|
{
|
||||||
stFaceZone,
|
stFaceZone,
|
||||||
stPatch,
|
stPatch,
|
||||||
|
stSurface,
|
||||||
stSampledSurface
|
stSampledSurface
|
||||||
};
|
};
|
||||||
|
|
||||||
//- region type names
|
//- Region type names
|
||||||
static const NamedEnum<regionTypes, 3> regionTypeNames_;
|
static const NamedEnum<regionTypes, 4> regionTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
//- Operation type enumeration
|
//- Operation type enumeration
|
||||||
@ -204,6 +209,7 @@ public:
|
|||||||
{
|
{
|
||||||
opNone, //!< None
|
opNone, //!< None
|
||||||
opSum, //!< Sum
|
opSum, //!< Sum
|
||||||
|
opWeightedSum, //!< Weighted sum
|
||||||
opSumMag, //!< Magnitude of sum
|
opSumMag, //!< Magnitude of sum
|
||||||
opSumDirection, //!< Sum in a given direction
|
opSumDirection, //!< Sum in a given direction
|
||||||
opSumDirectionBalance, //!< Sum in a given direction for multiple
|
opSumDirectionBalance, //!< Sum in a given direction for multiple
|
||||||
@ -221,7 +227,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
static const NamedEnum<operationType, 16> operationTypeNames_;
|
static const NamedEnum<operationType, 17> operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
//- Post-operation type enumeration
|
//- Post-operation type enumeration
|
||||||
@ -245,9 +251,6 @@ private:
|
|||||||
//- Set faces to evaluate based on a patch
|
//- Set faces to evaluate based on a patch
|
||||||
void setPatchFaces();
|
void setPatchFaces();
|
||||||
|
|
||||||
//- Set faces according to sampledSurface
|
|
||||||
void sampledSurfaceFaces(const dictionary&);
|
|
||||||
|
|
||||||
//- Combine mesh faces and points from multiple processors
|
//- Combine mesh faces and points from multiple processors
|
||||||
void combineMeshGeometry
|
void combineMeshGeometry
|
||||||
(
|
(
|
||||||
@ -270,10 +273,7 @@ protected:
|
|||||||
|
|
||||||
// Protected data
|
// Protected data
|
||||||
|
|
||||||
//- Surface writer
|
//- Region type
|
||||||
autoPtr<surfaceWriter> surfaceWriterPtr_;
|
|
||||||
|
|
||||||
//- region type
|
|
||||||
regionTypes regionType_;
|
regionTypes regionType_;
|
||||||
|
|
||||||
//- Operation to apply to values
|
//- Operation to apply to values
|
||||||
@ -309,23 +309,42 @@ protected:
|
|||||||
//- Local list of patch ID per face
|
//- Local list of patch ID per face
|
||||||
labelList facePatchId_;
|
labelList facePatchId_;
|
||||||
|
|
||||||
//- List of +1/-1 representing face flip map
|
//- List representing the face flip map
|
||||||
// (1 use as is, -1 negate)
|
// (false: use as-is, true: negate)
|
||||||
labelList faceSign_;
|
boolList faceFlip_;
|
||||||
|
|
||||||
|
|
||||||
// If operating on sampledSurface
|
//- Underlying sampledSurface (if operating on sampledSurface)
|
||||||
|
autoPtr<sampledSurface> surfacePtr_;
|
||||||
|
|
||||||
//- Underlying sampledSurface
|
//- Surface writer
|
||||||
autoPtr<sampledSurface> surfacePtr_;
|
autoPtr<surfaceWriter> surfaceWriterPtr_;
|
||||||
|
|
||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- The volume mesh or surface registry being used
|
||||||
|
const objectRegistry& obr() const override;
|
||||||
|
|
||||||
|
//- Return the local list of face IDs
|
||||||
|
inline const labelList& faceId() const;
|
||||||
|
|
||||||
|
//- Return the local list of patch ID per face
|
||||||
|
inline const labelList& facePatch() const;
|
||||||
|
|
||||||
|
//- Return the local true/false list representing the face flip map
|
||||||
|
inline const boolList& faceFlip() const;
|
||||||
|
|
||||||
|
//- True if the specified operation needs a surface Sf
|
||||||
|
bool needsSf() const;
|
||||||
|
|
||||||
|
//- True if the specified operation needs a weight-field
|
||||||
|
bool needsWeight() const;
|
||||||
|
|
||||||
//- Initialise, e.g. face addressing
|
//- Initialise, e.g. face addressing
|
||||||
void initialise(const dictionary& dict);
|
void initialise(const dictionary& dict);
|
||||||
|
|
||||||
//- Return true if the field name is valid
|
//- Return true if the field name is known and a valid type
|
||||||
template<class Type>
|
template<class Type>
|
||||||
bool validField(const word& fieldName) const;
|
bool validField(const word& fieldName) const;
|
||||||
|
|
||||||
@ -338,26 +357,78 @@ protected:
|
|||||||
const bool applyOrientation = false
|
const bool applyOrientation = false
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Apply the 'operation' to the values. Operation has to
|
//- Apply the 'operation' to the values. Operation must preserve Type.
|
||||||
// preserve Type.
|
template<class Type, class WeightType>
|
||||||
template<class Type>
|
|
||||||
Type processSameTypeValues
|
Type processSameTypeValues
|
||||||
(
|
(
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
const vectorField& Sf,
|
const vectorField& Sf,
|
||||||
const scalarField& weightField
|
const Field<WeightType>& weightField
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Apply the 'operation' to the values. Wrapper around
|
//- Apply the 'operation' to the values. Wrapper around
|
||||||
// processSameTypeValues. See also template specialisation below.
|
// processSameTypeValues. See also template specialisation below.
|
||||||
template<class Type>
|
template<class Type, class WeightType>
|
||||||
Type processValues
|
Type processValues
|
||||||
(
|
(
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
const vectorField& Sf,
|
const vectorField& Sf,
|
||||||
const scalarField& weightField
|
const Field<WeightType>& weightField
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Filter a surface field according to faceIds
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type>> filterField
|
||||||
|
(
|
||||||
|
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 bool applyOrientation
|
||||||
|
) const;
|
||||||
|
|
||||||
|
//- Weighting factor
|
||||||
|
template<class WeightType>
|
||||||
|
static tmp<scalarField> weightingFactor
|
||||||
|
(
|
||||||
|
const Field<WeightType>& weightField
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Weighting factor, weight field with the area
|
||||||
|
template<class WeightType>
|
||||||
|
static tmp<scalarField> weightingFactor
|
||||||
|
(
|
||||||
|
const Field<WeightType>& weightField,
|
||||||
|
const vectorField& Sf
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Templated helper function to output field values
|
||||||
|
template<class WeightType>
|
||||||
|
label writeAll
|
||||||
|
(
|
||||||
|
const vectorField& Sf,
|
||||||
|
const Field<WeightType>& weightField,
|
||||||
|
const meshedSurf& surfToWrite
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Templated helper function to output field values
|
||||||
|
template<class Type, class WeightType>
|
||||||
|
bool writeValues
|
||||||
|
(
|
||||||
|
const word& fieldName,
|
||||||
|
const vectorField& Sf,
|
||||||
|
const Field<WeightType>& weightField,
|
||||||
|
const bool orient,
|
||||||
|
const meshedSurf& surfToWrite
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
//- Output file header information
|
//- Output file header information
|
||||||
virtual void writeFileHeader(Ostream& os) const;
|
virtual void writeFileHeader(Ostream& os) const;
|
||||||
|
|
||||||
@ -396,52 +467,18 @@ public:
|
|||||||
//- Return the region type
|
//- Return the region type
|
||||||
inline const regionTypes& regionType() const;
|
inline const regionTypes& regionType() const;
|
||||||
|
|
||||||
//- Return the local list of face IDs
|
|
||||||
inline const labelList& faceId() const;
|
|
||||||
|
|
||||||
//- Return the local list of patch ID per face
|
|
||||||
inline const labelList& facePatch() const;
|
|
||||||
|
|
||||||
//- Return the list of +1/-1 representing face flip map
|
|
||||||
inline const labelList& faceSign() const;
|
|
||||||
|
|
||||||
//- Return the output directory
|
//- Return the output directory
|
||||||
inline fileName outputDir() const;
|
inline fileName outputDir() const;
|
||||||
|
|
||||||
//- Templated helper function to output field values
|
|
||||||
template<class Type, class WeightType>
|
|
||||||
bool writeValues
|
|
||||||
(
|
|
||||||
const word& fieldName,
|
|
||||||
const Field<WeightType>& weightField,
|
|
||||||
const bool orient
|
|
||||||
);
|
|
||||||
|
|
||||||
//- Filter a surface field according to faceIds
|
|
||||||
template<class Type>
|
|
||||||
tmp<Field<Type>> filterField
|
|
||||||
(
|
|
||||||
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 bool applyOrientation
|
|
||||||
) const;
|
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary&);
|
virtual bool read(const dictionary& dict) override;
|
||||||
|
|
||||||
//- Calculate and write
|
//- Calculate and write
|
||||||
virtual bool write();
|
virtual bool write() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//- Specialisation for scalar
|
//- Specialisation for scalar fields
|
||||||
template<>
|
template<>
|
||||||
scalar surfaceFieldValue::processValues
|
scalar surfaceFieldValue::processValues
|
||||||
(
|
(
|
||||||
@ -451,7 +488,7 @@ scalar surfaceFieldValue::processValues
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
//- Specialisation for vector
|
//- Specialisation for vector fields
|
||||||
template<>
|
template<>
|
||||||
vector surfaceFieldValue::processValues
|
vector surfaceFieldValue::processValues
|
||||||
(
|
(
|
||||||
@ -461,6 +498,32 @@ vector surfaceFieldValue::processValues
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
|
||||||
|
//- Specialisation for scalar - pass through
|
||||||
|
template<>
|
||||||
|
tmp<scalarField> surfaceFieldValue::weightingFactor
|
||||||
|
(
|
||||||
|
const Field<scalar>& weightField
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Specialisation for scalar - scalar * Area
|
||||||
|
template<>
|
||||||
|
tmp<scalarField> surfaceFieldValue::weightingFactor
|
||||||
|
(
|
||||||
|
const Field<scalar>& weightField,
|
||||||
|
const vectorField& Sf
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
//- Specialisation for vector - vector (dot) Area
|
||||||
|
template<>
|
||||||
|
tmp<scalarField> surfaceFieldValue::weightingFactor
|
||||||
|
(
|
||||||
|
const Field<vector>& weightField,
|
||||||
|
const vectorField& Sf
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace fieldValues
|
} // End namespace fieldValues
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -26,14 +26,7 @@ License
|
|||||||
#include "surfaceFieldValue.H"
|
#include "surfaceFieldValue.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
inline const Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes&
|
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::regionType() const
|
|
||||||
{
|
|
||||||
return regionType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::labelList&
|
inline const Foam::labelList&
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::faceId() const
|
Foam::functionObjects::fieldValues::surfaceFieldValue::faceId() const
|
||||||
@ -49,10 +42,19 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::facePatch() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::labelList&
|
inline const Foam::boolList&
|
||||||
Foam::functionObjects::fieldValues::surfaceFieldValue::faceSign() const
|
Foam::functionObjects::fieldValues::surfaceFieldValue::faceFlip() const
|
||||||
{
|
{
|
||||||
return faceSign_;
|
return faceFlip_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline const Foam::functionObjects::fieldValues::surfaceFieldValue::regionTypes&
|
||||||
|
Foam::functionObjects::fieldValues::surfaceFieldValue::regionType() const
|
||||||
|
{
|
||||||
|
return regionType_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -25,6 +25,7 @@ License
|
|||||||
|
|
||||||
#include "surfaceFieldValue.H"
|
#include "surfaceFieldValue.H"
|
||||||
#include "surfaceFields.H"
|
#include "surfaceFields.H"
|
||||||
|
#include "surfFields.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "sampledSurface.H"
|
#include "sampledSurface.H"
|
||||||
#include "surfaceWriter.H"
|
#include "surfaceWriter.H"
|
||||||
@ -40,17 +41,14 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::validField
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||||
|
typedef DimensionedField<Type, surfGeoMesh> smt;
|
||||||
|
|
||||||
if (regionType_ != stSampledSurface && obr_.foundObject<sf>(fieldName))
|
return
|
||||||
{
|
(
|
||||||
return true;
|
foundObject<smt>(fieldName)
|
||||||
}
|
|| foundObject<vf>(fieldName)
|
||||||
else if (obr_.foundObject<vf>(fieldName))
|
|| (regionType_ != stSampledSurface && foundObject<sf>(fieldName))
|
||||||
{
|
);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -65,14 +63,19 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
|
|||||||
{
|
{
|
||||||
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
typedef GeometricField<Type, fvsPatchField, surfaceMesh> sf;
|
||||||
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
typedef GeometricField<Type, fvPatchField, volMesh> vf;
|
||||||
|
typedef DimensionedField<Type, surfGeoMesh> smt;
|
||||||
|
|
||||||
if (regionType_ != stSampledSurface && obr_.foundObject<sf>(fieldName))
|
if (foundObject<smt>(fieldName))
|
||||||
{
|
{
|
||||||
return filterField(obr_.lookupObject<sf>(fieldName), applyOrientation);
|
return lookupObject<smt>(fieldName);
|
||||||
}
|
}
|
||||||
else if (obr_.foundObject<vf>(fieldName))
|
else if (regionType_ != stSampledSurface && foundObject<sf>(fieldName))
|
||||||
{
|
{
|
||||||
const vf& fld = obr_.lookupObject<vf>(fieldName);
|
return filterField(lookupObject<sf>(fieldName), applyOrientation);
|
||||||
|
}
|
||||||
|
else if (foundObject<vf>(fieldName))
|
||||||
|
{
|
||||||
|
const vf& fld = lookupObject<vf>(fieldName);
|
||||||
|
|
||||||
if (surfacePtr_.valid())
|
if (surfacePtr_.valid())
|
||||||
{
|
{
|
||||||
@ -124,39 +127,45 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::getFieldValues
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class WeightType>
|
||||||
Type Foam::functionObjects::fieldValues::surfaceFieldValue::
|
Type Foam::functionObjects::fieldValues::surfaceFieldValue::
|
||||||
processSameTypeValues
|
processSameTypeValues
|
||||||
(
|
(
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
const vectorField& Sf,
|
const vectorField& Sf,
|
||||||
const scalarField& weightField
|
const Field<WeightType>& weightField
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
Type result = Zero;
|
Type result = Zero;
|
||||||
switch (operation_)
|
switch (operation_)
|
||||||
{
|
{
|
||||||
|
case opNone:
|
||||||
|
break;
|
||||||
case opSum:
|
case opSum:
|
||||||
{
|
{
|
||||||
result = gSum(values);
|
result = gSum(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case opWeightedSum:
|
||||||
|
{
|
||||||
|
if (returnReduce(weightField.empty(), andOp<bool>()))
|
||||||
|
{
|
||||||
|
result = gSum(values);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tmp<scalarField> weight = weightingFactor(weightField);
|
||||||
|
|
||||||
|
result = gSum(weight*values);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case opSumMag:
|
case opSumMag:
|
||||||
{
|
{
|
||||||
result = gSum(cmptMag(values));
|
result = gSum(cmptMag(values));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opSumDirection:
|
case opSumDirection:
|
||||||
{
|
|
||||||
FatalErrorInFunction
|
|
||||||
<< "Operation " << operationTypeNames_[operation_]
|
|
||||||
<< " not available for values of type "
|
|
||||||
<< pTraits<Type>::typeName
|
|
||||||
<< exit(FatalError);
|
|
||||||
|
|
||||||
result = Zero;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case opSumDirectionBalance:
|
case opSumDirectionBalance:
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalErrorInFunction
|
||||||
@ -165,27 +174,26 @@ processSameTypeValues
|
|||||||
<< pTraits<Type>::typeName
|
<< pTraits<Type>::typeName
|
||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
|
|
||||||
result = Zero;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opAverage:
|
case opAverage:
|
||||||
{
|
{
|
||||||
label n = returnReduce(values.size(), sumOp<label>());
|
const label n = returnReduce(values.size(), sumOp<label>());
|
||||||
result = gSum(values)/(scalar(n) + ROOTVSMALL);
|
result = gSum(values)/(scalar(n) + ROOTVSMALL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedAverage:
|
case opWeightedAverage:
|
||||||
{
|
{
|
||||||
if (returnReduce(weightField.size(), sumOp<label>()))
|
if (returnReduce(weightField.empty(), andOp<bool>()))
|
||||||
{
|
{
|
||||||
// has weights
|
const label n = returnReduce(values.size(), sumOp<label>());
|
||||||
result =
|
result = gSum(values)/(scalar(n) + ROOTVSMALL);
|
||||||
gSum(weightField*values)/(gSum(weightField) + ROOTVSMALL);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
label n = returnReduce(values.size(), sumOp<label>());
|
const scalarField factor = weightingFactor(weightField);
|
||||||
result = gSum(values)/(scalar(n) + ROOTVSMALL);
|
|
||||||
|
result = gSum(factor*values)/(gSum(factor) + ROOTVSMALL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -198,14 +206,9 @@ processSameTypeValues
|
|||||||
}
|
}
|
||||||
case opWeightedAreaAverage:
|
case opWeightedAreaAverage:
|
||||||
{
|
{
|
||||||
const scalarField factor
|
const scalarField factor = weightingFactor(weightField, Sf);
|
||||||
(
|
|
||||||
returnReduce(weightField.size(), sumOp<label>()) // has weights
|
|
||||||
? weightField*mag(Sf)
|
|
||||||
: mag(Sf)
|
|
||||||
);
|
|
||||||
|
|
||||||
result = gSum(factor*values)/gSum(factor);
|
result = gSum(factor*values)/gSum(factor + ROOTVSMALL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opAreaIntegrate:
|
case opAreaIntegrate:
|
||||||
@ -217,12 +220,7 @@ processSameTypeValues
|
|||||||
}
|
}
|
||||||
case opWeightedAreaIntegrate:
|
case opWeightedAreaIntegrate:
|
||||||
{
|
{
|
||||||
const scalarField factor
|
const scalarField factor = weightingFactor(weightField, Sf);
|
||||||
(
|
|
||||||
returnReduce(weightField.size(), sumOp<label>()) // has weights
|
|
||||||
? weightField*mag(Sf)
|
|
||||||
: mag(Sf)
|
|
||||||
);
|
|
||||||
|
|
||||||
result = gSum(factor*values);
|
result = gSum(factor*values);
|
||||||
break;
|
break;
|
||||||
@ -240,16 +238,13 @@ processSameTypeValues
|
|||||||
case opCoV:
|
case opCoV:
|
||||||
{
|
{
|
||||||
const scalarField magSf(mag(Sf));
|
const scalarField magSf(mag(Sf));
|
||||||
|
|
||||||
const scalar gSumMagSf = gSum(magSf);
|
const scalar gSumMagSf = gSum(magSf);
|
||||||
|
|
||||||
Type meanValue = gSum(values*magSf)/gSumMagSf;
|
Type meanValue = gSum(values*magSf)/gSumMagSf;
|
||||||
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||||
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
{
|
||||||
scalarField vals(values.component(d));
|
tmp<scalarField> vals = values.component(d);
|
||||||
scalar mean = component(meanValue, d);
|
scalar mean = component(meanValue, d);
|
||||||
scalar& res = setComponent(result, d);
|
scalar& res = setComponent(result, d);
|
||||||
|
|
||||||
@ -260,38 +255,102 @@ processSameTypeValues
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case opAreaNormalAverage:
|
case opAreaNormalAverage:
|
||||||
{}
|
|
||||||
case opAreaNormalIntegrate:
|
case opAreaNormalIntegrate:
|
||||||
{}
|
// handled in specializations only
|
||||||
case opNone:
|
break;
|
||||||
{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type, class WeightType>
|
||||||
Type Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
|
Type Foam::functionObjects::fieldValues::surfaceFieldValue::processValues
|
||||||
(
|
(
|
||||||
const Field<Type>& values,
|
const Field<Type>& values,
|
||||||
const vectorField& Sf,
|
const vectorField& Sf,
|
||||||
const scalarField& weightField
|
const Field<WeightType>& weightField
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return processSameTypeValues(values, Sf, weightField);
|
return processSameTypeValues(values, Sf, weightField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
template<class WeightType>
|
||||||
|
Foam::tmp<Foam::scalarField>
|
||||||
|
Foam::functionObjects::fieldValues::surfaceFieldValue::weightingFactor
|
||||||
|
(
|
||||||
|
const Field<WeightType>& weightField
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return mag(weightField);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template<class WeightType>
|
||||||
|
Foam::label Foam::functionObjects::fieldValues::surfaceFieldValue::writeAll
|
||||||
|
(
|
||||||
|
const vectorField& Sf,
|
||||||
|
const Field<WeightType>& weightField,
|
||||||
|
const meshedSurf& surfToWrite
|
||||||
|
)
|
||||||
|
{
|
||||||
|
label nProcessed = 0;
|
||||||
|
|
||||||
|
forAll(fields_, i)
|
||||||
|
{
|
||||||
|
const word& fieldName = fields_[i];
|
||||||
|
const bool orient = (i >= orientedFieldsStart_);
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
writeValues<scalar>
|
||||||
|
(
|
||||||
|
fieldName, Sf, weightField, orient, surfToWrite
|
||||||
|
)
|
||||||
|
|| writeValues<vector>
|
||||||
|
(
|
||||||
|
fieldName, Sf, weightField, orient, surfToWrite
|
||||||
|
)
|
||||||
|
|| writeValues<sphericalTensor>
|
||||||
|
(
|
||||||
|
fieldName, Sf, weightField, orient, surfToWrite
|
||||||
|
)
|
||||||
|
|| writeValues<symmTensor>
|
||||||
|
(
|
||||||
|
fieldName, Sf, weightField, orient, surfToWrite
|
||||||
|
)
|
||||||
|
|| writeValues<tensor>
|
||||||
|
(
|
||||||
|
fieldName, Sf, weightField, orient, surfToWrite
|
||||||
|
)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
++nProcessed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Requested field " << fieldName
|
||||||
|
<< " not found in database and not processed"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nProcessed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
template<class Type, class WeightType>
|
template<class Type, class WeightType>
|
||||||
bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
|
bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
|
const vectorField& Sf,
|
||||||
const Field<WeightType>& weightField,
|
const Field<WeightType>& weightField,
|
||||||
const bool orient
|
const bool orient,
|
||||||
|
const meshedSurf& surfToWrite
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
const bool ok = validField<Type>(fieldName);
|
const bool ok = validField<Type>(fieldName);
|
||||||
@ -300,47 +359,19 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
|
|||||||
{
|
{
|
||||||
Field<Type> values(getFieldValues<Type>(fieldName, true, orient));
|
Field<Type> values(getFieldValues<Type>(fieldName, true, orient));
|
||||||
|
|
||||||
vectorField Sf;
|
|
||||||
if (surfacePtr_.valid())
|
|
||||||
{
|
|
||||||
// Get oriented Sf
|
|
||||||
Sf = surfacePtr_().Sf();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Get oriented Sf
|
|
||||||
Sf = filterField(mesh_.Sf(), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write raw values on surface if specified
|
// Write raw values on surface if specified
|
||||||
if (surfaceWriterPtr_.valid())
|
if (surfaceWriterPtr_.valid())
|
||||||
{
|
{
|
||||||
Field<Type> allValues(values);
|
Field<Type> allValues(values);
|
||||||
combineFields(allValues);
|
combineFields(allValues);
|
||||||
|
|
||||||
faceList faces;
|
|
||||||
pointField points;
|
|
||||||
|
|
||||||
if (surfacePtr_.valid())
|
|
||||||
{
|
|
||||||
combineSurfaceGeometry(faces, points);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
combineMeshGeometry(faces, points);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
surfaceWriterPtr_->write
|
surfaceWriterPtr_->write
|
||||||
(
|
(
|
||||||
outputDir(),
|
outputDir(),
|
||||||
regionTypeNames_[regionType_] + ("_" + regionName_),
|
regionTypeNames_[regionType_] + ("_" + regionName_),
|
||||||
meshedSurfRef
|
surfToWrite,
|
||||||
(
|
|
||||||
points,
|
|
||||||
faces
|
|
||||||
),
|
|
||||||
fieldName,
|
fieldName,
|
||||||
allValues,
|
allValues,
|
||||||
false
|
false
|
||||||
@ -360,27 +391,41 @@ bool Foam::functionObjects::fieldValues::surfaceFieldValue::writeValues
|
|||||||
case postOpNone:
|
case postOpNone:
|
||||||
break;
|
break;
|
||||||
case postOpSqrt:
|
case postOpSqrt:
|
||||||
|
{
|
||||||
|
// sqrt: component-wise - doesn't change the type
|
||||||
|
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||||
{
|
{
|
||||||
// sqrt: component-wise - doesn't change the type
|
setComponent(result, d)
|
||||||
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
= sqrt(mag(component(result, d)));
|
||||||
{
|
|
||||||
setComponent(result, d)
|
|
||||||
= sqrt(mag(component(result, d)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
file()<< tab << result;
|
file()<< tab << result;
|
||||||
|
|
||||||
Log << " " << operationTypeNames_[operation_]
|
// Write state/results information
|
||||||
<< "(" << regionName_ << ") of " << fieldName
|
word prefix, suffix;
|
||||||
|
{
|
||||||
|
if (postOperation_ != postOpNone)
|
||||||
|
{
|
||||||
|
// Adjust result name to include post-operation
|
||||||
|
prefix += postOperationTypeNames_[postOperation_];
|
||||||
|
prefix += '(';
|
||||||
|
suffix += ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
prefix += operationTypeNames_[operation_];
|
||||||
|
prefix += '(';
|
||||||
|
suffix += ')';
|
||||||
|
}
|
||||||
|
|
||||||
|
Log << " " << prefix << regionName_ << suffix
|
||||||
|
<< " of " << fieldName
|
||||||
<< " = " << result << endl;
|
<< " = " << result << endl;
|
||||||
|
|
||||||
// Write state/results information
|
// Write state/results information
|
||||||
const word& opName = operationTypeNames_[operation_];
|
word resultName = prefix + regionName_ + ',' + fieldName + suffix;
|
||||||
word resultName =
|
|
||||||
opName + '(' + regionName_ + ',' + fieldName + ')';
|
|
||||||
this->setResult(resultName, result);
|
this->setResult(resultName, result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -423,7 +468,10 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
|
|||||||
{
|
{
|
||||||
forAll(values, i)
|
forAll(values, i)
|
||||||
{
|
{
|
||||||
values[i] *= faceSign_[i];
|
if (faceFlip_[i])
|
||||||
|
{
|
||||||
|
values[i] *= -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,7 +508,10 @@ Foam::functionObjects::fieldValues::surfaceFieldValue::filterField
|
|||||||
{
|
{
|
||||||
forAll(values, i)
|
forAll(values, i)
|
||||||
{
|
{
|
||||||
values[i] *= faceSign_[i];
|
if (faceFlip_[i])
|
||||||
|
{
|
||||||
|
values[i] *= -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -48,17 +48,19 @@ const char*
|
|||||||
Foam::NamedEnum
|
Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::volFieldValue::operationType,
|
Foam::functionObjects::fieldValues::volFieldValue::operationType,
|
||||||
11
|
13
|
||||||
>::names[] =
|
>::names[] =
|
||||||
{
|
{
|
||||||
"none",
|
"none",
|
||||||
"sum",
|
"sum",
|
||||||
|
"weightedSum",
|
||||||
"sumMag",
|
"sumMag",
|
||||||
"average",
|
"average",
|
||||||
"weightedAverage",
|
"weightedAverage",
|
||||||
"volAverage",
|
"volAverage",
|
||||||
"weightedVolAverage",
|
"weightedVolAverage",
|
||||||
"volIntegrate",
|
"volIntegrate",
|
||||||
|
"weightedVolIntegrate",
|
||||||
"min",
|
"min",
|
||||||
"max",
|
"max",
|
||||||
"CoV"
|
"CoV"
|
||||||
@ -67,20 +69,59 @@ Foam::NamedEnum
|
|||||||
const Foam::NamedEnum
|
const Foam::NamedEnum
|
||||||
<
|
<
|
||||||
Foam::functionObjects::fieldValues::volFieldValue::operationType,
|
Foam::functionObjects::fieldValues::volFieldValue::operationType,
|
||||||
11
|
13
|
||||||
> Foam::functionObjects::fieldValues::volFieldValue::operationTypeNames_;
|
> Foam::functionObjects::fieldValues::volFieldValue::operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::functionObjects::fieldValues::volFieldValue::needsVol() const
|
||||||
|
{
|
||||||
|
// Only some operations need the cell volume
|
||||||
|
switch (operation_)
|
||||||
|
{
|
||||||
|
case opVolAverage:
|
||||||
|
case opWeightedVolAverage:
|
||||||
|
case opVolIntegrate:
|
||||||
|
case opWeightedVolIntegrate:
|
||||||
|
case opCoV:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::functionObjects::fieldValues::volFieldValue::needsWeight() const
|
||||||
|
{
|
||||||
|
// Only a few operations use weight field
|
||||||
|
switch (operation_)
|
||||||
|
{
|
||||||
|
case opWeightedSum:
|
||||||
|
case opWeightedAverage:
|
||||||
|
case opWeightedVolAverage:
|
||||||
|
case opWeightedVolIntegrate:
|
||||||
|
return true;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::functionObjects::fieldValues::volFieldValue::initialise
|
void Foam::functionObjects::fieldValues::volFieldValue::initialise
|
||||||
(
|
(
|
||||||
const dictionary& dict
|
const dictionary& dict
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (dict.readIfPresent("weightField", weightFieldName_))
|
weightFieldName_ = "none";
|
||||||
|
if (needsWeight())
|
||||||
{
|
{
|
||||||
Info<< " weight field = " << weightFieldName_;
|
if (dict.readIfPresent("weightField", weightFieldName_))
|
||||||
|
{
|
||||||
|
Info<< " weight field = " << weightFieldName_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Info<< nl << endl;
|
Info<< nl << endl;
|
||||||
@ -110,6 +151,42 @@ void Foam::functionObjects::fieldValues::volFieldValue::writeFileHeader
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::label Foam::functionObjects::fieldValues::volFieldValue::writeAll
|
||||||
|
(
|
||||||
|
const scalarField& V,
|
||||||
|
const scalarField& weightField
|
||||||
|
)
|
||||||
|
{
|
||||||
|
label nProcessed = 0;
|
||||||
|
|
||||||
|
forAll(fields_, i)
|
||||||
|
{
|
||||||
|
const word& fieldName = fields_[i];
|
||||||
|
|
||||||
|
if
|
||||||
|
(
|
||||||
|
writeValues<scalar>(fieldName, V, weightField)
|
||||||
|
|| writeValues<vector>(fieldName, V, weightField)
|
||||||
|
|| writeValues<sphericalTensor>(fieldName, V, weightField)
|
||||||
|
|| writeValues<symmTensor>(fieldName, V, weightField)
|
||||||
|
|| writeValues<tensor>(fieldName, V, weightField)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
++nProcessed;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WarningInFunction
|
||||||
|
<< "Requested field " << fieldName
|
||||||
|
<< " not found in database and not processed"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nProcessed;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::functionObjects::fieldValues::volFieldValue::volFieldValue
|
Foam::functionObjects::fieldValues::volFieldValue::volFieldValue
|
||||||
@ -159,8 +236,6 @@ bool Foam::functionObjects::fieldValues::volFieldValue::read
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
fieldValue::read(dict);
|
fieldValue::read(dict);
|
||||||
|
|
||||||
// No additional info to read
|
|
||||||
initialise(dict);
|
initialise(dict);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -176,37 +251,21 @@ bool Foam::functionObjects::fieldValues::volFieldValue::write()
|
|||||||
writeTime(file());
|
writeTime(file());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct weight field. Note: zero size means weight = 1
|
// Only some operations need the cell volume
|
||||||
|
scalarField V;
|
||||||
|
if (needsVol())
|
||||||
|
{
|
||||||
|
V = filterField(fieldValue::mesh_.V());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Weight field - zero-size means weight = 1
|
||||||
scalarField weightField;
|
scalarField weightField;
|
||||||
if (weightFieldName_ != "none")
|
if (weightFieldName_ != "none")
|
||||||
{
|
{
|
||||||
weightField =
|
weightField = getFieldValues<scalar>(weightFieldName_, true);
|
||||||
getFieldValues<scalar>
|
|
||||||
(
|
|
||||||
weightFieldName_,
|
|
||||||
true
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(fields_, i)
|
writeAll(V, weightField);
|
||||||
{
|
|
||||||
const word& fieldName = fields_[i];
|
|
||||||
bool ok = false;
|
|
||||||
|
|
||||||
ok = ok || writeValues<scalar>(fieldName, weightField);
|
|
||||||
ok = ok || writeValues<vector>(fieldName, weightField);
|
|
||||||
ok = ok || writeValues<sphericalTensor>(fieldName, weightField);
|
|
||||||
ok = ok || writeValues<symmTensor>(fieldName, weightField);
|
|
||||||
ok = ok || writeValues<tensor>(fieldName, weightField);
|
|
||||||
|
|
||||||
if (!ok)
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Requested field " << fieldName
|
|
||||||
<< " not found in database and not processed"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -82,12 +82,14 @@ Usage
|
|||||||
\plaintable
|
\plaintable
|
||||||
none | No operation
|
none | No operation
|
||||||
sum | Sum
|
sum | Sum
|
||||||
|
weightedSum | Weighted sum
|
||||||
sumMag | Sum of component magnitudes
|
sumMag | Sum of component magnitudes
|
||||||
average | Ensemble average
|
average | Ensemble average
|
||||||
weightedAverage | Weighted average
|
weightedAverage | Weighted average
|
||||||
volAverage | Volume weighted average
|
volAverage | Volume weighted average
|
||||||
weightedVolAverage | Weighted volume average
|
weightedVolAverage | Weighted volume average
|
||||||
volIntegrate | Volume integral
|
volIntegrate | Volume integral
|
||||||
|
weightedVolIntegrate | Weighted volume integral
|
||||||
min | Minimum
|
min | Minimum
|
||||||
max | Maximum
|
max | Maximum
|
||||||
CoV | Coefficient of variation: standard deviation/mean
|
CoV | Coefficient of variation: standard deviation/mean
|
||||||
@ -135,21 +137,23 @@ public:
|
|||||||
//- Operation type enumeration
|
//- Operation type enumeration
|
||||||
enum operationType
|
enum operationType
|
||||||
{
|
{
|
||||||
opNone,
|
opNone, //!< None
|
||||||
opSum,
|
opSum, //!< Sum
|
||||||
opSumMag,
|
opWeightedSum, //!< Weighted sum
|
||||||
opAverage,
|
opSumMag, //!< Magnitude of sum
|
||||||
opWeightedAverage,
|
opAverage, //!< Average
|
||||||
opVolAverage,
|
opWeightedAverage, //!< Weighted average
|
||||||
opWeightedVolAverage,
|
opVolAverage, //!< Volume average
|
||||||
opVolIntegrate,
|
opWeightedVolAverage, //!< Weighted volume average
|
||||||
opMin,
|
opVolIntegrate, //!< Volume integral
|
||||||
opMax,
|
opWeightedVolIntegrate, //!< Weighted volume integral
|
||||||
opCoV
|
opMin, //!< Minimum
|
||||||
|
opMax, //!< Maximum
|
||||||
|
opCoV //!< Coefficient of variation
|
||||||
};
|
};
|
||||||
|
|
||||||
//- Operation type names
|
//- Operation type names
|
||||||
static const NamedEnum<operationType, 11> operationTypeNames_;
|
static const NamedEnum<operationType, 13> operationTypeNames_;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -165,6 +169,12 @@ protected:
|
|||||||
|
|
||||||
// Protected Member Functions
|
// Protected Member Functions
|
||||||
|
|
||||||
|
//- True if the specified operation needs the cell-volume
|
||||||
|
bool needsVol() const;
|
||||||
|
|
||||||
|
//- True if the specified operation needs a weight-field
|
||||||
|
bool needsWeight() const;
|
||||||
|
|
||||||
//- Initialise, e.g. cell addressing
|
//- Initialise, e.g. cell addressing
|
||||||
void initialise(const dictionary& dict);
|
void initialise(const dictionary& dict);
|
||||||
|
|
||||||
@ -189,10 +199,30 @@ protected:
|
|||||||
const scalarField& weightField
|
const scalarField& weightField
|
||||||
) const;
|
) const;
|
||||||
|
|
||||||
|
//- Helper function to output field values
|
||||||
|
label writeAll
|
||||||
|
(
|
||||||
|
const scalarField& V,
|
||||||
|
const scalarField& weightField
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Templated helper function to output field values
|
||||||
|
template<class Type>
|
||||||
|
bool writeValues
|
||||||
|
(
|
||||||
|
const word& fieldName,
|
||||||
|
const scalarField& V,
|
||||||
|
const scalarField& weightField
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Filter a field according to cellIds
|
||||||
|
template<class Type>
|
||||||
|
tmp<Field<Type>> filterField(const Field<Type>& field) const;
|
||||||
|
|
||||||
|
|
||||||
//- Output file header information
|
//- Output file header information
|
||||||
virtual void writeFileHeader(Ostream& os) const;
|
virtual void writeFileHeader(Ostream& os) const;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//- Run-time type information
|
//- Run-time type information
|
||||||
@ -224,19 +254,11 @@ public:
|
|||||||
|
|
||||||
// Public Member Functions
|
// Public Member Functions
|
||||||
|
|
||||||
//- Templated helper function to output field values
|
|
||||||
template<class Type>
|
|
||||||
bool writeValues(const word& fieldName, const scalarField& weightField);
|
|
||||||
|
|
||||||
//- Filter a field according to cellIds
|
|
||||||
template<class Type>
|
|
||||||
tmp<Field<Type>> filterField(const Field<Type>& field) const;
|
|
||||||
|
|
||||||
//- Read from dictionary
|
//- Read from dictionary
|
||||||
virtual bool read(const dictionary&);
|
virtual bool read(const dictionary& dict) override;
|
||||||
|
|
||||||
//- Calculate and write
|
//- Calculate and write
|
||||||
virtual bool write();
|
virtual bool write() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation | Copyright (C) 2015-2016 OpenCFD Ltd.
|
\\/ M anipulation | Copyright (C) 2015-2017 OpenCFD Ltd.
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
This file is part of OpenFOAM.
|
This file is part of OpenFOAM.
|
||||||
@ -87,6 +87,18 @@ Type Foam::functionObjects::fieldValues::volFieldValue::processValues
|
|||||||
result = gSum(values);
|
result = gSum(values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case opWeightedSum:
|
||||||
|
{
|
||||||
|
if (returnReduce(weightField.empty(), andOp<bool>()))
|
||||||
|
{
|
||||||
|
result = gSum(values);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = gSum(weightField*values);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case opSumMag:
|
case opSumMag:
|
||||||
{
|
{
|
||||||
result = gSum(cmptMag(values));
|
result = gSum(cmptMag(values));
|
||||||
@ -94,34 +106,40 @@ Type Foam::functionObjects::fieldValues::volFieldValue::processValues
|
|||||||
}
|
}
|
||||||
case opAverage:
|
case opAverage:
|
||||||
{
|
{
|
||||||
label n = returnReduce(values.size(), sumOp<label>());
|
const label n = returnReduce(values.size(), sumOp<label>());
|
||||||
result = gSum(values)/(scalar(n) + ROOTVSMALL);
|
result = gSum(values)/(scalar(n) + ROOTVSMALL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedAverage:
|
case opWeightedAverage:
|
||||||
{
|
{
|
||||||
label wSize = returnReduce(weightField.size(), sumOp<label>());
|
if (returnReduce(weightField.empty(), andOp<bool>()))
|
||||||
|
|
||||||
if (wSize > 0)
|
|
||||||
{
|
{
|
||||||
result =
|
const label n = returnReduce(values.size(), sumOp<label>());
|
||||||
gSum(weightField*values)/(gSum(weightField) + ROOTVSMALL);
|
result = gSum(values)/(scalar(n) + ROOTVSMALL);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
label n = returnReduce(values.size(), sumOp<label>());
|
result =
|
||||||
result = gSum(values)/(scalar(n) + ROOTVSMALL);
|
gSum(weightField*values)/(gSum(weightField) + ROOTVSMALL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opVolAverage:
|
case opVolAverage:
|
||||||
{
|
{
|
||||||
result = gSum(values*V)/(gSum(V) + ROOTVSMALL);
|
result = gSum(values*V)/gSum(V);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opWeightedVolAverage:
|
case opWeightedVolAverage:
|
||||||
{
|
{
|
||||||
result = gSum(weightField*V*values)/gSum(weightField*V);
|
if (returnReduce(weightField.empty(), andOp<bool>()))
|
||||||
|
{
|
||||||
|
result = gSum(V*values)/(gSum(V) + ROOTVSMALL);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = gSum(weightField*V*values)
|
||||||
|
/(gSum(weightField*V) + ROOTVSMALL);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case opVolIntegrate:
|
case opVolIntegrate:
|
||||||
@ -129,6 +147,18 @@ Type Foam::functionObjects::fieldValues::volFieldValue::processValues
|
|||||||
result = gSum(V*values);
|
result = gSum(V*values);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case opWeightedVolIntegrate:
|
||||||
|
{
|
||||||
|
if (returnReduce(weightField.empty(), andOp<bool>()))
|
||||||
|
{
|
||||||
|
result = gSum(V*values);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = gSum(weightField*V*values);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case opMin:
|
case opMin:
|
||||||
{
|
{
|
||||||
result = gMin(values);
|
result = gMin(values);
|
||||||
@ -145,9 +175,7 @@ Type Foam::functionObjects::fieldValues::volFieldValue::processValues
|
|||||||
|
|
||||||
Type meanValue = gSum(V*values)/sumV;
|
Type meanValue = gSum(V*values)/sumV;
|
||||||
|
|
||||||
const label nComp = pTraits<Type>::nComponents;
|
for (direction d=0; d < pTraits<Type>::nComponents; ++d)
|
||||||
|
|
||||||
for (direction d=0; d<nComp; ++d)
|
|
||||||
{
|
{
|
||||||
scalarField vals(values.component(d));
|
scalarField vals(values.component(d));
|
||||||
scalar mean = component(meanValue, d);
|
scalar mean = component(meanValue, d);
|
||||||
@ -172,6 +200,7 @@ template<class Type>
|
|||||||
bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
|
bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
|
||||||
(
|
(
|
||||||
const word& fieldName,
|
const word& fieldName,
|
||||||
|
const scalarField& V,
|
||||||
const scalarField& weightField
|
const scalarField& weightField
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -180,7 +209,6 @@ bool Foam::functionObjects::fieldValues::volFieldValue::writeValues
|
|||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
Field<Type> values(getFieldValues<Type>(fieldName));
|
Field<Type> values(getFieldValues<Type>(fieldName));
|
||||||
scalarField V(filterField(fieldValue::mesh_.V()));
|
|
||||||
|
|
||||||
if (writeFields_)
|
if (writeFields_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -0,0 +1,41 @@
|
|||||||
|
/*--------------------------------*- 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 volScalarField;
|
||||||
|
location "0";
|
||||||
|
object T;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 0 0 1 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 300;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
"inlet.*"
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue $internalField;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
/*--------------------------------*- 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 volVectorField;
|
||||||
|
location "0";
|
||||||
|
object U;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 1 -1 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform (0 0 0);
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inlet_air
|
||||||
|
{
|
||||||
|
type flowRateInletVelocity;
|
||||||
|
massFlowRate constant 0.095;
|
||||||
|
value uniform (0 0 0);
|
||||||
|
}
|
||||||
|
inlet_fuel
|
||||||
|
{
|
||||||
|
type flowRateInletVelocity;
|
||||||
|
massFlowRate constant 0.005;
|
||||||
|
value uniform (0 0 0);
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type pressureInletOutletVelocity;
|
||||||
|
inletValue (0 0 0);
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
"wall.*"
|
||||||
|
{
|
||||||
|
type noSlip;
|
||||||
|
}
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform (0 0 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
/*--------------------------------*- 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 volScalarField;
|
||||||
|
location "0";
|
||||||
|
object alphat;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -1 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 1e-3;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
"inlet.*"
|
||||||
|
{
|
||||||
|
type calculated;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type calculated;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
"wall.*"
|
||||||
|
{
|
||||||
|
type compressible::alphatWallFunction;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
/*--------------------------------*- 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 volScalarField;
|
||||||
|
location "0";
|
||||||
|
object epsilon;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 2 -3 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 100;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inlet_air
|
||||||
|
{
|
||||||
|
type turbulentMixingLengthDissipationRateInlet;
|
||||||
|
mixingLength 0.005;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
inlet_fuel
|
||||||
|
{
|
||||||
|
type turbulentMixingLengthDissipationRateInlet;
|
||||||
|
mixingLength 0.001;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue $internalField;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
"inlet.*"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
"wall.*"
|
||||||
|
{
|
||||||
|
type epsilonWallFunction;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
/*--------------------------------*- 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 volScalarField;
|
||||||
|
location "0";
|
||||||
|
object k;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 2 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 6;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inlet_air
|
||||||
|
{
|
||||||
|
type turbulentIntensityKineticEnergyInlet;
|
||||||
|
intensity 0.05;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
inlet_fuel
|
||||||
|
{
|
||||||
|
type turbulentIntensityKineticEnergyInlet;
|
||||||
|
intensity 0.05;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue $internalField;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
/*--------------------------------*- 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 volScalarField;
|
||||||
|
location "0";
|
||||||
|
object nut;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 2 -1 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
"inlet.*"
|
||||||
|
{
|
||||||
|
type calculated;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type calculated;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
"wall.*"
|
||||||
|
{
|
||||||
|
type nutUWallFunction;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
/*--------------------------------*- 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 volScalarField;
|
||||||
|
location "0";
|
||||||
|
object p;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [1 -1 -2 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 1e5;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value $internalField;
|
||||||
|
}
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
/*--------------------------------*- 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 volScalarField;
|
||||||
|
location "0";
|
||||||
|
object tracer0;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 0 0 0 0 0 0];
|
||||||
|
|
||||||
|
internalField uniform 0;
|
||||||
|
|
||||||
|
boundaryField
|
||||||
|
{
|
||||||
|
inlet_air
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 0;
|
||||||
|
}
|
||||||
|
inlet_fuel
|
||||||
|
{
|
||||||
|
type fixedValue;
|
||||||
|
value uniform 1;
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
type inletOutlet;
|
||||||
|
inletValue uniform 0;
|
||||||
|
value uniform 0;
|
||||||
|
}
|
||||||
|
".*"
|
||||||
|
{
|
||||||
|
type zeroGradient;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
13
tutorials/compressible/rhoSimpleFoam/gasMixing/injectorPipe/Allclean
Executable file
13
tutorials/compressible/rhoSimpleFoam/gasMixing/injectorPipe/Allclean
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
|
||||||
|
# Source tutorial clean functions
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||||
|
|
||||||
|
cleanCase
|
||||||
|
rm -rf 0
|
||||||
|
|
||||||
|
rm -f constant/triSurface/*.eMesh* > /dev/null 2>&1
|
||||||
|
rm -rf constant/extendedFeatureEdgeMesh > /dev/null 2>&1
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
13
tutorials/compressible/rhoSimpleFoam/gasMixing/injectorPipe/Allrun
Executable file
13
tutorials/compressible/rhoSimpleFoam/gasMixing/injectorPipe/Allrun
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
|
||||||
|
# Source tutorial run functions
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||||
|
|
||||||
|
./Allrun.mesh
|
||||||
|
|
||||||
|
restore0Dir
|
||||||
|
runApplication decomposePar -force
|
||||||
|
runParallel rhoSimpleFoam
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
13
tutorials/compressible/rhoSimpleFoam/gasMixing/injectorPipe/Allrun.mesh
Executable file
13
tutorials/compressible/rhoSimpleFoam/gasMixing/injectorPipe/Allrun.mesh
Executable file
@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd ${0%/*} || exit 1 # Run from this directory
|
||||||
|
|
||||||
|
# Source tutorial run functions
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||||
|
|
||||||
|
runApplication blockMesh
|
||||||
|
runApplication surfaceFeatureExtract
|
||||||
|
runApplication snappyHexMesh -overwrite
|
||||||
|
|
||||||
|
rm -rf 0
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
@ -0,0 +1 @@
|
|||||||
|
Demonstration of simple gas mixing, with processing on surface fields.
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
/*--------------------------------*- 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;
|
||||||
|
location "constant";
|
||||||
|
object thermophysicalProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
thermoType
|
||||||
|
{
|
||||||
|
type hePsiThermo;
|
||||||
|
mixture pureMixture;
|
||||||
|
transport sutherland;
|
||||||
|
thermo hConst;
|
||||||
|
equationOfState perfectGas;
|
||||||
|
specie specie;
|
||||||
|
energy sensibleInternalEnergy;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// SIMPLE
|
||||||
|
thermoType
|
||||||
|
{
|
||||||
|
type heRhoThermo;
|
||||||
|
}
|
||||||
|
|
||||||
|
mixture
|
||||||
|
{
|
||||||
|
specie
|
||||||
|
{
|
||||||
|
nMoles 1;
|
||||||
|
molWeight 28.9;
|
||||||
|
}
|
||||||
|
thermodynamics
|
||||||
|
{
|
||||||
|
Cp 1007;
|
||||||
|
Hf 0;
|
||||||
|
}
|
||||||
|
transport
|
||||||
|
{
|
||||||
|
As 1.4792e-06;
|
||||||
|
Ts 116;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,268 @@
|
|||||||
|
solid fuel_inlet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.103873 0.00419647 0.1
|
||||||
|
vertex 0.109249 0.00380166 0.1
|
||||||
|
vertex 0.106039 -0.000293039 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 -0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.107097 0.00704535 0.1
|
||||||
|
vertex 0.109249 0.00380166 0.1
|
||||||
|
vertex 0.103873 0.00419647 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 -0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.103873 0.00419647 0.1
|
||||||
|
vertex 0.106039 -0.000293039 0.1
|
||||||
|
vertex 0.102084 0.000583721 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 -0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.109249 0.00380166 0.1
|
||||||
|
vertex 0.11 0 0.1
|
||||||
|
vertex 0.106039 -0.000293039 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.103852 0.00922834 0.1
|
||||||
|
vertex 0.107097 0.00704535 0.1
|
||||||
|
vertex 0.103873 0.00419647 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.102084 0.000583721 0.1
|
||||||
|
vertex 0.0989737 0.00243444 0.1
|
||||||
|
vertex 0.103873 0.00419647 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.102311 -0.00254505 0.1
|
||||||
|
vertex 0.102084 0.000583721 0.1
|
||||||
|
vertex 0.106039 -0.000293039 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.11 0 0.1
|
||||||
|
vertex 0.109249 -0.00380166 0.1
|
||||||
|
vertex 0.106039 -0.000293039 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.103873 0.00419647 0.1
|
||||||
|
vertex 0.099792 0.00657993 0.1
|
||||||
|
vertex 0.103852 0.00922834 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal -0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.102084 0.000583721 0.1
|
||||||
|
vertex 0.0987304 -0.00168894 0.1
|
||||||
|
vertex 0.0989737 0.00243444 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0989737 0.00243444 0.1
|
||||||
|
vertex 0.099792 0.00657993 0.1
|
||||||
|
vertex 0.103873 0.00419647 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.106039 -0.000293039 0.1
|
||||||
|
vertex 0.104805 -0.00474297 0.1
|
||||||
|
vertex 0.102311 -0.00254505 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 -0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.102084 0.000583721 0.1
|
||||||
|
vertex 0.102311 -0.00254505 0.1
|
||||||
|
vertex 0.0987304 -0.00168894 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.104805 -0.00474297 0.1
|
||||||
|
vertex 0.106039 -0.000293039 0.1
|
||||||
|
vertex 0.109249 -0.00380166 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 -0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.1 0.01 0.1
|
||||||
|
vertex 0.103852 0.00922834 0.1
|
||||||
|
vertex 0.099792 0.00657993 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0989737 0.00243444 0.1
|
||||||
|
vertex 0.0987304 -0.00168894 0.1
|
||||||
|
vertex 0.0943497 0.000109063 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0955515 0.00475557 0.1
|
||||||
|
vertex 0.099792 0.00657993 0.1
|
||||||
|
vertex 0.0989737 0.00243444 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal -0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.104805 -0.00474297 0.1
|
||||||
|
vertex 0.100159 -0.00601788 0.1
|
||||||
|
vertex 0.102311 -0.00254505 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0987304 -0.00168894 0.1
|
||||||
|
vertex 0.102311 -0.00254505 0.1
|
||||||
|
vertex 0.100159 -0.00601788 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.109249 -0.00380166 0.1
|
||||||
|
vertex 0.107097 -0.00704535 0.1
|
||||||
|
vertex 0.104805 -0.00474297 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0961732 0.0092388 0.1
|
||||||
|
vertex 0.1 0.01 0.1
|
||||||
|
vertex 0.099792 0.00657993 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0943497 0.000109063 0.1
|
||||||
|
vertex 0.0955515 0.00475557 0.1
|
||||||
|
vertex 0.0989737 0.00243444 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0955808 -0.00457201 0.1
|
||||||
|
vertex 0.0943497 0.000109063 0.1
|
||||||
|
vertex 0.0987304 -0.00168894 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal -0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.099792 0.00657993 0.1
|
||||||
|
vertex 0.0955515 0.00475557 0.1
|
||||||
|
vertex 0.0961732 0.0092388 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.100159 -0.00601788 0.1
|
||||||
|
vertex 0.104805 -0.00474297 0.1
|
||||||
|
vertex 0.103852 -0.00922834 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.100159 -0.00601788 0.1
|
||||||
|
vertex 0.0955808 -0.00457201 0.1
|
||||||
|
vertex 0.0987304 -0.00168894 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal -0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.107097 -0.00704535 0.1
|
||||||
|
vertex 0.103852 -0.00922834 0.1
|
||||||
|
vertex 0.104805 -0.00474297 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0955515 0.00475557 0.1
|
||||||
|
vertex 0.0943497 0.000109063 0.1
|
||||||
|
vertex 0.0907612 0.00382683 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 -0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0943497 0.000109063 0.1
|
||||||
|
vertex 0.0955808 -0.00457201 0.1
|
||||||
|
vertex 0.0907612 -0.00382683 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0929289 0.00707107 0.1
|
||||||
|
vertex 0.0961732 0.0092388 0.1
|
||||||
|
vertex 0.0955515 0.00475557 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal -0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.103852 -0.00922834 0.1
|
||||||
|
vertex 0.1 -0.01 0.1
|
||||||
|
vertex 0.100159 -0.00601788 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0955808 -0.00457201 0.1
|
||||||
|
vertex 0.100159 -0.00601788 0.1
|
||||||
|
vertex 0.0961732 -0.0092388 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0907612 0.00382683 0.1
|
||||||
|
vertex 0.0929289 0.00707107 0.1
|
||||||
|
vertex 0.0955515 0.00475557 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.09 -4.64102e-10 0.1
|
||||||
|
vertex 0.0907612 0.00382683 0.1
|
||||||
|
vertex 0.0943497 0.000109063 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0907612 -0.00382683 0.1
|
||||||
|
vertex 0.09 -4.64102e-10 0.1
|
||||||
|
vertex 0.0943497 0.000109063 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0929289 -0.00707107 0.1
|
||||||
|
vertex 0.0907612 -0.00382683 0.1
|
||||||
|
vertex 0.0955808 -0.00457201 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.1 -0.01 0.1
|
||||||
|
vertex 0.0961732 -0.0092388 0.1
|
||||||
|
vertex 0.100159 -0.00601788 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
facet normal 0 0 -1
|
||||||
|
outer loop
|
||||||
|
vertex 0.0961732 -0.0092388 0.1
|
||||||
|
vertex 0.0929289 -0.00707107 0.1
|
||||||
|
vertex 0.0955808 -0.00457201 0.1
|
||||||
|
endloop
|
||||||
|
endfacet
|
||||||
|
endsolid fuel_inlet
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,30 @@
|
|||||||
|
/*--------------------------------*- 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;
|
||||||
|
location "constant";
|
||||||
|
object turbulenceProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
simulationType RAS;
|
||||||
|
|
||||||
|
RAS
|
||||||
|
{
|
||||||
|
RASModel kEpsilon;
|
||||||
|
|
||||||
|
turbulence on;
|
||||||
|
|
||||||
|
printCoeffs on;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
//
|
||||||
|
// Averaging of volume fields or fields on an externally loaded surface.
|
||||||
|
avg-tracer0-0.25
|
||||||
|
{
|
||||||
|
${settings_avg}
|
||||||
|
subRegion plane-0.25;
|
||||||
|
}
|
||||||
|
|
||||||
|
avg-tracer0-0.45
|
||||||
|
{
|
||||||
|
${settings_avg}
|
||||||
|
subRegion plane-0.45;
|
||||||
|
}
|
||||||
|
|
||||||
|
avg-tracer0-0.55
|
||||||
|
{
|
||||||
|
${settings_avg}
|
||||||
|
subRegion plane-0.55;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: plus |
|
||||||
|
| \\ / A nd | Web: http://www.OpenFOAM.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object blockMeshDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
|
||||||
|
vertices
|
||||||
|
(
|
||||||
|
(-0.5 -0.125 -0.25)
|
||||||
|
(1.5 -0.125 -0.25)
|
||||||
|
(1.5 0.125 -0.25)
|
||||||
|
(-0.5 0.125 -0.25)
|
||||||
|
(-0.5 -0.125 0.25)
|
||||||
|
(1.5 -0.125 0.25)
|
||||||
|
(1.5 0.125 0.25)
|
||||||
|
(-0.5 0.125 0.25)
|
||||||
|
);
|
||||||
|
|
||||||
|
blocks
|
||||||
|
(
|
||||||
|
hex (0 1 2 3 4 5 6 7) (32 4 8) simpleGrading (1 1 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
edges
|
||||||
|
();
|
||||||
|
patches
|
||||||
|
();
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
/*--------------------------------*- 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;
|
||||||
|
location "system";
|
||||||
|
object controlDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
application rhoSimpleFoam;
|
||||||
|
|
||||||
|
startFrom latestTime;
|
||||||
|
|
||||||
|
startTime 0;
|
||||||
|
|
||||||
|
stopAt endTime;
|
||||||
|
|
||||||
|
endTime 0.4;
|
||||||
|
|
||||||
|
deltaT 1e-04;
|
||||||
|
|
||||||
|
writeControl adjustableRunTime;
|
||||||
|
|
||||||
|
writeInterval 2e-3;
|
||||||
|
|
||||||
|
purgeWrite 0;
|
||||||
|
|
||||||
|
writeFormat binary;
|
||||||
|
|
||||||
|
writePrecision 6;
|
||||||
|
|
||||||
|
writeCompression off;
|
||||||
|
|
||||||
|
timeFormat general;
|
||||||
|
|
||||||
|
timePrecision 6;
|
||||||
|
|
||||||
|
runTimeModifiable yes;
|
||||||
|
|
||||||
|
adjustTimeStep yes;
|
||||||
|
|
||||||
|
maxCo 0.5;
|
||||||
|
|
||||||
|
|
||||||
|
// SIMPLE
|
||||||
|
endTime 1200;
|
||||||
|
deltaT 1;
|
||||||
|
writeInterval 100;
|
||||||
|
|
||||||
|
#include "sampleControls"
|
||||||
|
|
||||||
|
functions
|
||||||
|
{
|
||||||
|
#include "scalarTransport"
|
||||||
|
#include "sampling"
|
||||||
|
}
|
||||||
|
|
||||||
|
OptimisationSwitches
|
||||||
|
{
|
||||||
|
// Force dumping (at next timestep) upon signal: 12 = USR2
|
||||||
|
writeNowSignal 12;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
/*--------------------------------*- 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;
|
||||||
|
location "system";
|
||||||
|
object decomposeParDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
numberOfSubdomains 8;
|
||||||
|
|
||||||
|
method hierarchical;
|
||||||
|
|
||||||
|
hierarchicalCoeffs
|
||||||
|
{
|
||||||
|
n ( 2 2 2 );
|
||||||
|
delta 0.001;
|
||||||
|
order xyz;
|
||||||
|
}
|
||||||
|
|
||||||
|
preservePatches ();
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
// Transcribe volume fields to surfaces.
|
||||||
|
fieldTransfer
|
||||||
|
{
|
||||||
|
type surfMeshes;
|
||||||
|
libs ("libsampling.so");
|
||||||
|
log true;
|
||||||
|
writeControl none;
|
||||||
|
createOnRead true;
|
||||||
|
executeControl timeStep;
|
||||||
|
executeInterval 1;
|
||||||
|
|
||||||
|
fields (rho U tracer0);
|
||||||
|
derived (rhoU);
|
||||||
|
|
||||||
|
baseCfg
|
||||||
|
{
|
||||||
|
type sampledTriSurfaceMesh;
|
||||||
|
source cells;
|
||||||
|
}
|
||||||
|
|
||||||
|
surfaces
|
||||||
|
(
|
||||||
|
plane-0.25
|
||||||
|
{
|
||||||
|
$baseCfg
|
||||||
|
surface plane-0.25.stl;
|
||||||
|
}
|
||||||
|
plane-0.45
|
||||||
|
{
|
||||||
|
$baseCfg
|
||||||
|
surface plane-0.45.stl;
|
||||||
|
}
|
||||||
|
plane-0.55
|
||||||
|
{
|
||||||
|
$baseCfg
|
||||||
|
surface plane-0.55.stl;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,64 @@
|
|||||||
|
/*--------------------------------*- 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;
|
||||||
|
location "system";
|
||||||
|
object fvSchemes;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
ddtSchemes
|
||||||
|
{
|
||||||
|
default Euler;
|
||||||
|
}
|
||||||
|
|
||||||
|
gradSchemes
|
||||||
|
{
|
||||||
|
default leastSquares;
|
||||||
|
grad(U) cellLimited Gauss linear 0.99;
|
||||||
|
}
|
||||||
|
|
||||||
|
divSchemes
|
||||||
|
{
|
||||||
|
default none;
|
||||||
|
div(phi,U) Gauss limitedLinearV 1;
|
||||||
|
div(phid,p) Gauss limitedLinear 1;
|
||||||
|
div(phi,K) Gauss limitedLinear 1;
|
||||||
|
div(phi,k) Gauss limitedLinear 1;
|
||||||
|
div(phi,h) Gauss limitedLinear 1;
|
||||||
|
div(phi,e) Gauss limitedLinear 1;
|
||||||
|
div(phi,Ekp) Gauss limitedLinear 1;
|
||||||
|
div(phi,T) Gauss limitedLinear 1;
|
||||||
|
div(phi,tracer0) Gauss limitedLinear 1;
|
||||||
|
div(phi,epsilon) Gauss limitedLinear 1;
|
||||||
|
div(R) Gauss linear;
|
||||||
|
div(U) Gauss linear;
|
||||||
|
div((Su*n)) Gauss linear;
|
||||||
|
div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
laplacianSchemes
|
||||||
|
{
|
||||||
|
default Gauss linear corrected;
|
||||||
|
}
|
||||||
|
|
||||||
|
interpolationSchemes
|
||||||
|
{
|
||||||
|
default linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
snGradSchemes
|
||||||
|
{
|
||||||
|
default corrected;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,152 @@
|
|||||||
|
/*--------------------------------*- 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;
|
||||||
|
location "system";
|
||||||
|
object fvSolution;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
solvers
|
||||||
|
{
|
||||||
|
"(p|rho)"
|
||||||
|
{
|
||||||
|
solver GAMG;
|
||||||
|
tolerance 1e-08;
|
||||||
|
relTol 0.05;
|
||||||
|
smoother symGaussSeidel;
|
||||||
|
nCellsInCoarsestLevel 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(U|k|epsilon|tracer0)"
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother symGaussSeidel;
|
||||||
|
nSweeps 2;
|
||||||
|
tolerance 1e-06;
|
||||||
|
relTol 0.1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
e
|
||||||
|
{
|
||||||
|
solver PBiCGStab;
|
||||||
|
preconditioner DILU;
|
||||||
|
nSweeps 2;
|
||||||
|
tolerance 1e-06;
|
||||||
|
relTol 0.1;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(p|rho)Final"
|
||||||
|
{
|
||||||
|
$p;
|
||||||
|
tolerance 1e-06;
|
||||||
|
relTol 0;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(U|k|epsilon|tracer0)Final"
|
||||||
|
{
|
||||||
|
$U;
|
||||||
|
tolerance 1e-05;
|
||||||
|
relTol 0;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
eFinal
|
||||||
|
{
|
||||||
|
$e;
|
||||||
|
tolerance 1e-05;
|
||||||
|
relTol 0;
|
||||||
|
minIter 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PIMPLE
|
||||||
|
{
|
||||||
|
nOuterCorrectors 2;
|
||||||
|
nCorrectors 1;
|
||||||
|
nNonOrthogonalCorrectors 0;
|
||||||
|
rhoMin 0.3;
|
||||||
|
rhoMax 2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
potentialFlow
|
||||||
|
{
|
||||||
|
nNonOrthogonalCorrectors 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SIMPLE
|
||||||
|
{
|
||||||
|
nNonOrthogonalCorrectors 0;
|
||||||
|
rhoMin 0.3;
|
||||||
|
rhoMax 1.4;
|
||||||
|
transonic false;
|
||||||
|
// consistent yes;
|
||||||
|
|
||||||
|
residualControl
|
||||||
|
{
|
||||||
|
p 1e-3;
|
||||||
|
U 1e-4;
|
||||||
|
e 1e-3;
|
||||||
|
|
||||||
|
// possibly check turbulence fields
|
||||||
|
"(k|epsilon|omega)" 1e-3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 2.4.x
|
||||||
|
rhoMin rhoMin [1 -3 0 0 0 0 0] 0.3;
|
||||||
|
rhoMax rhoMax [1 -3 0 0 0 0 0] 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
relaxationFactors-SIMPLE
|
||||||
|
{
|
||||||
|
fields
|
||||||
|
{
|
||||||
|
p 0.3;
|
||||||
|
rho 0.05;
|
||||||
|
}
|
||||||
|
equations
|
||||||
|
{
|
||||||
|
U 0.7;
|
||||||
|
"(k|epsilon)" 0.7;
|
||||||
|
e 0.5;
|
||||||
|
tracer0 1;
|
||||||
|
|
||||||
|
".*Final" 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
relaxationFactors-PIMPLE
|
||||||
|
{
|
||||||
|
equations
|
||||||
|
{
|
||||||
|
U 0.95;
|
||||||
|
"(k|epsilon)" 0.95;
|
||||||
|
e 0.95;
|
||||||
|
tracer0 1;
|
||||||
|
|
||||||
|
".*Final" 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// relaxationFactors { $relaxationFactors-PIMPLE }
|
||||||
|
relaxationFactors { $relaxationFactors-SIMPLE }
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
/*--------------------------------*- 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 meshQualityDict;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Include defaults parameters from master dictionary
|
||||||
|
#include "$WM_PROJECT_DIR/etc/caseDicts/meshQualityDict"
|
||||||
|
|
||||||
|
maxNonOrtho 55;
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,101 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
|
||||||
|
// Averaging of volume fields or fields on an externally loaded surface.
|
||||||
|
//
|
||||||
|
// fields [required]
|
||||||
|
// The fields and the specification for the type of averaging needed.
|
||||||
|
//
|
||||||
|
// The 'execute' control triggers the averaging.
|
||||||
|
// The 'output/write' control is optional.
|
||||||
|
//
|
||||||
|
// The averaging can be optionally restart in two ways:
|
||||||
|
//
|
||||||
|
// periodicRestart / restartPeriod:
|
||||||
|
// - reset at defined intervals
|
||||||
|
//
|
||||||
|
// restartTime:
|
||||||
|
// - a 'one-shot' reset at a particular time
|
||||||
|
//
|
||||||
|
settings_avg
|
||||||
|
{
|
||||||
|
type fieldAverage;
|
||||||
|
libs ("libfieldFunctionObjects.so");
|
||||||
|
log on;
|
||||||
|
enabled true;
|
||||||
|
|
||||||
|
executeControl timeStep;
|
||||||
|
writeControl outputTime;
|
||||||
|
writeInterval 1;
|
||||||
|
|
||||||
|
// restart behaviour
|
||||||
|
resetOnStartUp true;
|
||||||
|
resetOnOutput false;
|
||||||
|
// periodicRestart true;
|
||||||
|
// restartPeriod 0.002;
|
||||||
|
|
||||||
|
// Use the same values for all entries
|
||||||
|
meanOnly
|
||||||
|
{
|
||||||
|
mean on;
|
||||||
|
prime2Mean off;
|
||||||
|
base time;
|
||||||
|
}
|
||||||
|
|
||||||
|
fields
|
||||||
|
(
|
||||||
|
rho
|
||||||
|
{
|
||||||
|
$meanOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
U
|
||||||
|
{
|
||||||
|
$meanOnly;
|
||||||
|
}
|
||||||
|
|
||||||
|
tracer0
|
||||||
|
{
|
||||||
|
$meanOnly;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// restartTime:
|
||||||
|
// - a 'one-shot' reset at a particular time
|
||||||
|
//
|
||||||
|
// fields [required]
|
||||||
|
// Pairs of fields to use for calculating the deviation.
|
||||||
|
// The fields must already exist on the surfaces.
|
||||||
|
//
|
||||||
|
// weightField [optional]
|
||||||
|
// A scalar or vector field for weighting.
|
||||||
|
//
|
||||||
|
// postOperation [optional]
|
||||||
|
// Modify the results by particular operations.
|
||||||
|
// (none | sqrt)
|
||||||
|
// The sqrt operation is useful when determining RMS values.
|
||||||
|
//
|
||||||
|
// The 'output/write' control triggers the calculation.
|
||||||
|
settings_stats
|
||||||
|
{
|
||||||
|
type surfaceFieldValue;
|
||||||
|
libs ("libfieldFunctionObjects.so");
|
||||||
|
log on;
|
||||||
|
enabled true;
|
||||||
|
|
||||||
|
writeControl timeStep;
|
||||||
|
writeInterval 1;
|
||||||
|
|
||||||
|
writeFields false;
|
||||||
|
surfaceFormat vtk;
|
||||||
|
// writeArea true;
|
||||||
|
|
||||||
|
// resetOnStartUp true;
|
||||||
|
// resetOnOutput false;
|
||||||
|
// periodicRestart true;
|
||||||
|
// restartPeriod 0.0005;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
#include "fieldTransfer"
|
||||||
|
#include "avg-tracer0"
|
||||||
|
#include "sum-tracer0"
|
||||||
|
// #include "sum-tracer0Mean"
|
||||||
|
|
||||||
|
// #include "averaging.1612" // generate time-averaged fields
|
||||||
|
// #include "spatialDeviation.1612" // spatial deviation compared to a mean field
|
||||||
|
// #include "statistics.1612" // transcribe volume fields -> surface
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
|
||||||
|
tracer0
|
||||||
|
{
|
||||||
|
type scalarTransport;
|
||||||
|
libs ("libsolverFunctionObjects.so");
|
||||||
|
log off;
|
||||||
|
|
||||||
|
resetOnStartUp false;
|
||||||
|
// writeControl outputTime;
|
||||||
|
// writeInterval 1;
|
||||||
|
field tracer0;
|
||||||
|
D 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,379 @@
|
|||||||
|
/*--------------------------------*- 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 snappyHexMeshDict;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Which of the steps to run
|
||||||
|
castellatedMesh true;
|
||||||
|
snap true;
|
||||||
|
addLayers false;
|
||||||
|
|
||||||
|
|
||||||
|
// Geometry. Definition of all surfaces. All surfaces are of class
|
||||||
|
// searchableSurface.
|
||||||
|
// Surfaces are used
|
||||||
|
// - to specify refinement for any mesh cell intersecting it
|
||||||
|
// - to specify refinement for any mesh cell inside/outside/near
|
||||||
|
// - to 'snap' the mesh boundary to the surface
|
||||||
|
geometry
|
||||||
|
{
|
||||||
|
inlet_air.stl
|
||||||
|
{
|
||||||
|
type triSurfaceMesh;
|
||||||
|
name inlet_air;
|
||||||
|
}
|
||||||
|
inlet_fuel.stl
|
||||||
|
{
|
||||||
|
type triSurfaceMesh;
|
||||||
|
name inlet_fuel;
|
||||||
|
}
|
||||||
|
outlet.stl
|
||||||
|
{
|
||||||
|
type triSurfaceMesh;
|
||||||
|
name outlet;
|
||||||
|
}
|
||||||
|
entrainment.stl
|
||||||
|
{
|
||||||
|
type triSurfaceMesh;
|
||||||
|
name inlet_entrainment;
|
||||||
|
}
|
||||||
|
walls.stl
|
||||||
|
{
|
||||||
|
type triSurfaceMesh;
|
||||||
|
name walls;
|
||||||
|
}
|
||||||
|
|
||||||
|
refinementBox
|
||||||
|
{
|
||||||
|
type searchableBox;
|
||||||
|
min (-0.5 -0.125 -0.25);
|
||||||
|
max (1.5 0.125 0.25);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Settings for the castellatedMesh generation.
|
||||||
|
castellatedMeshControls
|
||||||
|
{
|
||||||
|
|
||||||
|
// Refinement parameters
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
// If local number of cells is >= maxLocalCells on any processor
|
||||||
|
// switches from from refinement followed by balancing
|
||||||
|
// (current method) to (weighted) balancing before refinement.
|
||||||
|
maxLocalCells 100000;
|
||||||
|
|
||||||
|
// Overall cell limit (approximately). Refinement will stop immediately
|
||||||
|
// upon reaching this number so a refinement level might not complete.
|
||||||
|
// Note that this is the number of cells before removing the part which
|
||||||
|
// is not 'visible' from the keepPoint. The final number of cells might
|
||||||
|
// actually be a lot less.
|
||||||
|
maxGlobalCells 2000000;
|
||||||
|
|
||||||
|
// The surface refinement loop might spend lots of iterations refining just a
|
||||||
|
// few cells. This setting will cause refinement to stop if <= minimumRefine
|
||||||
|
// are selected for refinement. Note: it will at least do one iteration
|
||||||
|
// (unless the number of cells to refine is 0)
|
||||||
|
minRefinementCells 0;
|
||||||
|
|
||||||
|
// Number of buffer layers between different levels.
|
||||||
|
// 1 means normal 2:1 refinement restriction, larger means slower
|
||||||
|
// refinement.
|
||||||
|
nCellsBetweenLevels 5;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Explicit feature edge refinement
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
// Specifies a level for any cell intersected by its edges.
|
||||||
|
// This is a featureEdgeMesh, read from constant/triSurface for now.
|
||||||
|
features
|
||||||
|
(
|
||||||
|
{
|
||||||
|
file "walls.eMesh";
|
||||||
|
level 0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Surface based refinement
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
// Specifies two levels for every surface. The first is the minimum level,
|
||||||
|
// every cell intersecting a surface gets refined up to the minimum level.
|
||||||
|
// The second level is the maximum level. Cells that 'see' multiple
|
||||||
|
// intersections where the intersections make an
|
||||||
|
// angle > resolveFeatureAngle get refined up to the maximum level.
|
||||||
|
|
||||||
|
refinementSurfaces
|
||||||
|
{
|
||||||
|
inlet_air
|
||||||
|
{
|
||||||
|
level (4 4);
|
||||||
|
patchInfo
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inlet_fuel
|
||||||
|
{
|
||||||
|
level (6 6);
|
||||||
|
patchInfo
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
outlet
|
||||||
|
{
|
||||||
|
level (4 4);
|
||||||
|
patchInfo
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
inlet_entrainment
|
||||||
|
{
|
||||||
|
level (4 4);
|
||||||
|
patchInfo
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
walls
|
||||||
|
{
|
||||||
|
level (4 4);
|
||||||
|
regions
|
||||||
|
{
|
||||||
|
pipe_fuel { level (6 6); }
|
||||||
|
}
|
||||||
|
patchInfo
|
||||||
|
{
|
||||||
|
type wall;
|
||||||
|
inGroups (wall);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resolveFeatureAngle 30;
|
||||||
|
|
||||||
|
|
||||||
|
// Region-wise refinement
|
||||||
|
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
// Specifies refinement level for cells in relation to a surface. One of
|
||||||
|
// three modes
|
||||||
|
// - distance. 'levels' specifies per distance to the surface the
|
||||||
|
// wanted refinement level. The distances need to be specified in
|
||||||
|
// descending order.
|
||||||
|
// - inside. 'levels' is only one entry and only the level is used. All
|
||||||
|
// cells inside the surface get refined up to the level. The surface
|
||||||
|
// needs to be closed for this to be possible.
|
||||||
|
// - outside. Same but cells outside.
|
||||||
|
|
||||||
|
refinementRegions
|
||||||
|
{
|
||||||
|
refinementBox
|
||||||
|
{
|
||||||
|
mode inside;
|
||||||
|
levels ((4 4));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Mesh selection
|
||||||
|
// ~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
// After refinement patches get added for all refinementSurfaces and
|
||||||
|
// all cells intersecting the surfaces get put into these patches. The
|
||||||
|
// section reachable from the locationInMesh is kept.
|
||||||
|
// NOTE: This point should never be on a face, always inside a cell, even
|
||||||
|
// after refinement.
|
||||||
|
// This is an outside point locationInMesh (-0.033 -0.033 0.0033);
|
||||||
|
locationInMesh (0.5 0.01 0.01);
|
||||||
|
|
||||||
|
|
||||||
|
// Whether any faceZones (as specified in the refinementSurfaces)
|
||||||
|
// are only on the boundary of corresponding cellZones or also allow
|
||||||
|
// free-standing zone faces. Not used if there are no faceZones.
|
||||||
|
allowFreeStandingZoneFaces false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Settings for the snapping.
|
||||||
|
snapControls
|
||||||
|
{
|
||||||
|
//- Number of patch smoothing iterations before finding correspondence
|
||||||
|
// to surface
|
||||||
|
nSmoothPatch 3;
|
||||||
|
|
||||||
|
//- Relative distance for points to be attracted by surface feature point
|
||||||
|
// or edge. True distance is this factor times local
|
||||||
|
// maximum edge length.
|
||||||
|
tolerance 1.0;
|
||||||
|
|
||||||
|
//- Number of mesh displacement relaxation iterations.
|
||||||
|
nSolveIter 300;
|
||||||
|
|
||||||
|
//- Maximum number of snapping relaxation iterations. Should stop
|
||||||
|
// before upon reaching a correct mesh.
|
||||||
|
nRelaxIter 5;
|
||||||
|
|
||||||
|
// Feature snapping
|
||||||
|
|
||||||
|
//- Number of feature edge snapping iterations.
|
||||||
|
// Leave out altogether to disable.
|
||||||
|
nFeatureSnapIter 10;
|
||||||
|
|
||||||
|
//- Detect (geometric) features by sampling the surface
|
||||||
|
implicitFeatureSnap true;
|
||||||
|
|
||||||
|
//- Use castellatedMeshControls::features
|
||||||
|
explicitFeatureSnap false;
|
||||||
|
|
||||||
|
//- Detect features between multiple surfaces
|
||||||
|
// (only for explicitFeatureSnap, default = false)
|
||||||
|
multiRegionFeatureSnap true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Settings for the layer addition.
|
||||||
|
addLayersControls
|
||||||
|
{
|
||||||
|
// Are the thickness parameters below relative to the undistorted
|
||||||
|
// size of the refined cell outside layer (true) or absolute sizes (false).
|
||||||
|
relativeSizes true;
|
||||||
|
|
||||||
|
// Per final patch (so not geometry!) the layer information
|
||||||
|
layers
|
||||||
|
{
|
||||||
|
"blade."
|
||||||
|
{
|
||||||
|
nSurfaceLayers 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Expansion factor for layer mesh
|
||||||
|
expansionRatio 1.0;
|
||||||
|
|
||||||
|
|
||||||
|
// Wanted thickness of final added cell layer. If multiple layers
|
||||||
|
// is the thickness of the layer furthest away from the wall.
|
||||||
|
// Relative to undistorted size of cell outside layer.
|
||||||
|
// See relativeSizes parameter.
|
||||||
|
finalLayerThickness 0.25;
|
||||||
|
|
||||||
|
// Minimum thickness of cell layer. If for any reason layer
|
||||||
|
// cannot be above minThickness do not add layer.
|
||||||
|
// See relativeSizes parameter.
|
||||||
|
minThickness 0.2;
|
||||||
|
|
||||||
|
// If points get not extruded do nGrow layers of connected faces that are
|
||||||
|
// also not grown. This helps convergence of the layer addition process
|
||||||
|
// close to features.
|
||||||
|
nGrow 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Advanced settings
|
||||||
|
|
||||||
|
// When not to extrude surface. 0 is flat surface, 90 is when two faces
|
||||||
|
// are perpendicular
|
||||||
|
featureAngle 30;
|
||||||
|
|
||||||
|
// Maximum number of snapping relaxation iterations. Should stop
|
||||||
|
// before upon reaching a correct mesh.
|
||||||
|
nRelaxIter 5;
|
||||||
|
|
||||||
|
// Number of smoothing iterations of surface normals
|
||||||
|
nSmoothSurfaceNormals 1;
|
||||||
|
|
||||||
|
// Number of smoothing iterations of interior mesh movement direction
|
||||||
|
nSmoothNormals 3;
|
||||||
|
|
||||||
|
// Smooth layer thickness over surface patches
|
||||||
|
nSmoothThickness 10;
|
||||||
|
|
||||||
|
// Stop layer growth on highly warped cells
|
||||||
|
maxFaceThicknessRatio 0.5;
|
||||||
|
|
||||||
|
// Reduce layer growth where ratio thickness to medial
|
||||||
|
// distance is large
|
||||||
|
maxThicknessToMedialRatio 0.3;
|
||||||
|
|
||||||
|
// Angle used to pick up medial axis points
|
||||||
|
minMedianAxisAngle 90;
|
||||||
|
|
||||||
|
// Create buffer region for new layer terminations
|
||||||
|
nBufferCellsNoExtrude 0;
|
||||||
|
|
||||||
|
|
||||||
|
// Overall max number of layer addition iterations. The mesher will exit
|
||||||
|
// if it reaches this number of iterations; possibly with an illegal
|
||||||
|
// mesh.
|
||||||
|
nLayerIter 50;
|
||||||
|
|
||||||
|
// Max number of iterations after which relaxed meshQuality controls
|
||||||
|
// get used. Up to nRelaxIter it uses the settings in meshQualityControls,
|
||||||
|
// after nRelaxIter it uses the values in meshQualityControls::relaxed.
|
||||||
|
nRelaxedIter 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Generic mesh quality settings. At any undoable phase these determine
|
||||||
|
// where to undo.
|
||||||
|
meshQualityControls
|
||||||
|
{
|
||||||
|
#include "meshQualityDict"
|
||||||
|
|
||||||
|
// Optional : some meshing phases allow usage of relaxed rules.
|
||||||
|
// See e.g. addLayersControls::nRelaxedIter.
|
||||||
|
relaxed
|
||||||
|
{
|
||||||
|
//- Maximum non-orthogonality allowed. Set to 180 to disable.
|
||||||
|
maxNonOrtho 75;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Advanced
|
||||||
|
|
||||||
|
//- Number of error distribution iterations
|
||||||
|
nSmoothScale 4;
|
||||||
|
//- amount to scale back displacement at error points
|
||||||
|
errorReduction 0.75;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Advanced
|
||||||
|
|
||||||
|
// Write flags
|
||||||
|
writeFlags
|
||||||
|
(
|
||||||
|
scalarLevels // write volScalarField with cellLevel for postprocessing
|
||||||
|
layerSets // write cellSets, faceSets of faces in layer
|
||||||
|
layerFields // write volScalarField for layer coverage
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Merge tolerance. Is fraction of overall bounding box of initial mesh.
|
||||||
|
// Note: the write tolerance needs to be higher than this.
|
||||||
|
mergeTolerance 1E-6;
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
// -*- C++ -*-
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
|
|
||||||
|
sum-tracer0-0.25
|
||||||
|
{
|
||||||
|
$settings_stats
|
||||||
|
|
||||||
|
regionType surface;
|
||||||
|
name plane-0.25;
|
||||||
|
|
||||||
|
operation weightedAreaIntegrate;
|
||||||
|
// postOperation sqrt;
|
||||||
|
|
||||||
|
weightField rhoU;
|
||||||
|
fields (tracer0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sum-tracer0-0.45
|
||||||
|
{
|
||||||
|
$settings_stats
|
||||||
|
|
||||||
|
regionType surface;
|
||||||
|
name plane-0.45;
|
||||||
|
|
||||||
|
operation weightedAreaIntegrate;
|
||||||
|
// postOperation sqrt;
|
||||||
|
|
||||||
|
weightField rhoU;
|
||||||
|
fields (tracer0);
|
||||||
|
}
|
||||||
|
|
||||||
|
sum-tracer0-0.55
|
||||||
|
{
|
||||||
|
$settings_stats
|
||||||
|
|
||||||
|
regionType surface;
|
||||||
|
name plane-0.55;
|
||||||
|
|
||||||
|
operation weightedAreaIntegrate;
|
||||||
|
// postOperation sqrt;
|
||||||
|
|
||||||
|
weightField rhoU;
|
||||||
|
fields (tracer0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
/*--------------------------------*- 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 surfaceFeatureExtractDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
walls.stl
|
||||||
|
{
|
||||||
|
// How to obtain raw features (extractFromFile || extractFromSurface)
|
||||||
|
extractionMethod extractFromSurface;
|
||||||
|
|
||||||
|
extractFromSurfaceCoeffs
|
||||||
|
{
|
||||||
|
// Mark edges whose adjacent surface normals are at an angle less
|
||||||
|
// than includedAngle as features
|
||||||
|
// - 0 : selects no edges
|
||||||
|
// - 180: selects all edges
|
||||||
|
includedAngle 150;
|
||||||
|
}
|
||||||
|
|
||||||
|
subsetFeatures
|
||||||
|
{
|
||||||
|
// Keep nonManifold edges (edges with >2 connected faces)
|
||||||
|
nonManifoldEdges no;
|
||||||
|
|
||||||
|
// Keep open edges (edges with 1 connected face)
|
||||||
|
openEdges yes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Write options
|
||||||
|
|
||||||
|
// Write features to obj format for postprocessing
|
||||||
|
writeObj yes;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user