From 8c5a73ebbc4e23a8f00ce1e273ba6f33bd118450 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 6 Aug 2012 17:57:29 +0100 Subject: [PATCH 01/26] STYLE: Updated copyright year --- .../singleStepReactingMixture/singleStepReactingMixture.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thermophysicalModels/reactionThermo/mixtures/singleStepReactingMixture/singleStepReactingMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/singleStepReactingMixture/singleStepReactingMixture.C index 69e87fe518..e8cc1da8bc 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/singleStepReactingMixture/singleStepReactingMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/singleStepReactingMixture/singleStepReactingMixture.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License From 0731c4725711195bf1b9bf67bd29e967db09956c Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 8 Aug 2012 10:27:40 +0100 Subject: [PATCH 02/26] ENH: Modifying oppositePanels combustion case --- .../pyrolysisModels/reactingOneDim/reactingOneDim.C | 8 ++++++-- .../oppositeBurningPanels/constant/combustionProperties | 1 + .../les/oppositeBurningPanels/constant/pyrolysisZones | 4 ++-- .../oppositeBurningPanels/constant/radiationProperties | 2 +- .../fireFoam/les/oppositeBurningPanels/system/controlDict | 8 ++++---- .../fireFoam/les/oppositeBurningPanels/system/fvSchemes | 1 + .../oppositeBurningPanels/system/panelRegion/fvSolution | 2 +- 7 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index 84ba7e84cd..2331ec217d 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -110,6 +110,7 @@ void reactingOneDim::updateQr() const volScalarField kappaRad_(kappaRad()); // Propagate Qr through 1-D regions + label totalFaceId = 0; forAll(intCoupledPatchIDs_, i) { const label patchI = intCoupledPatchIDs_[i]; @@ -121,7 +122,7 @@ void reactingOneDim::updateQr() { const scalar Qr0 = Qrp[faceI]; point Cf0 = Cf[faceI]; - const labelList& cells = boundaryFaceCells_[faceI]; + const labelList& cells = boundaryFaceCells_[totalFaceId]; scalar kappaInt = 0.0; forAll(cells, k) { @@ -132,6 +133,7 @@ void reactingOneDim::updateQr() Qr_[cellI] = Qr0*exp(-kappaInt); Cf0 = Cf1; } + totalFaceId ++; } } @@ -156,6 +158,7 @@ void reactingOneDim::updatePhiGas() const volScalarField& HsiGas = tHsiGas(); const volScalarField& RRiGas = tRRiGas(); + label totalFaceId = 0; forAll(intCoupledPatchIDs_, i) { const label patchI = intCoupledPatchIDs_[i]; @@ -164,7 +167,7 @@ void reactingOneDim::updatePhiGas() forAll(phiGasp, faceI) { - const labelList& cells = boundaryFaceCells_[faceI]; + const labelList& cells = boundaryFaceCells_[totalFaceId]; scalar massInt = 0.0; forAllReverse(cells, k) { @@ -185,6 +188,7 @@ void reactingOneDim::updatePhiGas() << " [kg/s] " << endl; } } + totalFaceId ++; } tHsiGas().clear(); } diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/combustionProperties b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/combustionProperties index 355d1e1b36..30c31c7471 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/combustionProperties +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/combustionProperties @@ -22,6 +22,7 @@ active true; infinitelyFastChemistryCoeffs { C 10; + semiImplicit false; } // ************************************************************************* // diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones index 6253de1741..1895f851df 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/pyrolysisZones @@ -31,9 +31,9 @@ FoamFile radFluxName Qr; - minimumDelta 1e-8; + minimumDelta 1e-12; - reactionDeltaMin 1e-8; + reactionDeltaMin 1e-12; moveMesh false; } diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties index ca98125036..df24e86f8d 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/radiationProperties @@ -33,7 +33,7 @@ fvDOMCoeffs nPhi 3; // azimuthal angles in PI/2 on X-Y.(from Y to X) nTheta 6; // polar angles in PI (from Z to X-Y plane) convergence 1e-4; // convergence criteria for radiation iteration - maxIter 4; // maximum number of iterations + maxIter 2; // maximum number of iterations } // Number of flow iterations per radiation iteration diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/controlDict b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/controlDict index 53c9826a9b..fb42599578 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/controlDict +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/controlDict @@ -16,25 +16,25 @@ FoamFile application fireFoam; -startFrom startTime; +startFrom latestTime; startTime 0; stopAt endTime; -endTime 15.0; +endTime 15; deltaT 0.03; writeControl adjustableRunTime; -writeInterval 0.5; +writeInterval 1 purgeWrite 0; writeFormat ascii; -writePrecision 6; +writePrecision 12; writeCompression off; diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/fvSchemes b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/fvSchemes index 9911bbedb3..e683569e7a 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/fvSchemes +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/fvSchemes @@ -70,6 +70,7 @@ fluxRequired { default no; p_rgh; + phiMesh; } diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSolution b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSolution index e1d5b8db0b..f485444f2e 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSolution +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/system/panelRegion/fvSolution @@ -32,7 +32,7 @@ solvers relTol 0; } - rhoThermo + rho { solver PCG; preconditioner DIC; From f26e16a9fa9764b11ba7ca8d027fc0c204da188b Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 8 Aug 2012 12:44:06 +0100 Subject: [PATCH 03/26] BUG: Deleting undefined function --- .../sampledSurface/sampledSurfaces/sampledSurfaces.C | 1 - .../sampledSurface/sampledSurfaces/sampledSurfaces.H | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index 5fedecbd56..778d33871c 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -188,7 +188,6 @@ void Foam::sampledSurfaces::read(const dictionary& dict) if (surfacesFound) { dict.lookup("fields") >> fieldSelection_; - clearFieldGroups(); dict.lookup("interpolationScheme") >> interpolationScheme_; const word writeType(dict.lookup("surfaceFormat")); diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H index ff676d1f99..ebff3bd94d 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H @@ -127,13 +127,8 @@ class sampledSurfaces // Private Member Functions - //- Clear old field groups - void clearFieldGroups(); - //- Append fieldName to the appropriate group - label appendFieldGroup(const word& fieldName, const word& fieldType); - - //- Classify field types, returns the number of fields + //- Return number of fields label classifyFields(); //- Write geometry only From a59fbe8f1e56934436acfd9b86e123d28a024d4c Mon Sep 17 00:00:00 2001 From: sergio Date: Wed, 8 Aug 2012 17:22:08 +0100 Subject: [PATCH 04/26] BUG: bug in reactingOneDim.C for updating gas phi --- .../pyrolysisModels/reactingOneDim/reactingOneDim.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index 2331ec217d..d20552f368 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -187,8 +187,8 @@ void reactingOneDim::updatePhiGas() << " is : " << massInt << " [kg/s] " << endl; } + totalFaceId ++; } - totalFaceId ++; } tHsiGas().clear(); } From baf3fe8c2c71b20a8156cf6bbaf49ee007ea30d4 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 9 Aug 2012 14:30:48 +0100 Subject: [PATCH 05/26] ENH: Enabled strict type check on lookupClass --- .../db/objectRegistry/objectRegistry.H | 2 +- .../objectRegistry/objectRegistryTemplates.C | 21 +++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H index 48cabcc1cf..14306e41fb 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.H @@ -157,7 +157,7 @@ public: //- Lookup and return all objects of the given Type template - HashTable lookupClass() const; + HashTable lookupClass(const bool strict = false) const; //- Is the named Type found? template diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C index eb7b8fab63..922d630de7 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,8 +29,7 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -Foam::wordList -Foam::objectRegistry::names() const +Foam::wordList Foam::objectRegistry::names() const { wordList objectNames(size()); @@ -50,14 +49,24 @@ Foam::objectRegistry::names() const template -Foam::HashTable -Foam::objectRegistry::lookupClass() const +Foam::HashTable Foam::objectRegistry::lookupClass +( + const bool strict +) const { HashTable objectsOfClass(size()); for (const_iterator iter = begin(); iter != end(); ++iter) { - if (isA(*iter())) + if (strict && isType(*iter())) + { + objectsOfClass.insert + ( + iter()->name(), + dynamic_cast(iter()) + ); + } + else if (isA(*iter())) { objectsOfClass.insert ( From 6082a72bb3a23ebd909a5f981b102fcccfa27173 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 9 Aug 2012 14:32:40 +0100 Subject: [PATCH 06/26] ENH: Added mapping support for DimensionedFields --- .../DimensionedField/MapDimensionedFields.H | 87 +++++++++++++++++++ src/finiteVolume/fvMesh/fvMesh.C | 9 +- .../mapping/fvFieldMappers/MapFvFields.H | 3 +- 3 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H new file mode 100644 index 0000000000..6520eaec2f --- /dev/null +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Description + Generic internal field mapper for dimensioned fields. For "real" mapping, + add template specialisations for mapping of internal fields depending on + mesh type. + +\*---------------------------------------------------------------------------*/ + +#ifndef MapDimensionedFields_H +#define MapDimensionedFields_H + +#include "polyMesh.H" +#include "MapFvVolField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template +void MapDimensionedFields(const MeshMapper& mapper) +{ + typedef DimensionedField FieldType; + typedef HashTable TableType; + + TableType fields + ( + mapper.thisDb().objectRegistry::template lookupClass(true) + ); + + forAllConstIter(typename TableType, fields, fieldIter) + { + FieldType& field = const_cast(*fieldIter()); + + if (&field.mesh() == &mapper.mesh()) + { + if (polyMesh::debug) + { + Info<< "Mapping " << field.typeName << ' ' << field.name() + << endl; + } + + MapInternalField()(field, mapper); + + field.instance() = field.time().timeName(); + } + else if (polyMesh::debug) + { + Info<< "Not mapping " << field.typeName << ' ' << field.name() + << " since originating mesh differs from that of mapper." + << endl; + } + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/finiteVolume/fvMesh/fvMesh.C b/src/finiteVolume/fvMesh/fvMesh.C index 0889270894..95ff899be9 100644 --- a/src/finiteVolume/fvMesh/fvMesh.C +++ b/src/finiteVolume/fvMesh/fvMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -494,6 +494,13 @@ void Foam::fvMesh::mapFields(const mapPolyMesh& meshMap) MapGeometricFields (mapper); + // Map all the dimensionedFields in the objectRegistry + MapDimensionedFields(mapper); + MapDimensionedFields(mapper); + MapDimensionedFields(mapper); + MapDimensionedFields(mapper); + MapDimensionedFields(mapper); + // Map all the clouds in the objectRegistry mapClouds(*this, meshMap); diff --git a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvFields.H b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvFields.H index 3f719f18bf..8ae0910b1a 100644 --- a/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvFields.H +++ b/src/finiteVolume/interpolation/mapping/fvFieldMappers/MapFvFields.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,7 @@ Description #include "MapGeometricFields.H" #include "MapFvSurfaceField.H" #include "MapFvVolField.H" +#include "MapDimensionedFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // From bfafc1d73b5484035fe4535d1759f293ad4e3354 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 9 Aug 2012 14:57:24 +0100 Subject: [PATCH 07/26] STYLE: consistent naming for cloud source fields --- .../clouds/Templates/KinematicCloud/KinematicCloud.C | 8 ++++---- .../clouds/Templates/KinematicCloud/KinematicCloudI.H | 6 +++--- .../clouds/Templates/ReactingCloud/ReactingCloud.C | 4 ++-- .../clouds/Templates/ReactingCloud/ReactingCloudI.H | 10 +++++----- .../clouds/Templates/ThermoCloud/ThermoCloudI.H | 6 +++--- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 3ca019fa4e..ef332fa673 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -346,7 +346,7 @@ Foam::KinematicCloud::KinematicCloud ( IOobject ( - this->name() + "UTrans", + this->name() + "::UTrans", this->db().time().timeName(), this->db(), IOobject::READ_IF_PRESENT, @@ -362,7 +362,7 @@ Foam::KinematicCloud::KinematicCloud ( IOobject ( - this->name() + "UCoeff", + this->name() + "::UCoeff", this->db().time().timeName(), this->db(), IOobject::READ_IF_PRESENT, @@ -426,7 +426,7 @@ Foam::KinematicCloud::KinematicCloud ( IOobject ( - this->name() + "UTrans", + this->name() + "::UTrans", this->db().time().timeName(), this->db(), IOobject::NO_READ, @@ -442,7 +442,7 @@ Foam::KinematicCloud::KinematicCloud ( IOobject ( - name + "UCoeff", + name + "::UCoeff", this->db().time().timeName(), this->db(), IOobject::NO_READ, diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 106ff158a7..a6bdf47cc4 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -539,7 +539,7 @@ Foam::KinematicCloud::theta() const ( IOobject ( - this->name() + "Theta", + this->name() + "::theta", this->db().time().timeName(), this->db(), IOobject::NO_READ, @@ -578,7 +578,7 @@ Foam::KinematicCloud::alpha() const ( IOobject ( - this->name() + "Alpha", + this->name() + "::alpha", this->db().time().timeName(), this->db(), IOobject::NO_READ, @@ -615,7 +615,7 @@ Foam::KinematicCloud::rhoEff() const ( IOobject ( - this->name() + "RhoEff", + this->name() + "::rhoEff", this->db().time().timeName(), this->db(), IOobject::NO_READ, diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C index 0f98e8b935..1bc817a4c1 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloud.C @@ -132,7 +132,7 @@ Foam::ReactingCloud::ReactingCloud ( IOobject ( - this->name() + "rhoTrans_" + specieName, + this->name() + "::rhoTrans_" + specieName, this->db().time().timeName(), this->db(), IOobject::READ_IF_PRESENT, @@ -176,7 +176,7 @@ Foam::ReactingCloud::ReactingCloud ( IOobject ( - this->name() + "rhoTrans_" + specieName, + this->name() + "::rhoTrans_" + specieName, this->db().time().timeName(), this->db(), IOobject::NO_READ, diff --git a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H index 2a9bbb2423..66cb73b85f 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ReactingCloud/ReactingCloudI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,7 +107,7 @@ inline Foam::tmp Foam::ReactingCloud::SYi ( IOobject ( - this->name() + "rhoTrans", + this->name() + "::rhoTrans", this->db().time().timeName(), this->db(), IOobject::NO_READ, @@ -155,7 +155,7 @@ Foam::ReactingCloud::Srho(const label i) const ( IOobject ( - this->name() + "rhoTrans", + this->name() + "::rhoTrans", this->db().time().timeName(), this->db(), IOobject::NO_READ, @@ -192,7 +192,7 @@ Foam::ReactingCloud::Srho() const ( IOobject ( - this->name() + "rhoTrans", + this->name() + "::rhoTrans", this->db().time().timeName(), this->db(), IOobject::NO_READ, @@ -236,7 +236,7 @@ Foam::ReactingCloud::Srho(volScalarField& rho) const ( IOobject ( - this->name() + "rhoTrans", + this->name() + "::rhoTrans", this->db().time().timeName(), this->db(), IOobject::NO_READ, diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H index 764595fece..a75f1f64d8 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H @@ -278,7 +278,7 @@ inline Foam::tmp Foam::ThermoCloud::Ep() const ( IOobject ( - this->name() + "radiation::Ep", + this->name() + "::radiation::Ep", this->db().time().timeName(), this->db(), IOobject::NO_READ, @@ -314,7 +314,7 @@ inline Foam::tmp Foam::ThermoCloud::ap() const ( IOobject ( - this->name() + "radiation::ap", + this->name() + "::radiation::ap", this->db().time().timeName(), this->db(), IOobject::NO_READ, @@ -351,7 +351,7 @@ Foam::ThermoCloud::sigmap() const ( IOobject ( - this->name() + "radiation::sigmap", + this->name() + "::radiation::sigmap", this->db().time().timeName(), this->db(), IOobject::NO_READ, From f763bca42ebe9fe5d6a15001f82ce8ff4bbd1f56 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 9 Aug 2012 15:17:24 +0100 Subject: [PATCH 08/26] BUG: #include of empty filename creates confusing error message (Mark Olesen) When using #include or #includeIfPresent, it is easy to generate an empty file name. For example, #include "~OpenFOAM/missing-path/file" On error, findEtcFile() returns an empty fileName. This was treated as a relative name, which meant there was an attempt to open the parent directory as a file. The resulting error message was confusing: --> FOAM FATAL IO ERROR: Attempt to put back onto bad stream file: /CASE/PATH/system at line 1. From function void Istream::putBack(const token&) in file db/IOstreams/IOstreams/Istream.C at line 34. - fix by leaving empty expansions as-is --- .../functionEntries/includeEntry/includeEntry.C | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.C b/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.C index 60478f9609..eb8fd09280 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -74,13 +74,15 @@ Foam::fileName Foam::functionEntries::includeEntry::includeFileName fileName fName(is); fName.expand(); - // relative name - if (!fName.isAbsolute()) + if (fName.empty() || fName.isAbsolute()) { - fName = fileName(is.name()).path()/fName; + return fName; + } + else + { + // relative name + return fileName(is.name()).path()/fName; } - - return fName; } From aadd377def97c6840818e06ba3a9268175606781 Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 9 Aug 2012 17:16:44 +0100 Subject: [PATCH 09/26] ENH: Code clean-up --- .../objectRegistry/objectRegistryTemplates.C | 10 +--- .../polyMesh/globalMeshData/globalMeshData.H | 51 ++++++++++--------- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C index 922d630de7..8c1ca52cf8 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C @@ -58,15 +58,7 @@ Foam::HashTable Foam::objectRegistry::lookupClass for (const_iterator iter = begin(); iter != end(); ++iter) { - if (strict && isType(*iter())) - { - objectsOfClass.insert - ( - iter()->name(), - dynamic_cast(iter()) - ); - } - else if (isA(*iter())) + if ((strict && isType(*iter())) || isA(*iter())) { objectsOfClass.insert ( diff --git a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H index 1f9c51ac9f..895daa91ab 100644 --- a/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H +++ b/src/OpenFOAM/meshes/polyMesh/globalMeshData/globalMeshData.H @@ -25,50 +25,53 @@ Class Foam::globalMeshData Description - Various mesh related information for a parallel run. Upon construction - constructs all info by using parallel communication. + Various mesh related information for a parallel run. Upon construction, + constructs all info using parallel communication. Requires: - all processor patches to have correct ordering. - all processorPatches to have their transforms set. - The shared point and edge addressing is quite interesting. - It calculates addressing for points and edges on coupled patches. In - the 'old' way a distincation was made between points/edges that are - only on two processors and those that are on multiple processors. The - problem is that those on multiple processors do not allow any - transformations and require a global reduction on the master processor. + The shared point and edge addressing calculates addressing for points + and edges on coupled patches. In the 'old' way a distinction was made + between points/edges that are only on two processors and those that are + on multiple processors. The problem is that those on multiple processors + do not allow any transformations and require a global reduction on the + master processor. The alternative is to have an exchange schedule (through a 'mapDistribute') which sends all point/edge data (no distinction is made between those on two and those on more than two coupled patches) to the local - 'master'. This master then does any calculation and sends - the result back to the 'slave' points/edges. This only needs to be done - on points on coupled faces. Any transformation is done using a predetermined - set of transformations - since transformations have to be space filling - only a certain number of transformation is supported. + 'master'. This master then does any calculation and sends + the result back to the 'slave' points/edges. This only needs to be done + on points on coupled faces. Any transformation is done using a + predetermined set of transformations - since transformations have to be + space filling only a certain number of transformation is supported. The exchange needs - a field of data - a mapDistribute which does all parallel exchange and transformations - This appens remote data to the end of the field. + This appens remote data to the end of the field - a set of indices which indicate where to get untransformed data in the field - a set of indices which indicate where to get transformed data in the field - See also mapDistribute, globalIndexAndTransform - - Notes: +Note - compared to 17x nTotalFaces, nTotalPoints do not compensate for - shared points since this would trigger full connectivity analysis + shared points since this would trigger full connectivity analysis - most calculation is demand driven and uses parallel communication - so make sure to invoke on all processors at the same time. + so make sure to invoke on all processors at the same time - old sharedEdge calculation: currently an edge is considered shared - if it uses two shared points and is used more than once. This is not - correct on processor patches but it only slightly overestimates the number - of shared edges. Doing full analysis of how many patches use the edge - would be too complicated. + if it uses two shared points and is used more than once. This is not + correct on processor patches but it only slightly overestimates the number + of shared edges. Doing full analysis of how many patches use the edge + would be too complicated + +SeeAlso + mapDistribute + globalIndexAndTransform + SourceFiles globalMeshData.C @@ -98,7 +101,7 @@ class globalIndexAndTransform; class PackedBoolList; /*---------------------------------------------------------------------------*\ - Class globalMeshData Declaration + Class globalMeshData Declaration \*---------------------------------------------------------------------------*/ class globalMeshData From 022716537b5bb4338ce66f1c0f22caccd0e107cd Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 9 Aug 2012 17:21:54 +0100 Subject: [PATCH 10/26] ENH: revert to local interrogation of object registry contents --- .../DimensionedField/MapDimensionedFields.H | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H index 6520eaec2f..b96c6ca666 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H @@ -45,10 +45,19 @@ void MapDimensionedFields(const MeshMapper& mapper) typedef DimensionedField FieldType; typedef HashTable TableType; - TableType fields - ( - mapper.thisDb().objectRegistry::template lookupClass(true) - ); + TableType fields(mapper.thisDb().size()); + + forAllConstIter(objectRegistry, mapper.thisDb(), iter) + { + if (isType(*iter())) + { + fields.insert + ( + iter()->name(), + dynamic_cast(iter()) + ); + } + } forAllConstIter(typename TableType, fields, fieldIter) { From 9dce59e9c45cd702f03a69781fad1be2110ce0a4 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 10 Aug 2012 09:59:53 +0100 Subject: [PATCH 11/26] ENH: Clear tet base pts and cell tree in polyMesh::updateMesh() --- src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C index bba7367e8b..96dc726b44 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C +++ b/src/OpenFOAM/meshes/polyMesh/polyMeshUpdate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,6 +31,8 @@ Description #include "Time.H" #include "globalMeshData.H" #include "pointMesh.H" +#include "indexedOctree.H" +#include "treeDataCell.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -44,6 +46,11 @@ void Foam::polyMesh::updateMesh(const mapPolyMesh& mpm) faceZones_.clearAddressing(); cellZones_.clearAddressing(); + // Remove the stored tet base points + tetBasePtIsPtr_.clear(); + // Remove the cell tree + cellTreePtr_.clear(); + // Update parallel data if (globalMeshDataPtr_.valid()) { From 16d5e020ca53b1b5f955626e3455a1e542058f74 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 10 Aug 2012 10:01:51 +0100 Subject: [PATCH 12/26] BUG: set particle cell ID in cloud autoMap for mesh unrefine --- src/lagrangian/basic/Cloud/Cloud.C | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/lagrangian/basic/Cloud/Cloud.C b/src/lagrangian/basic/Cloud/Cloud.C index 460b965070..d85ef08dca 100644 --- a/src/lagrangian/basic/Cloud/Cloud.C +++ b/src/lagrangian/basic/Cloud/Cloud.C @@ -423,6 +423,10 @@ void Foam::Cloud::autoMap trackStartCell = 0; p.cell() = 0; } + else + { + p.cell() = trackStartCell; + } vector pos = p.position(); From da64febc799d049590be486963057ae916def75f Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 Aug 2012 09:29:47 +0100 Subject: [PATCH 13/26] BUG: Corrected use of strict in lookup class --- .../db/objectRegistry/objectRegistryTemplates.C | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C index 8c1ca52cf8..960605e049 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C +++ b/src/OpenFOAM/db/objectRegistry/objectRegistryTemplates.C @@ -34,7 +34,7 @@ Foam::wordList Foam::objectRegistry::names() const wordList objectNames(size()); label count=0; - for (const_iterator iter = begin(); iter != end(); ++iter) + forAllConstIter(HashTable, *this, iter) { if (isA(*iter())) { @@ -56,9 +56,13 @@ Foam::HashTable Foam::objectRegistry::lookupClass { HashTable objectsOfClass(size()); - for (const_iterator iter = begin(); iter != end(); ++iter) + forAllConstIter(HashTable, *this, iter) { - if ((strict && isType(*iter())) || isA(*iter())) + if + ( + (strict && isType(*iter())) + || (!strict && isA(*iter())) + ) { objectsOfClass.insert ( From 01da75a7bad4d18b1d4bb0a1911eac860c8adeb4 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 Aug 2012 09:29:57 +0100 Subject: [PATCH 14/26] STYLE: Minor code formatting --- src/OpenFOAM/db/objectRegistry/objectRegistry.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenFOAM/db/objectRegistry/objectRegistry.H b/src/OpenFOAM/db/objectRegistry/objectRegistry.H index 14306e41fb..84b295c4d7 100644 --- a/src/OpenFOAM/db/objectRegistry/objectRegistry.H +++ b/src/OpenFOAM/db/objectRegistry/objectRegistry.H @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class objectRegistry Declaration + Class objectRegistry Declaration \*---------------------------------------------------------------------------*/ class objectRegistry From 368b5438316e6a5815851cc0079a2c9fb6700b76 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 Aug 2012 09:42:52 +0100 Subject: [PATCH 15/26] BUG: remove ambiguous construction from tmp --- .../sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index a56fcadf79..46b39ccb61 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -159,7 +159,7 @@ void Foam::sampledSurfaces::sampleAndWrite forAll(*this, surfI) { const sampledSurface& s = operator[](surfI); - Field values = s.sample(sField); + Field values(s.sample(sField)); writeSurface(values, surfI, fieldName, outputDir); } } From 218c34fc0091ae1aefa849abb9a1dcdc6172a1c8 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 Aug 2012 09:49:19 +0100 Subject: [PATCH 16/26] ENH: Use strict type lookup class for MapDimensionedFields --- .../DimensionedField/MapDimensionedFields.H | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H index b96c6ca666..1a82e69825 100644 --- a/src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H +++ b/src/OpenFOAM/fields/DimensionedFields/DimensionedField/MapDimensionedFields.H @@ -45,19 +45,7 @@ void MapDimensionedFields(const MeshMapper& mapper) typedef DimensionedField FieldType; typedef HashTable TableType; - TableType fields(mapper.thisDb().size()); - - forAllConstIter(objectRegistry, mapper.thisDb(), iter) - { - if (isType(*iter())) - { - fields.insert - ( - iter()->name(), - dynamic_cast(iter()) - ); - } - } + TableType fields(mapper.thisDb().template lookupClass(true)); forAllConstIter(typename TableType, fields, fieldIter) { From c0fa6d721c308cd9cb12095066fb10fe26472a45 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 Aug 2012 10:52:06 +0100 Subject: [PATCH 17/26] BUG: paraFoam - do not require reader module when using -builtin option - resolves mantis #612 --- bin/paraFoam | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/paraFoam b/bin/paraFoam index 867212e50c..e6465f0811 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -85,6 +85,7 @@ do ;; -builtin) extension=foam + requirePV=0 shift ;; -case) From db3ad447744117c3d59b2991ccf0d838292efc31 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 13 Aug 2012 15:30:15 +0100 Subject: [PATCH 18/26] ENH: Bounded mass fraction in COxidationHurtMitchell --- .../COxidationHurtMitchell/COxidationHurtMitchell.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C index c3ecbbffaf..b959d7f75b 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C @@ -155,7 +155,7 @@ Foam::scalar Foam::COxidationHurtMitchell::calculate } // Char percentage - const scalar charPrc = Ychar/Ydaf*100.0; + const scalar charPrc = max(0, min(Ychar/(Ydaf + ROOTVSMALL)*100.0, 100)); // Particle surface area const scalar Ap = constant::mathematical::pi*sqr(d); From affe532cd82f90d77a211aa88eef8856a58f16e1 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 14 Aug 2012 09:33:35 +0100 Subject: [PATCH 19/26] STYLE: updated notImplemented comment --- .../chemistryModel/ODEChemistryModel/ODEChemistryModel.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C index c18cccb712..438971d9cd 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C @@ -856,7 +856,7 @@ Foam::scalar Foam::ODEChemistryModel::solve "const scalar, " "const scalar, " "const scalar" - ")" + ") const" ); return (0); From 69cc8d8ae7daee12be6ddcc3feab6fef0208a797 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 14 Aug 2012 14:25:34 +0100 Subject: [PATCH 20/26] ENH: change deltaTChem to DimensionedField to enable auto mapping --- .../basicChemistryModel/basicChemistryModel.C | 14 +++++++++++++- .../basicChemistryModel/basicChemistryModel.H | 15 ++++++++++----- .../basicChemistryModel/basicChemistryModelI.H | 8 +++++--- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C index 38efa9e858..43b876fbd6 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C @@ -64,7 +64,19 @@ Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh) mesh_(mesh), chemistry_(lookup("chemistry")), deltaTChemIni_(readScalar(lookup("initialChemicalTimeStep"))), - deltaTChem_(mesh.nCells(), deltaTChemIni_) + deltaTChem_ + ( + IOobject + ( + "deltaTChem", + mesh.time().constant(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("deltaTChem0", dimTime, deltaTChemIni_) + ) {} diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H index 2f27d59f70..da54d4c916 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,6 +40,8 @@ SourceFiles #include "Switch.H" #include "scalarField.H" #include "volFieldsFwd.H" +#include "volMesh.H" +#include "DimensionedField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -80,14 +82,14 @@ protected: const scalar deltaTChemIni_; //- Latest estimation of integration step - scalarField deltaTChem_; + DimensionedField deltaTChem_; // Protected Member Functions //- Return non-const access to the latest estimation of integration // step, e.g. for multi-chemistry model - scalarField& deltaTChem(); + inline DimensionedField& deltaTChem(); //- Correct function - updates due to mesh changes void correct(); @@ -118,7 +120,7 @@ public: inline Switch chemistry() const; //- Return the latest estimation of integration step - inline const scalarField& deltaTChem() const; + inline const DimensionedField& deltaTChem() const; // Functions to be derived in derived classes @@ -126,7 +128,10 @@ public: // Fields //- Return const access to chemical source terms [kg/m3/s] - virtual tmp RR(const label i) const = 0; + virtual const DimensionedField& RR + ( + const label i + ) const = 0; // Chemistry solution diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModelI.H b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModelI.H index eeec0af749..6455309e15 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModelI.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,13 +37,15 @@ inline Foam::Switch Foam::basicChemistryModel::chemistry() const } -inline const Foam::scalarField& Foam::basicChemistryModel::deltaTChem() const +inline const Foam::DimensionedField& +Foam::basicChemistryModel::deltaTChem() const { return deltaTChem_; } -inline Foam::scalarField& Foam::basicChemistryModel::deltaTChem() +inline Foam::DimensionedField& +Foam::basicChemistryModel::deltaTChem() { return deltaTChem_; } From af1437fd14b8209fcde3ac3a22098c537810cf11 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 14 Aug 2012 14:26:11 +0100 Subject: [PATCH 21/26] ENH: Added DimensionedField handling to volume/domain integrate --- .../finiteVolume/fvc/fvcVolumeIntegrate.C | 51 +++++++++++++++++-- .../finiteVolume/fvc/fvcVolumeIntegrate.H | 28 +++++++++- 2 files changed, 75 insertions(+), 4 deletions(-) diff --git a/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.C b/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.C index f01c72ce6c..783a20482e 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.C +++ b/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -49,6 +49,7 @@ volumeIntegrate return vf.mesh().V()*vf.internalField(); } + template tmp > volumeIntegrate @@ -62,6 +63,23 @@ volumeIntegrate } +template +tmp > volumeIntegrate(const DimensionedField& df) +{ + return df.mesh().V()*df.field(); +} + + +template +tmp > +volumeIntegrate(const tmp >& tdf) +{ + tmp > tdidf = tdf().mesh().V()*tdf().field(); + tdf.clear(); + return tdidf; +} + + template dimensioned domainIntegrate @@ -77,9 +95,9 @@ domainIntegrate ); } + template -dimensioned -domainIntegrate +dimensioned domainIntegrate ( const tmp >& tvf ) @@ -90,6 +108,33 @@ domainIntegrate } +template +dimensioned domainIntegrate +( + const DimensionedField& df +) +{ + return dimensioned + ( + "domainIntegrate(" + df.name() + ')', + dimVol*df.dimensions(), + gSum(fvc::volumeIntegrate(df)) + ); +} + + +template +dimensioned domainIntegrate +( + const tmp >& tdf +) +{ + dimensioned integral = domainIntegrate(tdf()); + tdf.clear(); + return integral; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace fvc diff --git a/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.H b/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.H index 741d1451b4..784087ee30 100644 --- a/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.H +++ b/src/finiteVolume/finiteVolume/fvc/fvcVolumeIntegrate.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -67,6 +67,19 @@ namespace fvc ); + template + tmp > volumeIntegrate + ( + const DimensionedField& + ); + + template + tmp > volumeIntegrate + ( + const tmp >& + ); + + template dimensioned domainIntegrate ( @@ -78,6 +91,19 @@ namespace fvc ( const tmp >& ); + + + template + dimensioned domainIntegrate + ( + const DimensionedField& + ); + + template + dimensioned domainIntegrate + ( + const tmp >& + ); } From 1b9320bc0cce74a34837c644012205fea320d555 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 14 Aug 2012 14:26:50 +0100 Subject: [PATCH 22/26] ENH: change reaction rates to DimensionedFields to enable auto mapping --- .../reactingOneDim/reactingOneDim.C | 6 +- .../ODEChemistryModel/ODEChemistryModel.C | 18 +++- .../ODEChemistryModel/ODEChemistryModel.H | 14 +-- .../ODEChemistryModel/ODEChemistryModelI.H | 31 +------ .../ODESolidChemistryModel.C | 45 ++++++++-- .../ODESolidChemistryModel.H | 28 ++++-- .../ODESolidChemistryModelI.H | 90 +++++-------------- .../solidChemistryModel/solidChemistryModel.H | 14 ++- 8 files changed, 118 insertions(+), 128 deletions(-) diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index d20552f368..05c6c7b9a2 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -153,10 +153,10 @@ void reactingOneDim::updatePhiGas() tmp tHsiGas = solidChemistry_->gasHs(solidThermo_.p(), solidThermo_.T(), gasI); - tmp tRRiGas = solidChemistry_->RRg(gasI); - const volScalarField& HsiGas = tHsiGas(); - const volScalarField& RRiGas = tRRiGas(); + + const DimensionedField& RRiGas = + solidChemistry_->RRg(gasI); label totalFaceId = 0; forAll(intCoupledPatchIDs_, i) diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C index 438971d9cd..882aeff0a0 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C @@ -64,7 +64,19 @@ Foam::ODEChemistryModel::ODEChemistryModel RR_.set ( fieldI, - new scalarField(mesh.nCells(), 0.0) + new DimensionedField + ( + IOobject + ( + "RR::" + Y_[fieldI].name(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) + ) ); } @@ -706,7 +718,7 @@ void Foam::ODEChemistryModel::calculate() for (label i=0; i::solve for (label i = 0; i < nSpecie_; i++) { RR_[i].setSize(this->mesh().nCells()); - RR_[i] = 0.0; + RR_[i].field() = 0.0; } } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H index 9128e41557..da560dae87 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -42,6 +42,7 @@ SourceFiles #include "ODE.H" #include "volFieldsFwd.H" #include "simpleMatrix.H" +#include "DimensionedField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -90,14 +91,14 @@ protected: label nReaction_; //- List of reaction rate per specie [kg/m3/s] - PtrList RR_; + PtrList > RR_; // Protected Member Functions //- Write access to chemical source terms // (e.g. for multi-chemistry model) - inline PtrList& RR(); + inline PtrList >& RR(); public: @@ -205,8 +206,11 @@ public: // Chemistry model functions (overriding abstract functions in // basicChemistryModel.H) - //- Return const access to the chemical source terms - inline tmp RR(const label i) const; + //- Return const access to the chemical source terms for specie, i + inline const DimensionedField& RR + ( + const label i + ) const; //- Solve the reaction system for the given start time and time // step and return the characteristic time diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H index 8031b68ba4..9f06a064a7 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,7 +29,7 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline Foam::PtrList& +inline Foam::PtrList >& Foam::ODEChemistryModel::RR() { return RR_; @@ -69,36 +69,13 @@ Foam::ODEChemistryModel::nReaction() const template -inline Foam::tmp +inline const Foam::DimensionedField& Foam::ODEChemistryModel::RR ( const label i ) const { - tmp tRR - ( - new volScalarField - ( - IOobject - ( - "RR(" + this->Y_[i].name() + ')', - this->time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - this->mesh(), - dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0), - zeroGradientFvPatchScalarField::typeName - ) - ); - - if (this->chemistry_) - { - tRR().internalField() = RR_[i]; - tRR().correctBoundaryConditions(); - } - return tRR; + return RR_[i]; } diff --git a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C index 093c6d8d84..54097f267a 100644 --- a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C +++ b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C @@ -71,7 +71,19 @@ ODESolidChemistryModel RRs_.set ( fieldI, - new scalarField(mesh.nCells(), 0.0) + new DimensionedField + ( + IOobject + ( + "RRs::" + Ys_[fieldI].name(), + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) + ) ); @@ -134,7 +146,8 @@ ODESolidChemistryModel Y0Default ) ); - // Calculate inital values of Ysi0 = rho*delta*Yi + + // Calculate inital values of Ysi0 = rho*delta*Yi Ys0_[fieldI].internalField() = this->solid().rho() *max(Ys_[fieldI], scalar(0.001))*mesh.V(); @@ -143,7 +156,23 @@ ODESolidChemistryModel forAll(RRg_, fieldI) { - RRg_.set(fieldI, new scalarField(mesh.nCells(), 0.0)); + RRg_.set + ( + fieldI, + new DimensionedField + ( + IOobject + ( + "RRg::" + pyrolisisGases_[fieldI], + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) + ) + ); } forAll(gasThermo_, gasI) @@ -551,11 +580,11 @@ calculate() forAll(RRs_, i) { - RRs_[i] = 0.0; + RRs_[i].field() = 0.0; } forAll(RRg_, i) { - RRg_[i] = 0.0; + RRg_[i].field() = 0.0; } if (this->chemistry_) @@ -631,11 +660,11 @@ Foam::ODESolidChemistryModel::solve forAll(RRs_, i) { - RRs_[i] = 0.0; + RRs_[i].field() = 0.0; } forAll(RRg_, i) { - RRg_[i] = 0.0; + RRg_[i].field() = 0.0; } if (!this->chemistry_) @@ -798,7 +827,7 @@ Foam::ODESolidChemistryModel::solve "const scalar, " "const scalar, " "const scalar" - ")" + ") const" ); return (0); } diff --git a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.H index 5dc785c9c7..df48750381 100644 --- a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.H +++ b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.H @@ -41,6 +41,7 @@ SourceFiles #include "solidReaction.H" #include "ODE.H" #include "volFieldsFwd.H" +#include "DimensionedField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -96,19 +97,19 @@ protected: label nReaction_; //- List of reaction rate per solid [kg/m3/s] - PtrList RRs_; + PtrList > RRs_; //- List of reaction rate per gas [kg/m3/s] - PtrList RRg_; + PtrList > RRg_; // Protected Member Functions //- Write access to source terms for solids - inline PtrList& RRs(); + inline PtrList >& RRs(); //- Write access to source terms for gases - inline PtrList& RRg(); + inline PtrList >& RRg(); private: @@ -203,19 +204,28 @@ public: // Chemistry model functions //- Return const access to the chemical source terms for solids - inline tmp RRs(const label i) const; + inline const DimensionedField& RRs + ( + const label i + ) const; //- Return const access to the chemical source terms for gases - inline tmp RRg(const label i) const; + inline const DimensionedField& RRg + ( + const label i + ) const; //- Return total gas source term - inline tmp RRg() const; + inline tmp > RRg() const; //- Return total solid source term - inline tmp RRs() const; + inline tmp > RRs() const; //- Return const access to the total source terms - inline tmp RR(const label i) const; + inline const DimensionedField& RR + ( + const label i + ) const; //- Return sensible enthalpy for gas i [J/Kg] virtual tmp gasHs diff --git a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModelI.H b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModelI.H index 802345f3a9..bcb6a89f99 100644 --- a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModelI.H +++ b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,7 +29,7 @@ License // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -inline Foam::PtrList& +inline Foam::PtrList >& Foam::ODESolidChemistryModel::RRs() { return RRs_; @@ -37,7 +37,7 @@ Foam::ODESolidChemistryModel::RRs() template -inline Foam::PtrList& +inline Foam::PtrList >& Foam::ODESolidChemistryModel::RRg() { return RRg_; @@ -87,80 +87,34 @@ nReaction() const template -inline Foam::tmp +inline const Foam::DimensionedField& Foam::ODESolidChemistryModel::RRs ( const label i ) const { - tmp tRRs - ( - new volScalarField - ( - IOobject - ( - "RRs(" + Ys_[i].name() + ')', - this->time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - this->mesh(), - dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0), - zeroGradientFvPatchScalarField::typeName - ) - ); - - if (this->chemistry_) - { - tRRs().internalField() = RRs_[i]; - tRRs().correctBoundaryConditions(); - } - return tRRs; + return RRs_[i]; } template -inline Foam::tmp +inline const Foam::DimensionedField& Foam::ODESolidChemistryModel::RRg ( const label i ) const { - tmp tRRg - ( - new volScalarField - ( - IOobject - ( - "RRg(" + this->pyrolisisGases_[i] + ')', - this->time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - this->mesh(), - dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0), - zeroGradientFvPatchScalarField::typeName - ) - ); - - if (this->chemistry_) - { - tRRg().internalField() = RRg_[i]; - tRRg().correctBoundaryConditions(); - } - return tRRg; + return RRg_[i]; } template -inline Foam::tmp +inline Foam::tmp > Foam::ODESolidChemistryModel::RRg() const { - tmp tRRg + tmp > tRRg ( - new volScalarField + new DimensionedField ( IOobject ( @@ -171,30 +125,29 @@ Foam::ODESolidChemistryModel::RRg() const IOobject::NO_WRITE ), this->mesh(), - dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0), - zeroGradientFvPatchScalarField::typeName + dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) ) ); if (this->chemistry_) { + DimensionedField& RRg = tRRg(); for (label i=0; i < nGases_; i++) { - tRRg().internalField() += RRg_[i]; + RRg += RRg_[i]; } - tRRg().correctBoundaryConditions(); } return tRRg; } template -inline Foam::tmp +inline Foam::tmp > Foam::ODESolidChemistryModel::RRs() const { - tmp tRRs + tmp > tRRs ( - new volScalarField + new DimensionedField ( IOobject ( @@ -205,32 +158,31 @@ Foam::ODESolidChemistryModel::RRs() const IOobject::NO_WRITE ), this->mesh(), - dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0), - zeroGradientFvPatchScalarField::typeName + dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0) ) ); if (this->chemistry_) { + DimensionedField& RRs = tRRs(); for (label i=0; i < nSolids_; i++) { - tRRs().internalField() += RRs_[i]; + RRs += RRs_[i]; } - tRRs().correctBoundaryConditions(); } return tRRs; } template -inline Foam::tmp +inline const Foam::DimensionedField& Foam::ODESolidChemistryModel::RR ( const label i ) const { notImplemented("ODESolidChemistryModel::RR(const label)"); - return (Foam::volScalarField::null()); + return (DimensionedField::null()); } diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H index 9114f046ff..d9580162ef 100644 --- a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H +++ b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H @@ -124,16 +124,22 @@ public: inline const solidReactionThermo& solid() const; //- Return total gases mass source term [kg/m3/s] - virtual tmp RRg() const = 0; + virtual tmp > RRg() const = 0; //- Return total solids mass source term [kg/m3/s] - virtual tmp RRs() const = 0; + virtual tmp > RRs() const = 0; //- Return chemical source terms for solids [kg/m3/s] - virtual tmp RRs(const label i) const = 0; + virtual const DimensionedField& RRs + ( + const label i + ) const = 0; //- Return chemical source terms for gases [kg/m3/s] - virtual tmp RRg(const label i) const = 0; + virtual const DimensionedField& RRg + ( + const label i + ) const = 0; //- Return sensible enthalpy for gas i [J/Kg] virtual tmp gasHs From 3821ee560adcd98ea44b12a10047a3dcd429afa7 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 14 Aug 2012 14:27:10 +0100 Subject: [PATCH 23/26] ENH: Tutorial input dictionary updates --- .../fireFoam/les/smallPoolFire2D/constant/combustionProperties | 3 ++- .../fireFoam/les/smallPoolFire3D/constant/combustionProperties | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/combustionProperties b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/combustionProperties index 9973e9ad7b..1576592b91 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/combustionProperties +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/combustionProperties @@ -23,7 +23,8 @@ active true; infinitelyFastChemistryCoeffs { - C 5.0; + semiImplicit no; + C 5.0; } FSDCoeffs diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/combustionProperties b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/combustionProperties index cfa2cd8f28..689dc54c62 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/combustionProperties +++ b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/combustionProperties @@ -22,6 +22,7 @@ active on; infinitelyFastChemistryCoeffs { + semiImplicit no; C 5.0; } From 0dae57fb58c612978a96160bf845af9f7b511c1e Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 14 Aug 2012 15:07:07 +0100 Subject: [PATCH 24/26] ENH: Removed unnecessary mapping for chemistry models since change to DimensionedFields --- .../ODEChemistryModel/ODEChemistryModel.C | 61 +++++-------- .../basicChemistryModel/basicChemistryModel.C | 6 +- .../ODESolidChemistryModel.C | 89 +++++++------------ 3 files changed, 56 insertions(+), 100 deletions(-) diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C index 882aeff0a0..522afe5161 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C @@ -699,6 +699,11 @@ Foam::label Foam::ODEChemistryModel::nEqns() const template void Foam::ODEChemistryModel::calculate() { + if (!this->chemistry_) + { + return; + } + const volScalarField rho ( IOobject @@ -713,36 +718,24 @@ void Foam::ODEChemistryModel::calculate() this->thermo().rho() ); - if (this->mesh().changing()) + forAll(rho, celli) { + const scalar rhoi = rho[celli]; + const scalar Ti = this->thermo().T()[celli]; + const scalar pi = this->thermo().p()[celli]; + + scalarField c(nSpecie_, 0.0); for (label i=0; ichemistry_) - { - forAll(rho, celli) + const scalarField dcdt(omega(c, Ti, pi)); + + for (label i=0; ithermo().T()[celli]; - const scalar pi = this->thermo().p()[celli]; - - scalarField c(nSpecie_, 0.0); - for (label i=0; i::solve scalar deltaTMin = GREAT; + if (!this->chemistry_) + { + return deltaTMin; + } + const volScalarField rho ( IOobject @@ -773,21 +771,6 @@ Foam::scalar Foam::ODEChemistryModel::solve this->thermo().rho() ); - if (this->mesh().changing()) - { - for (label i = 0; i < nSpecie_; i++) - { - RR_[i].setSize(this->mesh().nCells()); - RR_[i].field() = 0.0; - } - } - - if (!this->chemistry_) - { - return deltaTMin; - } - - tmp thc = this->thermo().hc(); const scalarField& hc = thc(); diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C index 43b876fbd6..1182c22b92 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.C @@ -38,11 +38,7 @@ namespace Foam void Foam::basicChemistryModel::correct() { - if (mesh_.changing()) - { - deltaTChem_.setSize(mesh_.nCells()); - deltaTChem_ = deltaTChemIni_; - } + // do nothing } diff --git a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C index 54097f267a..23ad0e62a0 100644 --- a/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C +++ b/src/thermophysicalModels/solidChemistryModel/ODESolidChemistryModel/ODESolidChemistryModel.C @@ -548,9 +548,12 @@ ODESolidChemistryModel::nEqns() const template -void Foam::ODESolidChemistryModel:: -calculate() +void Foam::ODESolidChemistryModel::calculate() { + if (!this->chemistry_) + { + return; + } const volScalarField rho ( @@ -566,18 +569,6 @@ calculate() this->solid().rho() ); - if (this->mesh().changing()) - { - forAll(RRs_, i) - { - RRs_[i].setSize(rho.size()); - } - forAll(RRg_, i) - { - RRg_[i].setSize(rho.size()); - } - } - forAll(RRs_, i) { RRs_[i].field() = 0.0; @@ -587,37 +578,34 @@ calculate() RRg_[i].field() = 0.0; } - if (this->chemistry_) + forAll(rho, celli) { - forAll(rho, celli) + cellCounter_ = celli; + + const scalar delta = this->mesh().V()[celli]; + + if (reactingCells_[celli]) { - cellCounter_ = celli; + scalar rhoi = rho[celli]; + scalar Ti = this->solid().T()[celli]; + scalar pi = this->solid().p()[celli]; - const scalar delta = this->mesh().V()[celli]; - - if (reactingCells_[celli]) + scalarField c(nSpecie_, 0.0); + for (label i=0; isolid().T()[celli]; - scalar pi = this->solid().p()[celli]; + c[i] = rhoi*Ys_[i][celli]*delta; + } - scalarField c(nSpecie_, 0.0); - for (label i=0; i::solve const scalar deltaT ) { + scalar deltaTMin = GREAT; + + if (!this->chemistry_) + { + return deltaTMin; + } + const volScalarField rho ( IOobject @@ -646,18 +641,6 @@ Foam::ODESolidChemistryModel::solve this->solid().rho() ); - if (this->mesh().changing()) - { - forAll(RRs_, i) - { - RRs_[i].setSize(rho.size()); - } - forAll(RRg_, i) - { - RRg_[i].setSize(rho.size()); - } - } - forAll(RRs_, i) { RRs_[i].field() = 0.0; @@ -667,12 +650,6 @@ Foam::ODESolidChemistryModel::solve RRg_[i].field() = 0.0; } - if (!this->chemistry_) - { - return GREAT; - } - - scalar deltaTMin = GREAT; forAll(rho, celli) { From 2d419cc7df6bd27cba48fdcbd8a00deb9192fcc2 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 15 Aug 2012 12:57:55 +0100 Subject: [PATCH 25/26] BUG: Corrected mechanical energy in pEqn of compressibleTwoPhaseEulerFoam - mantis #624 --- .../solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H index 926abe2a09..d5a5d20631 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/pEqn.H @@ -178,7 +178,7 @@ rho2 = rho20 + psi2*p; K1 = 0.5*magSqr(U1); - K2 = 0.5*magSqr(U1); + K2 = 0.5*magSqr(U2); dpdt = fvc::ddt(p); } From 9162ade598578506014389b6df67fe605e0ddeaa Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 16 Aug 2012 09:14:03 +0100 Subject: [PATCH 26/26] BUG: missing link option to incompressibleRASModels to enable wall function selection - mantis #627 --- applications/solvers/multiphase/multiphaseEulerFoam/Make/options | 1 + 1 file changed, 1 insertion(+) diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/Make/options b/applications/solvers/multiphase/multiphaseEulerFoam/Make/options index 5799557cc9..7cd8f48ee4 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/Make/options +++ b/applications/solvers/multiphase/multiphaseEulerFoam/Make/options @@ -20,4 +20,5 @@ EXE_LIBS = \ -lincompressibleTransportModels \ -lcompressibleMultiphaseEulerianInterfacialModels \ -lincompressibleLESModels \ + -lincompressibleRASModels \ -lfiniteVolume