Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

Conflicts:
	src/postProcessing/functionObjects/field/Make/files
This commit is contained in:
mattijs
2013-11-12 10:00:53 +00:00
142 changed files with 2316 additions and 1992 deletions

View File

@ -7,11 +7,13 @@ EXE_INC = \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/surfMesh/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lsurfMesh \
-llagrangian \
-lfileFormats \
-lsurfMesh \
@ -19,4 +21,3 @@ LIB_LIBS = \
-lincompressibleTransportModels \
-lcompressibleTurbulenceModel \
-lincompressibleTurbulenceModel

View File

@ -48,11 +48,13 @@ namespace Foam
template<>
const char* NamedEnum<fieldValues::faceSource::operationType, 12>::names[] =
const char* NamedEnum<fieldValues::faceSource::operationType, 14>::names[] =
{
"none",
"sum",
"sumMag",
"sumDirection",
"sumDirectionBalance",
"average",
"weightedAverage",
"areaAverage",
@ -75,7 +77,7 @@ namespace Foam
const Foam::NamedEnum<Foam::fieldValues::faceSource::sourceType, 3>
Foam::fieldValues::faceSource::sourceTypeNames_;
const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 12>
const Foam::NamedEnum<Foam::fieldValues::faceSource::operationType, 14>
Foam::fieldValues::faceSource::operationTypeNames_;
@ -450,6 +452,11 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
Info<< " weight field = " << weightFieldName_;
}
if (dict.readIfPresent("scaleFactor", scaleFactor_))
{
Info<< " scale factor = " << scaleFactor_;
}
Info<< nl << endl;
if (valueOutput_)
@ -499,24 +506,15 @@ Foam::scalar Foam::fieldValues::faceSource::processValues
{
case opSumDirection:
{
const vector direction(dict_.lookup("direction"));
vector n(dict_.lookup("direction"));
return sum(pos(values*(Sf & n))*mag(values));
}
case opSumDirectionBalance:
{
vector n(dict_.lookup("direction"));
const scalarField nv(values*(Sf & n));
scalar v = 0.0;
forAll(Sf, i)
{
scalar d = Sf[i] & direction;
if (d > 0)
{
v += pos(values[i])*values[i];
}
else
{
v += neg(values[i])*values[i];
}
}
return v;
return sum(pos(nv)*mag(values) - neg(nv)*mag(values));
}
default:
{
@ -539,8 +537,19 @@ Foam::vector Foam::fieldValues::faceSource::processValues
{
case opSumDirection:
{
const vector direction(dict_.lookup("direction"));
return sum(pos(values & direction)*values);
vector n(dict_.lookup("direction"));
n /= mag(n) + ROOTVSMALL;
const scalarField nv(n & values);
return sum(pos(nv)*n*(nv));
}
case opSumDirectionBalance:
{
vector n(dict_.lookup("direction"));
n /= mag(n) + ROOTVSMALL;
const scalarField nv(n & values);
return sum(pos(nv)*n*(nv));
}
case opAreaNormalAverage:
{
@ -576,6 +585,7 @@ Foam::fieldValues::faceSource::faceSource
source_(sourceTypeNames_.read(dict.lookup("source"))),
operation_(operationTypeNames_.read(dict.lookup("operation"))),
weightFieldName_("none"),
scaleFactor_(1.0),
nFaces_(0),
faceId_(),
facePatchId_(),

View File

@ -71,6 +71,7 @@ Description
sourceName | name of face source if required | no |
operation | operation to perform | yes |
weightField | name of field to apply weighting | no |
scaleFactor | scale factor | no | 1
fields | list of fields to operate on | yes |
\endtable
@ -87,7 +88,9 @@ Description
\plaintable
none | no operation
sum | sum
sumMag | sum of component magnitudes
sumDirection | sum values which are positive in given direction
sumDirectionBalance | sum of balance of values in given direction
average | ensemble average
weightedAverage | weighted average
areaAverage | area weighted average
@ -177,7 +180,9 @@ public:
{
opNone,
opSum,
opSumMag,
opSumDirection,
opSumDirectionBalance,
opAverage,
opWeightedAverage,
opAreaAverage,
@ -190,7 +195,7 @@ public:
};
//- Operation type names
static const NamedEnum<operationType, 12> operationTypeNames_;
static const NamedEnum<operationType, 14> operationTypeNames_;
private:
@ -237,6 +242,9 @@ protected:
//- Weight field name - optional
word weightFieldName_;
//- Scale factor - optional
scalar scaleFactor_;
//- Global number of faces
label nFaces_;

View File

@ -141,6 +141,11 @@ Type Foam::fieldValues::faceSource::processSameTypeValues
result = sum(values);
break;
}
case opSumMag:
{
result = sum(cmptMag(values));
break;
}
case opSumDirection:
{
FatalErrorIn
@ -161,6 +166,26 @@ Type Foam::fieldValues::faceSource::processSameTypeValues
result = pTraits<Type>::zero;
break;
}
case opSumDirectionBalance:
{
FatalErrorIn
(
"template<class Type>"
"Type Foam::fieldValues::faceSource::processSameTypeValues"
"("
"const Field<Type>&, "
"const vectorField&, "
"const scalarField&"
") const"
)
<< "Operation " << operationTypeNames_[operation_]
<< " not available for values of type "
<< pTraits<Type>::typeName
<< exit(FatalError);
result = pTraits<Type>::zero;
break;
}
case opAverage:
{
result = sum(values)/values.size();
@ -304,8 +329,8 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
);
}
// apply weight field
values *= weightField;
// apply scale factor and weight field
values *= scaleFactor_*weightField;
if (Pstream::master())
{

View File

@ -61,6 +61,7 @@ class findCellParticle
//- passive data
label data_;
public:
friend class Cloud<findCellParticle>;
@ -75,7 +76,6 @@ public:
public:
// Constructors
trackingData
@ -97,6 +97,7 @@ public:
{
return cellToData_;
}
List<List<point> >& cellToEnd()
{
return cellToEnd_;
@ -104,7 +105,6 @@ public:
};
// Constructors
//- Construct from components
@ -171,7 +171,6 @@ public:
}
// Tracking
//- Track all particles to their end point

View File

@ -33,7 +33,7 @@ License
namespace Foam
{
defineTypeNameAndDebug(nearWallFields, 0);
defineTypeNameAndDebug(nearWallFields, 0);
}
@ -72,8 +72,8 @@ void Foam::nearWallFields::calcAddressing()
label patchI = iter.key();
const fvPatch& patch = mesh.boundary()[patchI];
vectorField nf = patch.nf();
vectorField faceCellCentres = patch.patch().faceCellCentres();
vectorField nf(patch.nf());
vectorField faceCellCentres(patch.patch().faceCellCentres());
forAll(patch, patchFaceI)
{

View File

@ -92,6 +92,8 @@ void Foam::surfaceInterpolateFields::execute()
{
if (active_)
{
Info<< type() << " " << name_ << " output:" << nl;
// Clear out any previously loaded fields
ssf_.clear();
svf_.clear();
@ -104,6 +106,8 @@ void Foam::surfaceInterpolateFields::execute()
interpolateFields<sphericalTensor>(sSpheretf_);
interpolateFields<symmTensor>(sSymmtf_);
interpolateFields<tensor>(stf_);
Info<< endl;
}
}