From 711e0a42dd1a2615249e8ae8f65960b7c0dbd4dc Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 8 Jan 2010 12:16:01 +0000 Subject: [PATCH 01/15] Updated function object example usage --- .../functionObjects/field/fieldAverage/controlDict | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/postProcessing/functionObjects/field/fieldAverage/controlDict b/src/postProcessing/functionObjects/field/fieldAverage/controlDict index 0132aa91dd..3e186c89e2 100644 --- a/src/postProcessing/functionObjects/field/fieldAverage/controlDict +++ b/src/postProcessing/functionObjects/field/fieldAverage/controlDict @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application oodles; +application XXX; startFrom latestTime; @@ -54,6 +54,12 @@ functions // Where to load it from (if not already in solver) functionObjectLibs ("libfieldAverage.so"); + // Function object enabled flag + enabled true; + + // When to output the average fields + outputControl outputTime; + // Fields to be averaged - runTime modifiable fields ( From 1812773b2518942bcd6e7178d0121b103f90fba8 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 8 Jan 2010 17:14:53 +0000 Subject: [PATCH 02/15] Updates to the fieldValues function object - Updates to enable correct operation in parallel - Added weighted average operation for cell sources --- .../field/fieldValues/cellSource/cellSource.C | 52 ++++-- .../field/fieldValues/cellSource/cellSource.H | 35 +++- .../cellSource/cellSourceTemplates.C | 69 ++++---- .../field/fieldValues/faceSource/faceSource.C | 19 ++- .../field/fieldValues/faceSource/faceSource.H | 19 ++- .../faceSource/faceSourceTemplates.C | 150 +++++------------- .../field/fieldValues/fieldValue/fieldValue.H | 13 ++ .../fieldValue/fieldValueTemplates.C | 66 ++++++++ 8 files changed, 249 insertions(+), 174 deletions(-) create mode 100644 src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueTemplates.C diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C index b94b687ba1..239aa4342d 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.C @@ -46,10 +46,13 @@ namespace Foam fieldValues::cellSource::sourceTypeNames_; template<> - const char* NamedEnum:: - names[] = {"none", "sum", "volAverage", "volIntegrate"}; + const char* NamedEnum:: + names[] = + { + "none", "sum", "volAverage", "volIntegrate", "weightedAverage" + }; - const NamedEnum + const NamedEnum fieldValues::cellSource::operationTypeNames_; } @@ -93,7 +96,7 @@ void Foam::fieldValues::cellSource::setCellZoneCells() // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -void Foam::fieldValues::cellSource::initialise() +void Foam::fieldValues::cellSource::initialise(const dictionary& dict) { switch (source_) { @@ -104,7 +107,7 @@ void Foam::fieldValues::cellSource::initialise() } default: { - FatalErrorIn("cellSource::constructCellAddressing()") + FatalErrorIn("cellSource::initialise()") << "Unknown source type. Valid source types are:" << sourceTypeNames_ << nl << exit(FatalError); } @@ -114,6 +117,29 @@ void Foam::fieldValues::cellSource::initialise() << " total cells = " << cellId_.size() << nl << " total volume = " << sum(filterField(mesh().V())) << nl << endl; + + if (operation_ == opWeightedAverage) + { + dict.lookup("weightField") >> weightFieldName_; + if + ( + obr().foundObject(weightFieldName_) + ) + { + Info<< " weight field = " << weightFieldName_; + } + else + { + FatalErrorIn("cellSource::initialise()") + << type() << " " << name_ << ": " + << sourceTypeNames_[source_] << "(" << sourceName_ << "):" + << nl << " Weight field " << weightFieldName_ + << " must be a " << volScalarField::typeName + << nl << exit(FatalError); + } + } + + Info<< nl << endl; } @@ -172,7 +198,7 @@ void Foam::fieldValues::cellSource::read(const dictionary& dict) if (active_) { // no additional info to read - initialise(); + initialise(dict); } } @@ -183,9 +209,12 @@ void Foam::fieldValues::cellSource::write() if (active_) { - outputFilePtr_() - << obr_.time().value() << tab - << sum(filterField(mesh().V())); + if (Pstream::master()) + { + outputFilePtr_() + << obr_.time().value() << tab + << sum(filterField(mesh().V())); + } forAll(fields_, i) { @@ -196,7 +225,10 @@ void Foam::fieldValues::cellSource::write() writeValues(fields_[i]); } - outputFilePtr_()<< endl; + if (Pstream::master()) + { + outputFilePtr_()<< endl; + } if (log_) { diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H index 89cc9ad010..a8d04f7d9a 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSource.H @@ -39,7 +39,7 @@ Description valueOutput true; // Write values at run-time output times? source cellZone; // Type of cell source sourceName c0; - operation volAverage; // none, sum, volAverage, volIntegrate + operation volAverage; fields ( p @@ -47,6 +47,13 @@ Description ); } + where operation is one of: + - none + - sum + - volAverage + - volIntegrate + - weightedAverage + SourceFiles cellSource.C @@ -96,11 +103,12 @@ public: opNone, opSum, opVolAverage, - opVolIntegrate + opVolIntegrate, + opWeightedAverage }; //- Operation type names - static const NamedEnum operationTypeNames_; + static const NamedEnum operationTypeNames_; private: @@ -127,23 +135,34 @@ protected: //- Local list of cell IDs labelList cellId_; + //- Weight field name - only used for opWeightedAverage mode + word weightFieldName_; + // Protected member functions //- Initialise, e.g. cell addressing - void initialise(); + void initialise(const dictionary& dict); + + //- Return true if the field name is valid + template + bool validField(const word& fieldName) const; //- Insert field values into values list template - bool setFieldValues + tmp > setFieldValues ( - const word& fieldName, - List& values + const word& fieldName ) const; //- Apply the 'operation' to the values template - Type processValues(const List& values) const; + Type processValues + ( + const Field& values, + const scalarField& V, + const scalarField& weightField + ) const; //- Output file header information virtual void writeFileHeader(); diff --git a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C index fe495fcca6..41c5e70d26 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/cellSource/cellSourceTemplates.C @@ -27,27 +27,16 @@ License #include "cellSource.H" #include "volFields.H" #include "IOList.H" -#include "ListListOps.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template -bool Foam::fieldValues::cellSource::setFieldValues -( - const word& fieldName, - List& values -) const +bool Foam::fieldValues::cellSource::validField(const word& fieldName) const { - values.setSize(cellId_.size(), pTraits::zero); - typedef GeometricField vf; if (obr_.foundObject(fieldName)) { - const vf& field = obr_.lookupObject(fieldName); - - values = UIndirectList(field, cellId_); - return true; } @@ -55,10 +44,29 @@ bool Foam::fieldValues::cellSource::setFieldValues } +template +Foam::tmp > Foam::fieldValues::cellSource::setFieldValues +( + const word& fieldName +) const +{ + typedef GeometricField vf; + + if (obr_.foundObject(fieldName)) + { + return filterField(obr_.lookupObject(fieldName)); + } + + return tmp >(new Field(0.0)); +} + + template Type Foam::fieldValues::cellSource::processValues ( - const List& values + const Field& values, + const scalarField& V, + const scalarField& weightField ) const { Type result = pTraits::zero; @@ -71,13 +79,17 @@ Type Foam::fieldValues::cellSource::processValues } case opVolAverage: { - tmp V = filterField(mesh().V()); - result = sum(values*V())/sum(V()); + result = sum(values*V)/sum(V); break; } case opVolIntegrate: { - result = sum(values*filterField(mesh().V())); + result = sum(values*V); + break; + } + case opWeightedAverage: + { + result = sum(values*weightField)/sum(weightField); break; } default: @@ -95,25 +107,20 @@ Type Foam::fieldValues::cellSource::processValues template bool Foam::fieldValues::cellSource::writeValues(const word& fieldName) { - List > allValues(Pstream::nProcs()); + const bool ok = validField(fieldName); - bool validField = - setFieldValues(fieldName, allValues[Pstream::myProcNo()]); - - if (validField) + if (ok) { - Pstream::gatherList(allValues); + Field values = combineFields(setFieldValues(fieldName)); + + scalarField V = combineFields(filterField(mesh().V())); + + scalarField weightField = + combineFields(setFieldValues(weightFieldName_)); if (Pstream::master()) { - List values = - ListListOps::combine > - ( - allValues, - accessOp >() - ); - - Type result = processValues(values); + Type result = processValues(values, V, weightField); if (valueOutput_) { @@ -144,7 +151,7 @@ bool Foam::fieldValues::cellSource::writeValues(const word& fieldName) } } - return validField; + return ok; } diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index b609f4310a..e84fe07402 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C @@ -220,7 +220,7 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict) } default: { - FatalErrorIn("faceSource::constructFaceAddressing()") + FatalErrorIn("faceSource::initiliase()") << type() << " " << name_ << ": " << sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl << " Unknown source type. Valid source types are:" @@ -245,7 +245,7 @@ void Foam::fieldValues::faceSource::initialise(const dictionary& dict) } else { - FatalErrorIn("faceSource::constructFaceAddressing()") + FatalErrorIn("faceSource::initialise()") << type() << " " << name_ << ": " << sourceTypeNames_[source_] << "(" << sourceName_ << "):" << nl << " Weight field " << weightFieldName_ @@ -326,9 +326,12 @@ void Foam::fieldValues::faceSource::write() if (active_) { - outputFilePtr_() - << obr_.time().value() << tab - << sum(filterField(mesh().magSf())); + if (Pstream::master()) + { + outputFilePtr_() + << obr_.time().value() << tab + << sum(filterField(mesh().magSf())); + } forAll(fields_, i) { @@ -339,7 +342,10 @@ void Foam::fieldValues::faceSource::write() writeValues(fields_[i]); } - outputFilePtr_()<< endl; + if (Pstream::master()) + { + outputFilePtr_()<< endl; + } if (log_) { @@ -350,4 +356,3 @@ void Foam::fieldValues::faceSource::write() // ************************************************************************* // - diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H index e8e2634b12..8ef65d870b 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H @@ -153,17 +153,22 @@ protected: //- Initialise, e.g. face addressing void initialise(const dictionary& dict); - //- Insert field values into values list + //- Return true if the field name is valid template - bool setFieldValues - ( - const word& fieldName, - List& values - ) const; + bool validField(const word& fieldName) const; + + //- Return field values by looking up field name + template + tmp > setFieldValues(const word& fieldName) const; //- Apply the 'operation' to the values template - Type processValues(const List& values) const; + Type processValues + ( + const Field& values, + const scalarField& magSf, + const scalarField& weightField + ) const; //- Output file header information virtual void writeFileHeader(); diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C index d7609573a7..a257384a50 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C @@ -33,70 +33,17 @@ License // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template -bool Foam::fieldValues::faceSource::setFieldValues -( - const word& fieldName, - List& values -) const +bool Foam::fieldValues::faceSource::validField(const word& fieldName) const { - values.setSize(faceId_.size(), pTraits::zero); - typedef GeometricField sf; typedef GeometricField vf; if (obr_.foundObject(fieldName)) { - const sf& field = obr_.lookupObject(fieldName); - - forAll(values, i) - { - label faceI = faceId_[i]; - label patchI = facePatchId_[i]; - if (patchI >= 0) - { - values[i] = field.boundaryField()[patchI][faceI]; - } - else - { - values[i] = field[faceI]; - } - - values[i] *= flipMap_[i]; - } - return true; } else if (obr_.foundObject(fieldName)) { - const vf& field = obr_.lookupObject(fieldName); - - forAll(values, i) - { - label faceI = faceId_[i]; - label patchI = facePatchId_[i]; - if (patchI >= 0) - { - values[i] = field.boundaryField()[patchI][faceI]; - } - else - { - FatalErrorIn - ( - "fieldValues::faceSource::setFieldValues" - "(" - "const word&, " - "List&" - ") const" - ) << type() << " " << name_ << ": " - << sourceTypeNames_[source_] << "(" << sourceName_ << "):" - << nl - << " Unable to process internal faces for volume field " - << fieldName << nl << abort(FatalError); - } - - values[i] *= flipMap_[i]; - } - return true; } @@ -104,10 +51,34 @@ bool Foam::fieldValues::faceSource::setFieldValues } +template +Foam::tmp > Foam::fieldValues::faceSource::setFieldValues +( + const word& fieldName +) const +{ + typedef GeometricField sf; + typedef GeometricField vf; + + if (obr_.foundObject(fieldName)) + { + return filterField(obr_.lookupObject(fieldName)); + } + else if (obr_.foundObject(fieldName)) + { + return filterField(obr_.lookupObject(fieldName)); + } + + return tmp >(new Field(0.0)); +} + + template Type Foam::fieldValues::faceSource::processValues ( - const List& values + const Field& values, + const scalarField& magSf, + const scalarField& weightField ) const { Type result = pTraits::zero; @@ -120,54 +91,17 @@ Type Foam::fieldValues::faceSource::processValues } case opAreaAverage: { - tmp magSf = filterField(mesh().magSf()); - result = sum(values*magSf())/sum(magSf()); + result = sum(values*magSf)/sum(magSf); break; } case opAreaIntegrate: { - result = sum(values*filterField(mesh().magSf())); + result = sum(values*magSf); break; } case opWeightedAverage: { - if (mesh().foundObject(weightFieldName_)) - { - tmp wField = - filterField - ( - mesh().lookupObject(weightFieldName_) - ); - result = sum(values*wField())/sum(wField()); - } - else if (mesh().foundObject(weightFieldName_)) - { - tmp wField = - filterField - ( - mesh().lookupObject - ( - weightFieldName_ - ) - ); - result = sum(values*wField())/sum(wField()); - } - else - { - FatalErrorIn - ( - "fieldValues::faceSource::processValues" - "(" - "List&" - ") const" - ) << type() << " " << name_ << ": " - << sourceTypeNames_[source_] << "(" << sourceName_ << "):" - << nl - << " Weight field " << weightFieldName_ - << " must be either a " << volScalarField::typeName - << " or " << surfaceScalarField::typeName << nl - << abort(FatalError); - } + result = sum(values*weightField)/sum(weightField); break; } default: @@ -185,25 +119,20 @@ Type Foam::fieldValues::faceSource::processValues template bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) { - List > allValues(Pstream::nProcs()); + const bool ok = validField(fieldName); - bool validField = - setFieldValues(fieldName, allValues[Pstream::myProcNo()]); - - if (validField) + if (ok) { - Pstream::gatherList(allValues); + Field values = combineFields(setFieldValues(fieldName)); + + scalarField magSf = combineFields(filterField(mesh().magSf())); + + scalarField weightField = + combineFields(setFieldValues(weightFieldName_)); if (Pstream::master()) { - List values = - ListListOps::combine > - ( - allValues, - accessOp >() - ); - - Type result = processValues(values); + Type result = processValues(values, magSf, weightField); if (valueOutput_) { @@ -222,7 +151,6 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) ).write(); } - outputFilePtr_()<< tab << result; if (log_) @@ -234,7 +162,7 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) } } - return validField; + return ok; } diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H index 1b96bb8e41..4aa6f41bd7 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValue.H @@ -164,6 +164,13 @@ public: //- Execute the at the final time-loop, currently does nothing virtual void end(); + + //- Comnbine fields from all processor domains into single field + template + tmp > combineFields + ( + const tmp >& field + ) const; }; @@ -177,6 +184,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository + #include "fieldValueTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueTemplates.C new file mode 100644 index 0000000000..23c700134f --- /dev/null +++ b/src/postProcessing/functionObjects/field/fieldValues/fieldValue/fieldValueTemplates.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd. + \\/ 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 2 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 "fieldValue.H" +#include "ListListOps.H" +#include "Pstream.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::tmp > Foam::fieldValue::combineFields +( + const tmp >& field +) const +{ + List > allValues(Pstream::nProcs()); + + allValues[Pstream::myProcNo()] = field(); + + Pstream::gatherList(allValues); + + if (Pstream::master()) + { + return tmp > + ( + new Field + ( + ListListOps::combine > + ( + allValues, + accessOp >() + ) + ) + ); + } + else + { + return field(); + } +} + + +// ************************************************************************* // From b441bb1f993655244b52564bceaa2de5c3edfdb2 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 10:46:57 +0000 Subject: [PATCH 03/15] Removed unused code-template code --- src/dynamicMesh/meshCut/directions/directions.C | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/src/dynamicMesh/meshCut/directions/directions.C b/src/dynamicMesh/meshCut/directions/directions.C index b50069d606..b77d2cefa4 100644 --- a/src/dynamicMesh/meshCut/directions/directions.C +++ b/src/dynamicMesh/meshCut/directions/directions.C @@ -446,19 +446,4 @@ Foam::directions::directions } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * // - - -// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // - - // ************************************************************************* // From 96ce5ae412f5d1a3b4f1f5a0ccec800107612488 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 12:05:39 +0000 Subject: [PATCH 04/15] Corrections and updates to turbulent heat flux temperature BC - Corrected calculation of temperature gradient - Option to specify the heat source in terms of a power [W] or flux [W/m2] --- ...entHeatFluxTemperatureFvPatchScalarField.C | 78 +++++++++++++------ ...entHeatFluxTemperatureFvPatchScalarField.H | 30 +++++-- 2 files changed, 79 insertions(+), 29 deletions(-) diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C index 2f54baf7c2..1832566586 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C @@ -37,6 +37,22 @@ namespace Foam namespace compressible { +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template<> +const char* +NamedEnum:: +names[] = + { + "power", + "flux" + }; + +const +NamedEnum + turbulentHeatFluxTemperatureFvPatchScalarField::heatSourceTypeNames_; + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // turbulentHeatFluxTemperatureFvPatchScalarField:: @@ -47,8 +63,8 @@ turbulentHeatFluxTemperatureFvPatchScalarField ) : fixedGradientFvPatchScalarField(p, iF), - q_(p.size(), 0.0), - rhoName_("rho") + heatSource_(hsPower), + q_(p.size(), 0.0) {} @@ -62,8 +78,8 @@ turbulentHeatFluxTemperatureFvPatchScalarField ) : fixedGradientFvPatchScalarField(ptf, p, iF, mapper), - q_(ptf.q_, mapper), - rhoName_(ptf.rhoName_) + heatSource_(ptf.heatSource_), + q_(ptf.q_, mapper) {} @@ -76,8 +92,8 @@ turbulentHeatFluxTemperatureFvPatchScalarField ) : fixedGradientFvPatchScalarField(p, iF), - q_("q", dict, p.size()), - rhoName_(dict.lookupOrDefault("rho", "rho")) + heatSource_(heatSourceTypeNames_.read(dict.lookup("heatSource"))), + q_("q", dict, p.size()) { fvPatchField::operator=(patchInternalField()); gradient() = 0.0; @@ -91,8 +107,8 @@ turbulentHeatFluxTemperatureFvPatchScalarField ) : fixedGradientFvPatchScalarField(thftpsf), - q_(thftpsf.q_), - rhoName_(thftpsf.rhoName_) + heatSource_(thftpsf.heatSource_), + q_(thftpsf.q_) {} @@ -104,8 +120,8 @@ turbulentHeatFluxTemperatureFvPatchScalarField ) : fixedGradientFvPatchScalarField(thftpsf, iF), - q_(thftpsf.q_), - rhoName_(thftpsf.rhoName_) + heatSource_(thftpsf.heatSource_), + q_(thftpsf.q_) {} @@ -150,22 +166,39 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs() const RASModel& rasModel = db().lookupObject("RASProperties"); - const scalarField alphaEffp = rasModel.alphaEff()().boundaryField()[patchI]; + const scalarField alphaEffp = rasModel.alphaEff(patchI); - const basicThermo& thermo = - db().lookupObject("thermophysicalProperties"); - -// const scalarField& Tp = thermo.T().boundaryField()[patchI]; const scalarField& Tp = *this; - const scalarField Cpp = thermo.Cp(Tp, patchI); + const scalarField Cpp = rasModel.thermo().Cp(Tp, patchI); - const scalarField& rhop = - patch().lookupPatchField(rhoName_); - - const scalar Ap = gSum(patch().magSf()); - - gradient() = q_/(Ap*rhop*Cpp*alphaEffp); + switch (heatSource_) + { + case hsPower: + { + const scalar Ap = gSum(patch().magSf()); + gradient() = q_/(Ap*Cpp*alphaEffp); + break; + } + case hsFlux: + { + gradient() = q_/(Cpp*alphaEffp); + break; + } + default: + { + FatalErrorIn + ( + "turbulentHeatFluxTemperatureFvPatchScalarField" + "(" + "const fvPatch&, " + "const DimensionedField&, " + "const dictionary&" + ")" + ) << "Unknown heat source type. Valid types are: " + << heatSourceTypeNames_ << nl << exit(FatalError); + } + } fixedGradientFvPatchScalarField::updateCoeffs(); } @@ -178,7 +211,6 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::write { fvPatchScalarField::write(os); q_.writeEntry("q", os); - os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl; gradient().writeEntry("gradient", os); writeEntry("value", os); } diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H index f7581102df..f32894a130 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H @@ -38,6 +38,7 @@ SourceFiles #include "fvPatchFields.H" #include "fixedGradientFvPatchFields.H" +#include "NamedEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,20 +48,37 @@ namespace compressible { /*---------------------------------------------------------------------------*\ - Class turbulentHeatFluxTemperatureFvPatchScalarField Declaration + Class turbulentHeatFluxTemperatureFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ class turbulentHeatFluxTemperatureFvPatchScalarField : public fixedGradientFvPatchScalarField { -// Private data +public: - //- Heat flux [W] - scalarField q_; + // Data types - //- Name of density field - word rhoName_; + //- Enumeration listing the possible hest source input modes + enum heatSourceType + { + hsPower, + hsFlux + }; + + + private: + + // Private data + + //- Heat source type names + static const NamedEnum heatSourceTypeNames_; + + //- Heat source type + heatSourceType heatSource_; + + //- Heat flux [W/m2] + scalarField q_; public: From 3b2c4abd574b49077e9ff95ff340769c1ec6db2c Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 12:07:15 +0000 Subject: [PATCH 05/15] Updates to the compressible LES/RAS api - removed repeated declaration of pure abstract functions - added function to return the turbulence effective thermal diffusivity for a patch --- .../LES/GenEddyVisc/GenEddyVisc.H | 9 ----- .../LES/GenSGSStress/GenSGSStress.H | 9 ----- .../compressible/LES/LESModel/LESModel.H | 28 +++++++++------ .../LES/SpalartAllmaras/SpalartAllmaras.H | 9 ----- .../compressible/RAS/LRR/LRR.H | 9 ++--- .../RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H | 9 ++--- .../RAS/LaunderSharmaKE/LaunderSharmaKE.H | 9 ++--- .../compressible/RAS/RASModel/RASModel.H | 36 +++++++++---------- .../RAS/RNGkEpsilon/RNGkEpsilon.H | 9 ++--- .../RAS/SpalartAllmaras/SpalartAllmaras.H | 9 ++--- .../compressible/RAS/kEpsilon/kEpsilon.H | 9 ++--- .../compressible/RAS/kOmegaSST/kOmegaSST.H | 9 ++--- .../compressible/RAS/laminar/laminar.C | 21 +++++++++++ .../compressible/RAS/laminar/laminar.H | 3 ++ .../RAS/realizableKE/realizableKE.H | 9 ++--- .../turbulenceModel/laminar/laminar.H | 10 ++++++ .../turbulenceModel/turbulenceModel.H | 8 ++++- 17 files changed, 99 insertions(+), 106 deletions(-) diff --git a/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H b/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H index 440ec71c5c..7f2d3f1f85 100644 --- a/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H +++ b/src/turbulenceModels/compressible/LES/GenEddyVisc/GenEddyVisc.H @@ -126,15 +126,6 @@ public: return alphaSgs_; } - //- Return thermal diffusivity - virtual tmp alphaEff() const - { - return tmp - ( - new volScalarField("alphaEff", alphaSgs_ + alpha()) - ); - } - //- Return the sub-grid stress tensor. virtual tmp B() const; diff --git a/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H b/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H index ff71c80b79..e65495225c 100644 --- a/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H +++ b/src/turbulenceModels/compressible/LES/GenSGSStress/GenSGSStress.H @@ -127,15 +127,6 @@ public: return alphaSgs_; } - //- Return thermal conductivity - virtual tmp alphaEff() const - { - return tmp - ( - new volScalarField("alphaEff", alphaSgs_ + alpha()) - ); - } - //- Return the sub-grid stress tensor virtual tmp B() const { diff --git a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H b/src/turbulenceModels/compressible/LES/LESModel/LESModel.H index cf019ea9a8..2cdde6c61e 100644 --- a/src/turbulenceModels/compressible/LES/LESModel/LESModel.H +++ b/src/turbulenceModels/compressible/LES/LESModel/LESModel.H @@ -189,12 +189,6 @@ public: } - //- Return the SGS turbulent kinetic energy. - virtual tmp k() const = 0; - - //- Return the SGS turbulent dissipation. - virtual tmp epsilon() const = 0; - //- Return the SGS turbulent viscosity virtual tmp muSgs() const = 0; @@ -210,8 +204,22 @@ public: //- Return the SGS turbulent thermal diffusivity virtual tmp alphaSgs() const = 0; - //- Return the SGS thermal conductivity. - virtual tmp alphaEff() const = 0; + //- Return the effective thermal diffusivity + virtual tmp alphaEff() const + { + return tmp + ( + new volScalarField("alphaEff", alphaSgs() + alpha()) + ); + } + + //- Return the effective turbulence thermal diffusivity for a patch + virtual tmp alphaEff(const label patchI) const + { + return + alphaSgs()().boundaryField()[patchI] + + alpha().boundaryField()[patchI]; + } //- Return the sub-grid stress tensor. virtual tmp B() const = 0; @@ -261,13 +269,13 @@ public: //- Correct Eddy-Viscosity and related properties. // This calls correct(const tmp& gradU) by supplying // gradU calculated locally. - void correct(); + virtual void correct(); //- Correct Eddy-Viscosity and related properties virtual void correct(const tmp& gradU); //- Read LESProperties dictionary - virtual bool read() = 0; + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H b/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H index e6239ec91b..29d53267a2 100644 --- a/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H +++ b/src/turbulenceModels/compressible/LES/SpalartAllmaras/SpalartAllmaras.H @@ -149,15 +149,6 @@ public: return alphaSgs_; } - //- Return thermal conductivity - virtual tmp alphaEff() const - { - return tmp - ( - new volScalarField("alphaEff", alphaSgs_ + alpha()) - ); - } - //- Return the sub-grid stress tensor. virtual tmp B() const; diff --git a/src/turbulenceModels/compressible/RAS/LRR/LRR.H b/src/turbulenceModels/compressible/RAS/LRR/LRR.H index 445faebd39..9ce0eef7bb 100644 --- a/src/turbulenceModels/compressible/RAS/LRR/LRR.H +++ b/src/turbulenceModels/compressible/RAS/LRR/LRR.H @@ -153,13 +153,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H index 00db2c304f..e8c5a331b2 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H +++ b/src/turbulenceModels/compressible/RAS/LaunderGibsonRSTM/LaunderGibsonRSTM.H @@ -162,13 +162,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H index b7c972a662..f9c878607d 100644 --- a/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H +++ b/src/turbulenceModels/compressible/RAS/LaunderSharmaKE/LaunderSharmaKE.H @@ -146,13 +146,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H index cc189f24c8..883fa0825a 100644 --- a/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H +++ b/src/turbulenceModels/compressible/RAS/RASModel/RASModel.H @@ -265,9 +265,6 @@ public: } - //- Return the turbulence viscosity - virtual tmp mut() const = 0; - //- Return the effective viscosity virtual tmp muEff() const { @@ -278,22 +275,21 @@ public: } //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const = 0; + virtual tmp alphaEff() const + { + return tmp + ( + new volScalarField("alphaEff", alphat() + alpha()) + ); + } - //- Return the turbulence kinetic energy - virtual tmp k() const = 0; - - //- Return the turbulence kinetic energy dissipation rate - virtual tmp epsilon() const = 0; - - //- Return the Reynolds stress tensor - virtual tmp R() const = 0; - - //- Return the effective stress tensor including the laminar stress - virtual tmp devRhoReff() const = 0; - - //- Return the source term for the momentum equation - virtual tmp divDevRhoReff(volVectorField& U) const = 0; + //- Return the effective turbulent thermal diffusivity for a patch + virtual tmp alphaEff(const label patchI) const + { + return + alphat()().boundaryField()[patchI] + + alpha().boundaryField()[patchI]; + } //- Return yPlus for the given patch virtual tmp yPlus @@ -303,10 +299,10 @@ public: ) const; //- Solve the turbulence equations and correct the turbulence viscosity - virtual void correct() = 0; + virtual void correct(); //- Read RASProperties dictionary - virtual bool read() = 0; + virtual bool read(); }; diff --git a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H index 1e4301adcd..9d9601eee7 100644 --- a/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H +++ b/src/turbulenceModels/compressible/RAS/RNGkEpsilon/RNGkEpsilon.H @@ -142,13 +142,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H index 94e736b9f8..fdb0c675ee 100644 --- a/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H +++ b/src/turbulenceModels/compressible/RAS/SpalartAllmaras/SpalartAllmaras.H @@ -178,13 +178,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H index 865120d8c6..11d8f75a05 100644 --- a/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H +++ b/src/turbulenceModels/compressible/RAS/kEpsilon/kEpsilon.H @@ -138,13 +138,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H index a563557f76..9806d32493 100644 --- a/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H +++ b/src/turbulenceModels/compressible/RAS/kOmegaSST/kOmegaSST.H @@ -222,13 +222,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/RAS/laminar/laminar.C b/src/turbulenceModels/compressible/RAS/laminar/laminar.C index 415dedee72..cc5666eb6c 100644 --- a/src/turbulenceModels/compressible/RAS/laminar/laminar.C +++ b/src/turbulenceModels/compressible/RAS/laminar/laminar.C @@ -78,6 +78,27 @@ tmp laminar::mut() const } +tmp laminar::alphat() const +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + "alphat", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("alphat", alpha().dimensions(), 0.0) + ) + ); +} + + tmp laminar::k() const { return tmp diff --git a/src/turbulenceModels/compressible/RAS/laminar/laminar.H b/src/turbulenceModels/compressible/RAS/laminar/laminar.H index af1f5e2bb2..506799ec98 100644 --- a/src/turbulenceModels/compressible/RAS/laminar/laminar.H +++ b/src/turbulenceModels/compressible/RAS/laminar/laminar.H @@ -89,6 +89,9 @@ public: return tmp(new volScalarField("muEff", mu())); } + //- Return the turbulence thermal diffusivity, i.e. 0 for laminar flow + virtual tmp alphat() const; + //- Return the effective turbulent thermal diffusivity, // i.e. the laminar thermal diffusivity virtual tmp alphaEff() const diff --git a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H index 222ee733a3..1b7d51a9a9 100644 --- a/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H +++ b/src/turbulenceModels/compressible/RAS/realizableKE/realizableKE.H @@ -159,13 +159,10 @@ public: return mut_; } - //- Return the effective turbulent thermal diffusivity - virtual tmp alphaEff() const + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return alphat_; } //- Return the turbulence kinetic energy diff --git a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H index d4379bfb2e..7645e67379 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H +++ b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.H @@ -99,6 +99,9 @@ public: return tmp(new volScalarField("muEff", mu())); } + //- Return the turbulence thermal diffusivity, i.e. 0 for laminar flow + virtual tmp alphat() const; + //- Return the effective turbulent thermal diffusivity, // i.e. the laminar thermal diffusivity virtual tmp alphaEff() const @@ -106,6 +109,13 @@ public: return tmp(new volScalarField("alphaEff", alpha())); } + //- Return the effective turbulent thermal diffusivity for a patch, + // i.e. the laminar thermal diffusivity + virtual tmp alphaEff(const label patchI) const + { + return alpha().boundaryField()[patchI]; + } + //- Return the turbulence kinetic energy, i.e. 0 for laminar flow virtual tmp k() const; diff --git a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H index 97638e5e49..9a84c01bb8 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H +++ b/src/turbulenceModels/compressible/turbulenceModel/turbulenceModel.H @@ -192,9 +192,15 @@ public: //- Return the effective viscosity virtual tmp muEff() const = 0; - //- Return the effective turbulent thermal diffusivity + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const = 0; + + //- Return the effective turbulence thermal diffusivity virtual tmp alphaEff() const = 0; + //- Return the effective turbulence thermal diffusivity for a patch + virtual tmp alphaEff(const label patchI) const = 0; + //- Return the turbulence kinetic energy virtual tmp k() const = 0; From e39f498186f1ca6295869ccaa336ab68505e4423 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 12:19:59 +0000 Subject: [PATCH 06/15] Thermal wall function update - Retrieve h directly from thermo package instead of using look-up --- .../alphatJayatillekeWallFunctionFvPatchScalarField.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C index 5c73b8b146..cab530edac 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C @@ -222,7 +222,7 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; const fvPatchScalarField& hw = - patch().lookupPatchField("h"); + rasModel.thermo().h().boundaryField()[patchI]; // Heat flux [W/m2] - lagging alphatw const scalarField qDot = (alphaw + alphatw)*hw.snGrad(); From 4727d16ffaadb40004485120d332243159838e1c Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 12:58:39 +0000 Subject: [PATCH 07/15] File missed during commit of 3b2c4abd574b49077e9ff95ff340769c1ec6db2c --- .../turbulenceModel/laminar/laminar.C | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C index 4a391c3db5..87d450d12d 100644 --- a/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C +++ b/src/turbulenceModels/compressible/turbulenceModel/laminar/laminar.C @@ -96,6 +96,27 @@ tmp laminar::mut() const } +tmp laminar::alphat() const +{ + return tmp + ( + new volScalarField + ( + IOobject + ( + "alphat", + runTime_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("alphat", alpha().dimensions(), 0.0) + ) + ); +} + + tmp laminar::k() const { return tmp From 19f8fa236a4b583d44c2d682686882422c404d57 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 12:59:32 +0000 Subject: [PATCH 08/15] Update PDR turbulence model to conform to updated turbulence model api --- .../turbulence/PDRkEpsilon/PDRkEpsilon.H | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H index 5e919efcc4..5cd98cd9d6 100644 --- a/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H +++ b/applications/solvers/combustion/PDRFoam/PDRModels/turbulence/PDRkEpsilon/PDRkEpsilon.H @@ -124,11 +124,6 @@ public: // Member Functions - tmp mut() const - { - return mut_; - } - //- Return the effective diffusivity for k tmp DkEff() const { @@ -147,41 +142,44 @@ public: ); } - //- Return the effective turbulent thermal diffusivity - tmp alphaEff() const + //- Return the turbulence viscosity + virtual tmp mut() const { - return tmp - ( - new volScalarField("alphaEff", alphat_ + alpha()) - ); + return mut_; + } + + //- Return the turbulence thermal diffusivity + virtual tmp alphat() const + { + return alphat_; } //- Return the turbulence kinetic energy - tmp k() const + virtual tmp k() const { return k_; } //- Return the turbulence kinetic energy dissipation rate - tmp epsilon() const + virtual tmp epsilon() const { return epsilon_; } //- Return the Reynolds stress tensor - tmp R() const; + virtual tmp R() const; //- Return the effective stress tensor including the laminar stress - tmp devRhoReff() const; + virtual tmp devRhoReff() const; //- Return the source term for the momentum equation - tmp divDevRhoReff(volVectorField& U) const; + virtual tmp divDevRhoReff(volVectorField& U) const; //- Solve the turbulence equations and correct the turbulence viscosity - void correct(); + virtual void correct(); //- Read turbulenceProperties dictionary - bool read(); + virtual bool read(); }; From e5ef0607341791ef88dd8fb030eb9a72103cf04a Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 13:07:32 +0000 Subject: [PATCH 09/15] Update to heat transfer tutorial case - Re-setting initial T fields to unitialised values prior to running setFields utility --- .../buoyantBoussinesqSimpleFoam/hotRoom/0/T | 406 +----------------- .../hotRoom/0/T.org | 406 +----------------- 2 files changed, 2 insertions(+), 810 deletions(-) diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/T b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/T index 76b8877c7e..18610a300b 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/T +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/T @@ -23,411 +23,7 @@ boundaryField floor { type fixedValue; - value nonuniform List -400 -( -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -600 -600 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -600 -600 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -) -; + value uniform 300; } ceiling { diff --git a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/T.org b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/T.org index 76b8877c7e..18610a300b 100644 --- a/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/T.org +++ b/tutorials/heatTransfer/buoyantBoussinesqSimpleFoam/hotRoom/0/T.org @@ -23,411 +23,7 @@ boundaryField floor { type fixedValue; - value nonuniform List -400 -( -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -600 -600 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -600 -600 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -300 -) -; + value uniform 300; } ceiling { From a813b9dc710f090810a8af948da462a69b267add Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 13:34:27 +0000 Subject: [PATCH 10/15] Further updates to turbulent heat flux BCs --- ...entHeatFluxTemperatureFvPatchScalarField.C | 2 + ...entHeatFluxTemperatureFvPatchScalarField.H | 31 +++++++---- ...entHeatFluxTemperatureFvPatchScalarField.C | 51 +++++++++++++++++- ...entHeatFluxTemperatureFvPatchScalarField.H | 53 ++++++++++++++++--- 4 files changed, 119 insertions(+), 18 deletions(-) diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C index 1832566586..e8e6234c32 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C @@ -210,6 +210,8 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::write ) const { fvPatchScalarField::write(os); + os.writeKeyword("heatSource") << heatSourceTypeNames_[heatSource_] + << token::END_STATEMENT << nl; q_.writeEntry("q", os); gradient().writeEntry("gradient", os); writeEntry("value", os); diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H index f32894a130..7d9e5b7a40 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H @@ -26,7 +26,20 @@ Class Foam::turbulentHeatFluxTemperatureFvPatchScalarField Description - Fixed heat flux boundary condition for temperature. + Fixed heat boundary condition to specify temperature gradient. Input + heat source either specified in terms of an absolute power [W], or as a + flux [W/m2]. + + Example usage: + + hotWall + { + type compressible::turbulentHeatFluxTemperature; + heatSource flux; // power [W]; flux [W/m2] + q uniform 10; // heat power or flux + value uniform 300; // initial temperature value + } + SourceFiles turbulentHeatFluxTemperatureFvPatchScalarField.C @@ -67,18 +80,18 @@ public: }; - private: +private: - // Private data + // Private data - //- Heat source type names - static const NamedEnum heatSourceTypeNames_; + //- Heat source type names + static const NamedEnum heatSourceTypeNames_; - //- Heat source type - heatSourceType heatSource_; + //- Heat source type + heatSourceType heatSource_; - //- Heat flux [W/m2] - scalarField q_; + //- Heat power [W] or flux [W/m2] + scalarField q_; public: diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C index 3ca461698a..76639637ba 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.C @@ -36,6 +36,22 @@ namespace Foam namespace incompressible { +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +template<> +const char* +NamedEnum:: +names[] = + { + "power", + "flux" + }; + +const +NamedEnum + turbulentHeatFluxTemperatureFvPatchScalarField::heatSourceTypeNames_; + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // turbulentHeatFluxTemperatureFvPatchScalarField:: @@ -46,6 +62,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField ) : fixedGradientFvPatchScalarField(p, iF), + heatSource_(hsPower), q_(p.size(), 0.0), alphaEffName_("undefinedAlphaEff"), CpName_("undefinedCp") @@ -62,6 +79,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField ) : fixedGradientFvPatchScalarField(ptf, p, iF, mapper), + heatSource_(ptf.heatSource_), q_(ptf.q_, mapper), alphaEffName_(ptf.alphaEffName_), CpName_(ptf.CpName_) @@ -77,6 +95,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField ) : fixedGradientFvPatchScalarField(p, iF), + heatSource_(heatSourceTypeNames_.read(dict.lookup("heatSource"))), q_("q", dict, p.size()), alphaEffName_(dict.lookup("alphaEff")), CpName_(dict.lookup("Cp")) @@ -93,6 +112,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField ) : fixedGradientFvPatchScalarField(thftpsf), + heatSource_(thftpsf.heatSource_), q_(thftpsf.q_), alphaEffName_(thftpsf.alphaEffName_), CpName_(thftpsf.CpName_) @@ -107,6 +127,7 @@ turbulentHeatFluxTemperatureFvPatchScalarField ) : fixedGradientFvPatchScalarField(thftpsf, iF), + heatSource_(thftpsf.heatSource_), q_(thftpsf.q_), alphaEffName_(thftpsf.alphaEffName_), CpName_(thftpsf.CpName_) @@ -156,7 +177,33 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs() const scalarField& Cpp = patch().lookupPatchField(CpName_); - gradient() = q_/(Cpp*alphaEffp); + switch (heatSource_) + { + case hsPower: + { + const scalar Ap = gSum(patch().magSf()); + gradient() = q_/(Ap*Cpp*alphaEffp); + break; + } + case hsFlux: + { + gradient() = q_/(Cpp*alphaEffp); + break; + } + default: + { + FatalErrorIn + ( + "turbulentHeatFluxTemperatureFvPatchScalarField" + "(" + "const fvPatch&, " + "const DimensionedField&, " + "const dictionary&" + ")" + ) << "Unknown heat source type. Valid types are: " + << heatSourceTypeNames_ << nl << exit(FatalError); + } + } fixedGradientFvPatchScalarField::updateCoeffs(); } @@ -165,6 +212,8 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs() void turbulentHeatFluxTemperatureFvPatchScalarField::write(Ostream& os) const { fixedGradientFvPatchScalarField::write(os); + os.writeKeyword("heatSource") << heatSourceTypeNames_[heatSource_] + << token::END_STATEMENT << nl; q_.writeEntry("q", os); os.writeKeyword("alphaEff") << alphaEffName_ << token::END_STATEMENT << nl; os.writeKeyword("Cp") << CpName_ << token::END_STATEMENT << nl; diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H index 848c9ca403..1ba9a77253 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/turbulentHeatFluxTemperature/turbulentHeatFluxTemperatureFvPatchScalarField.H @@ -26,7 +26,22 @@ Class Foam::turbulentHeatFluxTemperatureFvPatchScalarField Description - Fixed heat flux boundary condition for temperature. + Fixed heat boundary condition to specify temperature gradient. Input + heat source either specified in terms of an absolute power [W], or as a + flux [W/m2]. + + Example usage: + + hotWall + { + type turbulentHeatFluxTemperature; + heatSource flux; // power [W]; flux [W/m2] + q uniform 10; // heat power or flux + alphaEff alphaEff; // alphaEff field name; + // alphaEff in [kg/m/s] + Cp Cp; // Cp field name; Cp in [J/kg/K] + value uniform 300; // initial temperature value + } SourceFiles turbulentHeatFluxTemperatureFvPatchScalarField.C @@ -38,6 +53,7 @@ SourceFiles #include "fvPatchFields.H" #include "fixedGradientFvPatchFields.H" +#include "NamedEnum.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -54,16 +70,37 @@ class turbulentHeatFluxTemperatureFvPatchScalarField : public fixedGradientFvPatchScalarField { -// Private data +public: - //- Heat flux [W/m2] - scalarField q_; + // Data types - //- Name of effective thermal diffusivity field - word alphaEffName_; + //- Enumeration listing the possible hest source input modes + enum heatSourceType + { + hsPower, + hsFlux + }; - //- Name of specific heat capacity field - word CpName_; + +private: + + // Private data + + //- Heat source type names + static const NamedEnum heatSourceTypeNames_; + + //- Heat source type + heatSourceType heatSource_; + + //- Heat power [W] or flux [W/m2] + // NOTE: to be divided by density, rho, if used in kinematic form + scalarField q_; + + //- Name of effective thermal diffusivity field + word alphaEffName_; + + //- Name of specific heat capacity field + word CpName_; public: From 521837fc0f49b77ccf33996cda609d3a9753575b Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 16:22:23 +0000 Subject: [PATCH 11/15] Corrected template argument for cloud typedefs --- .../BasicReactingMultiphaseCloud.H | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.H b/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.H index f02475a316..3a8d69c2ef 100644 --- a/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.H @@ -42,13 +42,31 @@ Description namespace Foam { - typedef ReactingMultiphaseCloud > + typedef ReactingMultiphaseCloud + < + BasicReactingMultiphaseParcel + < + constGasThermoPhysics + > + > constThermoReactingMultiphaseCloud; - typedef ReactingMultiphaseCloud > + typedef ReactingMultiphaseCloud + < + BasicReactingMultiphaseParcel + < + gasThermoPhysics + > + > thermoReactingMultiphaseCloud; - typedef ReactingMultiphaseCloud > + typedef ReactingMultiphaseCloud + < + BasicReactingMultiphaseParcel + < + icoPoly8ThermoPhysics + > + > icoPoly8ThermoReactingMultiphaseCloud; } From ebfd516f88b2a8fdec8df60e6488e6cb2a07164d Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 16:23:21 +0000 Subject: [PATCH 12/15] Lagrangian multiphase cloud enthalpy coupling update - using chemical enthalpy instead of total enthalpy --- .../ReactingMultiphaseParcel/ReactingMultiphaseParcel.C | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index 5c3d3d0685..c1914e5ed5 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -401,7 +401,7 @@ void Foam::ReactingMultiphaseParcel::calc td.cloud().hcTrans()[cellI] += np0 *dMassGas[i] - *td.cloud().mcCarrierThermo().speciesData()[gid].H(T0); + *td.cloud().mcCarrierThermo().speciesData()[gid].Hc(); } forAll(YLiquid_, i) { @@ -410,7 +410,7 @@ void Foam::ReactingMultiphaseParcel::calc td.cloud().hcTrans()[cellI] += np0 *dMassLiquid[i] - *td.cloud().mcCarrierThermo().speciesData()[gid].H(T0); + *td.cloud().mcCarrierThermo().speciesData()[gid].Hc(); } /* // No mapping between solid components and carrier phase @@ -421,7 +421,7 @@ void Foam::ReactingMultiphaseParcel::calc td.cloud().hcTrans()[cellI] += np0 *dMassSolid[i] - *td.cloud().mcCarrierThermo().speciesData()[gid].H(T0); + *td.cloud().mcCarrierThermo().speciesData()[gid].Hc(); } */ forAll(dMassSRCarrier, i) @@ -430,7 +430,7 @@ void Foam::ReactingMultiphaseParcel::calc td.cloud().hcTrans()[cellI] += np0 *dMassSRCarrier[i] - *td.cloud().mcCarrierThermo().speciesData()[i].H(T0); + *td.cloud().mcCarrierThermo().speciesData()[i].Hc(); } // Update momentum transfer From 550d754650378c9cedd33fb9347f3a77907d2b1d Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 16:24:51 +0000 Subject: [PATCH 13/15] Bugfix: Xinf was incorrectly sized --- .../parcels/Templates/ReactingParcel/ReactingParcel.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 524b4d00d5..92525ea2b1 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -122,7 +122,7 @@ void Foam::ReactingParcel::correctSurfaceValues } // Far field carrier molar fractions - scalarField Xinf(Y_.size()); + scalarField Xinf(td.cloud().mcCarrierThermo().speciesData().size()); forAll(Xinf, i) { From 90032a8c02cc26f01756cba5ce9757067b6a1b24 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 11 Jan 2010 16:32:28 +0000 Subject: [PATCH 14/15] Correcting typo in omega initial field in tutorial --- .../verticalChannel/0/omega | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/omega b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/omega index f9b551e72b..0538e96fb7 100644 --- a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/omega +++ b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/verticalChannel/0/omega @@ -41,7 +41,7 @@ boundaryField type compressible::turbulentMixingLengthFrequencyInlet; mixingLength 0.007; k k; - value uniform 4.5-3; + value uniform 4.5e-3; } outlet { From dc507b8c7d39229e850c6355c4f6f8ba350c425b Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 13 Jan 2010 10:50:32 +0000 Subject: [PATCH 15/15] Relocated paraview PV_PLUGIN_PATH environment variable - moved to $FOAM_LIBBIN/paraview so that built libraries sit in their own folder - avoids PV error msgs on start-up when it tries to load all libs under the $PV_PLUGIN_PATH --- etc/apps/paraview3/bashrc | 2 +- etc/apps/paraview3/cshrc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/apps/paraview3/bashrc b/etc/apps/paraview3/bashrc index 7209dc0da8..bbeb6c0ebd 100644 --- a/etc/apps/paraview3/bashrc +++ b/etc/apps/paraview3/bashrc @@ -68,7 +68,7 @@ fi if [ -r $ParaView_DIR ] then export PATH=$ParaView_DIR/bin:$PATH - export PV_PLUGIN_PATH=$FOAM_LIBBIN + export PV_PLUGIN_PATH=$FOAM_LIBBIN/paraview fi unset cmake ParaView_PYTHON_DIR diff --git a/etc/apps/paraview3/cshrc b/etc/apps/paraview3/cshrc index 9160edf0f8..33c863215e 100644 --- a/etc/apps/paraview3/cshrc +++ b/etc/apps/paraview3/cshrc @@ -62,7 +62,7 @@ endif if ( -r $ParaView_INST_DIR ) then set path=($ParaView_DIR/bin $path) - setenv PV_PLUGIN_PATH $FOAM_LIBBIN + setenv PV_PLUGIN_PATH $FOAM_LIBBIN/paraview endif unset cmake paraviewMajor paraviewPython