From 4435d6404737fdc0b60dd98144cc0fcdf5a8d1af Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 16 Apr 2013 17:01:23 +0100 Subject: [PATCH 01/41] STYLE: Corrected spelling mistakes --- .../utilities/mesh/manipulation/checkMesh/checkGeometry.C | 2 +- .../utilities/mesh/manipulation/flattenMesh/flattenMesh.C | 2 +- applications/utilities/surface/surfaceCheck/surfaceCheck.C | 2 +- .../utilities/surface/surfacePointMerge/surfacePointMerge.C | 2 +- src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C | 2 +- src/dynamicMesh/polyMeshFilter/polyMeshFilter.C | 2 +- .../autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C | 2 +- .../autoHexMesh/refinementFeatures/refinementFeatures.C | 2 +- src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C | 2 +- src/mesh/blockMesh/blockMesh/blockMesh.H | 4 ++-- src/meshTools/searchableSurface/searchableSurfaceWithGaps.H | 2 +- src/meshTools/sets/topoSets/topoSet.C | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C index ef521a257d..f9fbac3b47 100644 --- a/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C +++ b/applications/utilities/mesh/manipulation/checkMesh/checkGeometry.C @@ -148,7 +148,7 @@ bool Foam::checkWedges { Info<< " ***Wedge patch " << pp.name() << " not planar." << " Point " << pt << " is not in patch plane by " - << d << " meter." + << d << " metre." << endl; } return true; diff --git a/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C b/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C index 00df77dfc5..9be145648f 100644 --- a/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C +++ b/applications/utilities/mesh/manipulation/flattenMesh/flattenMesh.C @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) boundBox bb(points); Info<< "bounding box: min = " << bb.min() - << " max = " << bb.max() << " meters." + << " max = " << bb.max() << " metres." << endl; diff --git a/applications/utilities/surface/surfaceCheck/surfaceCheck.C b/applications/utilities/surface/surfaceCheck/surfaceCheck.C index fb36589061..a017055958 100644 --- a/applications/utilities/surface/surfaceCheck/surfaceCheck.C +++ b/applications/utilities/surface/surfaceCheck/surfaceCheck.C @@ -435,7 +435,7 @@ int main(int argc, char *argv[]) scalar smallDim = 1e-6 * bb.mag(); Info<< "Checking for points less than 1e-6 of bounding box (" - << bb.span() << " meter) apart." + << bb.span() << " metre) apart." << endl; // Sort points diff --git a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C index b63686881a..585072d7c0 100644 --- a/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C +++ b/applications/utilities/surface/surfacePointMerge/surfacePointMerge.C @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) const fileName outFileName = args[3]; Info<< "Reading surface from " << surfFileName << " ..." << endl; - Info<< "Merging points within " << mergeTol << " meter." << endl; + Info<< "Merging points within " << mergeTol << " metre." << endl; triSurface surf1(surfFileName); diff --git a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C index 986922f61d..00aabb3bd6 100644 --- a/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C +++ b/src/dynamicMesh/polyMeshAdder/faceCoupleInfo.C @@ -1542,7 +1542,7 @@ void Foam::faceCoupleInfo::perfectPointMatch ) << "Did not match all of the master faces to the slave faces" << endl << "This usually means that the slave patch and master patch" - << " do not align to within " << absTol << " meter." + << " do not align to within " << absTol << " metre." << abort(FatalError); } diff --git a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C index a1cfc83aeb..3241a79c2d 100644 --- a/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C +++ b/src/dynamicMesh/polyMeshFilter/polyMeshFilter.C @@ -485,7 +485,7 @@ Foam::polyMeshFilter::polyMeshFilter(const fvMesh& mesh) faceFilterFactor_() { Info<< "Merging:" << nl - << " edges with length less than " << minLen_ << " meters" << nl + << " edges with length less than " << minLen_ << " metres" << nl << " edges split by a point with edges in line to within " << radToDeg(::acos(maxCos_)) << " degrees" << nl << " Minimum edge length reduction factor = " diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C index 0178c13875..4c262bd132 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoSnapDriver.C @@ -918,7 +918,7 @@ Foam::vectorField Foam::autoSnapDriver::calcNearestSurface << " coordinate:" << localPoints[pointI] << " did not find any surface within:" << minSnapDist[pointI] - << " meter." << endl; + << " metre." << endl; } } diff --git a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C index 9c8f08630f..f3d969e691 100644 --- a/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C +++ b/src/mesh/autoMesh/autoHexMesh/refinementFeatures/refinementFeatures.C @@ -133,7 +133,7 @@ void Foam::refinementFeatures::read { Info<< " level " << levels_[featI][j] << " for all cells within " << distances_[featI][j] - << " meter." << endl; + << " metre." << endl; } } } diff --git a/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C b/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C index bc3289f18e..a6f6790985 100644 --- a/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C +++ b/src/mesh/autoMesh/autoHexMesh/shellSurfaces/shellSurfaces.C @@ -118,7 +118,7 @@ void Foam::shellSurfaces::setAndCheckLevels { Info<< " level " << levels_[shellI][j] << " for all cells within " << distances_[shellI][j] - << " meter." << endl; + << " metre." << endl; } } else diff --git a/src/mesh/blockMesh/blockMesh/blockMesh.H b/src/mesh/blockMesh/blockMesh/blockMesh.H index 0188d28dca..9e18adf773 100644 --- a/src/mesh/blockMesh/blockMesh/blockMesh.H +++ b/src/mesh/blockMesh/blockMesh/blockMesh.H @@ -69,7 +69,7 @@ class blockMesh //- The list of curved edges curvedEdgeList edges_; - //- The scaling factor to convert to meters + //- The scaling factor to convert to metres scalar scaleFactor_; //- The blocks themselves (the topology) as a polyMesh @@ -171,7 +171,7 @@ public: return edges_; } - //- The scaling factor used to convert to meters + //- The scaling factor used to convert to metres scalar scaleFactor() const; //- The points for the entire mesh diff --git a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H index c169a98ca1..1098f2631f 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H +++ b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H @@ -65,7 +65,7 @@ private: // Private Member Data - //- gap size in meter + //- gap size in metre const scalar gap_; //- Underlying geometry (size 1) diff --git a/src/meshTools/sets/topoSets/topoSet.C b/src/meshTools/sets/topoSets/topoSet.C index 561d9fbe46..299d452629 100644 --- a/src/meshTools/sets/topoSets/topoSet.C +++ b/src/meshTools/sets/topoSets/topoSet.C @@ -269,7 +269,7 @@ void Foam::topoSet::writeDebug boundBox bb(pointField(coords, toc()), true); os << "Set bounding box: min = " - << bb.min() << " max = " << bb.max() << " meters. " << endl << endl; + << bb.min() << " max = " << bb.max() << " metres. " << endl << endl; label n = 0; From 02119af2c68bf204a7087620bda44d3d22fca962 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 3 May 2013 10:36:30 +0100 Subject: [PATCH 02/41] STYLE: Updated copyright year --- src/mesh/blockMesh/blockMesh/blockMesh.H | 2 +- src/meshTools/searchableSurface/searchableSurfaceWithGaps.H | 2 +- src/meshTools/sets/topoSets/topoSet.C | 2 +- src/regionModels/regionModel/regionModel/regionModel.C | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/mesh/blockMesh/blockMesh/blockMesh.H b/src/mesh/blockMesh/blockMesh/blockMesh.H index 9e18adf773..e3a6619ce9 100644 --- a/src/mesh/blockMesh/blockMesh/blockMesh.H +++ b/src/mesh/blockMesh/blockMesh/blockMesh.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H index 1098f2631f..1344cda2d9 100644 --- a/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H +++ b/src/meshTools/searchableSurface/searchableSurfaceWithGaps.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/meshTools/sets/topoSets/topoSet.C b/src/meshTools/sets/topoSets/topoSet.C index 299d452629..37fe9a0595 100644 --- a/src/meshTools/sets/topoSets/topoSet.C +++ b/src/meshTools/sets/topoSets/topoSet.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index 125f48c634..292dbe5e5a 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License From c52a2900e790abd6a7ee75d5f48097a04431e880 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 3 May 2013 10:39:38 +0100 Subject: [PATCH 03/41] ENH: Updated syntax change due to wordRe cunstructors --- .../PV398FoamReader/vtkPV398Foam/vtkPV398FoamMesh.C | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/applications/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMesh.C b/applications/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMesh.C index b4fc7858b2..c04f2be85a 100644 --- a/applications/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMesh.C +++ b/applications/utilities/postProcessing/graphics/PV398Readers/PV398FoamReader/vtkPV398Foam/vtkPV398FoamMesh.C @@ -179,12 +179,13 @@ void Foam::vtkPV398Foam::convertMeshPatches const word patchName = getPartName(partId); - labelHashSet patchIds(patches.patchSet(List(1, patchName))); + labelHashSet + patchIds(patches.patchSet(List(1, wordRe(patchName)))); if (debug) { Info<< "Creating VTK mesh for patches [" << patchIds <<"] " - << patchName << endl; + << patchName << endl; } vtkPolyData* vtkmesh = NULL; From 620f16b06e492a1be8fe11ed92265a48469c602d Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 3 May 2013 10:42:36 +0100 Subject: [PATCH 04/41] BUG: Renamed fluidThermo[Cloud|Parcel] back to basicThermo[Cloud|Parcel] --- .../coalChemistryFoam/coalChemistryFoam.C | 2 +- .../coalChemistryFoam/createClouds.H | 2 +- .../basicThermoCloud.H} | 12 +++++----- .../basicThermoParcel.H} | 12 +++++----- .../defineBasicThermoParcel.C | 6 ++--- .../makeBasicThermoParcelSubmodels.C | 22 ++++++++++--------- 6 files changed, 29 insertions(+), 27 deletions(-) rename src/lagrangian/intermediate/clouds/derived/{fluidThermoCloud/fluidThermoCloud.H => basicThermoCloud/basicThermoCloud.H} (90%) rename src/lagrangian/intermediate/parcels/derived/{fluidThermoParcel/fluidThermoParcel.H => basicThermoParcel/basicThermoParcel.H} (88%) rename src/lagrangian/intermediate/parcels/derived/{fluidThermoParcel => basicThermoParcel}/defineBasicThermoParcel.C (89%) rename src/lagrangian/intermediate/parcels/derived/{fluidThermoParcel => basicThermoParcel}/makeBasicThermoParcelSubmodels.C (72%) diff --git a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C index 208b7b9ce9..475e48a1cc 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C +++ b/applications/solvers/lagrangian/coalChemistryFoam/coalChemistryFoam.C @@ -37,7 +37,7 @@ Description #include "fvCFD.H" #include "turbulenceModel.H" -#include "fluidThermoCloud.H" +#include "basicThermoCloud.H" #include "coalCloud.H" #include "psiCombustionModel.H" #include "fvIOoptionList.H" diff --git a/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H b/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H index 87c882c9a6..5dcfe1df4f 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H +++ b/applications/solvers/lagrangian/coalChemistryFoam/createClouds.H @@ -9,7 +9,7 @@ coalCloud coalParcels ); Info<< "\nConstructing limestone cloud" << endl; -fluidThermoCloud limestoneParcels +basicThermoCloud limestoneParcels ( "limestoneCloud1", rho, diff --git a/src/lagrangian/intermediate/clouds/derived/fluidThermoCloud/fluidThermoCloud.H b/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H similarity index 90% rename from src/lagrangian/intermediate/clouds/derived/fluidThermoCloud/fluidThermoCloud.H rename to src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H index 5f024b0ee0..6894a2964a 100644 --- a/src/lagrangian/intermediate/clouds/derived/fluidThermoCloud/fluidThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H @@ -22,18 +22,18 @@ License along with OpenFOAM. If not, see . Class - Foam::fluidThermoCloud + Foam::basicThermoCloud Description Cloud class to introduce thermodynamic parcels \*---------------------------------------------------------------------------*/ -#ifndef fluidThermoCloud_H -#define fluidThermoCloud_H +#ifndef basicThermoCloud_H +#define basicThermoCloud_H #include "ThermoCloud.H" -#include "fluidThermoParcel.H" +#include "basicThermoParcel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,10 +45,10 @@ namespace Foam < Cloud < - fluidThermoParcel + basicThermoParcel > > - > fluidThermoCloud; + > basicThermoCloud; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/fluidThermoParcel.H b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H similarity index 88% rename from src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/fluidThermoParcel.H rename to src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H index 12e863b7b8..5deee9a015 100644 --- a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/fluidThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H @@ -22,18 +22,18 @@ License along with OpenFOAM. If not, see . Class - Foam::fluidThermoParcel + Foam::basicThermoParcel Description Definition of basic thermo parcel SourceFiles - fluidThermoParcel.C + basicThermoParcel.C \*---------------------------------------------------------------------------*/ -#ifndef fluidThermoParcel_H -#define fluidThermoParcel_H +#ifndef basicThermoParcel_H +#define basicThermoParcel_H #include "contiguous.H" #include "particle.H" @@ -44,10 +44,10 @@ SourceFiles namespace Foam { - typedef ThermoParcel > fluidThermoParcel; + typedef ThermoParcel > basicThermoParcel; template<> - inline bool contiguous() + inline bool contiguous() { return true; } diff --git a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/defineBasicThermoParcel.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/defineBasicThermoParcel.C similarity index 89% rename from src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/defineBasicThermoParcel.C rename to src/lagrangian/intermediate/parcels/derived/basicThermoParcel/defineBasicThermoParcel.C index 45381d280d..605fd6b2f7 100644 --- a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/defineBasicThermoParcel.C +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/defineBasicThermoParcel.C @@ -23,15 +23,15 @@ License \*---------------------------------------------------------------------------*/ -#include "fluidThermoParcel.H" +#include "basicThermoParcel.H" #include "Cloud.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - defineTemplateTypeNameAndDebug(fluidThermoParcel, 0); - defineTemplateTypeNameAndDebug(Cloud, 0); + defineTemplateTypeNameAndDebug(basicThermoParcel, 0); + defineTemplateTypeNameAndDebug(Cloud, 0); } // ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/makeBasicThermoParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C similarity index 72% rename from src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/makeBasicThermoParcelSubmodels.C rename to src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C index 1a685395ae..ba6d30bb91 100644 --- a/src/lagrangian/intermediate/parcels/derived/fluidThermoParcel/makeBasicThermoParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/makeBasicThermoParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "fluidThermoCloud.H" +#include "basicThermoCloud.H" #include "makeParcelCloudFunctionObjects.H" @@ -32,26 +32,28 @@ License #include "makeParcelDispersionModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelPatchInteractionModels.H" +#include "makeParcelStochasticCollisionModels.H" +#include "makeThermoParcelSurfaceFilmModels.H" // thermo variant // Thermodynamic #include "makeParcelHeatTransferModels.H" -#include "makeThermoParcelSurfaceFilmModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - makeParcelCloudFunctionObjects(fluidThermoCloud); + makeParcelCloudFunctionObjects(basicThermoCloud); // Kinematic sub-models - makeThermoParcelForces(fluidThermoCloud); - makeParcelDispersionModels(fluidThermoCloud); - makeParcelInjectionModels(fluidThermoCloud); - makeParcelPatchInteractionModels(fluidThermoCloud); + makeThermoParcelForces(basicThermoCloud); + makeParcelDispersionModels(basicThermoCloud); + makeParcelInjectionModels(basicThermoCloud); + makeParcelPatchInteractionModels(basicThermoCloud); + makeParcelStochasticCollisionModels(basicThermoCloud); + makeParcelSurfaceFilmModels(basicThermoCloud); // Thermo sub-models - makeParcelHeatTransferModels(fluidThermoCloud); - makeParcelSurfaceFilmModels(fluidThermoCloud); + makeParcelHeatTransferModels(basicThermoCloud); } From 8bae3f6513dded896db059183fb04d708f802b3e Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 3 May 2013 10:43:13 +0100 Subject: [PATCH 05/41] STYLE: Corrected header documentation --- .../incompressible/LES/dynLagrangian/dynLagrangian.H | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H b/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H index 4809ee902a..5b359e13d7 100644 --- a/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H +++ b/src/turbulenceModels/incompressible/LES/dynLagrangian/dynLagrangian.H @@ -49,7 +49,7 @@ Description d/dt(fmm) + div(U*fmm) = - (1/T)*(M && M - flm) + (1/T)*(M && M - fmm) where From 5522acf7fdf7d1b0384e5729282023e9ff6065e7 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 3 May 2013 10:46:57 +0100 Subject: [PATCH 06/41] BUG: Added missing hook to postMove() - mantis #829 --- .../parcels/Templates/CollidingParcel/CollidingParcel.C | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C index 186fbff0cf..97c531b21f 100644 --- a/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/CollidingParcel/CollidingParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -138,6 +138,8 @@ bool Foam::CollidingParcel::move } p.age() += dt; + + td.cloud().functions().postMove(p, cellI, dt, td.keepParticle); } break; From 9007b14697b06fe5fcc8d05db534b91931543e4b Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 3 May 2013 11:11:56 +0100 Subject: [PATCH 07/41] ENH: Added mu and sigma properties to sprayParcel --- .../Templates/SprayParcel/SprayParcel.C | 45 +++---- .../Templates/SprayParcel/SprayParcel.H | 86 ++++++++++++ .../Templates/SprayParcel/SprayParcelI.H | 122 +++++++++++++++++- .../Templates/SprayParcel/SprayParcelIO.C | 26 ++++ 4 files changed, 248 insertions(+), 31 deletions(-) diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C index b93d687c20..d0d3814bc7 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.C @@ -82,6 +82,7 @@ void Foam::SprayParcel::calc scalar T0 = this->T(); this->Cp() = td.cloud().composition().liquids().Cp(this->pc_, T0, X); + sigma_ = td.cloud().composition().liquids().sigma(this->pc_, T0, X); scalar rho0 = td.cloud().composition().liquids().rho(this->pc_, T0, X); this->rho() = rho0; @@ -89,13 +90,14 @@ void Foam::SprayParcel::calc if (td.keepParticle) { - // update Cp, diameter and density due to change in temperature + // update Cp, sigma, diameter and density due to change in temperature // and/or composition scalar T1 = this->T(); const scalarField& Y1(this->Y()); scalarField X1(td.cloud().composition().liquids().X(Y1)); this->Cp() = td.cloud().composition().liquids().Cp(this->pc_, T1, X1); + sigma_ = td.cloud().composition().liquids().sigma(this->pc_, T1, X); scalar rho1 = td.cloud().composition().liquids().rho(this->pc_, T1, X1); this->rho() = rho1; @@ -139,15 +141,6 @@ void Foam::SprayParcel::calcAtomization const AtomizationModel& atomization = td.cloud().atomization(); - - // cell state info is updated in ReactingParcel calc - const scalarField& Y(this->Y()); - scalarField X(composition.liquids().X(Y)); - - scalar rho = composition.liquids().rho(this->pc(), this->T(), X); - scalar mu = composition.liquids().mu(this->pc(), this->T(), X); - scalar sigma = composition.liquids().sigma(this->pc(), this->T(), X); - // Average molecular weight of carrier mix - assumes perfect gas scalar Wc = this->rhoc_*specie::RR*this->Tc()/this->pc(); scalar R = specie::RR/Wc; @@ -174,7 +167,7 @@ void Foam::SprayParcel::calcAtomization scalar chi = 0.0; if (atomization.calcChi()) { - chi = this->chi(td, X); + chi = this->chi(td, composition.liquids().X(this->Y())); } atomization.update @@ -183,9 +176,9 @@ void Foam::SprayParcel::calcAtomization this->d(), this->liquidCore(), this->tc(), - rho, - mu, - sigma, + this->rho(), + mu_, + sigma_, volFlowRate, rhoAv, Urel, @@ -207,10 +200,6 @@ void Foam::SprayParcel::calcBreakup const label cellI ) { - typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; - const CompositionModel& composition = - td.cloud().composition(); - typedef typename TrackData::cloudType cloudType; typedef typename cloudType::parcelType parcelType; typedef typename cloudType::forceType forceType; @@ -223,14 +212,6 @@ void Foam::SprayParcel::calcBreakup solveTABEq(td, dt); } - // cell state info is updated in ReactingParcel calc - const scalarField& Y(this->Y()); - scalarField X(composition.liquids().X(Y)); - - scalar rho = composition.liquids().rho(this->pc(), this->T(), X); - scalar mu = composition.liquids().mu(this->pc(), this->T(), X); - scalar sigma = composition.liquids().sigma(this->pc(), this->T(), X); - // Average molecular weight of carrier mix - assumes perfect gas scalar Wc = this->rhoc()*specie::RR*this->Tc()/this->pc(); scalar R = specie::RR/Wc; @@ -266,9 +247,9 @@ void Foam::SprayParcel::calcBreakup this->y(), this->yDot(), this->d0(), - rho, - mu, - sigma, + this->rho(), + mu_, + sigma_, this->U(), rhoAv, muAv, @@ -287,7 +268,7 @@ void Foam::SprayParcel::calcBreakup SprayParcel* child = new SprayParcel(*this); child->mass0() = massChild; child->d() = dChild; - child->nParticle() = massChild/rho*this->volume(dChild); + child->nParticle() = massChild/this->rho()*this->volume(dChild); const forceSuSp Fcp = forces.calcCoupled(*child, dt, massChild, Re, muAv); @@ -447,6 +428,8 @@ Foam::SprayParcel::SprayParcel(const SprayParcel& p) ParcelType(p), d0_(p.d0_), position0_(p.position0_), + sigma_(p.sigma_), + mu_(p.mu_), liquidCore_(p.liquidCore_), KHindex_(p.KHindex_), y_(p.y_), @@ -469,6 +452,8 @@ Foam::SprayParcel::SprayParcel ParcelType(p, mesh), d0_(p.d0_), position0_(p.position0_), + sigma_(p.sigma_), + mu_(p.mu_), liquidCore_(p.liquidCore_), KHindex_(p.KHindex_), y_(p.y_), diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H index 19529b7d0b..b068e43e09 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H @@ -59,6 +59,74 @@ class SprayParcel public ParcelType { +public: + + //- Class to hold reacting particle constant properties + class constantProperties + : + public ParcelType::constantProperties + { + // Private data + + //- Particle initial surface tension [N/m] + scalar sigma0_; + + //- Particle initial dynamic viscosity [Pa.s] + scalar mu0_; + + + public: + + // Constructors + + //- Null constructor + constantProperties(); + + //- Copy constructor + constantProperties(const constantProperties& cp); + + //- Constructor from dictionary + constantProperties + ( + const dictionary& parentDict, + const bool readFields = true + ); + + //- Construct from components + constantProperties + ( + const label parcelTypeId, + const scalar rhoMin, + const scalar rho0, + const scalar minParticleMass, + const scalar youngsModulus, + const scalar poissonsRatio, + const scalar T0, + const scalar TMin, + const scalar TMax, + const scalar Cp0, + const scalar epsilon0, + const scalar f0, + const scalar Pr, + const scalar pMin, + const Switch& constantVolume, + const scalar Tvap, + const scalar Tbp, + const scalar sigma0, + const scalar mu0 + ); + + + // Access + + //- Return const access to the initial surface tension + inline scalar sigma0() const; + + //- Return const access to the initial dynamic viscosity + inline scalar mu0() const; + }; + + protected: // Protected data @@ -71,6 +139,12 @@ protected: //- Injection position vector position0_; + //- Liquid surface tension [N/m] + scalar sigma_; + + //- Liquid dynamic viscosity [Pa.s] + scalar mu_; + //- Part of liquid core ( >0.5=liquid, <0.5=droplet ) scalar liquidCore_; @@ -219,6 +293,12 @@ public: //- Return const access to initial droplet position inline const vector& position0() const; + //- Return const access to the liquid surface tension + inline scalar sigma() const; + + //- Return const access to the liquid dynamic viscosity + inline scalar mu() const; + //- Return const access to liquid core inline scalar liquidCore() const; @@ -255,6 +335,12 @@ public: //- Return access to initial droplet position inline vector& position0(); + //- Return access to the liquid surface tension + inline scalar& sigma(); + + //- Return access to the liquid dynamic viscosity + inline scalar& mu(); + //- Return access to liquid core inline scalar& liquidCore(); diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H index 0ec6aad0e4..66e5dc616f 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.H +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelI.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,94 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +template +inline Foam::SprayParcel::constantProperties::constantProperties() +: + ParcelType::constantProperties(), + sigma0_(0.0), + mu0_(0.0) +{} + + +template +inline Foam::SprayParcel::constantProperties::constantProperties +( + const constantProperties& cp +) +: + ParcelType::constantProperties(cp), + sigma0_(cp.sigma0_), + mu0_(cp.mu0_) +{} + + +template +inline Foam::SprayParcel::constantProperties::constantProperties +( + const dictionary& parentDict, + const bool readFields +) +: + ParcelType::constantProperties(parentDict, readFields), + sigma0_(0.0), + mu0_(0.0) +{ + if (readFields) + { + this->dict().lookup("sigma0") >> sigma0_; + } +} + + +template +inline Foam::SprayParcel::constantProperties::constantProperties +( + const label parcelTypeId, + const scalar rhoMin, + const scalar rho0, + const scalar minParticleMass, + const scalar youngsModulus, + const scalar poissonsRatio, + const scalar T0, + const scalar TMin, + const scalar TMax, + const scalar Cp0, + const scalar epsilon0, + const scalar f0, + const scalar Pr, + const scalar pMin, + const Switch& constantVolume, + const scalar Tvap, + const scalar Tbp, + const scalar sigma0, + const scalar mu0 +) +: + ParcelType::constantProperties + ( + parcelTypeId, + rhoMin, + rho0, + minParticleMass, + youngsModulus, + poissonsRatio, + T0, + TMin, + TMax, + Cp0, + epsilon0, + f0, + Pr, + pMin, + constantVolume, + Tvap, + Tbp + ), + sigma0_(sigma0), + mu0_(mu0) +{} + + template inline Foam::SprayParcel::SprayParcel ( @@ -38,6 +126,8 @@ inline Foam::SprayParcel::SprayParcel ParcelType(mesh, position, cellI, tetFaceI, tetPtI), d0_(this->d()), position0_(position), + sigma_(0.0), + mu_(0.0), liquidCore_(0.0), KHindex_(0.0), y_(0.0), @@ -99,6 +189,8 @@ inline Foam::SprayParcel::SprayParcel ), d0_(d0), position0_(position), + sigma_(constProps.sigma0()), + mu_(constProps.mu0()), liquidCore_(liquidCore), KHindex_(KHindex), y_(y), @@ -127,6 +219,20 @@ inline const Foam::vector& Foam::SprayParcel::position0() const } +template +inline Foam::scalar Foam::SprayParcel::sigma() const +{ + return sigma_; +} + + +template +inline Foam::scalar Foam::SprayParcel::mu() const +{ + return mu_; +} + + template inline Foam::scalar Foam::SprayParcel::liquidCore() const { @@ -204,6 +310,20 @@ inline Foam::vector& Foam::SprayParcel::position0() } +template +inline Foam::scalar& Foam::SprayParcel::sigma() +{ + return sigma_; +} + + +template +inline Foam::scalar& Foam::SprayParcel::mu() +{ + return mu_; +} + + template inline Foam::scalar& Foam::SprayParcel::liquidCore() { diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C index f4d443f92a..6708e73e7b 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcelIO.C @@ -33,6 +33,8 @@ Foam::string Foam::SprayParcel::propHeader = ParcelType::propHeader + " d0" + " position0" + + " sigma" + + " mu" + " liquidCore" + " KHindex" + " y" @@ -57,6 +59,8 @@ Foam::SprayParcel::SprayParcel ParcelType(mesh, is, readFields), d0_(0.0), position0_(vector::zero), + sigma_(0.0), + mu_(0.0), liquidCore_(0.0), KHindex_(0.0), y_(0.0), @@ -74,6 +78,8 @@ Foam::SprayParcel::SprayParcel { d0_ = readScalar(is); is >> position0_; + sigma_ = readScalar(is); + mu_ = readScalar(is); liquidCore_ = readScalar(is); KHindex_ = readScalar(is); y_ = readScalar(is); @@ -91,6 +97,8 @@ Foam::SprayParcel::SprayParcel reinterpret_cast(&d0_), sizeof(d0_) + sizeof(position0_) + + sizeof(sigma_) + + sizeof(mu_) + sizeof(liquidCore_) + sizeof(KHindex_) + sizeof(y_) @@ -154,6 +162,12 @@ void Foam::SprayParcel::readFields ); c.checkFieldIOobject(c, position0); + IOField sigma(c.fieldIOobject("sigma", IOobject::MUST_READ)); + c.checkFieldIOobject(c, sigma); + + IOField mu(c.fieldIOobject("mu", IOobject::MUST_READ)); + c.checkFieldIOobject(c, mu); + IOField liquidCore(c.fieldIOobject ( "liquidCore", IOobject::MUST_READ) @@ -190,6 +204,8 @@ void Foam::SprayParcel::readFields SprayParcel& p = iter(); p.d0_ = d0[i]; p.position0_ = position0[i]; + p.sigma_ = sigma[i]; + p.mu_ = mu[i]; p.liquidCore_ = liquidCore[i]; p.KHindex_ = KHindex[i]; p.y_ = y[i]; @@ -230,6 +246,8 @@ void Foam::SprayParcel::writeFields c.fieldIOobject("position0", IOobject::NO_READ), np ); + IOField sigma(c.fieldIOobject("sigma", IOobject::NO_READ), np); + IOField mu(c.fieldIOobject("mu", IOobject::NO_READ), np); IOField liquidCore ( c.fieldIOobject("liquidCore", IOobject::NO_READ), @@ -254,6 +272,8 @@ void Foam::SprayParcel::writeFields const SprayParcel& p = iter(); d0[i] = p.d0_; position0[i] = p.position0_; + sigma[i] = p.sigma_; + mu[i] = p.mu_; liquidCore[i] = p.liquidCore_; KHindex[i] = p.KHindex_; y[i] = p.y_; @@ -268,6 +288,8 @@ void Foam::SprayParcel::writeFields d0.write(); position0.write(); + sigma.write(); + mu.write(); liquidCore.write(); KHindex.write(); y.write(); @@ -294,6 +316,8 @@ Foam::Ostream& Foam::operator<< os << static_cast(p) << token::SPACE << p.d0() << token::SPACE << p.position0() + << token::SPACE << p.sigma() + << token::SPACE << p.mu() << token::SPACE << p.liquidCore() << token::SPACE << p.KHindex() << token::SPACE << p.y() @@ -312,6 +336,8 @@ Foam::Ostream& Foam::operator<< reinterpret_cast(&p.d0_), sizeof(p.d0()) + sizeof(p.position0()) + + sizeof(p.sigma()) + + sizeof(p.mu()) + sizeof(p.liquidCore()) + sizeof(p.KHindex()) + sizeof(p.y()) From 794a870587f263758d444ed09cd0506d30a5d261 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 3 May 2013 11:19:43 +0100 Subject: [PATCH 08/41] STYLE: Adding files missed during commit 620f16b --- .../clouds/derived/basicThermoCloud/basicThermoCloud.H | 2 +- .../parcels/derived/basicThermoParcel/basicThermoParcel.H | 2 +- .../parcels/derived/basicThermoParcel/defineBasicThermoParcel.C | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H b/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H index 6894a2964a..00ee07d17e 100644 --- a/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H +++ b/src/lagrangian/intermediate/clouds/derived/basicThermoCloud/basicThermoCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H index 5deee9a015..c7778ac1cf 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/basicThermoParcel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/defineBasicThermoParcel.C b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/defineBasicThermoParcel.C index 605fd6b2f7..7c300a22b5 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/defineBasicThermoParcel.C +++ b/src/lagrangian/intermediate/parcels/derived/basicThermoParcel/defineBasicThermoParcel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License From a1f3c95f9cb26fcec6f89f5d810ae030f611d197 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 3 May 2013 11:33:17 +0100 Subject: [PATCH 09/41] ENH: Migrated stochastic collision models from spray to kinematic clouds, refactored and added models --- src/lagrangian/intermediate/Make/files | 2 +- .../Templates/KinematicCloud/KinematicCloud.C | 17 +- .../Templates/KinematicCloud/KinematicCloud.H | 20 + .../KinematicCloud/KinematicCloudI.H | 55 +++ .../kinematicCloud/kinematicCloud.H | 5 +- .../KinematicParcel/KinematicParcel.H | 5 +- ...keBasicKinematicCollidingParcelSubmodels.C | 4 +- .../makeBasicKinematicParcelSubmodels.C | 4 +- .../makeParcelStochasticCollisionModels.H | 45 +++ ...ultiphaseParcelStochasticCollisionModels.H | 47 +++ .../NoStochasticCollision.C | 44 +-- .../NoStochasticCollision.H | 40 +- .../StochasticCollisionModel.C | 79 +--- .../StochasticCollisionModel.H | 53 +-- .../StochasticCollisionModelNew.C | 8 +- .../SuppressionCollision.C | 91 +++++ .../SuppressionCollision.H | 111 ++++++ .../clouds/Templates/SprayCloud/SprayCloud.C | 146 +------ .../clouds/Templates/SprayCloud/SprayCloud.H | 26 +- .../clouds/Templates/SprayCloud/SprayCloudI.H | 18 +- .../Templates/SprayParcel/SprayParcel.H | 2 +- .../makeBasicSprayParcelSubmodels.C | 6 +- ...akeSprayParcelStochasticCollisionModels.H} | 8 +- .../ORourkeCollision/ORourkeCollision.C | 355 +++++++++--------- .../ORourkeCollision/ORourkeCollision.H | 113 +++--- .../TrajectoryCollision/TrajectoryCollision.C | 323 ++++------------ .../TrajectoryCollision/TrajectoryCollision.H | 98 ++--- 27 files changed, 803 insertions(+), 922 deletions(-) create mode 100644 src/lagrangian/intermediate/parcels/include/makeParcelStochasticCollisionModels.H create mode 100644 src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelStochasticCollisionModels.H rename src/lagrangian/{spray/submodels => intermediate/submodels/Kinematic}/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C (77%) rename src/lagrangian/{spray/submodels => intermediate/submodels/Kinematic}/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H (77%) rename src/lagrangian/{spray/submodels => intermediate/submodels/Kinematic}/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C (63%) rename src/lagrangian/{spray/submodels => intermediate/submodels/Kinematic}/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H (78%) rename src/lagrangian/{spray/submodels => intermediate/submodels/Kinematic}/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C (88%) create mode 100644 src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C create mode 100644 src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.H rename src/lagrangian/spray/parcels/include/{makeSprayParcelCollisionModels.H => makeSprayParcelStochasticCollisionModels.H} (88%) diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index ae4c1f9d66..9165621d6c 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -25,7 +25,7 @@ $(KINEMATICCOLLIDINGPARCEL)/makeBasicKinematicCollidingParcelSubmodels.C /* thermo parcel sub-models */ -THERMOPARCEL=$(DERIVEDPARCELS)/fluidThermoParcel +THERMOPARCEL=$(DERIVEDPARCELS)/basicThermoParcel $(THERMOPARCEL)/defineBasicThermoParcel.C $(THERMOPARCEL)/makeBasicThermoParcelSubmodels.C diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C index 03765b5c57..66e54468e5 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.C @@ -31,6 +31,7 @@ License #include "InjectionModelList.H" #include "DispersionModel.H" #include "PatchInteractionModel.H" +#include "StochasticCollisionModel.H" #include "SurfaceFilmModel.H" // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // @@ -56,6 +57,15 @@ void Foam::KinematicCloud::setModels() ).ptr() ); + stochasticCollisionModel_.reset + ( + StochasticCollisionModel >::New + ( + subModelProperties_, + *this + ).ptr() + ); + surfaceFilmModel_.reset ( SurfaceFilmModel >::New @@ -181,7 +191,6 @@ void Foam::KinematicCloud::evolveCloud(TrackData& td) if (preInjectionSize != this->size()) { updateCellOccupancy(); - preInjectionSize = this->size(); } @@ -191,6 +200,8 @@ void Foam::KinematicCloud::evolveCloud(TrackData& td) // Assume that motion will update the cellOccupancy as necessary // before it is required. td.cloud().motion(td); + + stochasticCollision().update(solution_.trackTime()); } else { @@ -249,6 +260,7 @@ void Foam::KinematicCloud::cloudReset(KinematicCloud& c) dispersionModel_.reset(c.dispersionModel_.ptr()); patchInteractionModel_.reset(c.patchInteractionModel_.ptr()); + stochasticCollisionModel_.reset(c.stochasticCollisionModel_.ptr()); surfaceFilmModel_.reset(c.surfaceFilmModel_.ptr()); UIntegrator_.reset(c.UIntegrator_.ptr()); @@ -338,6 +350,7 @@ Foam::KinematicCloud::KinematicCloud ), dispersionModel_(NULL), patchInteractionModel_(NULL), + stochasticCollisionModel_(NULL), surfaceFilmModel_(NULL), UIntegrator_(NULL), UTrans_ @@ -418,6 +431,7 @@ Foam::KinematicCloud::KinematicCloud injectors_(c.injectors_), dispersionModel_(c.dispersionModel_->clone()), patchInteractionModel_(c.patchInteractionModel_->clone()), + stochasticCollisionModel_(c.stochasticCollisionModel_->clone()), surfaceFilmModel_(c.surfaceFilmModel_->clone()), UIntegrator_(c.UIntegrator_->clone()), UTrans_ @@ -507,6 +521,7 @@ Foam::KinematicCloud::KinematicCloud injectors_(*this), dispersionModel_(NULL), patchInteractionModel_(NULL), + stochasticCollisionModel_(NULL), surfaceFilmModel_(NULL), UIntegrator_(NULL), UTrans_(NULL), diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H index 7cf68d8d5b..cae86032ca 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloud.H @@ -39,6 +39,7 @@ Description - dispersion model - injection model - patch interaction model + - stochastic collision model - surface film model SourceFiles @@ -84,6 +85,9 @@ class PatchInteractionModel; template class SurfaceFilmModel; +template +class StochasticCollisionModel; + /*---------------------------------------------------------------------------*\ Class KinematicCloud Declaration @@ -203,6 +207,10 @@ protected: autoPtr > > patchInteractionModel_; + //- Stochastic collision model + autoPtr > > + stochasticCollisionModel_; + //- Surface film model autoPtr > > surfaceFilmModel_; @@ -416,6 +424,15 @@ public: inline PatchInteractionModel >& patchInteraction(); + //- Return const-access to the stochastic collision model + inline const + StochasticCollisionModel >& + stochasticCollision() const; + + //- Return reference to the stochastic collision model + inline StochasticCollisionModel >& + stochasticCollision(); + //- Return const-access to the surface film model inline const SurfaceFilmModel >& surfaceFilm() const; @@ -482,6 +499,9 @@ public: // Fields + //- Volume swept rate of parcels per cell + inline const tmp vDotSweep() const; + //- Return the particle volume fraction field // Note: for particles belonging to this cloud only inline const tmp theta() const; diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index 7e50b0b67c..f99bb8c57c 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -204,6 +204,22 @@ Foam::KinematicCloud::patchInteraction() } +template +inline const Foam::StochasticCollisionModel >& +Foam::KinematicCloud::stochasticCollision() const +{ + return stochasticCollisionModel_(); +} + + +template +inline Foam::StochasticCollisionModel >& +Foam::KinematicCloud::stochasticCollision() +{ + return stochasticCollisionModel_(); +} + + template inline const Foam::SurfaceFilmModel >& Foam::KinematicCloud::surfaceFilm() const @@ -571,6 +587,45 @@ Foam::KinematicCloud::SU(volVectorField& U) const } +template +inline const Foam::tmp +Foam::KinematicCloud::vDotSweep() const +{ + tmp tvDotSweep + ( + new volScalarField + ( + IOobject + ( + this->name() + ":vDotSweep", + this->db().time().timeName(), + this->db(), + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh_, + dimensionedScalar("zero", dimless/dimTime, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + volScalarField& vDotSweep = tvDotSweep(); + forAllConstIter(typename KinematicCloud, *this, iter) + { + const parcelType& p = iter(); + const label cellI = p.cell(); + + vDotSweep[cellI] += p.nParticle()*p.areaP()*mag(p.U() - U_[cellI]); + } + + vDotSweep.internalField() /= mesh_.V(); + vDotSweep.correctBoundaryConditions(); + + return vDotSweep; +} + + template inline const Foam::tmp Foam::KinematicCloud::theta() const diff --git a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H index d7a0fcf0d0..84a98dd6b7 100644 --- a/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H +++ b/src/lagrangian/intermediate/clouds/baseClasses/kinematicCloud/kinematicCloud.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -100,6 +100,9 @@ public: // Fields + //- Volume swept rate of parcels per cell + virtual const tmp vDotSweep() const = 0; + //- Return the particle volume fraction field // Note: for particles belonging to this cloud only virtual const tmp theta() const = 0; diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H index ee860ad478..3460fe401b 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -520,8 +520,7 @@ public: // Helper functions - //- Return the index of the face to be used in the interpolation - // routine + //- Return the index of the face used in the interpolation routine inline label faceInterpolation() const; //- Cell owner mass diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicCollidingParcel/makeBasicKinematicCollidingParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicCollidingParcel/makeBasicKinematicCollidingParcelSubmodels.C index 5ed566d4b9..b07c64638e 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicCollidingParcel/makeBasicKinematicCollidingParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicCollidingParcel/makeBasicKinematicCollidingParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,6 +33,7 @@ License #include "makeParcelInjectionModels.H" #include "makeParcelCollisionModels.H" #include "makeParcelPatchInteractionModels.H" +#include "makeParcelStochasticCollisionModels.H" #include "makeParcelSurfaceFilmModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,6 +48,7 @@ namespace Foam makeParcelInjectionModels(basicKinematicCollidingCloud); makeParcelCollisionModels(basicKinematicCollidingCloud); makeParcelPatchInteractionModels(basicKinematicCollidingCloud); + makeParcelStochasticCollisionModels(basicKinematicCollidingCloud); makeParcelSurfaceFilmModels(basicKinematicCollidingCloud); } diff --git a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C index 8ad6216172..1aaa9590fc 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicKinematicParcel/makeBasicKinematicParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,6 +32,7 @@ License #include "makeParcelDispersionModels.H" #include "makeParcelInjectionModels.H" #include "makeParcelPatchInteractionModels.H" +#include "makeParcelStochasticCollisionModels.H" #include "makeParcelSurfaceFilmModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,6 +46,7 @@ namespace Foam makeParcelDispersionModels(basicKinematicCloud); makeParcelInjectionModels(basicKinematicCloud); makeParcelPatchInteractionModels(basicKinematicCloud); + makeParcelStochasticCollisionModels(basicKinematicCloud); makeParcelSurfaceFilmModels(basicKinematicCloud); } diff --git a/src/lagrangian/intermediate/parcels/include/makeParcelStochasticCollisionModels.H b/src/lagrangian/intermediate/parcels/include/makeParcelStochasticCollisionModels.H new file mode 100644 index 0000000000..e949d6e0ad --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeParcelStochasticCollisionModels.H @@ -0,0 +1,45 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef makeParcelStochasticCollisionModels_H +#define makeParcelStochasticCollisionModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "NoStochasticCollision.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeParcelStochasticCollisionModels(CloudType) \ + \ + makeStochasticCollisionModel(CloudType); \ + makeStochasticCollisionModelType(NoStochasticCollision, CloudType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelStochasticCollisionModels.H b/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelStochasticCollisionModels.H new file mode 100644 index 0000000000..ea8436b119 --- /dev/null +++ b/src/lagrangian/intermediate/parcels/include/makeReactingMultiphaseParcelStochasticCollisionModels.H @@ -0,0 +1,47 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef makeReactingMultiphaseParcelStochasticCollisionModels_H +#define makeReactingMultiphaseParcelStochasticCollisionModels_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "NoStochasticCollision.H" +#include "SuppressionCollision.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeReactingMultiphaseParcelStochasticCollisionModels(CloudType) \ + \ + makeStochasticCollisionModel(CloudType); \ + makeStochasticCollisionModelType(NoStochasticCollision, CloudType); \ + makeStochasticCollisionModelType(SuppressionCollision, CloudType); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C similarity index 77% rename from src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C rename to src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C index 024ccd313f..563c0caaef 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,15 @@ License #include "NoStochasticCollision.H" +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template +void Foam::NoStochasticCollision::collide(const scalar) +{ + // do nothing +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -64,37 +73,4 @@ bool Foam::NoStochasticCollision::active() const } -template -bool Foam::NoStochasticCollision::update -( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const -{ - return false; -} - - // ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H similarity index 77% rename from src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H rename to src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H index 0e93cbc031..81338611e3 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/NoStochasticCollision/NoStochasticCollision.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/NoStochasticCollision/NoStochasticCollision.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ Description namespace Foam { /*---------------------------------------------------------------------------*\ - Class NoStochasticCollision Declaration + Class NoStochasticCollision Declaration \*---------------------------------------------------------------------------*/ template @@ -47,6 +47,14 @@ class NoStochasticCollision : public StochasticCollisionModel { +protected: + + // Protected Member Functions + + //- Update the model + virtual void collide(const scalar dt); + + public: //- Runtime type information @@ -79,34 +87,6 @@ public: //- Flag to indicate whether model activates collision model virtual bool active() const; - - virtual bool update - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; }; diff --git a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C similarity index 63% rename from src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C rename to src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C index fa22d59f0b..f177613232 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,18 @@ License #include "StochasticCollisionModel.H" +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template +void Foam::StochasticCollisionModel::collide(const scalar dt) +{ + notImplemented + ( + "void Foam::NoStochasticCollision::collide(const scalar)" + ); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -69,66 +81,12 @@ Foam::StochasticCollisionModel::~StochasticCollisionModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -bool Foam::StochasticCollisionModel::update -( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const +void Foam::StochasticCollisionModel::update(const scalar dt) { - notImplemented - ( - "bool Foam::StochasticCollisionModel::update" - "(" - "const scalar, " - "cachedRandom&, " - "vector&, " - "scalar&, " - "scalar&, " - "scalar&, " - "vector&, " - "scalar&, " - "scalar&, " - "scalarField&, " - "const scalar, " - "const label, " - "const scalar, " - "vector&, " - "scalar&, " - "scalar&, " - "scalar&, " - "vector&, " - "scalar&, " - "scalar&, " - "scalarField&, " - "const scalar, " - "const label, " - "const scalar" - ") const" - ); - - return false; + if (this->active()) + { + this->collide(dt); + } } @@ -137,4 +95,3 @@ bool Foam::StochasticCollisionModel::update #include "StochasticCollisionModelNew.C" // ************************************************************************* // - diff --git a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H similarity index 78% rename from src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H rename to src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H index 87ebafab24..0ca8935b18 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModel.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,6 +55,12 @@ class StochasticCollisionModel : public SubModelBase { +protected: + + //- Main collision routine + virtual void collide(const scalar dt); + + public: //- Runtime type information @@ -114,33 +120,8 @@ public: // Member Functions - virtual bool update - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; + //- Update the model + void update(const scalar dt); }; @@ -152,27 +133,27 @@ public: #define makeStochasticCollisionModel(CloudType) \ \ - typedef CloudType::sprayCloudType sprayCloudType; \ + typedef CloudType::kinematicCloudType kinematicCloudType; \ defineNamedTemplateTypeNameAndDebug \ ( \ - StochasticCollisionModel, \ + StochasticCollisionModel, \ 0 \ ); \ defineTemplateRunTimeSelectionTable \ ( \ - StochasticCollisionModel, \ + StochasticCollisionModel, \ dictionary \ ); #define makeStochasticCollisionModelType(SS, CloudType) \ \ - typedef CloudType::sprayCloudType sprayCloudType; \ - defineNamedTemplateTypeNameAndDebug(SS, 0); \ + typedef CloudType::kinematicCloudType kinematicCloudType; \ + defineNamedTemplateTypeNameAndDebug(SS, 0); \ \ - StochasticCollisionModel:: \ - adddictionaryConstructorToTable > \ - add##SS##CloudType##sprayCloudType##ConstructorToTable_; + StochasticCollisionModel:: \ + adddictionaryConstructorToTable > \ + add##SS##CloudType##kinematicCloudType##ConstructorToTable_; diff --git a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C similarity index 88% rename from src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C rename to src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C index 1cfc31a16f..5c2a4b80f0 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/StochasticCollision/StochasticCollisionModel/StochasticCollisionModelNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,7 +37,7 @@ Foam::StochasticCollisionModel::New { word modelType(dict.lookup("stochasticCollisionModel")); - Info<< "Selecting StochasticCollisionModel " << modelType << endl; + Info<< "Selecting stochastic collision model " << modelType << endl; typename dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(modelType); @@ -51,9 +51,9 @@ Foam::StochasticCollisionModel::New "const dictionary&, " "CloudType&" ")" - ) << "Unknown StochasticCollisionModelType type " + ) << "Unknown model type type " << modelType << ", constructor not in hash table" << nl << nl - << " Valid StochasticCollisionModel types are:" << nl + << " Valid model types are:" << nl << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C new file mode 100644 index 0000000000..c25cc8b646 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C @@ -0,0 +1,91 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 . + +\*---------------------------------------------------------------------------*/ + +#include "SuppressionCollision.H" +#include "kinematicCloud.H" + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +template +void Foam::SuppressionCollision::collide(const scalar dt) +{ + const kinematicCloud& sc = + this->owner().mesh().template + lookupObject(suppressionCloud_); + + volScalarField vDotSweep(sc.vDotSweep()); + volScalarField P(type() + ":p", 1.0 - exp(-vDotSweep*dt)); + + forAllIter(typename CloudType, this->owner(), iter) + { + typename CloudType::parcelType& p = iter(); + label cellI = p.cell(); + + scalar xx = this->owner().rndGen().template sample01(); + + if (xx < P[cellI]) + { + p.canCombust() = -1; + p.typeId() = max(p.typeId(), suppressedParcelType_); + } + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::SuppressionCollision::SuppressionCollision +( + const dictionary& dict, + CloudType& owner +) +: + StochasticCollisionModel(owner), + suppressionCloud_(dict.lookup("suppressionCloud")), + suppressedParcelType_(dict.lookupOrDefault("suppressedParcelType", -1)) +{} + + +template +Foam::SuppressionCollision::SuppressionCollision +( + const SuppressionCollision& cm +) +: + StochasticCollisionModel(cm), + suppressionCloud_(cm.suppressionCloud_), + suppressedParcelType_(cm.suppressedParcelType_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::SuppressionCollision::~SuppressionCollision() +{} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.H new file mode 100644 index 0000000000..5d02ad4843 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 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 . + +Class + Foam::SuppressionCollision + +Description + Inter-cloud collision model, whereby the \c canReact flag can be used + to inhibit devolatilisation and surface reactions + +\*---------------------------------------------------------------------------*/ + +#ifndef SuppressionCollision_H +#define SuppressionCollision_H + +#include "StochasticCollisionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class SuppressionCollision Declaration +\*---------------------------------------------------------------------------*/ + +template +class SuppressionCollision +: + public StochasticCollisionModel +{ +protected: + + // Protected data + + //- Name of cloud used for suppression + const word suppressionCloud_; + + //- Suppressed parcel type - optional + const label suppressedParcelType_; + + + // Protected Member Functions + + //- Update the model + virtual void collide(const scalar dt); + + +public: + + //- Runtime type information + TypeName("suppressionCollision"); + + + // Constructors + + //- Construct from dictionary + SuppressionCollision(const dictionary& dict, CloudType& owner); + + //- Construct copy + SuppressionCollision(const SuppressionCollision& cm); + + //- Construct and return a clone + virtual autoPtr > clone() const + { + return autoPtr > + ( + new SuppressionCollision(*this) + ); + } + + + //- Destructor + virtual ~SuppressionCollision(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "SuppressionCollision.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C index bf418468bd..4bc55c989e 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,6 @@ License #include "SprayCloud.H" #include "AtomizationModel.H" #include "BreakupModel.H" -#include "StochasticCollisionModel.H" // * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // @@ -50,15 +49,6 @@ void Foam::SprayCloud::setModels() *this ).ptr() ); - - stochasticCollisionModel_.reset - ( - StochasticCollisionModel >::New - ( - this->subModelProperties(), - *this - ).ptr() - ); } @@ -72,7 +62,6 @@ void Foam::SprayCloud::cloudReset atomizationModel_.reset(c.atomizationModel_.ptr()); breakupModel_.reset(c.breakupModel_.ptr()); - stochasticCollisionModel_.reset(c.stochasticCollisionModel_.ptr()); } @@ -94,8 +83,7 @@ Foam::SprayCloud::SprayCloud cloudCopyPtr_(NULL), averageParcelMass_(0.0), atomizationModel_(NULL), - breakupModel_(NULL), - stochasticCollisionModel_(NULL) + breakupModel_(NULL) { if (this->solution().active()) { @@ -130,8 +118,7 @@ Foam::SprayCloud::SprayCloud cloudCopyPtr_(NULL), averageParcelMass_(c.averageParcelMass_), atomizationModel_(c.atomizationModel_->clone()), - breakupModel_(c.breakupModel_->clone()), - stochasticCollisionModel_(c.stochasticCollisionModel_->clone()) + breakupModel_(c.breakupModel_->clone()) {} @@ -148,8 +135,7 @@ Foam::SprayCloud::SprayCloud cloudCopyPtr_(NULL), averageParcelMass_(0.0), atomizationModel_(NULL), - breakupModel_(NULL), - stochasticCollisionModel_(NULL) + breakupModel_(NULL) {} @@ -179,6 +165,8 @@ void Foam::SprayCloud::setParcelThermoProperties // override rho and Cp from constantProperties parcel.Cp() = liqMix.Cp(parcel.pc(), parcel.T(), X); parcel.rho() = liqMix.rho(parcel.pc(), parcel.T(), X); + parcel.sigma() = liqMix.sigma(parcel.pc(), parcel.T(), X); + parcel.mu() = liqMix.mu(parcel.pc(), parcel.T(), X); } @@ -237,128 +225,6 @@ void Foam::SprayCloud::evolve() } -template -template -void Foam::SprayCloud::motion(TrackData& td) -{ - const scalar dt = this->solution().trackTime(); - - td.part() = TrackData::tpLinearTrack; - CloudType::move(td, dt); - - this->updateCellOccupancy(); - - if (stochasticCollision().active()) - { - const liquidMixtureProperties& liqMix = this->composition().liquids(); - - label i = 0; - forAllIter(typename SprayCloud, *this, iter) - { - label j = 0; - forAllIter(typename SprayCloud, *this, jter) - { - if (j > i) - { - parcelType& p = iter(); - scalar Vi = this->mesh().V()[p.cell()]; - scalarField X1(liqMix.X(p.Y())); - scalar sigma1 = liqMix.sigma(p.pc(), p.T(), X1); - scalar mp = p.mass()*p.nParticle(); - - parcelType& q = jter(); - scalar Vj = this->mesh().V()[q.cell()]; - scalarField X2(liqMix.X(q.Y())); - scalar sigma2 = liqMix.sigma(q.pc(), q.T(), X2); - scalar mq = q.mass()*q.nParticle(); - - bool updateProperties = stochasticCollision().update - ( - dt, - this->rndGen(), - p.position(), - mp, - p.d(), - p.nParticle(), - p.U(), - p.rho(), - p.T(), - p.Y(), - sigma1, - p.cell(), - Vi, - q.position(), - mq, - q.d(), - q.nParticle(), - q.U(), - q.rho(), - q.T(), - q.Y(), - sigma2, - q.cell(), - Vj - ); - - // for coalescence we need to update the density and - // the diameter cause of the temp/conc/mass-change - if (updateProperties) - { - if (mp > VSMALL) - { - scalarField Xp(liqMix.X(p.Y())); - p.rho() = liqMix.rho(p.pc(), p.T(), Xp); - p.Cp() = liqMix.Cp(p.pc(), p.T(), Xp); - p.d() = - cbrt - ( - 6.0*mp - /( - p.nParticle() - *p.rho() - *constant::mathematical::pi - ) - ); - } - - if (mq > VSMALL) - { - scalarField Xq(liqMix.X(q.Y())); - q.rho() = liqMix.rho(q.pc(), q.T(), Xq); - q.Cp() = liqMix.Cp(q.pc(), q.T(), Xq); - q.d() = - cbrt - ( - 6.0*mq - /( - q.nParticle() - *q.rho() - *constant::mathematical::pi - ) - ); - } - } - } - j++; - } - i++; - } - - // remove coalesced parcels that fall below minimum mass threshold - forAllIter(typename SprayCloud, *this, iter) - { - parcelType& p = iter(); - scalar mass = p.nParticle()*p.mass(); - - if (mass < td.cloud().constProps().minParticleMass()) - { - this->deleteParticle(p); - } - } - } -} - - template void Foam::SprayCloud::info() { diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.H b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.H index f8ffbbc7df..2055c375e8 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.H +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloud.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,6 +27,10 @@ Class Description Templated base class for spray cloud + - sub-models: + - atomization model + - break-up model + \*---------------------------------------------------------------------------*/ #ifndef SprayCloud_H @@ -46,9 +50,6 @@ class AtomizationModel; template class BreakupModel; -template -class StochasticCollisionModel; - /*---------------------------------------------------------------------------*\ Class SprayCloud Declaration \*---------------------------------------------------------------------------*/ @@ -106,10 +107,6 @@ protected: //- Break-up model autoPtr > > breakupModel_; - //- Collision model - autoPtr > > - stochasticCollisionModel_; - // Protected Member Functions @@ -202,14 +199,6 @@ public: //- Return reference to the breakup model inline BreakupModel >& breakup(); - //- Return const-access to the breakup model - inline const StochasticCollisionModel >& - stochasticCollision() const; - - //- Return reference to the breakup model - inline StochasticCollisionModel >& - stochasticCollision(); - // Cloud evolution functions @@ -236,10 +225,6 @@ public: //- Evolve the spray (inject, move) void evolve(); - //- Particle motion - - template - void motion(TrackData& td); // I-O @@ -249,7 +234,6 @@ public: }; - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H index fc07462670..834dbbddd4 100644 --- a/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.H +++ b/src/lagrangian/spray/clouds/Templates/SprayCloud/SprayCloudI.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,22 +65,6 @@ Foam::SprayCloud::breakup() } -template -inline const Foam::StochasticCollisionModel >& -Foam::SprayCloud::stochasticCollision() const -{ - return stochasticCollisionModel_; -} - - -template -inline Foam::StochasticCollisionModel >& -Foam::SprayCloud::stochasticCollision() -{ - return stochasticCollisionModel_(); -} - - template inline Foam::scalar Foam::SprayCloud::averageParcelMass() const { diff --git a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H index b068e43e09..1ac1663d28 100644 --- a/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.H +++ b/src/lagrangian/spray/parcels/Templates/SprayParcel/SprayParcel.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/spray/parcels/derived/basicSprayParcel/makeBasicSprayParcelSubmodels.C b/src/lagrangian/spray/parcels/derived/basicSprayParcel/makeBasicSprayParcelSubmodels.C index 01a480bab2..3af2751d2f 100644 --- a/src/lagrangian/spray/parcels/derived/basicSprayParcel/makeBasicSprayParcelSubmodels.C +++ b/src/lagrangian/spray/parcels/derived/basicSprayParcel/makeBasicSprayParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,6 +32,7 @@ License #include "makeParcelDispersionModels.H" #include "makeSprayParcelInjectionModels.H" // Spray variant #include "makeParcelPatchInteractionModels.H" +#include "makeSprayParcelStochasticCollisionModels.H" // Spray variant // Thermodynamic #include "makeParcelHeatTransferModels.H" @@ -44,7 +45,6 @@ License // Spray #include "makeSprayParcelAtomizationModels.H" #include "makeSprayParcelBreakupModels.H" -#include "makeSprayParcelCollisionModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,6 +57,7 @@ namespace Foam makeParcelDispersionModels(basicSprayCloud); makeSprayParcelInjectionModels(basicSprayCloud); makeParcelPatchInteractionModels(basicSprayCloud); + makeSprayParcelStochasticCollisionModels(basicSprayCloud); // Thermo sub-models makeParcelHeatTransferModels(basicSprayCloud); @@ -69,7 +70,6 @@ namespace Foam // Spray sub-models makeSprayParcelAtomizationModels(basicSprayCloud); makeSprayParcelBreakupModels(basicSprayCloud); - makeSprayParcelCollisionModels(basicSprayCloud); }; diff --git a/src/lagrangian/spray/parcels/include/makeSprayParcelCollisionModels.H b/src/lagrangian/spray/parcels/include/makeSprayParcelStochasticCollisionModels.H similarity index 88% rename from src/lagrangian/spray/parcels/include/makeSprayParcelCollisionModels.H rename to src/lagrangian/spray/parcels/include/makeSprayParcelStochasticCollisionModels.H index b5fc1ce39b..2d9fdbf4a3 100644 --- a/src/lagrangian/spray/parcels/include/makeSprayParcelCollisionModels.H +++ b/src/lagrangian/spray/parcels/include/makeSprayParcelStochasticCollisionModels.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,8 +23,8 @@ License \*---------------------------------------------------------------------------*/ -#ifndef makeSprayParcelCollisionModels_H -#define makeSprayParcelCollisionModels_H +#ifndef makeSprayParcelStochasticCollisionModels_H +#define makeSprayParcelStochasticCollisionModels_H // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -34,7 +34,7 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define makeSprayParcelCollisionModels(CloudType) \ +#define makeSprayParcelStochasticCollisionModels(CloudType) \ \ makeStochasticCollisionModel(CloudType); \ makeStochasticCollisionModelType(NoStochasticCollision, CloudType); \ diff --git a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C index 793eb50a35..258dd588a3 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C +++ b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.C @@ -24,150 +24,120 @@ License \*---------------------------------------------------------------------------*/ #include "ORourkeCollision.H" +#include "mathematicalConstants.H" +#include "SLGThermo.H" -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +using namespace Foam::constant::mathematical; + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // template -Foam::ORourkeCollision::ORourkeCollision -( - const dictionary& dict, - CloudType& owner -) -: - StochasticCollisionModel(dict, owner, typeName), - coalescence_(this->coeffDict().lookup("coalescence")) -{} +void Foam::ORourkeCollision::collide(const scalar dt) +{ + label i = 0; + forAllIter(typename CloudType, this->owner(), iter1) + { + label j = 0; + forAllIter(typename CloudType, this->owner(), iter2) + { + if (j > i) + { + parcelType& p1 = iter1(); + parcelType& p2 = iter2(); + + scalar m1 = p1.nParticle()*p1.mass(); + scalar m2 = p2.nParticle()*p2.mass(); + + bool massChanged = collideParcels(dt, p1, p2, m1, m2); + + if (massChanged) + { + if (m1 > ROOTVSMALL) + { + const scalarField X(liquids_.X(p1.Y())); + p1.rho() = liquids_.rho(p1.pc(), p1.T(), X); + p1.Cp() = liquids_.Cp(p1.pc(), p1.T(), X); + p1.sigma() = liquids_.sigma(p1.pc(), p1.T(), X); + p1.mu() = liquids_.mu(p1.pc(), p1.T(), X); + p1.d() = cbrt(6.0*m1/(p1.nParticle()*p1.rho()*pi)); + } + + if (m2 > ROOTVSMALL) + { + const scalarField X(liquids_.X(p2.Y())); + p2.rho() = liquids_.rho(p2.pc(), p2.T(), X); + p2.Cp() = liquids_.Cp(p2.pc(), p2.T(), X); + p2.sigma() = liquids_.sigma(p2.pc(), p2.T(), X); + p2.mu() = liquids_.mu(p2.pc(), p2.T(), X); + p2.d() = cbrt(6.0*m2/(p2.nParticle()*p2.rho()*pi)); + } + } + } + j++; + } + i++; + } + + // remove coalesced parcels that fall below minimum mass threshold + forAllIter(typename CloudType, this->owner(), iter) + { + parcelType& p = iter(); + scalar mass = p.nParticle()*p.mass(); + + if (mass < this->owner().constProps().minParticleMass()) + { + this->owner().deleteParticle(p); + } + } +} template -Foam::ORourkeCollision::ORourkeCollision -( - const ORourkeCollision& cm -) -: - StochasticCollisionModel(cm), - coalescence_(cm.coalescence_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::ORourkeCollision::~ORourkeCollision() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -bool Foam::ORourkeCollision::update +bool Foam::ORourkeCollision::collideParcels ( const scalar dt, - cachedRandom& rndGen, - vector& pos1, + parcelType& p1, + parcelType& p2, scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const + scalar& m2 +) { + const label cell1 = p1.cell(); + const label cell2 = p2.cell(); + // check if parcels belong to same cell - if ((celli != cellj) || (m1 < VSMALL) || (m2 < VSMALL)) + if ((cell1 != cell2) || (m1 < ROOTVSMALL) || (m2 < ROOTVSMALL)) { return false; } bool coalescence = false; - scalar magVrel = mag(U1-U2); + const scalar Vc = this->owner().mesh().V()[cell1]; + const scalar d1 = p1.d(); + const scalar d2 = p2.d(); + + scalar magUrel = mag(p1.U() - p2.U()); scalar sumD = d1 + d2; - scalar nu0 = 0.25*constant::mathematical::pi*sumD*sumD*magVrel*dt/volj; - scalar nMin = min(N1, N2); + scalar nu0 = 0.25*constant::mathematical::pi*sqr(sumD)*magUrel*dt/Vc; + scalar nMin = min(p1.nParticle(), p2.nParticle()); scalar nu = nMin*nu0; scalar collProb = exp(-nu); - scalar xx = rndGen.sample01(); + scalar xx = this->owner().rndGen().template sample01(); // collision occurs if (xx > collProb) { if (d1 > d2) { - coalescence = collideSorted - ( - dt, - rndGen, - pos1, - m1, - d1, - N1, - U1, - rho1, - T1, - Y1, - sigma1, - celli, - voli, - pos2, - m2, - d2, - N2, - U2, - rho2, - T2, - Y2, - sigma2, - cellj, - volj - ); + coalescence = collideSorted(dt, p1, p2, m1, m2); } else { - coalescence = collideSorted - ( - dt, - rndGen, - pos2, - m2, - d2, - N2, - U2, - rho2, - T2, - Y2, - sigma2, - cellj, - volj, - pos1, - m1, - d1, - N1, - U1, - rho1, - T1, - Y1, - sigma1, - celli, - voli - ); + coalescence = collideSorted(dt, p2, p1, m2, m1); } } + return coalescence; } @@ -176,85 +146,81 @@ template bool Foam::ORourkeCollision::collideSorted ( const scalar dt, - cachedRandom& rndGen, - vector& pos1, + parcelType& p1, + parcelType& p2, scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const + scalar& m2 +) { bool coalescence = false; - vector vRel = U1 - U2; - scalar magVRel = mag(vRel); + const scalar sigma1 = p1.sigma(); + const scalar sigma2 = p2.sigma(); - scalar mdMin = m2/N2; + const scalar d1 = p1.d(); + const scalar d2 = p2.d(); + + const scalar T1 = p1.T(); + const scalar T2 = p2.T(); + + const scalar rho1 = p1.rho(); + const scalar rho2 = p2.rho(); + + const vector& U1 = p1.U(); + const vector& U2 = p2.U(); + + const label& nP1 = p1.nParticle(); + const label& nP2 = p2.nParticle(); + + + vector URel = U1 - U2; + scalar magURel = mag(URel); scalar mTot = m1 + m2; - scalar gamma = d1/max(d2, 1.0e-12); - scalar f = gamma*gamma*gamma + 2.7*gamma - 2.4*gamma*gamma; + scalar gamma = d1/max(ROOTVSMALL, d2); + scalar f = pow3(gamma) + 2.7*gamma - 2.4*sqr(gamma); - vector momMax = m1*U1; - vector momMin = m2*U2; + // mass-averaged temperature + scalar Tave = (T1*m1 + T2*m2)/mTot; - // use mass-averaged temperature to calculate We number - scalar Tm = (T1*m1 + T2*m2)/mTot; + // interpolate to find average surface tension + scalar sigmaAve = sigma1 + (sigma2 - sigma1)*(Tave - T1)/(T2 - T1); - // interpolate the averaged surface tension - scalar sigma = sigma1 + (sigma2 - sigma1)*(Tm - T1)/(T2 - T1); - - sigma = max(1.0e-6, sigma); scalar Vtot = m1/rho1 + m2/rho2; - scalar rho = mTot/Vtot; + scalar rhoAve = mTot/Vtot; - scalar dMean = sqrt(d1*d2); - scalar WeColl = max(1.0e-12, 0.5*rho*magVRel*magVRel*dMean/sigma); + scalar dAve = sqrt(d1*d2); + scalar WeColl = 0.5*rhoAve*sqr(magURel)*dAve/max(ROOTVSMALL, sigmaAve); - scalar coalesceProb = min(1.0, 2.4*f/WeColl); + scalar coalesceProb = min(1.0, 2.4*f/max(ROOTVSMALL, WeColl)); - scalar prob = rndGen.sample01(); + scalar prob = this->owner().rndGen().template sample01(); // Coalescence if (prob < coalesceProb && coalescence_) { coalescence = true; - // How 'many' of the droplets coalesce - scalar nProb = prob*N2/N1; - // Conservation of mass, momentum and energy - scalar m2Org = m2; - scalar dm = N1*nProb*mdMin; - m2 -= dm; - scalar V2 = constant::mathematical::pi*pow3(d2)/6.0; - N2 = m2/(rho2*V2); + // number of the droplets that coalesce + scalar nProb = prob*nP2/nP1; + // conservation of mass, momentum and energy scalar m1Org = m1; + scalar m2Org = m2; + + scalar dm = nP1*nProb*m2/scalar(nP2); + m1 += dm; - T1 = (Tm*mTot - m2*T2)/m1; + m2 -= dm; - U1 =(momMax + (1.0 - m2/m2Org)*momMin)/m1; + p1.T() = (Tave*mTot - m2*T2)/m1; - // update the liquid mass fractions - Y1 = (m1Org*Y1 + dm*Y2)/m1; + p1.U() = (m1*U1 + (1.0 - m2/m2Org)*m2*U2)/m1; + + p1.Y() = (m1Org*p1.Y() + dm*p2.Y())/m1; + + p2.nParticle() = m2/(rho2*p2.volume()); } // Grazing collision (no coalescence) else @@ -271,28 +237,65 @@ bool Foam::ORourkeCollision::collideSorted // and these parcels should have coalesced gf = max(0.0, gf); - // gf -> 1 => v1p -> p1().U() ... - // gf -> 0 => v1p -> momentum/(m1+m2) + // gf -> 1 => v1p -> U1 ... + // gf -> 0 => v1p -> momentum/mTot vector mr = m1*U1 + m2*U2; - vector v1p = (mr + m2*gf*vRel)/(m1+m2); - vector v2p = (mr - m1*gf*vRel)/(m1+m2); + vector v1p = (mr + m2*gf*URel)/mTot; + vector v2p = (mr - m1*gf*URel)/mTot; - if (N1 < N2) + if (nP1 < nP2) { - U1 = v1p; - U2 = (N1*v2p + (N2-N1)*U2)/N2; + p1.U() = v1p; + p2.U() = (nP1*v2p + (nP2 - nP1)*U2)/nP2; } else { - U1 = (N2*v1p + (N1-N2)*U1)/N1; - U2 = v2p; + p1.U() = (nP2*v1p + (nP1 - nP2)*U1)/nP1; + p2.U() = v2p; } - } return coalescence; } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ORourkeCollision::ORourkeCollision +( + const dictionary& dict, + CloudType& owner, + const word& modelName +) +: + StochasticCollisionModel(dict, owner, modelName), + liquids_ + ( + owner.db().template lookupObject("SLGThermo").liquids() + ), + coalescence_(this->coeffDict().lookup("coalescence")) +{} + + +template +Foam::ORourkeCollision::ORourkeCollision +( + const ORourkeCollision& cm +) +: + StochasticCollisionModel(cm), + liquids_(cm.liquids_), + coalescence_(cm.coalescence_) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::ORourkeCollision::~ORourkeCollision() +{} + + // ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H index 1a98c9e5f9..0e3381a9af 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.H +++ b/src/lagrangian/spray/submodels/StochasticCollision/ORourkeCollision/ORourkeCollision.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,13 +34,14 @@ Description #define ORourkeCollision_H #include "StochasticCollisionModel.H" +#include "liquidMixtureProperties.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ - Class ORourkeCollision Declaration + Class ORourkeCollision Declaration \*---------------------------------------------------------------------------*/ template @@ -48,10 +49,44 @@ class ORourkeCollision : public StochasticCollisionModel { -private: +protected: + + // Protected Data + + //- Convenience typedef to the cloud's parcel type + typedef typename CloudType::parcelType parcelType; + + const liquidMixtureProperties& liquids_; + + //- Coalescence activation switch + Switch coalescence_; + + + // Protected Member Functions + + //- Main collision routine + virtual void collide(const scalar dt); + + //- Collide parcels and return true if mass has changed + virtual bool collideParcels + ( + const scalar dt, + parcelType& p1, + parcelType& p2, + scalar& m1, + scalar& m2 + ); + + // 1 is the larger drop and 2 is the smaller + virtual bool collideSorted + ( + const scalar dt, + parcelType& p1, + parcelType& p2, + scalar& m1, + scalar& m2 + ); - dictionary coeffsDict_; - Switch coalescence_; public: @@ -62,7 +97,12 @@ public: // Constructors //- Construct from dictionary - ORourkeCollision(const dictionary& dict, CloudType& cloud); + ORourkeCollision + ( + const dictionary& dict, + CloudType& cloud, + const word& modelName = typeName + ); //- Construct copy ORourkeCollision(const ORourkeCollision& cm); @@ -79,67 +119,6 @@ public: //- Destructor virtual ~ORourkeCollision(); - - - // Member Functions - - virtual bool update - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; - - - // 1 is the larger drop and 2 is the smaller - bool collideSorted - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; }; diff --git a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C index fa09dfc2ca..4abc032432 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C +++ b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.C @@ -25,187 +25,96 @@ License #include "TrajectoryCollision.H" -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // template -Foam::TrajectoryCollision::TrajectoryCollision -( - const dictionary& dict, - CloudType& owner -) -: - StochasticCollisionModel(dict, owner, typeName), - cSpace_(readScalar(this->coeffDict().lookup("cSpace"))), - cTime_(readScalar(this->coeffDict().lookup("cTime"))), - coalescence_(this->coeffDict().lookup("coalescence")) -{} +void Foam::TrajectoryCollision::collide(const scalar dt) +{ + ORourkeCollision::collide(dt); +} template -Foam::TrajectoryCollision::TrajectoryCollision -( - const TrajectoryCollision& cm -) -: - StochasticCollisionModel(cm), - cSpace_(cm.cSpace_), - cTime_(cm.cTime_), - coalescence_(cm.coalescence_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template -Foam::TrajectoryCollision::~TrajectoryCollision() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -bool Foam::TrajectoryCollision::update +bool Foam::TrajectoryCollision::collideParcels ( const scalar dt, - cachedRandom& rndGen, - vector& pos1, + parcelType& p1, + parcelType& p2, scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const + scalar& m2 +) { bool coalescence = false; - vector vRel = U1 - U2; + const vector& pos1 = p1.position(); + const vector& pos2 = p2.position(); - vector p = pos2 - pos1; - scalar dist = mag(p); + const vector& U1 = p1.U(); + const vector& U2 = p2.U(); - scalar vAlign = vRel & (p/(dist + SMALL)); + vector URel = U1 - U2; + + vector d = pos2 - pos1; + scalar magd = mag(d); + + scalar vAlign = URel & (d/(magd + ROOTVSMALL)); if (vAlign > 0) { + const scalar d1 = p1.d(); + const scalar d2 = p2.d(); + scalar sumD = d1 + d2; - if (vAlign*dt > dist - 0.5*sumD) + if (vAlign*dt > magd - 0.5*sumD) { - scalar v1Mag = mag(U1); - scalar v2Mag = mag(U2); - vector nv1 = U1/v1Mag; - vector nv2 = U2/v2Mag; + scalar magU1 = mag(U1) + ROOTVSMALL; + scalar magU2 = mag(U2) + ROOTVSMALL; + vector n1 = U1/magU1; + vector n2 = U2/magU2; - scalar v1v2 = nv1 & nv2; - scalar v1p = nv1 & p; - scalar v2p = nv2 & p; + scalar n1n2 = n1 & n2; + scalar n1d = n1 & d; + scalar n2d = n2 & d; - scalar det = 1.0 - v1v2*v1v2; + scalar det = 1.0 - sqr(n1n2); - scalar alpha = 1.0e+20; - scalar beta = 1.0e+20; + scalar alpha = GREAT; + scalar beta = GREAT; if (mag(det) > 1.0e-4) { - beta = -(v2p - v1v2*v1p)/det; - alpha = v1p + v1v2*beta; + beta = -(n2d - n1n2*n1d)/det; + alpha = n1d + n1n2*beta; } - alpha /= v1Mag*dt; - beta /= v2Mag*dt; + alpha /= magU1*dt; + beta /= magU2*dt; // is collision possible within this timestep - if ((alpha>0) && (alpha<1.0) && (beta>0) && (beta<1.0)) + if ((alpha > 0) && (alpha < 1.0) && (beta > 0) && (beta < 1.0)) { vector p1c = pos1 + alpha*U1*dt; vector p2c = pos2 + beta*U2*dt; - scalar closestDist = mag(p1c-p2c); + scalar closestDist = mag(p1c - p2c); scalar collProb = pow(0.5*sumD/max(0.5*sumD, closestDist), cSpace_) - * exp(-cTime_*mag(alpha-beta)); + *exp(-cTime_*mag(alpha - beta)); - scalar xx = rndGen.sample01(); + scalar xx = this->owner().rndGen().template sample01(); - // collision occur - if ((xx < collProb) && (m1 > VSMALL) && (m2 > VSMALL)) + // collision occurs + if (xx > collProb) { if (d1 > d2) { - coalescence = collideSorted - ( - dt, - rndGen, - pos1, - m1, - d1, - N1, - U1, - rho1, - T1, - Y1, - sigma1, - celli, - voli, - pos2, - m2, - d2, - N2, - U2, - rho2, - T2, - Y2, - sigma2, - cellj, - volj - ); + coalescence = this->collideSorted(dt, p1, p2, m1, m2); } else { - coalescence = collideSorted - ( - dt, - rndGen, - pos2, - m2, - d2, - N2, - U2, - rho2, - T2, - Y2, - sigma2, - cellj, - volj, - pos1, - m1, - d1, - N1, - U1, - rho1, - T1, - Y1, - sigma1, - celli, - voli - ); + coalescence = this->collideSorted(dt, p2, p1, m2, m1); } } } @@ -216,128 +125,38 @@ bool Foam::TrajectoryCollision::update } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + template -bool Foam::TrajectoryCollision::collideSorted +Foam::TrajectoryCollision::TrajectoryCollision ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U1, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj -) const -{ - bool coalescence = false; + const dictionary& dict, + CloudType& owner +) +: + ORourkeCollision(dict, owner, typeName), + cSpace_(readScalar(this->coeffDict().lookup("cSpace"))), + cTime_(readScalar(this->coeffDict().lookup("cTime"))) +{} - vector vRel = U1 - U2; - scalar mdMin = m2/N2; +template +Foam::TrajectoryCollision::TrajectoryCollision +( + const TrajectoryCollision& cm +) +: + ORourkeCollision(cm), + cSpace_(cm.cSpace_), + cTime_(cm.cTime_) +{} - scalar mTot = m1 + m2; - scalar gamma = d1/max(d2, 1.0e-12); - scalar f = gamma*gamma*gamma + 2.7*gamma - 2.4*gamma*gamma; +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - vector momMax = m1*U1; - vector momMin = m2*U2; - - // use mass-averaged temperature to calculate We number - scalar Tm = (T1*m1 + T2*m2)/mTot; - - // and mass averaged fractions ... - //scalarField Yav((m1*Y1 + m2*Y2)/mTot; - - // interpolate the averaged surface tension - scalar sigma = sigma1 + (sigma2 - sigma1)*(Tm - T1)/(T2 - T1); - - sigma = max(1.0e-6, sigma); - scalar Vtot = m1/rho1 + m2/rho2; - scalar rho = mTot/Vtot; - - scalar dMean = sqrt(d1*d2); - scalar WeColl = max(1.0e-12, 0.5*rho*magSqr(vRel)*dMean/sigma); - - scalar coalesceProb = min(1.0, 2.4*f/WeColl); - - scalar prob = rndGen.sample01(); - - // Coalescence - if ( prob < coalesceProb && coalescence_) - { - coalescence = true; - // How 'many' of the droplets coalesce - scalar nProb = prob*N2/N1; - - // Conservation of mass, momentum and energy - scalar m2Org = m2; - scalar dm = N1*nProb*mdMin; - m2 -= dm; - scalar V2 = constant::mathematical::pi*pow3(d2)/6.0; - N2 = m2/(rho2*V2); - - scalar m1Org = m1; - m1 += dm; - T1 = (Tm*mTot - m2*T2)/m1; - - U1 =(momMax + (1.0 - m2/m2Org)*momMin)/m1; - - // update the liquid mass fractions - Y1 = (m1Org*Y1 + dm*Y2)/m1; - } - // Grazing collision (no coalescence) - else - { - scalar gf = sqrt(prob) - sqrt(coalesceProb); - scalar denom = 1.0 - sqrt(coalesceProb); - if (denom < 1.0e-5) - { - denom = 1.0; - } - gf /= denom; - - // if gf negative, this means that coalescence is turned off - // and these parcels should have coalesced - gf = max(0.0, gf); - - // gf -> 1 => v1p -> p1().U() ... - // gf -> 0 => v1p -> momentum/(m1 + m2) - - vector mr = m1*U1 + m2*U2; - vector v1p = (mr + m2*gf*vRel)/(m1 + m2); - vector v2p = (mr - m1*gf*vRel)/(m1 + m2); - - if (N1 < N2) - { - U1 = v1p; - U2 = (N1*v2p + (N2 - N1)*U2)/N2; - } - else - { - U1 = (N2*v1p + (N1 - N2)*U1)/N1; - U2 = v2p; - } - } - - return coalescence; -} +template +Foam::TrajectoryCollision::~TrajectoryCollision() +{} // ************************************************************************* // diff --git a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.H b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.H index 979d84b490..ebd23198a0 100644 --- a/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.H +++ b/src/lagrangian/spray/submodels/StochasticCollision/TrajectoryCollision/TrajectoryCollision.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,35 +25,57 @@ Class Foam::TrajectoryCollision Description - Trajectory collision model by N. Nordin. + Trajectory collision model by N. Nordin, based on O'Rourke's collision + model \*---------------------------------------------------------------------------*/ #ifndef TrajectoryCollision_H #define TrajectoryCollision_H -#include "StochasticCollisionModel.H" +#include "ORourkeCollision.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ - Class TrajectoryCollision Declaration + Class TrajectoryCollision Declaration \*---------------------------------------------------------------------------*/ template class TrajectoryCollision : - public StochasticCollisionModel + public ORourkeCollision { -private: +protected: - // Private data + // Protected Data + //- Convenience typedef to the cloud's parcel type + typedef typename CloudType::parcelType parcelType; + + //- Space coefficient scalar cSpace_; + + //- Time coefficient scalar cTime_; - Switch coalescence_; + + + // Protected Member Functions + + //- Main collision routine + virtual void collide(const scalar dt); + + //- Collide parcels and return true if mass has changed + virtual bool collideParcels + ( + const scalar dt, + parcelType& p1, + parcelType& p2, + scalar& m1, + scalar& m2 + ); public: @@ -82,66 +104,6 @@ public: //- Destructor virtual ~TrajectoryCollision(); - - - // Member Functions - - virtual bool update - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; - - // 1 is the larger drop and 2 is the smaller - bool collideSorted - ( - const scalar dt, - cachedRandom& rndGen, - vector& pos1, - scalar& m1, - scalar& d1, - scalar& N1, - vector& U, - scalar& rho1, - scalar& T1, - scalarField& Y1, - const scalar sigma1, - const label celli, - const scalar voli, - vector& pos2, - scalar& m2, - scalar& d2, - scalar& N2, - vector& U2, - scalar& rho2, - scalar& T2, - scalarField& Y2, - const scalar sigma2, - const label cellj, - const scalar volj - ) const; }; From c819974315cd375ba5c50b37a3406195a6a306d6 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 3 May 2013 11:35:48 +0100 Subject: [PATCH 10/41] ENH: Updated handling of canCombust flag to suppress devolatilisation and surface combustion --- .../ReactingMultiphaseParcel.C | 7 +- .../ReactingMultiphaseParcel.H | 20 +- .../ReactingMultiphaseParcelI.H | 11 +- .../ReactingMultiphaseParcelIO.C | 4 +- .../Templates/ReactingParcel/ReactingParcel.C | 326 +++++++++--------- .../Templates/ReactingParcel/ReactingParcel.H | 2 +- ...keBasicReactingMultiphaseParcelSubmodels.C | 14 +- .../makeBasicReactingParcelSubmodels.C | 8 +- .../ConstantRateDevolatilisation.C | 9 +- .../ConstantRateDevolatilisation.H | 4 +- .../DevolatilisationModel.C | 6 +- .../DevolatilisationModel.H | 4 +- .../SingleKineticRateDevolatilisation.C | 9 +- .../SingleKineticRateDevolatilisation.H | 4 +- 14 files changed, 223 insertions(+), 205 deletions(-) diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index 9350e1251e..aab07b4d7d 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -498,7 +498,7 @@ void Foam::ReactingMultiphaseParcel::calcDevolatilisation const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV, scalar& Sh, scalar& N, @@ -512,6 +512,7 @@ void Foam::ReactingMultiphaseParcel::calcDevolatilisation ( !td.cloud().devolatilisation().active() || T < td.cloud().constProps().Tvap() + || canCombust == -1 ) { return; @@ -588,7 +589,7 @@ void Foam::ReactingMultiphaseParcel::calcSurfaceReactions const scalar d, const scalar T, const scalar mass, - const bool canCombust, + const label canCombust, const scalar N, const scalarField& YMix, const scalarField& YGas, @@ -603,7 +604,7 @@ void Foam::ReactingMultiphaseParcel::calcSurfaceReactions ) const { // Check that model is active - if (!td.cloud().surfaceReaction().active() || !canCombust) + if (!td.cloud().surfaceReaction().active() || (canCombust != 1)) { return; } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H index db20b8d9c7..ff13d240b9 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -183,9 +183,13 @@ protected: //- Mass fractions of solids [] scalarField YSolid_; - //- Flag to say that the particle is allowed to combust - // Only true after volatile content falls below threshold value - bool canCombust_; + //- Flag to identify if the particle can devolatilise and combust + // Combustion possible only after volatile content falls below + // threshold value. States include: + // 0 = can devolatilise, cannot combust but can change + // 1 = can devolatilise, can combust + // -1 = cannot devolatilise or combust, and cannot change + label canCombust_; // Protected Member Functions @@ -205,7 +209,7 @@ protected: const scalarField& YGasEff,// gas component mass fractions const scalarField& YLiquidEff,// liquid component mass fractions const scalarField& YSolidEff,// solid component mass fractions - bool& canCombust, // 'can combust' flag + label& canCombust, // 'can combust' flag scalarField& dMassDV, // mass transfer - local to particle scalar& Sh, // explicit particle enthalpy source scalar& N, // flux of species emitted from particle @@ -223,7 +227,7 @@ protected: const scalar d, // diameter const scalar T, // temperature const scalar mass, // mass - const bool canCombust, // 'can combust' flag + const label canCombust, // 'can combust' flag const scalar N, // flux of species emitted from particle const scalarField& YMix, // mixture mass fractions const scalarField& YGas, // gas-phase mass fractions @@ -362,7 +366,7 @@ public: inline const scalarField& YSolid() const; //- Return const access to the canCombust flag - inline bool canCombust() const; + inline label canCombust() const; // Edit @@ -377,7 +381,7 @@ public: inline scalarField& YSolid(); //- Return access to the canCombust flag - inline bool& canCombust(); + inline label& canCombust(); // Main calculation loop diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H index e610de174e..4a4a97eddf 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelI.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -94,7 +94,7 @@ inline Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel YGas_(0), YLiquid_(0), YSolid_(0), - canCombust_(false) + canCombust_(0) {} @@ -142,7 +142,7 @@ inline Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel YGas_(YGas0), YLiquid_(YLiquid0), YSolid_(YSolid0), - canCombust_(false) + canCombust_(0) {} @@ -192,7 +192,8 @@ YSolid() const template -inline bool Foam::ReactingMultiphaseParcel::canCombust() const +inline Foam::label +Foam::ReactingMultiphaseParcel::canCombust() const { return canCombust_; } @@ -220,7 +221,7 @@ inline Foam::scalarField& Foam::ReactingMultiphaseParcel::YSolid() template -inline bool& Foam::ReactingMultiphaseParcel::canCombust() +inline Foam::label& Foam::ReactingMultiphaseParcel::canCombust() { return canCombust_; } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C index fa1e6e0428..9495376322 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcelIO.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,7 +47,7 @@ Foam::ReactingMultiphaseParcel::ReactingMultiphaseParcel YGas_(0), YLiquid_(0), YSolid_(0), - canCombust_(false) + canCombust_(0) { if (readFields) { diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 4906280cf9..efb73ecae8 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -32,6 +32,169 @@ using namespace Foam::constant::mathematical; // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // +template +template +void Foam::ReactingParcel::calcPhaseChange +( + TrackData& td, + const scalar dt, + const label cellI, + const scalar Re, + const scalar Pr, + const scalar Ts, + const scalar nus, + const scalar d, + const scalar T, + const scalar mass, + const label idPhase, + const scalar YPhase, + const scalarField& YComponents, + scalarField& dMassPC, + scalar& Sh, + scalar& N, + scalar& NCpW, + scalarField& Cs +) +{ + if + ( + !td.cloud().phaseChange().active() + || T < td.cloud().constProps().Tvap() + || YPhase < SMALL + ) + { + return; + } + + typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; + const CompositionModel& composition = + td.cloud().composition(); + + const scalar TMax = td.cloud().phaseChange().TMax(pc_, this->Tc_); + const scalar Tdash = min(T, TMax); + const scalar Tsdash = min(Ts, TMax); + + // Calculate mass transfer due to phase change + td.cloud().phaseChange().calculate + ( + dt, + cellI, + Re, + Pr, + d, + nus, + Tdash, + Tsdash, + pc_, + this->Tc_, + YComponents, + dMassPC + ); + + // Limit phase change mass by availability of each specie + dMassPC = min(mass*YPhase*YComponents, dMassPC); + + const scalar dMassTot = sum(dMassPC); + + // Add to cumulative phase change mass + td.cloud().phaseChange().addToPhaseChangeMass(this->nParticle_*dMassTot); + + forAll(dMassPC, i) + { + const label idc = composition.localToGlobalCarrierId(idPhase, i); + const label idl = composition.globalIds(idPhase)[i]; + + const scalar dh = td.cloud().phaseChange().dh(idc, idl, pc_, Tdash); + Sh -= dMassPC[i]*dh/dt; + } + + + // Update molar emissions + if (td.cloud().heatTransfer().BirdCorrection()) + { + // Average molecular weight of carrier mix - assumes perfect gas + const scalar Wc = this->rhoc_*specie::RR*this->Tc_/this->pc_; + + + forAll(dMassPC, i) + { + const label idc = composition.localToGlobalCarrierId(idPhase, i); + const label idl = composition.globalIds(idPhase)[i]; + + const scalar Cp = composition.carrier().Cp(idc, pc_, Tsdash); + const scalar W = composition.carrier().W(idc); + const scalar Ni = dMassPC[i]/(this->areaS(d)*dt*W); + + const scalar Dab = + composition.liquids().properties()[idl].D(pc_, Tsdash, Wc); + + // Molar flux of species coming from the particle (kmol/m^2/s) + N += Ni; + + // Sum of Ni*Cpi*Wi of emission species + NCpW += Ni*Cp*W; + + // Concentrations of emission species + Cs[idc] += Ni*d/(2.0*Dab); + } + } +} + + +template +Foam::scalar Foam::ReactingParcel::updateMassFraction +( + const scalar mass0, + const scalarField& dMass, + scalarField& Y +) const +{ + scalar mass1 = mass0 - sum(dMass); + + // only update the mass fractions if the new particle mass is finite + if (mass1 > ROOTVSMALL) + { + forAll(Y, i) + { + Y[i] = (Y[i]*mass0 - dMass[i])/mass1; + } + } + + return mass1; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::ReactingParcel::ReactingParcel +( + const ReactingParcel& p +) +: + ParcelType(p), + mass0_(p.mass0_), + Y_(p.Y_), + pc_(p.pc_) +{} + + +template +Foam::ReactingParcel::ReactingParcel +( + const ReactingParcel& p, + const polyMesh& mesh +) +: + ParcelType(p, mesh), + mass0_(p.mass0_), + Y_(p.Y_), + pc_(p.pc_) +{} + + +// * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * * // + template template void Foam::ReactingParcel::setCellValues @@ -165,7 +328,7 @@ void Foam::ReactingParcel::correctSurfaceValues const SLGThermo& thermo = td.cloud().thermo(); // Far field carrier molar fractions - scalarField Xinf(td.cloud().thermo().carrier().species().size()); + scalarField Xinf(thermo.carrier().species().size()); forAll(Xinf, i) { @@ -234,29 +397,6 @@ void Foam::ReactingParcel::correctSurfaceValues } -template -Foam::scalar Foam::ReactingParcel::updateMassFraction -( - const scalar mass0, - const scalarField& dMass, - scalarField& Y -) const -{ - scalar mass1 = mass0 - sum(dMass); - - // only update the mass fractions if the new particle mass is finite - if (mass1 > ROOTVSMALL) - { - forAll(Y, i) - { - Y[i] = (Y[i]*mass0 - dMass[i])/mass1; - } - } - - return mass1; -} - - template template void Foam::ReactingParcel::calc @@ -472,144 +612,6 @@ void Foam::ReactingParcel::calc } -template -template -void Foam::ReactingParcel::calcPhaseChange -( - TrackData& td, - const scalar dt, - const label cellI, - const scalar Re, - const scalar Pr, - const scalar Ts, - const scalar nus, - const scalar d, - const scalar T, - const scalar mass, - const label idPhase, - const scalar YPhase, - const scalarField& YComponents, - scalarField& dMassPC, - scalar& Sh, - scalar& N, - scalar& NCpW, - scalarField& Cs -) -{ - if - ( - !td.cloud().phaseChange().active() - || T < td.cloud().constProps().Tvap() - || YPhase < SMALL - ) - { - return; - } - - typedef typename TrackData::cloudType::reactingCloudType reactingCloudType; - const CompositionModel& composition = - td.cloud().composition(); - - const scalar TMax = td.cloud().phaseChange().TMax(pc_, this->Tc_); - const scalar Tdash = min(T, TMax); - const scalar Tsdash = min(Ts, TMax); - - // Calculate mass transfer due to phase change - td.cloud().phaseChange().calculate - ( - dt, - cellI, - Re, - Pr, - d, - nus, - Tdash, - Tsdash, - pc_, - this->Tc_, - YComponents, - dMassPC - ); - - // Limit phase change mass by availability of each specie - dMassPC = min(mass*YPhase*YComponents, dMassPC); - - const scalar dMassTot = sum(dMassPC); - - // Add to cumulative phase change mass - td.cloud().phaseChange().addToPhaseChangeMass(this->nParticle_*dMassTot); - - forAll(dMassPC, i) - { - const label idc = composition.localToGlobalCarrierId(idPhase, i); - const label idl = composition.globalIds(idPhase)[i]; - - const scalar dh = td.cloud().phaseChange().dh(idc, idl, pc_, Tdash); - Sh -= dMassPC[i]*dh/dt; - } - - - // Update molar emissions - if (td.cloud().heatTransfer().BirdCorrection()) - { - // Average molecular weight of carrier mix - assumes perfect gas - const scalar Wc = this->rhoc_*specie::RR*this->Tc_/this->pc_; - - - forAll(dMassPC, i) - { - const label idc = composition.localToGlobalCarrierId(idPhase, i); - const label idl = composition.globalIds(idPhase)[i]; - - const scalar Cp = composition.carrier().Cp(idc, pc_, Tsdash); - const scalar W = composition.carrier().W(idc); - const scalar Ni = dMassPC[i]/(this->areaS(d)*dt*W); - - const scalar Dab = - composition.liquids().properties()[idl].D(pc_, Tsdash, Wc); - - // Molar flux of species coming from the particle (kmol/m^2/s) - N += Ni; - - // Sum of Ni*Cpi*Wi of emission species - NCpW += Ni*Cp*W; - - // Concentrations of emission species - Cs[idc] += Ni*d/(2.0*Dab); - } - } -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::ReactingParcel::ReactingParcel -( - const ReactingParcel& p -) -: - ParcelType(p), - mass0_(p.mass0_), - Y_(p.Y_), - pc_(p.pc_) -{} - - -template -Foam::ReactingParcel::ReactingParcel -( - const ReactingParcel& p, - const polyMesh& mesh -) -: - ParcelType(p, mesh), - mass0_(p.mass0_), - Y_(p.Y_), - pc_(p.pc_) -{} - - // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // #include "ReactingParcelIO.C" diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H index 0bb8f3704e..7b4fea251a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C index b14f905032..bafe2cdd26 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/makeBasicReactingMultiphaseParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,6 +32,8 @@ License #include "makeParcelDispersionModels.H" #include "makeReactingMultiphaseParcelInjectionModels.H" // MP variant #include "makeParcelPatchInteractionModels.H" +#include "makeReactingMultiphaseParcelStochasticCollisionModels.H" // MP variant +#include "makeReactingParcelSurfaceFilmModels.H" // Reacting variant // Thermodynamic #include "makeParcelHeatTransferModels.H" @@ -39,7 +41,6 @@ License // Reacting #include "makeReactingMultiphaseParcelCompositionModels.H" // MP Variant #include "makeReactingParcelPhaseChangeModels.H" -#include "makeReactingParcelSurfaceFilmModels.H" // Reacting multiphase #include "makeReactingMultiphaseParcelDevolatilisationModels.H" @@ -56,6 +57,11 @@ namespace Foam makeParcelDispersionModels(basicReactingMultiphaseCloud); makeReactingMultiphaseParcelInjectionModels(basicReactingMultiphaseCloud); makeParcelPatchInteractionModels(basicReactingMultiphaseCloud); + makeReactingMultiphaseParcelStochasticCollisionModels + ( + basicReactingMultiphaseCloud + ); + makeReactingParcelSurfaceFilmModels(basicReactingMultiphaseCloud); // Thermo sub-models makeParcelHeatTransferModels(basicReactingMultiphaseCloud); @@ -72,10 +78,6 @@ namespace Foam ( basicReactingMultiphaseCloud ); - makeReactingParcelSurfaceFilmModels - ( - basicReactingMultiphaseCloud - ); makeReactingMultiphaseParcelSurfaceReactionModels ( basicReactingMultiphaseCloud diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C index bd425895b6..e9eb87a2cd 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/makeBasicReactingParcelSubmodels.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,6 +32,8 @@ License #include "makeParcelDispersionModels.H" #include "makeReactingParcelInjectionModels.H" // Reacting variant #include "makeParcelPatchInteractionModels.H" +#include "makeParcelStochasticCollisionModels.H" +#include "makeReactingParcelSurfaceFilmModels.H" // Reacting variant // Thermodynamic #include "makeParcelHeatTransferModels.H" @@ -39,7 +41,6 @@ License // Reacting #include "makeReactingParcelCompositionModels.H" #include "makeReactingParcelPhaseChangeModels.H" -#include "makeReactingParcelSurfaceFilmModels.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,6 +53,8 @@ namespace Foam makeParcelDispersionModels(basicReactingCloud); makeReactingParcelInjectionModels(basicReactingCloud); makeParcelPatchInteractionModels(basicReactingCloud); + makeParcelStochasticCollisionModels(basicReactingCloud); + makeReactingParcelSurfaceFilmModels(basicReactingCloud); // Thermo sub-models makeParcelHeatTransferModels(basicReactingCloud); @@ -59,7 +62,6 @@ namespace Foam // Reacting sub-models makeReactingParcelCompositionModels(basicReactingCloud); makeReactingParcelPhaseChangeModels(basicReactingCloud); - makeReactingParcelSurfaceFilmModels(basicReactingCloud); } diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.C index 0de0772381..a98e959392 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.C +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -109,7 +109,7 @@ void Foam::ConstantRateDevolatilisation::calculate const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV ) const { @@ -130,7 +130,10 @@ void Foam::ConstantRateDevolatilisation::calculate dMassDV[id] = min(dt*A0*massVolatile0, massVolatile); } - canCombust = done; + if (done && canCombust != -1) + { + canCombust = 1; + } } diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.H index 7faffb990d..4b61de316d 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.H +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/ConstantRateDevolatilisation/ConstantRateDevolatilisation.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -111,7 +111,7 @@ public: const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV ) const; }; diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.C index 6b4325db4f..48a0a4ee5f 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.C +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -82,7 +82,7 @@ void Foam::DevolatilisationModel::calculate const scalarField&, const scalarField&, const scalarField&, - bool&, + label&, scalarField& ) const { @@ -98,7 +98,7 @@ void Foam::DevolatilisationModel::calculate "const scalarField&, " "const scalarField&, " "const scalarField&, " - "bool&, " + "label&, " "scalarField&" ") const" ); diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.H index 7cff8d426a..f467aa7470 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.H +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/DevolatilisationModel/DevolatilisationModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -133,7 +133,7 @@ public: const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV ) const; diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C index fe4b856cfb..d3a8ca8aed 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -112,7 +112,7 @@ void Foam::SingleKineticRateDevolatilisation::calculate const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV ) const { @@ -137,7 +137,10 @@ void Foam::SingleKineticRateDevolatilisation::calculate dMassDV[id] = min(dt*kappa*massVolatile, massVolatile); } - canCombust = done; + if (done && canCombust != -1) + { + canCombust = 1; + } } diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H index d9c3064ce9..6b4802c8f6 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/DevolatilisationModel/SingleKineticRateDevolatilisation/SingleKineticRateDevolatilisation.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -236,7 +236,7 @@ public: const scalarField& YGasEff, const scalarField& YLiquidEff, const scalarField& YSolidEff, - bool& canCombust, + label& canCombust, scalarField& dMassDV ) const; }; From 599a5f1d8dae4ef20e75c99761e7bc578421162e Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 3 May 2013 12:17:12 +0100 Subject: [PATCH 11/41] ENH: tutorial updates --- .../oppositeBurningPanels/constant/reactingCloud1Properties | 2 ++ .../les/smallPoolFire2D/constant/reactingCloud1Properties | 2 ++ .../les/smallPoolFire3D/constant/reactingCloud1Properties | 2 ++ .../verticalChannel/constant/reactingCloud1Properties | 2 ++ .../simplifiedSiwek/constant/coalCloud1Properties | 2 ++ .../simplifiedSiwek/constant/limestoneCloud1Properties | 2 ++ .../hopper/hopperEmptying/constant/kinematicCloudProperties | 2 ++ .../hopperInitialState/constant/kinematicCloudProperties | 2 ++ .../cylinder/constant/reactingCloud1Properties | 2 ++ .../hotBoxes/constant/reactingCloud1Properties | 2 ++ .../splashPanel/constant/reactingCloud1Properties | 2 ++ .../filter/constant/reactingCloud1Properties | 2 ++ .../parcelInBox/constant/reactingCloud1Properties | 2 ++ .../verticalChannel/constant/reactingCloud1Properties | 2 ++ .../verticalChannel/constant/reactingCloud1Properties | 2 ++ .../sprayFoam/aachenBomb/constant/sprayCloudProperties | 4 ++-- 16 files changed, 32 insertions(+), 2 deletions(-) diff --git a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/reactingCloud1Properties b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/reactingCloud1Properties index 91b20eee70..1de9320ac1 100644 --- a/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/reactingCloud1Properties +++ b/tutorials/combustion/fireFoam/les/oppositeBurningPanels/constant/reactingCloud1Properties @@ -89,6 +89,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/reactingCloud1Properties b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/reactingCloud1Properties index 91b20eee70..1de9320ac1 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/reactingCloud1Properties +++ b/tutorials/combustion/fireFoam/les/smallPoolFire2D/constant/reactingCloud1Properties @@ -89,6 +89,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/reactingCloud1Properties b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/reactingCloud1Properties index 91b20eee70..1de9320ac1 100644 --- a/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/reactingCloud1Properties +++ b/tutorials/combustion/fireFoam/les/smallPoolFire3D/constant/reactingCloud1Properties @@ -89,6 +89,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index aa8b02241a..6b759cd17e 100644 --- a/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/LTSReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -144,6 +144,8 @@ subModels surfaceReactionModel none; + stochasticCollisionModel none; + surfaceFilmModel none; radiation off; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties index bc122d0a37..77742fd018 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/coalCloud1Properties @@ -117,6 +117,8 @@ subModels devolatilisationModel constantRateDevolatilisation; + stochasticCollisionModel none; + surfaceReactionModel COxidationKineticDiffusionLimitedRate; surfaceFilmModel none; diff --git a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties index 0517933f4d..1177f8fc32 100644 --- a/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties +++ b/tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/limestoneCloud1Properties @@ -104,6 +104,8 @@ subModels heatTransferModel RanzMarshall; + stochasticCollisionModel none; + surfaceFilmModel none; radiation on; diff --git a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties index 3601470655..20eed6f6e0 100644 --- a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties +++ b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperEmptying/constant/kinematicCloudProperties @@ -70,6 +70,8 @@ subModels heatTransferModel none; + stochasticCollisionModel none; + surfaceFilmModel none; collisionModel pairCollision; diff --git a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperInitialState/constant/kinematicCloudProperties b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperInitialState/constant/kinematicCloudProperties index fbd8c9f174..b24dcb63b2 100644 --- a/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperInitialState/constant/kinematicCloudProperties +++ b/tutorials/lagrangian/icoUncoupledKinematicParcelFoam/hopper/hopperInitialState/constant/kinematicCloudProperties @@ -80,6 +80,8 @@ subModels heatTransferModel none; + stochasticCollisionModel none; + surfaceFilmModel none; collisionModel pairCollision; diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties index 68e6be961f..45ae8875b7 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/cylinder/constant/reactingCloud1Properties @@ -101,6 +101,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties index a4d326c041..fb559463aa 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/hotBoxes/constant/reactingCloud1Properties @@ -123,6 +123,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties index b59b42445e..c25468b554 100644 --- a/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFilmFoam/splashPanel/constant/reactingCloud1Properties @@ -101,6 +101,8 @@ subModels phaseChangeModel none; + stochasticCollisionModel none; + surfaceFilmModel thermoSurfaceFilm; radiation off; diff --git a/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties index cb6c2dd3be..5a1582cead 100644 --- a/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/filter/constant/reactingCloud1Properties @@ -110,6 +110,8 @@ subModels surfaceReactionModel none; + stochasticCollisionModel none; + surfaceFilmModel none; radiation off; diff --git a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties index 56b0a2d3e7..478bbe1359 100644 --- a/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/parcelInBox/constant/reactingCloud1Properties @@ -118,6 +118,8 @@ subModels surfaceReactionModel none; + stochasticCollisionModel none; + surfaceFilmModel none; radiation off; diff --git a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index b4d1d9abdf..47cd1a3bb6 100644 --- a/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/reactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -139,6 +139,8 @@ subModels surfaceReactionModel none; + stochasticCollisionModel none; + surfaceFilmModel none; radiation off; diff --git a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties index aa8b02241a..6b759cd17e 100644 --- a/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties +++ b/tutorials/lagrangian/simpleReactingParcelFoam/verticalChannel/constant/reactingCloud1Properties @@ -144,6 +144,8 @@ subModels surfaceReactionModel none; + stochasticCollisionModel none; + surfaceFilmModel none; radiation off; diff --git a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties index 0ce1e3bbc8..dc08a39d09 100644 --- a/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties +++ b/tutorials/lagrangian/sprayFoam/aachenBomb/constant/sprayCloudProperties @@ -161,14 +161,14 @@ subModels phaseChangeModel liquidEvaporationBoil; + stochasticCollisionModel none; + surfaceFilmModel none; atomizationModel none; breakupModel ReitzDiwakar; // ReitzKHRT; - stochasticCollisionModel none; - radiation off; standardWallInteractionCoeffs From 8b52b700d0e1b367d44fa481026c349cfdeb81fe Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 3 May 2013 12:55:44 +0100 Subject: [PATCH 12/41] ENH: Updated suppression collision model --- .../Templates/KinematicCloud/KinematicCloudI.H | 2 +- .../SuppressionCollision/SuppressionCollision.C | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H index f99bb8c57c..bef2f78a60 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/KinematicCloudI.H @@ -622,7 +622,7 @@ Foam::KinematicCloud::vDotSweep() const vDotSweep.internalField() /= mesh_.V(); vDotSweep.correctBoundaryConditions(); - return vDotSweep; + return tvDotSweep; } diff --git a/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C index c25cc8b646..b486fa02b7 100644 --- a/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C +++ b/src/lagrangian/intermediate/submodels/ReactingMultiphase/StochasticCollision/SuppressionCollision/SuppressionCollision.C @@ -36,7 +36,9 @@ void Foam::SuppressionCollision::collide(const scalar dt) lookupObject(suppressionCloud_); volScalarField vDotSweep(sc.vDotSweep()); - volScalarField P(type() + ":p", 1.0 - exp(-vDotSweep*dt)); + + dimensionedScalar Dt("dt", dimTime, dt); + volScalarField P(type() + ":p", 1.0 - exp(-vDotSweep*Dt)); forAllIter(typename CloudType, this->owner(), iter) { @@ -63,9 +65,12 @@ Foam::SuppressionCollision::SuppressionCollision CloudType& owner ) : - StochasticCollisionModel(owner), - suppressionCloud_(dict.lookup("suppressionCloud")), - suppressedParcelType_(dict.lookupOrDefault("suppressedParcelType", -1)) + StochasticCollisionModel(dict, owner, typeName), + suppressionCloud_(this->coeffDict().lookup("suppressionCloud")), + suppressedParcelType_ + ( + this->coeffDict().lookupOrDefault("suppressedParcelType", -1) + ) {} From d13c9810e86f277923bbd4af02d0ea4c1880e032 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 3 May 2013 15:46:29 +0100 Subject: [PATCH 13/41] VoF Solvers: Relocate the correction, sub-cycling and compressions controls from PIMPLE to the alpha1 sub-dict MULES: Add support for explicit correction interPhaseChangeFoam: Add option for explicit MULES or as correction to an upwind solution Deprecate implicit form of MULES --- .../compressibleInterFoam/alphaEqnsSubCycle.H | 4 +- .../compressibleInterDyMFoam/readControls.H | 12 - .../compressibleInterFoam.C | 4 +- .../multiphase/compressibleInterFoam/pEqn.H | 6 +- .../compressibleInterFoam/readControls.H | 13 - .../readTwoPhaseEulerFoamControls.H | 4 +- .../interFoam/LTSInterFoam/alphaEqnSubCycle.H | 3 +- .../interFoam/LTSInterFoam/setrDeltaT.H | 5 +- .../multiphase/interFoam/alphaEqnSubCycle.H | 3 +- .../interMixingFoam/alphaEqnsSubCycle.H | 4 +- .../interPhaseChangeFoam/alphaEqn.H | 124 ++--- .../interPhaseChangeFoam/alphaEqnSubCycle.H | 14 +- .../interPhaseChangeFoam.C | 2 +- .../multiphaseSystem/multiphaseSystem.C | 5 +- .../multiphaseMixture/multiphaseMixture.C | 11 +- .../twoLiquidMixingFoam/alphaEqnSubCycle.H | 3 +- .../readTwoPhaseEulerFoamControls.H | 3 +- .../fvMatrices/solvers/MULES/MULES.C | 19 + .../fvMatrices/solvers/MULES/MULES.H | 61 +++ .../fvMatrices/solvers/MULES/MULESTemplates.C | 426 ++++++++++++++++++ .../interfaceProperties/interfaceProperties.C | 2 +- .../cavitatingBullet/system/controlDict | 32 +- .../cavitatingBullet/system/fvSchemes | 6 +- .../cavitatingBullet/system/fvSolution | 26 +- 24 files changed, 635 insertions(+), 157 deletions(-) delete mode 100644 applications/solvers/multiphase/compressibleInterFoam/readControls.H diff --git a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H index be34ab52ed..accc3197ad 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/compressibleInterFoam/alphaEqnsSubCycle.H @@ -1,7 +1,5 @@ { - label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); - - label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); + #include "alphaControls.H" surfaceScalarField phic(mag(phi/mesh.magSf())); phic = min(interface.cAlpha()*phic, max(phic)); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H index 1a718434a8..cf50980460 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterDyMFoam/readControls.H @@ -1,17 +1,5 @@ #include "readTimeControls.H" - label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); - - label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); - - if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) - { - FatalErrorIn(args.executable()) - << "Sub-cycling alpha is only allowed for PISO, " - "i.e. when the number of outer-correctors = 1" - << exit(FatalError); - } - bool correctPhi = pimple.dict().lookupOrDefault("correctPhi", true); diff --git a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C index a42d911980..ed5faa7c86 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C +++ b/applications/solvers/multiphase/compressibleInterFoam/compressibleInterFoam.C @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) pimpleControl pimple(mesh); - #include "readControls.H" + #include "readTimeControls.H" #include "initContinuityErrs.H" #include "createFields.H" #include "CourantNo.H" @@ -68,7 +68,7 @@ int main(int argc, char *argv[]) while (runTime.run()) { - #include "readControls.H" + #include "readTimeControls.H" #include "CourantNo.H" #include "setDeltaT.H" diff --git a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H index 73babb08f0..1319378821 100644 --- a/applications/solvers/multiphase/compressibleInterFoam/pEqn.H +++ b/applications/solvers/multiphase/compressibleInterFoam/pEqn.H @@ -85,8 +85,8 @@ if (pimple.finalNonOrthogonalIter()) { - //p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); - //p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh; + p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); + p_rgh = p - (alpha1*rho1 + alpha2*rho2)*gh; dgdt = ( @@ -102,7 +102,7 @@ } } - p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); + // p = max(p_rgh + (alpha1*rho1 + alpha2*rho2)*gh, pMin); // Update densities from change in p_rgh rho1 += psi1*(p_rgh - p_rgh_0); diff --git a/applications/solvers/multiphase/compressibleInterFoam/readControls.H b/applications/solvers/multiphase/compressibleInterFoam/readControls.H deleted file mode 100644 index 87a055d641..0000000000 --- a/applications/solvers/multiphase/compressibleInterFoam/readControls.H +++ /dev/null @@ -1,13 +0,0 @@ - #include "readTimeControls.H" - - label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); - - label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); - - if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) - { - FatalErrorIn(args.executable()) - << "Sub-cycling alpha is only allowed for PISO operation, " - "i.e. when the number of outer-correctors = 1" - << exit(FatalError); - } diff --git a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H index cb8b4efc3b..9913595cf2 100644 --- a/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H +++ b/applications/solvers/multiphase/compressibleTwoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H @@ -1,4 +1,2 @@ #include "readTimeControls.H" - - int nAlphaCorr(readInt(pimple.dict().lookup("nAlphaCorr"))); - int nAlphaSubCycles(readInt(pimple.dict().lookup("nAlphaSubCycles"))); + #include "alphaControls.H" diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H index 57c78027a4..428876fd22 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/alphaEqnSubCycle.H @@ -1,5 +1,4 @@ -label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); -label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); +#include "alphaControls.H" if (nAlphaSubCycles > 1) { diff --git a/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H b/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H index 8525a8bf67..f419153506 100644 --- a/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H +++ b/applications/solvers/multiphase/interFoam/LTSInterFoam/setrDeltaT.H @@ -130,10 +130,7 @@ << ", " << gMax(1/rDeltaT.internalField()) << endl; } - label nAlphaSubCycles - ( - readLabel(pimpleDict.lookup("nAlphaSubCycles")) - ); + #include "alphaControls.H" rSubDeltaT = rDeltaT*nAlphaSubCycles; } diff --git a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H index 57c78027a4..428876fd22 100644 --- a/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interFoam/alphaEqnSubCycle.H @@ -1,5 +1,4 @@ -label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); -label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); +#include "alphaControls.H" if (nAlphaSubCycles > 1) { diff --git a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H index 97a09ce017..9e3f4f6bd4 100644 --- a/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H +++ b/applications/solvers/multiphase/interFoam/interMixingFoam/alphaEqnsSubCycle.H @@ -1,6 +1,4 @@ -const dictionary& pimpleDict = pimple.dict(); -label nAlphaCorr(readLabel(pimpleDict.lookup("nAlphaCorr"))); -label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles"))); +#include "alphaControls.H" if (nAlphaSubCycles > 1) { diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H index 75015542b5..9e5461614b 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqn.H @@ -4,9 +4,41 @@ surfaceScalarField phir("phir", phic*interface.nHatf()); - for (int gCorr=0; gCorr > vDotAlphal = + twoPhaseProperties->vDotAlphal(); + const volScalarField& vDotcAlphal = vDotAlphal[0](); + const volScalarField& vDotvAlphal = vDotAlphal[1](); + const volScalarField vDotvmcAlphal(vDotvAlphal - vDotcAlphal); + + tmp tphiAlpha; + + if (MULESCorr) { - surfaceScalarField phiAlpha + fvScalarMatrix alpha1Eqn + ( + fvm::ddt(alpha1) + + fvm::div(phi, alpha1, "UD") - fvm::Sp(divU, alpha1) + == + fvm::Sp(vDotvmcAlphal, alpha1) + + vDotcAlphal + ); + + alpha1Eqn.solve(); + + Info<< "Phase-1 volume fraction = " + << alpha1.weightedAverage(mesh.Vsc()).value() + << " Min(alpha1) = " << min(alpha1).value() + << " Max(alpha1) = " << max(alpha1).value() + << endl; + + tphiAlpha = alpha1Eqn.flux(); + } + + volScalarField alpha10("alpha10", alpha1); + + for (int aCorr=0; aCorr tphiAlphaCorr ( fvc::flux ( @@ -22,66 +54,52 @@ ) ); - Pair > vDotAlphal = - twoPhaseProperties->vDotAlphal(); - const volScalarField& vDotcAlphal = vDotAlphal[0](); - const volScalarField& vDotvAlphal = vDotAlphal[1](); + if (MULESCorr) + { + tphiAlphaCorr() -= tphiAlpha(); - volScalarField Sp - ( - IOobject + + volScalarField alpha100("alpha100", alpha10); + alpha10 = alpha1; + + MULES::correct ( - "Sp", - runTime.timeName(), - mesh - ), - vDotvAlphal - vDotcAlphal - ); + geometricOneField(), + alpha1, + tphiAlphaCorr(), + vDotvmcAlphal, + ( + divU*(alpha10 - alpha100) + - vDotvmcAlphal*alpha10 + )(), + 1, + 0 + ); - volScalarField Su - ( - IOobject + tphiAlpha() += tphiAlphaCorr(); + } + else + { + MULES::explicitSolve ( - "Su", - runTime.timeName(), - mesh - ), - // Divergence term is handled explicitly to be - // consistent with the explicit transport solution - divU*alpha1 - + vDotcAlphal - ); + geometricOneField(), + alpha1, + phi, + tphiAlphaCorr(), + vDotvmcAlphal, + (divU*alpha1 + vDotcAlphal)(), + 1, + 0 + ); - //MULES::explicitSolve - //( - // geometricOneField(), - // alpha1, - // phi, - // phiAlpha, - // Sp, - // Su, - // 1, - // 0 - //); - - MULES::implicitSolve - ( - geometricOneField(), - alpha1, - phi, - phiAlpha, - Sp, - Su, - 1, - 0 - ); + tphiAlpha = tphiAlphaCorr; + } alpha2 = 1.0 - alpha1; - rhoPhi += - (runTime.deltaT()/totalDeltaT) - *(phiAlpha*(rho1 - rho2) + phi*rho2); } + rhoPhi = tphiAlpha()*(rho1 - rho2) + phi*rho2; + Info<< "Liquid phase volume fraction = " << alpha1.weightedAverage(mesh.V()).value() << " Min(alpha1) = " << min(alpha1).value() diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H index 5e7fd27f75..a4338b907f 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/interPhaseChangeFoam/alphaEqnSubCycle.H @@ -11,21 +11,18 @@ surfaceScalarField rhoPhi ); { - const dictionary& pimpleDict = pimple.dict(); - - label nAlphaCorr(readLabel(pimpleDict.lookup("nAlphaCorr"))); - - label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles"))); + #include "alphaControls.H" surfaceScalarField phic(mag(phi/mesh.magSf())); phic = min(interface.cAlpha()*phic, max(phic)); volScalarField divU(fvc::div(phi)); - dimensionedScalar totalDeltaT = runTime.deltaT(); - if (nAlphaSubCycles > 1) { + dimensionedScalar totalDeltaT = runTime.deltaT(); + surfaceScalarField rhoPhiSum("rhoPhiSum", rhoPhi); + for ( subCycle alphaSubCycle(alpha1, nAlphaSubCycles); @@ -33,7 +30,10 @@ surfaceScalarField rhoPhi ) { #include "alphaEqn.H" + rhoPhiSum += (runTime.deltaT()/totalDeltaT)*rhoPhi; } + + rhoPhi = rhoPhiSum; } else { diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C index edfc34dfb8..bc6af055f0 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/interPhaseChangeFoam.C @@ -41,7 +41,7 @@ Description \*---------------------------------------------------------------------------*/ #include "fvCFD.H" -#include "IMULES.H" +#include "MULES.H" #include "subCycle.H" #include "interfaceProperties.H" #include "phaseChangeTwoPhaseMixture.H" diff --git a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C index 0cde87042d..a19b6a3d9b 100644 --- a/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C +++ b/applications/solvers/multiphase/multiphaseEulerFoam/multiphaseSystem/multiphaseSystem.C @@ -812,9 +812,8 @@ void Foam::multiphaseSystem::solve() const Time& runTime = mesh_.time(); - const dictionary& pimpleDict = mesh_.solutionDict().subDict("PIMPLE"); - - label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles"))); + const dictionary& alphaControls = mesh_.solverDict(phases_.first().name()); + label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); if (nAlphaSubCycles > 1) { diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index b3c4ecb111..76b4dab8dd 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -249,15 +249,12 @@ void Foam::multiphaseMixture::solve() const Time& runTime = mesh_.time(); - const dictionary& pimpleDict = mesh_.solutionDict().subDict("PIMPLE"); - - label nAlphaSubCycles(readLabel(pimpleDict.lookup("nAlphaSubCycles"))); - - scalar cAlpha(readScalar(pimpleDict.lookup("cAlpha"))); - - volScalarField& alpha = phases_.first(); + const dictionary& alphaControls = mesh_.solverDict(alpha.name()); + label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); + scalar cAlpha(readScalar(alphaControls.lookup("cAlpha"))); + if (nAlphaSubCycles > 1) { surfaceScalarField rhoPhiSum(0.0*rhoPhi_); diff --git a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H index 57c78027a4..428876fd22 100644 --- a/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H +++ b/applications/solvers/multiphase/twoLiquidMixingFoam/alphaEqnSubCycle.H @@ -1,5 +1,4 @@ -label nAlphaCorr(readLabel(pimple.dict().lookup("nAlphaCorr"))); -label nAlphaSubCycles(readLabel(pimple.dict().lookup("nAlphaSubCycles"))); +#include "alphaControls.H" if (nAlphaSubCycles > 1) { diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H b/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H index 1abe3ef10d..813fdd8f10 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/readTwoPhaseEulerFoamControls.H @@ -1,5 +1,4 @@ #include "readTimeControls.H" + #include "alphaControls.H" - int nAlphaCorr(readInt(pimple.dict().lookup("nAlphaCorr"))); - int nAlphaSubCycles(readInt(pimple.dict().lookup("nAlphaSubCycles"))); Switch correctAlpha(pimple.dict().lookup("correctAlpha")); diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C index 62ca855e78..ff5994e670 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.C @@ -48,6 +48,25 @@ void Foam::MULES::explicitSolve } +void Foam::MULES::correct +( + volScalarField& psi, + surfaceScalarField& phiPsiCorr, + const scalar psiMax, + const scalar psiMin +) +{ + correct + ( + geometricOneField(), + psi, + phiPsiCorr, + zeroField(), zeroField(), + psiMax, psiMin + ); +} + + void Foam::MULES::limitSum(UPtrList& phiPsiCorrs) { forAll(phiPsiCorrs[0], facei) diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H index 2307c289e4..c1d824b950 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULES.H @@ -92,6 +92,38 @@ void explicitSolve const scalar psiMin ); + +template +void correct +( + const RhoType& rho, + volScalarField& psi, + const surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su +); + +template +void correct +( + const RhoType& rho, + volScalarField& psi, + surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin +); + +void correct +( + volScalarField& psi, + surfaceScalarField& phiCorr, + const scalar psiMax, + const scalar psiMin +); + + template void limiter ( @@ -122,6 +154,35 @@ void limit const bool returnCorr ); + +template +void limiterCorr +( + scalarField& allLambda, + const RhoType& rho, + const volScalarField& psi, + const surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin, + const label nLimiterIter +); + +template +void limitCorr +( + const RhoType& rho, + const volScalarField& psi, + surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin, + const label nLimiterIter +); + + void limitSum(UPtrList& phiPsiCorrs); template diff --git a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C index a3cb9f17e9..e0718f923a 100644 --- a/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C +++ b/src/finiteVolume/fvMatrices/solvers/MULES/MULESTemplates.C @@ -96,6 +96,74 @@ void Foam::MULES::explicitSolve } +template +void Foam::MULES::correct +( + const RhoType& rho, + volScalarField& psi, + const surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su +) +{ + Info<< "MULES: Correcting " << psi.name() << endl; + + const fvMesh& mesh = psi.mesh(); + + const scalar deltaT = mesh.time().deltaTValue(); + + scalarField psiIf(psi.size(), 0); + fvc::surfaceIntegrate(psiIf, phiCorr); + + if (mesh.moving()) + { + psi.internalField() = + ( + rho.field()*psi.internalField()/deltaT + + Su.field() + - psiIf + )/(rho.field()/deltaT - Sp.field()); + } + else + { + psi.internalField() = + ( + rho.field()*psi.internalField()/deltaT + + Su.field() + - psiIf + )/(rho.field()/deltaT - Sp.field()); + } + + psi.correctBoundaryConditions(); +} + + +template +void Foam::MULES::correct +( + const RhoType& rho, + volScalarField& psi, + surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin +) +{ + const fvMesh& mesh = psi.mesh(); + + const dictionary& MULEScontrols = mesh.solverDict(psi.name()); + + label nLimiterIter + ( + readLabel(MULEScontrols.lookup("nLimiterIter")) + ); + + limitCorr(rho, psi, phiCorr, Sp, Su, psiMax, psiMin, nLimiterIter); + correct(rho, psi, phiCorr, Sp, Su); +} + + template void Foam::MULES::limiter ( @@ -511,6 +579,364 @@ void Foam::MULES::limit } +template +void Foam::MULES::limiterCorr +( + scalarField& allLambda, + const RhoType& rho, + const volScalarField& psi, + const surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin, + const label nLimiterIter +) +{ + const scalarField& psiIf = psi; + const volScalarField::GeometricBoundaryField& psiBf = psi.boundaryField(); + + const fvMesh& mesh = psi.mesh(); + + const labelUList& owner = mesh.owner(); + const labelUList& neighb = mesh.neighbour(); + tmp tVsc = mesh.Vsc(); + const scalarField& V = tVsc(); + const scalar deltaT = mesh.time().deltaTValue(); + + const scalarField& phiCorrIf = phiCorr; + const surfaceScalarField::GeometricBoundaryField& phiCorrBf = + phiCorr.boundaryField(); + + slicedSurfaceScalarField lambda + ( + IOobject + ( + "lambda", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh, + dimless, + allLambda, + false // Use slices for the couples + ); + + scalarField& lambdaIf = lambda; + surfaceScalarField::GeometricBoundaryField& lambdaBf = + lambda.boundaryField(); + + scalarField psiMaxn(psiIf.size(), psiMin); + scalarField psiMinn(psiIf.size(), psiMax); + + scalarField sumPhip(psiIf.size(), VSMALL); + scalarField mSumPhim(psiIf.size(), VSMALL); + + forAll(phiCorrIf, facei) + { + label own = owner[facei]; + label nei = neighb[facei]; + + psiMaxn[own] = max(psiMaxn[own], psiIf[nei]); + psiMinn[own] = min(psiMinn[own], psiIf[nei]); + + psiMaxn[nei] = max(psiMaxn[nei], psiIf[own]); + psiMinn[nei] = min(psiMinn[nei], psiIf[own]); + + scalar phiCorrf = phiCorrIf[facei]; + + if (phiCorrf > 0.0) + { + sumPhip[own] += phiCorrf; + mSumPhim[nei] += phiCorrf; + } + else + { + mSumPhim[own] -= phiCorrf; + sumPhip[nei] -= phiCorrf; + } + } + + forAll(phiCorrBf, patchi) + { + const fvPatchScalarField& psiPf = psiBf[patchi]; + const scalarField& phiCorrPf = phiCorrBf[patchi]; + + const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); + + if (psiPf.coupled()) + { + const scalarField psiPNf(psiPf.patchNeighbourField()); + + forAll(phiCorrPf, pFacei) + { + label pfCelli = pFaceCells[pFacei]; + + psiMaxn[pfCelli] = max(psiMaxn[pfCelli], psiPNf[pFacei]); + psiMinn[pfCelli] = min(psiMinn[pfCelli], psiPNf[pFacei]); + } + } + else + { + forAll(phiCorrPf, pFacei) + { + label pfCelli = pFaceCells[pFacei]; + + psiMaxn[pfCelli] = max(psiMaxn[pfCelli], psiPf[pFacei]); + psiMinn[pfCelli] = min(psiMinn[pfCelli], psiPf[pFacei]); + } + } + + forAll(phiCorrPf, pFacei) + { + label pfCelli = pFaceCells[pFacei]; + + scalar phiCorrf = phiCorrPf[pFacei]; + + if (phiCorrf > 0.0) + { + sumPhip[pfCelli] += phiCorrf; + } + else + { + mSumPhim[pfCelli] -= phiCorrf; + } + } + } + + psiMaxn = min(psiMaxn, psiMax); + psiMinn = max(psiMinn, psiMin); + + // scalar smooth = 0.5; + // psiMaxn = min((1.0 - smooth)*psiIf + smooth*psiMaxn, psiMax); + // psiMinn = max((1.0 - smooth)*psiIf + smooth*psiMinn, psiMin); + + psiMaxn = + V + *( + (rho.field()/deltaT - Sp.field())*psiMaxn + - Su.field() + - rho.field()*psi.internalField()/deltaT + ); + + psiMinn = + V + *( + Su.field() + - (rho.field()/deltaT - Sp.field())*psiMinn + + rho.field()*psi.internalField()/deltaT + ); + + scalarField sumlPhip(psiIf.size()); + scalarField mSumlPhim(psiIf.size()); + + for (int j=0; j 0.0) + { + sumlPhip[own] += lambdaPhiCorrf; + mSumlPhim[nei] += lambdaPhiCorrf; + } + else + { + mSumlPhim[own] -= lambdaPhiCorrf; + sumlPhip[nei] -= lambdaPhiCorrf; + } + } + + forAll(lambdaBf, patchi) + { + scalarField& lambdaPf = lambdaBf[patchi]; + const scalarField& phiCorrfPf = phiCorrBf[patchi]; + + const labelList& pFaceCells = mesh.boundary()[patchi].faceCells(); + + forAll(lambdaPf, pFacei) + { + label pfCelli = pFaceCells[pFacei]; + + scalar lambdaPhiCorrf = lambdaPf[pFacei]*phiCorrfPf[pFacei]; + + if (lambdaPhiCorrf > 0.0) + { + sumlPhip[pfCelli] += lambdaPhiCorrf; + } + else + { + mSumlPhim[pfCelli] -= lambdaPhiCorrf; + } + } + } + + forAll(sumlPhip, celli) + { + sumlPhip[celli] = + max(min + ( + (sumlPhip[celli] + psiMaxn[celli])/mSumPhim[celli], + 1.0), 0.0 + ); + + mSumlPhim[celli] = + max(min + ( + (mSumlPhim[celli] + psiMinn[celli])/sumPhip[celli], + 1.0), 0.0 + ); + } + + const scalarField& lambdam = sumlPhip; + const scalarField& lambdap = mSumlPhim; + + forAll(lambdaIf, facei) + { + if (phiCorrIf[facei] > 0.0) + { + lambdaIf[facei] = min + ( + lambdaIf[facei], + min(lambdap[owner[facei]], lambdam[neighb[facei]]) + ); + } + else + { + lambdaIf[facei] = min + ( + lambdaIf[facei], + min(lambdam[owner[facei]], lambdap[neighb[facei]]) + ); + } + } + + + forAll(lambdaBf, patchi) + { + fvsPatchScalarField& lambdaPf = lambdaBf[patchi]; + const scalarField& phiCorrfPf = phiCorrBf[patchi]; + const fvPatchScalarField& psiPf = psiBf[patchi]; + + if (isA(mesh.boundary()[patchi])) + { + lambdaPf = 0; + } + else if (psiPf.coupled()) + { + const labelList& pFaceCells = + mesh.boundary()[patchi].faceCells(); + + forAll(lambdaPf, pFacei) + { + label pfCelli = pFaceCells[pFacei]; + + if (phiCorrfPf[pFacei] > 0.0) + { + lambdaPf[pFacei] = + min(lambdaPf[pFacei], lambdap[pfCelli]); + } + else + { + lambdaPf[pFacei] = + min(lambdaPf[pFacei], lambdam[pfCelli]); + } + } + } + else + { + const labelList& pFaceCells = + mesh.boundary()[patchi].faceCells(); + const scalarField& phiCorrPf = phiCorrBf[patchi]; + + forAll(lambdaPf, pFacei) + { + // Limit outlet faces only + if (phiCorrPf[pFacei] > 0) + { + label pfCelli = pFaceCells[pFacei]; + + if (phiCorrfPf[pFacei] > 0.0) + { + lambdaPf[pFacei] = + min(lambdaPf[pFacei], lambdap[pfCelli]); + } + else + { + lambdaPf[pFacei] = + min(lambdaPf[pFacei], lambdam[pfCelli]); + } + } + } + } + } + + syncTools::syncFaceList(mesh, allLambda, minEqOp()); + } +} + + +template +void Foam::MULES::limitCorr +( + const RhoType& rho, + const volScalarField& psi, + surfaceScalarField& phiCorr, + const SpType& Sp, + const SuType& Su, + const scalar psiMax, + const scalar psiMin, + const label nLimiterIter +) +{ + const fvMesh& mesh = psi.mesh(); + + scalarField allLambda(mesh.nFaces(), 1.0); + + slicedSurfaceScalarField lambda + ( + IOobject + ( + "lambda", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + mesh, + dimless, + allLambda, + false // Use slices for the couples + ); + + limiterCorr + ( + allLambda, + rho, + psi, + phiCorr, + Sp, + Su, + psiMax, + psiMin, + nLimiterIter + ); + + phiCorr *= lambda; +} + + template void Foam::MULES::limitSum(SurfaceScalarFieldList& phiPsiCorrs) { diff --git a/src/transportModels/interfaceProperties/interfaceProperties.C b/src/transportModels/interfaceProperties/interfaceProperties.C index 63a1340ee9..ec9ace6ef9 100644 --- a/src/transportModels/interfaceProperties/interfaceProperties.C +++ b/src/transportModels/interfaceProperties/interfaceProperties.C @@ -159,7 +159,7 @@ Foam::interfaceProperties::interfaceProperties ( readScalar ( - alpha1.mesh().solutionDict().subDict("PIMPLE").lookup("cAlpha") + alpha1.mesh().solverDict(alpha1.name()).lookup("cAlpha") ) ), sigma_(dict.lookup("sigma")), diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/controlDict b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/controlDict index f190eaf2ff..d1a8467089 100644 --- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/controlDict +++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/controlDict @@ -14,37 +14,37 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -application interPhaseChangeFoam; +application interPhaseChangeFoam; -startFrom latestTime; +startFrom latestTime; -startTime 0; +startTime 0; -stopAt endTime; +stopAt endTime; -endTime 0.05; +endTime 0.05; -deltaT 1e-8; +deltaT 1e-8; -writeControl adjustableRunTime; +writeControl adjustableRunTime; -writeInterval 0.001; +writeInterval 0.001; -purgeWrite 0; +purgeWrite 0; -writeFormat ascii; +writeFormat ascii; -writePrecision 6; +writePrecision 6; -writeCompression uncompressed; +writeCompression uncompressed; -timeFormat general; +timeFormat general; -runTimeModifiable yes; +runTimeModifiable yes; -adjustTimeStep on; +adjustTimeStep on; -maxCo 1.0; +maxCo 5; // ************************************************************************* // diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes index 9143f603f4..8ddd1fe903 100644 --- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes +++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSchemes @@ -32,6 +32,7 @@ divSchemes div(phi,k) Gauss linearUpwind grad(k); div(phi,alpha) Gauss vanLeer; div(phirb,alpha) Gauss interfaceCompression; + UD Gauss upwind; div((muEff*dev(T(grad(U))))) Gauss linear; } @@ -47,10 +48,7 @@ laplacianSchemes snGradSchemes { - default none; - snGrad(pd) limited corrected 0.5; - snGrad(rho) limited corrected 0.5; - snGrad(alpha1) limited corrected 0.5; + default limited corrected 0.5; } fluxRequired diff --git a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSolution b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSolution index bfbd5df271..a1f8f8ffd5 100644 --- a/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSolution +++ b/tutorials/multiphase/interPhaseChangeFoam/cavitatingBullet/system/fvSolution @@ -18,22 +18,24 @@ solvers { alpha1 { - maxUnboundedness 1e-5; - CoCoeff 2; - maxIter 5; - nLimiterIter 2; + cAlpha 0; + nAlphaCorr 2; + nAlphaSubCycles 1; - solver PBiCG; - preconditioner DILU; - tolerance 1e-12; - relTol 0.1; + MULESCorr yes; + nLimiterIter 5; + + solver PBiCG; + preconditioner DILU; + tolerance 1e-8; + relTol 0; }; - U + "U.*" { solver PBiCG; preconditioner DILU; - tolerance 1e-06; + tolerance 1e-6; relTol 0; }; @@ -96,10 +98,6 @@ PIMPLE nOuterCorrectors 1; nCorrectors 3; nNonOrthogonalCorrectors 0; - - cAlpha 0; - nAlphaCorr 1; - nAlphaSubCycles 1; } From 000dd24b87fdd43fc4728a0cd23eaabd1fe7cc43 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 3 May 2013 15:47:15 +0100 Subject: [PATCH 14/41] boundedBackwardDdtScheme: Removed; it is total nonsense and would cause serious conservation errors --- src/finiteVolume/Make/files | 2 - .../boundedBackwardDdtScheme.C | 708 ------------------ .../boundedBackwardDdtScheme.H | 193 ----- .../boundedBackwardDdtSchemes.C | 44 -- 4 files changed, 947 deletions(-) delete mode 100644 src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C delete mode 100644 src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.H delete mode 100644 src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C diff --git a/src/finiteVolume/Make/files b/src/finiteVolume/Make/files index ddf9564230..5f87a9ceef 100644 --- a/src/finiteVolume/Make/files +++ b/src/finiteVolume/Make/files @@ -321,8 +321,6 @@ $(ddtSchemes)/CoEulerDdtScheme/CoEulerDdtSchemes.C $(ddtSchemes)/SLTSDdtScheme/SLTSDdtSchemes.C $(ddtSchemes)/localEulerDdtScheme/localEulerDdtSchemes.C $(ddtSchemes)/backwardDdtScheme/backwardDdtSchemes.C -$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C -$(ddtSchemes)/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C $(ddtSchemes)/CrankNicolsonDdtScheme/CrankNicolsonDdtSchemes.C $(ddtSchemes)/boundedDdtScheme/boundedDdtSchemes.C diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C b/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C deleted file mode 100644 index b46ca8e0f9..0000000000 --- a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.C +++ /dev/null @@ -1,708 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 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 . - -\*---------------------------------------------------------------------------*/ - -#include "boundedBackwardDdtScheme.H" -#include "surfaceInterpolate.H" -#include "fvcDiv.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace fv -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -scalar boundedBackwardDdtScheme::deltaT_() const -{ - return mesh().time().deltaTValue(); -} - - -scalar boundedBackwardDdtScheme::deltaT0_() const -{ - return mesh().time().deltaT0Value(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -tmp -boundedBackwardDdtScheme::fvcDdt -( - const dimensionedScalar& dt -) -{ - // No change compared to backward - - dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); - - IOobject ddtIOobject - ( - "ddt("+dt.name()+')', - mesh().time().timeName(), - mesh() - ); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(); - - scalar coefft = 1 + deltaT/(deltaT + deltaT0); - scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0)); - scalar coefft0 = coefft + coefft00; - - if (mesh().moving()) - { - tmp tdtdt - ( - new volScalarField - ( - ddtIOobject, - mesh(), - dimensionedScalar - ( - "0", - dt.dimensions()/dimTime, - 0.0 - ) - ) - ); - - tdtdt().internalField() = rDeltaT.value()*dt.value()* - ( - coefft - (coefft0*mesh().V0() - coefft00*mesh().V00())/mesh().V() - ); - - return tdtdt; - } - else - { - return tmp - ( - new volScalarField - ( - ddtIOobject, - mesh(), - dimensionedScalar - ( - "0", - dt.dimensions()/dimTime, - 0.0 - ), - calculatedFvPatchScalarField::typeName - ) - ); - } -} - - -tmp -boundedBackwardDdtScheme::fvcDdt -( - const volScalarField& vf -) -{ - dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); - - IOobject ddtIOobject - ( - "ddt("+vf.name()+')', - mesh().time().timeName(), - mesh() - ); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const volScalarField phict - ( - mag - ( - vf.oldTime().oldTime() - - vf.oldTime().oldTime().oldTime() - )/ - ( - mag - ( - vf.oldTime() - - vf.oldTime().oldTime() - ) - + dimensionedScalar("small", vf.dimensions(), VSMALL) - ) - ); - - const volScalarField limiter(pos(phict) - pos(phict - scalar(1))); - const volScalarField coefft(scalar(1) + limiter*deltaT/(deltaT + deltaT0)); - const volScalarField coefft00 - ( - limiter*sqr(deltaT)/(deltaT0*(deltaT + deltaT0)) - ); - const volScalarField coefft0(coefft + coefft00); - - if (mesh().moving()) - { - return tmp - ( - new volScalarField - ( - ddtIOobject, - mesh(), - rDeltaT.dimensions()*vf.dimensions(), - rDeltaT.value()* - ( - coefft*vf.internalField() - - ( - coefft0.internalField() - *vf.oldTime().internalField()*mesh().V0() - - coefft00.internalField() - *vf.oldTime().oldTime().internalField() - *mesh().V00() - )/mesh().V() - ), - rDeltaT.value()* - ( - coefft.boundaryField()*vf.boundaryField() - - ( - coefft0.boundaryField()* - vf.oldTime().boundaryField() - - coefft00.boundaryField()* - vf.oldTime().oldTime().boundaryField() - ) - ) - ) - ); - } - else - { - return tmp - ( - new volScalarField - ( - ddtIOobject, - rDeltaT* - ( - coefft*vf - - coefft0*vf.oldTime() - + coefft00*vf.oldTime().oldTime() - ) - ) - ); - } -} - - -tmp -boundedBackwardDdtScheme::fvcDdt -( - const dimensionedScalar& rho, - const volScalarField& vf -) -{ - dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); - - IOobject ddtIOobject - ( - "ddt("+rho.name()+','+vf.name()+')', - mesh().time().timeName(), - mesh() - ); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const volScalarField phict - ( - mag - ( - vf.oldTime().oldTime() - - vf.oldTime().oldTime().oldTime() - )/ - ( - mag - ( - vf.oldTime() - - vf.oldTime().oldTime() - ) - + dimensionedScalar("small", vf.dimensions(), VSMALL) - ) - ); - - const volScalarField limiter(pos(phict) - pos(phict - scalar(1))); - const volScalarField coefft(scalar(1) + limiter*deltaT/(deltaT + deltaT0)); - const volScalarField coefft00 - ( - limiter*sqr(deltaT)/(deltaT0*(deltaT + deltaT0)) - ); - const volScalarField coefft0(coefft + coefft00); - - if (mesh().moving()) - { - return tmp - ( - new volScalarField - ( - ddtIOobject, - mesh(), - rDeltaT.dimensions()*rho.dimensions()*vf.dimensions(), - rDeltaT.value()*rho.value()* - ( - coefft*vf.internalField() - - ( - coefft0.internalField()* - vf.oldTime().internalField()*mesh().V0() - - coefft00.internalField()* - vf.oldTime().oldTime().internalField() - *mesh().V00() - )/mesh().V() - ), - rDeltaT.value()*rho.value()* - ( - coefft.boundaryField()*vf.boundaryField() - - ( - coefft0.boundaryField()* - vf.oldTime().boundaryField() - - coefft00.boundaryField()* - vf.oldTime().oldTime().boundaryField() - ) - ) - ) - ); - } - else - { - return tmp - ( - new volScalarField - ( - ddtIOobject, - rDeltaT*rho* - ( - coefft*vf - - coefft0*vf.oldTime() - + coefft00*vf.oldTime().oldTime() - ) - ) - ); - } -} - - -tmp -boundedBackwardDdtScheme::fvcDdt -( - const volScalarField& rho, - const volScalarField& vf -) -{ - dimensionedScalar rDeltaT = 1.0/mesh().time().deltaT(); - - IOobject ddtIOobject - ( - "ddt("+rho.name()+','+vf.name()+')', - mesh().time().timeName(), - mesh() - ); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const volScalarField phict - ( - mag - ( - rho.oldTime().oldTime()*vf.oldTime().oldTime() - - rho.oldTime().oldTime().oldTime()*vf.oldTime().oldTime().oldTime() - )/ - ( - mag - ( - rho.oldTime()*vf.oldTime() - - rho.oldTime().oldTime()*vf.oldTime().oldTime() - ) - + dimensionedScalar("small", rho.dimensions()*vf.dimensions(), VSMALL) - ) - ); - - const volScalarField limiter(pos(phict) - pos(phict - scalar(1))); - const volScalarField coefft(scalar(1) + limiter*deltaT/(deltaT + deltaT0)); - const volScalarField coefft00 - ( - limiter*sqr(deltaT)/(deltaT0*(deltaT + deltaT0)) - ); - const volScalarField coefft0(coefft + coefft00); - - if (mesh().moving()) - { - return tmp - ( - new volScalarField - ( - ddtIOobject, - mesh(), - rDeltaT.dimensions()*rho.dimensions()*vf.dimensions(), - rDeltaT.value()* - ( - coefft*rho.internalField()*vf.internalField() - - ( - coefft0.internalField()* - rho.oldTime().internalField()* - vf.oldTime().internalField()*mesh().V0() - - coefft00.internalField()* - rho.oldTime().oldTime().internalField() - *vf.oldTime().oldTime().internalField()*mesh().V00() - )/mesh().V() - ), - rDeltaT.value()* - ( - coefft.boundaryField()*vf.boundaryField() - - ( - coefft0.boundaryField()* - rho.oldTime().boundaryField()* - vf.oldTime().boundaryField() - - coefft00.boundaryField()* - rho.oldTime().oldTime().boundaryField()* - vf.oldTime().oldTime().boundaryField() - ) - ) - ) - ); - } - else - { - return tmp - ( - new volScalarField - ( - ddtIOobject, - rDeltaT* - ( - coefft*rho*vf - - coefft0*rho.oldTime()*vf.oldTime() - + coefft00*rho.oldTime().oldTime()*vf.oldTime().oldTime() - ) - ) - ); - } -} - - -tmp -boundedBackwardDdtScheme::fvmDdt -( - const volScalarField& vf -) -{ - tmp tfvm - ( - new fvScalarMatrix - ( - vf, - vf.dimensions()*dimVol/dimTime - ) - ); - - fvScalarMatrix& fvm = tfvm(); - - scalar rDeltaT = 1.0/deltaT_(); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const scalarField phict - ( - mag - ( - vf.oldTime().oldTime().internalField() - - vf.oldTime().oldTime().oldTime().internalField() - )/ - ( - mag - ( - vf.oldTime().internalField() - - vf.oldTime().oldTime().internalField() - ) - + VSMALL - ) - ); - - const scalarField limiter(pos(phict) - pos(phict - 1.0)); - const scalarField coefft(1.0 + limiter*deltaT/(deltaT + deltaT0)); - const scalarField coefft00 - ( - limiter*deltaT*deltaT/(deltaT0*(deltaT + deltaT0)) - ); - const scalarField coefft0(coefft + coefft00); - - fvm.diag() = (coefft*rDeltaT)*mesh().V(); - - if (mesh().moving()) - { - fvm.source() = rDeltaT* - ( - coefft0*vf.oldTime().internalField()*mesh().V0() - - coefft00*vf.oldTime().oldTime().internalField() - *mesh().V00() - ); - } - else - { - fvm.source() = rDeltaT*mesh().V()* - ( - coefft0*vf.oldTime().internalField() - - coefft00*vf.oldTime().oldTime().internalField() - ); - } - - return tfvm; -} - - -tmp -boundedBackwardDdtScheme::fvmDdt -( - const dimensionedScalar& rho, - const volScalarField& vf -) -{ - tmp tfvm - ( - new fvScalarMatrix - ( - vf, - rho.dimensions()*vf.dimensions()*dimVol/dimTime - ) - ); - fvScalarMatrix& fvm = tfvm(); - - scalar rDeltaT = 1.0/deltaT_(); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const scalarField phict - ( - mag - ( - vf.oldTime().oldTime().internalField() - - vf.oldTime().oldTime().oldTime().internalField() - )/ - ( - mag - ( - vf.oldTime().internalField() - - vf.oldTime().oldTime().internalField() - ) - + VSMALL - ) - ); - - const scalarField limiter(pos(phict) - pos(phict - 1.0)); - const scalarField coefft(1.0 + limiter*deltaT/(deltaT + deltaT0)); - const scalarField coefft00 - ( - limiter*deltaT*deltaT/(deltaT0*(deltaT + deltaT0)) - ); - const scalarField coefft0(coefft + coefft00); - - fvm.diag() = (coefft*rDeltaT*rho.value())*mesh().V(); - - if (mesh().moving()) - { - fvm.source() = rDeltaT*rho.value()* - ( - coefft0*vf.oldTime().internalField()*mesh().V0() - - coefft00*vf.oldTime().oldTime().internalField() - *mesh().V00() - ); - } - else - { - fvm.source() = rDeltaT*mesh().V()*rho.value()* - ( - coefft0*vf.oldTime().internalField() - - coefft00*vf.oldTime().oldTime().internalField() - ); - } - - return tfvm; -} - - -tmp -boundedBackwardDdtScheme::fvmDdt -( - const volScalarField& rho, - const volScalarField& vf -) -{ - tmp tfvm - ( - new fvScalarMatrix - ( - vf, - rho.dimensions()*vf.dimensions()*dimVol/dimTime - ) - ); - fvScalarMatrix& fvm = tfvm(); - - scalar rDeltaT = 1.0/deltaT_(); - - scalar deltaT = deltaT_(); - scalar deltaT0 = deltaT0_(vf); - - // Calculate unboundedness indicator - // Note: all times moved by one because access to internal field - // copies current field into the old-time level. - const scalarField phict - ( - mag - ( - rho.oldTime().oldTime().internalField()* - vf.oldTime().oldTime().internalField() - - rho.oldTime().oldTime().oldTime().internalField()* - vf.oldTime().oldTime().oldTime().internalField() - )/ - ( - mag - ( - rho.oldTime().internalField()* - vf.oldTime().internalField() - - rho.oldTime().oldTime().internalField()* - vf.oldTime().oldTime().internalField() - ) - + VSMALL - ) - ); - - const scalarField limiter(pos(phict) - pos(phict - 1.0)); - const scalarField coefft(1.0 + limiter*deltaT/(deltaT + deltaT0)); - const scalarField coefft00 - ( - limiter*deltaT*deltaT/(deltaT0*(deltaT + deltaT0)) - ); - const scalarField coefft0(coefft + coefft00); - - fvm.diag() = (coefft*rDeltaT)*rho.internalField()*mesh().V(); - - if (mesh().moving()) - { - fvm.source() = rDeltaT* - ( - coefft0*rho.oldTime().internalField() - *vf.oldTime().internalField()*mesh().V0() - - coefft00*rho.oldTime().oldTime().internalField() - *vf.oldTime().oldTime().internalField()*mesh().V00() - ); - } - else - { - fvm.source() = rDeltaT*mesh().V()* - ( - coefft0*rho.oldTime().internalField() - *vf.oldTime().internalField() - - coefft00*rho.oldTime().oldTime().internalField() - *vf.oldTime().oldTime().internalField() - ); - } - - return tfvm; -} - - -tmp boundedBackwardDdtScheme::fvcDdtPhiCorr -( - const volScalarField& rA, - const volScalarField& U, - const surfaceScalarField& phi -) -{ - notImplemented - ( - "boundedBackwardDdtScheme::fvcDdtPhiCorr" - ); - - return surfaceScalarField::null(); -} - - -tmp boundedBackwardDdtScheme::fvcDdtPhiCorr -( - const volScalarField& rA, - const volScalarField& rho, - const volScalarField& U, - const surfaceScalarField& phi -) -{ - notImplemented - ( - "boundedBackwardDdtScheme::fvcDdtPhiCorr" - ); - - return surfaceScalarField::null(); -} - - -tmp boundedBackwardDdtScheme::meshPhi -( - const volScalarField& vf -) -{ - notImplemented - ( - "boundedBackwardDdtScheme::meshPhi(const volScalarField& vf)" - ); - - return surfaceScalarField::null(); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.H b/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.H deleted file mode 100644 index 900e2a7993..0000000000 --- a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtScheme.H +++ /dev/null @@ -1,193 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 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 . - -Class - Foam::fv::boundedBackwardDdtScheme - -Description - Second-order bounded-backward-differencing ddt using the current and - two previous time-step values. - -SourceFiles - boundedBackwardDdtScheme.C - -\*---------------------------------------------------------------------------*/ - -#ifndef boundedBackwardDdtScheme_H -#define boundedBackwardDdtScheme_H - -#include "ddtScheme.H" -#include "fvMatrices.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace fv -{ - -/*---------------------------------------------------------------------------*\ - Class boundedBackwardDdtScheme Declaration -\*---------------------------------------------------------------------------*/ - -class boundedBackwardDdtScheme -: - public fv::ddtScheme -{ - // Private Member Functions - - //- Return the current time-step - scalar deltaT_() const; - - //- Return the previous time-step - scalar deltaT0_() const; - - //- Return the previous time-step or GREAT if the old timestep field - // wasn't available in which case Euler ddt is used - template - scalar deltaT0_(const GeoField& vf) const - { - if (vf.oldTime().timeIndex() == vf.oldTime().oldTime().timeIndex()) - { - return GREAT; - } - else - { - return deltaT0_(); - } - } - - - //- Disallow default bitwise copy construct - boundedBackwardDdtScheme(const boundedBackwardDdtScheme&); - - //- Disallow default bitwise assignment - void operator=(const boundedBackwardDdtScheme&); - - -public: - - //- Runtime type information - TypeName("boundedBackward"); - - - // Constructors - - //- Construct from mesh - boundedBackwardDdtScheme(const fvMesh& mesh) - : - ddtScheme(mesh) - {} - - //- Construct from mesh and Istream - boundedBackwardDdtScheme(const fvMesh& mesh, Istream& is) - : - ddtScheme(mesh, is) - {} - - - // Member Functions - - //- Return mesh reference - const fvMesh& mesh() const - { - return fv::ddtScheme::mesh(); - } - - tmp fvcDdt - ( - const dimensionedScalar& - ); - - tmp fvcDdt - ( - const volScalarField& - ); - - tmp fvcDdt - ( - const dimensionedScalar&, - const volScalarField& - ); - - tmp fvcDdt - ( - const volScalarField&, - const volScalarField& - ); - - tmp fvmDdt - ( - const volScalarField& - ); - - tmp fvmDdt - ( - const dimensionedScalar&, - const volScalarField& - ); - - tmp fvmDdt - ( - const volScalarField&, - const volScalarField& - ); - - tmp fvcDdtPhiCorr - ( - const volScalarField& rA, - const volScalarField& U, - const surfaceScalarField& phi - ); - - tmp fvcDdtPhiCorr - ( - const volScalarField& rA, - const volScalarField& rho, - const volScalarField& U, - const surfaceScalarField& phi - ); - - tmp meshPhi - ( - const volScalarField& - ); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace fv - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C b/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C deleted file mode 100644 index 1504b8ba3b..0000000000 --- a/src/finiteVolume/finiteVolume/ddtSchemes/boundedBackwardDdtScheme/boundedBackwardDdtSchemes.C +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2011 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 . - -\*---------------------------------------------------------------------------*/ - -#include "boundedBackwardDdtScheme.H" -#include "fvMesh.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace fv -{ - -defineTypeNameAndDebug(boundedBackwardDdtScheme, 0); - -ddtScheme::addIstreamConstructorToTable - addboundedBackwardDdtSchemeIstreamConstructorToTable_; - -} -} - -// ************************************************************************* // From 4fc0924c89e53543f8089b72c7ac60481d7f6571 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 3 May 2013 15:47:33 +0100 Subject: [PATCH 15/41] Remove unnecessary typedefs --- src/OpenFOAM/fields/Fields/Field/Field.C | 1 - .../mappedFixedPushedInternalValueFvPatchField.C | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index 8545c2aa9e..59db58d65d 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -677,7 +677,6 @@ template template void Foam::Field::operator=(const VectorSpace& vs) { - typedef VectorSpace VSType; TFOR_ALL_F_OP_S(Type, *this, =, VSType, vs) } diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.C index 2cea02cd9c..433c417d89 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.C @@ -95,8 +95,6 @@ mappedFixedPushedInternalValueFvPatchField template void Foam::mappedFixedPushedInternalValueFvPatchField::updateCoeffs() { - typedef GeometricField FieldType; - if (this->updated()) { return; From 90656d4fd166ed9a805e9c8563f3783cfef8652a Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 3 May 2013 15:47:45 +0100 Subject: [PATCH 16/41] Update headers --- src/OpenFOAM/fields/Fields/Field/Field.C | 2 +- .../mappedFixedPushedInternalValueFvPatchField.C | 2 +- src/transportModels/interfaceProperties/interfaceProperties.C | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenFOAM/fields/Fields/Field/Field.C b/src/OpenFOAM/fields/Fields/Field/Field.C index 59db58d65d..334eba8e41 100644 --- a/src/OpenFOAM/fields/Fields/Field/Field.C +++ b/src/OpenFOAM/fields/Fields/Field/Field.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.C index 433c417d89..3550e414cf 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/mappedFixedPushedInternalValue/mappedFixedPushedInternalValueFvPatchField.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/transportModels/interfaceProperties/interfaceProperties.C b/src/transportModels/interfaceProperties/interfaceProperties.C index ec9ace6ef9..cfa20630ae 100644 --- a/src/transportModels/interfaceProperties/interfaceProperties.C +++ b/src/transportModels/interfaceProperties/interfaceProperties.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License From 6b19bb219349ca866d1f305e7536a67ca5bc8714 Mon Sep 17 00:00:00 2001 From: Henry Date: Fri, 3 May 2013 15:48:21 +0100 Subject: [PATCH 17/41] VoF: localize reading of alpha controls --- .../cfdTools/general/include/alphaControls.H | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 src/finiteVolume/cfdTools/general/include/alphaControls.H diff --git a/src/finiteVolume/cfdTools/general/include/alphaControls.H b/src/finiteVolume/cfdTools/general/include/alphaControls.H new file mode 100644 index 0000000000..b5ae1f94d8 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/include/alphaControls.H @@ -0,0 +1,12 @@ +const dictionary& alphaControls = mesh.solverDict(alpha1.name()); +label nAlphaCorr(readLabel(alphaControls.lookup("nAlphaCorr"))); +label nAlphaSubCycles(readLabel(alphaControls.lookup("nAlphaSubCycles"))); +Switch MULESCorr(alphaControls.lookup("MULESCorr")); + +if (nAlphaSubCycles > 1 && pimple.nCorrPIMPLE() != 1) +{ + FatalErrorIn(args.executable()) + << "Sub-cycling alpha is only allowed for PISO operation, " + "i.e. when the number of outer-correctors = 1" + << exit(FatalError); +} From 5da306b1c1f8302b0676f6c42f04cfbc9b12e551 Mon Sep 17 00:00:00 2001 From: Sergio Ferraris Date: Fri, 3 May 2013 15:59:41 +0100 Subject: [PATCH 18/41] ENH: viewFactorsGen: Modification of shootRays algorithm. Rays that hit themselfs are continued until they hit(or not) the agglomeration target. If they do the surfaces can see each other. faceAgglomerate: The agglomeration now stops when the global nCoarse is reached (not per-processor) --- .../faceAgglomerate/faceAgglomerate.C | 55 +++++--- .../{faceAgglomerateDict => viewFactorsDict} | 6 + .../viewFactorsGen/searchingEngine.H | 24 +++- .../preProcessing/viewFactorsGen/shootRays.H | 129 +++++++++++++++--- .../viewFactorsGen/viewFactorsGen.C | 122 ++++++++++++++++- .../pairPatchAgglomeration.C | 95 ++++++++----- 6 files changed, 347 insertions(+), 84 deletions(-) rename applications/utilities/preProcessing/faceAgglomerate/{faceAgglomerateDict => viewFactorsDict} (91%) diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C index 2e3a56007b..ee9339d0f9 100644 --- a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C +++ b/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,6 +40,7 @@ Description #include "pairPatchAgglomeration.H" #include "labelListIOList.H" #include "syncTools.H" +#include "globalIndex.H" using namespace Foam; @@ -53,7 +54,7 @@ int main(int argc, char *argv[]) #include "createTime.H" #include "createNamedMesh.H" - const word dictName("faceAgglomerateDict"); + const word dictName("viewFactorsDict"); #include "setConstantMeshDictionaryIO.H" @@ -79,16 +80,16 @@ int main(int argc, char *argv[]) boundary.size() ); - forAll(boundary, patchId) + label nCoarseFaces = 0; + + forAllConstIter(dictionary, agglomDict, iter) { - const polyPatch& pp = boundary[patchId]; - - label patchI = pp.index(); - finalAgglom[patchI].setSize(pp.size(), 0); - - if (!pp.coupled()) + labelList patchIds = boundary.findIndices(iter().keyword()); + forAll(patchIds, i) { - if (agglomDict.found(pp.name())) + label patchI = patchIds[i]; + const polyPatch& pp = boundary[patchI]; + if (!pp.coupled()) { Info << "\nAgglomerating patch : " << pp.name() << endl; pairPatchAgglomeration agglomObject @@ -99,12 +100,11 @@ int main(int argc, char *argv[]) agglomObject.agglomerate(); finalAgglom[patchI] = agglomObject.restrictTopBottomAddressing(); - } - else - { - FatalErrorIn(args.executable()) - << "Patch " << pp.name() << " not found in dictionary: " - << agglomDict.name() << exit(FatalError); + + if (finalAgglom[patchI].size()) + { + nCoarseFaces += max(finalAgglom[patchI] + 1); + } } } } @@ -144,6 +144,7 @@ int main(int argc, char *argv[]) if (writeAgglom) { + globalIndex index(nCoarseFaces); volScalarField facesAgglomeration ( IOobject @@ -158,14 +159,26 @@ int main(int argc, char *argv[]) dimensionedScalar("facesAgglomeration", dimless, 0) ); + label coarsePatchIndex = 0; forAll(boundary, patchId) { - fvPatchScalarField& bFacesAgglomeration = - facesAgglomeration.boundaryField()[patchId]; - - forAll(bFacesAgglomeration, j) + const polyPatch& pp = boundary[patchId]; + if (pp.size() > 0) { - bFacesAgglomeration[j] = finalAgglom[patchId][j]; + fvPatchScalarField& bFacesAgglomeration = + facesAgglomeration.boundaryField()[patchId]; + + forAll(bFacesAgglomeration, j) + { + bFacesAgglomeration[j] = + index.toGlobal + ( + Pstream::myProcNo(), + finalAgglom[patchId][j] + coarsePatchIndex + ); + } + + coarsePatchIndex += max(finalAgglom[patchId]) + 1; } } diff --git a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict b/applications/utilities/preProcessing/faceAgglomerate/viewFactorsDict similarity index 91% rename from applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict rename to applications/utilities/preProcessing/faceAgglomerate/viewFactorsDict index 9c164f1509..931511380f 100644 --- a/applications/utilities/preProcessing/faceAgglomerate/faceAgglomerateDict +++ b/applications/utilities/preProcessing/faceAgglomerate/viewFactorsDict @@ -17,6 +17,12 @@ FoamFile // Write agglomeration as a volScalarField with calculated boundary values writeFacesAgglomeration true; +//Debug option +debug 0; + +//Dump connectivity rays +dumpRays false; + // Per patch (wildcard possible) the coarsening level bottomAir_to_heater { diff --git a/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H b/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H index a48fd193f1..ed1d9031ec 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H +++ b/applications/utilities/preProcessing/viewFactorsGen/searchingEngine.H @@ -32,6 +32,19 @@ forAll(patches, patchI) } } +labelList triSurfaceToAgglom(5*nFineFaces); + +const triSurface localSurface = triangulate +( + patches, + includePatches, + finalAgglom, + triSurfaceToAgglom, + globalNumbering, + coarsePatches +); + + distributedTriSurfaceMesh surfacesMesh ( IOobject @@ -43,12 +56,13 @@ distributedTriSurfaceMesh surfacesMesh IOobject::NO_READ, IOobject::NO_WRITE ), - triSurfaceTools::triangulate - ( - patches, - includePatches - ), + localSurface, dict ); + +triSurfaceToAgglom.resize(surfacesMesh.size()); + //surfacesMesh.searchableSurface::write(); + +surfacesMesh.setField(triSurfaceToAgglom); diff --git a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H index 095436b1a1..9cc1ccbcd3 100644 --- a/applications/utilities/preProcessing/viewFactorsGen/shootRays.H +++ b/applications/utilities/preProcessing/viewFactorsGen/shootRays.H @@ -2,7 +2,7 @@ // Pre-size by assuming a certain percentage is visible. // Maximum lenght for dynamicList -const label maxDynListLength = 10000; +const label maxDynListLength = 100000; for (label procI = 0; procI < Pstream::nProcs(); procI++) { @@ -14,12 +14,17 @@ for (label procI = 0; procI < Pstream::nProcs(); procI++) DynamicList