From 82f569972f9ccd7c1bbb6604f63592a4c379820e Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Tue, 13 Sep 2011 12:40:22 +0100 Subject: [PATCH 01/11] ENH: Addition of radialActuationDiskSource --- src/finiteVolume/Make/files | 1 + .../actuationDiskSource/actuationDiskSource.C | 50 +++--- .../actuationDiskSource/actuationDiskSource.H | 8 +- .../actuationDiskSourceTemplates.C | 6 +- .../basicSource/basicSource/basicSource.C | 8 +- .../basicSource/basicSource/basicSource.H | 4 +- .../explicitSource/explicitSource.C | 5 +- .../explicitSource/explicitSource.H | 1 + .../radialActuationDiskSource.C | 134 +++++++++++++++ .../radialActuationDiskSource.H | 154 ++++++++++++++++++ .../radialActuationDiskSourceTemplates.C | 94 +++++++++++ 11 files changed, 432 insertions(+), 33 deletions(-) create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index e81819706f..aabb0a3ca3 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -387,6 +387,7 @@ $(basicSource)/basicSource/basicSourceIO.C $(basicSource)/basicSource/basicSourceList.C $(basicSource)/basicSource/IObasicSourceList.C $(basicSource)/actuationDiskSource/actuationDiskSource.C +$(basicSource)/radialActuationDiskSource/radialActuationDiskSource.C $(basicSource)/explicitSource/explicitSource.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C index d44e61e7dc..32a025d993 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C @@ -69,12 +69,13 @@ void Foam::actuationDiskSource::checkData() const Foam::actuationDiskSource::actuationDiskSource ( const word& name, + const word& modelType, const dictionary& dict, const fvMesh& mesh ) : - basicSource(name, dict, mesh), - dict_(dict.subDict(typeName + "Coeffs")), + basicSource(name, modelType, dict, mesh), + dict_(dict.subDict(modelType + "Coeffs")), diskDir_(dict_.lookup("diskDir")), Cp_(readScalar(dict_.lookup("Cp"))), Ct_(readScalar(dict_.lookup("Ct"))), @@ -97,31 +98,34 @@ void Foam::actuationDiskSource::addSu(fvMatrix& UEqn) compressible = true; } - const scalarField& V = this->mesh().V(); + const scalarField& cellsV = this->mesh().V(); vectorField& Usource = UEqn.source(); const vectorField& U = UEqn.psi(); - if (compressible) + if (V() > VSMALL) { - addActuationDiskAxialInertialResistance - ( - Usource, - cells_, - V, - this->mesh().lookupObject("rho"), - U - ); - } - else - { - addActuationDiskAxialInertialResistance - ( - Usource, - cells_, - V, - geometricOneField(), - U - ); + if (compressible) + { + addActuationDiskAxialInertialResistance + ( + Usource, + cells_, + cellsV, + this->mesh().lookupObject("rho"), + U + ); + } + else + { + addActuationDiskAxialInertialResistance + ( + Usource, + cells_, + cellsV, + geometricOneField(), + U + ); + } } } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H index 4b01c6a2af..8b54ac0871 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H @@ -69,7 +69,10 @@ class actuationDiskSource : public basicSource { - // Private data + +protected: + + // Protected data //- Sub dictionary with actuationDisk information const dictionary& dict_; @@ -87,6 +90,8 @@ class actuationDiskSource scalar diskArea_; +private: + // Private Member Functions //- Check data @@ -122,6 +127,7 @@ public: actuationDiskSource ( const word& name, + const word& modelType, const dictionary& dict, const fvMesh& mesh ); diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C index 3544f356bb..a5c8208d7b 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C @@ -36,13 +36,12 @@ void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance ( vectorField& Usource, const labelList& cells, - const scalarField& V, + const scalarField& Vcells, const RhoFieldType& rho, const vectorField& U ) const { scalar a = 1.0 - Cp_/Ct_; - scalar totVol = 0.0; scalarField T(cells.size()); vector uniDiskDir = diskDir_/mag(diskDir_); tensor E(tensor::zero); @@ -52,12 +51,11 @@ void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance const vectorField U1((1.0 - a)*U); forAll(cells, i) { - totVol += V[cells[i]]; T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a); } forAll(cells, i) { - Usource[cells[i]] += ((V[cells[i]]/totVol)*T[i]*E) & U1[cells[i]]; + Usource[cells[i]] += ((Vcells[cells[i]]/V())*T[i]*E) & U1[cells[i]]; } } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C index 53d0c8509f..6bca9b3e30 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C @@ -188,6 +188,7 @@ void Foam::basicSource::setCellSet() Foam::basicSource::basicSource ( const word& name, + const word& modelType, const dictionary& dict, const fvMesh& mesh ) @@ -198,7 +199,10 @@ Foam::basicSource::basicSource active_(readBool(dict_.lookup("active"))), timeStart_(readScalar(dict_.lookup("timeStart"))), duration_(readScalar(dict_.lookup("duration"))), - selectionMode_(selectionModeTypeNames_.read(dict_.lookup("selectionMode"))), + selectionMode_ + ( + selectionModeTypeNames_.read(dict_.lookup("selectionMode")) + ), cellSetName_("none"), V_(0.0) { @@ -237,7 +241,7 @@ Foam::autoPtr Foam::basicSource::New << exit(FatalError); } - return autoPtr(cstrIter()(name, dict, mesh)); + return autoPtr(cstrIter()(name, modelType, dict, mesh)); } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H index 9cd23138a1..0ab5002fad 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.H @@ -180,10 +180,11 @@ public: dictionary, ( const word& name, + const word& modelType, const dictionary& dict, const fvMesh& mesh ), - (name, dict, mesh) + (name, modelType, dict, mesh) ); @@ -193,6 +194,7 @@ public: basicSource ( const word& name, + const word& modelType, const dictionary& dict, const fvMesh& mesh ); diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C index 570d2e01a2..3299f1c556 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C @@ -106,12 +106,13 @@ void Foam::explicitSource::setFieldData(const dictionary& dict) Foam::explicitSource::explicitSource ( const word& name, + const word& modelType, const dictionary& dict, const fvMesh& mesh ) : - basicSource(name, dict, mesh), - dict_(dict.subDict(typeName + "Coeffs")), + basicSource(name, modelType, dict, mesh), + dict_(dict.subDict(modelType + "Coeffs")), volumeMode_(volumeModeTypeNames_.read(dict_.lookup("volumeMode"))) { setFieldData(dict_.subDict("fieldData")); diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H index 062840f10d..9b88fac753 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H @@ -135,6 +135,7 @@ public: explicitSource ( const word& name, + const word& modelType, const dictionary& dict, const fvMesh& mesh ); diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C new file mode 100644 index 0000000000..e01a2a5736 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.C @@ -0,0 +1,134 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*----------------------------------------------------------------------------*/ + +#include "radialActuationDiskSource.H" +#include "geometricOneField.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(radialActuationDiskSource, 0); + addToRunTimeSelectionTable + ( + basicSource, + radialActuationDiskSource, + dictionary + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::radialActuationDiskSource::radialActuationDiskSource +( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + actuationDiskSource(name, modelType, dict, mesh), + dict_(dict.subDict(modelType + "Coeffs")), + coeffs_() +{ + dict_.lookup("coeffs") >> coeffs_; + Info<< " - creating radial actuation disk zone: " + << this->name() << endl; +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::radialActuationDiskSource::addSu(fvMatrix& UEqn) +{ + bool compressible = false; + if (UEqn.dimensions() == dimensionSet(1, 1, -2, 0, 0)) + { + compressible = true; + } + + const scalarField& cellsV = this->mesh().V(); + vectorField& Usource = UEqn.source(); + const vectorField& U = UEqn.psi(); + + if (V() > VSMALL) + { + if (compressible) + { + addRadialActuationDiskAxialInertialResistance + ( + Usource, + cells_, + cellsV, + this->mesh().lookupObject("rho"), + U + ); + } + else + { + addRadialActuationDiskAxialInertialResistance + ( + Usource, + cells_, + cellsV, + geometricOneField(), + U + ); + } + } +} + + +void Foam::radialActuationDiskSource::writeData(Ostream& os) const +{ + actuationDiskSource::writeData(os); +} + + +bool Foam::radialActuationDiskSource::read(const dictionary& dict) +{ + if (basicSource::read(dict)) + { + const dictionary& sourceDict = dict.subDict(name()); + const dictionary& subDictCoeffs = + sourceDict.subDict(typeName + "Coeffs"); + subDictCoeffs.readIfPresent("diskDir", diskDir_); + subDictCoeffs.readIfPresent("Cp", Cp_); + subDictCoeffs.readIfPresent("Ct", Ct_); + subDictCoeffs.readIfPresent("diskArea", diskArea_); + subDictCoeffs.lookup("coeffs") >> coeffs_; + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H new file mode 100644 index 0000000000..701e752ff4 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSource.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::radialActuationDiskSource + +Description + Actuation disk zone definition. + Constant values for momentum source for actuation disk + + T = 2*rho*A*sqr(Uo)*a*(1-a) + U1 = (1 -a)Uo + where: + A: disk area + Uo: upstream velocity + a: 1 - Cp/Ct + U1: velocity at the disk + + + The thrust is distributed by a radial function: + thrust(r) = T*(C0 + C1*r^2 + C2*r^4) + + +SourceFiles + radialActuationDiskSource.C + radialActuationDiskSourceTemplates.C + +\*---------------------------------------------------------------------------*/ + +#ifndef radialActuationDiskSource_H +#define radialActuationDiskSource_H + +#include "DimensionedField.H" +#include "volFieldsFwd.H" +#include "FixedList.H" +#include "actuationDiskSource.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class radialActuationDiskSource Declaration +\*---------------------------------------------------------------------------*/ + +class radialActuationDiskSource +: + public actuationDiskSource +{ + // Private data + + //- Sub dictionary with model information + const dictionary& dict_; + + //- Coeffcients for the radial distribution + FixedList coeffs_; + + + // Private Member Functions + + //- Add resistance to the UEqn + template + void addRadialActuationDiskAxialInertialResistance + ( + vectorField& Usource, + const labelList& cells, + const scalarField& V, + const RhoFieldType& rho, + const vectorField& U + ) const; + + //- Disallow default bitwise copy construct + radialActuationDiskSource(const radialActuationDiskSource&); + + //- Disallow default bitwise assignment + void operator=(const radialActuationDiskSource&); + + +public: + + //- Runtime type information + TypeName("radialActuationDiskSource"); + + + // Constructors + + //- Construct from components + radialActuationDiskSource + ( + const word& name, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + //- Destructor + virtual ~radialActuationDiskSource() + {} + + + // Public Functions + + //-Source term to fvMatrix + virtual void addSu(fvMatrix& UEqn); + + + // I-O + + //- Write data + virtual void writeData(Ostream&) const; + + //- Read dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "radialActuationDiskSourceTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C new file mode 100644 index 0000000000..2fea641d30 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C @@ -0,0 +1,94 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +\*----------------------------------------------------------------------------*/ + +#include "radialActuationDiskSource.H" +#include "volFields.H" +#include "fvMatrix.H" +#include "fvm.H" +#include "mathematicalConstants.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::radialActuationDiskSource:: +addRadialActuationDiskAxialInertialResistance +( + vectorField& Usource, + const labelList& cells, + const scalarField& Vcells, + const RhoFieldType& rho, + const vectorField& U +) const +{ + scalar a = 1.0 - Cp_/Ct_; + scalarField T(cells.size()); + scalarField Tr(cells.size()); + const vector uniDiskDir = diskDir_/mag(diskDir_); + + + tensor E(tensor::zero); + E.xx() = uniDiskDir.x(); + E.yy() = uniDiskDir.y(); + E.zz() = uniDiskDir.z(); + const vectorField U1((1.0 - a)*U); + + const Field zoneCellCentres(mesh().cellCentres(), cells); + const Field zoneCellVolumes(mesh().cellVolumes(), cells); + + const vector avgCentre = gSum(zoneCellVolumes*zoneCellCentres)/V(); + const scalar maxR = mag(max(zoneCellCentres - avgCentre)); + + scalar intCoeffs = + coeffs_[0] + + coeffs_[1]*sqr(maxR)/2.0 + + coeffs_[2]*pow4(maxR)/3.0; + + forAll(cells, i) + { + T[i] = 2.0*rho[cells[i]]*diskArea_*mag(U1[cells[i]])*a/(1.0 - a); + + scalar r = mag(mesh().cellCentres()[cells[i]] - avgCentre); + + Tr[i] = + T[i]*(coeffs_[0] + coeffs_[1]*sqr(r) + coeffs_[2]*pow4(r)) + /intCoeffs; + } + + forAll(cells, i) + { + Usource[cells[i]] += ((Vcells[cells[i]]/V())*Tr[i]*E) & U1[cells[i]]; + } + + if (debug) + { + Info<< "Source name: " << name() << nl + << "Average centre: " << avgCentre << nl + << "Maximum radius: " << maxR << endl; + } +} + + +// ************************************************************************* // From 95af8817dfac348c7e59fd3b1cce21474cc1b320 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 13 Sep 2011 17:59:29 +0100 Subject: [PATCH 02/11] ENH: starcd mesh reader: convert cyclics --- src/conversion/meshReader/starcd/STARCDMeshReader.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conversion/meshReader/starcd/STARCDMeshReader.C b/src/conversion/meshReader/starcd/STARCDMeshReader.C index 6162da0f9b..a7aca36d7f 100644 --- a/src/conversion/meshReader/starcd/STARCDMeshReader.C +++ b/src/conversion/meshReader/starcd/STARCDMeshReader.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "STARCDMeshReader.H" -#include "cyclicPolyPatch.H" +#include "oldCyclicPolyPatch.H" #include "emptyPolyPatch.H" #include "wallPolyPatch.H" #include "symmetryPolyPatch.H" @@ -950,7 +950,7 @@ void Foam::meshReaders::STARCD::readBoundary(const fileName& inputName) { // incorrect. should be cyclicPatch but this // requires info on connected faces. - patchTypes_[patchI] = cyclicPolyPatch::typeName; + patchTypes_[patchI] = oldCyclicPolyPatch::typeName; patchPhysicalTypes_[patchI] = patchTypes_[patchI]; } else if (origType == "baffle") From e8a288fc003a7f632adf034d27f8347ffc984c76 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 14 Sep 2011 10:38:28 +0100 Subject: [PATCH 03/11] ENH: Improved AMI message output --- .../AMIInterpolation/AMIInterpolation.C | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C index e5abcf818f..aa638ebd38 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.C @@ -97,9 +97,10 @@ void Foam::AMIInterpolation::checkPatches boundBox bbSrc(srcPatch.points(), srcPatch.meshPoints()); boundBox bbTgt(tgtPatch.points(), tgtPatch.meshPoints()); - bbTgt.inflate(maxBoundsError); + boundBox bbTgtInf(bbTgt); + bbTgtInf.inflate(maxBoundsError); - if (!bbTgt.contains(bbSrc)) + if (!bbTgtInf.contains(bbSrc)) { WarningIn ( @@ -109,10 +110,11 @@ void Foam::AMIInterpolation::checkPatches "const primitivePatch&" ")" ) << "Source and target patch bounding boxes are not similar" << nl - << " src span : " << bbSrc.span() << nl - << " tgt span : " << bbTgt.span() << nl - << " source: " << bbSrc << nl - << " target: " << bbTgt << endl; + << " source box span : " << bbSrc.span() << nl + << " target box span : " << bbTgt.span() << nl + << " source box : " << bbSrc << nl + << " target box : " << bbTgt << nl + << " inflated target box : " << bbTgtInf << endl; } } From 71c5c0fdb8b4abdfb845bc4ea89cc0ce51de76b6 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 14 Sep 2011 10:39:21 +0100 Subject: [PATCH 04/11] ENH: Added time bounds to function objects --- .../OutputFilterFunctionObject.C | 20 ++++++++++-- .../OutputFilterFunctionObject.H | 31 +++++++++++++------ 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C index effd031a19..86a2867777 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.C @@ -37,6 +37,18 @@ void Foam::OutputFilterFunctionObject::readDict() dict_.readIfPresent("dictionary", dictName_); dict_.readIfPresent("enabled", enabled_); dict_.readIfPresent("storeFilter", storeFilter_); + dict_.readIfPresent("timeStart", timeStart_); + dict_.readIfPresent("timeEnd", timeEnd_); +} + + +template +bool Foam::OutputFilterFunctionObject::active() const +{ + return + enabled_ + && time_.value() >= timeStart_ + && time_.value() <= timeEnd_; } @@ -94,6 +106,8 @@ Foam::OutputFilterFunctionObject::OutputFilterFunctionObject dictName_(), enabled_(true), storeFilter_(true), + timeStart_(-VGREAT), + timeEnd_(VGREAT), outputControl_(t, dict) { readDict(); @@ -121,7 +135,7 @@ bool Foam::OutputFilterFunctionObject::start() { readDict(); - if (enabled_&&storeFilter_) + if (enabled_ && storeFilter_) { allocateFilter(); } @@ -136,7 +150,7 @@ bool Foam::OutputFilterFunctionObject::execute const bool forceWrite ) { - if (enabled_) + if (active()) { if (!storeFilter_) { @@ -163,7 +177,7 @@ bool Foam::OutputFilterFunctionObject::execute template bool Foam::OutputFilterFunctionObject::end() { - if (enabled_) + if (active()) { if (!storeFilter_) { diff --git a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H index 35347f86d4..0b264cb806 100644 --- a/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H +++ b/src/OpenFOAM/db/functionObjects/OutputFilterFunctionObject/OutputFilterFunctionObject.H @@ -68,18 +68,28 @@ class OutputFilterFunctionObject //- Input dictionary dictionary dict_; - //- Name of region - word regionName_; - //- Optional dictionary name to supply required inputs - word dictName_; + // Optional user inputs - //- Switch for the execution of the functionObject - bool enabled_; + //- Name of region - defaults to name of polyMesh::defaultRegion + word regionName_; + + //- Dictionary name to supply required inputs + word dictName_; + + //- Switch for the execution - defaults to 'yes/on' + bool enabled_; + + //- Switch to store filter in between writes or use on-the-fly + // construction - defaults to true + bool storeFilter_; + + //- Activation time - defaults to -VGREAT + scalar timeStart_; + + //- De-activation time - defaults to VGREAT + scalar timeEnd_; - //- Switch to store filter in between writes or use on-the-fly - // construction - bool storeFilter_; //- Output controls outputFilterOutputControl outputControl_; @@ -99,6 +109,9 @@ class OutputFilterFunctionObject //- Destroys most of the data associated with this object. void destroyFilter(); + //- Returns true if active (enabled and within time bounds) + bool active() const; + //- Disallow default bitwise copy construct OutputFilterFunctionObject(const OutputFilterFunctionObject&); From 5deeeda0076ab9be302714cb2805859a2e7dce29 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 14 Sep 2011 11:32:58 +0100 Subject: [PATCH 05/11] STYLE: Corrected comment spelling --- .../temperatureThermoBaffle1DFvPatchScalarField.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.H b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.H index e3c785fb4d..8ee1b01b9c 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/turbulenceModel/derivedFvPatchFields/temperatureThermoBaffle1D/temperatureThermoBaffle1DFvPatchScalarField.H @@ -25,7 +25,7 @@ Class Foam::temperatureThermoBaffle1DFvPatchScalarField Description - Bounday which solves the 1D steady state heat transfer equation + Boundary which solves the 1D steady state heat transfer equation through a baffle. SourceFiles From 4c70e9837e188fe5d66c70ce27870bcf2e7446d7 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 14 Sep 2011 14:18:44 +0100 Subject: [PATCH 06/11] ENH: Updated mapped boundary types --- .../mappedField/mappedFieldFvPatchField.C | 38 ++----------------- .../mappedFixedInternalValueFvPatchField.C | 26 +------------ .../mappedFixedValueFvPatchField.C | 28 +------------- .../mappedFlowRateFvPatchVectorField.C | 3 +- ...mappedVelocityFluxFixedValueFvPatchField.C | 27 ++++++------- ...elfContainedMappedFixedValueFvPatchField.C | 15 ++++---- 6 files changed, 27 insertions(+), 110 deletions(-) diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C index e02fa12ef2..19aeaa4a5a 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedField/mappedFieldFvPatchField.C @@ -204,14 +204,13 @@ void mappedFieldFvPatchField::updateCoeffs() { case NEARESTCELL: { - const mapDistribute& distMap = mappedPatchBase::map(); newValues = sampleField(); - distMap.distribute(newValues); + this->distribute(newValues); break; } - case NEARESTPATCHFACE: + case NEARESTPATCHFACE: case NEARESTPATCHFACEAMI: { const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID(samplePatch()); @@ -230,34 +229,7 @@ void mappedFieldFvPatchField::updateCoeffs() const mapDistribute& distMap = mappedPatchBase::map(); newValues = nbrField.boundaryField()[nbrPatchID]; - distMap.distribute(newValues); - - break; - } - case mappedPatchBase::NEARESTPATCHFACEAMI: - { - const label nbrPatchID = - nbrMesh.boundaryMesh().findPatchID(samplePatch()); - - if (nbrPatchID < 0) - { - FatalErrorIn - ( - "void mappedFixedValueFvPatchField::updateCoeffs()" - )<< "Unable to find sample patch " << samplePatch() - << " in region " << sampleRegion() - << " for patch " << this->patch().name() << nl - << abort(FatalError); - } - -// const fieldType& nbrField = sampleField(); -// newValues = mpp.AMI().interpolateToSource(nbrField); - - notImplemented - ( - "void mappedFieldFvPatchField::updateCoeffs() " - "with mappedPatchBase::NEARESTPATCHFACEAMI" - ); + this->distribute(newValues); break; } @@ -279,9 +251,7 @@ void mappedFieldFvPatchField::updateCoeffs() } } - const mapDistribute& distMap = mappedPatchBase::map(); - distMap.distribute(allValues); - + this->distribute(allValues); newValues.transfer(allValues); break; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C index 8920d39502..326adefd74 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedInternalValue/mappedFixedInternalValueFvPatchField.C @@ -127,31 +127,7 @@ void Foam::mappedFixedInternalValueFvPatchField::updateCoeffs() // Retrieve the neighbour patch internal field Field nbrIntFld(nbrField.patchInternalField()); - - switch (mpp.mode()) - { - case (mappedPatchBase::NEARESTPATCHFACEAMI): - { - // Retrieve the neighbour patch internal field - nbrIntFld = mpp.AMI().interpolateToSource(nbrIntFld); - break; - } - default: - { - const mapDistribute& distMap = mpp.map(); - - mapDistribute::distribute - ( - Pstream::defaultCommsType, - distMap.schedule(), - distMap.constructSize(), - distMap.subMap(), // what to send - distMap.constructMap(), // what to receive - nbrIntFld - ); - break; - } - } + mpp.distribute(nbrIntFld); // Restore tag UPstream::msgType() = oldTag; diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C index ffe8960fa7..930a931206 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedValue/mappedFixedValueFvPatchField.C @@ -283,30 +283,6 @@ void mappedFixedValueFvPatchField::updateCoeffs() break; } case mappedPatchBase::NEARESTPATCHFACE: - { - const mapDistribute& distMap = mpp.map(); - - const label nbrPatchID = - nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch()); - - if (nbrPatchID < 0) - { - FatalErrorIn - ( - "void mappedFixedValueFvPatchField::updateCoeffs()" - )<< "Unable to find sample patch " << mpp.samplePatch() - << " in region " << mpp.sampleRegion() - << " for patch " << this->patch().name() << nl - << abort(FatalError); - } - - const fieldType& nbrField = sampleField(); - - newValues = nbrField.boundaryField()[nbrPatchID]; - distMap.distribute(newValues); - - break; - } case mappedPatchBase::NEARESTPATCHFACEAMI: { const label nbrPatchID = @@ -324,9 +300,9 @@ void mappedFixedValueFvPatchField::updateCoeffs() } const fieldType& nbrField = sampleField(); - newValues = nbrField.boundaryField()[nbrPatchID]; - newValues = mpp.AMI().interpolateToSource(newValues); + newValues = nbrField.boundaryField()[nbrPatchID]; + mpp.distribute(newValues); break; } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFlowRate/mappedFlowRateFvPatchVectorField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFlowRate/mappedFlowRateFvPatchVectorField.C index 9584f2b96c..63aadec6a1 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFlowRate/mappedFlowRateFvPatchVectorField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFlowRate/mappedFlowRateFvPatchVectorField.C @@ -28,7 +28,6 @@ License #include "addToRunTimeSelectionTable.H" #include "fvPatchFieldMapper.H" #include "mappedPatchBase.H" -#include "mapDistribute.H" #include "surfaceFields.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -128,7 +127,7 @@ void Foam::mappedFlowRateFvPatchVectorField::updateCoeffs() scalarList phi = nbrPatch.lookupPatchField(nbrPhiName_); - mpp.map().distribute(phi); + mpp.distribute(phi); const surfaceScalarField& phiName = diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C index 29f6afa027..00be69fc85 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedVelocityFluxFixedValue/mappedVelocityFluxFixedValueFvPatchField.C @@ -176,13 +176,10 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs() ( mappedVelocityFluxFixedValueFvPatchField::patch().patch() ); - const mapDistribute& distMap = mpp.map(); const fvMesh& nbrMesh = refCast(mpp.sampleMesh()); const word& fieldName = dimensionedInternalField().name(); - const volVectorField& UField = nbrMesh.lookupObject - ( - fieldName - ); + const volVectorField& UField = + nbrMesh.lookupObject(fieldName); surfaceScalarField& phiField = const_cast ( @@ -213,26 +210,25 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs() } } - distMap.distribute(allUValues); + mpp.distribute(allUValues); newUValues.transfer(allUValues); - distMap.distribute(allPhiValues); + mpp.distribute(allPhiValues); newPhiValues.transfer(allPhiValues); break; } case mappedPolyPatch::NEARESTPATCHFACE: + case mappedPolyPatch::NEARESTPATCHFACEAMI: { - const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID - ( - mpp.samplePatch() - ); + const label nbrPatchID = + nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch()); newUValues = UField.boundaryField()[nbrPatchID]; - distMap.distribute(newUValues); + mpp.distribute(newUValues); newPhiValues = phiField.boundaryField()[nbrPatchID]; - distMap.distribute(newPhiValues); + mpp.distribute(newPhiValues); break; } @@ -242,8 +238,9 @@ void Foam::mappedVelocityFluxFixedValueFvPatchField::updateCoeffs() ( "mappedVelocityFluxFixedValueFvPatchField::" "updateCoeffs()" - ) << "patch can only be used in NEARESTPATCHFACE or NEARESTFACE " - << "mode" << nl << abort(FatalError); + ) << "patch can only be used in NEARESTPATCHFACE, " + << "NEARESTPATCHFACEAMI or NEARESTFACE mode" << nl + << abort(FatalError); } } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchField.C index 1a3334c927..e13eacc4bf 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/selfContainedMapped/selfContainedMappedFixedValueFvPatchField.C @@ -229,7 +229,6 @@ void selfContainedMappedFixedValueFvPatchField::updateCoeffs() const fvMesh& thisMesh = this->patch().boundaryMesh().mesh(); const fvMesh& nbrMesh = refCast(sampleMesh()); - const mapDistribute& distMap = mappedPatchBase::map(); // Result of obtaining remote values Field newValues; @@ -238,6 +237,8 @@ void selfContainedMappedFixedValueFvPatchField::updateCoeffs() { case NEARESTCELL: { + const mapDistribute& distMap = mappedPatchBase::map(); + if (interpolationScheme_ != interpolationCell::typeName) { // Need to do interpolation so need cells to sample. @@ -275,12 +276,10 @@ void selfContainedMappedFixedValueFvPatchField::updateCoeffs() break; } - case NEARESTPATCHFACE: + case NEARESTPATCHFACE: case NEARESTPATCHFACEAMI: { - const label nbrPatchID = nbrMesh.boundaryMesh().findPatchID - ( - samplePatch() - ); + const label nbrPatchID = + nbrMesh.boundaryMesh().findPatchID(samplePatch()); if (nbrPatchID < 0) { FatalErrorIn @@ -297,7 +296,7 @@ void selfContainedMappedFixedValueFvPatchField::updateCoeffs() const fieldType& nbrField = sampleField(); newValues = nbrField.boundaryField()[nbrPatchID]; - distMap.distribute(newValues); + this->distribute(newValues); break; } @@ -319,7 +318,7 @@ void selfContainedMappedFixedValueFvPatchField::updateCoeffs() } } - distMap.distribute(allValues); + this->distribute(allValues); newValues.transfer(allValues); From 484cd6c221eecceb0feb9ec5f5a194517250ba24 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 14 Sep 2011 15:46:21 +0100 Subject: [PATCH 07/11] ENH: Added -dict option to extrudeToRegionMesh --- .../extrude/extrudeToRegionMesh/extrudeToRegionMesh.C | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C index 3549dc9560..f6214c8e62 100644 --- a/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C +++ b/applications/utilities/mesh/generation/extrude/extrudeToRegionMesh/extrudeToRegionMesh.C @@ -924,6 +924,7 @@ int main(int argc, char *argv[]) #include "addRegionOption.H" #include "addOverwriteOption.H" + argList::addOption("dict", "name", "specify alternative dictionary"); argList::addBoolOption("AMI", "apply mapped AMI boundary type"); #include "setRootCase.H" @@ -932,6 +933,8 @@ int main(int argc, char *argv[]) const word oldInstance = mesh.pointsInstance(); bool overwrite = args.optionFound("overwrite"); + const word dictName + (args.optionLookupOrDefault("dict", "extrudeToRegionMeshDict")); mappedPatchBase::sampleMode sampleMode = mappedPatchBase::NEARESTPATCHFACE; if (args.optionFound("AMI")) @@ -943,7 +946,7 @@ int main(int argc, char *argv[]) ( IOobject ( - "extrudeToRegionMeshDict", + dictName, runTime.system(), runTime, IOobject::MUST_READ_IF_MODIFIED From b1045257208b98acb47b38ad5b141cedcff8b697 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 15 Sep 2011 16:04:25 +0100 Subject: [PATCH 08/11] ENH: execFlowFunctionObjects: added -region option. Added -noFlow option. --- .../postProcessing/foamCalc/foamCalcApp.C | 3 +- .../execFlowFunctionObjects.C | 418 ++++++++++-------- src/postProcessing/postCalc/postCalc.C | 8 +- 3 files changed, 253 insertions(+), 176 deletions(-) diff --git a/applications/utilities/postProcessing/foamCalc/foamCalcApp.C b/applications/utilities/postProcessing/foamCalc/foamCalcApp.C index e9fb697570..39d0a581d5 100644 --- a/applications/utilities/postProcessing/foamCalc/foamCalcApp.C +++ b/applications/utilities/postProcessing/foamCalc/foamCalcApp.C @@ -43,6 +43,7 @@ Description int main(int argc, char *argv[]) { Foam::timeSelector::addOptions(); +# include "addRegionOption.H" Foam::argList::addBoolOption ( "noWrite", @@ -74,7 +75,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); -# include "createMesh.H" +# include "createNamedMesh.H" utility().tryPreCalc(args, runTime, mesh); diff --git a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C index fe84a1daa0..f0487ac2a2 100644 --- a/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C +++ b/applications/utilities/postProcessing/miscellaneous/execFlowFunctionObjects/execFlowFunctionObjects.C @@ -37,6 +37,11 @@ Description #include "calc.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "pointFields.H" +#include "ReadFields.H" + #include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H" #include "incompressible/RAS/RASModel/RASModel.H" @@ -84,203 +89,268 @@ namespace Foam void Foam::calc(const argList& args, const Time& runTime, const fvMesh& mesh) { - Info<< " Reading phi" << endl; - surfaceScalarField phi - ( - IOobject - ( - "phi", - runTime.timeName(), - mesh, - IOobject::MUST_READ - ), - mesh - ); - - Info<< " Reading U" << endl; - volVectorField U - ( - IOobject - ( - "U", - runTime.timeName(), - mesh, - IOobject::MUST_READ - ), - mesh - ); - - Info<< " Reading p" << endl; - volScalarField p - ( - IOobject - ( - "p", - runTime.timeName(), - mesh, - IOobject::MUST_READ - ), - mesh - ); - - if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0)) + if (args.optionFound("noFlow")) { - IOobject RASPropertiesHeader - ( - "RASProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ); + Info<< " Operating in no-flow mode; no models will be loaded." + << " All vol, surface and point fields will be loaded." << endl; - IOobject LESPropertiesHeader - ( - "LESProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ); + // Read objects in time directory + IOobjectList objects(mesh, runTime.timeName()); - if (RASPropertiesHeader.headerOk()) - { - IOdictionary RASProperties(RASPropertiesHeader); + // Read vol fields. - singlePhaseTransportModel laminarTransport(U, phi); + PtrList vsFlds; + ReadFields(mesh, objects, vsFlds); - autoPtr RASModel - ( - incompressible::RASModel::New - ( - U, - phi, - laminarTransport - ) - ); - execFlowFunctionObjects(args, runTime); - } - else if (LESPropertiesHeader.headerOk()) - { - IOdictionary LESProperties(LESPropertiesHeader); + PtrList vvFlds; + ReadFields(mesh, objects, vvFlds); - singlePhaseTransportModel laminarTransport(U, phi); + PtrList vstFlds; + ReadFields(mesh, objects, vstFlds); - autoPtr sgsModel - ( - incompressible::LESModel::New(U, phi, laminarTransport) - ); + PtrList vsymtFlds; + ReadFields(mesh, objects, vsymtFlds); - execFlowFunctionObjects(args, runTime); - } - else - { - IOdictionary transportProperties - ( - IOobject - ( - "transportProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); + PtrList vtFlds; + ReadFields(mesh, objects, vtFlds); - dimensionedScalar nu(transportProperties.lookup("nu")); + // Read surface fields. - execFlowFunctionObjects(args, runTime); - } - } - else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0)) - { - autoPtr thermo(basicPsiThermo::New(mesh)); + PtrList ssFlds; + ReadFields(mesh, objects, ssFlds); - volScalarField rho - ( - IOobject - ( - "rho", - runTime.timeName(), - mesh - ), - thermo->rho() - ); + PtrList svFlds; + ReadFields(mesh, objects, svFlds); - IOobject RASPropertiesHeader - ( - "RASProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ); + PtrList sstFlds; + ReadFields(mesh, objects, sstFlds); - IOobject LESPropertiesHeader - ( - "LESProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE, - false - ); + PtrList ssymtFlds; + ReadFields(mesh, objects, ssymtFlds); - if (RASPropertiesHeader.headerOk()) - { - IOdictionary RASProperties(RASPropertiesHeader); + PtrList stFlds; + ReadFields(mesh, objects, stFlds); - autoPtr RASModel - ( - compressible::RASModel::New - ( - rho, - U, - phi, - thermo() - ) - ); + // Read point fields. + const pointMesh& pMesh = pointMesh::New(mesh); - execFlowFunctionObjects(args, runTime); - } - else if (LESPropertiesHeader.headerOk()) - { - IOdictionary LESProperties(LESPropertiesHeader); + PtrList psFlds; + ReadFields(pMesh, objects, psFlds); - autoPtr sgsModel - ( - compressible::LESModel::New(rho, U, phi, thermo()) - ); + PtrList pvFlds; + ReadFields(pMesh, objects, pvFlds); - execFlowFunctionObjects(args, runTime); - } - else - { - IOdictionary transportProperties - ( - IOobject - ( - "transportProperties", - runTime.constant(), - mesh, - IOobject::MUST_READ_IF_MODIFIED, - IOobject::NO_WRITE - ) - ); + PtrList pstFlds; + ReadFields(pMesh, objects, pstFlds); - dimensionedScalar mu(transportProperties.lookup("mu")); + PtrList psymtFlds; + ReadFields(pMesh, objects, psymtFlds); - execFlowFunctionObjects(args, runTime); - } + PtrList ptFlds; + ReadFields(pMesh, objects, ptFlds); + + execFlowFunctionObjects(args, runTime); } else { - FatalErrorIn(args.executable()) - << "Incorrect dimensions of phi: " << phi.dimensions() - << nl << exit(FatalError); + Info<< " Reading phi" << endl; + surfaceScalarField phi + ( + IOobject + ( + "phi", + runTime.timeName(), + mesh, + IOobject::MUST_READ + ), + mesh + ); + + Info<< " Reading U" << endl; + volVectorField U + ( + IOobject + ( + "U", + runTime.timeName(), + mesh, + IOobject::MUST_READ + ), + mesh + ); + + Info<< " Reading p" << endl; + volScalarField p + ( + IOobject + ( + "p", + runTime.timeName(), + mesh, + IOobject::MUST_READ + ), + mesh + ); + + if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0)) + { + IOobject RASPropertiesHeader + ( + "RASProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ); + + IOobject LESPropertiesHeader + ( + "LESProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ); + + if (RASPropertiesHeader.headerOk()) + { + IOdictionary RASProperties(RASPropertiesHeader); + + singlePhaseTransportModel laminarTransport(U, phi); + + autoPtr RASModel + ( + incompressible::RASModel::New + ( + U, + phi, + laminarTransport + ) + ); + execFlowFunctionObjects(args, runTime); + } + else if (LESPropertiesHeader.headerOk()) + { + IOdictionary LESProperties(LESPropertiesHeader); + + singlePhaseTransportModel laminarTransport(U, phi); + + autoPtr sgsModel + ( + incompressible::LESModel::New(U, phi, laminarTransport) + ); + + execFlowFunctionObjects(args, runTime); + } + else + { + IOdictionary transportProperties + ( + IOobject + ( + "transportProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ); + + dimensionedScalar nu(transportProperties.lookup("nu")); + + execFlowFunctionObjects(args, runTime); + } + } + else if (phi.dimensions() == dimensionSet(1, 0, -1, 0, 0)) + { + autoPtr thermo(basicPsiThermo::New(mesh)); + + volScalarField rho + ( + IOobject + ( + "rho", + runTime.timeName(), + mesh + ), + thermo->rho() + ); + + IOobject RASPropertiesHeader + ( + "RASProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ); + + IOobject LESPropertiesHeader + ( + "LESProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE, + false + ); + + if (RASPropertiesHeader.headerOk()) + { + IOdictionary RASProperties(RASPropertiesHeader); + + autoPtr RASModel + ( + compressible::RASModel::New + ( + rho, + U, + phi, + thermo() + ) + ); + + execFlowFunctionObjects(args, runTime); + } + else if (LESPropertiesHeader.headerOk()) + { + IOdictionary LESProperties(LESPropertiesHeader); + + autoPtr sgsModel + ( + compressible::LESModel::New(rho, U, phi, thermo()) + ); + + execFlowFunctionObjects(args, runTime); + } + else + { + IOdictionary transportProperties + ( + IOobject + ( + "transportProperties", + runTime.constant(), + mesh, + IOobject::MUST_READ_IF_MODIFIED, + IOobject::NO_WRITE + ) + ); + + dimensionedScalar mu(transportProperties.lookup("mu")); + + execFlowFunctionObjects(args, runTime); + } + } + else + { + FatalErrorIn(args.executable()) + << "Incorrect dimensions of phi: " << phi.dimensions() + << nl << exit(FatalError); + } } } diff --git a/src/postProcessing/postCalc/postCalc.C b/src/postProcessing/postCalc/postCalc.C index f477818a4c..ff2dd174e0 100644 --- a/src/postProcessing/postCalc/postCalc.C +++ b/src/postProcessing/postCalc/postCalc.C @@ -57,11 +57,17 @@ namespace Foam int main(int argc, char *argv[]) { Foam::timeSelector::addOptions(); +# include "addRegionOption.H" Foam::argList::addBoolOption ( "noWrite", "suppress writing results" ); + Foam::argList::addBoolOption + ( + "noFlow", + "suppress creating flow models (execFlowFunctionObjects only)" + ); Foam::argList::addOption ( "dict", @@ -72,7 +78,7 @@ int main(int argc, char *argv[]) #include "setRootCase.H" #include "createTime.H" Foam::instantList timeDirs = Foam::timeSelector::select0(runTime, args); - #include "createMesh.H" + #include "createNamedMesh.H" forAll(timeDirs, timeI) { From 9f8fb69105b2d642c2f973dad070ad337b60944c Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 15 Sep 2011 16:45:08 +0100 Subject: [PATCH 09/11] ENH: streamFunction: added -region option --- .../velocityField/streamFunction/streamFunction.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C b/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C index 850b8cbb5c..c5c024b3ef 100644 --- a/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C +++ b/applications/utilities/postProcessing/velocityField/streamFunction/streamFunction.C @@ -42,13 +42,14 @@ Description int main(int argc, char *argv[]) { timeSelector::addOptions(); +# include "addRegionOption.H" # include "setRootCase.H" # include "createTime.H" instantList timeDirs = timeSelector::select0(runTime, args); -# include "createMeshNoClear.H" +# include "createNamedMesh.H" pointMesh pMesh(mesh); From 67d17dcb128ec4996fd0ad6e8bad7bd2919c6cf8 Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 16 Sep 2011 14:43:43 +0100 Subject: [PATCH 10/11] STYLE: maxerVesselAMI2D: remove unused file --- .../constant/polyMesh/boundary | 78 ------------------- 1 file changed, 78 deletions(-) delete mode 100644 tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/polyMesh/boundary diff --git a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/polyMesh/boundary b/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/polyMesh/boundary deleted file mode 100644 index 34ba2b59dd..0000000000 --- a/tutorials/incompressible/pimpleDyMFoam/mixerVesselAMI2D/constant/polyMesh/boundary +++ /dev/null @@ -1,78 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class polyBoundaryMesh; - location "constant/polyMesh"; - object boundary; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -6 -( - rotor - { - type wall; - nFaces 192; - startFace 5856; - } - stator - { - type wall; - nFaces 192; - startFace 6048; - } - AMI1 - { - type cyclicAMI; - nFaces 96; - startFace 6240; - matchTolerance 0.0001; - neighbourPatch AMI2; - transform noOrdering; - surface - { - type searchableCylinder; - point1 ( 0 0 -1 ); - point2 ( 0 0 1 ); - radius 0.5; - } - } - AMI2 - { - type cyclicAMI; - nFaces 96; - startFace 6336; - matchTolerance 0.0001; - neighbourPatch AMI1; - transform noOrdering; - surface - { - type searchableCylinder; - point1 ( 0 0 -1 ); - point2 ( 0 0 1 ); - radius 0.5; - } - } - front - { - type empty; - nFaces 3072; - startFace 6432; - } - back - { - type empty; - nFaces 3072; - startFace 9504; - } -) - -// ************************************************************************* // From 6ac8d99e925a6653cbff4b53bb011d4142f71fca Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 16 Sep 2011 14:44:38 +0100 Subject: [PATCH 11/11] BUG: radialActuactionDiskSource: corrected maxR calculation. --- .../radialActuationDiskSourceTemplates.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C index 2fea641d30..6c8469fda8 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/radialActuationDiskSource/radialActuationDiskSourceTemplates.C @@ -59,7 +59,7 @@ addRadialActuationDiskAxialInertialResistance const Field zoneCellVolumes(mesh().cellVolumes(), cells); const vector avgCentre = gSum(zoneCellVolumes*zoneCellCentres)/V(); - const scalar maxR = mag(max(zoneCellCentres - avgCentre)); + const scalar maxR = gMax(mag(zoneCellCentres - avgCentre)); scalar intCoeffs = coeffs_[0]