Merge branch 'master' of github.com:OpenFOAM/OpenFOAM-2.3.x

This commit is contained in:
william 2014-08-14 16:32:52 +01:00
commit 6519e2f7e1
14 changed files with 148 additions and 70 deletions

View file

@ -53,7 +53,8 @@ using namespace Foam;
int main(int argc, char *argv[])
{
# include "addOverwriteOption.H"
#include "addOverwriteOption.H"
#include "addRegionOption.H"
argList::validArgs.append("cellSet");
argList::addBoolOption
(
@ -62,10 +63,10 @@ int main(int argc, char *argv[])
" (default is to extend set)"
);
# include "setRootCase.H"
# include "createTime.H"
#include "setRootCase.H"
#include "createTime.H"
runTime.functionObjects().off();
# include "createMesh.H"
#include "createNamedMesh.H"
const word oldInstance = mesh.pointsInstance();
word cellSetName(args.args()[1]);
@ -181,7 +182,7 @@ int main(int argc, char *argv[])
mesh.movePoints(map().preMotionPoints());
}
Pout<< "Refined from " << returnReduce(map().nOldCells(), sumOp<label>())
Info<< "Refined from " << returnReduce(map().nOldCells(), sumOp<label>())
<< " to " << mesh.globalData().nTotalCells() << " cells." << nl << endl;
if (overwrite)

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -37,6 +37,7 @@ Description
#include "fvCFD.H"
#include "volFields.H"
#include "pointFields.H"
#include "IOobjectList.H"
#include "patchSummaryTemplates.H"
@ -87,6 +88,12 @@ int main(int argc, char *argv[])
PtrList<volSymmTensorField> vsytf(objNames.size());
PtrList<volTensorField> vtf(objNames.size());
PtrList<pointScalarField> psf(objNames.size());
PtrList<pointVectorField> pvf(objNames.size());
PtrList<pointSphericalTensorField> psptf(objNames.size());
PtrList<pointSymmTensorField> psytf(objNames.size());
PtrList<pointTensorField> ptf(objNames.size());
Info<< "Valid fields:" << endl;
forAll(objNames, objI)
@ -101,11 +108,17 @@ int main(int argc, char *argv[])
if (obj.headerOk())
{
addToFieldList<scalar>(vsf, obj, objI, mesh);
addToFieldList<vector>(vvf, obj, objI, mesh);
addToFieldList<sphericalTensor>(vsptf, obj, objI, mesh);
addToFieldList<symmTensor>(vsytf, obj, objI, mesh);
addToFieldList<tensor>(vtf, obj, objI, mesh);
addToFieldList(vsf, obj, objI, mesh);
addToFieldList(vvf, obj, objI, mesh);
addToFieldList(vsptf, obj, objI, mesh);
addToFieldList(vsytf, obj, objI, mesh);
addToFieldList(vtf, obj, objI, mesh);
addToFieldList(psf, obj, objI, pointMesh::New(mesh));
addToFieldList(pvf, obj, objI, pointMesh::New(mesh));
addToFieldList(psptf, obj, objI, pointMesh::New(mesh));
addToFieldList(psytf, obj, objI, pointMesh::New(mesh));
addToFieldList(ptf, obj, objI, pointMesh::New(mesh));
}
}
@ -119,11 +132,17 @@ int main(int argc, char *argv[])
forAll(bm, patchI)
{
Info<< bm[patchI].type() << "\t: " << bm[patchI].name() << nl;
outputFieldList<scalar>(vsf, patchI);
outputFieldList<vector>(vvf, patchI);
outputFieldList<sphericalTensor>(vsptf, patchI);
outputFieldList<symmTensor>(vsytf, patchI);
outputFieldList<tensor>(vtf, patchI);
outputFieldList(vsf, patchI);
outputFieldList(vvf, patchI);
outputFieldList(vsptf, patchI);
outputFieldList(vsytf, patchI);
outputFieldList(vtf, patchI);
outputFieldList(psf, patchI);
outputFieldList(pvf, patchI);
outputFieldList(psptf, patchI);
outputFieldList(psytf, patchI);
outputFieldList(ptf, patchI);
Info<< endl;
}
}
@ -139,11 +158,17 @@ int main(int argc, char *argv[])
forAll(bm, patchI)
{
HashTable<word> fieldToType;
collectFieldList<scalar>(vsf, patchI, fieldToType);
collectFieldList<vector>(vvf, patchI, fieldToType);
collectFieldList<sphericalTensor>(vsptf, patchI, fieldToType);
collectFieldList<symmTensor>(vsytf, patchI, fieldToType);
collectFieldList<tensor>(vtf, patchI, fieldToType);
collectFieldList(vsf, patchI, fieldToType);
collectFieldList(vvf, patchI, fieldToType);
collectFieldList(vsptf, patchI, fieldToType);
collectFieldList(vsytf, patchI, fieldToType);
collectFieldList(vtf, patchI, fieldToType);
collectFieldList(psf, patchI, fieldToType);
collectFieldList(pvf, patchI, fieldToType);
collectFieldList(psptf, patchI, fieldToType);
collectFieldList(psytf, patchI, fieldToType);
collectFieldList(ptf, patchI, fieldToType);
label groupI = findIndex(fieldToTypes, fieldToType);
if (groupI == -1)
@ -184,11 +209,17 @@ int main(int argc, char *argv[])
Info<< "group\t: " << groups[i] << nl;
}
}
outputFieldList<scalar>(vsf, patchIDs[0]);
outputFieldList<vector>(vvf, patchIDs[0]);
outputFieldList<sphericalTensor>(vsptf, patchIDs[0]);
outputFieldList<symmTensor>(vsytf, patchIDs[0]);
outputFieldList<tensor>(vtf, patchIDs[0]);
outputFieldList(vsf, patchIDs[0]);
outputFieldList(vvf, patchIDs[0]);
outputFieldList(vsptf, patchIDs[0]);
outputFieldList(vsytf, patchIDs[0]);
outputFieldList(vtf, patchIDs[0]);
outputFieldList(psf, patchIDs[0]);
outputFieldList(pvf, patchIDs[0]);
outputFieldList(psptf, patchIDs[0]);
outputFieldList(psytf, patchIDs[0]);
outputFieldList(ptf, patchIDs[0]);
Info<< endl;
}
else
@ -199,11 +230,17 @@ int main(int argc, char *argv[])
label patchI = patchIDs[i];
Info<< bm[patchI].type()
<< "\t: " << bm[patchI].name() << nl;
outputFieldList<scalar>(vsf, patchI);
outputFieldList<vector>(vvf, patchI);
outputFieldList<sphericalTensor>(vsptf, patchI);
outputFieldList<symmTensor>(vsytf, patchI);
outputFieldList<tensor>(vtf, patchI);
outputFieldList(vsf, patchI);
outputFieldList(vvf, patchI);
outputFieldList(vsptf, patchI);
outputFieldList(vsytf, patchI);
outputFieldList(vtf, patchI);
outputFieldList(psf, patchI);
outputFieldList(pvf, patchI);
outputFieldList(psptf, patchI);
outputFieldList(psytf, patchI);
outputFieldList(ptf, patchI);
Info<< endl;
}
}

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -28,33 +28,33 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type>
template<class GeoField>
void Foam::addToFieldList
(
PtrList<GeometricField<Type, fvPatchField, volMesh> >& fieldList,
PtrList<GeoField>& fieldList,
const IOobject& obj,
const label fieldI,
const fvMesh& mesh
const typename GeoField::Mesh& mesh
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
typedef GeoField fieldType;
if (obj.headerClassName() == fieldType::typeName)
if (obj.headerClassName() == GeoField::typeName)
{
fieldList.set
(
fieldI,
new fieldType(obj, mesh)
new GeoField(obj, mesh)
);
Info<< " " << fieldType::typeName << tab << obj.name() << endl;
Info<< " " << GeoField::typeName << tab << obj.name() << endl;
}
}
template<class Type>
template<class GeoField>
void Foam::outputFieldList
(
const PtrList<GeometricField<Type, fvPatchField, volMesh> >& fieldList,
const PtrList<GeoField>& fieldList,
const label patchI
)
{
@ -62,7 +62,8 @@ void Foam::outputFieldList
{
if (fieldList.set(fieldI))
{
Info<< " " << pTraits<Type>::typeName << tab << tab
Info<< " " << pTraits<typename GeoField::value_type>::typeName
<< tab << tab
<< fieldList[fieldI].name() << tab << tab
<< fieldList[fieldI].boundaryField()[patchI].type() << nl;
}
@ -70,10 +71,10 @@ void Foam::outputFieldList
}
template<class Type>
template<class GeoField>
void Foam::collectFieldList
(
const PtrList<GeometricField<Type, fvPatchField, volMesh> >& fieldList,
const PtrList<GeoField>& fieldList,
const label patchI,
HashTable<word>& fieldToType
)

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -33,26 +33,26 @@ License
namespace Foam
{
template<class Type>
template<class GeoField>
void addToFieldList
(
PtrList<GeometricField<Type, fvPatchField, volMesh> >& fieldList,
PtrList<GeoField>& fieldList,
const IOobject& obj,
const label fieldI,
const fvMesh& mesh
const typename GeoField::Mesh& mesh
);
template<class Type>
template<class GeoField>
void outputFieldList
(
const PtrList<GeometricField<Type, fvPatchField, volMesh> >& fieldList,
const PtrList<GeoField>& fieldList,
const label patchI
);
template<class Type>
template<class GeoField>
void collectFieldList
(
const PtrList<GeometricField<Type, fvPatchField, volMesh> >& fieldList,
const PtrList<GeoField>& fieldList,
const label patchI,
HashTable<word>& fieldToType
);

View file

@ -77,7 +77,7 @@ inletOutletTotalTemperatureFvPatchScalarField
:
inletOutletFvPatchScalarField(p, iF),
UName_(dict.lookupOrDefault<word>("U", "U")),
psiName_(dict.lookupOrDefault<word>("psi", "psi")),
psiName_(dict.lookupOrDefault<word>("psi", "thermo:psi")),
gamma_(readScalar(dict.lookup("gamma"))),
T0_("T0", dict, p.size())
{

View file

@ -805,6 +805,17 @@ void Foam::AMIInterpolation<SourcePatch, TargetPatch>::update
label srcTotalSize = returnReduce(srcPatch.size(), sumOp<label>());
label tgtTotalSize = returnReduce(tgtPatch.size(), sumOp<label>());
if (srcTotalSize == 0)
{
if (debug)
{
Info<< "AMI: no source faces present - no addressing constructed"
<< endl;
}
return;
}
Info<< indent
<< "AMI: Creating addressing and weights between "
<< srcTotalSize << " source faces and "

View file

@ -97,11 +97,13 @@ void Foam::mapNearestAMI<SourcePatch, TargetPatch>::setNextNearestFaces
}
}
forAll(mapFlag, srcFaceI)
forAll(mapFlag, faceI)
{
if (!mapFlag[srcFaceI])
if (mapFlag[faceI])
{
tgtFaceI = this->findTargetFace(srcFaceI);
srcFaceI = faceI;
tgtFaceI = this->findTargetFace(faceI);
if (tgtFaceI == -1)
{
const vectorField& srcCf = this->srcPatch_.faceCentres();

View file

@ -444,6 +444,20 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict)
if (dict.readIfPresent("weightField", weightFieldName_))
{
Info<< " weight field = " << weightFieldName_ << nl;
if (source_ == stSampledSurface)
{
FatalIOErrorIn
(
"void Foam::fieldValues::faceSource::initialise"
"("
"const dictionary&"
")",
dict
)
<< "Cannot use weightField for a sampledSurface"
<< exit(FatalIOError);
}
}
if (dict.found("orientedWeightField"))
@ -664,8 +678,8 @@ void Foam::fieldValues::faceSource::write()
file() << obr_.time().value() << tab << totalArea;
}
// construct weight field
scalarField weightField(faceId_.size(), 1.0);
// construct weight field. Note: zero size means weight = 1
scalarField weightField;
if (weightFieldName_ != "none")
{
weightField =

View file

@ -195,7 +195,14 @@ Type Foam::fieldValues::faceSource::processSameTypeValues
}
case opWeightedAverage:
{
result = sum(values)/sum(weightField);
if (weightField.size())
{
result = sum(values)/sum(weightField);
}
else
{
result = sum(values)/values.size();
}
break;
}
case opAreaAverage:
@ -329,8 +336,13 @@ bool Foam::fieldValues::faceSource::writeValues
}
}
// apply scale factor and weight field
values *= scaleFactor_*weightField;
values *= scaleFactor_;
if (weightField.size())
{
values *= weightField;
}
if (Pstream::master())
{

View file

@ -19,7 +19,7 @@ functions
turbulenceFields1
{
type turbulenceFields;
functionObjectLibs ("libfieldFunctionObjects.so");
functionObjectLibs ("libutilityFunctionObjects.so");
enabled true;
outputControl timeStep;
outputInterval 1;

View file

@ -143,7 +143,7 @@ void Foam::turbulenceFields::read(const dictionary& dict)
Info<< "storing fields:" << nl;
forAllConstIter(wordHashSet, fieldSet_, iter)
{
Info<< " " << modelName << '.' << iter.key() << nl;
Info<< " " << modelName << ':' << iter.key() << nl;
}
Info<< endl;
}
@ -151,8 +151,6 @@ void Foam::turbulenceFields::read(const dictionary& dict)
{
Info<< "no fields requested to be stored" << nl << endl;
}
execute();
}
}

