mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of ssh://opencfd:8007/home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -526,7 +526,7 @@ $(Fields)/symmTensorField/symmTensorField.C
|
||||
$(Fields)/tensorField/tensorField.C
|
||||
$(Fields)/complexFields/complexFields.C
|
||||
|
||||
$(Fields)/labelField/labelIOField.
|
||||
$(Fields)/labelField/labelIOField.C
|
||||
$(Fields)/labelField/labelFieldIOField.C
|
||||
$(Fields)/scalarField/scalarIOField.C
|
||||
$(Fields)/scalarField/scalarFieldIOField.C
|
||||
|
||||
@ -51,8 +51,13 @@ class subCycleField
|
||||
//- Reference to the field being sub-cycled
|
||||
GeometricField& gf_;
|
||||
|
||||
//- Reference to the field old-time field being sub-cycled
|
||||
// Needed to avoid calls to oldTime() which may cause
|
||||
// unexpected updates of the old-time field
|
||||
GeometricField& gf0_;
|
||||
|
||||
//- Copy of the "real" old-time value of the field
|
||||
GeometricField gf0_;
|
||||
GeometricField gf_0_;
|
||||
|
||||
|
||||
public:
|
||||
@ -63,19 +68,33 @@ public:
|
||||
subCycleField(GeometricField& gf)
|
||||
:
|
||||
gf_(gf),
|
||||
gf0_(gf.oldTime())
|
||||
gf0_(gf.oldTime()),
|
||||
gf_0_(gf0_.name() + "_", gf0_)
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
~subCycleField()
|
||||
{
|
||||
// Reset the old-time field
|
||||
gf0_ = gf_0_;
|
||||
|
||||
// Correct the time index of the field to correspond to the global time
|
||||
gf_.timeIndex() = gf_.time().timeIndex();
|
||||
gf0_.timeIndex() = gf_.time().timeIndex();
|
||||
}
|
||||
|
||||
// Reset the old-time field value
|
||||
gf_.oldTime() = gf0_;
|
||||
gf_.oldTime().timeIndex() = gf0_.timeIndex();
|
||||
|
||||
//- Correct the time index of the field to correspond to
|
||||
// the sub-cycling time.
|
||||
//
|
||||
// The time index is incremented to protect the old-time value from
|
||||
// being updated at the beginning of the time-loop in the case of
|
||||
// outer iteration
|
||||
void updateTimeIndex()
|
||||
{
|
||||
gf_.timeIndex() = gf_.time().timeIndex() + 1;
|
||||
gf0_.timeIndex() = gf_.time().timeIndex() + 1;
|
||||
}
|
||||
};
|
||||
|
||||
@ -106,16 +125,18 @@ public:
|
||||
//- Construct field and number of sub-cycles
|
||||
subCycle(GeometricField& gf, const label nSubCycles)
|
||||
:
|
||||
|
||||
subCycleField<GeometricField>(gf),
|
||||
subCycleTime(const_cast<Time&>(gf.time()), nSubCycles)
|
||||
{}
|
||||
{
|
||||
// Update the field time index to correspond to the sub-cycle time
|
||||
this->updateTimeIndex();
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
// End the subCycleTime, which restores the time state
|
||||
~subCycle()
|
||||
{
|
||||
// End the subCycleTime, which restores the time state
|
||||
endSubCycle();
|
||||
}
|
||||
};
|
||||
|
||||
@ -324,6 +324,7 @@ Foam::Time::Time
|
||||
secondaryWriteControl_(wcTimeStep),
|
||||
secondaryWriteInterval_(labelMax/10.0), // bit less to allow calculations
|
||||
purgeWrite_(0),
|
||||
secondaryPurgeWrite_(0),
|
||||
writeOnce_(false),
|
||||
subCycling_(false),
|
||||
sigWriteNow_(true, *this),
|
||||
@ -416,6 +417,7 @@ Foam::Time::Time
|
||||
secondaryWriteControl_(wcTimeStep),
|
||||
secondaryWriteInterval_(labelMax/10.0),
|
||||
purgeWrite_(0),
|
||||
secondaryPurgeWrite_(0),
|
||||
writeOnce_(false),
|
||||
subCycling_(false),
|
||||
sigWriteNow_(true, *this),
|
||||
@ -511,6 +513,7 @@ Foam::Time::Time
|
||||
secondaryWriteControl_(wcTimeStep),
|
||||
secondaryWriteInterval_(labelMax/10.0),
|
||||
purgeWrite_(0),
|
||||
secondaryPurgeWrite_(0),
|
||||
writeOnce_(false),
|
||||
subCycling_(false),
|
||||
sigWriteNow_(true, *this),
|
||||
@ -608,6 +611,7 @@ Foam::Time::Time
|
||||
secondaryWriteControl_(wcTimeStep),
|
||||
secondaryWriteInterval_(labelMax/10.0),
|
||||
purgeWrite_(0),
|
||||
secondaryPurgeWrite_(0),
|
||||
writeOnce_(false),
|
||||
subCycling_(false),
|
||||
|
||||
@ -1070,11 +1074,13 @@ Foam::Time& Foam::Time::operator++()
|
||||
|
||||
|
||||
outputTime_ = false;
|
||||
primaryOutputTime_ = false;
|
||||
secondaryOutputTime_ = false;
|
||||
|
||||
switch (writeControl_)
|
||||
{
|
||||
case wcTimeStep:
|
||||
outputTime_ = !(timeIndex_ % label(writeInterval_));
|
||||
primaryOutputTime_ = !(timeIndex_ % label(writeInterval_));
|
||||
break;
|
||||
|
||||
case wcRunTime:
|
||||
@ -1088,7 +1094,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
|
||||
if (outputIndex > outputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
primaryOutputTime_ = true;
|
||||
outputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1103,7 +1109,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
);
|
||||
if (outputIndex > outputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
primaryOutputTime_ = true;
|
||||
outputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1118,7 +1124,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
);
|
||||
if (outputIndex > outputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
primaryOutputTime_ = true;
|
||||
outputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1130,9 +1136,8 @@ Foam::Time& Foam::Time::operator++()
|
||||
switch (secondaryWriteControl_)
|
||||
{
|
||||
case wcTimeStep:
|
||||
outputTime_ =
|
||||
outputTime_
|
||||
|| !(timeIndex_ % label(secondaryWriteInterval_));
|
||||
secondaryOutputTime_ =
|
||||
!(timeIndex_ % label(secondaryWriteInterval_));
|
||||
break;
|
||||
|
||||
case wcRunTime:
|
||||
@ -1146,7 +1151,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
|
||||
if (outputIndex > secondaryOutputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
secondaryOutputTime_ = true;
|
||||
secondaryOutputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1161,7 +1166,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
);
|
||||
if (outputIndex > secondaryOutputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
secondaryOutputTime_ = true;
|
||||
secondaryOutputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1176,7 +1181,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
);
|
||||
if (outputIndex > secondaryOutputTimeIndex_)
|
||||
{
|
||||
outputTime_ = true;
|
||||
secondaryOutputTime_ = true;
|
||||
secondaryOutputTimeIndex_ = outputIndex;
|
||||
}
|
||||
}
|
||||
@ -1184,6 +1189,9 @@ Foam::Time& Foam::Time::operator++()
|
||||
}
|
||||
|
||||
|
||||
outputTime_ = primaryOutputTime_ || secondaryOutputTime_;
|
||||
|
||||
|
||||
// see if endTime needs adjustment to stop at the next run()/end() check
|
||||
if (!end())
|
||||
{
|
||||
@ -1195,6 +1203,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
{
|
||||
endTime_ = value();
|
||||
outputTime_ = true;
|
||||
primaryOutputTime_ = true;
|
||||
}
|
||||
else if (stopAt_ == saNextWrite && outputTime_ == true)
|
||||
{
|
||||
@ -1205,6 +1214,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
// Override outputTime if one-shot writing
|
||||
if (writeOnce_)
|
||||
{
|
||||
primaryOutputTime_ = true;
|
||||
outputTime_ = true;
|
||||
writeOnce_ = false;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -138,10 +138,15 @@ protected:
|
||||
|
||||
scalar secondaryWriteInterval_;
|
||||
|
||||
|
||||
label purgeWrite_;
|
||||
mutable FIFOStack<word> previousOutputTimes_;
|
||||
|
||||
// Additional purging
|
||||
|
||||
label secondaryPurgeWrite_;
|
||||
mutable FIFOStack<word> previousSecondaryOutputTimes_;
|
||||
|
||||
|
||||
// One-shot writing
|
||||
bool writeOnce_;
|
||||
|
||||
|
||||
@ -160,6 +160,20 @@ void Foam::Time::readDict()
|
||||
}
|
||||
}
|
||||
|
||||
if (controlDict_.readIfPresent("secondaryPurgeWrite", secondaryPurgeWrite_))
|
||||
{
|
||||
if (secondaryPurgeWrite_ < 0)
|
||||
{
|
||||
WarningIn("Time::readDict()")
|
||||
<< "invalid value for secondaryPurgeWrite "
|
||||
<< secondaryPurgeWrite_
|
||||
<< ", should be >= 0, setting to 0"
|
||||
<< endl;
|
||||
|
||||
secondaryPurgeWrite_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (controlDict_.found("timeFormat"))
|
||||
{
|
||||
const word formatName(controlDict_.lookup("timeFormat"));
|
||||
@ -347,13 +361,45 @@ bool Foam::Time::writeObject
|
||||
timeDict.regIOobject::writeObject(fmt, ver, cmp);
|
||||
bool writeOK = objectRegistry::writeObject(fmt, ver, cmp);
|
||||
|
||||
if (writeOK && purgeWrite_)
|
||||
if (writeOK)
|
||||
{
|
||||
previousOutputTimes_.push(tmName);
|
||||
|
||||
while (previousOutputTimes_.size() > purgeWrite_)
|
||||
// Does primary or secondary time trigger purging?
|
||||
// Note that primary times can only be purged by primary
|
||||
// purging. Secondary times can be purged by either primary
|
||||
// or secondary purging.
|
||||
if (primaryOutputTime_ && purgeWrite_)
|
||||
{
|
||||
rmDir(objectRegistry::path(previousOutputTimes_.pop()));
|
||||
previousOutputTimes_.push(tmName);
|
||||
|
||||
while (previousOutputTimes_.size() > purgeWrite_)
|
||||
{
|
||||
rmDir(objectRegistry::path(previousOutputTimes_.pop()));
|
||||
}
|
||||
}
|
||||
if
|
||||
(
|
||||
!primaryOutputTime_
|
||||
&& secondaryOutputTime_
|
||||
&& secondaryPurgeWrite_
|
||||
)
|
||||
{
|
||||
// Writing due to secondary
|
||||
previousSecondaryOutputTimes_.push(tmName);
|
||||
|
||||
while
|
||||
(
|
||||
previousSecondaryOutputTimes_.size()
|
||||
> secondaryPurgeWrite_
|
||||
)
|
||||
{
|
||||
rmDir
|
||||
(
|
||||
objectRegistry::path
|
||||
(
|
||||
previousSecondaryOutputTimes_.pop()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -368,6 +414,7 @@ bool Foam::Time::writeObject
|
||||
|
||||
bool Foam::Time::writeNow()
|
||||
{
|
||||
primaryOutputTime_ = true;
|
||||
outputTime_ = true;
|
||||
return write();
|
||||
}
|
||||
|
||||
@ -37,7 +37,9 @@ Foam::TimeState::TimeState()
|
||||
deltaT0_(0),
|
||||
deltaTchanged_(false),
|
||||
outputTimeIndex_(0),
|
||||
primaryOutputTime_(false),
|
||||
secondaryOutputTimeIndex_(0),
|
||||
secondaryOutputTime_(false),
|
||||
outputTime_(false)
|
||||
{}
|
||||
|
||||
|
||||
@ -61,8 +61,14 @@ protected:
|
||||
bool deltaTchanged_;
|
||||
|
||||
label outputTimeIndex_;
|
||||
//- Is outputTime because of primary?
|
||||
bool primaryOutputTime_;
|
||||
|
||||
label secondaryOutputTimeIndex_;
|
||||
bool outputTime_;
|
||||
//- Is outputTime because of secondary?
|
||||
bool secondaryOutputTime_;
|
||||
|
||||
bool outputTime_;
|
||||
|
||||
public:
|
||||
|
||||
@ -112,7 +118,7 @@ public:
|
||||
|
||||
// Check
|
||||
|
||||
//- Return true if this is an output time
|
||||
//- Return true if this is an output time (primary or secondary)
|
||||
bool outputTime() const;
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -30,11 +30,8 @@ License
|
||||
namespace Foam
|
||||
{
|
||||
template<>
|
||||
const char* Foam::NamedEnum
|
||||
<
|
||||
Foam::outputFilterOutputControl::outputControls,
|
||||
2
|
||||
>::names[] =
|
||||
const char* NamedEnum<outputFilterOutputControl::outputControls, 2>::
|
||||
names[] =
|
||||
{
|
||||
"timeStep",
|
||||
"outputTime"
|
||||
|
||||
@ -372,6 +372,12 @@ Foam::dimensionSet Foam::sqrt(const dimensionSet& ds)
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionSet Foam::cbrt(const dimensionSet& ds)
|
||||
{
|
||||
return pow(ds, 1.0/3.0);
|
||||
}
|
||||
|
||||
|
||||
Foam::dimensionSet Foam::magSqr(const dimensionSet& ds)
|
||||
{
|
||||
return pow(ds, 2);
|
||||
|
||||
@ -76,6 +76,7 @@ dimensionSet pow6(const dimensionSet&);
|
||||
dimensionSet pow025(const dimensionSet&);
|
||||
|
||||
dimensionSet sqrt(const dimensionSet&);
|
||||
dimensionSet cbrt(const dimensionSet&);
|
||||
dimensionSet magSqr(const dimensionSet&);
|
||||
dimensionSet mag(const dimensionSet&);
|
||||
dimensionSet sign(const dimensionSet&);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -377,6 +377,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg, neg)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -85,6 +85,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg, neg)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -105,6 +105,7 @@ UNARY_FUNCTION(scalar, scalar, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -98,6 +98,7 @@ UNARY_FUNCTION(scalar, scalar, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg)
|
||||
|
||||
@ -128,6 +128,7 @@ UNARY_FUNCTION(scalar, scalar, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg)
|
||||
|
||||
@ -103,6 +103,7 @@ UNARY_FUNCTION(scalar, scalar, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg)
|
||||
|
||||
@ -47,7 +47,7 @@ GeometricBoundaryField
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const BoundaryMesh&, "
|
||||
"const Field<Type>&, const word&)"
|
||||
"const DimensionedField<Type>&, const word&)"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -84,8 +84,13 @@ GeometricBoundaryField
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const BoundaryMesh&, "
|
||||
"const Field<Type>&, const wordList&, const wordList&)"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const BoundaryMesh&, "
|
||||
"const DimensionedField<Type>&, "
|
||||
"const wordList&, "
|
||||
"const wordList&"
|
||||
")"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -99,8 +104,13 @@ GeometricBoundaryField
|
||||
(
|
||||
"GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const BoundaryMesh&, "
|
||||
"const Field<Type>&, const wordList&, const wordList&)"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const BoundaryMesh&, "
|
||||
"const DimensionedField<Type>&, "
|
||||
"const wordList&, "
|
||||
"const wordList&"
|
||||
")"
|
||||
) << "Incorrect number of patch type specifications given" << nl
|
||||
<< " Number of patches in mesh = " << bmesh.size()
|
||||
<< " number of patch type specifications = "
|
||||
@ -160,8 +170,12 @@ GeometricBoundaryField
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const BoundaryMesh&, "
|
||||
"const Field<Type>&, const PatchField<Type>List&)"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const BoundaryMesh&, "
|
||||
"const DimensionedField<Type, GeoMesh>&, "
|
||||
"const PtrLIst<PatchField<Type> >&"
|
||||
")"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -188,8 +202,12 @@ GeometricBoundaryField
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const GeometricBoundaryField<Type, "
|
||||
"PatchField, BoundaryMesh>&)"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const DimensionedField<Type, GeoMesh>&, "
|
||||
"const typename GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField&"
|
||||
")"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -220,8 +238,11 @@ GeometricBoundaryField
|
||||
{
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField(const GeometricBoundaryField<Type, "
|
||||
"PatchField, BoundaryMesh>&)"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField&"
|
||||
")"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -244,7 +265,11 @@ GeometricBoundaryField
|
||||
Info<< "GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField"
|
||||
"(const BoundaryMesh&, const Field<Type>&, const dictionary&)"
|
||||
"("
|
||||
"const BoundaryMesh&, "
|
||||
"const DimensionedField<Type, GeoMesh>&, "
|
||||
"const dictionary&"
|
||||
")"
|
||||
<< endl;
|
||||
}
|
||||
|
||||
@ -326,12 +351,13 @@ GeometricBoundaryField
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"GeometricField<Type, PatchField, GeoMesh>::\n"
|
||||
"GeometricBoundaryField::GeometricBoundaryField\n"
|
||||
"(\n"
|
||||
" const BoundaryMesh&,\n"
|
||||
" const DimensionedField<Type, GeoMesh>&,\n"
|
||||
" const dictionary&\n"
|
||||
"GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const BoundaryMesh&, "
|
||||
"const DimensionedField<Type, GeoMesh>&, "
|
||||
"const dictionary&"
|
||||
")",
|
||||
dict
|
||||
) << "Cannot find patchField entry for cyclic "
|
||||
@ -344,12 +370,13 @@ GeometricBoundaryField
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"GeometricField<Type, PatchField, GeoMesh>::\n"
|
||||
"GeometricBoundaryField::GeometricBoundaryField\n"
|
||||
"(\n"
|
||||
" const BoundaryMesh&,\n"
|
||||
" const DimensionedField<Type, GeoMesh>&,\n"
|
||||
" const dictionary&\n"
|
||||
"GeometricField<Type, PatchField, GeoMesh>::"
|
||||
"GeometricBoundaryField::"
|
||||
"GeometricBoundaryField"
|
||||
"("
|
||||
"const BoundaryMesh&, "
|
||||
"const DimensionedField<Type, GeoMesh>&, "
|
||||
"const dictionary&"
|
||||
")",
|
||||
dict
|
||||
) << "Cannot find patchField entry for "
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -448,6 +448,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg, neg)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -93,6 +93,7 @@ UNARY_FUNCTION(scalar, scalar, pow5, pow5)
|
||||
UNARY_FUNCTION(scalar, scalar, pow6, pow6)
|
||||
UNARY_FUNCTION(scalar, scalar, pow025, pow025)
|
||||
UNARY_FUNCTION(scalar, scalar, sqrt, sqrt)
|
||||
UNARY_FUNCTION(scalar, scalar, cbrt, cbrt)
|
||||
UNARY_FUNCTION(scalar, scalar, sign, sign)
|
||||
UNARY_FUNCTION(scalar, scalar, pos, pos)
|
||||
UNARY_FUNCTION(scalar, scalar, neg, neg)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,6 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "SlicedGeometricField.H"
|
||||
#include "processorFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -40,7 +41,8 @@ slicedBoundaryField
|
||||
(
|
||||
const Mesh& mesh,
|
||||
const Field<Type>& completeField,
|
||||
const bool preserveCouples
|
||||
const bool preserveCouples,
|
||||
const bool preserveProcessorOnly
|
||||
)
|
||||
{
|
||||
tmp<FieldField<PatchField, Type> > tbf
|
||||
@ -52,7 +54,15 @@ slicedBoundaryField
|
||||
|
||||
forAll(mesh.boundary(), patchi)
|
||||
{
|
||||
if (preserveCouples && mesh.boundary()[patchi].coupled())
|
||||
if
|
||||
(
|
||||
preserveCouples
|
||||
&& mesh.boundary()[patchi].coupled()
|
||||
&& (
|
||||
!preserveProcessorOnly
|
||||
|| isA<processorFvPatch>(mesh.boundary()[patchi])
|
||||
)
|
||||
)
|
||||
{
|
||||
// For coupled patched construct the correct patch field type
|
||||
bf.set
|
||||
@ -243,7 +253,8 @@ SlicedGeometricField
|
||||
const dimensionSet& ds,
|
||||
const Field<Type>& completeIField,
|
||||
const Field<Type>& completeBField,
|
||||
const bool preserveCouples
|
||||
const bool preserveCouples,
|
||||
const bool preserveProcessorOnly
|
||||
)
|
||||
:
|
||||
GeometricField<Type, PatchField, GeoMesh>
|
||||
@ -252,7 +263,13 @@ SlicedGeometricField
|
||||
mesh,
|
||||
ds,
|
||||
Field<Type>(),
|
||||
slicedBoundaryField(mesh, completeBField, preserveCouples)
|
||||
slicedBoundaryField
|
||||
(
|
||||
mesh,
|
||||
completeBField,
|
||||
preserveCouples,
|
||||
preserveProcessorOnly
|
||||
)
|
||||
)
|
||||
{
|
||||
// Set the internalField to the slice of the complete field
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -83,7 +83,8 @@ private:
|
||||
(
|
||||
const Mesh& mesh,
|
||||
const Field<Type>& completeField,
|
||||
const bool preserveCouples
|
||||
const bool preserveCouples,
|
||||
const bool preserveProcessorOnly = false
|
||||
);
|
||||
|
||||
//- Slice the given field and a create a PtrList of SlicedPatchField
|
||||
@ -133,7 +134,8 @@ public:
|
||||
const dimensionSet&,
|
||||
const Field<Type>& completeIField,
|
||||
const Field<Type>& completeBField,
|
||||
const bool preserveCouples=true
|
||||
const bool preserveCouples=true,
|
||||
const bool preserveProcessorOnly = false
|
||||
);
|
||||
|
||||
//- Construct from GeometricField. Reuses full internal and
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -303,14 +303,12 @@ void Foam::meshReader::createPolyBoundary()
|
||||
|
||||
Info<< "Added " << nMissingFaces << " unmatched faces" << endl;
|
||||
|
||||
// Add missing faces to last patch ('Default_Empty' etc.)
|
||||
if (nMissingFaces > 0)
|
||||
{
|
||||
patchSizes_.last() = nMissingFaces;
|
||||
}
|
||||
else
|
||||
{
|
||||
patchStarts_.setSize(patchStarts_.size() - 1);
|
||||
}
|
||||
|
||||
|
||||
// reset the size of the face list
|
||||
meshFaces_.setSize(nCreatedFaces);
|
||||
|
||||
@ -2,12 +2,10 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/fvMotionSolver/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
-I$(LIB_SRC)/fvMotionSolver/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh \
|
||||
-lfvMotionSolvers \
|
||||
-lsampling
|
||||
-lfvMotionSolvers
|
||||
|
||||
@ -41,8 +41,18 @@ namespace Foam
|
||||
fixedTemperatureSource,
|
||||
dictionary
|
||||
);
|
||||
|
||||
template<>
|
||||
const char* NamedEnum<fixedTemperatureSource::temperatureMode, 2>::names[] =
|
||||
{
|
||||
"constant",
|
||||
"lookup"
|
||||
};
|
||||
}
|
||||
|
||||
const Foam::NamedEnum<Foam::fixedTemperatureSource::temperatureMode, 2>
|
||||
Foam::fixedTemperatureSource::temperatureModeNames_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -55,8 +65,29 @@ Foam::fixedTemperatureSource::fixedTemperatureSource
|
||||
)
|
||||
:
|
||||
basicSource(name, modelType, dict, mesh),
|
||||
T_(readScalar(coeffs_.lookup("temperature")))
|
||||
mode_(temperatureModeNames_.read(coeffs_.lookup("mode"))),
|
||||
Tconstant_(0.0),
|
||||
TName_("T")
|
||||
{
|
||||
switch (mode_)
|
||||
{
|
||||
case tmConstant:
|
||||
{
|
||||
coeffs_.lookup("temperature") >> Tconstant_;
|
||||
break;
|
||||
}
|
||||
case tmLookup:
|
||||
{
|
||||
TName_ = coeffs_.lookupOrDefault<word>("TName", "T");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// error handling done by NamedEnum
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fieldNames_.setSize(1, "energy");
|
||||
applied_.setSize(1, false);
|
||||
}
|
||||
@ -81,8 +112,31 @@ void Foam::fixedTemperatureSource::setValue
|
||||
|
||||
if (eqn.psi().name() == thermo.he().name())
|
||||
{
|
||||
const scalarField Tfield(cells_.size(), T_);
|
||||
eqn.setValues(cells_, thermo.he(thermo.p(), Tfield, cells_));
|
||||
switch (mode_)
|
||||
{
|
||||
case tmConstant:
|
||||
{
|
||||
scalarField Tconst(cells_.size(), Tconstant_);
|
||||
eqn.setValues(cells_, thermo.he(thermo.p(), Tconst, cells_));
|
||||
|
||||
break;
|
||||
}
|
||||
case tmLookup:
|
||||
{
|
||||
const volScalarField& T =
|
||||
mesh().lookupObject<volScalarField>(TName_);
|
||||
|
||||
scalarField Tlookup(T, cells_);
|
||||
eqn.setValues(cells_, thermo.he(thermo.p(), Tlookup, cells_));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
// error handling done by NamedEnum
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +152,8 @@ bool Foam::fixedTemperatureSource::read(const dictionary& dict)
|
||||
{
|
||||
if (basicSource::read(dict))
|
||||
{
|
||||
coeffs_.readIfPresent("T", T_);
|
||||
coeffs_.readIfPresent("temperature", Tconstant_);
|
||||
coeffs_.readIfPresent("TName", TName_);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -33,7 +33,13 @@ Description
|
||||
fixedTemperatureSourceCoeffs
|
||||
{
|
||||
fieldNames (h e hs); // names of fields to apply source
|
||||
mode constant; // constant or lookup
|
||||
|
||||
// constant option
|
||||
temperature 500; // fixed temperature [K]
|
||||
|
||||
// loolup option
|
||||
// TName T; // optional temperature field name
|
||||
}
|
||||
|
||||
|
||||
@ -46,6 +52,7 @@ SourceFiles
|
||||
#define fixedTemperatureSource_H
|
||||
|
||||
#include "basicSource.H"
|
||||
#include "NamedEnum.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -61,12 +68,32 @@ class fixedTemperatureSource
|
||||
public basicSource
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//- Temperature mode
|
||||
enum temperatureMode
|
||||
{
|
||||
tmConstant,
|
||||
tmLookup
|
||||
};
|
||||
|
||||
|
||||
//- String representation of temperatureMode enums
|
||||
static const NamedEnum<temperatureMode, 2> temperatureModeNames_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Fixed temperature [K]
|
||||
scalar T_;
|
||||
//- Operation mode
|
||||
temperatureMode mode_;
|
||||
|
||||
//- Constant temperature [K]
|
||||
scalar Tconstant_;
|
||||
|
||||
//- Temperature field name
|
||||
word TName_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
@ -2,4 +2,17 @@ vtk/vtkUnstructuredReader.C
|
||||
nas/NASCore.C
|
||||
starcd/STARCDCore.C
|
||||
|
||||
coordSet/coordSet.C
|
||||
|
||||
setWriters = sampledSetWriters
|
||||
|
||||
$(setWriters)/writers.C
|
||||
$(setWriters)/ensight/ensightSetWriterRunTime.C
|
||||
$(setWriters)/gnuplot/gnuplotSetWriterRunTime.C
|
||||
$(setWriters)/jplot/jplotSetWriterRunTime.C
|
||||
$(setWriters)/raw/rawSetWriterRunTime.C
|
||||
$(setWriters)/vtk/vtkSetWriterRunTime.C
|
||||
$(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
|
||||
$(setWriters)/csv/csvSetWriterRunTime.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfileFormats
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,7 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "gnuplotSetWriter.H"
|
||||
#include "clock.H"
|
||||
#include "coordSet.H"
|
||||
#include "fileName.H"
|
||||
#include "OFstream.H"
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -166,7 +166,6 @@ void Foam::writer<Type>::write
|
||||
{
|
||||
valueSetPtrs[i] = &valueSets[i];
|
||||
}
|
||||
|
||||
write(points, valueSetNames, valueSetPtrs, os);
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -296,6 +296,12 @@ Foam::MRFZone::MRFZone
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::vector Foam::MRFZone::Omega() const
|
||||
{
|
||||
return omega_->value(mesh_.time().timeOutputValue())*axis_;
|
||||
}
|
||||
|
||||
|
||||
void Foam::MRFZone::addCoriolis
|
||||
(
|
||||
const volVectorField& U,
|
||||
@ -312,7 +318,7 @@ void Foam::MRFZone::addCoriolis
|
||||
vectorField& ddtUc = ddtU.internalField();
|
||||
const vectorField& Uc = U.internalField();
|
||||
|
||||
const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_;
|
||||
const vector Omega = this->Omega();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
@ -334,7 +340,7 @@ void Foam::MRFZone::addCoriolis(fvVectorMatrix& UEqn) const
|
||||
vectorField& Usource = UEqn.source();
|
||||
const vectorField& U = UEqn.psi();
|
||||
|
||||
const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_;
|
||||
const vector Omega = this->Omega();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
@ -360,7 +366,7 @@ void Foam::MRFZone::addCoriolis
|
||||
vectorField& Usource = UEqn.source();
|
||||
const vectorField& U = UEqn.psi();
|
||||
|
||||
const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_;
|
||||
const vector Omega = this->Omega();
|
||||
|
||||
forAll(cells, i)
|
||||
{
|
||||
@ -374,7 +380,7 @@ void Foam::MRFZone::relativeVelocity(volVectorField& U) const
|
||||
{
|
||||
const volVectorField& C = mesh_.C();
|
||||
|
||||
const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_;
|
||||
const vector Omega = this->Omega();
|
||||
|
||||
const labelList& cells = mesh_.cellZones()[cellZoneID_];
|
||||
|
||||
@ -412,7 +418,7 @@ void Foam::MRFZone::absoluteVelocity(volVectorField& U) const
|
||||
{
|
||||
const volVectorField& C = mesh_.C();
|
||||
|
||||
const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_;
|
||||
const vector Omega = this->Omega();
|
||||
|
||||
const labelList& cells = mesh_.cellZones()[cellZoneID_];
|
||||
|
||||
@ -480,7 +486,7 @@ void Foam::MRFZone::absoluteFlux
|
||||
|
||||
void Foam::MRFZone::correctBoundaryVelocity(volVectorField& U) const
|
||||
{
|
||||
const vector Omega = omega_->value(mesh_.time().timeOutputValue())*axis_;
|
||||
const vector Omega = this->Omega();
|
||||
|
||||
|
||||
// Included patches
|
||||
|
||||
@ -47,7 +47,7 @@ SourceFiles
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "fvMatricesFwd.H"
|
||||
#include "fvMatrices.H"
|
||||
#include "mapPolyMesh.H"
|
||||
#include "DataEntry.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
@ -164,6 +164,9 @@ public:
|
||||
//- Return const access to the MRF active flag
|
||||
inline bool active() const;
|
||||
|
||||
//- Return the current Omega vector
|
||||
vector Omega() const;
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fvMatrices.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -63,7 +63,19 @@ Foam::fixedJumpFvPatchField<Type>::fixedJumpFvPatchField
|
||||
:
|
||||
jumpCyclicFvPatchField<Type>(p, iF),
|
||||
jump_("jump", dict, p.size())
|
||||
{}
|
||||
{
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchField<Type>::operator=
|
||||
(
|
||||
Field<Type>("value", dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->evaluate(Pstream::blocking);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -63,7 +63,19 @@ Foam::fixedJumpAMIFvPatchField<Type>::fixedJumpAMIFvPatchField
|
||||
:
|
||||
jumpCyclicAMIFvPatchField<Type>(p, iF),
|
||||
jump_("jump", dict, p.size())
|
||||
{}
|
||||
{
|
||||
if (dict.found("value"))
|
||||
{
|
||||
fvPatchField<Type>::operator=
|
||||
(
|
||||
Field<Type>("value", dict, p.size())
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->evaluate(Pstream::blocking);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
|
||||
@ -53,7 +53,7 @@ timeVaryingMappedFixedValueFvPatchField
|
||||
endSampleTime_(-1),
|
||||
endSampledValues_(0),
|
||||
endAverage_(pTraits<Type>::zero),
|
||||
offSet_()
|
||||
offset_()
|
||||
{}
|
||||
|
||||
|
||||
@ -79,7 +79,7 @@ timeVaryingMappedFixedValueFvPatchField
|
||||
endSampleTime_(-1),
|
||||
endSampledValues_(0),
|
||||
endAverage_(pTraits<Type>::zero),
|
||||
offSet_()
|
||||
offset_()
|
||||
{}
|
||||
|
||||
|
||||
@ -104,7 +104,7 @@ timeVaryingMappedFixedValueFvPatchField
|
||||
endSampleTime_(-1),
|
||||
endSampledValues_(0),
|
||||
endAverage_(pTraits<Type>::zero),
|
||||
offSet_(DataEntry<Type>::New("offSet", dict))
|
||||
offset_(DataEntry<Type>::New("offset", dict))
|
||||
{
|
||||
dict.readIfPresent("fieldTableName", fieldTableName_);
|
||||
|
||||
@ -138,7 +138,7 @@ timeVaryingMappedFixedValueFvPatchField
|
||||
endSampleTime_(ptf.endSampleTime_),
|
||||
endSampledValues_(ptf.endSampledValues_),
|
||||
endAverage_(ptf.endAverage_),
|
||||
offSet_(ptf.offSet_().clone().ptr())
|
||||
offset_(ptf.offset_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
@ -163,7 +163,7 @@ timeVaryingMappedFixedValueFvPatchField
|
||||
endSampleTime_(ptf.endSampleTime_),
|
||||
endSampledValues_(ptf.endSampledValues_),
|
||||
endAverage_(ptf.endAverage_),
|
||||
offSet_(ptf.offSet_().clone().ptr())
|
||||
offset_(ptf.offset_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
@ -487,7 +487,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::updateCoeffs()
|
||||
|
||||
// apply offset to mapped values
|
||||
const scalar t = this->db().time().timeOutputValue();
|
||||
this->operator==(*this + offSet_->value(t));
|
||||
this->operator==(*this + offset_->value(t));
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -512,7 +512,7 @@ void timeVaryingMappedFixedValueFvPatchField<Type>::write(Ostream& os) const
|
||||
<< token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
offSet_->writeData(os);
|
||||
offset_->writeData(os);
|
||||
|
||||
this->writeEntry("value", os);
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ class timeVaryingMappedFixedValueFvPatchField
|
||||
Type endAverage_;
|
||||
|
||||
//- Time varying offset values to interpolated data
|
||||
autoPtr<DataEntry<Type> > offSet_;
|
||||
autoPtr<DataEntry<Type> > offset_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -73,6 +73,10 @@ Foam::uniformJumpAMIFvPatchField<Type>::uniformJumpAMIFvPatchField
|
||||
{
|
||||
fvPatchField<Type>::operator=(Field<Type>("value", dict, p.size()));
|
||||
}
|
||||
else
|
||||
{
|
||||
this->evaluate(Pstream::blocking);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -133,6 +133,8 @@ void fvMesh::makeC() const
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Construct as slices. Only preserve processor (not e.g. cyclic)
|
||||
|
||||
CPtr_ = new slicedVolVectorField
|
||||
(
|
||||
IOobject
|
||||
@ -148,33 +150,10 @@ void fvMesh::makeC() const
|
||||
*this,
|
||||
dimLength,
|
||||
cellCentres(),
|
||||
faceCentres()
|
||||
faceCentres(),
|
||||
true, //preserveCouples
|
||||
true //preserveProcOnly
|
||||
);
|
||||
|
||||
|
||||
// Need to correct for cyclics transformation since absolute quantity.
|
||||
// Ok on processor patches since hold opposite cell centre (no
|
||||
// transformation)
|
||||
slicedVolVectorField& C = *CPtr_;
|
||||
|
||||
forAll(C.boundaryField(), patchi)
|
||||
{
|
||||
if
|
||||
(
|
||||
isA<cyclicFvPatchVectorField>(C.boundaryField()[patchi])
|
||||
|| isA<cyclicAMIFvPatchVectorField>(C.boundaryField()[patchi])
|
||||
)
|
||||
{
|
||||
// Note: cyclic is not slice but proper field
|
||||
C.boundaryField()[patchi] == static_cast<const vectorField&>
|
||||
(
|
||||
static_cast<const List<vector>&>
|
||||
(
|
||||
boundary_[patchi].patchSlice(faceCentres())
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicMesh/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \
|
||||
|
||||
LIB_LIBS = \
|
||||
@ -10,4 +11,5 @@ LIB_LIBS = \
|
||||
-lmeshTools \
|
||||
-ldynamicMesh \
|
||||
-lfiniteVolume \
|
||||
-lfileFormats
|
||||
/*-lforces include in controlDict if needed */
|
||||
|
||||
@ -17,8 +17,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
-I$(LIB_SRC)/dynamicFvMesh/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
@ -42,5 +41,4 @@ LIB_LIBS = \
|
||||
-lincompressibleTransportModels \
|
||||
-lregionModels \
|
||||
-lsurfaceFilmModels \
|
||||
-ldynamicFvMesh \
|
||||
-lsampling
|
||||
-ldynamicFvMesh
|
||||
|
||||
@ -326,7 +326,7 @@ bool Foam::KinematicParcel<ParcelType>::move
|
||||
|
||||
p.age() += dt;
|
||||
|
||||
td.cloud().functions().postMove(p, cellI, dt);
|
||||
td.cloud().functions().postMove(p, cellI, dt, td.keepParticle);
|
||||
}
|
||||
|
||||
return td.keepParticle;
|
||||
@ -340,7 +340,7 @@ void Foam::KinematicParcel<ParcelType>::hitFace(TrackData& td)
|
||||
typename TrackData::cloudType::parcelType& p =
|
||||
static_cast<typename TrackData::cloudType::parcelType&>(*this);
|
||||
|
||||
td.cloud().functions().postFace(p, p.face());
|
||||
td.cloud().functions().postFace(p, p.face(), td.keepParticle);
|
||||
}
|
||||
|
||||
|
||||
@ -364,7 +364,14 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
|
||||
static_cast<typename TrackData::cloudType::parcelType&>(*this);
|
||||
|
||||
// Invoke post-processing model
|
||||
td.cloud().functions().postPatch(p, pp, trackFraction, tetIs);
|
||||
td.cloud().functions().postPatch
|
||||
(
|
||||
p,
|
||||
pp,
|
||||
trackFraction,
|
||||
tetIs,
|
||||
td.keepParticle
|
||||
);
|
||||
|
||||
// Invoke surface film model
|
||||
if (td.cloud().surfaceFilm().transferParcel(p, pp, td.keepParticle))
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -29,6 +29,7 @@ License
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "FacePostProcessing.H"
|
||||
#include "ParticleCollector.H"
|
||||
#include "ParticleErosion.H"
|
||||
#include "ParticleTracks.H"
|
||||
#include "ParticleTrap.H"
|
||||
@ -42,6 +43,7 @@ License
|
||||
makeCloudFunctionObject(CloudType); \
|
||||
\
|
||||
makeCloudFunctionObjectType(FacePostProcessing, CloudType); \
|
||||
makeCloudFunctionObjectType(ParticleCollector, CloudType); \
|
||||
makeCloudFunctionObjectType(ParticleErosion, CloudType); \
|
||||
makeCloudFunctionObjectType(ParticleTracks, CloudType); \
|
||||
makeCloudFunctionObjectType(ParticleTrap, CloudType); \
|
||||
|
||||
@ -96,7 +96,8 @@ void Foam::CloudFunctionObject<CloudType>::postMove
|
||||
(
|
||||
const typename CloudType::parcelType&,
|
||||
const label,
|
||||
const scalar
|
||||
const scalar,
|
||||
bool&
|
||||
)
|
||||
{
|
||||
// do nothing
|
||||
@ -109,7 +110,8 @@ void Foam::CloudFunctionObject<CloudType>::postPatch
|
||||
const typename CloudType::parcelType&,
|
||||
const polyPatch&,
|
||||
const scalar,
|
||||
const tetIndices&
|
||||
const tetIndices&,
|
||||
bool&
|
||||
)
|
||||
{
|
||||
// do nothing
|
||||
@ -120,7 +122,8 @@ template<class CloudType>
|
||||
void Foam::CloudFunctionObject<CloudType>::postFace
|
||||
(
|
||||
const typename CloudType::parcelType&,
|
||||
const label
|
||||
const label,
|
||||
bool&
|
||||
)
|
||||
{
|
||||
// do nothing
|
||||
|
||||
@ -46,6 +46,9 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class polyPatch;
|
||||
class tetIndices;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class CloudFunctionObject Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -134,7 +137,8 @@ public:
|
||||
(
|
||||
const typename CloudType::parcelType& p,
|
||||
const label cellI,
|
||||
const scalar dt
|
||||
const scalar dt,
|
||||
bool& keepParticle
|
||||
);
|
||||
|
||||
//- Post-patch hook
|
||||
@ -143,14 +147,16 @@ public:
|
||||
const typename CloudType::parcelType& p,
|
||||
const polyPatch& pp,
|
||||
const scalar trackFraction,
|
||||
const tetIndices& testIs
|
||||
const tetIndices& testIs,
|
||||
bool& keepParticle
|
||||
);
|
||||
|
||||
//- Post-face hook
|
||||
virtual void postFace
|
||||
(
|
||||
const typename CloudType::parcelType& p,
|
||||
const label faceI
|
||||
const label faceI,
|
||||
bool& keepParticle
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -132,12 +132,18 @@ void Foam::CloudFunctionObjectList<CloudType>::postMove
|
||||
(
|
||||
const typename CloudType::parcelType& p,
|
||||
const label cellI,
|
||||
const scalar dt
|
||||
const scalar dt,
|
||||
bool& keepParticle
|
||||
)
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).postMove(p, cellI, dt);
|
||||
this->operator[](i).postMove(p, cellI, dt, keepParticle);
|
||||
|
||||
if (!keepParticle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -148,12 +154,25 @@ void Foam::CloudFunctionObjectList<CloudType>::postPatch
|
||||
const typename CloudType::parcelType& p,
|
||||
const polyPatch& pp,
|
||||
const scalar trackFraction,
|
||||
const tetIndices& tetIs
|
||||
const tetIndices& tetIs,
|
||||
bool& keepParticle
|
||||
)
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).postPatch(p, pp, trackFraction, tetIs);
|
||||
this->operator[](i).postPatch
|
||||
(
|
||||
p,
|
||||
pp,
|
||||
trackFraction,
|
||||
tetIs,
|
||||
keepParticle
|
||||
);
|
||||
|
||||
if (!keepParticle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,12 +181,18 @@ template<class CloudType>
|
||||
void Foam::CloudFunctionObjectList<CloudType>::postFace
|
||||
(
|
||||
const typename CloudType::parcelType& p,
|
||||
const label faceI
|
||||
const label faceI,
|
||||
bool& keepParticle
|
||||
)
|
||||
{
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->operator[](i).postFace(p, faceI);
|
||||
this->operator[](i).postFace(p, faceI, keepParticle);
|
||||
|
||||
if (!keepParticle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -114,7 +114,8 @@ public:
|
||||
(
|
||||
const typename CloudType::parcelType& p,
|
||||
const label cellI,
|
||||
const scalar dt
|
||||
const scalar dt,
|
||||
bool& keepParticle
|
||||
);
|
||||
|
||||
//- Post-patch hook
|
||||
@ -123,14 +124,16 @@ public:
|
||||
const typename CloudType::parcelType& p,
|
||||
const polyPatch& pp,
|
||||
const scalar trackFraction,
|
||||
const tetIndices& tetIs
|
||||
const tetIndices& tetIs,
|
||||
bool& keepParticle
|
||||
);
|
||||
|
||||
//- Post-face hook
|
||||
virtual void postFace
|
||||
(
|
||||
const typename CloudType::parcelType& p,
|
||||
const label faceI
|
||||
const label faceI,
|
||||
bool& keepParticle
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -133,7 +133,7 @@ void Foam::FacePostProcessing<CloudType>::write()
|
||||
{
|
||||
OFstream& os = outputFilePtr_[zoneI];
|
||||
os << time.timeName() << token::TAB << sumMassTotal << token::TAB
|
||||
<< sumMassFlowRate<< endl;
|
||||
<< sumMassFlowRate<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,7 +376,8 @@ template<class CloudType>
|
||||
void Foam::FacePostProcessing<CloudType>::postFace
|
||||
(
|
||||
const parcelType& p,
|
||||
const label faceI
|
||||
const label faceI,
|
||||
bool&
|
||||
)
|
||||
{
|
||||
if
|
||||
|
||||
@ -160,7 +160,8 @@ public:
|
||||
virtual void postFace
|
||||
(
|
||||
const parcelType& p,
|
||||
const label faceI
|
||||
const label faceI,
|
||||
bool& keepParticle
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -0,0 +1,677 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ParticleCollector.H"
|
||||
#include "Pstream.H"
|
||||
#include "surfaceWriter.H"
|
||||
#include "unitConversion.H"
|
||||
#include "Random.H"
|
||||
#include "triangle.H"
|
||||
#include "cloud.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::ParticleCollector<CloudType>::makeLogFile
|
||||
(
|
||||
const faceList& faces,
|
||||
const Field<point>& points,
|
||||
const Field<scalar>& area
|
||||
)
|
||||
{
|
||||
// Create the output file if not already created
|
||||
if (log_)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating output file" << endl;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
const fileName logDir = outputDir_/this->owner().time().timeName();
|
||||
|
||||
// Create directory if does not exist
|
||||
mkDir(logDir);
|
||||
|
||||
// Open new file at start up
|
||||
outputFilePtr_.reset
|
||||
(
|
||||
new OFstream(logDir/(type() + ".dat"))
|
||||
);
|
||||
|
||||
outputFilePtr_()
|
||||
<< "# Source : " << type() << nl
|
||||
<< "# Total area : " << sum(area) << nl
|
||||
<< "# Time";
|
||||
|
||||
forAll(faces, i)
|
||||
{
|
||||
word id = Foam::name(i);
|
||||
|
||||
outputFilePtr_()
|
||||
<< tab << "area[" << id << "]"
|
||||
<< tab << "mass[" << id << "]"
|
||||
<< tab << "massFlowRate[" << id << "]"
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::ParticleCollector<CloudType>::initPolygons()
|
||||
{
|
||||
mode_ = mtPolygon;
|
||||
|
||||
List<Field<point> > polygons(this->coeffDict().lookup("polygons"));
|
||||
label nPoints = 0;
|
||||
forAll(polygons, polyI)
|
||||
{
|
||||
label np = polygons[polyI].size();
|
||||
if (np < 3)
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
"Foam::ParticleCollector<CloudType>::initPolygons()",
|
||||
this->coeffDict()
|
||||
)
|
||||
<< "polygons must consist of at least 3 points"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
nPoints += np;
|
||||
}
|
||||
|
||||
label pointOffset = 0;
|
||||
points_.setSize(nPoints);
|
||||
faces_.setSize(polygons.size());
|
||||
faceTris_.setSize(polygons.size());
|
||||
area_.setSize(polygons.size());
|
||||
forAll(faces_, faceI)
|
||||
{
|
||||
const Field<point>& polyPoints = polygons[faceI];
|
||||
face f(identity(polyPoints.size()) + pointOffset);
|
||||
UIndirectList<point>(points_, f) = polyPoints;
|
||||
area_[faceI] = f.mag(points_);
|
||||
|
||||
DynamicList<face> tris;
|
||||
f.triangles(points_, tris);
|
||||
faceTris_[faceI].transfer(tris);
|
||||
|
||||
faces_[faceI].transfer(f);
|
||||
|
||||
pointOffset += polyPoints.size();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::ParticleCollector<CloudType>::initConcentricCircles()
|
||||
{
|
||||
mode_ = mtConcentricCircle;
|
||||
|
||||
vector origin(this->coeffDict().lookup("origin"));
|
||||
|
||||
radius_ = this->coeffDict().lookup("radius");
|
||||
nSector_ = readLabel(this->coeffDict().lookup("nSector"));
|
||||
|
||||
label nS = nSector_;
|
||||
|
||||
vector refDir;
|
||||
if (nSector_ > 1)
|
||||
{
|
||||
refDir = this->coeffDict().lookup("refDir");
|
||||
refDir -= normal_*(normal_ & refDir);
|
||||
refDir /= mag(refDir);
|
||||
}
|
||||
else
|
||||
{
|
||||
// set 4 quadrants for single sector cases
|
||||
nS = 4;
|
||||
|
||||
vector tangent = vector::zero;
|
||||
scalar magTangent = 0.0;
|
||||
|
||||
Random rnd(1234);
|
||||
while (magTangent < SMALL)
|
||||
{
|
||||
vector v = rnd.vector01();
|
||||
|
||||
tangent = v - (v & normal_)*normal_;
|
||||
magTangent = mag(tangent);
|
||||
}
|
||||
|
||||
refDir = tangent/magTangent;
|
||||
}
|
||||
|
||||
scalar dTheta = 5.0;
|
||||
scalar dThetaSector = 360.0/scalar(nS);
|
||||
label intervalPerSector = max(1, ceil(dThetaSector/dTheta));
|
||||
dTheta = dThetaSector/scalar(intervalPerSector);
|
||||
|
||||
label nPointPerSector = intervalPerSector + 1;
|
||||
|
||||
label nPointPerRadius = nS*(nPointPerSector - 1);
|
||||
label nPoint = radius_.size()*nPointPerRadius;
|
||||
label nFace = radius_.size()*nS;
|
||||
|
||||
// add origin
|
||||
nPoint++;
|
||||
|
||||
points_.setSize(nPoint);
|
||||
faces_.setSize(nFace);
|
||||
area_.setSize(nFace);
|
||||
|
||||
coordSys_ = cylindricalCS("coordSys", origin, normal_, refDir, false);
|
||||
|
||||
List<label> ptIDs(identity(nPointPerRadius));
|
||||
|
||||
points_[0] = origin;
|
||||
|
||||
// points
|
||||
forAll(radius_, radI)
|
||||
{
|
||||
label pointOffset = radI*nPointPerRadius + 1;
|
||||
|
||||
for (label i = 0; i < nPointPerRadius; i++)
|
||||
{
|
||||
label pI = i + pointOffset;
|
||||
point pCyl(radius_[radI], degToRad(i*dTheta), 0.0);
|
||||
points_[pI] = coordSys_.globalPosition(pCyl);
|
||||
}
|
||||
}
|
||||
|
||||
// faces
|
||||
DynamicList<label> facePts(2*nPointPerSector);
|
||||
forAll(radius_, radI)
|
||||
{
|
||||
if (radI == 0)
|
||||
{
|
||||
for (label secI = 0; secI < nS; secI++)
|
||||
{
|
||||
facePts.clear();
|
||||
|
||||
// append origin point
|
||||
facePts.append(0);
|
||||
|
||||
for (label ptI = 0; ptI < nPointPerSector; ptI++)
|
||||
{
|
||||
label i = ptI + secI*(nPointPerSector - 1);
|
||||
label id = ptIDs.fcIndex(i - 1) + 1;
|
||||
facePts.append(id);
|
||||
}
|
||||
|
||||
label faceI = secI + radI*nS;
|
||||
|
||||
faces_[faceI] = face(facePts);
|
||||
area_[faceI] = faces_[faceI].mag(points_);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (label secI = 0; secI < nS; secI++)
|
||||
{
|
||||
facePts.clear();
|
||||
|
||||
label offset = (radI - 1)*nPointPerRadius + 1;
|
||||
|
||||
for (label ptI = 0; ptI < nPointPerSector; ptI++)
|
||||
{
|
||||
label i = ptI + secI*(nPointPerSector - 1);
|
||||
label id = offset + ptIDs.fcIndex(i - 1);
|
||||
facePts.append(id);
|
||||
}
|
||||
for (label ptI = nPointPerSector-1; ptI >= 0; ptI--)
|
||||
{
|
||||
label i = ptI + secI*(nPointPerSector - 1);
|
||||
label id = offset + nPointPerRadius + ptIDs.fcIndex(i - 1);
|
||||
facePts.append(id);
|
||||
}
|
||||
|
||||
label faceI = secI + radI*nS;
|
||||
|
||||
faces_[faceI] = face(facePts);
|
||||
area_[faceI] = faces_[faceI].mag(points_);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::ParticleCollector<CloudType>::collectParcelPolygon
|
||||
(
|
||||
const point& position,
|
||||
const vector& U
|
||||
) const
|
||||
{
|
||||
scalar dt = this->owner().db().time().deltaTValue();
|
||||
|
||||
point end(position + dt*U);
|
||||
|
||||
label dummyNearType = -1;
|
||||
label dummyNearLabel = -1;
|
||||
|
||||
forAll(faces_, faceI)
|
||||
{
|
||||
const label facePoint0 = faces_[faceI][0];
|
||||
|
||||
const point p0 = points_[facePoint0];
|
||||
|
||||
const scalar d1 = normal_ & (position - p0);
|
||||
const scalar d2 = normal_ & (end - p0);
|
||||
|
||||
if (sign(d1) == sign(d2))
|
||||
{
|
||||
// did not cross polygon plane
|
||||
continue;
|
||||
}
|
||||
|
||||
// intersection point
|
||||
point pIntersect = position + (d1/(d1 - d2))*dt*U;
|
||||
|
||||
const List<face>& tris = faceTris_[faceI];
|
||||
|
||||
// identify if point is within poly bounds
|
||||
forAll(tris, triI)
|
||||
{
|
||||
const face& tri = tris[triI];
|
||||
triPointRef t
|
||||
(
|
||||
points_[tri[0]],
|
||||
points_[tri[1]],
|
||||
points_[tri[2]]
|
||||
);
|
||||
|
||||
if (t.classify(pIntersect, dummyNearType, dummyNearLabel))
|
||||
{
|
||||
return faceI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::ParticleCollector<CloudType>::collectParcelConcentricCircles
|
||||
(
|
||||
const point& position,
|
||||
const vector& U
|
||||
) const
|
||||
{
|
||||
label secI = -1;
|
||||
|
||||
scalar dt = this->owner().db().time().deltaTValue();
|
||||
|
||||
point end(position + dt*U);
|
||||
|
||||
const scalar d1 = normal_ & (position - coordSys_.origin());
|
||||
const scalar d2 = normal_ & (end - coordSys_.origin());
|
||||
|
||||
if (sign(d1) == sign(d2))
|
||||
{
|
||||
// did not cross plane
|
||||
return secI;
|
||||
}
|
||||
|
||||
// intersection point in cylindrical co-ordinate system
|
||||
point pCyl = coordSys_.localPosition(position + (d1/(d1 - d2))*dt*U);
|
||||
|
||||
scalar r = pCyl[0];
|
||||
|
||||
if (r < radius_.last())
|
||||
{
|
||||
label radI = 0;
|
||||
while (r > radius_[radI])
|
||||
{
|
||||
radI++;
|
||||
}
|
||||
|
||||
if (nSector_ == 1)
|
||||
{
|
||||
secI = 4*radI;
|
||||
}
|
||||
else
|
||||
{
|
||||
scalar theta = pCyl[1] + constant::mathematical::pi;
|
||||
|
||||
secI =
|
||||
nSector_*radI
|
||||
+ floor
|
||||
(
|
||||
scalar(nSector_)*theta/constant::mathematical::twoPi
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return secI;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::ParticleCollector<CloudType>::write()
|
||||
{
|
||||
const fvMesh& mesh = this->owner().mesh();
|
||||
const Time& time = mesh.time();
|
||||
scalar timeNew = time.value();
|
||||
scalar timeElapsed = timeNew - timeOld_;
|
||||
|
||||
totalTime_ += timeElapsed;
|
||||
|
||||
const scalar alpha = (totalTime_ - timeElapsed)/totalTime_;
|
||||
const scalar beta = timeElapsed/totalTime_;
|
||||
|
||||
forAll(faces_, faceI)
|
||||
{
|
||||
massFlowRate_[faceI] =
|
||||
alpha*massFlowRate_[faceI] + beta*mass_[faceI]/timeElapsed;
|
||||
massTotal_[faceI] += mass_[faceI];
|
||||
}
|
||||
|
||||
const label procI = Pstream::myProcNo();
|
||||
|
||||
Info<< type() << " output:" << nl;
|
||||
|
||||
if (outputFilePtr_.valid())
|
||||
{
|
||||
outputFilePtr_() << time.timeName();
|
||||
}
|
||||
|
||||
|
||||
Field<scalar> faceMassTotal(mass_.size());
|
||||
Field<scalar> faceMassFlowRate(massFlowRate_.size());
|
||||
|
||||
forAll(faces_, faceI)
|
||||
{
|
||||
scalarList allProcMass(Pstream::nProcs());
|
||||
allProcMass[procI] = massTotal_[faceI];
|
||||
Pstream::gatherList(allProcMass);
|
||||
faceMassTotal[faceI] = sum(allProcMass);
|
||||
|
||||
scalarList allProcMassFlowRate(Pstream::nProcs());
|
||||
allProcMassFlowRate[procI] = massFlowRate_[faceI];
|
||||
Pstream::gatherList(allProcMassFlowRate);
|
||||
faceMassFlowRate[faceI] = sum(allProcMassFlowRate);
|
||||
|
||||
Info<< " face " << faceI
|
||||
<< ": total mass = " << faceMassTotal[faceI]
|
||||
<< "; average mass flow rate = " << faceMassFlowRate[faceI]
|
||||
<< nl;
|
||||
|
||||
if (outputFilePtr_.valid())
|
||||
{
|
||||
outputFilePtr_()
|
||||
<< tab << area_[faceI]
|
||||
<< tab << faceMassTotal[faceI]
|
||||
<< tab << faceMassFlowRate[faceI]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
|
||||
|
||||
if (surfaceFormat_ != "none")
|
||||
{
|
||||
if (Pstream::master())
|
||||
{
|
||||
autoPtr<surfaceWriter> writer(surfaceWriter::New(surfaceFormat_));
|
||||
|
||||
writer->write
|
||||
(
|
||||
outputDir_/time.timeName(),
|
||||
"collector",
|
||||
points_,
|
||||
faces_,
|
||||
"massTotal",
|
||||
faceMassTotal,
|
||||
false
|
||||
);
|
||||
|
||||
writer->write
|
||||
(
|
||||
outputDir_/time.timeName(),
|
||||
"collector",
|
||||
points_,
|
||||
faces_,
|
||||
"massFlowRate",
|
||||
faceMassFlowRate,
|
||||
false
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (resetOnWrite_)
|
||||
{
|
||||
forAll(faces_, faceI)
|
||||
{
|
||||
massFlowRate_[faceI] = 0.0;
|
||||
}
|
||||
timeOld_ = timeNew;
|
||||
totalTime_ = 0.0;
|
||||
}
|
||||
|
||||
forAll(faces_, faceI)
|
||||
{
|
||||
mass_[faceI] = 0.0;
|
||||
}
|
||||
|
||||
// writeProperties();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::ParticleCollector<CloudType>::ParticleCollector
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
CloudFunctionObject<CloudType>(dict, owner, typeName),
|
||||
mode_(mtUnknown),
|
||||
parcelType_(this->coeffDict().lookupOrDefault("parcelType", -1)),
|
||||
removeCollected_(this->coeffDict().lookup("removeCollected")),
|
||||
points_(),
|
||||
faces_(),
|
||||
faceTris_(),
|
||||
nSector_(0),
|
||||
radius_(),
|
||||
coordSys_(false),
|
||||
normal_(this->coeffDict().lookup("normal")),
|
||||
negateParcelsOppositeNormal_
|
||||
(
|
||||
readBool(this->coeffDict().lookup("negateParcelsOppositeNormal"))
|
||||
),
|
||||
surfaceFormat_(this->coeffDict().lookup("surfaceFormat")),
|
||||
resetOnWrite_(this->coeffDict().lookup("resetOnWrite")),
|
||||
totalTime_(0.0),
|
||||
mass_(),
|
||||
massTotal_(),
|
||||
massFlowRate_(),
|
||||
log_(this->coeffDict().lookup("log")),
|
||||
outputFilePtr_(),
|
||||
outputDir_(owner.mesh().time().path()),
|
||||
timeOld_(owner.mesh().time().value())
|
||||
{
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
outputDir_ =
|
||||
outputDir_/".."/"postProcessing"/cloud::prefix/owner.name();
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir_ =
|
||||
outputDir_/"postProcessing"/cloud::prefix/owner.name();
|
||||
}
|
||||
|
||||
normal_ /= mag(normal_);
|
||||
|
||||
word mode(this->coeffDict().lookup("mode"));
|
||||
if (mode == "polygon")
|
||||
{
|
||||
initPolygons();
|
||||
}
|
||||
else if (mode == "concentricCircle")
|
||||
{
|
||||
initConcentricCircles();
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::ParticleCollector<CloudType>::ParticleCollector"
|
||||
"("
|
||||
"const dictionary& dict,"
|
||||
"CloudType& owner"
|
||||
")"
|
||||
)
|
||||
<< "Unknown mode " << mode << ". Available options are "
|
||||
<< "polygon and concentricCircle" << exit(FatalError);
|
||||
}
|
||||
|
||||
mass_.setSize(faces_.size(), 0.0);
|
||||
massTotal_.setSize(faces_.size(), 0.0);
|
||||
massFlowRate_.setSize(faces_.size(), 0.0);
|
||||
|
||||
makeLogFile(faces_, points_, area_);
|
||||
|
||||
// readProperties(); AND initialise mass... fields
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::ParticleCollector<CloudType>::ParticleCollector
|
||||
(
|
||||
const ParticleCollector<CloudType>& pc
|
||||
)
|
||||
:
|
||||
CloudFunctionObject<CloudType>(pc),
|
||||
mode_(pc.mode_),
|
||||
parcelType_(pc.parcelType_),
|
||||
points_(pc.points_),
|
||||
faces_(pc.faces_),
|
||||
faceTris_(pc.faceTris_),
|
||||
nSector_(pc.nSector_),
|
||||
radius_(pc.radius_),
|
||||
coordSys_(pc.coordSys_),
|
||||
normal_(pc.normal_),
|
||||
negateParcelsOppositeNormal_(pc.negateParcelsOppositeNormal_),
|
||||
surfaceFormat_(pc.surfaceFormat_),
|
||||
resetOnWrite_(pc.resetOnWrite_),
|
||||
totalTime_(pc.totalTime_),
|
||||
mass_(pc.mass_),
|
||||
massTotal_(pc.massTotal_),
|
||||
massFlowRate_(pc.massFlowRate_),
|
||||
log_(pc.log_),
|
||||
outputFilePtr_(),
|
||||
outputDir_(pc.outputDir_),
|
||||
timeOld_(0.0)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::ParticleCollector<CloudType>::~ParticleCollector()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::ParticleCollector<CloudType>::postMove
|
||||
(
|
||||
const parcelType& p,
|
||||
const label cellI,
|
||||
const scalar dt,
|
||||
bool& keepParticle
|
||||
)
|
||||
{
|
||||
if ((parcelType_ != -1) && (parcelType_ != p.typeId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
label faceI = -1;
|
||||
|
||||
switch (mode_)
|
||||
{
|
||||
case mtPolygon:
|
||||
{
|
||||
faceI = collectParcelPolygon(p.position(), p.U());
|
||||
break;
|
||||
}
|
||||
case mtConcentricCircle:
|
||||
{
|
||||
faceI = collectParcelConcentricCircles(p.position(), p.U());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
if (faceI != -1)
|
||||
{
|
||||
scalar m = p.nParticle()*p.mass();
|
||||
|
||||
if (negateParcelsOppositeNormal_)
|
||||
{
|
||||
vector Uhat = p.U();
|
||||
Uhat /= mag(Uhat) + ROOTVSMALL;
|
||||
if ((Uhat & normal_) < 0)
|
||||
{
|
||||
m *= -1.0;
|
||||
}
|
||||
}
|
||||
|
||||
// add mass contribution
|
||||
mass_[faceI] += m;
|
||||
|
||||
if (nSector_ == 1)
|
||||
{
|
||||
mass_[faceI + 1] += m;
|
||||
mass_[faceI + 2] += m;
|
||||
mass_[faceI + 3] += m;
|
||||
}
|
||||
|
||||
if (removeCollected_)
|
||||
{
|
||||
keepParticle = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,259 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::ParticleCollector
|
||||
|
||||
Description
|
||||
Function object to collect the parcel mass- and mass flow rate over a
|
||||
set of polygons. The polygons are defined as lists of points. If a
|
||||
parcel is 'collected', it is subsequently flagged to be removed from the
|
||||
domain.
|
||||
|
||||
SourceFiles
|
||||
ParticleCollector.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ParticleCollector_H
|
||||
#define ParticleCollector_H
|
||||
|
||||
#include "CloudFunctionObject.H"
|
||||
#include "cylindricalCS.H"
|
||||
#include "face.H"
|
||||
#include "Switch.H"
|
||||
#include "OFstream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ParticleCollector Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
class ParticleCollector
|
||||
:
|
||||
public CloudFunctionObject<CloudType>
|
||||
{
|
||||
public:
|
||||
|
||||
enum modeType
|
||||
{
|
||||
mtPolygon,
|
||||
mtConcentricCircle,
|
||||
mtUnknown
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Data
|
||||
|
||||
// Typedefs
|
||||
|
||||
//- Convenience typedef for parcel type
|
||||
typedef typename CloudType::parcelType parcelType;
|
||||
|
||||
//- Collector mode type
|
||||
modeType mode_;
|
||||
|
||||
//- Index of parcel types to collect (-1 by default = all particles)
|
||||
const label parcelType_;
|
||||
|
||||
//- Flag to remove collected particles
|
||||
Switch removeCollected_;
|
||||
|
||||
//- List of points
|
||||
Field<point> points_;
|
||||
|
||||
//- List of faces
|
||||
List<face> faces_;
|
||||
|
||||
|
||||
// Polygon collector
|
||||
|
||||
//- Triangulation of faces
|
||||
List<List<face> > faceTris_;
|
||||
|
||||
// Concentric circles collector
|
||||
|
||||
//- Number of sectors per circle
|
||||
label nSector_;
|
||||
|
||||
//- List of radii
|
||||
List<scalar> radius_;
|
||||
|
||||
//- Cylindrical co-ordinate system
|
||||
cylindricalCS coordSys_;
|
||||
|
||||
|
||||
//- Face areas
|
||||
Field<scalar> area_;
|
||||
|
||||
//- Polygon normal vector
|
||||
vector normal_;
|
||||
|
||||
//- Remove mass of parcel travelling in opposite direction to normal_
|
||||
bool negateParcelsOppositeNormal_;
|
||||
|
||||
//- Surface output format
|
||||
const word surfaceFormat_;
|
||||
|
||||
//- Flag to indicate whether data should be reset/cleared on writing
|
||||
Switch resetOnWrite_;
|
||||
|
||||
//- Total time
|
||||
scalar totalTime_;
|
||||
|
||||
//- Mass storage
|
||||
List<scalar> mass_;
|
||||
|
||||
//- Mass total storage
|
||||
List<scalar> massTotal_;
|
||||
|
||||
//- Mass flow rate storage
|
||||
List<scalar> massFlowRate_;
|
||||
|
||||
//- Flag to indicate whether data should be written to file
|
||||
Switch log_;
|
||||
|
||||
//- Output file pointer
|
||||
autoPtr<OFstream> outputFilePtr_;
|
||||
|
||||
//- Output directory
|
||||
fileName outputDir_;
|
||||
|
||||
//- Last calculation time
|
||||
scalar timeOld_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Helper function to create log files
|
||||
void makeLogFile
|
||||
(
|
||||
const faceList& faces,
|
||||
const Field<point>& points,
|
||||
const Field<scalar>& area
|
||||
);
|
||||
|
||||
//- Initialise polygon collectors
|
||||
void initPolygons();
|
||||
|
||||
//- Initialise concentric circle collectors
|
||||
void initConcentricCircles();
|
||||
|
||||
//- Collect parcels in polygon collectors
|
||||
label collectParcelPolygon
|
||||
(
|
||||
const point& position,
|
||||
const vector& U
|
||||
) const;
|
||||
|
||||
//- Collect parcels in concentric circle collectors
|
||||
label collectParcelConcentricCircles
|
||||
(
|
||||
const point& position,
|
||||
const vector& U
|
||||
) const;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Write post-processing info
|
||||
void write();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("particleCollector");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
ParticleCollector(const dictionary& dict, CloudType& owner);
|
||||
|
||||
//- Construct copy
|
||||
ParticleCollector(const ParticleCollector<CloudType>& pc);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual autoPtr<CloudFunctionObject<CloudType> > clone() const
|
||||
{
|
||||
return autoPtr<CloudFunctionObject<CloudType> >
|
||||
(
|
||||
new ParticleCollector<CloudType>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~ParticleCollector();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return const access to the reset on write flag
|
||||
inline const Switch& resetOnWrite() const;
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Post-move hook
|
||||
virtual void postMove
|
||||
(
|
||||
const parcelType& p,
|
||||
const label cellI,
|
||||
const scalar dt,
|
||||
bool& keepParticle
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "ParticleCollectorI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "ParticleCollector.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,34 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
inline const Foam::Switch&
|
||||
Foam::ParticleCollector<CloudType>::resetOnWrite() const
|
||||
{
|
||||
return resetOnWrite_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -168,7 +168,8 @@ void Foam::ParticleErosion<CloudType>::postPatch
|
||||
const parcelType& p,
|
||||
const polyPatch& pp,
|
||||
const scalar trackFraction,
|
||||
const tetIndices& tetIs
|
||||
const tetIndices& tetIs,
|
||||
bool&
|
||||
)
|
||||
{
|
||||
const label patchI = pp.index();
|
||||
|
||||
@ -128,7 +128,8 @@ public:
|
||||
const parcelType& p,
|
||||
const polyPatch& pp,
|
||||
const scalar trackFraction,
|
||||
const tetIndices& tetIs
|
||||
const tetIndices& tetIs,
|
||||
bool& keepParticle
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -112,7 +112,8 @@ template<class CloudType>
|
||||
void Foam::ParticleTracks<CloudType>::postFace
|
||||
(
|
||||
const parcelType& p,
|
||||
const label
|
||||
const label,
|
||||
bool&
|
||||
)
|
||||
{
|
||||
if
|
||||
|
||||
@ -143,7 +143,8 @@ public:
|
||||
virtual void postFace
|
||||
(
|
||||
const parcelType& p,
|
||||
const label faceI
|
||||
const label faceI,
|
||||
bool& keepParticle
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -104,7 +104,8 @@ void Foam::ParticleTrap<CloudType>::postMove
|
||||
(
|
||||
parcelType& p,
|
||||
const label cellI,
|
||||
const scalar
|
||||
const scalar,
|
||||
bool&
|
||||
)
|
||||
{
|
||||
if (alphaPtr_->internalField()[cellI] < threshold_)
|
||||
|
||||
@ -125,7 +125,8 @@ public:
|
||||
(
|
||||
typename CloudType::parcelType& p,
|
||||
const label cellI,
|
||||
const scalar dt
|
||||
const scalar dt,
|
||||
bool& keepParticle
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -220,7 +220,8 @@ void Foam::PatchPostProcessing<CloudType>::postPatch
|
||||
const parcelType& p,
|
||||
const polyPatch& pp,
|
||||
const scalar,
|
||||
const tetIndices& tetIs
|
||||
const tetIndices& tetIs,
|
||||
bool&
|
||||
)
|
||||
{
|
||||
const label patchI = pp.index();
|
||||
|
||||
@ -129,7 +129,8 @@ public:
|
||||
const parcelType& p,
|
||||
const polyPatch& pp,
|
||||
const scalar trackFraction,
|
||||
const tetIndices& tetIs
|
||||
const tetIndices& tetIs,
|
||||
bool& keepParticle
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -125,7 +125,8 @@ void Foam::VoidFraction<CloudType>::postMove
|
||||
(
|
||||
const parcelType& p,
|
||||
const label cellI,
|
||||
const scalar dt
|
||||
const scalar dt,
|
||||
bool&
|
||||
)
|
||||
{
|
||||
volScalarField& theta = thetaPtr_();
|
||||
|
||||
@ -115,7 +115,8 @@ public:
|
||||
(
|
||||
const parcelType& p,
|
||||
const label cellI,
|
||||
const scalar dt
|
||||
const scalar dt,
|
||||
bool& keepParticle
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@ -302,13 +302,15 @@ void Foam::PairCollision<CloudType>::wallInteraction()
|
||||
|
||||
if (particleHit)
|
||||
{
|
||||
this->owner().functions().postFace(p, realFaceI);
|
||||
bool keep = true;
|
||||
this->owner().functions().postFace(p, realFaceI, keep);
|
||||
this->owner().functions().postPatch
|
||||
(
|
||||
p,
|
||||
mesh.boundaryMesh()[patchI],
|
||||
1.0,
|
||||
p.currentTetIndices()
|
||||
p.currentTetIndices(),
|
||||
keep
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -398,13 +398,15 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
|
||||
// surface energy of secondary parcels [J]
|
||||
scalar ESigmaSec = 0;
|
||||
|
||||
// sample splash distribution to detrmine secondary parcel diameters
|
||||
// sample splash distribution to determine secondary parcel diameters
|
||||
scalarList dNew(parcelsPerSplash_);
|
||||
scalarList npNew(parcelsPerSplash_);
|
||||
forAll(dNew, i)
|
||||
{
|
||||
const scalar y = rndGen_.sample01<scalar>();
|
||||
dNew[i] = -dBarSplash*log(exp(-dMin/dBarSplash) - y*K);
|
||||
ESigmaSec += sigma*p.areaS(dNew[i]);
|
||||
npNew[i] = mRatio*np*pow3(d)/pow3(dNew[i])/parcelsPerSplash_;
|
||||
ESigmaSec += npNew[i]*sigma*p.areaS(dNew[i]);
|
||||
}
|
||||
|
||||
// incident kinetic energy [J]
|
||||
@ -459,7 +461,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::splashInteraction
|
||||
// perturb new parcels towards the owner cell centre
|
||||
pPtr->position() += 0.5*rndGen_.sample01<scalar>()*(posC - posCf);
|
||||
|
||||
pPtr->nParticle() = mRatio*np*pow3(d)/pow3(dNew[i])/parcelsPerSplash_;
|
||||
pPtr->nParticle() = npNew[i];
|
||||
|
||||
pPtr->d() = dNew[i];
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/edgeMesh/lnInclude \
|
||||
-I$(LIB_SRC)/surfMesh/lnInclude \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude
|
||||
@ -13,6 +14,7 @@ LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-llagrangian \
|
||||
-lmeshTools \
|
||||
-lfileFormats \
|
||||
-ledgeMesh \
|
||||
-lsurfMesh \
|
||||
-ltriSurface \
|
||||
|
||||
@ -167,7 +167,7 @@ class autoSnapDriver
|
||||
void correctAttraction
|
||||
(
|
||||
const DynamicList<point>& surfacePoints,
|
||||
const DynamicList<label>& surfaceCount,
|
||||
const DynamicList<label>& surfaceCounts,
|
||||
const point& edgePt,
|
||||
const vector& edgeNormal, // normalised normal
|
||||
const point& pt,
|
||||
@ -213,7 +213,7 @@ class autoSnapDriver
|
||||
|
||||
DynamicList<point>& surfacePoints,
|
||||
DynamicList<vector>& surfaceNormals,
|
||||
DynamicList<label>& surfaceCount
|
||||
DynamicList<label>& surfaceCounts
|
||||
) const;
|
||||
void binFeatureFaces
|
||||
(
|
||||
@ -224,13 +224,13 @@ class autoSnapDriver
|
||||
const scalarField& snapDist,
|
||||
const label pointI,
|
||||
|
||||
const List<List<point> >& pointFaceNormals,
|
||||
const List<List<point> >& pointFaceSurfNormals,
|
||||
const List<List<point> >& pointFaceDisp,
|
||||
const List<List<point> >& pointFaceCentres,
|
||||
|
||||
DynamicList<point>& surfacePoints,
|
||||
DynamicList<vector>& surfaceNormals,
|
||||
DynamicList<label>& surfaceCount
|
||||
DynamicList<label>& surfaceCounts
|
||||
) const;
|
||||
|
||||
|
||||
@ -259,7 +259,7 @@ class autoSnapDriver
|
||||
const indirectPrimitivePatch& pp,
|
||||
const scalarField& snapDist,
|
||||
|
||||
const List<List<point> >& pointFaceNormals,
|
||||
const List<List<point> >& pointFaceSurfNormals,
|
||||
const List<List<point> >& pointFaceDisp,
|
||||
const List<List<point> >& pointFaceCentres,
|
||||
const labelListList& pointFacePatchID,
|
||||
@ -277,7 +277,7 @@ class autoSnapDriver
|
||||
const indirectPrimitivePatch&,
|
||||
const scalarField&,
|
||||
|
||||
const List<List<point> >& pointFaceNormals,
|
||||
const List<List<point> >& pointFaceSurfNormals,
|
||||
const List<List<point> >& pointFaceDisp,
|
||||
const List<List<point> >& pointFaceCentres,
|
||||
const labelListList& pointFacePatchID,
|
||||
|
||||
@ -690,7 +690,7 @@ void Foam::autoSnapDriver::calcNearestFacePointProperties
|
||||
void Foam::autoSnapDriver::correctAttraction
|
||||
(
|
||||
const DynamicList<point>& surfacePoints,
|
||||
const DynamicList<label>& surfaceCount,
|
||||
const DynamicList<label>& surfaceCounts,
|
||||
const point& edgePt,
|
||||
const vector& edgeNormal, // normalised normal
|
||||
const point& pt,
|
||||
@ -702,7 +702,7 @@ void Foam::autoSnapDriver::correctAttraction
|
||||
scalar tang = ((pt-edgePt)&edgeNormal);
|
||||
|
||||
labelList order;
|
||||
Foam::sortedOrder(surfaceCount, order);
|
||||
Foam::sortedOrder(surfaceCounts, order);
|
||||
|
||||
if (order[0] < order[1])
|
||||
{
|
||||
@ -763,7 +763,7 @@ void Foam::autoSnapDriver::binFeatureFace
|
||||
|
||||
DynamicList<point>& surfacePoints,
|
||||
DynamicList<vector>& surfaceNormals,
|
||||
DynamicList<label>& surfaceCount
|
||||
DynamicList<label>& surfaceCounts
|
||||
) const
|
||||
{
|
||||
// What to do with very far attraction? For now just ignore the face
|
||||
@ -783,7 +783,7 @@ void Foam::autoSnapDriver::binFeatureFace
|
||||
)
|
||||
{
|
||||
same = true;
|
||||
surfaceCount[j]++;
|
||||
surfaceCounts[j]++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -796,7 +796,7 @@ void Foam::autoSnapDriver::binFeatureFace
|
||||
{
|
||||
surfacePoints.append(pt);
|
||||
surfaceNormals.append(faceSurfaceNormal);
|
||||
surfaceCount.append(1);
|
||||
surfaceCounts.append(1);
|
||||
}
|
||||
else if (surfacePoints.size() == 2)
|
||||
{
|
||||
@ -810,7 +810,7 @@ void Foam::autoSnapDriver::binFeatureFace
|
||||
// Definitely makes a feature point
|
||||
surfacePoints.append(pt);
|
||||
surfaceNormals.append(faceSurfaceNormal);
|
||||
surfaceCount.append(1);
|
||||
surfaceCounts.append(1);
|
||||
}
|
||||
}
|
||||
else if (surfacePoints.size() == 3)
|
||||
@ -834,7 +834,7 @@ void Foam::autoSnapDriver::binFeatureFace
|
||||
// Different feature point
|
||||
surfacePoints.append(pt);
|
||||
surfaceNormals.append(faceSurfaceNormal);
|
||||
surfaceCount.append(1);
|
||||
surfaceCounts.append(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -860,15 +860,15 @@ void Foam::autoSnapDriver::binFeatureFaces
|
||||
|
||||
DynamicList<point>& surfacePoints,
|
||||
DynamicList<vector>& surfaceNormals,
|
||||
DynamicList<label>& surfaceCount
|
||||
DynamicList<label>& surfaceCounts
|
||||
) const
|
||||
{
|
||||
const List<point>& pfNormals = pointFaceSurfNormals[pointI];
|
||||
const List<point>& pfSurfNormals = pointFaceSurfNormals[pointI];
|
||||
const List<point>& pfDisp = pointFaceDisp[pointI];
|
||||
const List<point>& pfCentres = pointFaceCentres[pointI];
|
||||
|
||||
// Collect all different directions
|
||||
forAll(pfNormals, i)
|
||||
forAll(pfSurfNormals, i)
|
||||
{
|
||||
binFeatureFace
|
||||
(
|
||||
@ -879,12 +879,12 @@ void Foam::autoSnapDriver::binFeatureFaces
|
||||
snapDist[pointI],
|
||||
|
||||
pfCentres[i],
|
||||
pfNormals[i],
|
||||
pfSurfNormals[i],
|
||||
pfDisp[i],
|
||||
|
||||
surfacePoints,
|
||||
surfaceNormals,
|
||||
surfaceCount
|
||||
surfaceCounts
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -914,7 +914,7 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction
|
||||
// Collect all different directions
|
||||
DynamicList<point> surfacePoints(4);
|
||||
DynamicList<vector> surfaceNormals(4);
|
||||
DynamicList<label> surfaceCount(4);
|
||||
DynamicList<label> surfaceCounts(4);
|
||||
|
||||
binFeatureFaces
|
||||
(
|
||||
@ -931,7 +931,7 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction
|
||||
|
||||
surfacePoints,
|
||||
surfaceNormals,
|
||||
surfaceCount
|
||||
surfaceCounts
|
||||
);
|
||||
|
||||
const point& pt = pp.localPoints()[pointI];
|
||||
@ -966,11 +966,13 @@ void Foam::autoSnapDriver::featureAttractionUsingReconstruction
|
||||
vector d = r.refPoint()-pt;
|
||||
d -= (d&n)*n;
|
||||
|
||||
//- This does not help much but distorts a perfectly aligned mesh
|
||||
// so disabled for now.
|
||||
//// Correct for attraction to non-dominant face
|
||||
//correctAttraction
|
||||
//(
|
||||
// surfacePoints,
|
||||
// surfaceCount,
|
||||
// surfaceCounts,
|
||||
// r.refPoint(),
|
||||
// n, // normalised normal
|
||||
// pt,
|
||||
@ -1813,8 +1815,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
||||
}
|
||||
|
||||
// Reverse: from pp point to nearest feature
|
||||
vectorField allPatchAttraction(pp.nPoints(), vector::zero);
|
||||
List<pointConstraint> allPatchConstraints(pp.nPoints());
|
||||
vectorField rawPatchAttraction(pp.nPoints(), vector::zero);
|
||||
List<pointConstraint> rawPatchConstraints(pp.nPoints());
|
||||
|
||||
determineFeatures
|
||||
(
|
||||
@ -1837,15 +1839,15 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
||||
edgeAttractors,
|
||||
edgeConstraints,
|
||||
// pp point to nearest feature
|
||||
allPatchAttraction,
|
||||
allPatchConstraints
|
||||
rawPatchAttraction,
|
||||
rawPatchConstraints
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Baffle handling
|
||||
// ~~~~~~~~~~~~~~~
|
||||
// Override pointAttractor, edgeAttractor, allPatchAttration etc. to
|
||||
// Override pointAttractor, edgeAttractor, rawPatchAttration etc. to
|
||||
// implement 'baffle' handling.
|
||||
// Baffle: the mesh pp point originates from a loose standing
|
||||
// baffle.
|
||||
@ -1983,8 +1985,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
||||
featI,
|
||||
edgeAttractors,
|
||||
edgeConstraints,
|
||||
allPatchAttraction,
|
||||
allPatchConstraints
|
||||
rawPatchAttraction,
|
||||
rawPatchConstraints
|
||||
);
|
||||
|
||||
if (!nearInfo.hit())
|
||||
@ -2033,8 +2035,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
||||
vector::zero;
|
||||
|
||||
// Store for later use
|
||||
allPatchAttraction[pointI] = featPt-pt;
|
||||
allPatchConstraints[pointI] =
|
||||
rawPatchAttraction[pointI] = featPt-pt;
|
||||
rawPatchConstraints[pointI] =
|
||||
pointConstraints[featI][featPointI];
|
||||
|
||||
if (oldPointI != -1)
|
||||
@ -2053,8 +2055,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
||||
edgeFeatI,
|
||||
edgeAttractors,
|
||||
edgeConstraints,
|
||||
allPatchAttraction,
|
||||
allPatchConstraints
|
||||
rawPatchAttraction,
|
||||
rawPatchConstraints
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2084,8 +2086,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
||||
featI,
|
||||
edgeAttractors,
|
||||
edgeConstraints,
|
||||
allPatchAttraction,
|
||||
allPatchConstraints
|
||||
rawPatchAttraction,
|
||||
rawPatchConstraints
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -2296,11 +2298,11 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
||||
if
|
||||
(
|
||||
patchConstraints[pointI].first() <= 1
|
||||
&& allPatchConstraints[pointI].first() > 1
|
||||
&& rawPatchConstraints[pointI].first() > 1
|
||||
)
|
||||
{
|
||||
patchAttraction[pointI] = allPatchAttraction[pointI];
|
||||
patchConstraints[pointI] = allPatchConstraints[pointI];
|
||||
patchAttraction[pointI] = rawPatchAttraction[pointI];
|
||||
patchConstraints[pointI] = rawPatchConstraints[pointI];
|
||||
|
||||
if (multiPatchStr.valid())
|
||||
{
|
||||
@ -2434,7 +2436,7 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
||||
// Snap edges to feature edges
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Walk existing edges and snap remaining ones (that are marked as
|
||||
// feature edges in allPatchConstraints)
|
||||
// feature edges in rawPatchConstraints)
|
||||
|
||||
stringFeatureEdges
|
||||
(
|
||||
@ -2444,8 +2446,8 @@ void Foam::autoSnapDriver::featureAttractionUsingFeatureEdges
|
||||
pp,
|
||||
snapDist,
|
||||
|
||||
allPatchAttraction,
|
||||
allPatchConstraints,
|
||||
rawPatchAttraction,
|
||||
rawPatchConstraints,
|
||||
|
||||
patchAttraction,
|
||||
patchConstraints
|
||||
|
||||
@ -2295,13 +2295,6 @@ void Foam::meshRefinement::dumpIntersections(const fileName& prefix) const
|
||||
}
|
||||
}
|
||||
|
||||
// Convert to vtk format
|
||||
string cmd
|
||||
(
|
||||
"objToVTK " + prefix + "_edges.obj " + prefix + "_edges.vtk > /dev/null"
|
||||
);
|
||||
system(cmd.c_str());
|
||||
|
||||
Pout<< endl;
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/triSurface/lnInclude
|
||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-ltriSurface
|
||||
-ltriSurface \
|
||||
-lfileFormats
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -27,12 +27,42 @@ License
|
||||
#include "searchableSurfacesQueries.H"
|
||||
#include "ListOps.H"
|
||||
#include "Time.H"
|
||||
//#include "vtkSetWriter.H"
|
||||
#include "DynamicField.H"
|
||||
//#include "OBJstream.H"
|
||||
#include "PatchTools.H"
|
||||
#include "triSurfaceMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(Foam::searchableSurfaces, 0);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
//- Is edge connected to triangle
|
||||
bool Foam::searchableSurfaces::connected
|
||||
(
|
||||
const triSurface& s,
|
||||
const label edgeI,
|
||||
const pointIndexHit& hit
|
||||
)
|
||||
{
|
||||
const triFace& localFace = s.localFaces()[hit.index()];
|
||||
const edge& e = s.edges()[edgeI];
|
||||
|
||||
forAll(localFace, i)
|
||||
{
|
||||
if (e.otherVertex(localFace[i]) != -1)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct with length.
|
||||
@ -378,6 +408,468 @@ Foam::pointIndexHit Foam::searchableSurfaces::facesIntersection
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::searchableSurfaces::checkClosed(const bool report) const
|
||||
{
|
||||
if (report)
|
||||
{
|
||||
Info<< "Checking for closedness." << endl;
|
||||
}
|
||||
|
||||
bool hasError = false;
|
||||
|
||||
forAll(*this, surfI)
|
||||
{
|
||||
if (!operator[](surfI).hasVolumeType())
|
||||
{
|
||||
hasError = true;
|
||||
|
||||
if (report)
|
||||
{
|
||||
Info<< " " << names()[surfI]
|
||||
<< " : not closed" << endl;
|
||||
}
|
||||
|
||||
if (isA<triSurface>(operator[](surfI)))
|
||||
{
|
||||
const triSurface& s = dynamic_cast<const triSurface&>
|
||||
(
|
||||
operator[](surfI)
|
||||
);
|
||||
const labelListList& edgeFaces = s.edgeFaces();
|
||||
|
||||
label nSingleEdges = 0;
|
||||
forAll(edgeFaces, edgeI)
|
||||
{
|
||||
if (edgeFaces[edgeI].size() == 1)
|
||||
{
|
||||
nSingleEdges++;
|
||||
}
|
||||
}
|
||||
|
||||
label nMultEdges = 0;
|
||||
forAll(edgeFaces, edgeI)
|
||||
{
|
||||
if (edgeFaces[edgeI].size() > 2)
|
||||
{
|
||||
nMultEdges++;
|
||||
}
|
||||
}
|
||||
|
||||
if (report && (nSingleEdges != 0 || nMultEdges != 0))
|
||||
{
|
||||
Info<< " connected to one face : "
|
||||
<< nSingleEdges << nl
|
||||
<< " connected to >2 faces : "
|
||||
<< nMultEdges << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (report)
|
||||
{
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
return returnReduce(hasError, orOp<bool>());
|
||||
}
|
||||
|
||||
|
||||
bool Foam::searchableSurfaces::checkNormalOrientation(const bool report) const
|
||||
{
|
||||
if (report)
|
||||
{
|
||||
Info<< "Checking for normal orientation." << endl;
|
||||
}
|
||||
|
||||
bool hasError = false;
|
||||
|
||||
forAll(*this, surfI)
|
||||
{
|
||||
if (isA<triSurface>(operator[](surfI)))
|
||||
{
|
||||
const triSurface& s = dynamic_cast<const triSurface&>
|
||||
(
|
||||
operator[](surfI)
|
||||
);
|
||||
|
||||
labelHashSet borderEdge(s.size()/1000);
|
||||
PatchTools::checkOrientation(s, false, &borderEdge);
|
||||
// Colour all faces into zones using borderEdge
|
||||
labelList normalZone;
|
||||
label nZones = PatchTools::markZones(s, borderEdge, normalZone);
|
||||
if (nZones > 1)
|
||||
{
|
||||
hasError = true;
|
||||
|
||||
if (report)
|
||||
{
|
||||
Info<< " " << names()[surfI]
|
||||
<< " : has multiple orientation zones ("
|
||||
<< nZones << ")" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (report)
|
||||
{
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
return returnReduce(hasError, orOp<bool>());
|
||||
}
|
||||
|
||||
|
||||
bool Foam::searchableSurfaces::checkSizes
|
||||
(
|
||||
const scalar maxRatio,
|
||||
const bool report
|
||||
) const
|
||||
{
|
||||
if (report)
|
||||
{
|
||||
Info<< "Checking for size." << endl;
|
||||
}
|
||||
|
||||
bool hasError = false;
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
const boundBox& bb = operator[](i).bounds();
|
||||
|
||||
for (label j = i+1; j < size(); j++)
|
||||
{
|
||||
scalar ratio = bb.mag()/operator[](j).bounds().mag();
|
||||
|
||||
if (ratio > maxRatio || ratio < 1.0/maxRatio)
|
||||
{
|
||||
hasError = true;
|
||||
|
||||
if (report)
|
||||
{
|
||||
Info<< " " << names()[i]
|
||||
<< " bounds differ from " << names()[j]
|
||||
<< " by more than a factor 100:" << nl
|
||||
<< " bounding box : " << bb << nl
|
||||
<< " bounding box : " << operator[](j).bounds()
|
||||
<< endl;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (report)
|
||||
{
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
return returnReduce(hasError, orOp<bool>());
|
||||
}
|
||||
|
||||
|
||||
bool Foam::searchableSurfaces::checkIntersection
|
||||
(
|
||||
const scalar tolerance,
|
||||
const autoPtr<writer<scalar> >& setWriter,
|
||||
const bool report
|
||||
) const
|
||||
{
|
||||
if (report)
|
||||
{
|
||||
Info<< "Checking for intersection." << endl;
|
||||
}
|
||||
|
||||
//cpuTime timer;
|
||||
|
||||
bool hasError = false;
|
||||
|
||||
forAll(*this, i)
|
||||
{
|
||||
if (isA<triSurfaceMesh>(operator[](i)))
|
||||
{
|
||||
const triSurfaceMesh& s0 = dynamic_cast<const triSurfaceMesh&>
|
||||
(
|
||||
operator[](i)
|
||||
);
|
||||
const edgeList& edges0 = s0.edges();
|
||||
const pointField& localPoints0 = s0.localPoints();
|
||||
|
||||
// Collect all the edge vectors
|
||||
pointField start(edges0.size());
|
||||
pointField end(edges0.size());
|
||||
forAll(edges0, edgeI)
|
||||
{
|
||||
const edge& e = edges0[edgeI];
|
||||
start[edgeI] = localPoints0[e[0]];
|
||||
end[edgeI] = localPoints0[e[1]];
|
||||
}
|
||||
|
||||
// Test all other surfaces for intersection
|
||||
forAll(*this, j)
|
||||
{
|
||||
List<pointIndexHit> hits;
|
||||
|
||||
if (i == j)
|
||||
{
|
||||
// Slightly shorten the edges to prevent finding lots of
|
||||
// intersections. The fast triangle intersection routine
|
||||
// has problems with rays passing through a point of the
|
||||
// triangle.
|
||||
vectorField d
|
||||
(
|
||||
max(tolerance, 10*s0.tolerance())
|
||||
*(end-start)
|
||||
);
|
||||
start += d;
|
||||
end -= d;
|
||||
}
|
||||
|
||||
operator[](j).findLineAny(start, end, hits);
|
||||
|
||||
label nHits = 0;
|
||||
DynamicField<point> intersections(edges0.size()/100);
|
||||
DynamicField<scalar> intersectionEdge(intersections.capacity());
|
||||
|
||||
forAll(hits, edgeI)
|
||||
{
|
||||
if
|
||||
(
|
||||
hits[edgeI].hit()
|
||||
&& (i != j || !connected(s0, edgeI, hits[edgeI]))
|
||||
)
|
||||
{
|
||||
intersections.append(hits[edgeI].hitPoint());
|
||||
intersectionEdge.append(1.0*edgeI);
|
||||
nHits++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nHits > 0)
|
||||
{
|
||||
if (report)
|
||||
{
|
||||
Info<< " " << names()[i]
|
||||
<< " intersects " << names()[j]
|
||||
<< " at " << nHits
|
||||
<< " locations."
|
||||
<< endl;
|
||||
|
||||
//vtkSetWriter<scalar> setWriter;
|
||||
if (setWriter.valid())
|
||||
{
|
||||
scalarField dist(mag(intersections));
|
||||
coordSet track
|
||||
(
|
||||
names()[i] + '_' + names()[j],
|
||||
"xyz",
|
||||
intersections.xfer(),
|
||||
dist
|
||||
);
|
||||
wordList valueSetNames(1, "edgeIndex");
|
||||
List<const scalarField*> valueSets
|
||||
(
|
||||
1,
|
||||
&intersectionEdge
|
||||
);
|
||||
|
||||
fileName fName
|
||||
(
|
||||
setWriter().getFileName(track, valueSetNames)
|
||||
);
|
||||
Info<< " Writing intersection locations to "
|
||||
<< fName << endl;
|
||||
OFstream os
|
||||
(
|
||||
s0.searchableSurface::time().path()
|
||||
/fName
|
||||
);
|
||||
setWriter().write
|
||||
(
|
||||
track,
|
||||
valueSetNames,
|
||||
valueSets,
|
||||
os
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
hasError = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (report)
|
||||
{
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
return returnReduce(hasError, orOp<bool>());
|
||||
}
|
||||
|
||||
|
||||
bool Foam::searchableSurfaces::checkQuality
|
||||
(
|
||||
const scalar minQuality,
|
||||
const bool report
|
||||
) const
|
||||
{
|
||||
if (report)
|
||||
{
|
||||
Info<< "Checking for triangle quality." << endl;
|
||||
}
|
||||
|
||||
bool hasError = false;
|
||||
|
||||
forAll(*this, surfI)
|
||||
{
|
||||
if (isA<triSurface>(operator[](surfI)))
|
||||
{
|
||||
const triSurface& s = dynamic_cast<const triSurface&>
|
||||
(
|
||||
operator[](surfI)
|
||||
);
|
||||
|
||||
label nBadTris = 0;
|
||||
forAll(s, faceI)
|
||||
{
|
||||
const labelledTri& f = s[faceI];
|
||||
|
||||
scalar q = triPointRef
|
||||
(
|
||||
s.points()[f[0]],
|
||||
s.points()[f[1]],
|
||||
s.points()[f[2]]
|
||||
).quality();
|
||||
|
||||
if (q < minQuality)
|
||||
{
|
||||
nBadTris++;
|
||||
}
|
||||
}
|
||||
|
||||
if (nBadTris > 0)
|
||||
{
|
||||
hasError = true;
|
||||
|
||||
if (report)
|
||||
{
|
||||
Info<< " " << names()[surfI]
|
||||
<< " : has " << nBadTris << " bad quality triangles "
|
||||
<< " (quality < " << minQuality << ")" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (report)
|
||||
{
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
return returnReduce(hasError, orOp<bool>());
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Check all surfaces. Return number of failures.
|
||||
Foam::label Foam::searchableSurfaces::checkTopology
|
||||
(
|
||||
const bool report
|
||||
) const
|
||||
{
|
||||
label noFailedChecks = 0;
|
||||
|
||||
if (checkClosed(report))
|
||||
{
|
||||
noFailedChecks++;
|
||||
}
|
||||
|
||||
if (checkNormalOrientation(report))
|
||||
{
|
||||
noFailedChecks++;
|
||||
}
|
||||
return noFailedChecks;
|
||||
}
|
||||
|
||||
|
||||
Foam::label Foam::searchableSurfaces::checkGeometry
|
||||
(
|
||||
const scalar maxRatio,
|
||||
const scalar tol,
|
||||
const autoPtr<writer<scalar> >& setWriter,
|
||||
const scalar minQuality,
|
||||
const bool report
|
||||
) const
|
||||
{
|
||||
label noFailedChecks = 0;
|
||||
|
||||
if (maxRatio > 0 && checkSizes(maxRatio, report))
|
||||
{
|
||||
noFailedChecks++;
|
||||
}
|
||||
|
||||
if (checkIntersection(tol, setWriter, report))
|
||||
{
|
||||
noFailedChecks++;
|
||||
}
|
||||
|
||||
if (checkQuality(minQuality, report))
|
||||
{
|
||||
noFailedChecks++;
|
||||
}
|
||||
|
||||
return noFailedChecks;
|
||||
}
|
||||
|
||||
|
||||
void Foam::searchableSurfaces::writeStats
|
||||
(
|
||||
const List<wordList>& patchTypes,
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
Info<< "Statistics." << endl;
|
||||
forAll(*this, surfI)
|
||||
{
|
||||
Info<< " " << names()[surfI] << ':' << endl;
|
||||
|
||||
const searchableSurface& s = operator[](surfI);
|
||||
|
||||
Info<< " type : " << s.type() << nl
|
||||
<< " size : " << s.globalSize() << nl;
|
||||
if (isA<triSurfaceMesh>(s))
|
||||
{
|
||||
const triSurfaceMesh& ts = dynamic_cast<const triSurfaceMesh&>(s);
|
||||
Info<< " edges : " << ts.nEdges() << nl
|
||||
<< " points : " << ts.points().size() << nl;
|
||||
}
|
||||
Info<< " bounds : " << s.bounds() << nl
|
||||
<< " closed : " << Switch(s.hasVolumeType()) << endl;
|
||||
|
||||
if (patchTypes.size() && patchTypes[surfI].size() >= 1)
|
||||
{
|
||||
wordList unique(HashSet<word>(patchTypes[surfI]).sortedToc());
|
||||
Info<< " patches : ";
|
||||
forAll(unique, i)
|
||||
{
|
||||
Info<< unique[i];
|
||||
if (i < unique.size()-1)
|
||||
{
|
||||
Info<< ',';
|
||||
}
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
|
||||
|
||||
const Foam::searchableSurface& Foam::searchableSurfaces::operator[]
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -37,6 +37,7 @@ SourceFiles
|
||||
|
||||
#include "searchableSurface.H"
|
||||
#include "labelPair.H"
|
||||
#include "writer.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -44,6 +45,7 @@ namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
class triSurface;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class searchableSurfaces Declaration
|
||||
@ -70,6 +72,15 @@ class searchableSurfaces
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Is edge on face
|
||||
static bool connected
|
||||
(
|
||||
const triSurface& s,
|
||||
const label edgeI,
|
||||
const pointIndexHit& hit
|
||||
);
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
searchableSurfaces(const searchableSurfaces&);
|
||||
|
||||
@ -189,6 +200,49 @@ public:
|
||||
) const;
|
||||
|
||||
|
||||
// Checking
|
||||
|
||||
//- Are all surfaces closed and manifold
|
||||
bool checkClosed(const bool report) const;
|
||||
|
||||
//- Are all (triangulated) surfaces consistent normal orientation
|
||||
bool checkNormalOrientation(const bool report) const;
|
||||
|
||||
//- Are all bounding boxes of similar size
|
||||
bool checkSizes(const scalar maxRatio, const bool report) const;
|
||||
|
||||
//- Do surfaces self-intersect or intersect others
|
||||
bool checkIntersection
|
||||
(
|
||||
const scalar tol,
|
||||
const autoPtr<writer<scalar> >&,
|
||||
const bool report
|
||||
) const;
|
||||
|
||||
//- Check triangle quality
|
||||
bool checkQuality
|
||||
(
|
||||
const scalar minQuality,
|
||||
const bool report
|
||||
) const;
|
||||
|
||||
//- All topological checks. Return number of failed checks
|
||||
label checkTopology(const bool report) const;
|
||||
|
||||
//- All geometric checks. Return number of failed checks
|
||||
label checkGeometry
|
||||
(
|
||||
const scalar maxRatio,
|
||||
const scalar tolerance,
|
||||
const autoPtr<writer<scalar> >& setWriter,
|
||||
const scalar minQuality,
|
||||
const bool report
|
||||
) const;
|
||||
|
||||
//- Write some stats
|
||||
void writeStats(const List<wordList>&, Ostream&) const;
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Return const and non-const reference to searchableSurface by index.
|
||||
|
||||
@ -625,6 +625,12 @@ Foam::triSurfaceMesh::edgeTree() const
|
||||
}
|
||||
|
||||
|
||||
Foam::scalar Foam::triSurfaceMesh::tolerance() const
|
||||
{
|
||||
return tolerance_;
|
||||
}
|
||||
|
||||
|
||||
const Foam::wordList& Foam::triSurfaceMesh::regions() const
|
||||
{
|
||||
if (regions_.empty())
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -182,6 +182,7 @@ public:
|
||||
//- Demand driven contruction of octree for boundary edges
|
||||
const indexedOctree<treeDataEdge>& edgeTree() const;
|
||||
|
||||
scalar tolerance() const;
|
||||
|
||||
// searchableSurface implementation
|
||||
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling
|
||||
-lmeshTools
|
||||
|
||||
@ -2,6 +2,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
@ -11,6 +12,7 @@ LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-llagrangian \
|
||||
-lfileFormats \
|
||||
-lsampling \
|
||||
-lincompressibleTransportModels \
|
||||
-lcompressibleTurbulenceModel \
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude \
|
||||
-I$(LIB_SRC)/fileFormats/lnInclude \
|
||||
-I$(LIB_SRC)/transportModels \
|
||||
-I$(LIB_SRC)/turbulenceModels \
|
||||
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
|
||||
@ -17,4 +17,4 @@ LIB_LIBS = \
|
||||
-lcompressibleLESModels \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling
|
||||
-lfileFormats
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lsampling
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user