From d4787dce18bc839a1fa23fd923426518102c1914 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 14 Jan 2013 12:49:31 +0000 Subject: [PATCH 01/19] ENH: Updated info message --- src/randomProcesses/noise/noiseFFT.C | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/randomProcesses/noise/noiseFFT.C b/src/randomProcesses/noise/noiseFFT.C index 9a7ca7cd95..a262125121 100644 --- a/src/randomProcesses/noise/noiseFFT.C +++ b/src/randomProcesses/noise/noiseFFT.C @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -53,16 +53,14 @@ Foam::noiseFFT::noiseFFT(const fileName& pFileName, const label skip) scalarField(), deltat_(0.0) { - // Construct control dictionary + // Construct pressure data file IFstream pFile(pFileName); // Check pFile stream is OK if (!pFile.good()) { - FatalErrorIn - ( - "noiseFFT::noiseFFT(const fileName&, const label)" - ) << "Cannot read file " << pFileName + FatalErrorIn("noiseFFT::noiseFFT(const scalar, const scalarField&)") + << "Cannot read file " << pFileName << exit(FatalError); } @@ -76,7 +74,10 @@ Foam::noiseFFT::noiseFFT(const fileName& pFileName, const label skip) if (!pFile.good() || pFile.eof()) { - FatalErrorIn("noiseFFT::noiseFFT(const fileName&, const label)") + FatalErrorIn + ( + "noiseFFT::noiseFFT(const scalar, const scalarField&)" + ) << "Number of points in file " << pFileName << " is less than the number to be skipped = " << skip << exit(FatalError); From 89473d43dd00786d7acd03e16aa5e2a84ae6fcd0 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 16 Jan 2013 16:38:37 +0000 Subject: [PATCH 02/19] ENH: Added sumDirection operation into faceSource function object --- .../field/fieldValues/faceSource/faceSource.C | 72 +++++++++++++++++-- .../field/fieldValues/faceSource/faceSource.H | 19 +++-- .../faceSource/faceSourceTemplates.C | 22 +++++- .../field/fieldValues/fieldValue/fieldValue.C | 5 +- .../field/fieldValues/fieldValue/fieldValue.H | 8 ++- .../fieldValues/fieldValue/fieldValueI.H | 8 ++- 6 files changed, 121 insertions(+), 13 deletions(-) diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index 14a6fa310e..d69ac989ad 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,10 +48,11 @@ namespace Foam template<> - const char* NamedEnum::names[] = + const char* NamedEnum::names[] = { "none", "sum", + "sumDirection", "average", "weightedAverage", "areaAverage", @@ -74,7 +75,7 @@ namespace Foam const Foam::NamedEnum Foam::fieldValues::faceSource::sourceTypeNames_; -const Foam::NamedEnum +const Foam::NamedEnum Foam::fieldValues::faceSource::operationTypeNames_; @@ -486,6 +487,46 @@ void Foam::fieldValues::faceSource::writeFileHeader(const label i) } +template<> +Foam::scalar Foam::fieldValues::faceSource::processValues +( + const Field& values, + const vectorField& Sf, + const scalarField& weightField +) const +{ + switch (operation_) + { + case opSumDirection: + { + const vector direction(dict_.lookup("direction")); + + 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; + } + default: + { + // Fall through to other operations + return processSameTypeValues(values, Sf, weightField); + } + } +} + + template<> Foam::vector Foam::fieldValues::faceSource::processValues ( @@ -496,14 +537,35 @@ Foam::vector Foam::fieldValues::faceSource::processValues { switch (operation_) { + case opSumDirection: + { + const vector direction(dict_.lookup("direction")); + + vector v(vector::zero); + + forAll(Sf, i) + { + scalar d = Sf[i] & direction; + if (d > 0) + { + v += pos(values[i] & direction)*values[i]; + } + else + { + v += neg(values[i] & direction)*values[i]; + } + } + + return v; + } case opAreaNormalAverage: { - scalar result = sum(values&Sf)/sum(mag(Sf)); + scalar result = sum(values & Sf)/sum(mag(Sf)); return vector(result, 0.0, 0.0); } case opAreaNormalIntegrate: { - scalar result = sum(values&Sf); + scalar result = sum(values & Sf); return vector(result, 0.0, 0.0); } default: diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H index 42bc27a311..9af8c7c342 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -87,6 +87,7 @@ Description \plaintable none | no operation sum | sum + sumDirection | sum values which are positive in given direction average | ensemble average weightedAverage | weighted average areaAverage | area weighted average @@ -176,6 +177,7 @@ public: { opNone, opSum, + opSumDirection, opAverage, opWeightedAverage, opAreaAverage, @@ -188,7 +190,7 @@ public: }; //- Operation type names - static const NamedEnum operationTypeNames_; + static const NamedEnum operationTypeNames_; private: @@ -366,8 +368,17 @@ public: }; -//- Specialisation of processing vectors for opAreaNormalAverage, -// opAreaNormalIntegrate (use inproduct - dimension reducing operation) +//- Specialisation of processing scalars +template<> +scalar faceSource::processValues +( + const Field& values, + const vectorField& Sf, + const scalarField& weightField +) const; + + +//- Specialisation of processing vectors template<> vector faceSource::processValues ( diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C index a82f489036..8177946ffc 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -141,6 +141,26 @@ Type Foam::fieldValues::faceSource::processSameTypeValues result = sum(values); break; } + case opSumDirection: + { + FatalErrorIn + ( + "template" + "Type Foam::fieldValues::faceSource::processSameTypeValues" + "(" + "const Field&, " + "const vectorField&, " + "const scalarField&" + ") const" + ) + << "Operation " << operationTypeNames_[operation_] + << " not available for values of type " + << pTraits::typeName + << exit(FatalError); + + result = pTraits::zero; + break; + } case opAverage: { result = sum(values)/values.size(); diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C index 5cb2faa3b6..50d47d8198 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.C @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,8 @@ void Foam::fieldValue::read(const dictionary& dict) { if (active_) { + dict_ = dict; + log_ = dict.lookupOrDefault("log", false); dict.lookup("fields") >> fields_; dict.lookup("valueOutput") >> valueOutput_; @@ -78,6 +80,7 @@ Foam::fieldValue::fieldValue functionObjectFile(obr, name, valueType), name_(name), obr_(obr), + dict_(dict), active_(true), log_(false), sourceName_(dict.lookupOrDefault("sourceName", "sampledSurface")), diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H index 1b2f2621e7..b7994383d5 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,6 +75,9 @@ protected: //- Database this class is registered to const objectRegistry& obr_; + //- Construction dictionary + dictionary dict_; + //- Active flag bool active_; @@ -149,6 +152,9 @@ public: //- Return the reference to the object registry inline const objectRegistry& obr() const; + //- Return the reference to the construction dictionary + inline const dictionary& dict() const; + //- Return the active flag inline bool active() const; diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.H index aaee816af2..55651a3539 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.H +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueI.H @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,6 +40,12 @@ inline const Foam::objectRegistry& Foam::fieldValue::obr() const } +inline const Foam::dictionary& Foam::fieldValue::dict() const +{ + return dict_; +} + + inline bool Foam::fieldValue::active() const { return active_; From 55b083336ce2a68c3658219aa4e213c3a540521f Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 16 Jan 2013 16:39:14 +0000 Subject: [PATCH 03/19] ENH: Added average option to fieldValueDelta function object --- .../fieldValueDelta/fieldValueDelta.C | 17 ++++++++--------- .../fieldValueDelta/fieldValueDelta.H | 18 +++++++++++++++--- .../fieldValueDelta/fieldValueDeltaTemplates.C | 16 ++++++++++++++-- 3 files changed, 37 insertions(+), 14 deletions(-) diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C index 20614f474f..cf9fb29236 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,15 +38,16 @@ namespace Foam template<> const char* - NamedEnum::names[] = + NamedEnum::names[] = { "add", "subtract", "min", - "max" + "max", + "average" }; - const NamedEnum + const NamedEnum fieldValues::fieldValueDelta::operationTypeNames_; } @@ -158,7 +159,7 @@ void Foam::fieldValues::fieldValueDelta::write() if (log_) { - Info<< type() << " output:" << endl; + Info<< type() << " " << name_ << " output:" << endl; } bool found = false; @@ -179,10 +180,8 @@ void Foam::fieldValues::fieldValueDelta::write() { Info<< " none" << endl; } - else - { - Info<< endl; - } + + Info<< endl; } } diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H index e28771109a..24d72f1f6b 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDelta.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,8 @@ Description { type fieldValueDelta; functionObjectLibs ("libfieldFunctionObjects.so"); + operation subtract; + fieldValue1 { ... @@ -54,6 +56,15 @@ Description type | type name: fieldValueDelta | yes | \endtable + \linebreak + The \c operation is one of: + \plaintable + add | add + subtract | subtract + min | minimum + max | maximum + average | average + \endplaintable SeeAlso Foam::fieldValue @@ -92,11 +103,12 @@ public: opAdd, opSubtract, opMin, - opMax + opMax, + opAverage }; //- Operation type names - static const NamedEnum operationTypeNames_; + static const NamedEnum operationTypeNames_; private: diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C index 6b757fc2df..b107c79527 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValueDelta/fieldValueDeltaTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ License #include "GeometricField.H" #include "volMesh.H" +#include "surfaceMesh.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -59,6 +60,11 @@ Type Foam::fieldValues::fieldValueDelta::applyOperation result = max(value1, value2); break; } + case opAverage: + { + result = 0.5*(value1 + value2); + break; + } default: { FatalErrorIn @@ -83,6 +89,7 @@ template void Foam::fieldValues::fieldValueDelta::processFields(bool& found) { typedef GeometricField vf; + typedef GeometricField sf; const wordList& fields1 = source1Ptr_->fields(); @@ -95,7 +102,12 @@ void Foam::fieldValues::fieldValueDelta::processFields(bool& found) forAll(fields1, i) { const word& fieldName = fields1[i]; - if (obr_.foundObject(fieldName) && results2.found(fieldName)) + + if + ( + (obr_.foundObject(fieldName) || obr_.foundObject(fieldName)) + && results2.found(fieldName) + ) { results1.lookup(fieldName) >> r1; results2.lookup(fieldName) >> r2; From 9e5e2c8beae87e83a7a3ad14d79a575664af78bb Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 16 Jan 2013 16:41:08 +0000 Subject: [PATCH 04/19] ENH: Added scale option to nastranSurfaceWriter --- .../writers/nastran/nastranSurfaceWriter.C | 10 ++++++---- .../writers/nastran/nastranSurfaceWriter.H | 5 ++++- .../writers/nastran/nastranSurfaceWriterTemplates.C | 10 ++++++---- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C index 436457c469..eaa16feb6b 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -336,15 +336,17 @@ Foam::nastranSurfaceWriter::nastranSurfaceWriter() : surfaceWriter(), writeFormat_(wfShort), - fieldMap_() + fieldMap_(), + scale_(1.0) {} Foam::nastranSurfaceWriter::nastranSurfaceWriter(const dictionary& options) : surfaceWriter(), - writeFormat_(wfShort), - fieldMap_() + writeFormat_(wfLong), + fieldMap_(), + scale_(options.lookupOrDefault("scale", 1.0)) { if (options.found("format")) { diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H index 4e968ee55f..35374a7d94 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -75,6 +75,9 @@ private: //- Map of OpenFOAM field name vs nastran field name HashTable fieldMap_; + //- Scale to apply to values (default = 1.0) + scalar scale_; + // Private Member Functions diff --git a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C index e43dc5757f..fc0a283d75 100644 --- a/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C +++ b/src/sampling/sampledSurface/writers/nastran/nastranSurfaceWriterTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -46,6 +46,8 @@ void Foam::nastranSurfaceWriter::writeFaceValue label SID = 1; + Type scaledValue = scale_*value; + switch (writeFormat_) { case wfShort: @@ -59,7 +61,7 @@ void Foam::nastranSurfaceWriter::writeFaceValue for (direction dirI = 0; dirI < pTraits::nComponents; dirI++) { - os << setw(8) << component(value, dirI); + os << setw(8) << component(scaledValue, dirI); } os.unsetf(ios_base::right); @@ -77,7 +79,7 @@ void Foam::nastranSurfaceWriter::writeFaceValue for (direction dirI = 0; dirI < pTraits::nComponents; dirI++) { - os << setw(16) << component(value, dirI); + os << setw(16) << component(scaledValue, dirI); } os.unsetf(ios_base::right); @@ -98,7 +100,7 @@ void Foam::nastranSurfaceWriter::writeFaceValue for (direction dirI = 0; dirI < pTraits::nComponents; dirI++) { - os << ',' << component(value, dirI); + os << ',' << component(scaledValue, dirI); } break; From 5e13cdf1ff6de32a4cce967d6097bc3598341854 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 16 Jan 2013 17:00:08 +0000 Subject: [PATCH 05/19] BUG: Corrected bug in spray break-up model --- .../spray/submodels/BreakupModel/PilchErdman/PilchErdman.C | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C b/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C index d900260410..2aca8ae5ad 100644 --- a/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C +++ b/src/lagrangian/spray/submodels/BreakupModel/PilchErdman/PilchErdman.C @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -127,10 +127,10 @@ bool Foam::PilchErdman::update scalar rho12 = sqrt(rhoc/rho); - scalar Vd = Urmag*rho12*(B1_*taubBar * B2_*taubBar*taubBar); + scalar Vd = Urmag*rho12*(B1_*taubBar + B2_*taubBar*taubBar); scalar Vd1 = sqr(1.0 - Vd/Urmag); Vd1 = max(Vd1, SMALL); - scalar Ds = 2.0*Wec*sigma*Vd1/(Vd1*rhoc*sqr(Urmag)); + scalar Ds = 2.0*Wec*sigma/(Vd1*rhoc*sqr(Urmag)); scalar A = Urmag*rho12/d; scalar taub = taubBar/A; From d4a937aafc5c1fe8fa333eee5520f4569985e252 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 17 Jan 2013 11:22:58 +0000 Subject: [PATCH 06/19] ENH: face source: updated sumDirection op for vector --- .../field/fieldValues/faceSource/faceSource.C | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index d69ac989ad..dd54de718a 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C @@ -540,23 +540,7 @@ Foam::vector Foam::fieldValues::faceSource::processValues case opSumDirection: { const vector direction(dict_.lookup("direction")); - - vector v(vector::zero); - - forAll(Sf, i) - { - scalar d = Sf[i] & direction; - if (d > 0) - { - v += pos(values[i] & direction)*values[i]; - } - else - { - v += neg(values[i] & direction)*values[i]; - } - } - - return v; + return sum(pos(values & direction)*values); } case opAreaNormalAverage: { From 59c4dfe0db3099ef5888231184b6a2c41a4e1253 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 17 Jan 2013 12:38:07 +0000 Subject: [PATCH 07/19] ENH: Tutorial update --- .../chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions index 00978429d9..475ac8e040 100644 --- a/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions +++ b/tutorials/heatTransfer/chtMultiRegionSimpleFoam/heatExchanger/system/air/fvOptions @@ -69,7 +69,7 @@ MRF1 { origin (0.25 0.25 0.25); axis (0 0 1); - omega 5.305; // 500 rpm + omega 477.5; // 500 rpm } } From fd7bcb62e946e716f59552bbaced8b87c037852c Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 18 Jan 2013 08:32:19 +0000 Subject: [PATCH 08/19] ENH: Updated tutorial --- .../incompressible/simpleFoam/motorBike/system/forceCoeffs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs b/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs index c3a066a07f..7ecdf60478 100644 --- a/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs +++ b/tutorials/incompressible/simpleFoam/motorBike/system/forceCoeffs @@ -10,8 +10,7 @@ forceCoeffs1 { type forceCoeffs; functionObjectLibs ( "libforces.so" ); - outputControl timeStep; - outputInterval 1; + outputControl outputTime; log yes; patches ( "motorBike.*" ); From ba391381abdd59695b264b0cd305bf32e5961537 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 21 Jan 2013 11:40:20 +0000 Subject: [PATCH 09/19] STYLE: minor input file change --- .../rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions index d75a43c565..57de407801 100644 --- a/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions +++ b/tutorials/compressible/rhoSimpleFoam/angledDuctExplicitFixedCoeff/system/fvOptions @@ -59,4 +59,4 @@ porosity1 } -************************************************************************* // +//***************************************************************************// From 4256e0a770842ee656d82f4ca935e370768f600b Mon Sep 17 00:00:00 2001 From: laurence Date: Mon, 21 Jan 2013 14:39:16 +0000 Subject: [PATCH 10/19] ENH: edgeCollapser: Make mesh checking optional and set default values for dictionary Update biconic25-55Run35 tutorial with simplified collapseDict --- .../mesh/advanced/collapseEdges/collapseDict | 25 ++- .../polyMeshFilter/polyMeshFilter.C | 202 ++++++++++-------- .../polyMeshFilter/polyMeshFilter.H | 8 +- .../polyTopoChange/edgeCollapser.C | 9 +- .../biconic25-55Run35/system/collapseDict | 56 ----- .../biconic25-55Run35/system/meshQualityDict | 67 ------ 6 files changed, 136 insertions(+), 231 deletions(-) delete mode 100644 tutorials/compressible/rhoCentralFoam/biconic25-55Run35/system/meshQualityDict diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseDict b/applications/utilities/mesh/advanced/collapseEdges/collapseDict index 340c33049f..170a0a890d 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseDict +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseDict @@ -14,6 +14,11 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// If on, after collapsing check the quality of the mesh. If bad faces are +// generated then redo the collapsing with stricter filtering. +controlMeshQuality on; + + collapseEdgesCoeffs { // Edges shorter than this absolute value will be merged @@ -22,21 +27,13 @@ collapseEdgesCoeffs // The maximum angle between two edges that share a point attached to // no other edges maximumMergeAngle 30; - - // The amount that minimumEdgeLength will be reduced by for each - // edge if that edge's collapse generates a poor quality face - reductionFactor 0.5; } collapseFacesCoeffs { // The initial face length factor - initialFaceLengthFactor 0.5; - - // The amount that initialFaceLengthFactor will be reduced by for each - // face if its collapse generates a poor quality face - reductionFactor $initialFaceLengthFactor; + initialFaceLengthFactor 0.5; // If the face can't be collapsed to an edge, and it has a span less than // the target face length multiplied by this coefficient, collapse it @@ -63,12 +60,20 @@ collapseFacesCoeffs } -meshQualityCoeffs +controlMeshQualityCoeffs { // Name of the dictionary that has the mesh quality coefficients used // by motionSmoother::checkMesh #include "meshQualityDict"; + // The amount that minimumEdgeLength will be reduced by for each + // edge if that edge's collapse generates a poor quality face + edgeReductionFactor 0.5; + + // The amount that initialFaceLengthFactor will be reduced by for each + // face if its collapse generates a poor quality face + faceReductionFactor $initialFaceLengthFactor; + // Maximum number of smoothing iterations for the reductionFactors maximumSmoothingIterations 2; diff --git a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C index 9b184f994e..a1cfc83aeb 100644 --- a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C +++ b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C @@ -427,9 +427,13 @@ Foam::polyMeshFilter::polyMeshFilter(const fvMesh& mesh) IOobject::NO_WRITE ) ), + controlMeshQuality_ + ( + dict_.lookupOrDefault("controlMeshQuality", false) + ), collapseEdgesCoeffDict_(dict_.subDict("collapseEdgesCoeffs")), - collapseFacesCoeffDict_(dict_.subDict("collapseFacesCoeffs")), - meshQualityCoeffDict_(dict_.subDict("meshQualityCoeffs")), + collapseFacesCoeffDict_(dict_.subOrEmptyDict("collapseFacesCoeffs")), + meshQualityCoeffDict_(dict_.subOrEmptyDict("controlMeshQualityCoeffs")), minLen_(readScalar(collapseEdgesCoeffDict_.lookup("minimumEdgeLength"))), maxCos_ ( @@ -443,27 +447,39 @@ Foam::polyMeshFilter::polyMeshFilter(const fvMesh& mesh) ), edgeReductionFactor_ ( - readScalar(collapseEdgesCoeffDict_.lookup("reductionFactor")) + meshQualityCoeffDict_.lookupOrDefault("edgeReductionFactor", -1) ), maxIterations_ ( - readLabel(meshQualityCoeffDict_.lookup("maximumIterations")) + meshQualityCoeffDict_.lookupOrAddDefault