From c1268eb06195b24b0766b41be45b65f13edd7bc3 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 4 Nov 2014 15:46:17 +0000 Subject: [PATCH] ENH: Film models - added output of injected mass per patch --- .../pyrolysisModel/pyrolysisModelCollection.C | 4 +- .../pyrolysisModel/pyrolysisModelCollection.H | 4 +- .../reactingOneDim/reactingOneDim.C | 4 +- .../reactingOneDim/reactingOneDim.H | 4 +- .../regionModel/regionModel/regionModel.C | 2 +- .../regionModel/regionModel/regionModel.H | 4 +- .../kinematicSingleLayer.C | 2 +- .../kinematicSingleLayer.H | 4 +- .../submodels/filmSubModelBase.H | 9 ++- .../submodels/filmSubModelBaseI.H | 8 ++- .../injectionModelList/injectionModelList.C | 57 +++++++++++++++---- .../injectionModelList/injectionModelList.H | 15 +++-- .../thermoSingleLayer/thermoSingleLayer.C | 2 +- .../thermoSingleLayer/thermoSingleLayer.H | 4 +- .../thermalBaffle/thermalBaffle.C | 10 ++-- .../thermalBaffle/thermalBaffle.H | 4 +- 16 files changed, 90 insertions(+), 47 deletions(-) diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.C b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.C index ca241f55ee..f00a368eb5 100644 --- a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.C +++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -148,7 +148,7 @@ void pyrolysisModelCollection::evolve() } -void pyrolysisModelCollection::info() const +void pyrolysisModelCollection::info() { forAll(*this, i) { diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.H b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.H index da2da6d9f8..06d3597c62 100644 --- a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.H +++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelCollection.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -99,7 +99,7 @@ public: virtual void evolve(); //- Provide some feedback from pyrolysis regions - virtual void info() const; + virtual void info(); //- Return max diffusivity allowed in the solid virtual scalar maxDiff() const; diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index 127a561342..7b0a694e90 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -729,7 +729,7 @@ void reactingOneDim::evolveRegion() } -void reactingOneDim::info() const +void reactingOneDim::info() { Info<< "\nPyrolysis in region: " << regionMesh().name() << endl; diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H index 40cd93e149..753df0ba15 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -285,7 +285,7 @@ public: // I-O //- Provide some feedback - virtual void info() const; + virtual void info(); }; diff --git a/src/regionModels/regionModel/regionModel/regionModel.C b/src/regionModels/regionModel/regionModel/regionModel.C index 46eae95592..4ee88f0c8a 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.C +++ b/src/regionModels/regionModel/regionModel/regionModel.C @@ -579,7 +579,7 @@ void Foam::regionModels::regionModel::postEvolveRegion() } -void Foam::regionModels::regionModel::info() const +void Foam::regionModels::regionModel::info() { // do nothing } diff --git a/src/regionModels/regionModel/regionModel/regionModel.H b/src/regionModels/regionModel/regionModel/regionModel.H index d77916c70b..f0179b8150 100644 --- a/src/regionModels/regionModel/regionModel/regionModel.H +++ b/src/regionModels/regionModel/regionModel/regionModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -343,7 +343,7 @@ public: // I-O //- Provide some feedback - virtual void info() const; + virtual void info(); }; diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 78e6d18964..2faa91982c 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -1074,7 +1074,7 @@ const volScalarField& kinematicSingleLayer::cloudDiameterTrans() const } -void kinematicSingleLayer::info() const +void kinematicSingleLayer::info() { Info<< "\nSurface film: " << type() << endl; diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H index 181a58b68b..ace33f055a 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -525,7 +525,7 @@ public: // I-O //- Provide some feedback - virtual void info() const; + virtual void info(); }; diff --git a/src/regionModels/surfaceFilmModels/submodels/filmSubModelBase.H b/src/regionModels/surfaceFilmModels/submodels/filmSubModelBase.H index 41d9f29d98..76d85d3059 100644 --- a/src/regionModels/surfaceFilmModels/submodels/filmSubModelBase.H +++ b/src/regionModels/surfaceFilmModels/submodels/filmSubModelBase.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -61,7 +61,7 @@ protected: // Protected data //- Reference to the owner surface film model - const surfaceFilmModel& owner_; + surfaceFilmModel& owner_; public: @@ -103,9 +103,12 @@ public: //- Flag to indicate when to write a property virtual bool outputTime() const; - //- Return the reference to the owner surface film model + //- Return const access to the owner surface film model inline const surfaceFilmModel& owner() const; + //- Return the reference to the owner surface film model + inline surfaceFilmModel& owner(); + template inline const FilmType& filmType() const; }; diff --git a/src/regionModels/surfaceFilmModels/submodels/filmSubModelBaseI.H b/src/regionModels/surfaceFilmModels/submodels/filmSubModelBaseI.H index aa04eeb2a4..c9149735cd 100644 --- a/src/regionModels/surfaceFilmModels/submodels/filmSubModelBaseI.H +++ b/src/regionModels/surfaceFilmModels/submodels/filmSubModelBaseI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,6 +40,12 @@ inline const surfaceFilmModel& filmSubModelBase::owner() const } +inline surfaceFilmModel& filmSubModelBase::owner() +{ + return owner_; +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace surfaceFilmModels diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.C index 667fe2d810..5cdebac7c0 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,8 +39,7 @@ namespace surfaceFilmModels injectionModelList::injectionModelList(surfaceFilmModel& owner) : PtrList(), - owner_(owner), - dict_(dictionary::null) + filmSubModelBase(owner) {} @@ -51,8 +50,15 @@ injectionModelList::injectionModelList ) : PtrList(), - owner_(owner), - dict_(dict) + filmSubModelBase + ( + "injectionModelList", + owner, + dict, + "injectionModelList", + "injectionModelList" + ), + massInjected_(owner.intCoupledPatchIDs().size(), 0.0) { const wordList activeModels(dict.lookup("injectionModels")); @@ -71,11 +77,7 @@ injectionModelList::injectionModelList forAllConstIter(wordHashSet, models, iter) { const word& model = iter.key(); - set - ( - i, - injectionModel::New(owner, dict, model) - ); + set(i, injectionModel::New(owner, dict, model)); i++; } } @@ -91,6 +93,7 @@ injectionModelList::injectionModelList injectionModelList::~injectionModelList() {} + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // void injectionModelList::correct @@ -110,10 +113,19 @@ void injectionModelList::correct // Push values to boundaries ready for transfer to the primary region massToInject.correctBoundaryConditions(); diameterToInject.correctBoundaryConditions(); + + const labelList& patchIDs = owner().intCoupledPatchIDs(); + + forAll(patchIDs, i) + { + label patchI = patchIDs[i]; + massInjected_[i] = + massInjected_[i] + sum(massToInject.boundaryField()[patchI]); + } } -void injectionModelList::info(Ostream& os) const +void injectionModelList::info(Ostream& os) { scalar injectedMass = 0.0; forAll(*this, i) @@ -123,6 +135,29 @@ void injectionModelList::info(Ostream& os) const } os << indent << "injected mass = " << injectedMass << nl; + + scalarList mass0(massInjected_.size(), 0.0); + this->getModelProperty("massInjected", mass0); + + scalarList mass(massInjected_); + Pstream::listCombineGather(mass, plusEqOp()); + mass = mass + mass0; + + const polyBoundaryMesh& pbm = owner().regionMesh().boundaryMesh(); + const labelList& patchIDs = owner().intCoupledPatchIDs(); + + forAll(patchIDs, i) + { + label patchI = patchIDs[i]; + Info<< indent << " - patch: " << pbm[patchI].name() << ": " + << mass[i] << endl; + } + + if (owner().time().outputTime()) + { + setModelProperty("massInjected", mass); + massInjected_ = 0.0; + } } diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.H index c58f85a653..0feb88aeef 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.H +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModelList/injectionModelList.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,7 @@ SourceFiles #include "PtrList.H" #include "injectionModel.H" +#include "filmSubModelBase.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,17 +54,15 @@ namespace surfaceFilmModels class injectionModelList : - public PtrList + public PtrList, + public filmSubModelBase { private: // Private data - //- Reference to the owner surface film model - surfaceFilmModel& owner_; - - //- Dictionary - dictionary dict_; + //- List of mass injected per patch + scalarField massInjected_; // Private Member Functions @@ -110,7 +109,7 @@ public: // I-O //- Provide some info - void info(Ostream& os) const; + virtual void info(Ostream& os); }; diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index c466759cd1..480b0194bb 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -730,7 +730,7 @@ tmp thermoSingleLayer::primaryMassTrans() const } -void thermoSingleLayer::info() const +void thermoSingleLayer::info() { kinematicSingleLayer::info(); diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H index 6995e34e3a..143833bca5 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -404,7 +404,7 @@ public: // I-O //- Provide some feedback - virtual void info() const; + virtual void info(); }; diff --git a/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C index 3fbe65e795..bd6c507c23 100644 --- a/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C +++ b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,13 +107,13 @@ void thermalBaffle::solveEnergy() forAll(ppCoupled, localFaceI) { const labelList& cells = boundaryFaceCells_[localFaceI]; - forAll (cells, i) + forAll(cells, i) { const label cellId = cells[i]; Q[cellId] = Qs_.boundaryField()[patchI][localFaceI] - /thickness_[localFaceI]; + /thickness_[localFaceI]; rho[cellId] *= delta_.value()/thickness_[localFaceI]; @@ -352,7 +352,7 @@ const solidThermo& thermalBaffle::thermo() const } -void thermalBaffle::info() const +void thermalBaffle::info() { const labelList& coupledPatches = intCoupledPatchIDs(); @@ -361,7 +361,7 @@ void thermalBaffle::info() const const label patchI = coupledPatches[i]; const fvPatchScalarField& ph = h_.boundaryField()[patchI]; const word patchName = regionMesh().boundary()[patchI].name(); - Info << indent << "Q : " << patchName << indent << + Info<< indent << "Q : " << patchName << indent << gSum ( mag(regionMesh().Sf().boundaryField()[patchI]) diff --git a/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.H b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.H index b8265948a9..eecbd4265b 100644 --- a/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.H +++ b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -199,7 +199,7 @@ public: // I-O //- Provide some feedback - virtual void info() const; + virtual void info(); };