View file

@ -32,16 +32,16 @@ Description
further manipulation.
Fields are stored as copies of the original, with the prefix
"tubulenceModel::", e.g.
"tubulenceModel:", e.g.
turbulenceModel::R
turbulenceModel:R
Example of function object specification:
\verbatim
turbulenceFields1
{
type turbulenceFields;
functionObjectLibs ("libfieldFunctionObjects.so");
functionObjectLibs ("libutilityFunctionObjects.so");
...
fields
(

View file

@ -36,7 +36,7 @@ void Foam::turbulenceFields::processField
{
typedef GeometricField<Type, fvPatchField, volMesh> FieldType;
const word scopedName = modelName + '.' + fieldName;
const word scopedName = modelName + ':' + fieldName;
if (obr_.foundObject<FieldType>(scopedName))
{

View file

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -217,6 +217,8 @@ void Foam::radiation::P1::calculate()
E_ = absorptionEmission_->E();
const volScalarField sigmaEff(scatter_->sigmaEff());
const dimensionedScalar a0 ("a0", a_.dimensions(), ROOTVSMALL);
// Construct diffusion
const volScalarField gamma
(
@ -228,7 +230,7 @@ void Foam::radiation::P1::calculate()
IOobject::NO_READ,
IOobject::NO_WRITE
),
1.0/(3.0*a_ + sigmaEff)
1.0/(3.0*a_ + sigmaEff + a0)
);
// Solve G transport equation