From 4f4d1393fa4f45c7e23d2684bf254d718e263365 Mon Sep 17 00:00:00 2001 From: mattijs Date: Thu, 3 Sep 2009 12:29:49 +0100 Subject: [PATCH 01/18] firstTime always chooses constant --- src/OpenFOAM/db/Time/Time.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index f0c67306be..7405cfb5b6 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -115,7 +115,14 @@ void Foam::Time::setControls() { if (timeDirs.size()) { - startTime_ = timeDirs[0].value(); + if (timeDirs[0].name() == constant() && timeDirs.size() >= 2) + { + startTime_ = timeDirs[1].value(); + } + else + { + startTime_ = timeDirs[0].value(); + } } } else if (startFrom == "latestTime") From 4c9ae0171a591ecf1067f86c6327568255617675 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 3 Sep 2009 18:01:32 +0100 Subject: [PATCH 02/18] code tidying --- .../pdfs/RosinRammler/RosinRammler.C | 24 +++++++-------- .../pdfs/exponential/exponential.C | 27 +++++++---------- .../pdfs/general/general.C | 29 +++++++------------ src/thermophysicalModels/pdfs/normal/normal.C | 23 ++++++--------- .../pdfs/uniform/uniform.C | 2 +- 5 files changed, 42 insertions(+), 63 deletions(-) diff --git a/src/thermophysicalModels/pdfs/RosinRammler/RosinRammler.C b/src/thermophysicalModels/pdfs/RosinRammler/RosinRammler.C index 36b84679ed..f157c2645f 100644 --- a/src/thermophysicalModels/pdfs/RosinRammler/RosinRammler.C +++ b/src/thermophysicalModels/pdfs/RosinRammler/RosinRammler.C @@ -47,14 +47,15 @@ Foam::RosinRammler::RosinRammler(const dictionary& dict, Random& rndGen) d_(pdfDict_.lookup("d")), n_(pdfDict_.lookup("n")), ls_(d_), - range_(maxValue_-minValue_) + range_(maxValue_ - minValue_) { if (minValue_<0) { FatalErrorIn ( "RosinRammler::RosinRammler(const dictionary& dict)" - ) << " minValue = " << minValue_ << ", it must be >0." << abort(FatalError); + ) << " minValue = " << minValue_ << ", it must be >0." << nl + << abort(FatalError); } if (maxValue_p); return x; } diff --git a/src/thermophysicalModels/pdfs/exponential/exponential.C b/src/thermophysicalModels/pdfs/exponential/exponential.C index 973161537f..6ebe918fe8 100644 --- a/src/thermophysicalModels/pdfs/exponential/exponential.C +++ b/src/thermophysicalModels/pdfs/exponential/exponential.C @@ -46,14 +46,15 @@ Foam::exponential::exponential(const dictionary& dict, Random& rndGen) maxValue_(readScalar(pdfDict_.lookup("maxValue"))), lambda_(pdfDict_.lookup("lambda")), ls_(lambda_), - range_(maxValue_-minValue_) + range_(maxValue_ - minValue_) { if (minValue_<0) { FatalErrorIn ( "exponential::exponential(const dictionary& dict)" - ) << " minValue = " << minValue_ << ", it must be >0." << abort(FatalError); + ) << " minValue = " << minValue_ << ", it must be >0." << nl + << abort(FatalError); } scalar sMax = 0; @@ -73,7 +74,7 @@ Foam::exponential::exponential(const dictionary& dict, Random& rndGen) sMax = max(sMax, s); } - for(label i=0; iy); return x; } diff --git a/src/thermophysicalModels/pdfs/general/general.C b/src/thermophysicalModels/pdfs/general/general.C index ec5d2b7abf..59b1a75953 100644 --- a/src/thermophysicalModels/pdfs/general/general.C +++ b/src/thermophysicalModels/pdfs/general/general.C @@ -45,7 +45,7 @@ Foam::general::general(const dictionary& dict, Random& rndGen) nEntries_(xy_.size()), minValue_(xy_[0][0]), maxValue_(xy_[nEntries_-1][0]), - range_(maxValue_-minValue_) + range_(maxValue_ - minValue_) { // normalize the pdf scalar yMax = 0; @@ -72,12 +72,11 @@ Foam::general::~general() Foam::scalar Foam::general::sample() const { - scalar y = 0; - scalar x = 0; + scalar x = 0.0; + scalar y = 0.0; + scalar p = 0.0; - bool success = false; - - while (!success) + do { x = minValue_ + range_*rndGen_.scalar01(); y = rndGen_.scalar01(); @@ -87,23 +86,17 @@ Foam::scalar Foam::general::sample() const while (!intervalFound) { i++; - if ( (x>xy_[i][0]) && (xxy_[i][0]) && (xy); return x; } diff --git a/src/thermophysicalModels/pdfs/normal/normal.C b/src/thermophysicalModels/pdfs/normal/normal.C index f8633c270b..2669f73e91 100644 --- a/src/thermophysicalModels/pdfs/normal/normal.C +++ b/src/thermophysicalModels/pdfs/normal/normal.C @@ -46,7 +46,7 @@ Foam::normal::normal(const dictionary& dict, Random& rndGen) expectation_(pdfDict_.lookup("expectation")), variance_(pdfDict_.lookup("variance")), strength_(pdfDict_.lookup("strength")), - range_(maxValue_-minValue_) + range_(maxValue_ - minValue_) { scalar sMax = 0; label n = strength_.size(); @@ -84,31 +84,26 @@ Foam::normal::~normal() Foam::scalar Foam::normal::sample() const { - scalar y = 0; - scalar x = 0; - label n = expectation_.size(); + scalar x = 0.0; + scalar y = 0.0; + scalar p = 0.0; bool success = false; - while (!success) + do { x = minValue_ + range_*rndGen_.scalar01(); y = rndGen_.scalar01(); - scalar p = 0.0; + p = 0.0; - for (label i=0; iy); return x; } diff --git a/src/thermophysicalModels/pdfs/uniform/uniform.C b/src/thermophysicalModels/pdfs/uniform/uniform.C index 988c337071..09c2c4b05a 100644 --- a/src/thermophysicalModels/pdfs/uniform/uniform.C +++ b/src/thermophysicalModels/pdfs/uniform/uniform.C @@ -43,7 +43,7 @@ Foam::uniform::uniform(const dictionary& dict, Random& rndGen) pdfDict_(dict.subDict(typeName + "PDF")), minValue_(readScalar(pdfDict_.lookup("minValue"))), maxValue_(readScalar(pdfDict_.lookup("maxValue"))), - range_(maxValue_-minValue_) + range_(maxValue_ - minValue_) {} From 6ae71645a2bed6b908ccb0a96d0a8b5b03229f28 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 3 Sep 2009 18:12:12 +0100 Subject: [PATCH 03/18] using cbrt(x) instead of pow(x, 0.333) --- .../PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C index 322ca30284..2589813289 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C @@ -58,7 +58,7 @@ Foam::scalar Foam::LiquidEvaporation::Sh const scalar Sc ) const { - return 2.0 + 0.6*Foam::sqrt(Re)*pow(Sc, 0.333); + return 2.0 + 0.6*Foam::sqrt(Re)*cbrt(Sc); } From ae95696aac151c76315a4ff9a08ba1b186c78e39 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 3 Sep 2009 18:15:18 +0100 Subject: [PATCH 04/18] minor formatting --- .../ReactingParcel/ReactingParcelIO.C | 2 +- .../HeatTransferModel/HeatTransferModel.H | 54 +++++++++---------- .../NoHeatTransfer/NoHeatTransfer.H | 1 + .../RanzMarshall/RanzMarshall.H | 4 +- 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C index b72d2af25a..d6591ee050 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C @@ -157,7 +157,7 @@ void Foam::ReactingParcel::writeFields { ThermoParcel::writeFields(c); - const label np = c.size(); + const label np = c.size(); if (np > 0) { diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.H b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.H index 1f9015800c..72453a2124 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.H +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/HeatTransferModel/HeatTransferModel.H @@ -115,42 +115,42 @@ public: // Member Functions - // Access + // Access - //- Return the cloud dictionary - const dictionary& dict() const; + //- Return the cloud dictionary + const dictionary& dict() const; - //- Return the coefficients dictionary - const dictionary& coeffDict() const; + //- Return the coefficients dictionary + const dictionary& coeffDict() const; - //- Return the owner cloud object - const CloudType& owner() const; + //- Return the owner cloud object + const CloudType& owner() const; - //- Return the Bird htc correction flag - const Switch& BirdCorrection() const; + //- Return the Bird htc correction flag + const Switch& BirdCorrection() const; - //- Flag to indicate whether model activates heat transfer model - virtual bool active() const = 0; + //- Flag to indicate whether model activates heat transfer model + virtual bool active() const = 0; - // Evaluation + // Evaluation - //- Nusselt number - virtual scalar Nu - ( - const scalar Re, - const scalar Pr - ) const = 0; + //- Nusselt number + virtual scalar Nu + ( + const scalar Re, + const scalar Pr + ) const = 0; - //- Return heat transfer coefficient - virtual scalar htc - ( - const scalar dp, - const scalar Re, - const scalar Pr, - const scalar kappa, - const scalar NCpW - ) const; + //- Return heat transfer coefficient + virtual scalar htc + ( + const scalar dp, + const scalar Re, + const scalar Pr, + const scalar kappa, + const scalar NCpW + ) const; }; diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/NoHeatTransfer/NoHeatTransfer.H b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/NoHeatTransfer/NoHeatTransfer.H index 2941b4c2b7..7a5ea0a86a 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/NoHeatTransfer/NoHeatTransfer.H +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/NoHeatTransfer/NoHeatTransfer.H @@ -39,6 +39,7 @@ Description namespace Foam { + /*---------------------------------------------------------------------------*\ Class NoHeatTransfer Declaration \*---------------------------------------------------------------------------*/ diff --git a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/RanzMarshall/RanzMarshall.H b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/RanzMarshall/RanzMarshall.H index e30c51cef4..3df31f1f8d 100644 --- a/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/RanzMarshall/RanzMarshall.H +++ b/src/lagrangian/intermediate/submodels/Thermodynamic/HeatTransferModel/RanzMarshall/RanzMarshall.H @@ -39,6 +39,7 @@ Description namespace Foam { + /*---------------------------------------------------------------------------*\ Class RanzMarshall Declaration \*---------------------------------------------------------------------------*/ @@ -76,9 +77,6 @@ public: //- Flag to indicate whether model activates heat transfer model virtual bool active() const; - //- Return the Bird correction flag - const Switch& BirdCorrection() const; - // Evaluation From 4e1dc5ffe14587b9e311ec545910c038451389ed Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 4 Sep 2009 10:25:31 +0100 Subject: [PATCH 05/18] removed faceZonesIntegrationFunctionObject - functionality offered by fieldValuesFunctionObject --- src/postProcessing/functionObjects/Allwmake | 1 - .../functionObjects/zones/Make/files | 4 - .../functionObjects/zones/Make/options | 9 - .../IOfaceZonesIntegration.H | 50 --- .../faceZonesIntegration.C | 330 ------------------ .../faceZonesIntegration.H | 180 ---------- .../faceZonesIntegrationFunctionObject.C | 43 --- .../faceZonesIntegrationFunctionObject.H | 55 --- 8 files changed, 672 deletions(-) delete mode 100644 src/postProcessing/functionObjects/zones/Make/files delete mode 100644 src/postProcessing/functionObjects/zones/Make/options delete mode 100644 src/postProcessing/functionObjects/zones/faceZoneIntegration/IOfaceZonesIntegration.H delete mode 100644 src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.C delete mode 100644 src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.H delete mode 100644 src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegrationFunctionObject.C delete mode 100644 src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegrationFunctionObject.H diff --git a/src/postProcessing/functionObjects/Allwmake b/src/postProcessing/functionObjects/Allwmake index b068fe51cb..6c642dfe7b 100755 --- a/src/postProcessing/functionObjects/Allwmake +++ b/src/postProcessing/functionObjects/Allwmake @@ -7,6 +7,5 @@ wmake libso forces wmake libso IO wmake libso utilities wmake libso systemCall -wmake libso zones # ----------------------------------------------------------------- end-of-file diff --git a/src/postProcessing/functionObjects/zones/Make/files b/src/postProcessing/functionObjects/zones/Make/files deleted file mode 100644 index 90e33f7524..0000000000 --- a/src/postProcessing/functionObjects/zones/Make/files +++ /dev/null @@ -1,4 +0,0 @@ -faceZoneIntegration/faceZonesIntegration.C -faceZoneIntegration/faceZonesIntegrationFunctionObject.C - -LIB = $(FOAM_LIBBIN)/libzoneFunctionObjects diff --git a/src/postProcessing/functionObjects/zones/Make/options b/src/postProcessing/functionObjects/zones/Make/options deleted file mode 100644 index 5166bcc9e3..0000000000 --- a/src/postProcessing/functionObjects/zones/Make/options +++ /dev/null @@ -1,9 +0,0 @@ -EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude \ - -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/sampling/lnInclude - -LIB_LIBS = \ - -lfiniteVolume \ - -lmeshTools \ - -lsampling diff --git a/src/postProcessing/functionObjects/zones/faceZoneIntegration/IOfaceZonesIntegration.H b/src/postProcessing/functionObjects/zones/faceZoneIntegration/IOfaceZonesIntegration.H deleted file mode 100644 index ef1ecbf004..0000000000 --- a/src/postProcessing/functionObjects/zones/faceZoneIntegration/IOfaceZonesIntegration.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 - -Typedef - Foam::IOfaceZonesIntegration - -Description - Instance of the generic IOOutputFilter for faceZonesIntegration. - -\*---------------------------------------------------------------------------*/ - -#ifndef IOfaceZonesIntegration_H -#define IOfaceZonesIntegration_H - -#include "faceZonesIntegration.H" -#include "IOOutputFilter.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef IOOutputFilter IOfaceZonesIntegration; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.C b/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.C deleted file mode 100644 index 2899224d29..0000000000 --- a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.C +++ /dev/null @@ -1,330 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "faceZonesIntegration.H" -#include "volFields.H" -#include "dictionary.H" -#include "Time.H" -#include "IOmanip.H" -#include "ListListOps.H" -#include "processorPolyPatch.H" -#include "cyclicPolyPatch.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(faceZonesIntegration, 0); -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::faceZonesIntegration::faceZonesIntegration -( - const word& name, - const objectRegistry& obr, - const dictionary& dict, - const bool loadFromFiles -) -: - name_(name), - obr_(obr), - active_(true), - log_(false), - zoneNames_(), - fieldNames_(), - filePtr_(NULL) -{ - // Check if the available mesh is an fvMesh otherise deactivate - if (!isA(obr_)) - { - active_ = false; - WarningIn - ( - "Foam::faceZonesIntegration::faceZonesIntegration" - "(" - "const word&, " - "const objectRegistry&, " - "const dictionary&, " - "const bool" - ")" - ) << "No fvMesh available, deactivating." - << endl; - } - - read(dict); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::faceZonesIntegration::~faceZonesIntegration() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::faceZonesIntegration::read(const dictionary& dict) -{ - if (active_) - { - log_ = dict.lookupOrDefault("log", false); - - dict.lookup("fields") >> fieldNames_; - - dict.lookup("faceZones") >> zoneNames_; - } -} - - -void Foam::faceZonesIntegration::makeFile() -{ - // Create the face Zone file if not already created - if (filePtr_.empty()) - { - if (debug) - { - Info<< "Creating faceZonesIntegration file." << endl; - } - - // File update - if (Pstream::master()) - { - fileName faceZonesIntegrationDir; - if (Pstream::parRun()) - { - // Put in undecomposed case (Note: gives problems for - // distributed data running) - faceZonesIntegrationDir = - obr_.time().path()/".."/name_/obr_.time().timeName(); - } - else - { - faceZonesIntegrationDir = - obr_.time().path()/name_/obr_.time().timeName(); - } - - // Create directory if does not exist. - mkDir(faceZonesIntegrationDir); - - // Open new file at start up - filePtr_.resize(fieldNames_.size()); - - forAll(fieldNames_, fieldI) - { - const word& fieldName = fieldNames_[fieldI]; - - OFstream* sPtr = new OFstream - ( - faceZonesIntegrationDir/fieldName - ); - - filePtr_.insert(fieldName, sPtr); - } - - // Add headers to output data - writeFileHeader(); - } - } -} - - -void Foam::faceZonesIntegration::writeFileHeader() -{ - forAllIter(HashPtrTable, filePtr_, iter) - { - unsigned int w = IOstream::defaultPrecision() + 7; - - OFstream& os = *filePtr_[iter.key()]; - - os << "#Time " << setw(w); - - forAll (zoneNames_, zoneI) - { - os << zoneNames_[zoneI] << setw(w); - } - - os << nl << endl; - } -} - - -void Foam::faceZonesIntegration::execute() -{ - // Do nothing - only valid on write -} - - -void Foam::faceZonesIntegration::end() -{ - // Do nothing - only valid on write -} - - -void Foam::faceZonesIntegration::write() -{ - if (active_) - { - makeFile(); - - forAll(fieldNames_, fieldI) - { - const word& fieldName = fieldNames_[fieldI]; - - const surfaceScalarField& sField = - obr_.lookupObject(fieldName); - - const fvMesh& mesh = sField.mesh(); - - // 1. integrate over all face zones - - scalarField integralVals(zoneNames_.size()); - - forAll(integralVals, zoneI) - { - const word& name = zoneNames_[zoneI]; - - label zoneID = mesh.faceZones().findZoneID(name); - - const faceZone& fZone = mesh.faceZones()[zoneID]; - - integralVals[zoneI] = returnReduce - ( - calcIntegral(sField, fZone), - sumOp() - ); - } - - - unsigned int w = IOstream::defaultPrecision() + 7; - - // 2. Write only on master - - if (Pstream::master() && filePtr_.found(fieldName)) - { - OFstream& os = *filePtr_(fieldName); - - os << obr_.time().value(); - - forAll(integralVals, zoneI) - { - os << ' ' << setw(w) << integralVals[zoneI]; - - if (log_) - { - Info<< "faceZonesIntegration output:" << nl - << " Integration[" << zoneI << "] " - << integralVals[zoneI] << endl; - } - } - - os << endl; - } - } - } -} - - -Foam::scalar Foam::faceZonesIntegration::calcIntegral -( - const surfaceScalarField& sField, - const faceZone& fZone -) const -{ - scalar sum = 0.0; - const fvMesh& mesh = sField.mesh(); - - forAll (fZone, i) - { - label faceI = fZone[i]; - - if (mesh.isInternalFace(faceI)) - { - if (fZone.flipMap()[i]) - { - sum -= sField[faceI]; - } - else - { - sum += sField[faceI]; - } - } - else - { - label patchI = mesh.boundaryMesh().whichPatch(faceI); - const polyPatch& pp = mesh.boundaryMesh()[patchI]; - const fvsPatchScalarField& bField = sField.boundaryField()[patchI]; - if (isA(pp)) - { - if (refCast(pp).owner()) - { - label patchFaceI = pp.whichFace(faceI); - if (fZone.flipMap()[i]) - { - sum -= bField[patchFaceI]; - } - else - { - sum += bField[patchFaceI]; - } - } - } - else if (isA(pp)) - { - label patchFaceI = faceI - pp.start(); - if (patchFaceI < pp.size()/2) - { - if (fZone.flipMap()[i]) - { - sum -= bField[patchFaceI]; - } - else - { - sum += bField[patchFaceI]; - } - } - } - else if (!isA(pp)) - { - label patchFaceI = faceI - pp.start(); - if (fZone.flipMap()[i]) - { - sum -= bField[patchFaceI]; - } - else - { - sum += bField[patchFaceI]; - } - } - } - } - - return sum; -} - - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.H b/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.H deleted file mode 100644 index d1a1bacfd2..0000000000 --- a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegration.H +++ /dev/null @@ -1,180 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 - -Class - Foam::faceZonesIntegration - -Description - Integrates surfaceScalarFields on faceZones - -SourceFiles - faceZonesIntegration.C - IOfaceZonesIntegration.H - -\*---------------------------------------------------------------------------*/ - -#ifndef faceZonesIntegration_H -#define faceZonesIntegration_H - -#include "fvCFD.H" -#include "primitiveFieldsFwd.H" -#include "volFieldsFwd.H" -#include "HashPtrTable.H" -#include "OFstream.H" -#include "Switch.H" -#include "pointFieldFwd.H" -#include "polyMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// Forward declaration of classes -class objectRegistry; -class dictionary; -class mapPolyMesh; - -/*---------------------------------------------------------------------------*\ - Class faceZonesIntegration Declaration -\*---------------------------------------------------------------------------*/ - -class faceZonesIntegration -{ - -protected: - - // Protected data - - //- Name of this set of face zone integration, - // Also used as the name of the output directory. - word name_; - - const objectRegistry& obr_; - - - // Read from dictionary - - //- On/off switch - bool active_; - - //- Switch to send output to Info as well as to file - Switch log_; - - //- List of face zone names to integrate over - wordList zoneNames_; - - //- Names of the surface fields - wordList fieldNames_; - - - //- Current open files - HashPtrTable filePtr_; - - - - // Protected Member Functions - - //- If the integration file has not been created create it - void makeFile(); - - scalar calcIntegral - ( - const surfaceScalarField& sField, - const faceZone& fZone - ) const; - - - //- Disallow default bitwise copy construct - faceZonesIntegration(const faceZonesIntegration&); - - //- Disallow default bitwise assignment - void operator=(const faceZonesIntegration&); - - //- Output file header information - virtual void writeFileHeader(); - - -public: - - //- Runtime type information - TypeName("faceZonesIntegration"); - - - // Constructors - - //- Construct for given objectRegistry and dictionary. - // Allow the possibility to load fields from files - faceZonesIntegration - ( - const word& name, - const objectRegistry&, - const dictionary&, - const bool loadFromFiles = false - ); - - - //- Destructor - virtual ~faceZonesIntegration(); - - - // Member Functions - - //- Return name of the set of zones - virtual const word& name() const - { - return name_; - }; - - //- Read the zone integration data - virtual void read(const dictionary&); - - //- Execute, currently does nothing - virtual void execute(); - - //- Execute at the final time-loop, currently does nothing - virtual void end(); - - //- Write the integration - virtual void write(); - - //- Update for changes of mesh - virtual void updateMesh(const mapPolyMesh&) - {} - - //- Update for changes of mesh - virtual void movePoints(const pointField&) - {} -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegrationFunctionObject.C b/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegrationFunctionObject.C deleted file mode 100644 index 43665119b1..0000000000 --- a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegrationFunctionObject.C +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 "faceZonesIntegrationFunctionObject.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineNamedTemplateTypeNameAndDebug(faceZonesIntegrationFunctionObject, 0); - - addToRunTimeSelectionTable - ( - functionObject, - faceZonesIntegrationFunctionObject, - dictionary - ); -} - -// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegrationFunctionObject.H b/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegrationFunctionObject.H deleted file mode 100644 index 2cc95e2af2..0000000000 --- a/src/postProcessing/functionObjects/zones/faceZoneIntegration/faceZonesIntegrationFunctionObject.H +++ /dev/null @@ -1,55 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 - -Typedef - Foam::faceZonesIntegrationFunctionObject - -Description - FunctionObject wrapper around faceZonesIntegration to allow them to be - created via the functions list within controlDict. - -SourceFiles - faceZonesIntegrationFunctionObject.C - -\*---------------------------------------------------------------------------*/ - -#ifndef faceZonesIntegrationFunctionObject_H -#define faceZonesIntegrationFunctionObject_H - -#include "faceZonesIntegration.H" -#include "OutputFilterFunctionObject.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - typedef OutputFilterFunctionObject - faceZonesIntegrationFunctionObject; -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // From 1198d3e0adb899d427e497fa3dca426ebfd000cc Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 4 Sep 2009 12:25:28 +0100 Subject: [PATCH 06/18] added region option --- .../mesh/manipulation/createBaffles/createBaffles.C | 3 ++- .../utilities/mesh/manipulation/createPatch/createPatch.C | 8 +++++++- .../utilities/mesh/manipulation/setsToZones/setsToZones.C | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C index 3d23cce5c3..c6fa201218 100644 --- a/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C +++ b/applications/utilities/mesh/manipulation/createBaffles/createBaffles.C @@ -125,6 +125,7 @@ label findPatchID(const polyMesh& mesh, const word& name) int main(int argc, char *argv[]) { +# include "addRegionOption.H" argList::validArgs.append("faceZone"); argList::validArgs.append("patch"); argList::validOptions.insert("additionalPatches", "(patch2 .. patchN)"); @@ -134,7 +135,7 @@ int main(int argc, char *argv[]) # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); -# include "createMesh.H" +# include "createNamedMesh.H" const word oldInstance = mesh.pointsInstance(); const polyBoundaryMesh& patches = mesh.boundaryMesh(); diff --git a/applications/utilities/mesh/manipulation/createPatch/createPatch.C b/applications/utilities/mesh/manipulation/createPatch/createPatch.C index 40ba0efade..6374722e46 100644 --- a/applications/utilities/mesh/manipulation/createPatch/createPatch.C +++ b/applications/utilities/mesh/manipulation/createPatch/createPatch.C @@ -516,11 +516,13 @@ void syncPoints int main(int argc, char *argv[]) { +# include "addRegionOption.H" argList::validOptions.insert("overwrite", ""); # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); +# include "createNamedPolyMesh.H" const bool overwrite = args.optionFound("overwrite"); @@ -532,6 +534,11 @@ int main(int argc, char *argv[]) ( "createPatchDict", runTime.system(), + ( + regionName != polyMesh::defaultRegion + ? regionName + : word::null + ), runTime, IOobject::MUST_READ, IOobject::NO_WRITE, @@ -551,7 +558,6 @@ int main(int argc, char *argv[]) coupledPolyPatch::matchTol = tol; -# include "createPolyMesh.H" const word oldInstance = mesh.pointsInstance(); const polyBoundaryMesh& patches = mesh.boundaryMesh(); diff --git a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C index a369a195b8..df419e118b 100644 --- a/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C +++ b/applications/utilities/mesh/manipulation/setsToZones/setsToZones.C @@ -60,6 +60,7 @@ int main(int argc, char *argv[]) { argList::validOptions.insert("noFlipMap", ""); +# include "addRegionOption.H" # include "addTimeOptions.H" # include "setRootCase.H" # include "createTime.H" @@ -77,7 +78,7 @@ int main(int argc, char *argv[]) runTime.setTime(Times[startTime], startTime); -# include "createPolyMesh.H" +# include "createNamedPolyMesh.H" // Search for list of objects for the time of the mesh IOobjectList objects From fd1873fe4b1c185ba6d92c06d1f1b9cd0ac8126e Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 4 Sep 2009 12:25:42 +0100 Subject: [PATCH 07/18] handling zero-sized triangles --- src/meshTools/triSurface/triangleFuncs/triangleFuncs.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C b/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C index dab51b4714..e3f4983ffe 100644 --- a/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C +++ b/src/meshTools/triSurface/triangleFuncs/triangleFuncs.C @@ -115,7 +115,7 @@ bool Foam::triangleFuncs::intersectAxesBundle // V10:(-1.285715 8.99165e-16 -1.142858) // V20:(0 0 -1.678573) // i0:0 - if (Foam::mag(det)/localScale < SMALL) + if (localScale < VSMALL || Foam::mag(det)/localScale < SMALL) { // Triangle parallel to dir return false; From c01cfedba8907511782391ced3e041a106059ceb Mon Sep 17 00:00:00 2001 From: mattijs Date: Fri, 4 Sep 2009 12:44:45 +0100 Subject: [PATCH 08/18] added some comment --- .../mesh/generation/snappyHexMesh/snappyHexMeshDict | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict index cd7c13d783..92c92d72e5 100644 --- a/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict +++ b/applications/utilities/mesh/generation/snappyHexMesh/snappyHexMeshDict @@ -280,11 +280,14 @@ addLayersControls nBufferCellsNoExtrude 0; - // Overall max number of layer addition iterations + // Overall max number of layer addition iterations. The mesher will exit + // if it reaches this number of iterations; possibly with an illegal + // mesh. nLayerIter 50; // Max number of iterations after which relaxed meshQuality controls - // get used. + // get used. Up to nRelaxIter it uses the settings in meshQualityControls, + // after nRelaxIter it uses the values in meshQualityControls::relaxed. nRelaxedIter 20; } From 6062a1ef6604e03ad59f953200b1e2dee8667555 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 4 Sep 2009 16:19:57 +0100 Subject: [PATCH 09/18] updates/improvements to the cloud IO system and using new constants --- .../coalChemistryFoam/coalChemistryFoam.C | 1 - .../coalChemistryFoam/createClouds.H | 2 +- .../createClouds.H | 2 +- .../porousExplicitSourceReactingParcelFoam.C | 1 - .../reactingParcelFoam/createClouds.H | 2 +- .../reactingParcelFoam/reactingParcelFoam.C | 1 - src/lagrangian/basic/Cloud/CloudIO.C | 8 +- .../coalCombustion/CoalCloud/CoalCloud.C | 70 ---------------- .../coalCombustion/CoalCloud/CoalCloud.H | 68 ++------------- .../CoalCloud/defineCoalCloud.C | 38 --------- src/lagrangian/coalCombustion/Make/files | 3 - .../include/createCoalParcelTypes.H | 3 +- src/lagrangian/dieselSpray/parcel/parcelIO.C | 10 +-- src/lagrangian/dieselSpray/spray/spray.C | 16 ++-- src/lagrangian/dieselSpray/spray/spray.H | 9 +- .../clouds/Templates/DsmcCloud/DsmcCloud.C | 20 +++-- .../clouds/Templates/DsmcCloud/DsmcCloud.H | 13 +-- .../clouds/Templates/DsmcCloud/DsmcCloudI.H | 18 ++-- .../dsmc/clouds/derived/dsmcCloud/dsmcCloud.C | 11 +-- .../dsmc/clouds/derived/dsmcCloud/dsmcCloud.H | 6 -- .../parcels/Templates/DsmcParcel/DsmcParcel.H | 4 +- .../Templates/DsmcParcel/DsmcParcelIO.C | 10 +-- .../LarsenBorgnakkeVariableHardSphere.C | 10 ++- .../VariableHardSphere/VariableHardSphere.C | 10 ++- .../FreeStream/FreeStream.C | 8 +- .../MaxwellianThermal/MaxwellianThermal.C | 5 +- src/lagrangian/intermediate/Make/files | 7 -- .../Templates/KinematicCloud/KinematicCloud.C | 10 ++- .../Templates/KinematicCloud/KinematicCloud.H | 3 +- .../Templates/ReactingCloud/ReactingCloud.C | 10 ++- .../Templates/ReactingCloud/ReactingCloud.H | 3 +- .../ReactingMultiphaseCloud.C | 12 ++- .../ReactingMultiphaseCloud.H | 3 +- .../Templates/ThermoCloud/ThermoCloud.C | 13 ++- .../Templates/ThermoCloud/ThermoCloud.H | 3 +- .../BasicReactingCloud/BasicReactingCloud.C | 70 ---------------- .../BasicReactingCloud/BasicReactingCloud.H | 68 ++------------- .../defineBasicReactingCloud.C | 38 --------- .../BasicReactingMultiphaseCloud.C | 70 ---------------- .../BasicReactingMultiphaseCloud.H | 74 +++-------------- .../defineBasicReactingMultiphaseCloud.C | 38 --------- .../basicKinematicCloud/basicKinematicCloud.C | 68 --------------- .../basicKinematicCloud/basicKinematicCloud.H | 52 +----------- .../basicThermoCloud/basicThermoCloud.C | 68 --------------- .../basicThermoCloud/basicThermoCloud.H | 56 +------------ .../clouds/include/createReactingCloudTypes.H | 50 ----------- .../KinematicParcel/KinematicParcel.H | 4 +- .../KinematicParcel/KinematicParcelIO.C | 10 +-- .../ReactingMultiphaseParcel.H | 7 +- .../ReactingMultiphaseParcelIO.C | 12 ++- .../Templates/ReactingParcel/ReactingParcel.H | 4 +- .../ReactingParcel/ReactingParcelIO.C | 15 ++-- .../Templates/ThermoParcel/ThermoParcel.H | 4 +- .../Templates/ThermoParcel/ThermoParcelIO.C | 10 +-- .../molecule/mdTools/temperatureAndPressure.H | 8 +- .../molecule/molecule/molecule.H | 7 +- .../molecule/molecule/moleculeIO.C | 9 +- .../molecule/moleculeCloud/moleculeCloud.C | 82 +++++++------------ .../molecule/moleculeCloud/moleculeCloud.H | 18 +--- .../molecule/moleculeCloud/moleculeCloudI.H | 8 +- .../solidParticle/solidParticleCloud.C | 14 ++-- .../solidParticle/solidParticleCloud.H | 9 +- .../field/streamLine/streamLineParticle.C | 10 +-- .../streamLine/streamLineParticleCloud.C | 30 ++----- .../streamLine/streamLineParticleCloud.H | 14 +--- .../utilities/dsmcFields/dsmcFields.C | 10 ++- 66 files changed, 257 insertions(+), 1093 deletions(-) delete mode 100644 src/lagrangian/coalCombustion/CoalCloud/CoalCloud.C delete mode 100644 src/lagrangian/coalCombustion/CoalCloud/defineCoalCloud.C delete mode 100644 src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/BasicReactingCloud.C delete mode 100644 src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/defineBasicReactingCloud.C delete mode 100644 src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.C delete mode 100644 src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/defineBasicReactingMultiphaseCloud.C delete mode 100644 src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.C delete mode 100644 src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.C delete mode 100644 src/lagrangian/intermediate/clouds/include/createReactingCloudTypes.H diff --git a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C index 8a7fb290b8..f6794e92b2 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C +++ b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C @@ -38,7 +38,6 @@ Description #include "CoalCloud.H" #include "psiChemistryModel.H" #include "chemistrySolver.H" -#include "thermoPhysicsTypes.H" #include "timeActivatedExplicitCellSource.H" #include "radiationModel.H" diff --git a/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H b/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H index 0a5fd91b75..dbd7cf9659 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H @@ -1,5 +1,5 @@ Info<< "\nConstructing coal cloud" << endl; -CoalCloud coalParcels +thermoCoalCloud coalParcels ( "coalCloud1", rho, diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createClouds.H b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createClouds.H index 728e605e57..2accb8e1c9 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createClouds.H +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/createClouds.H @@ -1,5 +1,5 @@ Info<< "\nConstructing reacting cloud" << endl; -BasicReactingCloud parcels +icoPoly8ThermoReactingCloud parcels ( "reactingCloud1", rho, diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C index 4242452440..bf0a16af28 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/porousExplicitSourceReactingParcelFoam.C @@ -46,7 +46,6 @@ Description #include "BasicReactingCloud.H" #include "rhoChemistryModel.H" #include "chemistrySolver.H" -#include "thermoPhysicsTypes.H" #include "radiationModel.H" #include "porousZones.H" #include "timeActivatedExplicitMulticomponentPointSource.H" diff --git a/applications/solvers/lagrangian/reactingParcelFoam/createClouds.H b/applications/solvers/lagrangian/reactingParcelFoam/createClouds.H index 4ae0633ab7..f3e043143c 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/createClouds.H +++ b/applications/solvers/lagrangian/reactingParcelFoam/createClouds.H @@ -1,5 +1,5 @@ Info<< "\nConstructing reacting cloud" << endl; -BasicReactingCloud parcels +thermoReactingCloud parcels ( "reactingCloud1", rho, diff --git a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C index 62f8f4834a..4dfd367d09 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C +++ b/applications/solvers/lagrangian/reactingParcelFoam/reactingParcelFoam.C @@ -37,7 +37,6 @@ Description #include "BasicReactingCloud.H" #include "psiChemistryModel.H" #include "chemistrySolver.H" -#include "thermoPhysicsTypes.H" #include "radiationModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/basic/Cloud/CloudIO.C b/src/lagrangian/basic/Cloud/CloudIO.C index c1e4b30f80..ac23db92e4 100644 --- a/src/lagrangian/basic/Cloud/CloudIO.C +++ b/src/lagrangian/basic/Cloud/CloudIO.C @@ -139,7 +139,13 @@ void Foam::Cloud::readFields() template void Foam::Cloud::writeFields() const -{} +{ + if (this->size()) + { + const ParticleType& p = *this->first(); + ParticleType::writeFields(p.cloud()); + } +} template diff --git a/src/lagrangian/coalCombustion/CoalCloud/CoalCloud.C b/src/lagrangian/coalCombustion/CoalCloud/CoalCloud.C deleted file mode 100644 index 0f274d70bf..0000000000 --- a/src/lagrangian/coalCombustion/CoalCloud/CoalCloud.C +++ /dev/null @@ -1,70 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-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 "CoalCloud.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::CoalCloud::CoalCloud -( - const word& cloudName, - const volScalarField& rho, - const volVectorField& U, - const dimensionedVector& g, - basicThermo& thermo -) -: - ReactingMultiphaseCloud > - ( - cloudName, - rho, - U, - g, - thermo - ) -{ - CoalParcel::readFields(*this); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::CoalCloud::~CoalCloud() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::CoalCloud::writeFields() const -{ - CoalParcel::writeFields(*this); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/coalCombustion/CoalCloud/CoalCloud.H b/src/lagrangian/coalCombustion/CoalCloud/CoalCloud.H index 8516508d8b..0ca7aa497c 100644 --- a/src/lagrangian/coalCombustion/CoalCloud/CoalCloud.H +++ b/src/lagrangian/coalCombustion/CoalCloud/CoalCloud.H @@ -26,9 +26,7 @@ Class CoalCloud Description - -SourceFiles - CoalCloud.C + Coal cloud templated on the type of carrier phase thermodynamics \*---------------------------------------------------------------------------*/ @@ -37,69 +35,21 @@ SourceFiles #include "ReactingMultiphaseCloud.H" #include "CoalParcel.H" +#include "thermoPhysicsTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { + typedef ReactingMultiphaseCloud > + constThermoCoalCloud; -/*---------------------------------------------------------------------------*\ - Class CoalCloud Declaration -\*---------------------------------------------------------------------------*/ + typedef ReactingMultiphaseCloud > + thermoCoalCloud; -template -class CoalCloud -: - public ReactingMultiphaseCloud > -{ - // Private Member Functions - - //- Disallow default bitwise copy construct - CoalCloud(const CoalCloud&); - - //- Disallow default bitwise assignment - void operator=(const CoalCloud&); - - -public: - - //-Runtime type information - TypeName("CoalCloud"); - - - // Constructors - - //- Construct given carrier gas fields - CoalCloud - ( - const word& cloudName, - const volScalarField& rho, - const volVectorField& U, - const dimensionedVector& g, - basicThermo& thermo - ); - - - //- Destructor - ~CoalCloud(); - - - // Member Functions - - //- Write fields - virtual void writeFields() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository - #include "CoalCloud.C" -#endif + typedef ReactingMultiphaseCloud > + icoPoly8ThermoCoalCloud; +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/coalCombustion/CoalCloud/defineCoalCloud.C b/src/lagrangian/coalCombustion/CoalCloud/defineCoalCloud.C deleted file mode 100644 index cc0fa34f49..0000000000 --- a/src/lagrangian/coalCombustion/CoalCloud/defineCoalCloud.C +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-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 "createReactingCloudTypes.H" -#include "CoalCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - createReactingCloudType(CoalCloud); -}; - - -// ************************************************************************* // diff --git a/src/lagrangian/coalCombustion/Make/files b/src/lagrangian/coalCombustion/Make/files index 2c7aac61ab..e00ab17131 100644 --- a/src/lagrangian/coalCombustion/Make/files +++ b/src/lagrangian/coalCombustion/Make/files @@ -1,6 +1,3 @@ -/* Coal cloud */ -CoalCloud/defineCoalCloud.C - /* Coal parcel and sub-models */ CoalParcel/defineCoalParcel.C CoalParcel/makeCoalParcelSubmodels.C diff --git a/src/lagrangian/coalCombustion/include/createCoalParcelTypes.H b/src/lagrangian/coalCombustion/include/createCoalParcelTypes.H index 7d7f95da36..f81595ad59 100644 --- a/src/lagrangian/coalCombustion/include/createCoalParcelTypes.H +++ b/src/lagrangian/coalCombustion/include/createCoalParcelTypes.H @@ -92,8 +92,7 @@ License ( \ ReactingMultiphaseCloud, \ 0 \ - ); \ - defineParcelTypeNameAndDebug(CoalCloud, 0); + ); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/dieselSpray/parcel/parcelIO.C b/src/lagrangian/dieselSpray/parcel/parcelIO.C index 4ae7bbc90a..f9c0293383 100644 --- a/src/lagrangian/dieselSpray/parcel/parcelIO.C +++ b/src/lagrangian/dieselSpray/parcel/parcelIO.C @@ -96,10 +96,7 @@ Foam::parcel::parcel } -void Foam::parcel::readFields -( - Cloud& c -) +void Foam::parcel::readFields(Cloud& c) { if (!c.size()) { @@ -195,10 +192,7 @@ void Foam::parcel::readFields } -void Foam::parcel::writeFields -( - const Cloud& c -) +void Foam::parcel::writeFields(const Cloud& c) { Particle::writeFields(c); diff --git a/src/lagrangian/dieselSpray/spray/spray.C b/src/lagrangian/dieselSpray/spray/spray.C index 1f1945ef5d..8dc5ad5fe0 100644 --- a/src/lagrangian/dieselSpray/spray/spray.C +++ b/src/lagrangian/dieselSpray/spray/spray.C @@ -59,7 +59,8 @@ Foam::spray::spray const basicMultiComponentMixture& composition, const PtrList& gasProperties, const dictionary&, - const dimensionedVector& g + const dimensionedVector& g, + bool readFields ) : Cloud(U.mesh(), false), // suppress className checking on positions @@ -345,7 +346,10 @@ Foam::spray::spray } } - parcel::readFields(*this); + if (readFields) + { + parcel::readFields(*this); + } } @@ -355,12 +359,4 @@ Foam::spray::~spray() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::spray::writeFields() const -{ - parcel::writeFields(*this); -} - - // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/spray/spray.H b/src/lagrangian/dieselSpray/spray/spray.H index 60127656e7..5c641ec84e 100644 --- a/src/lagrangian/dieselSpray/spray/spray.H +++ b/src/lagrangian/dieselSpray/spray/spray.H @@ -194,7 +194,8 @@ public: const basicMultiComponentMixture& composition, const PtrList& gasProperties, const dictionary& thermophysicalProperties, - const dimensionedVector& g + const dimensionedVector& g, + bool readFields = true ); @@ -339,12 +340,6 @@ public: //- Return Ambient Temperature void calculateAmbientTemperature(); - - - // I/O - - //- Write fields - virtual void writeFields() const; }; diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C index 23aa3dc478..5ac29101e5 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.C @@ -28,11 +28,9 @@ License #include "BinaryCollisionModel.H" #include "WallInteractionModel.H" #include "InflowBoundaryModel.H" +#include "constants.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template -Foam::scalar Foam::DsmcCloud::kb = 1.380650277e-23; +using namespace Foam::constant; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -526,7 +524,8 @@ Foam::DsmcCloud::DsmcCloud ( const word& cloudName, const volScalarField& T, - const volVectorField& U + const volVectorField& U, + bool readFields ) : Cloud(T.mesh(), cloudName, false), @@ -630,6 +629,11 @@ Foam::DsmcCloud::DsmcCloud { collisionSelectionRemainder_[i] = rndGen_.scalar01(); } + + if (readFields) + { + ParcelType::readFields(*this); + } } @@ -853,7 +857,7 @@ Foam::vector Foam::DsmcCloud::equipartitionLinearVelocity ) { return - sqrt(kb*temperature/mass) + sqrt(physicoChemical::k.value()*temperature/mass) *vector ( rndGen_.GaussNormal(), @@ -879,7 +883,7 @@ Foam::scalar Foam::DsmcCloud::equipartitionInternalEnergy else if (iDof < 2.0 + SMALL && iDof > 2.0 - SMALL) { // Special case for iDof = 2, i.e. diatomics; - Ei = -log(rndGen_.scalar01())*kb*temperature; + Ei = -log(rndGen_.scalar01())*physicoChemical::k.value()*temperature; } else { @@ -897,7 +901,7 @@ Foam::scalar Foam::DsmcCloud::equipartitionInternalEnergy } while (P < rndGen_.scalar01()); - Ei = energyRatio*kb*temperature; + Ei = energyRatio*physicoChemical::k.value()*temperature; } return Ei; diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H index 76b1dd7e79..c3765ba0df 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloud.H @@ -171,12 +171,6 @@ class DsmcCloud public: - // Static data members - - //- Boltzmann constant - static scalar kb; - - // Constructors //- Construct given name and mesh, will read Parcels from file @@ -184,7 +178,8 @@ public: ( const word& cloudName, const volScalarField& T, - const volVectorField& U + const volVectorField& U, + bool readFields = true ); //- Construct given name and mesh. Used to initialise. @@ -338,6 +333,7 @@ public: scalar mass ) const; + // Sub-models //- Return reference to binary elastic collision model @@ -429,11 +425,8 @@ public: //- Evolve the cloud (move, collide) void evolve(); - //- Clear the Cloud inline void clear(); - - }; diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H index 492bc98e18..1c58b87c24 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H @@ -24,7 +24,9 @@ License \*---------------------------------------------------------------------------*/ -#include "mathConstants.H" +#include "constants.H" + +using namespace Foam::constant; // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -314,7 +316,8 @@ inline Foam::scalar Foam::DsmcCloud::maxwellianAverageSpeed scalar mass ) const { - return 2.0*sqrt(2.0*kb*temperature/(constant::math::pi*mass)); + return + 2.0*sqrt(2.0*physicoChemical::k.value()*temperature/(math::pi*mass)); } @@ -325,7 +328,8 @@ inline Foam::scalarField Foam::DsmcCloud::maxwellianAverageSpeed scalar mass ) const { - return 2.0*sqrt(2.0*kb*temperature/(constant::math::pi*mass)); + return + 2.0*sqrt(2.0*physicoChemical::k.value()*temperature/(math::pi*mass)); } @@ -336,7 +340,7 @@ inline Foam::scalar Foam::DsmcCloud::maxwellianRMSSpeed scalar mass ) const { - return sqrt(3.0*kb*temperature/mass); + return sqrt(3.0*physicoChemical::k.value()*temperature/mass); } @@ -347,7 +351,7 @@ inline Foam::scalarField Foam::DsmcCloud::maxwellianRMSSpeed scalar mass ) const { - return sqrt(3.0*kb*temperature/mass); + return sqrt(3.0*physicoChemical::k.value()*temperature/mass); } @@ -359,7 +363,7 @@ Foam::DsmcCloud::maxwellianMostProbableSpeed scalar mass ) const { - return sqrt(2.0*kb*temperature/mass); + return sqrt(2.0*physicoChemical::k.value()*temperature/mass); } @@ -371,7 +375,7 @@ Foam::DsmcCloud::maxwellianMostProbableSpeed scalar mass ) const { - return sqrt(2.0*kb*temperature/mass); + return sqrt(2.0*physicoChemical::k.value()*temperature/mass); } diff --git a/src/lagrangian/dsmc/clouds/derived/dsmcCloud/dsmcCloud.C b/src/lagrangian/dsmc/clouds/derived/dsmcCloud/dsmcCloud.C index 425e47a705..7f94f3e739 100644 --- a/src/lagrangian/dsmc/clouds/derived/dsmcCloud/dsmcCloud.C +++ b/src/lagrangian/dsmc/clouds/derived/dsmcCloud/dsmcCloud.C @@ -44,9 +44,7 @@ Foam::dsmcCloud::dsmcCloud ) : DsmcCloud(cloudName, T, U) -{ - dsmcParcel::readFields(*this); -} +{} Foam::dsmcCloud::dsmcCloud @@ -65,11 +63,4 @@ Foam::dsmcCloud::~dsmcCloud() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::dsmcCloud::writeFields() const -{ - dsmcParcel::writeFields(*this); -} - // ************************************************************************* // diff --git a/src/lagrangian/dsmc/clouds/derived/dsmcCloud/dsmcCloud.H b/src/lagrangian/dsmc/clouds/derived/dsmcCloud/dsmcCloud.H index ad63aca9fc..99343c2b3e 100644 --- a/src/lagrangian/dsmc/clouds/derived/dsmcCloud/dsmcCloud.H +++ b/src/lagrangian/dsmc/clouds/derived/dsmcCloud/dsmcCloud.H @@ -86,12 +86,6 @@ public: //- Destructor ~dsmcCloud(); - - - // Member functions - - //- Write fields - virtual void writeFields() const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H index d96d515843..918767b1af 100644 --- a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H +++ b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H @@ -308,9 +308,9 @@ public: // I-O - static void readFields(DsmcCloud& c); + static void readFields(Cloud& c); - static void writeFields(const DsmcCloud& c); + static void writeFields(const Cloud& c); // Ostream Operator diff --git a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelIO.C b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelIO.C index 6677591009..6e43e47508 100644 --- a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelIO.C +++ b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelIO.C @@ -74,10 +74,7 @@ Foam::DsmcParcel::DsmcParcel template -void Foam::DsmcParcel::readFields -( - DsmcCloud& c -) +void Foam::DsmcParcel::readFields(Cloud& c) { if (!c.size()) { @@ -107,10 +104,7 @@ void Foam::DsmcParcel::readFields template -void Foam::DsmcParcel::writeFields -( - const DsmcCloud& c -) +void Foam::DsmcParcel::writeFields(const Cloud& c) { Particle::writeFields(c); diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C index 3ab8c5511e..e445f7cde5 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C @@ -25,7 +25,9 @@ License \*---------------------------------------------------------------------------*/ #include "LarsenBorgnakkeVariableHardSphere.H" -#include "mathConstants.H" +#include "constants.H" + +using namespace Foam::constant; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -157,8 +159,8 @@ Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere::sigmaTcR // calculating cross section = pi*dPQ^2, where dPQ is from Bird, eq. 4.79 scalar sigmaTPQ = - constant::math::pi*dPQ*dPQ - *pow(2.0*CloudType::kb*Tref_/(mR*cR*cR), omegaPQ - 0.5) + math::pi*dPQ*dPQ + *pow(2.0*physicoChemical::k.value()*Tref_/(mR*cR*cR), omegaPQ - 0.5) /exp(Foam::lgamma(2.5 - omegaPQ)); return sigmaTPQ*cR; @@ -253,7 +255,7 @@ void Foam::LarsenBorgnakkeVariableHardSphere::collide scalar sinTheta = sqrt(1.0 - cosTheta*cosTheta); - scalar phi = constant::math::twoPi*rndGen.scalar01(); + scalar phi = math::twoPi*rndGen.scalar01(); vector postCollisionRelU = cR diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C index 8afc892c84..3174445ac6 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C @@ -25,7 +25,9 @@ License \*---------------------------------------------------------------------------*/ #include "VariableHardSphere.H" -#include "mathConstants.H" +#include "constants.H" + +using namespace Foam::constant; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -91,8 +93,8 @@ Foam::scalar Foam::VariableHardSphere::sigmaTcR // calculating cross section = pi*dPQ^2, where dPQ is from Bird, eq. 4.79 scalar sigmaTPQ = - constant::math::pi*dPQ*dPQ - *pow(2.0*CloudType::kb*Tref_/(mR*cR*cR), omegaPQ - 0.5) + math::pi*dPQ*dPQ + *pow(2.0*physicoChemical::k.value()*Tref_/(mR*cR*cR), omegaPQ - 0.5) /exp(Foam::lgamma(2.5 - omegaPQ)); return sigmaTPQ*cR; @@ -126,7 +128,7 @@ void Foam::VariableHardSphere::collide scalar sinTheta = sqrt(1.0 - cosTheta*cosTheta); - scalar phi = constant::math::twoPi*rndGen.scalar01(); + scalar phi = math::twoPi*rndGen.scalar01(); vector postCollisionRelU = cR diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C index 5472e6c237..dded033d73 100644 --- a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C +++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C @@ -25,7 +25,9 @@ License \*---------------------------------------------------------------------------*/ #include "FreeStream.H" -#include "mathConstants.H" +#include "constants.H" + +using namespace Foam::constant; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -131,7 +133,7 @@ void Foam::FreeStream::inflow() Random& rndGen(cloud.rndGen()); - scalar sqrtPi = sqrt(constant::math::pi); + scalar sqrtPi = sqrt(math::pi); label particlesInserted = 0; @@ -370,7 +372,7 @@ void Foam::FreeStream::inflow() } while (P < rndGen.scalar01()); vector U = - sqrt(CloudType::kb*faceTemperature/mass) + sqrt(physicoChemical::k.value()*faceTemperature/mass) *( rndGen.GaussNormal()*t1 + rndGen.GaussNormal()*t2 diff --git a/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.C b/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.C index e7213561c0..569e9b21e6 100644 --- a/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.C +++ b/src/lagrangian/dsmc/submodels/WallInteractionModel/MaxwellianThermal/MaxwellianThermal.C @@ -25,6 +25,9 @@ License \*---------------------------------------------------------------------------*/ #include "MaxwellianThermal.H" +#include "constants.H" + +using namespace Foam::constant; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -108,7 +111,7 @@ void Foam::MaxwellianThermal::correct scalar iDof = cloud.constProps(typeId).internalDegreesOfFreedom(); U = - sqrt(CloudType::kb*T/mass) + sqrt(physicoChemical::k.value()*T/mass) *( rndGen.GaussNormal()*tw1 + rndGen.GaussNormal()*tw2 diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index 7911383146..270bc40e2e 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -18,13 +18,6 @@ $(BASECLOUDS)/reactingCloud/reactingCloud.C $(BASECLOUDS)/reactingMultiphaseCloud/reactingMultiphaseCloud.C -/* Cloud container/injection mechanisms */ -$(DERIVEDCLOUDS)/basicKinematicCloud/basicKinematicCloud.C -$(DERIVEDCLOUDS)/basicThermoCloud/basicThermoCloud.C -$(DERIVEDCLOUDS)/BasicReactingCloud/defineBasicReactingCloud.C -$(DERIVEDCLOUDS)/BasicReactingMultiphaseCloud/defineBasicReactingMultiphaseCloud.C - - /* kinematic parcel sub-models */ KINEMATICPARCEL=$(DERIVEDPARCELS)/basicKinematicParcel $(KINEMATICPARCEL)/basicKinematicParcel.C diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 650cb7ddcb..f034fbbaa3 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -43,7 +43,8 @@ Foam::KinematicCloud::KinematicCloud const volScalarField& rho, const volVectorField& U, const volScalarField& mu, - const dimensionedVector& g + const dimensionedVector& g, + bool readFields ) : Cloud(rho.mesh(), cloudName, false), @@ -136,7 +137,12 @@ Foam::KinematicCloud::KinematicCloud mesh_, dimensionedVector("zero", dimMass*dimVelocity, vector::zero) ) -{} +{ + if (readFields) + { + ParcelType::readFields(*this); + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index ee2b3bafe2..4d5295b08d 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -204,7 +204,8 @@ public: const volScalarField& rho, const volVectorField& U, const volScalarField& mu, - const dimensionedVector& g + const dimensionedVector& g, + bool readFields = true ); diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index 1e58d2876c..6f4b4bc763 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -67,10 +67,11 @@ Foam::ReactingCloud::ReactingCloud const volScalarField& rho, const volVectorField& U, const dimensionedVector& g, - basicThermo& thermo + basicThermo& thermo, + bool readFields ) : - ThermoCloud(cloudName, rho, U, g, thermo), + ThermoCloud(cloudName, rho, U, g, thermo, false), reactingCloud(), constProps_(this->particleProperties()), mcCarrierThermo_ @@ -118,6 +119,11 @@ Foam::ReactingCloud::ReactingCloud ) ); } + + if (readFields) + { + ParcelType::readFields(*this); + } } diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H index 74b75ea416..23f579649a 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.H @@ -152,7 +152,8 @@ public: const volScalarField& rho, const volVectorField& U, const dimensionedVector& g, - basicThermo& thermo + basicThermo& thermo, + bool readFields = true ); diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C index 5e7dee64bc..e81aa2ee8d 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.C @@ -38,10 +38,11 @@ Foam::ReactingMultiphaseCloud::ReactingMultiphaseCloud const volScalarField& rho, const volVectorField& U, const dimensionedVector& g, - basicThermo& thermo + basicThermo& thermo, + bool readFields ) : - ReactingCloud(cloudName, rho, U, g, thermo), + ReactingCloud(cloudName, rho, U, g, thermo, false), reactingMultiphaseCloud(), constProps_(this->particleProperties()), devolatilisationModel_ @@ -61,7 +62,12 @@ Foam::ReactingMultiphaseCloud::ReactingMultiphaseCloud ) ), dMassDevolatilisation_(0.0) -{} +{ + if (readFields) + { + ParcelType::readFields(*this); + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H index b073308407..61dcdf6679 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingMultiphaseCloud/ReactingMultiphaseCloud.H @@ -134,7 +134,8 @@ public: const volScalarField& rho, const volVectorField& U, const dimensionedVector& g, - basicThermo& thermo + basicThermo& thermo, + bool readFields = true ); diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C index 0585629246..48ef62ee19 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.C @@ -39,7 +39,8 @@ Foam::ThermoCloud::ThermoCloud const volScalarField& rho, const volVectorField& U, const dimensionedVector& g, - basicThermo& thermo + basicThermo& thermo, + bool readFields ) : KinematicCloud @@ -48,7 +49,8 @@ Foam::ThermoCloud::ThermoCloud rho, U, thermo.mu(), - g + g, + false ), thermoCloud(), constProps_(this->particleProperties()), @@ -98,7 +100,12 @@ Foam::ThermoCloud::ThermoCloud this->mesh(), dimensionedScalar("zero", dimensionSet(1, 2, -2, 0, 0), 0.0) ) -{} +{ + if (readFields) + { + ParcelType::readFields(*this); + } +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H index 151b076411..793a563f5b 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloud.H @@ -140,7 +140,8 @@ public: const volScalarField& rho, const volVectorField& U, const dimensionedVector& g, - basicThermo& thermo + basicThermo& thermo, + bool readFields = true ); diff --git a/src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/BasicReactingCloud.C b/src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/BasicReactingCloud.C deleted file mode 100644 index e59ca18ecf..0000000000 --- a/src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/BasicReactingCloud.C +++ /dev/null @@ -1,70 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-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 "BasicReactingCloud.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::BasicReactingCloud::BasicReactingCloud -( - const word& cloudName, - const volScalarField& rho, - const volVectorField& U, - const dimensionedVector& g, - basicThermo& thermo -) -: - ReactingCloud > - ( - cloudName, - rho, - U, - g, - thermo - ) -{ - BasicReactingParcel::readFields(*this); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::BasicReactingCloud::~BasicReactingCloud() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::BasicReactingCloud::writeFields() const -{ - BasicReactingParcel::writeFields(*this); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/BasicReactingCloud.H b/src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/BasicReactingCloud.H index 0dea7344a6..7c737d1c62 100644 --- a/src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/BasicReactingCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/BasicReactingCloud.H @@ -38,73 +38,21 @@ SourceFiles #include "ReactingCloud.H" #include "BasicReactingParcel.H" +#include "thermoPhysicsTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { + typedef ReactingCloud > + constThermoReactingCloud; -// Forward declaration of classes -template -class BasicReactingCloud; + typedef ReactingCloud > + thermoReactingCloud; -/*---------------------------------------------------------------------------*\ - Class BasicReactingCloud Declaration -\*---------------------------------------------------------------------------*/ - -template -class BasicReactingCloud -: - public ReactingCloud > -{ - // Private Member Functions - - //- Disallow default bitwise copy construct - BasicReactingCloud(const BasicReactingCloud&); - - //- Disallow default bitwise assignment - void operator=(const BasicReactingCloud&); - - -public: - - //- Runtime type information - TypeName("BasicReactingCloud"); - - - // Constructors - - //- Construct given carrier gas fields - BasicReactingCloud - ( - const word& cloudName, - const volScalarField& rho, - const volVectorField& U, - const dimensionedVector& g, - basicThermo& thermo - ); - - - //- Destructor - ~BasicReactingCloud(); - - - // Member Functions - - //- Write fields - virtual void writeFields() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository - #include "BasicReactingCloud.C" -#endif + typedef ReactingCloud > + icoPoly8ThermoReactingCloud; +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/defineBasicReactingCloud.C b/src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/defineBasicReactingCloud.C deleted file mode 100644 index ca5b9e8090..0000000000 --- a/src/lagrangian/intermediate/clouds/derived/BasicReactingCloud/defineBasicReactingCloud.C +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-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 "createReactingCloudTypes.H" -#include "BasicReactingCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - createReactingCloudType(BasicReactingCloud); -}; - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.C deleted file mode 100644 index 6f08db2016..0000000000 --- a/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.C +++ /dev/null @@ -1,70 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-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 "BasicReactingMultiphaseCloud.H" - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::BasicReactingMultiphaseCloud::BasicReactingMultiphaseCloud -( - const word& cloudName, - const volScalarField& rho, - const volVectorField& U, - const dimensionedVector& g, - basicThermo& thermo -) -: - ReactingMultiphaseCloud > - ( - cloudName, - rho, - U, - g, - thermo - ) -{ - BasicReactingMultiphaseParcel::readFields(*this); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::BasicReactingMultiphaseCloud::~BasicReactingMultiphaseCloud() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::BasicReactingMultiphaseCloud::writeFields() const -{ - BasicReactingMultiphaseParcel::writeFields(*this); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.H b/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.H index 11b6fb2378..f02475a316 100644 --- a/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/BasicReactingMultiphaseCloud.H @@ -26,10 +26,8 @@ Class Foam::BasicReactingMultiphaseCloud Description - Reacting multiphase cloud templated on the type of carrier phase thermodynamics - -SourceFiles - BasicReactingMultiphaseCloud.C + Reacting multiphase cloud templated on the type of carrier phase + thermodynamics \*---------------------------------------------------------------------------*/ @@ -38,73 +36,21 @@ SourceFiles #include "ReactingMultiphaseCloud.H" #include "BasicReactingMultiphaseParcel.H" +#include "thermoPhysicsTypes.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { + typedef ReactingMultiphaseCloud > + constThermoReactingMultiphaseCloud; -// Forward declaration of classes -template -class BasicReactingMultiphaseCloud; + typedef ReactingMultiphaseCloud > + thermoReactingMultiphaseCloud; -/*---------------------------------------------------------------------------*\ - Class BasicReactingMultiphaseCloud Declaration -\*---------------------------------------------------------------------------*/ - -template -class BasicReactingMultiphaseCloud -: - public ReactingMultiphaseCloud > -{ - // Private Member Functions - - //- Disallow default bitwise copy construct - BasicReactingMultiphaseCloud(const BasicReactingMultiphaseCloud&); - - //- Disallow default bitwise assignment - void operator=(const BasicReactingMultiphaseCloud&); - - -public: - - //- Runtime type information - TypeName("BasicReactingMultiphaseCloud"); - - - // Constructors - - //- Construct given carrier gas fields - BasicReactingMultiphaseCloud - ( - const word& cloudName, - const volScalarField& rho, - const volVectorField& U, - const dimensionedVector& g, - basicThermo& thermo - ); - - - //- Destructor - ~BasicReactingMultiphaseCloud(); - - - // Member Functions - - //- Write fields - virtual void writeFields() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository - #include "BasicReactingMultiphaseCloud.C" -#endif + typedef ReactingMultiphaseCloud > + icoPoly8ThermoReactingMultiphaseCloud; +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/defineBasicReactingMultiphaseCloud.C b/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/defineBasicReactingMultiphaseCloud.C deleted file mode 100644 index d23115997d..0000000000 --- a/src/lagrangian/intermediate/clouds/derived/BasicReactingMultiphaseCloud/defineBasicReactingMultiphaseCloud.C +++ /dev/null @@ -1,38 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-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 "createReactingCloudTypes.H" -#include "BasicReactingMultiphaseCloud.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - createReactingCloudType(BasicReactingMultiphaseCloud); -}; - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.C b/src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.C deleted file mode 100644 index 15ab7afdfc..0000000000 --- a/src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.C +++ /dev/null @@ -1,68 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-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 "basicKinematicCloud.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(basicKinematicCloud, 0); -}; - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::basicKinematicCloud::basicKinematicCloud -( - const word& cloudName, - const volScalarField& rho, - const volVectorField& U, - const volScalarField& mu, - const dimensionedVector& g -) -: - KinematicCloud(cloudName, rho, U, mu, g) -{ - basicKinematicParcel::readFields(*this); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::basicKinematicCloud::~basicKinematicCloud() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::basicKinematicCloud::writeFields() const -{ - basicKinematicParcel::writeFields(*this); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.H b/src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.H index 9b2c6003d3..3a277e415a 100644 --- a/src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/basicKinematicCloud/basicKinematicCloud.H @@ -43,56 +43,8 @@ SourceFiles namespace Foam { - -/*---------------------------------------------------------------------------*\ - Class basicKinematicCloud Declaration -\*---------------------------------------------------------------------------*/ - -class basicKinematicCloud -: - public KinematicCloud -{ - // Private member functions - - //- Disallow default bitwise copy construct - basicKinematicCloud(const basicKinematicCloud&); - - //- Disallow default bitwise assignment - void operator=(const basicKinematicCloud&); - - -public: - - //- Runtime type information - TypeName("basicKinematicCloud"); - - - // Constructors - - //- Construct from components - basicKinematicCloud - ( - const word& cloudName, - const volScalarField& rho, - const volVectorField& U, - const volScalarField& mu, - const dimensionedVector& g - ); - - - //- Destructor - ~basicKinematicCloud(); - - - // Member functions - - //- Write fields - virtual void writeFields() const; -}; - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + typedef KinematicCloud basicKinematicCloud; +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.C b/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.C deleted file mode 100644 index fc7ee7dc26..0000000000 --- a/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.C +++ /dev/null @@ -1,68 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-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 "basicThermoCloud.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(basicThermoCloud, 0); -}; - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::basicThermoCloud::basicThermoCloud -( - const word& cloudName, - const volScalarField& rho, - const volVectorField& U, - const dimensionedVector& g, - basicThermo& thermo -) -: - ThermoCloud(cloudName, rho, U, g, thermo) -{ - basicThermoParcel::readFields(*this); -} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::basicThermoCloud::~basicThermoCloud() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::basicThermoCloud::writeFields() const -{ - basicThermoParcel::writeFields(*this); -} - - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H b/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H index cbe3695d5d..c8ce18494f 100644 --- a/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H @@ -43,60 +43,8 @@ SourceFiles namespace Foam { - -/*---------------------------------------------------------------------------*\ - Class basicThermoCloud Declaration -\*---------------------------------------------------------------------------*/ - -class basicThermoCloud -: - public ThermoCloud -{ - // Private Member Functions - - //- Disallow default bitwise copy construct - basicThermoCloud - ( - const basicThermoCloud& - ); - - //- Disallow default bitwise assignment - void operator=(const basicThermoCloud&); - - -public: - - //- Runtime type information - TypeName("basicThermoCloud"); - - - // Constructors - - //- Construct given carrier gas fields - basicThermoCloud - ( - const word& cloudName, - const volScalarField& rho, - const volVectorField& U, - const dimensionedVector& g, - basicThermo& thermo - ); - - - //- Destructor - ~basicThermoCloud(); - - - // Member Functions - - //- Write fields - virtual void writeFields() const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam + typedef ThermoCloud basicThermoCloud; +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/clouds/include/createReactingCloudTypes.H b/src/lagrangian/intermediate/clouds/include/createReactingCloudTypes.H deleted file mode 100644 index 14f439e285..0000000000 --- a/src/lagrangian/intermediate/clouds/include/createReactingCloudTypes.H +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-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 - -\*---------------------------------------------------------------------------*/ - -#ifndef createReactingCloudTypes_H -#define createReactingCloudTypes_H - -#include "thermoPhysicsTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define createReactingCloudType(CloudType) \ - \ - createReactingCloudThermoType(CloudType, constGasThermoPhysics); \ - createReactingCloudThermoType(CloudType, gasThermoPhysics); \ - createReactingCloudThermoType(CloudType, icoPoly8ThermoPhysics); - - -#define createReactingCloudThermoType(CloudType, ThermoType) \ - \ - defineTemplateTypeNameAndDebug(CloudType, 0); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H index 973c97a2d8..b09cac4790 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H @@ -520,10 +520,10 @@ public: // I-O //- Read - static void readFields(KinematicCloud& c); + static void readFields(Cloud& c); //- Write - static void writeFields(const KinematicCloud& c); + static void writeFields(const Cloud& c); // Ostream Operator diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C index c69199cfb7..637de03109 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelIO.C @@ -103,10 +103,7 @@ Foam::KinematicParcel::KinematicParcel template -void Foam::KinematicParcel::readFields -( - KinematicCloud& c -) +void Foam::KinematicParcel::readFields(Cloud& c) { if (!c.size()) { @@ -153,10 +150,7 @@ void Foam::KinematicParcel::readFields template -void Foam::KinematicParcel::writeFields -( - const KinematicCloud& c -) +void Foam::KinematicParcel::writeFields(const Cloud& c) { Particle::writeFields(c); diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H index fabe2f6136..1bc1ee99d7 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H @@ -399,13 +399,10 @@ public: // I-O //- Read - static void readFields(ReactingMultiphaseCloud& c); + static void readFields(Cloud& c); //- Write - static void writeFields - ( - const ReactingMultiphaseCloud& c - ); + static void writeFields(const Cloud& c); // Ostream Operator diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C index 512f21e953..04747d9420 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C @@ -94,14 +94,17 @@ Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel template void Foam::ReactingMultiphaseParcel::readFields ( - ReactingMultiphaseCloud& c + Cloud& cIn ) { - if (!c.size()) + if (!cIn.size()) { return; } + ReactingMultiphaseCloud& c = + dynamic_cast&>(cIn); + ReactingParcel::readFields(c); // Get names and sizes for each Y... @@ -185,9 +188,12 @@ void Foam::ReactingMultiphaseParcel::readFields template void Foam::ReactingMultiphaseParcel::writeFields ( - const ReactingMultiphaseCloud& c + const Cloud& cIn ) { + const ReactingMultiphaseCloud& c = + dynamic_cast&>(cIn); + ReactingParcel::writeFields(c); label np = c.size(); diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index c3910a46ab..8219ec2ac7 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -348,10 +348,10 @@ public: // I-O //- Read - static void readFields(ReactingCloud& c); + static void readFields(Cloud& c); //- Write - static void writeFields(const ReactingCloud& c); + static void writeFields(const Cloud& c); // Ostream Operator diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C index d6591ee050..f8bfbf24f7 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcelIO.C @@ -88,16 +88,16 @@ Foam::ReactingParcel::ReactingParcel template -void Foam::ReactingParcel::readFields -( - ReactingCloud& c -) +void Foam::ReactingParcel::readFields(Cloud& cIn) { - if (!c.size()) + if (!cIn.size()) { return; } + ReactingCloud& c = + dynamic_cast&>(cIn); + ThermoParcel::readFields(c); IOField mass0(c.fieldIOobject("mass0", IOobject::MUST_READ)); @@ -152,9 +152,12 @@ void Foam::ReactingParcel::readFields template void Foam::ReactingParcel::writeFields ( - const ReactingCloud& c + const Cloud& cIn ) { + const ReactingCloud& c = + dynamic_cast&>(cIn); + ThermoParcel::writeFields(c); const label np = c.size(); diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H index f0e728bc1f..4bcdc43707 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.H @@ -359,10 +359,10 @@ public: // I-O //- Read - static void readFields(ThermoCloud& c); + static void readFields(Cloud& c); //- Write - static void writeFields(const ThermoCloud& c); + static void writeFields(const Cloud& c); // Ostream Operator diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C index 827b2f36f4..b0a075af06 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcelIO.C @@ -79,10 +79,7 @@ Foam::ThermoParcel::ThermoParcel template -void Foam::ThermoParcel::readFields -( - ThermoCloud& c -) +void Foam::ThermoParcel::readFields(Cloud& c) { if (!c.size()) { @@ -111,10 +108,7 @@ void Foam::ThermoParcel::readFields template -void Foam::ThermoParcel::writeFields -( - const ThermoCloud& c -) +void Foam::ThermoParcel::writeFields(const Cloud& c) { KinematicParcel::writeFields(c); diff --git a/src/lagrangian/molecularDynamics/molecule/mdTools/temperatureAndPressure.H b/src/lagrangian/molecularDynamics/molecule/mdTools/temperatureAndPressure.H index 788763b163..34dd65156a 100644 --- a/src/lagrangian/molecularDynamics/molecule/mdTools/temperatureAndPressure.H +++ b/src/lagrangian/molecularDynamics/molecule/mdTools/temperatureAndPressure.H @@ -57,7 +57,7 @@ if (runTime.outputTime()) averageTemperature = ( - 2.0/(moleculeCloud::kb * accumulatedDOFs) + 2.0/(physicoChemical::k.value()*accumulatedDOFs) * ( accumulatedTotalLinearKE + accumulatedTotalAngularKE @@ -70,10 +70,8 @@ if (runTime.outputTime()) ( ( (accumulatedNMols/nAveragingSteps) - * - moleculeCloud::kb * averageTemperature - + - accumulatedTotalrDotfSum/(6.0 * nAveragingSteps) + *physicoChemical::k.value()*averageTemperature + + accumulatedTotalrDotfSum/(6.0*nAveragingSteps) ) / meshVolume diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H index ef2de145c4..990c4af6be 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H +++ b/src/lagrangian/molecularDynamics/molecule/molecule/molecule.H @@ -382,9 +382,12 @@ public: int& ); - static void readFields(moleculeCloud& mC); - static void writeFields(const moleculeCloud& mC); + // I-O + + static void readFields(Cloud& mC); + + static void writeFields(const Cloud& mC); // IOstream Operators diff --git a/src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C b/src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C index fa2e239304..fb732c77f1 100644 --- a/src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C +++ b/src/lagrangian/molecularDynamics/molecule/molecule/moleculeIO.C @@ -98,7 +98,7 @@ Foam::molecule::molecule } -void Foam::molecule::readFields(moleculeCloud& mC) +void Foam::molecule::readFields(Cloud& mC) { if (!mC.size()) { @@ -150,7 +150,7 @@ void Foam::molecule::readFields(moleculeCloud& mC) } -void Foam::molecule::writeFields(const moleculeCloud& mC) +void Foam::molecule::writeFields(const Cloud& mC) { Particle::writeFields(mC); @@ -241,9 +241,10 @@ void Foam::molecule::writeFields(const moleculeCloud& mC) orientation2.write(); orientation3.write(); - mC.writeXYZ + const moleculeCloud& m = dynamic_cast(mC); + m.writeXYZ ( - mC.mesh().time().timePath() + "/lagrangian" + "/moleculeCloud.xmol" + m.mesh().time().timePath() + "/lagrangian" + "/moleculeCloud.xmol" ); } diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C index 40ebfba487..d51e92f453 100644 --- a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C @@ -28,6 +28,8 @@ License #include "fvMesh.H" #include "mathConstants.H" +using namespace Foam::constant; + // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam @@ -36,13 +38,6 @@ namespace Foam defineTemplateTypeNameAndDebug(Cloud, 0); }; -Foam::scalar Foam::moleculeCloud::kb = 1.380650277e-23; - -Foam::scalar Foam::moleculeCloud::elementaryCharge = 1.602176487e-19; - -Foam::scalar Foam::moleculeCloud::vacuumPermittivity = 8.854187817e-12; - - // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // void Foam::moleculeCloud::buildConstProps() @@ -103,9 +98,7 @@ void Foam::moleculeCloud::buildConstProps() void Foam::moleculeCloud::setSiteSizesAndPositions() { - iterator mol(this->begin()); - - for (mol = this->begin(); mol != this->end(); ++mol) + forAllIter(moleculeCloud, *this, mol) { const molecule::constantProperties& cP = constProps(mol().id()); @@ -123,14 +116,7 @@ void Foam::moleculeCloud::buildCellOccupancy() cellOccupancy_[cO].clear(); } - iterator mol(this->begin()); - - for - ( - mol = this->begin(); - mol != this->end(); - ++mol - ) + forAllIter(moleculeCloud, *this, mol) { cellOccupancy_[mol().cell()].append(&mol()); } @@ -225,9 +211,7 @@ void Foam::moleculeCloud::calculateTetherForce() { const tetherPotentialList& tetherPot(pot_.tetherPotentials()); - iterator mol(this->begin()); - - for (mol = this->begin(); mol != this->end(); ++mol) + forAllIter(moleculeCloud, *this, mol) { if (mol().tethered()) { @@ -252,9 +236,7 @@ void Foam::moleculeCloud::calculateTetherForce() void Foam::moleculeCloud::calculateExternalForce() { - iterator mol(this->begin()); - - for (mol = this->begin(); mol != this->end(); ++mol) + forAllIter(moleculeCloud, *this, mol) { mol().a() += pot_.gravity(); } @@ -624,11 +606,11 @@ void Foam::moleculeCloud::initialiseMolecules zoneDict.lookup("orientationAngles") ); - scalar phi(orientationAngles.x()*constant::math::pi/180.0); + scalar phi(orientationAngles.x()*math::pi/180.0); - scalar theta(orientationAngles.y()*constant::math::pi/180.0); + scalar theta(orientationAngles.y()*math::pi/180.0); - scalar psi(orientationAngles.z()*constant::math::pi/180.0); + scalar psi(orientationAngles.z()*math::pi/180.0); const tensor R ( @@ -994,11 +976,11 @@ void Foam::moleculeCloud::createMolecule { pi = equipartitionAngularMomentum(temperature, cP); - scalar phi(rndGen_.scalar01()*constant::math::twoPi); + scalar phi(rndGen_.scalar01()*math::twoPi); - scalar theta(rndGen_.scalar01()*constant::math::twoPi); + scalar theta(rndGen_.scalar01()*math::twoPi); - scalar psi(rndGen_.scalar01()*constant::math::twoPi); + scalar psi(rndGen_.scalar01()*math::twoPi); Q = tensor ( @@ -1039,9 +1021,7 @@ Foam::label Foam::moleculeCloud::nSites() const { label n = 0; - const_iterator mol(this->begin()); - - for (mol = this->begin(); mol != this->end(); ++mol) + forAllConstIter(moleculeCloud, *this, mol) { n += constProps(mol().id()).nSites(); } @@ -1055,7 +1035,8 @@ Foam::label Foam::moleculeCloud::nSites() const Foam::moleculeCloud::moleculeCloud ( const polyMesh& mesh, - const potential& pot + const potential& pot, + bool readFields ) : Cloud(mesh, "moleculeCloud", false), @@ -1066,7 +1047,10 @@ Foam::moleculeCloud::moleculeCloud constPropList_(), rndGen_(clock::getTime()) { - molecule::readFields(*this); + if (readFields) + { + molecule::readFields(*this); + } buildConstProps(); @@ -1082,9 +1066,10 @@ Foam::moleculeCloud::moleculeCloud ( const polyMesh& mesh, const potential& pot, - const IOdictionary& mdInitialiseDict + const IOdictionary& mdInitialiseDict, + bool readFields ) - : +: Cloud(mesh, "moleculeCloud", false), mesh_(mesh), pot_(pot), @@ -1092,7 +1077,10 @@ Foam::moleculeCloud::moleculeCloud constPropList_(), rndGen_(clock::getTime()) { - molecule::readFields(*this); + if (readFields) + { + molecule::readFields(*this); + } clear(); @@ -1126,10 +1114,8 @@ void Foam::moleculeCloud::calculateForce() { buildCellOccupancy(); - iterator mol(this->begin()); - // Set accumulated quantities to zero - for (mol = this->begin(); mol != this->end(); ++mol) + forAllIter(moleculeCloud, *this, mol) { mol().siteForces() = vector::zero; @@ -1166,9 +1152,7 @@ void Foam::moleculeCloud::applyConstraintsAndThermostats << "----------------------------------------" << endl; - iterator mol(this->begin()); - - for (mol = this->begin(); mol != this->end(); ++mol) + forAllIter(moleculeCloud, *this, mol) { mol().v() *= temperatureCorrectionFactor; @@ -1177,21 +1161,13 @@ void Foam::moleculeCloud::applyConstraintsAndThermostats } -void Foam::moleculeCloud::writeFields() const -{ - molecule::writeFields(*this); -} - - void Foam::moleculeCloud::writeXYZ(const fileName& fName) const { OFstream str(fName); str << nSites() << nl << "moleculeCloud site positions in angstroms" << nl; - const_iterator mol(this->begin()); - - for (mol = this->begin(); mol != this->end(); ++mol) + forAllConstIter(moleculeCloud, *this, mol) { const molecule::constantProperties& cP = constProps(mol().id()); diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.H b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.H index 6863227c12..81623e715f 100644 --- a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.H +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.H @@ -156,22 +156,14 @@ private: public: - // Static data members - - static scalar kb; - - static scalar elementaryCharge; - - static scalar vacuumPermittivity; - - // Constructors //- Construct given mesh and potential references moleculeCloud ( const polyMesh& mesh, - const potential& pot + const potential& pot, + bool readFields = true ); //- Construct given mesh, potential and mdInitialiseDict @@ -179,7 +171,8 @@ public: ( const polyMesh& mesh, const potential& pot, - const IOdictionary& mdInitialiseDict + const IOdictionary& mdInitialiseDict, + bool readFields = true ); @@ -217,9 +210,6 @@ public: // Member Operators - //- Write fields - void writeFields() const; - //- Write molecule sites in XYZ format void writeXYZ(const fileName& fName) const; }; diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudI.H b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudI.H index 94c9f49286..fee67cfced 100644 --- a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudI.H +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloudI.H @@ -24,6 +24,10 @@ License \*---------------------------------------------------------------------------*/ +#include "constants.H" + +using namespace Foam::constant; + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // inline void Foam::moleculeCloud::evaluatePair @@ -576,7 +580,7 @@ inline Foam::vector Foam::moleculeCloud::equipartitionLinearVelocity scalar mass ) { - return sqrt(kb*temperature/mass)*vector + return sqrt(physicoChemical::k.value()*temperature/mass)*vector ( rndGen_.GaussNormal(), rndGen_.GaussNormal(), @@ -591,7 +595,7 @@ inline Foam::vector Foam::moleculeCloud::equipartitionAngularMomentum const molecule::constantProperties& cP ) { - scalar sqrtKbT = sqrt(kb*temperature); + scalar sqrtKbT = sqrt(physicoChemical::k.value()*temperature); if (cP.linearMolecule()) { diff --git a/src/lagrangian/solidParticle/solidParticleCloud.C b/src/lagrangian/solidParticle/solidParticleCloud.C index b317f75d94..e17f4efc60 100644 --- a/src/lagrangian/solidParticle/solidParticleCloud.C +++ b/src/lagrangian/solidParticle/solidParticleCloud.C @@ -42,7 +42,8 @@ namespace Foam Foam::solidParticleCloud::solidParticleCloud ( const fvMesh& mesh, - const word& cloudName + const word& cloudName, + bool readFields ) : Cloud(mesh, cloudName, false), @@ -62,7 +63,10 @@ Foam::solidParticleCloud::solidParticleCloud e_(dimensionedScalar(particleProperties_.lookup("e")).value()), mu_(dimensionedScalar(particleProperties_.lookup("mu")).value()) { - solidParticle::readFields(*this); + if (readFields) + { + solidParticle::readFields(*this); + } } @@ -84,10 +88,4 @@ void Foam::solidParticleCloud::move(const dimensionedVector& g) } -void Foam::solidParticleCloud::writeFields() const -{ - solidParticle::writeFields(*this); -} - - // ************************************************************************* // diff --git a/src/lagrangian/solidParticle/solidParticleCloud.H b/src/lagrangian/solidParticle/solidParticleCloud.H index f171007ce3..81675b34cd 100644 --- a/src/lagrangian/solidParticle/solidParticleCloud.H +++ b/src/lagrangian/solidParticle/solidParticleCloud.H @@ -86,7 +86,8 @@ public: solidParticleCloud ( const fvMesh&, - const word& cloudName = "defaultCloud" + const word& cloudName = "defaultCloud", + bool readFields = true ); @@ -106,12 +107,6 @@ public: //- Move the particles under the influence of the given // gravitational acceleration void move(const dimensionedVector& g); - - - // Write - - //- Write fields - virtual void writeFields() const; }; diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C b/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C index 03b5a80288..8754ed2df4 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C +++ b/src/postProcessing/functionObjects/field/streamLine/streamLineParticle.C @@ -387,10 +387,7 @@ void Foam::streamLineParticle::hitPatch {} -void Foam::streamLineParticle::readFields -( - Cloud& c -) +void Foam::streamLineParticle::readFields(Cloud& c) { if (!c.size()) { @@ -426,10 +423,7 @@ void Foam::streamLineParticle::readFields } -void Foam::streamLineParticle::writeFields -( - const Cloud& c -) +void Foam::streamLineParticle::writeFields(const Cloud& c) { Particle::writeFields(c); diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.C b/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.C index 95a92d024a..51f16c91f9 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.C +++ b/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.C @@ -26,15 +26,11 @@ License #include "streamLineParticleCloud.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTemplateTypeNameAndDebug(Cloud, 0); - + defineTemplateTypeNameAndDebug(Cloud, 0); }; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -42,12 +38,16 @@ defineTemplateTypeNameAndDebug(Cloud, 0); Foam::streamLineParticleCloud::streamLineParticleCloud ( const polyMesh& mesh, - const word& cloudName + const word& cloudName, + bool readFields ) : Cloud(mesh, cloudName, false) { - readFields(); + if (readFields) + { + streamLineParticle::readFields(*this); + } } @@ -62,18 +62,4 @@ Foam::streamLineParticleCloud::streamLineParticleCloud {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::streamLineParticleCloud::readFields() -{ - streamLineParticle::readFields(*this); -} - - -void Foam::streamLineParticleCloud::writeFields() const -{ - streamLineParticle::writeFields(*this); -} - - // ************************************************************************* // diff --git a/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.H b/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.H index 40171fca9d..5894124277 100644 --- a/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.H +++ b/src/postProcessing/functionObjects/field/streamLine/streamLineParticleCloud.H @@ -45,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class streamLineCloud Declaration + Class streamLineCloud Declaration \*---------------------------------------------------------------------------*/ class streamLineParticleCloud @@ -72,7 +72,8 @@ public: streamLineParticleCloud ( const polyMesh&, - const word& cloudName = "defaultCloud" + const word& cloudName = "defaultCloud", + bool readFields = true ); //- Construct from mesh, cloud name, and a list of particles @@ -82,15 +83,6 @@ public: const word& cloudName, const IDLList& particles ); - - - // Member Functions - - //- Read fields - virtual void readFields(); - - //- Write fields - virtual void writeFields() const; }; diff --git a/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.C b/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.C index 8957dee17c..eac6499043 100644 --- a/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.C +++ b/src/postProcessing/functionObjects/utilities/dsmcFields/dsmcFields.C @@ -29,6 +29,10 @@ License #include "dictionary.H" #include "dsmcCloud.H" +#include "constants.H" + +using namespace Foam::constant; + // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam @@ -164,7 +168,7 @@ void Foam::dsmcFields::write() obr_, IOobject::NO_READ ), - 2.0/(3.0*dsmcCloud::kb*rhoNMean) + 2.0/(3.0*physicoChemical::k.value()*rhoNMean) *(linearKEMean - 0.5*rhoMMean*(UMean & UMean)) ); @@ -178,7 +182,7 @@ void Foam::dsmcFields::write() obr_, IOobject::NO_READ ), - 2.0/(dsmcCloud::kb*iDofMean)*internalEMean + 2.0/(physicoChemical::k.value()*iDofMean)*internalEMean ); Info<< " Calculating overallT field." << endl; @@ -191,7 +195,7 @@ void Foam::dsmcFields::write() obr_, IOobject::NO_READ ), - 2.0/(dsmcCloud::kb*(3.0*rhoNMean + iDofMean)) + 2.0/(physicoChemical::k.value()*(3.0*rhoNMean + iDofMean)) *(linearKEMean - 0.5*rhoMMean*(UMean & UMean) + internalEMean) ); From 94f5bc6dbfdb3726c9544a32e27c6c491c0fca2c Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 4 Sep 2009 16:23:46 +0100 Subject: [PATCH 10/18] removed unused variable --- src/thermophysicalModels/pdfs/normal/normal.C | 1 - 1 file changed, 1 deletion(-) diff --git a/src/thermophysicalModels/pdfs/normal/normal.C b/src/thermophysicalModels/pdfs/normal/normal.C index 2669f73e91..4a66fc9883 100644 --- a/src/thermophysicalModels/pdfs/normal/normal.C +++ b/src/thermophysicalModels/pdfs/normal/normal.C @@ -87,7 +87,6 @@ Foam::scalar Foam::normal::sample() const scalar x = 0.0; scalar y = 0.0; scalar p = 0.0; - bool success = false; do { From b82e21a81522c0463c6c9e276bf6b25eaa649f30 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 4 Sep 2009 17:49:14 +0100 Subject: [PATCH 11/18] updating IO for (previously missed) clouds --- .../basic/indexedParticle/indexedParticle.H | 2 +- .../indexedParticle/indexedParticleCloud.C | 15 +++++-------- .../indexedParticle/indexedParticleCloud.H | 11 +++------- .../passiveParticle/passiveParticleCloud.C | 22 +++++-------------- .../passiveParticle/passiveParticleCloud.H | 14 +++--------- 5 files changed, 19 insertions(+), 45 deletions(-) diff --git a/src/lagrangian/basic/indexedParticle/indexedParticle.H b/src/lagrangian/basic/indexedParticle/indexedParticle.H index 7023f0ba6d..be2ecd65d9 100644 --- a/src/lagrangian/basic/indexedParticle/indexedParticle.H +++ b/src/lagrangian/basic/indexedParticle/indexedParticle.H @@ -47,7 +47,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class indexedParticle Declaration + Class indexedParticle Declaration \*---------------------------------------------------------------------------*/ class indexedParticle diff --git a/src/lagrangian/basic/indexedParticle/indexedParticleCloud.C b/src/lagrangian/basic/indexedParticle/indexedParticleCloud.C index a9ebc140ec..81ce7e3322 100644 --- a/src/lagrangian/basic/indexedParticle/indexedParticleCloud.C +++ b/src/lagrangian/basic/indexedParticle/indexedParticleCloud.C @@ -45,20 +45,17 @@ defineTemplateTypeNameAndDebug(Cloud, 0); Foam::indexedParticleCloud::indexedParticleCloud ( const polyMesh& mesh, - const word& cloudName + const word& cloudName, + bool readFields ) : Cloud(mesh, cloudName, false) { - indexedParticle::readFields(*this); + if (readFields) + { + indexedParticle::readFields(*this); + } } -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::indexedParticleCloud::writeFields() const -{ - indexedParticle::writeFields(*this); -} - // ************************************************************************* // diff --git a/src/lagrangian/basic/indexedParticle/indexedParticleCloud.H b/src/lagrangian/basic/indexedParticle/indexedParticleCloud.H index 65033e0a9d..0f8f39edbb 100644 --- a/src/lagrangian/basic/indexedParticle/indexedParticleCloud.H +++ b/src/lagrangian/basic/indexedParticle/indexedParticleCloud.H @@ -45,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class indexedParticleCloud Declaration + Class indexedParticleCloud Declaration \*---------------------------------------------------------------------------*/ class indexedParticleCloud @@ -69,14 +69,9 @@ public: indexedParticleCloud ( const polyMesh&, - const word& cloudName = "defaultCloud" + const word& cloudName = "defaultCloud", + bool readFields = true ); - - - // Member Functions - - //- Write fields - virtual void writeFields() const; }; diff --git a/src/lagrangian/basic/passiveParticle/passiveParticleCloud.C b/src/lagrangian/basic/passiveParticle/passiveParticleCloud.C index ebb67d26de..79f937aaa0 100644 --- a/src/lagrangian/basic/passiveParticle/passiveParticleCloud.C +++ b/src/lagrangian/basic/passiveParticle/passiveParticleCloud.C @@ -43,12 +43,16 @@ defineTemplateTypeNameAndDebug(Cloud, 0); Foam::passiveParticleCloud::passiveParticleCloud ( const polyMesh& mesh, - const word& cloudName + const word& cloudName, + bool readFields ) : Cloud(mesh, cloudName, false) { - readFields(); + if (readFields) + { + passiveParticle::readFields(*this); + } } @@ -63,18 +67,4 @@ Foam::passiveParticleCloud::passiveParticleCloud {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::passiveParticleCloud::readFields() -{ - passiveParticle::readFields(*this); -} - - -void Foam::passiveParticleCloud::writeFields() const -{ - passiveParticle::writeFields(*this); -} - - // ************************************************************************* // diff --git a/src/lagrangian/basic/passiveParticle/passiveParticleCloud.H b/src/lagrangian/basic/passiveParticle/passiveParticleCloud.H index e3c0266fa3..1ef383867b 100644 --- a/src/lagrangian/basic/passiveParticle/passiveParticleCloud.H +++ b/src/lagrangian/basic/passiveParticle/passiveParticleCloud.H @@ -45,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class passiveParticleCloud Declaration + Class passiveParticleCloud Declaration \*---------------------------------------------------------------------------*/ class passiveParticleCloud @@ -72,7 +72,8 @@ public: passiveParticleCloud ( const polyMesh&, - const word& cloudName = "defaultCloud" + const word& cloudName = "defaultCloud", + bool readFields = true ); //- Construct from mesh, cloud name, and a list of particles @@ -82,15 +83,6 @@ public: const word& cloudName, const IDLList& particles ); - - - // Member Functions - - //- Read fields - virtual void readFields(); - - //- Write fields - virtual void writeFields() const; }; From 75b0c7d1f8f58292bc8151a02b914f9cbd54be76 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 7 Sep 2009 13:37:58 +0100 Subject: [PATCH 12/18] added wall check for particle lambda calc --- src/lagrangian/basic/Particle/ParticleI.H | 56 +++++++++++++---------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/src/lagrangian/basic/Particle/ParticleI.H b/src/lagrangian/basic/Particle/ParticleI.H index 65ac64e525..2e6d8f868f 100644 --- a/src/lagrangian/basic/Particle/ParticleI.H +++ b/src/lagrangian/basic/Particle/ParticleI.H @@ -25,6 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "polyMesh.H" +#include "wallPolyPatch.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -46,21 +47,25 @@ inline Foam::scalar Foam::Particle::lambda Sf /= mag(Sf); vector Cf = mesh.faceCentres()[facei]; - // move reference point for wall + // patch interaction if (!cloud_.internalFace(facei)) { - const vector& C = mesh.cellCentres()[celli_]; - scalar CCf = mag((C - Cf) & Sf); - // check if distance between cell centre and face centre - // is larger than wallImpactDistance - if - ( - CCf - > static_cast(*this).wallImpactDistance(Sf) - ) + label patchi = patch(facei); + const polyPatch& patch = mesh.boundaryMesh()[patchi]; + + // move reference point for wall + if (isA(patch)) { - Cf -= static_cast(*this) - .wallImpactDistance(Sf)*Sf; + const vector& C = mesh.cellCentres()[celli_]; + scalar CCf = mag((C - Cf) & Sf); + // check if distance between cell centre and face centre + // is larger than wallImpactDistance + const ParticleType& p = + static_cast(*this); + if (CCf > p.wallImpactDistance(Sf)) + { + Cf -=p.wallImpactDistance(Sf)*Sf; + } } } @@ -190,21 +195,24 @@ inline Foam::scalar Foam::Particle::lambda Sf /= mag(Sf); vector Cf = mesh.faceCentres()[facei]; - // move reference point for wall + // patch interaction if (!cloud_.internalFace(facei)) { - const vector& C = mesh.cellCentres()[celli_]; - scalar CCf = mag((C - Cf) & Sf); - // check if distance between cell centre and face centre - // is larger than wallImpactDistance - if - ( - CCf - > static_cast(*this).wallImpactDistance(Sf) - ) + label patchi = patch(facei); + const polyPatch& patch = mesh.boundaryMesh()[patchi]; + + // move reference point for wall + if (isA(patch)) { - Cf -= static_cast(*this) - .wallImpactDistance(Sf)*Sf; + const vector& C = mesh.cellCentres()[celli_]; + scalar CCf = mag((C - Cf) & Sf); + // check if distance between cell centre and face centre + // is larger than wallImpactDistance + const ParticleType& p = static_cast(*this); + if (CCf > p.wallImpactDistance(Sf)) + { + Cf -=p.wallImpactDistance(Sf)*Sf; + } } } From fd35d9d36abbebc92e9d2266e501a8eeef5ede3c Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 7 Sep 2009 16:57:17 +0100 Subject: [PATCH 13/18] more descriptive comment --- src/lagrangian/intermediate/particleForces/particleForces.H | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lagrangian/intermediate/particleForces/particleForces.H b/src/lagrangian/intermediate/particleForces/particleForces.H index fbe88a6dc8..f0be486381 100644 --- a/src/lagrangian/intermediate/particleForces/particleForces.H +++ b/src/lagrangian/intermediate/particleForces/particleForces.H @@ -26,7 +26,8 @@ Class Foam::particleForces Description - Particle forces + Provides a mechanism to calculate particle forces + Note: forces are force per unit mass (accelerations) SourceFiles particleForces.C From 21ba33aad1bfc286fc374b3d499961980f13d344 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 8 Sep 2009 17:37:56 +0100 Subject: [PATCH 14/18] added region option --- .../manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C index e12ab576fd..b1c064a6ee 100644 --- a/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C +++ b/applications/utilities/mesh/manipulation/mergeOrSplitBaffles/mergeOrSplitBaffles.C @@ -222,13 +222,14 @@ labelList findBaffles(const polyMesh& mesh, const labelList& boundaryFaces) int main(int argc, char *argv[]) { +# include "addRegionOption.H" argList::validOptions.insert("split", ""); argList::validOptions.insert("overwrite", ""); argList::validOptions.insert("detectOnly", ""); # include "setRootCase.H" # include "createTime.H" runTime.functionObjects().off(); -# include "createMesh.H" +# include "createNamedMesh.H" const word oldInstance = mesh.pointsInstance(); bool split = args.optionFound("split"); From 0aa0114310b963a901fcb02b1f38e88db3169d24 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 8 Sep 2009 17:39:01 +0100 Subject: [PATCH 15/18] preservePatches option still needed for geometric decomposition options --- .../decomposePar/decomposeParDict | 6 ++++ .../decomposePar/distributeCells.C | 29 +++++++++++++++++++ .../decompositionMethod/decompositionMethod.C | 13 +++++++-- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict index aad15ee459..e1620d7201 100644 --- a/applications/utilities/parallelProcessing/decomposePar/decomposeParDict +++ b/applications/utilities/parallelProcessing/decomposePar/decomposeParDict @@ -22,6 +22,12 @@ numberOfSubdomains 4; //- Keep owner and neighbour on same processor for faces in zones: // preserveFaceZones (heater solid1 solid3); + +//- Keep owner and neighbour on same processor for faces in patches: +// (makes sense only for cyclic patches) +//preservePatches (cyclic_left_right); + + method scotch; // method hierarchical; // method simple; diff --git a/applications/utilities/parallelProcessing/decomposePar/distributeCells.C b/applications/utilities/parallelProcessing/decomposePar/distributeCells.C index af47af244f..ffd54ac685 100644 --- a/applications/utilities/parallelProcessing/decomposePar/distributeCells.C +++ b/applications/utilities/parallelProcessing/decomposePar/distributeCells.C @@ -45,6 +45,35 @@ void domainDecomposition::distributeCells() labelHashSet sameProcFaces; + if (decompositionDict_.found("preservePatches")) + { + wordList pNames(decompositionDict_.lookup("preservePatches")); + + Info<< "Keeping owner of faces in patches " << pNames + << " on same processor. This only makes sense for cyclics." << endl; + + const polyBoundaryMesh& patches = boundaryMesh(); + + forAll(pNames, i) + { + label patchI = patches.findPatchID(pNames[i]); + + if (patchI == -1) + { + FatalErrorIn("domainDecomposition::distributeCells()") + << "Unknown preservePatch " << pNames[i] + << endl << "Valid patches are " << patches.names() + << exit(FatalError); + } + + const polyPatch& pp = patches[patchI]; + + forAll(pp, i) + { + sameProcFaces.insert(pp.start() + i); + } + } + } if (decompositionDict_.found("preserveFaceZones")) { wordList zNames(decompositionDict_.lookup("preserveFaceZones")); diff --git a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C index c38e0494ae..d5c98d52b5 100644 --- a/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C +++ b/src/decompositionMethods/decompositionMethods/decompositionMethod/decompositionMethod.C @@ -141,9 +141,18 @@ Foam::labelList Foam::decompositionMethod::decompose const pointField& coarsePoints ) { - scalarField coarseWeights(0); + // Decompose based on agglomerated points + labelList coarseDistribution(decompose(coarsePoints)); - return decompose(fineToCoarse, coarsePoints, coarseWeights); + // Rework back into decomposition for original mesh_ + labelList fineDistribution(fineToCoarse.size()); + + forAll(fineDistribution, i) + { + fineDistribution[i] = coarseDistribution[fineToCoarse[i]]; + } + + return fineDistribution; } From 9c86fec6e3e31b5d17d928c64ab0e0435f17ee49 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 8 Sep 2009 17:39:47 +0100 Subject: [PATCH 16/18] protect against illegal number of layers --- .../autoHexMeshDriver/autoLayerDriver.C | 48 +++++++++++++------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index 27ca388fe3..3d0274bc33 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -2661,10 +2661,22 @@ void Foam::autoLayerDriver::addLayers { const polyBoundaryMesh& patches = mesh.boundaryMesh(); - Info<< nl - << "patch faces layers avg thickness[m]" << nl - << " near-wall overall" << nl - << "----- ----- ------ --------- -------" << endl; + // Find maximum length of a patch name, for a nicer output + label maxPatchNameLen = 0; + forAll(meshMover.adaptPatchIDs(), i) + { + label patchI = meshMover.adaptPatchIDs()[i]; + word patchName = patches[patchI].name(); + maxPatchNameLen = max(maxPatchNameLen,label(patchName.size())); + } + + Info<< nl + << setf(ios_base::left) << setw(maxPatchNameLen) << "patch" + << setw(0) << " faces layers avg thickness[m]" << nl + << setf(ios_base::left) << setw(maxPatchNameLen) << " " + << setw(0) << " near-wall overall" << nl + << setf(ios_base::left) << setw(maxPatchNameLen) << "-----" + << setw(0) << " ----- ------ --------- -------" << endl; forAll(meshMover.adaptPatchIDs(), i) { @@ -2704,18 +2716,24 @@ void Foam::autoLayerDriver::addLayers label totNPoints = returnReduce(meshPoints.size(), sumOp