From 5b10d3c3fa3fbd696607ce941a2bb1dd17b493bb Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 17 Mar 2011 09:58:33 +0000 Subject: [PATCH 1/8] ENH: Added relaxation factor to cloud explicit calcs --- .../KinematicCloud/cloudSolution/cloudSolution.C | 13 +++++++++---- .../KinematicCloud/cloudSolution/cloudSolution.H | 4 ++-- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C index 2d726f45e8..165a7be0b6 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.C @@ -127,17 +127,19 @@ void Foam::cloudSolution::read() schemes_.setSize(vars.size()); forAll(vars, i) { + // read solution variable name schemes_[i].first() = vars[i]; + // set semi-implicit (1) explicit (0) flag Istream& is = schemesDict.lookup(vars[i]); const word scheme(is); if (scheme == "semiImplicit") { - is >> schemes_[i].second(); + schemes_[i].second().first() = true; } else if (scheme == "explicit") { - schemes_[i].second() = -1; + schemes_[i].second().first() = false; } else { @@ -145,6 +147,9 @@ void Foam::cloudSolution::read() << "Invalid scheme " << scheme << ". Valid schemes are " << "explicit and semiImplicit" << exit(FatalError); } + + // read under-relaxation factor + is >> schemes_[i].second().second(); } } @@ -155,7 +160,7 @@ Foam::scalar Foam::cloudSolution::relaxCoeff(const word& fieldName) const { if (fieldName == schemes_[i].first()) { - return schemes_[i].second(); + return schemes_[i].second().second(); } } @@ -173,7 +178,7 @@ bool Foam::cloudSolution::semiImplicit(const word& fieldName) const { if (fieldName == schemes_[i].first()) { - return schemes_[i].second() >= 0; + return schemes_[i].second().first(); } } diff --git a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H index 6c2430e408..5f0fdb1cee 100644 --- a/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H +++ b/src/lagrangian/intermediate/clouds/Templates/KinematicCloud/cloudSolution/cloudSolution.H @@ -25,7 +25,7 @@ Class Foam::cloudSolution Description - - Stores all relevant solution info + Stores all relevant solution info for cloud SourceFiles cloudSolutionI.H @@ -100,7 +100,7 @@ class cloudSolution Switch resetSourcesOnStartup_; //- List schemes, e.g. U semiImplicit 1 - List > schemes_; + List > > schemes_; // Private Member Functions From a9109f3e3069ce71166468af7cc7b60841822c3b Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 17 Mar 2011 10:00:14 +0000 Subject: [PATCH 2/8] ENH: Added reg expression handling for patches lookup in cloud models --- src/lagrangian/intermediate/Make/files | 1 + .../LocalInteraction/LocalInteraction.C | 48 +------ .../LocalInteraction/LocalInteraction.H | 6 +- .../patchInteractionDataList.C | 130 ++++++++++++++++++ .../patchInteractionDataList.H | 90 ++++++++++++ .../PatchPostProcessing/PatchPostProcessing.C | 78 ++++++----- .../PatchPostProcessing/PatchPostProcessing.H | 12 +- .../PatchPostProcessingI.H | 12 +- 8 files changed, 280 insertions(+), 97 deletions(-) create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionDataList.C create mode 100644 src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionDataList.H diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index f3a6866a97..9165621d6c 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -48,6 +48,7 @@ $(RADIATION)/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission. $(RADIATION)/scatter/cloudScatter/cloudScatter.C submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C +submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionDataList.C KINEMATICINJECTION=submodels/Kinematic/InjectionModel $(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionData.C diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C index 56a9ce61a6..20d8997b22 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.C @@ -33,9 +33,9 @@ Foam::label Foam::LocalInteraction::applyToPatch const label globalPatchI ) const { - forAll(patchIds_, patchI) + forAll(patchIDs_, patchI) { - if (patchIds_[patchI] == globalPatchI) + if (patchIDs_[patchI] == globalPatchI) { return patchI; } @@ -130,8 +130,8 @@ Foam::LocalInteraction::LocalInteraction ) : PatchInteractionModel(dict, cloud, typeName), - patchData_(this->coeffDict().lookup("patches")), - patchIds_(patchData_.size()), + patchData_(cloud.mesh(), this->coeffDict().lookup("patches")), + patchIDs_(patchData_.size()), nEscape0_(patchData_.size(), 0), massEscape0_(patchData_.size(), 0.0), nStick0_(patchData_.size(), 0), @@ -141,44 +141,6 @@ Foam::LocalInteraction::LocalInteraction nStick_(patchData_.size(), 0), massStick_(patchData_.size(), 0.0) { - const polyMesh& mesh = cloud.mesh(); - const polyBoundaryMesh& bMesh = mesh.boundaryMesh(); - - // check that user patches are valid region patches - forAll(patchData_, patchI) - { - const word& patchName = patchData_[patchI].patchName(); - patchIds_[patchI] = bMesh.findPatchID(patchName); - if (patchIds_[patchI] < 0) - { - FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)") - << "Patch " << patchName << " not found. Available patches " - << "are: " << bMesh.names() << nl << exit(FatalError); - } - } - - // check that all walls are specified - DynamicList badWalls; - forAll(bMesh, patchI) - { - if - ( - isA(bMesh[patchI]) - && applyToPatch(bMesh[patchI].index()) < 0 - ) - { - badWalls.append(bMesh[patchI].name()); - } - } - - if (badWalls.size() > 0) - { - FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)") - << "All wall patches must be specified when employing local patch " - << "interaction. Please specify data for patches:" << nl - << badWalls << nl << exit(FatalError); - } - // check that interactions are valid/specified forAll(patchData_, patchI) { @@ -211,7 +173,7 @@ Foam::LocalInteraction::LocalInteraction : PatchInteractionModel(pim), patchData_(pim.patchData_), - patchIds_(pim.patchIds_), + patchIDs_(pim.patchIDs_), nEscape0_(pim.nEscape0_), massEscape0_(pim.massEscape0_), nStick0_(pim.nStick0_), diff --git a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H index 42b641aeab..5d6962b595 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H +++ b/src/lagrangian/intermediate/submodels/Kinematic/PatchInteractionModel/LocalInteraction/LocalInteraction.H @@ -33,7 +33,7 @@ Description #define LocalInteraction_H #include "PatchInteractionModel.H" -#include "patchInteractionData.H" +#include "patchInteractionDataList.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,10 +51,10 @@ class LocalInteraction // Private data //- List of participating patches - const List patchData_; + const patchInteractionDataList patchData_; //- List of participating patch ids - List