From cf43a1043ee7ea86513543e16d9e25c5a7ceeb2f Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 23 Jun 2010 11:30:04 +0100 Subject: [PATCH] STYLE: minor code style changes + move template funcs into separate files --- .../actuationDiskSource/actuationDiskSource.C | 53 +++++------ .../actuationDiskSource/actuationDiskSource.H | 8 +- .../actuationDiskSourceTemplates.C | 1 + .../basicSource/IObasicSourceList.H | 14 +-- .../basicSource/basicSource/basicSource.C | 25 ++---- .../basicSource/basicSource/basicSourceI.H | 7 +- .../basicSource/basicSource/basicSourceIO.C | 1 - .../basicSource/basicSource/basicSourceList.C | 2 + .../basicSource/basicSource/basicSourceList.H | 13 +-- .../explicitSource/explicitSource.C | 88 +++---------------- .../explicitSource/explicitSource.H | 6 ++ .../explicitSource/explicitSourceIO.C | 6 +- .../explicitSource/explicitSourceTemplates.C | 79 +++++++++++++++++ ...lindricalInletVelocityFvPatchVectorField.H | 10 +-- .../ODEChemistryModel/ODEChemistryModel.C | 5 +- .../ODEChemistryModel/ODEChemistryModel.H | 2 +- .../LES/dynLagrangian/dynLagrangian.C | 20 ++--- .../LES/dynLagrangian/dynLagrangian.H | 9 +- ...ndaryLayerInletEpsilonFvPatchScalarField.C | 29 +++--- ...ndaryLayerInletEpsilonFvPatchScalarField.H | 1 + ...daryLayerInletVelocityFvPatchVectorField.C | 33 ++++--- ...daryLayerInletVelocityFvPatchVectorField.H | 5 +- 22 files changed, 208 insertions(+), 209 deletions(-) create mode 100644 src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceTemplates.C diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C index 44f46f9de3..c2e5b79c2e 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.C @@ -34,10 +34,8 @@ License namespace Foam { - -defineTypeNameAndDebug(actuationDiskSource, 0); -addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary); - + defineTypeNameAndDebug(actuationDiskSource, 0); + addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary); } @@ -45,20 +43,22 @@ addToRunTimeSelectionTable(basicSource, actuationDiskSource, dictionary); void Foam::actuationDiskSource::checkData() { - if - ( - magSqr(diskArea_) <= VSMALL - || Cp_ <= VSMALL - || Ct_ <= VSMALL - || diskDir_ == vector::zero - ) + if (magSqr(diskArea_) <= VSMALL) { - FatalIOErrorIn - ( - "Foam::actuationDiskSource::checkData()", - dict_ - ) << "diskArea, Cp or Ct is small " - << "or disk direction not specified" + FatalErrorIn("Foam::actuationDiskSource::checkData()") + << "diskArea is approximately zero" + << exit(FatalIOError); + } + if (Cp_ <= VSMALL || Ct_ <= VSMALL) + { + FatalErrorIn("Foam::actuationDiskSource::checkData()") + << "Cp and Ct must be greater than zero" + << exit(FatalIOError); + } + if (mag(diskDir_) < VSMALL) + { + FatalErrorIn("Foam::actuationDiskSource::checkData()") + << "disk direction vector is approximately zero" << exit(FatalIOError); } } @@ -75,11 +75,11 @@ Foam::actuationDiskSource::actuationDiskSource : basicSource(name, dict, mesh), cellZoneID_(mesh.cellZones().findZoneID(this->cellSetName())), - diskDir_(vector::zero), - Cp_(0), - Ct_(0), - diskArea_(0), - dict_(dict.subDict(typeName + "Coeffs")) + dict_(dict.subDict(typeName + "Coeffs")), + diskDir_(dict_.lookup("diskDir")), + Cp_(readScalar(dict_.lookup("Cp"))), + Ct_(readScalar(dict_.lookup("Ct"))), + diskArea_(readScalar(dict_.lookup("diskArea"))) { Info<< " - creating actuation disk zone: " << this->name() << endl; @@ -98,11 +98,6 @@ Foam::actuationDiskSource::actuationDiskSource << exit(FatalError); } - dict_.readIfPresent("diskDir", diskDir_); - dict_.readIfPresent("Cp", Cp_); - dict_.readIfPresent("Ct", Ct_); - dict_.readIfPresent("diskArea", diskArea_); - checkData(); } @@ -132,7 +127,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix& UEqn) addActuationDiskAxialInertialResistance ( Usource, - cells,//this->cells(), + cells, V, this->mesh().lookupObject("rho"), U @@ -143,7 +138,7 @@ void Foam::actuationDiskSource::addSu(fvMatrix& UEqn) addActuationDiskAxialInertialResistance ( Usource, - cells,//this->cells(), + cells, V, geometricOneField(), U diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H index 661fc99a54..3ce8ecc3ea 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSource.H @@ -62,7 +62,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class actuationDiskSource Declaration + Class actuationDiskSource Declaration \*---------------------------------------------------------------------------*/ class actuationDiskSource @@ -74,6 +74,9 @@ class actuationDiskSource //- Cell zone ID label cellZoneID_; + //- Sub dictionary with actuationDisk information + const dictionary& dict_; + //- Disk area normal vector diskDir_; @@ -86,9 +89,6 @@ class actuationDiskSource //- Disk area scalar diskArea_; - //- Sub dictionary with actuationDisk information - const dictionary& dict_; - // Private Member Functions diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C index 17fcbf6fd0..971b8edfcd 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/actuationDiskSource/actuationDiskSourceTemplates.C @@ -61,4 +61,5 @@ void Foam::actuationDiskSource::addActuationDiskAxialInertialResistance } } + // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.H index c291c37356..d4b2c11f1c 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/IObasicSourceList.H @@ -58,10 +58,7 @@ private: // Private Member Functions //- Disallow default bitwise copy construct - IObasicSourceList - ( - const IObasicSourceList& - ); + IObasicSourceList(const IObasicSourceList&); //- Disallow default bitwise assignment void operator=(const IObasicSourceList&); @@ -72,18 +69,15 @@ public: // Constructors //- Construct from components with list of field names - IObasicSourceList - ( - const fvMesh& mesh - ); + IObasicSourceList(const fvMesh& mesh); - // Destructor + //- Destructor virtual ~IObasicSourceList() {} - //- Read dictionary + //- Read dictionary virtual bool read(); }; diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C index d74ce2b352..a42ecd25f0 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSource.C @@ -39,8 +39,7 @@ namespace Foam // * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * // -const Foam::wordList Foam::basicSource:: -selectionModeTypeNames_ +const Foam::wordList Foam::basicSource::selectionModeTypeNames_ ( IStringStream("(points cellSet cellZone all)")() ); @@ -48,8 +47,7 @@ selectionModeTypeNames_ // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -Foam::basicSource::selectionModeType -Foam::basicSource::wordToSelectionModeType +Foam::basicSource::selectionModeType Foam::basicSource::wordToSelectionModeType ( const word& smtName ) const @@ -93,16 +91,13 @@ Foam::word Foam::basicSource::selectionModeTypeToWord } -void Foam::basicSource::setSelection -( - const dictionary& dict -) +void Foam::basicSource::setSelection(const dictionary& dict) { switch (selectionMode_) { case smPoints: { - //Do nothing. It should be sorted out by derived class// + // Do nothing. It should be sorted out by derived class break; } case smCellSet: @@ -236,11 +231,7 @@ Foam::autoPtr Foam::basicSource::New const fvMesh& mesh ) { - word typeModel; - - { - dict.lookup("typeModel") >> typeModel; - } + word typeModel(dict.lookup("typeModel")); Info<< "Selecting model type " << typeModel << endl; @@ -254,9 +245,9 @@ Foam::autoPtr Foam::basicSource::New "basicSource::New(const volVectorField&, " "const surfaceScalarField&, transportModel&)" ) << "Unknown Model type " << typeModel - << endl << endl - << "Valid model types are :" << endl - << dictionaryConstructorTablePtr_->toc() + << nl << nl + << "Valid model types are :" << nl + << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H index 89e68a7df8..fca34ab1d9 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceI.H @@ -27,7 +27,6 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - inline const Foam::word& Foam::basicSource::name() const { return name_; @@ -75,8 +74,7 @@ Foam::basicSource::selectionMode() const } -inline const Foam::word& -Foam::basicSource::cellSetName() const +inline const Foam::word& Foam::basicSource::cellSetName() const { return cellSetName_; } @@ -88,8 +86,7 @@ inline Foam::scalar Foam::basicSource::V() const } -inline const Foam::labelList& -Foam::basicSource::cells() const +inline const Foam::labelList& Foam::basicSource::cells() const { return cells_; } diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C index 88966fdd6b..9d2a7c74a1 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceIO.C @@ -27,7 +27,6 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - void Foam::basicSource::writeData(Ostream& os) const { os << indent << name_ << nl diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C index 8329a6f03d..8b4f1914e8 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.C @@ -61,6 +61,7 @@ Foam::basicSourceList::basicSourceList } } + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -177,4 +178,5 @@ Foam::Ostream& Foam::operator<< return os; } + // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H index 96490f94ef..678166f16a 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/basicSource/basicSourceList.H @@ -63,10 +63,7 @@ private: // Private Member Functions //- Disallow default bitwise copy construct - basicSourceList - ( - const basicSourceList& - ); + basicSourceList(const basicSourceList&); //- Disallow default bitwise assignment void operator=(const basicSourceList&); @@ -77,14 +74,10 @@ public: // Constructors //- Construct from components with list of field names - basicSourceList - ( - const fvMesh& mesh, - const dictionary& dict - ); + basicSourceList(const fvMesh& mesh, const dictionary& dict); - // Destructor + //- Destructor virtual ~basicSourceList() {} diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C index 9798d82ce8..493408d0ea 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.C @@ -66,12 +66,9 @@ void Foam::explicitSource::setSelectedCellsFromPoints() if (globalCellI < 0) { - WarningIn - ( - "explicitSource::setSelectedCellsFromPoints()" - ) - << "Unable to find owner cell for point " << points_[i] - << endl; + WarningIn("explicitSource::setSelectedCellsFromPoints()") + << "Unable to find owner cell for point " << points_[i] + << endl; } } @@ -79,20 +76,6 @@ void Foam::explicitSource::setSelectedCellsFromPoints() } -template -void Foam::explicitSource::addSources -( - Field& fieldSource, - Type& data -) const -{ - forAll(this->cells(), i) - { - fieldSource[this->cells()[i]] = data/volSource_[i]; - } -} - - // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // Foam::explicitSource::volumeModeType @@ -136,49 +119,8 @@ Foam::word Foam::explicitSource::volumeModeTypeToWord } } -template -void Foam::explicitSource::addField -( - HashTable& fields, - const wordList& fieldTypes, - const wordList& fieldNames, - const dictionary& fieldDataDict -) -{ - forAll (fieldTypes, fieldI) - { - word fieldName = fieldNames[fieldI]; - word fieldType = fieldTypes[fieldI]; - typedef GeometricField geometricField; - - if - ( - ( - fieldType - == GeometricField::typeName - ) && - ( - this->mesh().foundObject(fieldName) - ) - ) - { - Type fieldValue = fieldDataDict.lookupOrDefault - ( - fieldName, - pTraits::zero - ); - - fields.insert(fieldName, fieldValue); - } - } -} - - -void Foam::explicitSource::setFieldData -( - const dictionary& dict -) +void Foam::explicitSource::setFieldData(const dictionary& dict) { scalarFields_.clear(); vectorFields_.clear(); @@ -271,10 +213,7 @@ Foam::explicitSource::explicitSource } -void Foam::explicitSource::addSu -( - fvMatrix& Eqn -) +void Foam::explicitSource::addSu(fvMatrix& Eqn) { Field& source = Eqn.source(); scalar data = scalarFields_[Eqn.psi().name()]; @@ -282,10 +221,7 @@ void Foam::explicitSource::addSu } -void Foam::explicitSource::addSu -( - fvMatrix& Eqn -) +void Foam::explicitSource::addSu(fvMatrix& Eqn) { Field& source = Eqn.source(); vector data = vectorFields_[Eqn.psi().name()]; @@ -293,29 +229,25 @@ void Foam::explicitSource::addSu } -void Foam::explicitSource::addSu -( - DimensionedField& field -) +void Foam::explicitSource::addSu(DimensionedField& field) { scalar data = scalarFields_[field.name()]; addSources(field, data); } -void Foam::explicitSource::addSu -( - DimensionedField& field -) +void Foam::explicitSource::addSu(DimensionedField& field) { vector data = vectorFields_[field.name()]; addSources(field, data); } + void Foam::explicitSource::addExplicitSources() { scalarFields_.applySources(); vectorFields_.applySources(); } + // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H index 8aba2a2dca..5ea397a8c3 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSource.H @@ -284,6 +284,12 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#ifdef NoRepository +# include "explicitSourceTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceIO.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceIO.C index b9e3c82707..ab5524a7de 100644 --- a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceIO.C +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceIO.C @@ -69,11 +69,7 @@ bool Foam::explicitSource::read(const dictionary& dict) // * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const explicitSource& source -) +Foam::Ostream& Foam::operator<<(Ostream& os, const explicitSource& source) { source.writeData(os); return os; diff --git a/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceTemplates.C b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceTemplates.C new file mode 100644 index 0000000000..20e9230e99 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/fieldSources/basicSource/explicitSource/explicitSourceTemplates.C @@ -0,0 +1,79 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +template +void Foam::explicitSource::addSources +( + Field& fieldSource, + Type& data +) const +{ + forAll(this->cells(), i) + { + fieldSource[this->cells()[i]] = data/volSource_[i]; + } +} + + +template +void Foam::explicitSource::addField +( + HashTable& fields, + const wordList& fieldTypes, + const wordList& fieldNames, + const dictionary& fieldDataDict +) +{ + typedef GeometricField geometricField; + + forAll (fieldTypes, fieldI) + { + word fieldName = fieldNames[fieldI]; + word fieldType = fieldTypes[fieldI]; + + if + ( + ( + fieldType + == GeometricField::typeName + ) && + ( + this->mesh().foundObject(fieldName) + ) + ) + { + Type fieldValue = fieldDataDict.lookupOrDefault + ( + fieldName, + pTraits::zero + ); + + fields.insert(fieldName, fieldValue); + } + } +} + + +// ************************************************************************* // diff --git a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H index a08d6801dc..eec47f34d6 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H +++ b/src/finiteVolume/fields/fvPatchFields/derived/cylindricalInletVelocity/cylindricalInletVelocityFvPatchVectorField.H @@ -68,19 +68,19 @@ class cylindricalInletVelocityFvPatchVectorField // Private data //- Axial velocity - scalar axialVelocity_; + const scalar axialVelocity_; //- Central point - vector centre_; + const vector centre_; //- Axis - vector axis_; + const vector axis_; //- RPM - scalar rpm_; + const scalar rpm_; //- Radial velocity - scalar radialVelocity_; + const scalar radialVelocity_; public: diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C index 4055c27f5f..a3da083706 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C @@ -508,10 +508,7 @@ Foam::ODEChemistryModel::tc() const { const Reaction& R = reactions_[i]; - omega - ( - R, c, Ti, pi, pf, cf, lRef, pr, cr, rRef - ); + omega(R, c, Ti, pi, pf, cf, lRef, pr, cr, rRef); forAll(R.rhs(), s) { diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H index 680ecdc84f..777daf1127 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H @@ -91,7 +91,7 @@ protected: //- Chemistry solver autoPtr > solver_; - //- Chemical source term [kg/m3/s] + //- List of reaction rate per specie [kg/m3/s] PtrList RR_; diff --git a/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.C b/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.C index 505aeeabba..10affdf12c 100644 --- a/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.C +++ b/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.C @@ -138,11 +138,11 @@ void dynLagrangian::correct(const tmp& gradU) fvScalarMatrix flmEqn ( - fvm::ddt(flm_) - + fvm::div(phi(), flm_) - == - invT*LM - - fvm::Sp(invT, flm_) + fvm::ddt(flm_) + + fvm::div(phi(), flm_) + == + invT*LM + - fvm::Sp(invT, flm_) ); flmEqn.relax(); @@ -154,11 +154,11 @@ void dynLagrangian::correct(const tmp& gradU) fvScalarMatrix fmmEqn ( - fvm::ddt(fmm_) - + fvm::div(phi(), fmm_) - == - invT*MM - - fvm::Sp(invT, fmm_) + fvm::ddt(fmm_) + + fvm::div(phi(), fmm_) + == + invT*MM + - fvm::Sp(invT, fmm_) ); fmmEqn.relax(); diff --git a/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H b/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H index 0d82201d72..6bcb2b9511 100644 --- a/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H +++ b/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H @@ -84,7 +84,7 @@ namespace LESModels { /*---------------------------------------------------------------------------*\ - Class dynLagrangian Declaration + Class dynLagrangian Declaration \*---------------------------------------------------------------------------*/ class dynLagrangian @@ -104,6 +104,8 @@ class dynLagrangian dimensionedScalar flm0_; dimensionedScalar fmm0_; + + // Private Member Functions //- Update sub-grid scale fields @@ -141,14 +143,13 @@ public: // Member Functions - //- Return SGS kinetic energy - + //- Return SGS kinetic energy tmp k(const tmp& gradU) const { return 2.0*sqr(delta())*magSqr(dev(symm(gradU))); } - //- Return SGS kinetic energy + //- Return SGS kinetic energy virtual tmp k() const { return k(fvc::grad(U())); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C index 58a5df9cec..18a3bb0915 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.C @@ -90,8 +90,16 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField { if (mag(z_) < SMALL) { - FatalErrorIn("atmBoundaryLayerInletEpsilonFvPatchScalarField(dict)") - << "z is not correct" + FatalErrorIn + ( + "atmBoundaryLayerInletEpsilonFvPatchScalarField" + "(" + "const fvPatch&, " + "const DimensionedField&, " + "const dictionary&" + ")" + ) + << "magnitude of z vector must be greater than zero" << abort(FatalError); } @@ -104,16 +112,16 @@ atmBoundaryLayerInletEpsilonFvPatchScalarField atmBoundaryLayerInletEpsilonFvPatchScalarField:: atmBoundaryLayerInletEpsilonFvPatchScalarField ( - const atmBoundaryLayerInletEpsilonFvPatchScalarField& fcvpvf, + const atmBoundaryLayerInletEpsilonFvPatchScalarField& blpsf, const DimensionedField& iF ) : - fixedValueFvPatchScalarField(fcvpvf, iF), - Ustar_(fcvpvf.Ustar_), - z_(fcvpvf.z_), - z0_(fcvpvf.z0_), - kappa_(fcvpvf.kappa_), - zGround_(fcvpvf.zGround_) + fixedValueFvPatchScalarField(blpsf, iF), + Ustar_(blpsf.Ustar_), + z_(blpsf.z_), + z0_(blpsf.z0_), + kappa_(blpsf.kappa_), + zGround_(blpsf.zGround_) {} @@ -123,11 +131,10 @@ void atmBoundaryLayerInletEpsilonFvPatchScalarField::updateCoeffs() { const vectorField& c = patch().Cf(); scalarField coord = (c & z_); - scalarField::operator=(pow(Ustar_, 3.0)/(kappa_*(coord - zGround_ + z0_))); + scalarField::operator=(pow3(Ustar_)/(kappa_*(coord - zGround_ + z0_))); } -// Write void atmBoundaryLayerInletEpsilonFvPatchScalarField::write(Ostream& os) const { fvPatchScalarField::write(os); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H index 89a3cb213b..b129c50007 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletEpsilon/atmBoundaryLayerInletEpsilonFvPatchScalarField.H @@ -92,6 +92,7 @@ class atmBoundaryLayerInletEpsilonFvPatchScalarField //- Minimum corrdinate value in z direction scalar zGround_; + public: //- Runtime type information diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C index ad712145fc..cdbf4bfc7d 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.C @@ -99,8 +99,16 @@ atmBoundaryLayerInletVelocityFvPatchVectorField { if (mag(n_) < SMALL || mag(z_) < SMALL || mag(z0_) < SMALL) { - FatalErrorIn("atmBoundaryLayerInletVelocityFvPatchVectorField(dict)") - << "n, z or z0 given are close to zero is not correct" + FatalErrorIn + ( + "atmBoundaryLayerInletVelocityFvPatchVectorField" + "(" + "const fvPatch&, " + "const DimensionedField&, " + "onst dictionary&" + ")" + ) + << "magnitude of n, z and z0 vectors must be greater than zero" << abort(FatalError); } @@ -116,19 +124,19 @@ atmBoundaryLayerInletVelocityFvPatchVectorField atmBoundaryLayerInletVelocityFvPatchVectorField:: atmBoundaryLayerInletVelocityFvPatchVectorField ( - const atmBoundaryLayerInletVelocityFvPatchVectorField& fcvpvf, + const atmBoundaryLayerInletVelocityFvPatchVectorField& blpvf, const DimensionedField& iF ) : - fixedValueFvPatchVectorField(fcvpvf, iF), - Ustar_(fcvpvf.Ustar_), - n_(fcvpvf.n_), - z_(fcvpvf.z_), - z0_(fcvpvf.z0_), - kappa_(fcvpvf.kappa_), - Uref_(fcvpvf.Uref_), - Href_(fcvpvf.Href_), - zGround_(fcvpvf.zGround_) + fixedValueFvPatchVectorField(blpvf, iF), + Ustar_(blpvf.Ustar_), + n_(blpvf.n_), + z_(blpvf.z_), + z0_(blpvf.z0_), + kappa_(blpvf.kappa_), + Uref_(blpvf.Uref_), + Href_(blpvf.Href_), + zGround_(blpvf.zGround_) {} @@ -158,7 +166,6 @@ void atmBoundaryLayerInletVelocityFvPatchVectorField::updateCoeffs() } -// Write void atmBoundaryLayerInletVelocityFvPatchVectorField::write(Ostream& os) const { fvPatchVectorField::write(os); diff --git a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H index 4f5783bb0f..8a967a6aa1 100644 --- a/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H +++ b/src/turbulenceModels/incompressible/RAS/derivedFvPatchFields/atmBoundaryLayerInletVelocity/atmBoundaryLayerInletVelocityFvPatchVectorField.H @@ -115,6 +115,7 @@ class atmBoundaryLayerInletVelocityFvPatchVectorField //- Minimum corrdinate value in z direction scalar zGround_; + public: //- Runtime type information @@ -138,8 +139,8 @@ public: const dictionary& ); - //- Construct by mapping given atmBoundaryLayerInletVelocityFvPatchVectorField - // onto a new patch + //- Construct by mapping given + // atmBoundaryLayerInletVelocityFvPatchVectorField onto a new patch atmBoundaryLayerInletVelocityFvPatchVectorField ( const atmBoundaryLayerInletVelocityFvPatchVectorField&,