Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-plus into develop

This commit is contained in:
sergio
2016-12-13 07:20:39 -08:00
30 changed files with 311 additions and 288 deletions

View File

@ -1,8 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wclean libso CompressibleTwoPhaseMixtureTurbulenceModels
wclean
# ----------------------------------------------------------------- end-of-file
#------------------------------------------------------------------------------

View File

@ -1,8 +1,7 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake libso CompressibleTwoPhaseMixtureTurbulenceModels
wmake
# ----------------------------------------------------------------- end-of-file
#------------------------------------------------------------------------------

View File

@ -4,7 +4,6 @@ cd ${0%/*} || exit 1 # Run from this directory
# Parse arguments for library compilation
targetType=libso
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
set -x
wmake $targetType temperaturePhaseChangeTwoPhaseMixtures
wmake

View File

@ -7,8 +7,6 @@ cd ${0%/*} || exit 1 # Run from this directory
if [ -f "$CGAL_ARCH_PATH/include/CGAL/version.h" ] || \
[ "${CGAL_ARCH_PATH##*-}" = system -a -f /usr/include/CGAL/version.h ]
then
set -x
wmake $targetType conformalVoronoiMesh
wmake $targetType conformalVoronoi2DMesh
wmake foamyQuadMesh

View File

@ -20,7 +20,6 @@ then
export LINK_FLAGS="${LINK_FLAGS} -lzoltanRenumber -L${ZOLTAN_ARCH_PATH}/lib -lzoltan"
fi
set -x
wmake $targetType
#------------------------------------------------------------------------------

View File

@ -1,6 +1,5 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
set -x
unset COMPILE_FLAGS LINK_FLAGS

View File

@ -82,7 +82,7 @@ Description
runTime | Execute/write every 'Interval' run time period
clockTime | Execute/write every 'Interval' clock time period
cpuTime | Execute/write every 'Interval' CPU time period
none | Execute/write every time-step
none | Execute/write disabled
\endtable
The sub-dictionary name \c \<functionObjectName\> is chosen by the user, and

View File

@ -452,25 +452,22 @@ void Foam::ensightMesh::writeCellConnectivity
ensightCells::NFACED
};
for (int i=0; i < 5; ++i)
for (label typei=0; typei < ensightCells::nTypes; ++typei)
{
const ensightCells::elemType& what = oldOrder[i];
const ensightCells::elemType& what = oldOrder[typei];
writeCellConnectivity(what, ensCells, pointToGlobal, os);
}
}
else
{
const List<ensightCells::elemType> enums =
ensightCells::elemEnum.enums();
forAllConstIter(List<ensightCells::elemType>, enums, iter)
return;
}
for (label typei=0; typei < ensightCells::nTypes; ++typei)
{
const ensightCells::elemType what = *iter;
const ensightCells::elemType what = ensightCells::elemType(typei);
writeCellConnectivity(what, ensCells, pointToGlobal, os);
}
}
}
@ -614,13 +611,11 @@ void Foam::ensightMesh::writeFaceConnectivity
const bool raw
) const
{
const List<ensightFaces::elemType> enums = ensightFaces::elemEnum.enums();
if (raw)
{
forAllConstIter(List<ensightFaces::elemType>, enums, iter)
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{
const ensightFaces::elemType what = *iter;
const ensightFaces::elemType what = ensightFaces::elemType(typei);
writeFaceConnectivity
(
@ -638,9 +633,9 @@ void Foam::ensightMesh::writeFaceConnectivity
}
else
{
forAllConstIter(List<ensightFaces::elemType>, enums, iter)
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{
const ensightFaces::elemType what = *iter;
const ensightFaces::elemType what = ensightFaces::elemType(typei);
writeFaceConnectivity
(

View File

@ -101,7 +101,8 @@ bool Foam::ensightOutput::writeFaceField
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{
const ensightFaces::elemType what = ensightFaces::elemType(typei);
const ensightFaces::elemType what =
ensightFaces::elemType(typei);
writeFieldContent
(
@ -136,7 +137,7 @@ bool Foam::ensightOutput::writeFaceSubField
}
label start = 0; // start of sublist
for (label typei = 0; typei < ensightFaces::nTypes; ++typei)
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{
const ensightFaces::elemType what = ensightFaces::elemType(typei);
const label size = ensFaces.faceIds(what).size();

View File

@ -84,7 +84,8 @@ bool Foam::ensightSerialOutput::writeField
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{
const ensightFaces::elemType what = ensightFaces::elemType(typei);
const ensightFaces::elemType what =
ensightFaces::elemType(typei);
writeFieldContent
(

View File

@ -263,12 +263,9 @@ void Foam::ensightPartCells::write
}
// write each element type
const List<ensightCells::elemType> enums =
ensightCells::elemEnum.enums();
forAllConstIter(List<ensightCells::elemType>, enums, iter)
for (label typei=0; typei < ensightCells::nTypes; ++typei)
{
const ensightCells::elemType what = *iter;
const ensightCells::elemType what = ensightCells::elemType(typei);
writeConnectivity
(
@ -308,10 +305,9 @@ void Foam::ensightPartCells::dumpInfo(Ostream& os) const
os.writeEntry("name", name());
os.writeEntry("size", size());
const List<ensightCells::elemType> enums = ensightCells::elemEnum.enums();
forAllConstIter(List<ensightCells::elemType>, enums, iter)
for (label typei=0; typei < ensightCells::nTypes; ++typei)
{
const ensightCells::elemType what = *iter;
const ensightCells::elemType what = ensightCells::elemType(typei);
const labelUList& addr = this->cellIds(what);
os.writeKeyword(ensightCells::key(what));

View File

@ -226,12 +226,9 @@ void Foam::ensightPartFaces::write
}
// write part
const List<ensightFaces::elemType> enums =
ensightFaces::elemEnum.enums();
forAllConstIter(List<ensightFaces::elemType>, enums, iter)
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{
const ensightFaces::elemType what = *iter;
const ensightFaces::elemType what = ensightFaces::elemType(typei);
writeConnectivity
(
@ -273,10 +270,9 @@ void Foam::ensightPartFaces::dumpInfo(Ostream& os) const
os.writeEntry("start", start_);
os.writeEntry("size", size());
const List<ensightFaces::elemType> enums = ensightFaces::elemEnum.enums();
forAllConstIter(List<ensightFaces::elemType>, enums, iter)
for (label typei=0; typei < ensightFaces::nTypes; ++typei)
{
const ensightFaces::elemType what = *iter;
const ensightFaces::elemType what = ensightFaces::elemType(typei);
const labelUList& addr = this->faceIds(what);
os.writeKeyword(ensightFaces::key(what));

View File

@ -49,41 +49,25 @@ const Foam::NamedEnum<Foam::ensightCells::elemType, 5>
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline Foam::label Foam::ensightCells::offset
(
const enum elemType what,
const label i
) const
{
label n = i;
for (label typeI = 0; typeI < label(what); ++typeI)
{
n += sizes_[typeI];
}
return n;
}
void Foam::ensightCells::resize()
void Foam::ensightCells::resizeAll()
{
// overall required size
label n = 0;
forAll(sizes_, typeI)
forAll(sizes_, typei)
{
n += sizes_[typeI];
n += sizes_[typei];
}
address_.setSize(n, Zero);
// assign corresponding sub-lists
n = 0;
forAll(sizes_, typeI)
forAll(sizes_, typei)
{
deleteDemandDrivenData(lists_[typeI]);
deleteDemandDrivenData(lists_[typei]);
lists_[typeI] = new SubList<label>(address_, sizes_[typeI], n);
lists_[typei] = new SubList<label>(address_, sizes_[typei], n);
n += sizes_[typeI];
n += sizes_[typei];
}
}
@ -98,12 +82,12 @@ Foam::ensightCells::ensightCells(const label partIndex)
lists_()
{
// Ensure sub-lists are properly initialized to nullptr
forAll(lists_, typeI)
forAll(lists_, typei)
{
lists_[typeI] = nullptr;
lists_[typei] = nullptr;
}
resize(); // adjust allocation
resizeAll(); // adjust allocation
}
@ -115,9 +99,9 @@ Foam::ensightCells::ensightCells(const ensightCells& obj)
lists_()
{
// Ensure sub-lists are properly initialized to nullptr
forAll(lists_, typeI)
forAll(lists_, typei)
{
lists_[typeI] = nullptr;
lists_[typei] = nullptr;
}
// Total (reduced) sizes
@ -126,7 +110,7 @@ Foam::ensightCells::ensightCells(const ensightCells& obj)
// Local sizes
this->sizes_ = obj.sizes();
resize(); // adjust allocation
resizeAll(); // adjust allocation
// Restore total (reduced) sizes
this->sizes_ = totSizes;
@ -137,9 +121,9 @@ Foam::ensightCells::ensightCells(const ensightCells& obj)
Foam::ensightCells::~ensightCells()
{
forAll(lists_, typeI)
forAll(lists_, typei)
{
deleteDemandDrivenData(lists_[typeI]);
deleteDemandDrivenData(lists_[typei]);
}
address_.clear();
}
@ -150,21 +134,33 @@ Foam::ensightCells::~ensightCells()
Foam::FixedList<Foam::label, 5> Foam::ensightCells::sizes() const
{
FixedList<label, 5> count;
forAll(lists_, typeI)
forAll(lists_, typei)
{
count[typeI] = lists_[typeI]->size();
count[typei] = lists_[typei]->size();
}
return count;
}
Foam::label Foam::ensightCells::offset(const enum elemType what) const
{
label n = 0;
for (label typei = 0; typei < label(what); ++typei)
{
n += lists_[typei]->size();
}
return n;
}
Foam::label Foam::ensightCells::total() const
{
label n = 0;
forAll(sizes_, typeI)
forAll(sizes_, typei)
{
n += sizes_[typeI];
n += sizes_[typei];
}
return n;
}
@ -173,25 +169,25 @@ Foam::label Foam::ensightCells::total() const
void Foam::ensightCells::clear()
{
sizes_ = Zero; // reset sizes
resize();
resizeAll();
}
void Foam::ensightCells::reduce()
{
forAll(sizes_, typeI)
forAll(sizes_, typei)
{
sizes_[typeI] = lists_[typeI]->size();
Foam::reduce(sizes_[typeI], sumOp<label>());
sizes_[typei] = lists_[typei]->size();
Foam::reduce(sizes_[typei], sumOp<label>());
}
}
void Foam::ensightCells::sort()
{
forAll(lists_, typeI)
forAll(lists_, typei)
{
Foam::sort(*(lists_[typeI]));
Foam::sort(*(lists_[typei]));
}
}
@ -217,9 +213,9 @@ void Foam::ensightCells::classify
// Can avoid double looping, but only at the expense of allocation
sizes_ = Zero; // reset sizes
for (label listI = 0; listI < sz; ++listI)
for (label listi = 0; listi < sz; ++listi)
{
const label id = indirect ? addressing[listI] : listI;
const label id = indirect ? addressing[listi] : listi;
const cellModel& model = shapes[id].model();
enum elemType what = NFACED;
@ -243,13 +239,13 @@ void Foam::ensightCells::classify
sizes_[what]++;
}
resize(); // adjust allocation
resizeAll(); // adjust allocation
sizes_ = Zero; // reset sizes
// Assign cell-id per shape type
for (label listI = 0; listI < sz; ++listI)
for (label listi = 0; listi < sz; ++listi)
{
const label id = indirect ? addressing[listI] : listI;
const label id = indirect ? addressing[listi] : listi;
const cellModel& model = shapes[id].model();
enum elemType what = NFACED;
@ -276,10 +272,4 @@ void Foam::ensightCells::classify
}
Foam::label Foam::ensightCells::offset(const enum elemType what) const
{
return offset(what, 0);
}
// ************************************************************************* //

View File

@ -89,21 +89,19 @@ private:
//- Linear list of ids, sub-sectioned per element type via SubLists
labelList address_;
//- List of sizes for each element type
//- List of global sizes for each element type.
// Used temporarily for local sizes when building the element lists.
FixedList<label, 5> sizes_;
//- List of ids for each element type
//- List of ids for each element type.
// Managed via pointers, since a SubList cannot be relocated/resized.
FixedList<SubList<label>*, 5> lists_;
// Private Member Functions
//- Low-level offset routine
inline label offset(const enum elemType what, const label i) const;
//- Use current sizes to redimension the element lists
void resize();
//- Use temporarily stored sizes to redimension the element lists
void resizeAll();
//- Disallow default bitwise assignment
void operator=(const ensightCells&) = delete;
@ -145,13 +143,15 @@ public:
// This value is only meaningful after a reduce operation.
label total() const;
//- The processor local sizes per element type.
FixedList<label, 5> sizes() const;
//- The global numbers per element type.
// This value is only meaningful after a reduce operation.
inline const FixedList<label, 5>& totals() const;
//- The processor local sizes per element type.
FixedList<label, 5> sizes() const;
//- Processor local starting offset of element type.
label offset(const enum elemType what) const;
//- Return the (local) cell ids of the specified element type
inline const labelUList& cellIds(const enum elemType) const;
@ -159,9 +159,6 @@ public:
//- Return the cell ids of all elements
inline const labelUList& cellIds() const;
//- Starting offset of element type.
label offset(const enum elemType what) const;
// Edit

View File

@ -74,52 +74,36 @@ inline void Foam::ensightFaces::add
{
const enum elemType what = whatType(f);
label n = sizes_[what]++;
lists_[what]->operator[](n) = id;
// linear addressing:
const label index = offset(what) + sizes_[what]++;
address_[index] = id;
if (flipMap_.size())
{
flipMap_[offset(what, n)] = flip;
flipMap_[index] = flip;
}
}
// only used in this file-scope
inline Foam::label Foam::ensightFaces::offset
(
const enum elemType what,
const label i
) const
{
label n = i;
for (label typeI = 0; typeI < label(what); ++typeI)
{
n += sizes_[typeI];
}
return n;
}
void Foam::ensightFaces::resize()
void Foam::ensightFaces::resizeAll()
{
// overall required size
label n = 0;
forAll(sizes_, typeI)
forAll(sizes_, typei)
{
n += sizes_[typeI];
n += sizes_[typei];
}
address_.setSize(n, Zero);
// assign corresponding sub-lists
n = 0;
forAll(sizes_, typeI)
forAll(sizes_, typei)
{
deleteDemandDrivenData(lists_[typeI]);
deleteDemandDrivenData(lists_[typei]);
lists_[typeI] = new SubList<label>(address_, sizes_[typeI], n);
lists_[typei] = new SubList<label>(address_, sizes_[typei], n);
n += sizes_[typeI];
n += sizes_[typei];
}
// normally assume no flipMap
@ -138,12 +122,12 @@ Foam::ensightFaces::ensightFaces(label partIndex)
lists_()
{
// Ensure sub-lists are properly initialized to nullptr
forAll(lists_, typeI)
forAll(lists_, typei)
{
lists_[typeI] = nullptr;
lists_[typei] = nullptr;
}
resize(); // adjust allocation
resizeAll(); // adjust allocation
}
@ -156,9 +140,9 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj)
lists_()
{
// Ensure sub-lists are properly initialized to nullptr
forAll(lists_, typeI)
forAll(lists_, typei)
{
lists_[typeI] = nullptr;
lists_[typei] = nullptr;
}
// Total (reduced) sizes
@ -167,7 +151,7 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj)
// Local sizes
this->sizes_ = obj.sizes();
resize(); // adjust allocation
resizeAll(); // adjust allocation
// Restore total (reduced) sizes
this->sizes_ = totSizes;
@ -178,9 +162,9 @@ Foam::ensightFaces::ensightFaces(const ensightFaces& obj)
Foam::ensightFaces::~ensightFaces()
{
forAll(lists_, typeI)
forAll(lists_, typei)
{
deleteDemandDrivenData(lists_[typeI]);
deleteDemandDrivenData(lists_[typei]);
}
address_.clear();
flipMap_.clear();
@ -192,21 +176,33 @@ Foam::ensightFaces::~ensightFaces()
Foam::FixedList<Foam::label, 3> Foam::ensightFaces::sizes() const
{
FixedList<label, 3> count;
forAll(lists_, typeI)
forAll(lists_, typei)
{
count[typeI] = lists_[typeI]->size();
count[typei] = lists_[typei]->size();
}
return count;
}
Foam::label Foam::ensightFaces::offset(const enum elemType what) const
{
label n = 0;
for (label typei = 0; typei < label(what); ++typei)
{
n += lists_[typei]->size();
}
return n;
}
Foam::label Foam::ensightFaces::total() const
{
label n = 0;
forAll(sizes_, typeI)
forAll(sizes_, typei)
{
n += sizes_[typeI];
n += sizes_[typei];
}
return n;
}
@ -215,16 +211,16 @@ Foam::label Foam::ensightFaces::total() const
void Foam::ensightFaces::clear()
{
sizes_ = Zero; // reset sizes
resize();
resizeAll();
}
void Foam::ensightFaces::reduce()
{
forAll(sizes_, typeI)
forAll(sizes_, typei)
{
sizes_[typeI] = lists_[typeI]->size();
Foam::reduce(sizes_[typeI], sumOp<label>());
sizes_[typei] = lists_[typei]->size();
Foam::reduce(sizes_[typei], sumOp<label>());
}
}
@ -238,9 +234,9 @@ void Foam::ensightFaces::sort()
labelList order;
label start = 0;
forAll(lists_, typeI)
forAll(lists_, typei)
{
SubList<label>& idLst = *(lists_[typeI]);
SubList<label>& idLst = *(lists_[typei]);
const label sz = idLst.size();
if (sz)
@ -258,9 +254,9 @@ void Foam::ensightFaces::sort()
else
{
// no flip-maps, simpler to sort
forAll(lists_, typeI)
forAll(lists_, typei)
{
Foam::sort(*(lists_[typeI]));
Foam::sort(*(lists_[typei]));
}
flipMap_.clear(); // for safety
}
@ -275,19 +271,19 @@ void Foam::ensightFaces::classify(const faceList& faces)
// Can avoid double looping, but only at the expense of allocation
sizes_ = Zero; // reset sizes
for (label listI = 0; listI < sz; ++listI)
for (label listi = 0; listi < sz; ++listi)
{
const enum elemType what = whatType(faces[listI]);
const enum elemType what = whatType(faces[listi]);
sizes_[what]++;
}
resize(); // adjust allocation
resizeAll(); // adjust allocation
sizes_ = Zero; // reset sizes
// Assign face-id per shape type
for (label listI = 0; listI < sz; ++listI)
for (label listi = 0; listi < sz; ++listi)
{
add(faces[listI], listI);
add(faces[listi], listi);
}
}
@ -310,9 +306,9 @@ void Foam::ensightFaces::classify
// Can avoid double looping, but only at the expense of allocation
sizes_ = Zero; // reset sizes
for (label listI = 0; listI < sz; ++listI)
for (label listi = 0; listi < sz; ++listi)
{
const label faceId = addressing[listI];
const label faceId = addressing[listi];
if (!exclude[faceId])
{
@ -321,7 +317,7 @@ void Foam::ensightFaces::classify
}
}
resize(); // adjust allocation
resizeAll(); // adjust allocation
sizes_ = Zero; // reset sizes
if (useFlip)
@ -331,10 +327,10 @@ void Foam::ensightFaces::classify
}
// Assign face-id per shape type
for (label listI = 0; listI < sz; ++listI)
for (label listi = 0; listi < sz; ++listi)
{
const label faceId = addressing[listI];
const bool flip = useFlip && flipMap[listI];
const label faceId = addressing[listi];
const bool flip = useFlip && flipMap[listi];
if (!exclude[faceId])
{
@ -343,11 +339,4 @@ void Foam::ensightFaces::classify
}
}
Foam::label Foam::ensightFaces::offset(const enum elemType what) const
{
return offset(what, 0);
}
// ************************************************************************* //

View File

@ -89,7 +89,8 @@ private:
//- Linear list of face-flips
boolList flipMap_;
//- List of global sizes for each element type
//- List of global sizes for each element type.
// Used temporarily for local sizes when building the element lists.
FixedList<label, 3> sizes_;
//- SubLists of ids for each element type.
@ -102,14 +103,11 @@ private:
//- Simple classifier
inline static elemType whatType(const face&);
//- Low-level addition routine
//- Low-level internal addition routine
inline void add(const face&, const label id, const bool flip = false);
//- Low-level offset routine
inline label offset(const enum elemType what, const label i) const;
//- Use current sizes to redimension the element lists
void resize();
//- Use temporarily stored sizes to redimension the element lists
void resizeAll();
//- Disallow default bitwise assignment
void operator=(const ensightFaces&) = delete;
@ -151,29 +149,26 @@ public:
// This value is only meaningful after a reduce operation.
label total() const;
//- The global numbers per element type.
// This value is only meaningful after a reduce operation.
inline const FixedList<label, 3>& totals() const;
//- The processor local sizes per element type.
FixedList<label, 3> sizes() const;
//- The global numbers per element type.
// This value is only meaningful after a reduce operation.
const FixedList<label, 3>& totals() const;
//- Processor local starting offset of element type.
label offset(const enum elemType what) const;
//- Return the (local) face ids of the specified element type
inline const labelUList& faceIds(const enum elemType) const;
//- Return the face ids of all elements
//- Return the processor local face ids of all elements
inline const labelUList& faceIds() const;
//- Return the flip-map of all elements
//- Return the processor local flip-map of all elements
inline const boolList& flipMap() const;
//- Starting offset of element type.
label offset(const enum elemType what) const;
// Edit
//- Classify the face types, set element list.

View File

@ -64,7 +64,7 @@ template<>
const char* Foam::NamedEnum
<
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
15
16
>::names[] =
{
"none",
@ -77,6 +77,7 @@ const char* Foam::NamedEnum
"areaAverage",
"weightedAreaAverage",
"areaIntegrate",
"weightedAreaIntegrate",
"min",
"max",
"CoV",
@ -93,7 +94,7 @@ const Foam::NamedEnum
const Foam::NamedEnum
<
Foam::functionObjects::fieldValues::surfaceFieldValue::operationType,
15
16
> Foam::functionObjects::fieldValues::surfaceFieldValue::operationTypeNames_;

View File

@ -109,14 +109,15 @@ Usage
sumDirectionBalance | sum of balance of values in given direction
average | ensemble average
weightedAverage | weighted average
areaAverage | area weighted average
areaAverage | area-weighted average
weightedAreaAverage | weighted area average
areaIntegrate | area integral
weightedAreaIntegrate | weighted area integral
min | minimum
max | maximum
CoV | coefficient of variation: standard deviation/mean
areaNormalAverage| area weighted average in face normal direction
areaNormalIntegrate | area weighted integral in face normal directon
areaNormalAverage| area-weighted average in face normal direction
areaNormalIntegrate | area-weighted integral in face normal directon
\endplaintable
Note
@ -210,6 +211,7 @@ public:
opAreaAverage, //!< Area average
opWeightedAreaAverage, //!< Weighted area average
opAreaIntegrate, //!< Area integral
opWeightedAreaIntegrate, //!< Weighted area integral
opMin, //!< Minimum
opMax, //!< Maximum
opCoV, //!< Coefficient of variation
@ -218,7 +220,7 @@ public:
};
//- Operation type names
static const NamedEnum<operationType, 15> operationTypeNames_;
static const NamedEnum<operationType, 16> operationTypeNames_;
private:

View File

@ -176,10 +176,9 @@ processSameTypeValues
}
case opWeightedAverage:
{
label wSize = returnReduce(weightField.size(), sumOp<label>());
if (wSize > 0)
if (returnReduce(weightField.size(), sumOp<label>()))
{
// has weights
result =
gSum(weightField*values)/(gSum(weightField) + ROOTVSMALL);
}
@ -192,31 +191,40 @@ processSameTypeValues
}
case opAreaAverage:
{
const scalarField magSf(mag(Sf));
const scalarField factor(mag(Sf));
result = gSum(magSf*values)/gSum(magSf);
result = gSum(factor*values)/gSum(factor);
break;
}
case opWeightedAreaAverage:
{
const scalarField magSf(mag(Sf));
label wSize = returnReduce(weightField.size(), sumOp<label>());
const scalarField factor
(
returnReduce(weightField.size(), sumOp<label>()) // has weights
? weightField*mag(Sf)
: mag(Sf)
);
if (wSize > 0)
{
result = gSum(weightField*magSf*values)/gSum(magSf*weightField);
}
else
{
result = gSum(magSf*values)/gSum(magSf);
}
result = gSum(factor*values)/gSum(factor);
break;
}
case opAreaIntegrate:
{
const scalarField magSf(mag(Sf));
const scalarField factor(mag(Sf));
result = gSum(magSf*values);
result = gSum(factor*values);
break;
}
case opWeightedAreaIntegrate:
{
const scalarField factor
(
returnReduce(weightField.size(), sumOp<label>()) // has weights
? weightField*mag(Sf)
: mag(Sf)
);
result = gSum(factor*values);
break;
}
case opMin:

View File

@ -16,8 +16,6 @@ targetType=libso
# echo
#fi
set -x
wmake $targetType renumberMethods
if [ -f "$BOOST_ARCH_PATH/include/boost/version.hpp" ] || \

View File

@ -31,6 +31,7 @@ License
#include "volPointInterpolation.H"
#include "PatchTools.H"
#include "mapPolyMesh.H"
#include "sampledTriSurfaceMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -84,6 +85,37 @@ void Foam::sampledSurfaces::writeGeometry() const
}
void Foam::sampledSurfaces::writeOriginalIds()
{
const word fieldName = "Ids";
const fileName outputDir = outputPath_/time_.timeName();
forAll(*this, surfI)
{
const sampledSurface& s = operator[](surfI);
if (isA<sampledTriSurfaceMesh>(s))
{
const sampledTriSurfaceMesh& surf =
dynamicCast<const sampledTriSurfaceMesh&>(s);
if (surf.keepIds())
{
const labelList& idLst = surf.originalIds();
Field<scalar> ids(idLst.size());
forAll(idLst, i)
{
ids[i] = idLst[i];
}
writeSurface(ids, surfI, fieldName, outputDir);
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::sampledSurfaces::sampledSurfaces

View File

@ -116,6 +116,9 @@ class sampledSurfaces
//- Write geometry only
void writeGeometry() const;
//- Write scalar field with original ids
void writeOriginalIds();
//- Write sampled fieldName on surface and on outputDir path
template<class Type>
void writeSurface

View File

@ -60,7 +60,6 @@ Foam::label Foam::sampledSurfaces::classifyFields()
{
// Check currently available fields
wordList allFields = obr_.sortedNames();
labelList indices = findStrings(fieldSelection_, allFields);
forAll(fieldSelection_, i)
{

View File

@ -49,9 +49,7 @@ void Foam::sampledSurfaces::writeSurface
gatheredValues[Pstream::myProcNo()] = values;
Pstream::gatherList(gatheredValues);
fileName sampleFile;
if (Pstream::master())
{
// Combine values into single field
@ -181,24 +179,21 @@ void Foam::sampledSurfaces::sampleAndWrite
template<class GeoField>
void Foam::sampledSurfaces::sampleAndWrite(const IOobjectList& objects)
{
wordList names;
wordList fieldNames;
if (loadFromFiles_)
{
IOobjectList fieldObjects(objects.lookupClass(GeoField::typeName));
names = fieldObjects.names();
fieldNames = objects.sortedNames(GeoField::typeName, fieldSelection_);
}
else
{
names = mesh_.thisDb().names<GeoField>();
fieldNames = mesh_.thisDb().sortedNames<GeoField>(fieldSelection_);
writeOriginalIds();
}
labelList nameIDs(findStrings(fieldSelection_, names));
wordHashSet fieldNames(wordList(names, nameIDs));
forAllConstIter(wordHashSet, fieldNames, iter)
forAll(fieldNames, fieldi)
{
const word& fieldName = iter.key();
const word& fieldName = fieldNames[fieldi];
if ((Pstream::master()) && verbose_)
{

View File

@ -296,6 +296,11 @@ bool Foam::sampledTriSurfaceMesh::update(const meshSearch& meshSearcher)
}
if (keepIds_)
{
originalIds_ = faceMap;
}
// Subset cellOrFaceLabels
cellOrFaceLabels = UIndirectList<label>(cellOrFaceLabels, faceMap)();
@ -545,6 +550,8 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
),
sampleSource_(sampleSource),
needsUpdate_(true),
keepIds_(false),
originalIds_(),
sampleElements_(0),
samplePoints_(0)
{}
@ -573,6 +580,8 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
),
sampleSource_(samplingSourceNames_[dict.lookup("source")]),
needsUpdate_(true),
keepIds_(dict.lookupOrDefault<Switch>("keepIds", false)),
originalIds_(),
sampleElements_(0),
samplePoints_(0)
{}
@ -603,6 +612,8 @@ Foam::sampledTriSurfaceMesh::sampledTriSurfaceMesh
),
sampleSource_(samplingSourceNames_[sampleSourceName]),
needsUpdate_(true),
keepIds_(false),
originalIds_(),
sampleElements_(0),
samplePoints_(0)
{}
@ -633,6 +644,7 @@ bool Foam::sampledTriSurfaceMesh::expire()
sampledSurface::clearGeom();
MeshStorage::clear();
originalIds_.clear();
boundaryTreePtr_.clear();
sampleElements_.clear();
samplePoints_.clear();

View File

@ -117,6 +117,13 @@ private:
//- Track if the surface needs an update
mutable bool needsUpdate_;
//- Retain element ids/order of original surface
bool keepIds_;
//- List of element ids/order of the original surface,
// when keepIds is active.
labelList originalIds_;
//- Search tree for all non-coupled boundary faces
mutable autoPtr<indexedOctree<treeDataFace>> boundaryTreePtr_;
@ -240,6 +247,19 @@ public:
return MeshStorage::Cf();
}
//- If element ids/order of the original surface are kept
bool keepIds() const
{
return keepIds_;
}
//- List of element ids/order of the original surface,
// when keepIds is active.
const labelList& originalIds() const
{
return originalIds_;
}
//- Sample field on surface
virtual tmp<scalarField> sample

View File

@ -7,6 +7,6 @@ cd ${0%/*} || exit 1 # Run from this directory
restore0Dir
runApplication blockMesh
runApplication $(getApplication) -writePhi -writep
runApplication streamFunction
runApplication postProcess -func streamFunction
#------------------------------------------------------------------------------

View File

@ -15,11 +15,11 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh solidBodyMotionFvMesh;
dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs ( "libfvMotionSolvers.so" );
solver solidBody;
solidBodyMotionFvMeshCoeffs
solidBodyCoeffs
{
cellZone rotating;

View File

@ -24,7 +24,7 @@ boundaryField
inlet
{
type outletMappedUniformInletHeatAddition;
outletPatchName outlet1;
outletPatch outlet1;
Q 5; // Heat addition in W
TMin 300;
TMax 500;

View File

@ -15,11 +15,11 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh solidBodyMotionFvMesh;
dynamicFvMesh dynamicMotionSolverFvMesh;
motionSolverLibs ( "libfvMotionSolvers.so" );
solver solidBody;
solidBodyMotionFvMeshCoeffs
solidBodyCoeffs
{
cellZone inletChannel;