diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/Make/files b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/Make/files index f193faaf03..8dba9ed218 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/Make/files +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/Make/files @@ -20,9 +20,9 @@ wallBoilingSubModels/departureFrequencyModels/departureFrequencyModel/newDepartu wallBoilingSubModels/departureFrequencyModels/Cole/Cole.C wallBoilingSubModels/departureFrequencyModels/KocamustafaogullariIshiiDepartureFrequency/KocamustafaogullariIshiiDepartureFrequency.C +alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.C alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C -alphatPhaseChangeJayatillekeWallFunction/alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.C -alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C +alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C copiedFixedValue/copiedFixedValueFvPatchScalarField.C fixedMultiPhaseHeatFlux/fixedMultiPhaseHeatFluxFvPatchScalarField.C diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C deleted file mode 100644 index 7a6e41a482..0000000000 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C +++ /dev/null @@ -1,215 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2019 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 "alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.H" -#include "fvPatchFieldMapper.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField:: -alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF), - vaporPhaseName_("vapor"), - relax_(1.0), - fixedDmdt_(0.0), - L_(0.0) -{} - - -alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField:: -alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF, dict), - vaporPhaseName_(dict.lookup("vaporPhase")), - relax_(dict.lookupOrDefault("relax", 1.0)), - fixedDmdt_(dict.lookupOrDefault("fixedDmdt", 0.0)), - L_(dict.lookupOrDefault("L", 0.0)) -{} - - -alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField:: -alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField -( - const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField& psf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField - ( - psf, - p, - iF, - mapper - ), - fixedDmdt_(psf.fixedDmdt_), - L_(psf.L_) -{} - - -alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField:: -alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField -( - const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField& psf -) -: - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(psf), - relax_(psf.relax_), - fixedDmdt_(psf.fixedDmdt_), - L_(psf.L_) -{} - - -alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField:: -alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField -( - const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField& psf, - const DimensionedField& iF -) -: - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(psf, iF), - relax_(psf.relax_), - fixedDmdt_(psf.fixedDmdt_), - L_(psf.L_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField:: -activePhasePair(const phasePairKey& phasePair) const -{ - if (phasePair == phasePairKey(vaporPhaseName_, internalField().group())) - { - return true; - } - else - { - return false; - } -} - - -const scalarField& alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField:: -dmdt(const phasePairKey& phasePair) const -{ - if (activePhasePair(phasePair)) - { - return dmdt_; - } - else - { - FatalErrorInFunction - << " dmdt requested for invalid phasePair!" - << abort(FatalError); - - return mDotL_; - } -} - - -const scalarField& alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField:: -mDotL(const phasePairKey& phasePair) const -{ - if (activePhasePair(phasePair)) - { - return mDotL_; - } - else - { - FatalErrorInFunction - << " mDotL requested for invalid phasePair!" - << abort(FatalError); - - return mDotL_; - } -} - - -void alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - dmdt_ = (1 - relax_)*dmdt_ + relax_*fixedDmdt_; - mDotL_ = dmdt_*L_; - - operator==(calcAlphat(*this)); - - fixedValueFvPatchScalarField::updateCoeffs(); -} - - -void alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField::write -( - Ostream& os -) const -{ - fvPatchField::write(os); - writeEntry(os, "vaporPhase", vaporPhaseName_); - writeEntry(os, "relax", relax_); - writeEntry(os, "fixedDmdt", fixedDmdt_); - writeEntry(os, "L", L_); - writeEntry(os, "dmdt", dmdt_); - writeEntry(os, "value", *this); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..ef8dfbf2d3 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C @@ -0,0 +1,156 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2019 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 "alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H" +#include "fvPatchFieldMapper.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF), + fixedDmdtf_(0), + L_(0) +{} + + +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF, dict), + fixedDmdtf_(dict.lookupOrDefault("fixedDmdtf", 0)), + L_(dict.lookupOrDefault("L", 0)) +{} + + +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +( + const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& psf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField + ( + psf, + p, + iF, + mapper + ), + fixedDmdtf_(psf.fixedDmdtf_), + L_(psf.L_) +{} + + +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +( + const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& psf +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField(psf), + fixedDmdtf_(psf.fixedDmdtf_), + L_(psf.L_) +{} + + +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: +alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +( + const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& psf, + const DimensionedField& iF +) +: + alphatPhaseChangeWallFunctionFvPatchScalarField(psf, iF), + fixedDmdtf_(psf.fixedDmdtf_), + L_(psf.L_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + dmdtf_ = (1 - relax_)*dmdtf_ + relax_*fixedDmdtf_; + dmdtLf_ = dmdtf_*L_; + + operator==(calcAlphat(*this)); + + fixedValueFvPatchScalarField::updateCoeffs(); +} + + +void alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::write +( + Ostream& os +) const +{ + alphatPhaseChangeWallFunctionFvPatchScalarField::write(os); + + writeEntry(os, "fixedDmdtf", fixedDmdtf_); + writeEntry(os, "L", L_); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.H b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H similarity index 64% rename from applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.H rename to applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H index cfe32297f5..53411b3161 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtWallBoilingWallFunction/alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.H +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H @@ -23,25 +23,24 @@ License Class Foam::compressible:: - alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField Description - A simple alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField with + A simple alphatPhaseChangeWallFunctionFvPatchScalarField with a fixed volumetric phase-change mass flux. See also - Foam::compressible:: - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField SourceFiles - alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField.C + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C \*---------------------------------------------------------------------------*/ -#ifndef alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField_H -#define alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField_H +#ifndef alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField_H +#define alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField_H -#include "alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.H" +#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,23 +50,17 @@ namespace compressible { /*---------------------------------------------------------------------------*\ - Class alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField Declaration + Class alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ -class alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField +class alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField : - public alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + public alphatPhaseChangeWallFunctionFvPatchScalarField { // Private Data - //- name on the phase - word vaporPhaseName_; - - //- dmdt relaxationFactor - scalar relax_; - //- Volumetric phase-change mass flux in near wall cells - scalar fixedDmdt_; + scalar fixedDmdtf_; //- Latent heat scalar L_; @@ -76,20 +69,20 @@ class alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField public: //- Runtime type information - TypeName("compressible::alphatFixedDmdtWallBoilingWallFunction"); + TypeName("compressible::alphatFixedDmdtfWallBoilingWallFunction"); // Constructors //- Construct from patch and internal field - alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField& ); //- Construct from patch, internal field and dictionary - alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField&, @@ -97,20 +90,20 @@ public: ); //- Construct by mapping given - // alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField + // alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField // onto a new patch - alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField ( - const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField&, + const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField&, const fvPatch&, const DimensionedField&, const fvPatchFieldMapper& ); //- Copy constructor - alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField ( - const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField& + const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& ); //- Construct and return a clone @@ -118,7 +111,7 @@ public: { return tmp ( - new alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField + new alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField ( *this ) @@ -126,9 +119,9 @@ public: } //- Copy constructor setting internal field reference - alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField + alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField ( - const alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField&, + const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField&, const DimensionedField& ); @@ -140,7 +133,7 @@ public: { return tmp ( - new alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField + new alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField ( *this, iF @@ -151,15 +144,6 @@ public: // Member Functions - //- Is there phase change mass transfer for this phasePair - virtual bool activePhasePair(const phasePairKey&) const; - - //- Return the rate of phase-change for specific phase pair - virtual const scalarField& dmdt(const phasePairKey&) const; - - //- Return the rate of phase-change for specific phase pair - virtual const scalarField& mDotL(const phasePairKey&) const; - // Evaluation functions //- Update the coefficients associated with the patch field diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C index ba7ff7ee04..0130ec720a 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C @@ -48,9 +48,11 @@ alphatPhaseChangeWallFunctionFvPatchScalarField const DimensionedField& iF ) : - fixedValueFvPatchScalarField(p, iF), - dmdt_(p.size(), 0), - mDotL_(p.size(), 0) + alphatPhaseJayatillekeWallFunctionFvPatchScalarField(p, iF), + otherPhaseName_(word::null), + relax_(1), + dmdtf_(p.size(), 0), + dmdtLf_(p.size(), 0) {} @@ -62,18 +64,31 @@ alphatPhaseChangeWallFunctionFvPatchScalarField const dictionary& dict ) : - fixedValueFvPatchScalarField(p, iF, dict), - dmdt_(p.size(), 0), - mDotL_(p.size(), 0) + alphatPhaseJayatillekeWallFunctionFvPatchScalarField(p, iF, dict), + otherPhaseName_(dict.lookup("otherPhase")), + relax_(dict.lookupOrDefault("relax", 1)), + dmdtf_(p.size(), 0), + dmdtLf_(p.size(), 0) { - if (dict.found("dmdt")) + // Check that otherPhaseName != this phase + if (internalField().group() == otherPhaseName_) { - dmdt_ = scalarField("dmdt", dict, p.size()); + FatalErrorInFunction + << "otherPhase should be the name of the vapor phase that " + << "corresponds to the liquid base or vice versa" << nl + << "This phase: " << internalField().group() << nl + << "otherPhase: " << otherPhaseName_ + << abort(FatalError); } - if (dict.found("mDotL")) + if (dict.found("dmdtf")) { - dmdt_ = scalarField("mDotL", dict, p.size()); + dmdtf_ = scalarField("dmdtf", dict, p.size()); + } + + if (dict.found("dmdtLf")) + { + dmdtf_ = scalarField("dmdtLf", dict, p.size()); } } @@ -87,9 +102,11 @@ alphatPhaseChangeWallFunctionFvPatchScalarField const fvPatchFieldMapper& mapper ) : - fixedValueFvPatchScalarField(ptf, p, iF, mapper), - dmdt_(mapper(ptf.dmdt_)), - mDotL_(mapper(ptf.mDotL_)) + alphatPhaseJayatillekeWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + otherPhaseName_(ptf.otherPhaseName_), + relax_(ptf.relax_), + dmdtf_(mapper(ptf.dmdtf_)), + dmdtLf_(mapper(ptf.dmdtLf_)) {} @@ -99,9 +116,11 @@ alphatPhaseChangeWallFunctionFvPatchScalarField const alphatPhaseChangeWallFunctionFvPatchScalarField& awfpsf ) : - fixedValueFvPatchScalarField(awfpsf), - dmdt_(awfpsf.dmdt_), - mDotL_(awfpsf.mDotL_) + alphatPhaseJayatillekeWallFunctionFvPatchScalarField(awfpsf), + otherPhaseName_(awfpsf.otherPhaseName_), + relax_(awfpsf.relax_), + dmdtf_(awfpsf.dmdtf_), + dmdtLf_(awfpsf.dmdtLf_) {} @@ -112,21 +131,88 @@ alphatPhaseChangeWallFunctionFvPatchScalarField const DimensionedField& iF ) : - fixedValueFvPatchScalarField(awfpsf, iF), - dmdt_(awfpsf.dmdt_), - mDotL_(awfpsf.mDotL_) + alphatPhaseJayatillekeWallFunctionFvPatchScalarField(awfpsf, iF), + otherPhaseName_(awfpsf.otherPhaseName_), + relax_(awfpsf.relax_), + dmdtf_(awfpsf.dmdtf_), + dmdtLf_(awfpsf.dmdtLf_) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void alphatPhaseChangeWallFunctionFvPatchScalarField:: -write(Ostream& os) const +bool alphatPhaseChangeWallFunctionFvPatchScalarField:: +activePhasePair(const phasePairKey& phasePair) const { - fvPatchField::write(os); - writeEntry(os, "dmdt", dmdt_); - writeEntry(os, "mDotL", mDotL_); - writeEntry(os, "value", *this); + if (phasePair == phasePairKey(otherPhaseName_, internalField().group())) + { + return true; + } + else + { + return false; + } +} + + +const scalarField& +alphatPhaseChangeWallFunctionFvPatchScalarField::dmdtf() const +{ + return dmdtf_; +} + + +const scalarField& alphatPhaseChangeWallFunctionFvPatchScalarField:: +dmdtf(const phasePairKey& phasePair) const +{ + if (activePhasePair(phasePair)) + { + return dmdtf_; + } + else + { + FatalErrorInFunction + << " dmdtf requested for invalid phasePair!" + << abort(FatalError); + + return dmdtLf_; + } +} + + +const scalarField& +alphatPhaseChangeWallFunctionFvPatchScalarField::dmdtLf() const +{ + return dmdtLf_; +} + + +const scalarField& alphatPhaseChangeWallFunctionFvPatchScalarField:: +dmdtLf(const phasePairKey& phasePair) const +{ + if (activePhasePair(phasePair)) + { + return dmdtLf_; + } + else + { + FatalErrorInFunction + << " dmdtLf requested for invalid phasePair!" + << abort(FatalError); + + return dmdtLf_; + } +} + + +void alphatPhaseChangeWallFunctionFvPatchScalarField::write(Ostream& os) const +{ + alphatPhaseJayatillekeWallFunctionFvPatchScalarField::write(os); + + writeEntry(os, "otherPhase", otherPhaseName_); + writeEntry(os, "relax", relax_); + writeEntry(os, "dmdtf", dmdtf_); + writeEntry(os, "dmdtLf", dmdtLf_); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H index b78a6e3d61..6e52b783ed 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H @@ -28,8 +28,7 @@ Description Abstract base-class for all alphatWallFunctions supporting phase-change. See also - Foam::fixedValueFvPatchScalarField - Foam::alphatWallFunctionFvPatchScalarField + Foam::alphatPhaseJayatillekeWallFunctionFvPatchScalarField SourceFiles alphatPhaseChangeWallFunctionFvPatchScalarField.C @@ -39,7 +38,7 @@ SourceFiles #ifndef alphatPhaseChangeWallFunctionFvPatchScalarField_H #define alphatPhaseChangeWallFunctionFvPatchScalarField_H -#include "fixedValueFvPatchFields.H" +#include "alphatPhaseJayatillekeWallFunctionFvPatchScalarField.H" #include "phasePairKey.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -55,17 +54,23 @@ namespace compressible class alphatPhaseChangeWallFunctionFvPatchScalarField : - public fixedValueFvPatchScalarField + public alphatPhaseJayatillekeWallFunctionFvPatchScalarField { protected: // Protected data + //- Name of the other phase + const word otherPhaseName_; + + //- Relaxation factor + const scalar relax_; + //- Rate of phase-change - scalarField dmdt_; + scalarField dmdtf_; //- Latent heat of the phase-change - scalarField mDotL_; + scalarField dmdtLf_; public: @@ -118,47 +123,22 @@ public: // Member Functions - //- Return the rate of phase-change - virtual const scalarField& dmdt() const - { - return dmdt_; - } - - //- Return the enthalpy source due to phase-change - virtual const scalarField& mDotL() const - { - return mDotL_; - } //- Is there phase change mass transfer for this phasePair - virtual bool activePhasePair(const phasePairKey&) const - { - return false; - } + bool activePhasePair(const phasePairKey&) const; + + //- Return the rate of phase-change + const scalarField& dmdtf() const; //- Return the rate of phase-change for specific phase pair - virtual const scalarField& dmdt(const phasePairKey&) const - { - return dmdt_; - } + const scalarField& dmdtf(const phasePairKey&) const; + + //- Return the enthalpy source due to phase-change + const scalarField& dmdtLf() const; //- Return the rate of phase-change for specific phase pair - virtual const scalarField& mDotL(const phasePairKey&) const - { - return mDotL_; - } + const scalarField& dmdtLf(const phasePairKey&) const; - //- Return the rate of phase-change for specific phase - virtual scalarField dmdt(const word&) const - { - return dmdt_; - } - - //- Return the enthalpy source due to phase-change for specific phase - virtual scalarField mDotL(const word&) const - { - return mDotL_; - } // Evaluation functions diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeJayatillekeWallFunction/alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.C similarity index 77% rename from applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeJayatillekeWallFunction/alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.C rename to applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.C index f93001318c..21295872dc 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeJayatillekeWallFunction/alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.C +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.C @@ -23,11 +23,9 @@ License \*---------------------------------------------------------------------------*/ -#include "alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.H" +#include "alphatPhaseJayatillekeWallFunctionFvPatchScalarField.H" #include "phaseSystem.H" -#include "compressibleTurbulenceModel.H" -#include "ThermalDiffusivity.H" -#include "PhaseCompressibleTurbulenceModel.H" +#include "phaseCompressibleTurbulenceModel.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -39,27 +37,23 @@ namespace compressible // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -scalar alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::maxExp_ - = 50.0; -scalar alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::tolerance_ - = 0.01; -label alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::maxIters_ - = 10; +scalar alphatPhaseJayatillekeWallFunctionFvPatchScalarField::maxExp_ = 50.0; +scalar alphatPhaseJayatillekeWallFunctionFvPatchScalarField::tolerance_ = 0.01; +label alphatPhaseJayatillekeWallFunctionFvPatchScalarField::maxIters_ = 10; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -tmp -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::Psmooth +tmp alphatPhaseJayatillekeWallFunctionFvPatchScalarField::Psmooth ( const scalarField& Prat ) const { - return 9.24*(pow(Prat, 0.75) - 1)*(1 + 0.28*exp(-0.007*Prat)); + return 9.24*(pow(Prat, 0.75) - 1.0)*(1.0 + 0.28*exp(-0.007*Prat)); } tmp -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::yPlusTherm +alphatPhaseJayatillekeWallFunctionFvPatchScalarField::yPlusTherm ( const nutWallFunctionFvPatchScalarField& nutw, const scalarField& P, @@ -83,6 +77,7 @@ alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::yPlusTherm if (yptNew < vSmall) { ypsf[facei] = 0; + break; } else if (mag(yptNew - ypt) < tolerance_) { @@ -100,8 +95,76 @@ alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::yPlusTherm return typsf; } + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +alphatPhaseJayatillekeWallFunctionFvPatchScalarField:: +alphatPhaseJayatillekeWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(p, iF), + Prt_(0.85) +{} + + +alphatPhaseJayatillekeWallFunctionFvPatchScalarField:: +alphatPhaseJayatillekeWallFunctionFvPatchScalarField +( + const alphatPhaseJayatillekeWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + Prt_(ptf.Prt_) +{} + + +alphatPhaseJayatillekeWallFunctionFvPatchScalarField:: +alphatPhaseJayatillekeWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchScalarField(p, iF, dict), + Prt_(dict.lookupOrDefault("Prt", 0.85)) +{} + + + +alphatPhaseJayatillekeWallFunctionFvPatchScalarField:: +alphatPhaseJayatillekeWallFunctionFvPatchScalarField +( + const alphatPhaseJayatillekeWallFunctionFvPatchScalarField& awfpsf +) +: + fixedValueFvPatchScalarField(awfpsf), + Prt_(awfpsf.Prt_) +{} + + +alphatPhaseJayatillekeWallFunctionFvPatchScalarField:: +alphatPhaseJayatillekeWallFunctionFvPatchScalarField +( + const alphatPhaseJayatillekeWallFunctionFvPatchScalarField& awfpsf, + const DimensionedField& iF +) +: + fixedValueFvPatchScalarField(awfpsf, iF), + Prt_(awfpsf.Prt_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + tmp -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::calcAlphat +alphatPhaseJayatillekeWallFunctionFvPatchScalarField::calcAlphat ( const scalarField& prevAlphat ) const @@ -221,73 +284,7 @@ alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::calcAlphat } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField:: -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF), - Prt_(0.85) -{} - - -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField:: -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF, dict), - Prt_(dict.lookupOrDefault("Prt", 0.85)) -{} - - -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField:: -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField -( - const alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - alphatPhaseChangeWallFunctionFvPatchScalarField(ptf, p, iF, mapper), - Prt_(ptf.Prt_) -{} - - -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField:: -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField -( - const alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField& awfpsf -) -: - alphatPhaseChangeWallFunctionFvPatchScalarField(awfpsf), - Prt_(awfpsf.Prt_) -{} - - -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField:: -alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField -( - const alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField& awfpsf, - const DimensionedField& iF -) -: - alphatPhaseChangeWallFunctionFvPatchScalarField(awfpsf, iF), - Prt_(awfpsf.Prt_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() +void alphatPhaseJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() { if (updated()) { @@ -300,14 +297,13 @@ void alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::updateCoeffs() } -void alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::write +void alphatPhaseJayatillekeWallFunctionFvPatchScalarField::write ( Ostream& os ) const { fvPatchField::write(os); writeEntry(os, "Prt", Prt_); - writeEntry(os, "dmdt", dmdt_); writeEntry(os, "value", *this); } @@ -317,10 +313,9 @@ void alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField::write makePatchTypeField ( fvPatchScalarField, - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + alphatPhaseJayatillekeWallFunctionFvPatchScalarField ); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace compressible diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeJayatillekeWallFunction/alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.H b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.H similarity index 75% rename from applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeJayatillekeWallFunction/alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.H rename to applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.H index 53d07224f0..633eeff4de 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseChangeJayatillekeWallFunction/alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.H +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatPhaseJayatillekeWallFunction/alphatPhaseJayatillekeWallFunctionFvPatchScalarField.H @@ -23,7 +23,7 @@ License Class Foam::compressible:: - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + alphatPhaseJayatillekeWallFunctionFvPatchScalarField Description This boundary condition provides a thermal wall function for turbulent @@ -43,7 +43,7 @@ Usage \verbatim { - type alphatPhaseChangeJayatillekeWallFunction; + type alphatPhaseJayatillekeWallFunction; Prt 0.85; kappa 0.41; E 9.8; @@ -55,14 +55,14 @@ See also Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField SourceFiles - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.C + alphatPhaseJayatillekeWallFunctionFvPatchScalarField.C \*---------------------------------------------------------------------------*/ -#ifndef compressible_alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField_H -#define compressible_alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField_H +#ifndef compressible_alphatPhaseJayatillekeWallFunctionFvPatchScalarField_H +#define compressible_alphatPhaseJayatillekeWallFunctionFvPatchScalarField_H -#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H" +#include "fixedValueFvPatchFields.H" #include "nutWallFunctionFvPatchScalarField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -73,12 +73,12 @@ namespace compressible { /*---------------------------------------------------------------------------*\ - Class alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField Declaration + Class alphatPhaseJayatillekeWallFunctionFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ -class alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField +class alphatPhaseJayatillekeWallFunctionFvPatchScalarField : - public alphatPhaseChangeWallFunctionFvPatchScalarField + public fixedValueFvPatchScalarField { protected: @@ -108,30 +108,24 @@ protected: const scalarField& Prat ) const; - //- Update turbulent thermal diffusivity - tmp calcAlphat - ( - const scalarField& prevAlphat - ) const; - public: //- Runtime type information - TypeName("compressible::alphatPhaseChangeJayatillekeWallFunction"); + TypeName("compressible::alphatPhaseJayatillekeWallFunction"); // Constructors //- Construct from patch and internal field - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + alphatPhaseJayatillekeWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField& ); //- Construct from patch, internal field and dictionary - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + alphatPhaseJayatillekeWallFunctionFvPatchScalarField ( const fvPatch&, const DimensionedField&, @@ -139,20 +133,20 @@ public: ); //- Construct by mapping given - // alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + // alphatPhaseJayatillekeWallFunctionFvPatchScalarField // onto a new patch - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + alphatPhaseJayatillekeWallFunctionFvPatchScalarField ( - const alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField&, + const alphatPhaseJayatillekeWallFunctionFvPatchScalarField&, const fvPatch&, const DimensionedField&, const fvPatchFieldMapper& ); //- Copy constructor - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + alphatPhaseJayatillekeWallFunctionFvPatchScalarField ( - const alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField& + const alphatPhaseJayatillekeWallFunctionFvPatchScalarField& ); //- Construct and return a clone @@ -160,7 +154,7 @@ public: { return tmp ( - new alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + new alphatPhaseJayatillekeWallFunctionFvPatchScalarField ( *this ) @@ -168,9 +162,9 @@ public: } //- Copy constructor setting internal field reference - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + alphatPhaseJayatillekeWallFunctionFvPatchScalarField ( - const alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField&, + const alphatPhaseJayatillekeWallFunctionFvPatchScalarField&, const DimensionedField& ); @@ -182,7 +176,7 @@ public: { return tmp ( - new alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + new alphatPhaseJayatillekeWallFunctionFvPatchScalarField ( *this, iF @@ -195,6 +189,9 @@ public: // Evaluation functions + //- Evaluate the turbulent thermal diffusivity + tmp calcAlphat(const scalarField& prevAlphat) const; + //- Update the coefficients associated with the patch field virtual void updateCoeffs(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C index 4b5b0d8892..afef358c40 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -73,10 +73,8 @@ alphatWallBoilingWallFunctionFvPatchScalarField const DimensionedField& iF ) : - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF), - otherPhaseName_("vapor"), + alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF), phaseType_(liquidPhase), - relax_(0.1), AbyV_(p.size(), 0), alphatConv_(p.size(), 0), dDep_(p.size(), 1e-5), @@ -103,10 +101,8 @@ alphatWallBoilingWallFunctionFvPatchScalarField const dictionary& dict ) : - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(p, iF, dict), - otherPhaseName_(dict.lookup("otherPhase")), + alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF, dict), phaseType_(phaseTypeNames_.read(dict.lookup("phaseType"))), - relax_(dict.lookupOrDefault("relax", 0.1)), AbyV_(p.size(), 0), alphatConv_(p.size(), 0), dDep_(p.size(), 1e-5), @@ -116,18 +112,6 @@ alphatWallBoilingWallFunctionFvPatchScalarField departureDiamModel_(nullptr), departureFreqModel_(nullptr) { - - // Check that otherPhaseName != this phase - if (internalField().group() == otherPhaseName_) - { - FatalErrorInFunction - << "otherPhase should be the name of the vapor phase that " - << "corresponds to the liquid base of vice versa" << nl - << "This phase: " << internalField().group() << nl - << "otherPhase: " << otherPhaseName_ - << abort(FatalError); - } - switch (phaseType_) { case vaporPhase: @@ -138,7 +122,7 @@ alphatWallBoilingWallFunctionFvPatchScalarField dict.subDict("partitioningModel") ); - dmdt_ = 0; + dmdtf_ = 0; break; } @@ -205,16 +189,14 @@ alphatWallBoilingWallFunctionFvPatchScalarField const fvPatchFieldMapper& mapper ) : - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + alphatPhaseChangeWallFunctionFvPatchScalarField ( psf, p, iF, mapper ), - otherPhaseName_(psf.otherPhaseName_), phaseType_(psf.phaseType_), - relax_(psf.relax_), AbyV_(psf.AbyV_), alphatConv_(mapper(psf.alphatConv_)), dDep_(mapper(psf.dDep_)), @@ -232,10 +214,8 @@ alphatWallBoilingWallFunctionFvPatchScalarField const alphatWallBoilingWallFunctionFvPatchScalarField& psf ) : - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(psf), - otherPhaseName_(psf.otherPhaseName_), + alphatPhaseChangeWallFunctionFvPatchScalarField(psf), phaseType_(psf.phaseType_), - relax_(psf.relax_), AbyV_(psf.AbyV_), alphatConv_(psf.alphatConv_), dDep_(psf.dDep_), @@ -254,10 +234,8 @@ alphatWallBoilingWallFunctionFvPatchScalarField const DimensionedField& iF ) : - alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField(psf, iF), - otherPhaseName_(psf.otherPhaseName_), + alphatPhaseChangeWallFunctionFvPatchScalarField(psf, iF), phaseType_(psf.phaseType_), - relax_(psf.relax_), AbyV_(psf.AbyV_), alphatConv_(psf.alphatConv_), dDep_(psf.dDep_), @@ -271,53 +249,6 @@ alphatWallBoilingWallFunctionFvPatchScalarField // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -bool alphatWallBoilingWallFunctionFvPatchScalarField:: -activePhasePair(const phasePairKey& phasePair) const -{ - if (phasePair == phasePairKey(otherPhaseName_, internalField().group())) - { - return true; - } - else - { - return false; - } -} - -const scalarField& alphatWallBoilingWallFunctionFvPatchScalarField:: -dmdt(const phasePairKey& phasePair) const -{ - if (activePhasePair(phasePair)) - { - return dmdt_; - } - else - { - FatalErrorInFunction - << " dmdt requested for invalid phasePair!" - << abort(FatalError); - - return dmdt_; - } -} - -const scalarField& alphatWallBoilingWallFunctionFvPatchScalarField:: -mDotL(const phasePairKey& phasePair) const -{ - if (activePhasePair(phasePair)) - { - return mDotL_; - } - else - { - FatalErrorInFunction - << " mDotL requested for invalid phasePair!" - << abort(FatalError); - - return mDotL_; - } -} - void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() { if (updated()) @@ -594,13 +525,13 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() // Volumetric mass source in the near wall cell due to the // wall boiling - dmdt_ = - (1 - relax_)*dmdt_ + dmdtf_ = + (1 - relax_)*dmdtf_ + relax_*(1.0/6.0)*A2E*dDep_*rhoVaporw*fDep*AbyV_; // Volumetric source in the near wall cell due to the wall // boiling - mDotL_ = dmdt_*L; + dmdtLf_ = dmdtf_*L; // Quenching heat transfer coefficient const scalarField hQ @@ -657,8 +588,8 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() Info<< " A2: " << gMin(A2) << " - " << gMax(A2) << endl; Info<< " A2E: " << gMin(A2E) << " - " << gMax(A2E) << endl; - Info<< " dmdtW: " << gMin(dmdt_) << " - " - << gMax(dmdt_) << endl; + Info<< " dmdtW: " << gMin(dmdtf_) << " - " + << gMax(dmdtf_) << endl; Info<< " qc: " << gMin(qc) << " - " << gMax(qc) << endl; Info<< " qq: " << gMin(fLiquid*qq()) << " - " << gMax(fLiquid*qq()) << endl; @@ -706,11 +637,12 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() void alphatWallBoilingWallFunctionFvPatchScalarField::write(Ostream& os) const { - fvPatchField::write(os); + alphatPhaseChangeWallFunctionFvPatchScalarField::write(os); writeEntry(os, "phaseType", phaseTypeNames_[phaseType_]); - - writeEntry(os, "relax", relax_); + writeEntry(os, "alphatConv", alphatConv_); + writeEntry(os, "dDep", dDep_); + writeEntry(os, "qQuenching", qq_); switch (phaseType_) { @@ -747,13 +679,6 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::write(Ostream& os) const break; } } - - writeEntry(os, "otherPhase", otherPhaseName_); - writeEntry(os, "dmdt", dmdt_); - writeEntry(os, "dDep", dDep_); - writeEntry(os, "qQuenching", qq_); - writeEntry(os, "alphatConv", alphatConv_); - writeEntry(os, "value", *this); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H index dfa4c1c68b..632e9d660c 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H +++ b/applications/solvers/multiphase/reactingEulerFoam/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H @@ -131,7 +131,7 @@ SourceFiles #ifndef compressible_alphatWallBoilingWallFunctionFvPatchScalarField_H #define compressible_alphatWallBoilingWallFunctionFvPatchScalarField_H -#include "alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField.H" +#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H" #include "partitioningModel.H" #include "nucleationSiteModel.H" #include "departureDiameterModel.H" @@ -150,7 +150,7 @@ namespace compressible class alphatWallBoilingWallFunctionFvPatchScalarField : - public alphatPhaseChangeJayatillekeWallFunctionFvPatchScalarField + public alphatPhaseChangeWallFunctionFvPatchScalarField { public: @@ -163,23 +163,17 @@ public: liquidPhase }; + //- Heat source type names + static const NamedEnum phaseTypeNames_; + private: // Private Data - //- name of the other phase (vapor/liquid phase) - word otherPhaseName_; - - //- Heat source type names - static const NamedEnum phaseTypeNames_; - //- Heat source type phaseType phaseType_; - //- dmdt relaxationFactor - scalar relax_; - //- Patch face area by cell volume scalarField AbyV_; @@ -280,17 +274,6 @@ public: // Member Functions - using alphatPhaseChangeWallFunctionFvPatchScalarField::dmdt; - - //- Is there phase change mass transfer for this phasePair - virtual bool activePhasePair(const phasePairKey&) const; - - //- Return the rate of phase-change for specific phase pair - virtual const scalarField& dmdt(const phasePairKey&) const; - - //- Return the rate of phase-change for specific phase pair - virtual const scalarField& mDotL(const phasePairKey&) const; - //- Return the departure diameter field const scalarField& dDeparture() const { @@ -306,9 +289,10 @@ public: //- Return the evaporation surface heat flux [W/m^2] tmp qe() const { - return mDotL_/AbyV_; + return dmdtLf_/AbyV_; } + // Evaluation functions //- Update the coefficients associated with the patch field diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C index 61a919ab6c..b8f40a82b8 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C @@ -135,20 +135,20 @@ Foam::tmp Foam::interfaceCompositionModel::L } -void Foam::interfaceCompositionModel::addMDotL +void Foam::interfaceCompositionModel::addDmdtL ( const volScalarField& K, const volScalarField& Tf, - volScalarField& mDotL, - volScalarField& mDotLPrime + volScalarField& dmdtL, + volScalarField& dmdtLPrime ) const { forAllConstIter(hashedWordList, species_, iter) { const volScalarField rhoKDL(thermo_.rho()*K*D(*iter)*L(*iter, Tf)); - mDotL += rhoKDL*dY(*iter, Tf); - mDotLPrime += rhoKDL*YfPrime(*iter, Tf); + dmdtL += rhoKDL*dY(*iter, Tf); + dmdtLPrime += rhoKDL*YfPrime(*iter, Tf); } } diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H index d5d29d27ff..bd0481fd61 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H @@ -182,12 +182,12 @@ public: ) const; //- Add latent heat flow rate to total - virtual void addMDotL + virtual void addDmdtL ( const volScalarField& K, const volScalarField& Tf, - volScalarField& mDotL, - volScalarField& mDotLPrime + volScalarField& dmdtL, + volScalarField& dmdtLPrime ) const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/deposition/deposition.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/deposition/deposition.C index ca11d114c5..2e5b4f0f4b 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/deposition/deposition.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/deposition/deposition.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -63,8 +63,14 @@ Foam::phaseTransferModels::deposition::~deposition() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +bool Foam::phaseTransferModels::deposition::mixture() const +{ + return true; +} + + Foam::tmp -Foam::phaseTransferModels::deposition::dmdt() const +Foam::phaseTransferModels::deposition::dmdtf() const { const phaseModel* dropletPtr = nullptr; scalar sign = 1; diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/deposition/deposition.H b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/deposition/deposition.H index 38897306d4..f12762943d 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/deposition/deposition.H +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/deposition/deposition.H @@ -92,8 +92,11 @@ public: // Member Functions - //- The mass transfer rate - virtual tmp dmdt() const; + //- Whether or not there is a mass transfer rate for the mixture + virtual bool mixture() const; + + //- The mass transfer rate for the mixture + virtual tmp dmdtf() const; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C index d7fb0b33e8..83e39266b7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,6 +39,8 @@ namespace Foam const Foam::dimensionSet Foam::phaseTransferModel::dimDmdt = Foam::dimDensity/Foam::dimTime; +const Foam::hashedWordList Foam::phaseTransferModel::noSpecies_ = + Foam::hashedWordList(); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -48,6 +50,15 @@ Foam::phaseTransferModel::phaseTransferModel const phasePair& pair ) : + regIOobject + ( + IOobject + ( + IOobject::groupName(typeName, pair.name()), + pair.phase1().mesh().time().timeName(), + pair.phase1().mesh() + ) + ), pair_(pair) {} @@ -58,4 +69,37 @@ Foam::phaseTransferModel::~phaseTransferModel() {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::phaseTransferModel::mixture() const +{ + return false; +} + + +Foam::tmp Foam::phaseTransferModel::dmdtf() const +{ + return tmp(nullptr); +} + + +const Foam::hashedWordList& Foam::phaseTransferModel::species() const +{ + return noSpecies_; +} + + +Foam::HashPtrTable +Foam::phaseTransferModel::dmidtf() const +{ + return HashPtrTable(); +} + + +bool Foam::phaseTransferModel::writeData(Ostream& os) const +{ + return os.good(); +} + + // ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.H b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.H index 9af52d3ece..ba14ab2fce 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.H @@ -38,6 +38,8 @@ SourceFiles #include "volFields.H" #include "dictionary.H" +#include "HashPtrTable.H" +#include "hashedWordList.H" #include "runTimeSelectionTables.H" namespace Foam @@ -50,6 +52,8 @@ class phasePair; \*---------------------------------------------------------------------------*/ class phaseTransferModel +: + public regIOobject { protected: @@ -85,6 +89,9 @@ public: //- Mass transfer rate dimensions static const dimensionSet dimDmdt; + //- Empty species list + static const hashedWordList noSpecies_; + // Constructors @@ -111,29 +118,20 @@ public: // Member Functions - //- Return the active species for the current pair, - // by default returns empty list - virtual const wordList activeSpecies() const - { - return wordList(); - }; + //- Whether or not there is a mass transfer rate for the mixture + virtual bool mixture() const; - //- Do possible corrections before dmdt calculations - virtual void correct() {}; + //- The mass transfer rate for the mixture + virtual tmp dmdtf() const; - //- The mass transfer rate - virtual tmp dmdt() const = 0; + //- The list of individual species that are transferred + virtual const hashedWordList& species() const; - //- The mass transfer rate for the given species, this needs to be - // implemented only if the model uses non uniform species transfer - virtual tmp speciesDmdt - ( - const word speciesName - ) const - { - NotImplemented; - return dmdt(); - }; + //- The mass transfer rate for individual species + virtual HashPtrTable dmidtf() const; + + //- Dummy write for regIOobject + bool writeData(Ostream& os) const; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C index 31e1d7ea1d..3be9c4ff75 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C @@ -74,44 +74,33 @@ Foam::phaseTransferModels::reactionDriven::~reactionDriven() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp -Foam::phaseTransferModels::reactionDriven::dmdt() const +const Foam::hashedWordList& +Foam::phaseTransferModels::reactionDriven::species() const { - volScalarField dmdt - ( - volScalarField::New - ( - "reactionDrivendmdt", - pair_.phase1().mesh(), - dimensionedScalar(Foam::phaseTransferModel::dimDmdt, 0) - ) - ); - - forAllConstIter - ( - wordList, - species_, - sIter - ) - { - dmdt += speciesDmdt(*sIter); - } - - return dmdt; + return species_; } -Foam::tmp -Foam::phaseTransferModels::reactionDriven::speciesDmdt -( - const word speciesName -) const +Foam::HashPtrTable +Foam::phaseTransferModels::reactionDriven::dmidtf() const { - // Reaction rate query requires non const Y - volScalarField& Y = - const_cast(reactingPhase_.Y(speciesName)); + HashPtrTable result; - return sign_*reactingPhase_*reactingPhase_.R(Y) & Y; + forAll(species_, i) + { + const word name = species_[i]; + + volScalarField& Y = + const_cast(reactingPhase_.Y(name)); + + result.set + ( + species_[i], + (sign_*reactingPhase_*reactingPhase_.R(Y) & Y).ptr() + ); + } + + return result; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H index 7376ae2fbc..0e5634cfcd 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H +++ b/applications/solvers/multiphase/reactingEulerFoam/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H @@ -74,7 +74,7 @@ private: const scalar sign_; //- List of species changing phase - wordList species_; + const hashedWordList species_; public: @@ -99,20 +99,11 @@ public: // Member Functions - //- Return the active species for the current pair - virtual const wordList activeSpecies() const - { - return species_; - }; + //- The list of individual species that are transferred + virtual const hashedWordList& species() const; - //- The mass transfer rate - virtual tmp dmdt() const; - - //- The mass transfer rate for the given species - virtual tmp speciesDmdt - ( - const word speciesName - ) const; + //- The mass transfer rate for individual species + virtual HashPtrTable dmidtf() const; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C index f4323f2d0d..abc7e3a525 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.C @@ -31,46 +31,97 @@ License namespace Foam { +namespace blendedInterfacialModel +{ -// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // +template +inline tmp interpolate(tmp f); template<> -inline tmp -blendedInterfacialModel::interpolate(tmp f) +inline tmp interpolate(tmp f) { return f; } - template<> -inline tmp -blendedInterfacialModel::interpolate(tmp f) +inline tmp interpolate(tmp f) { return fvc::interpolate(f); } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - +} // End namespace blendedInterfacialModel } // End namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template -template -void Foam::BlendedInterfacialModel::correctFixedFluxBCs +template class PatchField, class GeoMesh> +void Foam::BlendedInterfacialModel::calculateBlendingCoeffs ( - GeoField& field + tmp>& f1, + tmp>& f2, + const bool subtract ) const { - typename GeoField::Boundary& fieldBf = field.boundaryFieldRef(); + typedef GeometricField scalarGeoField; - forAll(phase1_.phi()().boundaryField(), patchi) + if (model_.valid() && subtract) + { + FatalErrorInFunction + << "Cannot treat an interfacial model with no distinction between " + << "continuous and dispersed phases as signed" + << exit(FatalError); + } + + if (model_.valid() || model1In2_.valid()) + { + f1 = + blendedInterfacialModel::interpolate + ( + blending_.f1(phase1_, phase2_) + ); + } + + if (model_.valid() || model2In1_.valid()) + { + f2 = + (subtract ? -1 : +1) + *blendedInterfacialModel::interpolate + ( + blending_.f2(phase1_, phase2_) + ); + } +} + + +template +template class PatchField, class GeoMesh> +void Foam::BlendedInterfacialModel::correctFixedFluxBCs +( + GeometricField& field +) const +{ + typedef GeometricField typeGeoField; + + typename typeGeoField::Boundary& fieldBf = field.boundaryFieldRef(); + + forAll(fieldBf, patchi) { if ( - isA ( - phase1_.phi()().boundaryField()[patchi] + !phase1_.stationary() + && isA + ( + phase1_.phi()().boundaryField()[patchi] + ) + ) + || ( + !phase2_.stationary() + && isA + ( + phase2_.phi()().boundaryField()[patchi] + ) ) ) { @@ -103,73 +154,30 @@ Foam::BlendedInterfacialModel::evaluate typedef GeometricField typeGeoField; tmp f1, f2; + calculateBlendingCoeffs(f1, f2, subtract); - if (model_.valid() || model1In2_.valid()) - { - f1 = - blendedInterfacialModel::interpolate - ( - blending_.f1(phase1_, phase2_) - ); - } - - if (model_.valid() || model2In1_.valid()) - { - f2 = - blendedInterfacialModel::interpolate - ( - blending_.f2(phase1_, phase2_) - ); - } - - tmp x - ( - new typeGeoField + tmp x = + typeGeoField::New ( - IOobject - ( - ModelType::typeName + ":" + name, - phase1_.mesh().time().timeName(), - phase1_.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - false - ), + ModelType::typeName + ":" + + IOobject::groupName(name, phasePair(phase1_, phase2_).name()), phase1_.mesh(), - dimensioned("zero", dims, Zero) - ) - ); + dimensioned(dims, Zero) + ); if (model_.valid()) { - if (subtract) - { - FatalErrorInFunction - << "Cannot treat an interfacial model with no distinction " - << "between continuous and dispersed phases as signed" - << exit(FatalError); - } - - x.ref() += (model_().*method)(args ...)*(scalar(1) - f1() - f2()); + x.ref() += (scalar(1) - f1() - f2())*(model_().*method)(args ...); } if (model1In2_.valid()) { - x.ref() += (model1In2_().*method)(args ...)*f1; + x.ref() += f1*(model1In2_().*method)(args ...); } if (model2In1_.valid()) { - tmp dx = (model2In1_().*method)(args ...)*f2; - - if (subtract) - { - x.ref() -= dx; - } - else - { - x.ref() += dx; - } + x.ref() += f2*(model2In1_().*method)(args ...); } if @@ -185,6 +193,96 @@ Foam::BlendedInterfacialModel::evaluate } +template +template +< + class Type, + template class PatchField, + class GeoMesh, + class ... Args +> +Foam::HashPtrTable> +Foam::BlendedInterfacialModel::evaluate +( + HashPtrTable> + (ModelType::*method)(Args ...) const, + const word& name, + const dimensionSet& dims, + const bool subtract, + Args ... args +) const +{ + typedef GeometricField scalarGeoField; + typedef GeometricField typeGeoField; + + tmp f1, f2; + calculateBlendingCoeffs(f1, f2, subtract); + + HashPtrTable xs; + + auto addToXs = [&] + ( + const scalarGeoField& f, + const HashPtrTable& dxs + ) + { + forAllConstIter(typename HashPtrTable, dxs, dxIter) + { + if (xs.found(dxIter.key())) + { + *xs[dxIter.key()] += f**dxIter(); + } + else + { + xs.insert + ( + dxIter.key(), + typeGeoField::New + ( + ModelType::typeName + ':' + + IOobject::groupName + ( + IOobject::groupName(name, dxIter.key()), + phasePair(phase1_, phase2_).name() + ), + f**dxIter() + ).ptr() + ); + } + } + }; + + if (model_.valid()) + { + addToXs(scalar(1) - f1() - f2(), (model_().*method)(args ...)); + } + + if (model1In2_.valid()) + { + addToXs(f1, (model1In2_().*method)(args ...)); + } + + if (model2In1_.valid()) + { + addToXs(f2, (model1In2_().*method)(args ...)); + } + + if + ( + correctFixedFluxBCs_ + && (model_.valid() || model1In2_.valid() || model2In1_.valid()) + ) + { + forAllIter(typename HashPtrTable, xs, xIter) + { + correctFixedFluxBCs(*xIter()); + } + } + + return xs; +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -290,46 +388,6 @@ Foam::BlendedInterfacialModel::~BlendedInterfacialModel() // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // -template -void Foam::BlendedInterfacialModel::correct() -{ - if (model1In2_.valid()) - { - model1In2_->correct(); - } - if (model2In1_.valid()) - { - model2In1_->correct(); - } - if (model_.valid()) - { - model_->correct(); - } -} - - -template -const Foam::wordList Foam::BlendedInterfacialModel:: -activeSpecies() const -{ - wordList activeSpeciesList; - if (model1In2_.valid()) - { - activeSpeciesList.append(model1In2_->activeSpecies()); - } - if (model2In1_.valid()) - { - activeSpeciesList.append(model2In1_->activeSpecies()); - } - if (model_.valid()) - { - activeSpeciesList.append(model_->activeSpecies()); - } - - return activeSpeciesList; -} - - template Foam::tmp Foam::BlendedInterfacialModel::K() const @@ -384,29 +442,50 @@ Foam::BlendedInterfacialModel::D() const template -Foam::tmp -Foam::BlendedInterfacialModel::dmdt() const +bool Foam::BlendedInterfacialModel::mixture() const { - return evaluate(&ModelType::dmdt, "dmdt", ModelType::dimDmdt, false); + return + (model1In2_.valid() && model1In2_->mixture()) + || (model2In1_.valid() && model2In1_->mixture()) + || (model_.valid() && model_->mixture()); } template Foam::tmp -Foam::BlendedInterfacialModel::speciesDmdt -( - const word speciesName -) const +Foam::BlendedInterfacialModel::dmdtf() const { - return - evaluate - ( - &ModelType::speciesDmdt, - "speciesDmdt", - ModelType::dimDmdt, - false, - speciesName - ); + return evaluate(&ModelType::dmdtf, "dmdtf", ModelType::dimDmdt, true); +} + + +template +Foam::hashedWordList Foam::BlendedInterfacialModel::species() const +{ + wordList species; + + if (model1In2_.valid()) + { + species.append(model1In2_->species()); + } + if (model2In1_.valid()) + { + species.append(model2In1_->species()); + } + if (model_.valid()) + { + species.append(model_->species()); + } + + return hashedWordList(move(species)); +} + + +template +Foam::HashPtrTable +Foam::BlendedInterfacialModel::dmidtf() const +{ + return evaluate(&ModelType::dmidtf, "dmidtf", ModelType::dimDmdt, true); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.H index 432e1d3490..e216dc3282 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/BlendedInterfacialModel/BlendedInterfacialModel.H @@ -37,6 +37,8 @@ SourceFiles #include "blendingMethod.H" #include "phasePair.H" #include "orderedPhasePair.H" +#include "HashPtrTable.H" +#include "hashedWordList.H" #include "geometricZeroField.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,21 +46,6 @@ SourceFiles namespace Foam { -/*---------------------------------------------------------------------------*\ - Class blendedInterfacialModel Declaration -\*---------------------------------------------------------------------------*/ - -class blendedInterfacialModel -{ - public: - - //- Convenience function to interpolate blending values. Needs to be - // specialised, so can't sit in the templated class. - template - static inline tmp interpolate(tmp f); -}; - - /*---------------------------------------------------------------------------*\ Class BlendedInterfacialModel Declaration \*---------------------------------------------------------------------------*/ @@ -94,9 +81,21 @@ class BlendedInterfacialModel // Private Member Functions + //- Calculate the blending coefficients + template class PatchField, class GeoMesh> + void calculateBlendingCoeffs + ( + tmp>& f1, + tmp>& f2, + const bool subtract + ) const; + //- Correct coeff/value on fixed flux boundary conditions - template - void correctFixedFluxBCs(GeoField& field) const; + template class PatchField, class GeoMesh> + void correctFixedFluxBCs + ( + GeometricField& field + ) const; //- Return the blended coeff/value template @@ -116,6 +115,24 @@ class BlendedInterfacialModel Args ... args ) const; + //- Return the blended coeff/value + template + < + class Type, + template class PatchField, + class GeoMesh, + class ... Args + > + HashPtrTable> evaluate + ( + HashPtrTable> + (ModelType::*method)(Args ...) const, + const word& name, + const dimensionSet& dims, + const bool subtract, + Args ... args + ) const; + public: @@ -162,12 +179,6 @@ public: // Member Functions - //- Correct the underlying models - void correct(); - - //- Return the list of active species - const wordList activeSpecies() const; - //- Return the blended force coefficient tmp K() const; @@ -187,11 +198,17 @@ public: //- Return the blended diffusivity tmp D() const; - //- Return the blended mass transfer rate - tmp dmdt() const; + //- Return the list of individual species that are transferred + bool mixture() const; - //- Return the blended species transfer rate - tmp speciesDmdt(const word speciesName) const; + //- Return the blended mass transfer rate + tmp dmdtf() const; + + //- Return the list of individual species that are transferred + hashedWordList species() const; + + //- Return the blended mass transfer rates for individual species + HashPtrTable dmidtf() const; //- Dummy write for regIOobject bool writeData(Ostream& os) const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C index 495ceb485f..9981199674 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.C @@ -32,13 +32,12 @@ License // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // template -Foam::autoPtr +Foam::autoPtr Foam::InterfaceCompositionPhaseChangePhaseSystem:: -iDmdts() const +dmdtfs() const { - autoPtr iDmdtsPtr(new phaseSystem::dmdtTable); - - phaseSystem::dmdtTable& iDmdts = iDmdtsPtr(); + autoPtr dmdtPtr(new phaseSystem::dmdtfTable); + phaseSystem::dmdtfTable& dmdtfs = dmdtPtr(); forAllConstIter ( @@ -66,43 +65,43 @@ iDmdts() const ( hashedWordList, compositionModel.species(), - memberIter + specieIter ) { - const word& member = *memberIter; + const word& specie = *specieIter; - const label dmidtSign = pairIter.index() == 0 ? +1 : -1; - - tmp dmidt + tmp dmidtf ( - *(*iDmdtSu_[pair])[member] - + *(*iDmdtSp_[pair])[member]*phase.Y(member) + (pairIter.index() == 0 ? +1 : -1) + *( + *(*dmidtfSus_[pair])[specie] + + *(*dmidtfSps_[pair])[specie]*phase.Y(specie) + ) ); - if (iDmdts.found(pair)) + if (dmdtfs.found(pair)) { - *iDmdts[pair] += dmidtSign*dmidt; + *dmdtfs[pair] += dmidtf; } else { - iDmdts.insert(pair, (dmidtSign*dmidt).ptr()); + dmdtfs.insert(pair, dmidtf.ptr()); } } } } - return iDmdtsPtr; + return dmdtPtr; } template -Foam::autoPtr +Foam::autoPtr Foam::InterfaceCompositionPhaseChangePhaseSystem:: -iDmidts() const +dmidtfs() const { - autoPtr iDmidtsPtr(new phaseSystem::dmidtTable); - - phaseSystem::dmidtTable& iDmidts = iDmidtsPtr(); + autoPtr dmidtfsPtr(new phaseSystem::dmidtfTable); + phaseSystem::dmidtfTable& dmidtfs = dmidtfsPtr(); forAllConstIter ( @@ -114,9 +113,9 @@ iDmidts() const const phasePair& pair = this->phasePairs_[interfaceCompositionModelIter.key()]; - if (!iDmidts.found(pair)) + if (!dmidtfs.found(pair)) { - iDmidts.insert(pair, new HashPtrTable()); + dmidtfs.insert(pair, new HashPtrTable()); } forAllConstIter(phasePair, pair, pairIter) @@ -135,32 +134,34 @@ iDmidts() const ( hashedWordList, compositionModel.species(), - memberIter + specieIter ) { - const word& member = *memberIter; + const word& specie = *specieIter; - const label dmidtSign = pairIter.index() == 0 ? +1 : -1; - tmp dmidt + tmp dmidtf ( - *(*iDmdtSu_[pair])[member] - + *(*iDmdtSp_[pair])[member]*phase.Y(member) + (pairIter.index() == 0 ? +1 : -1) + *( + *(*dmidtfSus_[pair])[specie] + + *(*dmidtfSps_[pair])[specie]*phase.Y(specie) + ) ); - if (iDmidts[pair]->found(member)) + if (dmidtfs[pair]->found(specie)) { - *(*iDmidts[pair])[member] += dmidtSign*dmidt; + *(*dmidtfs[pair])[specie] += dmidtf; } else { - iDmidts[pair]->insert(member, (dmidtSign*dmidt).ptr()); + dmidtfs[pair]->insert(specie, dmidtf.ptr()); } } } } - return iDmidtsPtr; + return dmidtfsPtr; } @@ -255,8 +256,8 @@ InterfaceCompositionPhaseChangePhaseSystem const phasePair& pair = this->phasePairs_[interfaceCompositionModelIter.key()]; - iDmdtSu_.insert(pair, new HashPtrTable()); - iDmdtSp_.insert(pair, new HashPtrTable()); + dmidtfSus_.insert(pair, new HashPtrTable()); + dmidtfSps_.insert(pair, new HashPtrTable()); forAllConstIter(phasePair, pair, pairIter) { @@ -272,23 +273,57 @@ InterfaceCompositionPhaseChangePhaseSystem ( hashedWordList, compositionModel.species(), - memberIter + specieIter ) { - const word& member = *memberIter; + const word& specie = *specieIter; - iDmdtSu_[pair]->insert + dmidtfSus_[pair]->insert ( - member, - zeroVolField(pair, "iDmdtSu", dimDensity/dimTime) - .ptr() + specie, + new volScalarField + ( + IOobject + ( + IOobject::groupName + ( + IOobject::groupName + ( + "interfaceCompositionPhaseChange:dmidtfSu", + specie + ), + pair.name() + ), + this->mesh().time().timeName(), + this->mesh() + ), + this->mesh(), + dimensionedScalar(dimDensity/dimTime, 0) + ) ); - iDmdtSp_[pair]->insert + dmidtfSps_[pair]->insert ( - member, - zeroVolField(pair, "iDmdtSp", dimDensity/dimTime) - .ptr() + specie, + new volScalarField + ( + IOobject + ( + IOobject::groupName + ( + IOobject::groupName + ( + "interfaceCompositionPhaseChange:dmidtfSp", + specie + ), + pair.name() + ), + this->mesh().time().timeName(), + this->mesh() + ), + this->mesh(), + dimensionedScalar(dimDensity/dimTime, 0) + ) ); } } @@ -306,24 +341,71 @@ Foam::InterfaceCompositionPhaseChangePhaseSystem:: // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +template +Foam::tmp +Foam::InterfaceCompositionPhaseChangePhaseSystem::dmdtf +( + const phasePairKey& key +) const +{ + tmp tDmdtf = BasePhaseSystem::dmdtf(key); + + if (interfaceCompositionModels_.found(key)) + { + const phasePair& pair = this->phasePairs_[key]; + + forAllConstIter(phasePair, pair, pairIter) + { + const autoPtr& compositionModelPtr = + interfaceCompositionModels_[key][pairIter.index()]; + + if (!compositionModelPtr.valid()) continue; + + const interfaceCompositionModel& compositionModel = + compositionModelPtr(); + + const phaseModel& phase = *pairIter; + + forAllConstIter + ( + hashedWordList, + compositionModel.species(), + specieIter + ) + { + const word& specie = *specieIter; + + tDmdtf.ref() += + Pair::compare(pair, key) + *( + *(*dmidtfSus_[pair])[specie] + - *(*dmidtfSps_[pair])[specie]*phase.Y(specie) + ); + } + } + } + + return tDmdtf; +} + + template Foam::PtrList Foam::InterfaceCompositionPhaseChangePhaseSystem::dmdts() const { PtrList dmdts(BasePhaseSystem::dmdts()); - autoPtr iDmdtsPtr = this->iDmdts(); + autoPtr dmdtfsPtr = this->dmdtfs(); + const phaseSystem::dmdtfTable& dmdtfs = dmdtfsPtr(); - const phaseSystem::dmdtTable& iDmdts = iDmdtsPtr(); - - forAllConstIter(phaseSystem::dmdtTable, iDmdts, iDmdtIter) + forAllConstIter(phaseSystem::dmdtfTable, dmdtfs, dmdtfsIter) { - const phasePair& pair = this->phasePairs_[iDmdtIter.key()]; + const phasePair& pair = this->phasePairs_[dmdtfsIter.key()]; const phaseModel& phase = pair.phase1(); const phaseModel& otherPhase = pair.phase2(); - addField(phase, "dmdt", *iDmdtIter(), dmdts); - addField(otherPhase, "dmdt", - *iDmdtIter(), dmdts); + addField(phase, "dmdt", *dmdtfsIter(), dmdts); + addField(otherPhase, "dmdt", - *dmdtfsIter(), dmdts); } return dmdts; @@ -340,7 +422,7 @@ momentumTransfer() phaseSystem::momentumTransferTable& eqns = eqnsPtr(); - this->addDmdtU(iDmdts(), eqns); + this->addDmdtUfs(dmdtfs(), eqns); return eqnsPtr; } @@ -356,7 +438,7 @@ momentumTransferf() phaseSystem::momentumTransferTable& eqns = eqnsPtr(); - this->addDmdtU(iDmdts(), eqns); + this->addDmdtUfs(dmdtfs(), eqns); return eqnsPtr; } @@ -372,7 +454,7 @@ heatTransfer() const phaseSystem::heatTransferTable& eqns = eqnsPtr(); - this->addDmidtHe(iDmidts(), eqns); + this->addDmidtHef(dmidtfs(), eqns); return eqnsPtr; } @@ -390,7 +472,7 @@ specieTransfer() const // Explicit /* - this->addDmidtY(iDmidts(), eqns); + this->addDmidtYf(dmidtfs(), eqns); */ // Semi-implicit @@ -421,22 +503,22 @@ specieTransfer() const ( hashedWordList, compositionModel.species(), - memberIter + specieIter ) { - const word& member = *memberIter; + const word& specie = *specieIter; // Implicit transport through this phase - *eqns[phase.Y(member).name()] += - *(*iDmdtSu_[pair])[member] - + fvm::Sp(*(*iDmdtSp_[pair])[member], phase.Y(member)); + *eqns[phase.Y(specie).name()] += + *(*dmidtfSus_[pair])[specie] + + fvm::Sp(*(*dmidtfSps_[pair])[specie], phase.Y(specie)); // Explicit transport out of the other phase - if (eqns.found(IOobject::groupName(member, otherPhase.name()))) + if (eqns.found(IOobject::groupName(specie, otherPhase.name()))) { - *eqns[otherPhase.Y(member).name()] -= - *(*iDmdtSu_[pair])[member] - + *(*iDmdtSp_[pair])[member]*phase.Y(member); + *eqns[otherPhase.Y(specie).name()] -= + *(*dmidtfSus_[pair])[specie] + + *(*dmidtfSps_[pair])[specie]*phase.Y(specie); } } } @@ -486,16 +568,16 @@ correct() ( hashedWordList, compositionModel.species(), - memberIter + specieIter ) { - const word& member = *memberIter; + const word& specie = *specieIter; - const volScalarField KD(K*compositionModel.D(member)); - const volScalarField Yf(compositionModel.Yf(member, Tf)); + const volScalarField KD(K*compositionModel.D(specie)); + const volScalarField Yf(compositionModel.Yf(specie, Tf)); - *(*iDmdtSu_[pair])[member] = phase.rho()*KD*Yf; - *(*iDmdtSp_[pair])[member] = - phase.rho()*KD; + *(*dmidtfSus_[pair])[specie] = phase.rho()*KD*Yf; + *(*dmidtfSps_[pair])[specie] = - phase.rho()*KD; } } } @@ -546,40 +628,40 @@ correctInterfaceThermo() for (label i = 0; i < nInterfaceCorrectors_; ++ i) { - tmp mDotL = - zeroVolField + tmp dmdtLf = + volScalarField::New ( - pair, - "mDotL", - dimEnergy/dimVolume/dimTime + IOobject::groupName("dmdtLf", pair.name()), + this->mesh(), + dimensionedScalar(dimEnergy/dimVolume/dimTime, 0) ); - tmp mDotLPrime = - zeroVolField + tmp dmdtLfPrime = + volScalarField::New ( - pair, - "mDotLPrime", - mDotL().dimensions()/dimTemperature + IOobject::groupName("dmdtLfPrime", pair.name()), + this->mesh(), + dimensionedScalar(dmdtLf().dimensions()/dimTemperature, 0) ); // Add latent heats from forward and backward models if (this->interfaceCompositionModels_[pair].first().valid()) { - this->interfaceCompositionModels_[pair].first()->addMDotL + this->interfaceCompositionModels_[pair].first()->addDmdtL ( diffusiveMassTransferModels_[pair].first()->K(), Tf, - mDotL.ref(), - mDotLPrime.ref() + dmdtLf.ref(), + dmdtLfPrime.ref() ); } if (this->interfaceCompositionModels_[pair].second().valid()) { - this->interfaceCompositionModels_[pair].second()->addMDotL + this->interfaceCompositionModels_[pair].second()->addDmdtL ( - diffusiveMassTransferModels_[pair].second()->K(), Tf, - mDotL.ref(), - mDotLPrime.ref() + dmdtLf.ref(), + dmdtLfPrime.ref() ); } @@ -589,10 +671,10 @@ correctInterfaceThermo() ( H1*(Tf - pair.phase1().thermo().T()) + H2*(Tf - pair.phase2().thermo().T()) - - mDotL + - dmdtLf ) /( - max(H1 + H2 - mDotLPrime, HSmall) + max(H1 + H2 - dmdtLfPrime, HSmall) ); Tf.correctBoundaryConditions(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.H index 6f9c4572b4..ac2948be07 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/InterfaceCompositionPhaseChangePhaseSystem/InterfaceCompositionPhaseChangePhaseSystem.H @@ -59,8 +59,6 @@ class InterfaceCompositionPhaseChangePhaseSystem : public BasePhaseSystem { -private: - // Private typedefs typedef HashTable @@ -92,19 +90,19 @@ private: interfaceCompositionModelTable interfaceCompositionModels_; //- The explicit part of the interfacial mass transfer rates - phaseSystem::dmidtTable iDmdtSu_; + phaseSystem::dmidtfTable dmidtfSus_; //- The implicit part of the interfacial mass transfer rates - phaseSystem::dmidtTable iDmdtSp_; + phaseSystem::dmidtfTable dmidtfSps_; // Private member functions - //- Return the bulk mass transfers across each interface - autoPtr iDmdts() const; + //- Return mass transfers across each interface + autoPtr dmdtfs() const; - //- Return the species mass transfers across each interface - autoPtr iDmidts() const; + //- Return species mass transfers across each interface + autoPtr dmidtfs() const; public: @@ -121,6 +119,9 @@ public: // Member Functions + //- Return the mass transfer rate for an interface + virtual tmp dmdtf(const phasePairKey& key) const; + //- Return the mass transfer rates for each phase virtual PtrList dmdts() const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C index 2384017eff..cd9ee83a50 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.C @@ -119,18 +119,18 @@ Foam::MomentumTransferPhaseSystem::Vm // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template -void Foam::MomentumTransferPhaseSystem::addDmdtU +void Foam::MomentumTransferPhaseSystem::addDmdtUfs ( - const phaseSystem::dmdtTable& dmdts, + const phaseSystem::dmdtfTable& dmdtfs, phaseSystem::momentumTransferTable& eqns ) { - forAllConstIter(phaseSystem::dmdtTable, dmdts, dmdtIter) + forAllConstIter(phaseSystem::dmdtfTable, dmdtfs, dmdtfIter) { - const phasePairKey& key = dmdtIter.key(); + const phasePairKey& key = dmdtfIter.key(); const phasePair& pair(this->phasePairs_[key]); - const volScalarField dmdt(Pair::compare(pair, key)**dmdtIter()); + const volScalarField dmdtf(Pair::compare(pair, key)**dmdtfIter()); phaseModel& phase1 = this->phases()[pair.phase1().name()]; phaseModel& phase2 = this->phases()[pair.phase2().name()]; @@ -150,18 +150,18 @@ void Foam::MomentumTransferPhaseSystem::addDmdtU if (!phase1.stationary()) { - const volScalarField dmdt21(posPart(dmdt)); + const volScalarField dmdtf21(posPart(dmdtf)); *eqns[phase1.name()] += - dmdt21*phase2.U() - fvm::Sp(dmdt21, phase1.URef()); + dmdtf21*phase2.U() - fvm::Sp(dmdtf21, phase1.URef()); } if (!phase2.stationary()) { - const volScalarField dmdt12(negPart(dmdt)); + const volScalarField dmdtf12(negPart(dmdtf)); *eqns[phase2.name()] -= - dmdt12*phase1.U() - fvm::Sp(dmdt12, phase2.URef()); + dmdtf12*phase1.U() - fvm::Sp(dmdtf12, phase2.URef()); } } } @@ -220,13 +220,33 @@ MomentumTransferPhaseSystem Kds_.insert ( pair, - zeroVolField(pair, "Kd", dragModel::dimK).ptr() + new volScalarField + ( + IOobject + ( + IOobject::groupName("Kd", pair.name()), + this->mesh().time().timeName(), + this->mesh() + ), + this->mesh(), + dimensionedScalar(dragModel::dimK, 0) + ) ); Kdfs_.insert ( pair, - zeroSurfaceField(pair, "Kdf", dragModel::dimK).ptr() + new surfaceScalarField + ( + IOobject + ( + IOobject::groupName("Kdf", pair.name()), + this->mesh().time().timeName(), + this->mesh() + ), + this->mesh(), + dimensionedScalar(dragModel::dimK, 0) + ) ); } @@ -242,13 +262,33 @@ MomentumTransferPhaseSystem Vms_.insert ( pair, - zeroVolField(pair, "Vm", virtualMassModel::dimK).ptr() + new volScalarField + ( + IOobject + ( + IOobject::groupName("Vm", pair.name()), + this->mesh().time().timeName(), + this->mesh() + ), + this->mesh(), + dimensionedScalar(virtualMassModel::dimK, 0) + ) ); Vmfs_.insert ( pair, - zeroSurfaceField(pair, "Vmf", virtualMassModel::dimK).ptr() + new surfaceScalarField + ( + IOobject + ( + IOobject::groupName("Vmf", pair.name()), + this->mesh().time().timeName(), + this->mesh() + ), + this->mesh(), + dimensionedScalar(virtualMassModel::dimK, 0) + ) ); } } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.H index 18912b4425..1514f7bf47 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/MomentumTransferPhaseSystem/MomentumTransferPhaseSystem.H @@ -192,9 +192,9 @@ protected: // Protected Member Functions //- Add momentum transfer terms which result from bulk mass transfers - void addDmdtU + void addDmdtUfs ( - const phaseSystem::dmdtTable& dmdts, + const phaseSystem::dmdtfTable& dmdtfs, phaseSystem::momentumTransferTable& eqns ); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/OneResistanceHeatTransferPhaseSystem/OneResistanceHeatTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/OneResistanceHeatTransferPhaseSystem/OneResistanceHeatTransferPhaseSystem.C index 8986ad5e98..7828a3b963 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/OneResistanceHeatTransferPhaseSystem/OneResistanceHeatTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/OneResistanceHeatTransferPhaseSystem/OneResistanceHeatTransferPhaseSystem.C @@ -32,20 +32,19 @@ License // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template -void Foam::OneResistanceHeatTransferPhaseSystem::addDmdtHe +void Foam::OneResistanceHeatTransferPhaseSystem::addDmdtHefs ( - const phaseSystem::dmdtTable& dmdts, + const phaseSystem::dmdtfTable& dmdtfs, phaseSystem::heatTransferTable& eqns ) const { - forAllConstIter(phaseSystem::dmdtTable, dmdts, dmdtIter) + forAllConstIter(phaseSystem::dmdtfTable, dmdtfs, dmdtfIter) { - const phasePairKey& key = dmdtIter.key(); + const phasePairKey& key = dmdtfIter.key(); const phasePair& pair(this->phasePairs_[key]); - - const volScalarField dmdt(Pair::compare(pair, key)**dmdtIter()); - const volScalarField dmdt21(posPart(dmdt)); - const volScalarField dmdt12(negPart(dmdt)); + const volScalarField dmdtf(Pair::compare(pair, key)**dmdtfIter()); + const volScalarField dmdtf21(posPart(dmdtf)); + const volScalarField dmdtf12(negPart(dmdtf)); const phaseModel& phase1 = pair.phase1(); const phaseModel& phase2 = pair.phase2(); @@ -57,30 +56,30 @@ void Foam::OneResistanceHeatTransferPhaseSystem::addDmdtHe const volScalarField K2(phase2.K()); // Note that the phase EEqn contains a continuity error term. See - // MomentumTransferPhaseSystem::addDmdtU for an explanation of the + // MomentumTransferPhaseSystem::addDmdtUfs for an explanation of the // fvm::Sp terms below. // Transfer of energy from bulk to bulk - *eqns[phase1.name()] += dmdt21*he2 - fvm::Sp(dmdt21, he1); - *eqns[phase2.name()] -= dmdt12*he1 - fvm::Sp(dmdt12, he2); + *eqns[phase1.name()] += dmdtf21*he2 - fvm::Sp(dmdtf21, he1); + *eqns[phase2.name()] -= dmdtf12*he1 - fvm::Sp(dmdtf12, he2); // Transfer of kinetic energy - *eqns[phase1.name()] += dmdt21*(K2 - K1); - *eqns[phase2.name()] -= dmdt12*(K1 - K2); + *eqns[phase1.name()] += dmdtf21*(K2 - K1); + *eqns[phase2.name()] -= dmdtf12*(K1 - K2); } } template -void Foam::OneResistanceHeatTransferPhaseSystem::addDmidtHe +void Foam::OneResistanceHeatTransferPhaseSystem::addDmidtHef ( - const phaseSystem::dmidtTable& dmidts, + const phaseSystem::dmidtfTable& dmidtfs, phaseSystem::heatTransferTable& eqns ) const { - forAllConstIter(phaseSystem::dmidtTable, dmidts, dmidtIter) + forAllConstIter(phaseSystem::dmidtfTable, dmidtfs, dmidtfIter) { - const phasePairKey& key = dmidtIter.key(); + const phasePairKey& key = dmidtfIter.key(); const phasePair& pair(this->phasePairs_[key]); const phaseModel& phase1 = pair.phase1(); @@ -93,19 +92,19 @@ void Foam::OneResistanceHeatTransferPhaseSystem::addDmidtHe const volScalarField K2(phase2.K()); // Note that the phase EEqn contains a continuity error term. See - // MomentumTransferPhaseSystem::addDmdtU for an explanation of the + // MomentumTransferPhaseSystem::addDmdtUfs for an explanation of the // fvm::Sp terms below. - forAllConstIter(HashPtrTable, *dmidtIter(), dmidtJter) + forAllConstIter(HashPtrTable, *dmidtfIter(), dmidtfJter) { - const word& member = dmidtJter.key(); + const word& member = dmidtfJter.key(); - const volScalarField dmidt + const volScalarField dmidtf ( - Pair::compare(pair, key)**dmidtJter() + Pair::compare(pair, key)**dmidtfJter() ); - const volScalarField dmidt21(posPart(dmidt)); - const volScalarField dmidt12(negPart(dmidt)); + const volScalarField dmidtf21(posPart(dmidtf)); + const volScalarField dmidtf12(negPart(dmidtf)); // Create the energies for the transferring specie volScalarField hei1(he1); @@ -136,12 +135,12 @@ void Foam::OneResistanceHeatTransferPhaseSystem::addDmidtHe } // Transfer of energy from bulk to bulk - *eqns[phase1.name()] += dmidt21*hei2 - fvm::Sp(dmidt21, he1); - *eqns[phase2.name()] -= dmidt12*hei1 - fvm::Sp(dmidt12, he2); + *eqns[phase1.name()] += dmidtf21*hei2 - fvm::Sp(dmidtf21, he1); + *eqns[phase2.name()] -= dmidtf12*hei1 - fvm::Sp(dmidtf12, he2); // Transfer of kinetic energy - *eqns[phase1.name()] += dmidt21*(K2 - K1); - *eqns[phase2.name()] -= dmidt12*(K1 - K2); + *eqns[phase1.name()] += dmidtf21*(K2 - K1); + *eqns[phase2.name()] -= dmidtf12*(K1 - K2); } } } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/OneResistanceHeatTransferPhaseSystem/OneResistanceHeatTransferPhaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/OneResistanceHeatTransferPhaseSystem/OneResistanceHeatTransferPhaseSystem.H index 3dba5f064a..451d142ba0 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/OneResistanceHeatTransferPhaseSystem/OneResistanceHeatTransferPhaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/OneResistanceHeatTransferPhaseSystem/OneResistanceHeatTransferPhaseSystem.H @@ -82,16 +82,16 @@ protected: // Protected Member Functions //- Add energy transfer terms which result from bulk mass transfers - void addDmdtHe + void addDmdtHefs ( - const phaseSystem::dmdtTable& dmdts, + const phaseSystem::dmdtfTable& dmdtfs, phaseSystem::heatTransferTable& eqns ) const; //- Add energy transfer terms which result from specie mass transfers - void addDmidtHe + void addDmidtHef ( - const phaseSystem::dmidtTable& dmidts, + const phaseSystem::dmidtfTable& dmidtfs, phaseSystem::heatTransferTable& eqns ) const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PhaseTransferPhaseSystem/PhaseTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PhaseTransferPhaseSystem/PhaseTransferPhaseSystem.C index 9be7d5ea04..922f278a83 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PhaseTransferPhaseSystem/PhaseTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PhaseTransferPhaseSystem/PhaseTransferPhaseSystem.C @@ -30,66 +30,14 @@ License // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // template -void Foam::PhaseTransferPhaseSystem::addToSpeciesDmdt -( - const phasePair& pair, - const wordList species -) +Foam::autoPtr +Foam::PhaseTransferPhaseSystem::totalDmdtfs() const { - if (species.empty()) - { - return; - } - - if (!specieDmdt_.found(pair)) - { - specieDmdt_.insert(pair, new HashPtrTable()); - } - - forAllConstIter + autoPtr totalDmdtfsPtr ( - wordList, - species, - sIter - ) - { - const word specieName(*sIter); - if (!specieDmdt_[pair]->found(specieName)) - { - specieDmdt_[pair]->insert - ( - specieName, - new volScalarField - ( - IOobject - ( - IOobject::groupName - ( - specieName+":dmdt", - pair.name() - ), - this->mesh().time().timeName(), - this->mesh(), - IOobject::NO_READ, - IOobject::AUTO_WRITE - ), - this->mesh(), - dimensionedScalar(Foam::phaseTransferModel::dimDmdt, 0) - ) - ); - } - } -} - - -template -Foam::autoPtr -Foam::PhaseTransferPhaseSystem:: -sumDmdts() const -{ - autoPtr sumDmdtsPtr(new phaseSystem::dmdtTable); - - phaseSystem::dmdtTable& sumDmdts = sumDmdtsPtr(); + new phaseSystem::dmdtfTable + ); + phaseSystem::dmdtfTable& totalDmdtfs = totalDmdtfsPtr(); forAllConstIter ( @@ -101,52 +49,45 @@ sumDmdts() const const phasePair& pair = this->phasePairs_[phaseTransferModelIter.key()]; - sumDmdts.insert - ( - pair, - zeroVolField(pair, "dmdt", dimDensity/dimTime).ptr() - ); + totalDmdtfs.insert(pair, phaseSystem::dmdtf(pair).ptr()); - if (specieDmdt_.found(pair)) + if (phaseTransferModelIter()->mixture()) { - forAllConstIter - ( - HashPtrTable, - *specieDmdt_[pair], - sDmdtIter - ) - { - *sumDmdts[pair] += - phaseTransferModelIter()->speciesDmdt(sDmdtIter.key()); - } + *totalDmdtfs[pair] += *dmdtfs_[pair]; } - else + + forAllConstIter + ( + HashPtrTable, + *dmidtfs_[pair], + dmidtfIter + ) { - *sumDmdts[pair] += *rDmdt_[pair]; + *totalDmdtfs[pair] += *dmidtfIter(); } } - return sumDmdtsPtr; + return totalDmdtfsPtr; } // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template -void Foam::PhaseTransferPhaseSystem::addDmdtY +void Foam::PhaseTransferPhaseSystem::addDmdtYfs ( - const phaseSystem::dmdtTable& dmdts, + const phaseSystem::dmdtfTable& dmdtfs, phaseSystem::specieTransferTable& eqns ) const { - forAllConstIter(phaseSystem::dmdtTable, dmdts, dmdtIter) + forAllConstIter(phaseSystem::dmdtfTable, dmdtfs, dmdtfIter) { - const phasePairKey& key = dmdtIter.key(); + const phasePairKey& key = dmdtfIter.key(); const phasePair& pair(this->phasePairs_[key]); - const volScalarField dmdt(Pair::compare(pair, key)**dmdtIter()); - const volScalarField dmdt12(negPart(dmdt)); - const volScalarField dmdt21(posPart(dmdt)); + const volScalarField dmdtf(Pair::compare(pair, key)**dmdtfIter()); + const volScalarField dmdtf12(negPart(dmdtf)); + const volScalarField dmdtf21(posPart(dmdtf)); const phaseModel& phase1 = pair.phase1(); const phaseModel& phase2 = pair.phase2(); @@ -159,23 +100,23 @@ void Foam::PhaseTransferPhaseSystem::addDmdtY const volScalarField& Y1 = phase1.Y()[Yi1]; const volScalarField& Y2 = phase2.Y(Y1.member()); - *eqns[Y1.name()] += dmdt21*Y2 + fvm::Sp(dmdt12, Y1); - *eqns[Y2.name()] -= dmdt12*Y1 + fvm::Sp(dmdt21, Y2); + *eqns[Y1.name()] += dmdtf21*Y2 + fvm::Sp(dmdtf12, Y1); + *eqns[Y2.name()] -= dmdtf12*Y1 + fvm::Sp(dmdtf21, Y2); } } } template -void Foam::PhaseTransferPhaseSystem::addDmidtY +void Foam::PhaseTransferPhaseSystem::addDmidtYf ( - const phaseSystem::dmidtTable& dmidts, + const phaseSystem::dmidtfTable& dmidtfs, phaseSystem::specieTransferTable& eqns ) const { - forAllConstIter(phaseSystem::dmidtTable, dmidts, dmidtIter) + forAllConstIter(phaseSystem::dmidtfTable, dmidtfs, dmidtfIter) { - const phasePairKey& key = dmidtIter.key(); + const phasePairKey& key = dmidtfIter.key(); const phasePair& pair(this->phasePairs_[key]); const phaseModel& phase1 = pair.phase1(); @@ -184,25 +125,25 @@ void Foam::PhaseTransferPhaseSystem::addDmidtY // Note that the phase YiEqn does not contain a continuity error term, // so the transfers below are complete. - forAllConstIter(HashPtrTable, *dmidtIter(), dmidtJter) + forAllConstIter(HashPtrTable, *dmidtfIter(), dmidtfJter) { - const word& member = dmidtJter.key(); + const word& member = dmidtfJter.key(); - const volScalarField dmidt + const volScalarField dmidtf ( - Pair::compare(pair, key)**dmidtJter() + Pair::compare(pair, key)**dmidtfJter() ); if (!phase1.pure()) { const volScalarField& Y1 = phase1.Y(member); - *eqns[Y1.name()] += dmidt; + *eqns[Y1.name()] += dmidtf; } if (!phase2.pure()) { const volScalarField& Y2 = phase2.Y(member); - *eqns[Y2.name()] -= dmidt; + *eqns[Y2.name()] -= dmidtf; } } } @@ -235,14 +176,59 @@ Foam::PhaseTransferPhaseSystem::PhaseTransferPhaseSystem { const phasePair& pair = this->phasePairs_[phaseTransferModelIter.key()]; - addToSpeciesDmdt(pair, phaseTransferModelIter()->activeSpecies()); - - if (!specieDmdt_.found(pair)) + if (phaseTransferModelIter()->mixture()) { - this->rDmdt_.insert + dmdtfs_.insert ( - phaseTransferModelIter.key(), - zeroVolField(pair, "rDmdt", dimDensity/dimTime).ptr() + pair, + new volScalarField + ( + IOobject + ( + IOobject::groupName + ( + "phaseTransfer:dmdtf", + pair.name() + ), + this->mesh().time().timeName(), + this->mesh() + ), + this->mesh(), + dimensionedScalar(dimDensity/dimTime, 0) + ) + ); + } + + dmidtfs_.insert(pair, new HashPtrTable()); + + const hashedWordList species(phaseTransferModelIter()->species()); + + forAllConstIter(hashedWordList, species, specieIter) + { + const word& specie = *specieIter; + + dmidtfs_[pair]->insert + ( + specie, + new volScalarField + ( + IOobject + ( + IOobject::groupName + ( + IOobject::groupName + ( + "phaseTransfer:dmidtf", + specie + ), + pair.name() + ), + this->mesh().time().timeName(), + this->mesh() + ), + this->mesh(), + dimensionedScalar(dimDensity/dimTime, 0) + ) ); } } @@ -252,30 +238,60 @@ Foam::PhaseTransferPhaseSystem::PhaseTransferPhaseSystem // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -Foam::PhaseTransferPhaseSystem:: -~PhaseTransferPhaseSystem() +Foam::PhaseTransferPhaseSystem::~PhaseTransferPhaseSystem() {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +template +Foam::tmp +Foam::PhaseTransferPhaseSystem::dmdtf +( + const phasePairKey& key +) const +{ + tmp tDmdtf = BasePhaseSystem::dmdtf(key); + + if (phaseTransferModels_.found(key)) + { + const label dmdtfSign(Pair::compare(this->phasePairs_[key], key)); + + if (phaseTransferModels_[key]->mixture()) + { + tDmdtf.ref() += dmdtfSign**dmdtfs_[key]; + } + + forAllConstIter + ( + HashPtrTable, + *dmidtfs_[key], + dmidtfIter + ) + { + tDmdtf.ref() += dmdtfSign**dmidtfIter(); + } + } + + return tDmdtf; +} + + template Foam::PtrList Foam::PhaseTransferPhaseSystem::dmdts() const { PtrList dmdts(BasePhaseSystem::dmdts()); - autoPtr sumDmdtsPtr = this->sumDmdts(); + autoPtr totalDmdtfsPtr = this->totalDmdtfs(); + const phaseSystem::dmdtfTable& totalDmdtfs = totalDmdtfsPtr(); - const phaseSystem::dmdtTable& sumDmdts = sumDmdtsPtr(); - - forAllConstIter(phaseSystem::dmdtTable, sumDmdts, sumDmdtIter) + forAllConstIter(phaseSystem::dmdtfTable, totalDmdtfs, totalDmdtfIter) { - const phasePair& pair = this->phasePairs_[sumDmdtIter.key()]; - - addField(pair.phase1(), "dmdt", *sumDmdtIter(), dmdts); - addField(pair.phase2(), "dmdt", - *sumDmdtIter(), dmdts); + const phasePair& pair = this->phasePairs_[totalDmdtfIter.key()]; + addField(pair.phase1(), "dmdt", *totalDmdtfIter(), dmdts); + addField(pair.phase2(), "dmdt", - *totalDmdtfIter(), dmdts); } return dmdts; @@ -291,7 +307,7 @@ Foam::PhaseTransferPhaseSystem::momentumTransfer() phaseSystem::momentumTransferTable& eqns = eqnsPtr(); - this->addDmdtU(sumDmdts(), eqns); + this->addDmdtUfs(totalDmdtfs(), eqns); return eqnsPtr; } @@ -306,7 +322,7 @@ Foam::PhaseTransferPhaseSystem::momentumTransferf() phaseSystem::momentumTransferTable& eqns = eqnsPtr(); - this->addDmdtU(sumDmdts(), eqns); + this->addDmdtUfs(totalDmdtfs(), eqns); return eqnsPtr; } @@ -321,9 +337,8 @@ Foam::PhaseTransferPhaseSystem::heatTransfer() const phaseSystem::heatTransferTable& eqns = eqnsPtr(); - this->addDmdtHe(rDmdt_, eqns); - this->addDmidtHe(specieDmdt_, eqns); - + this->addDmdtHefs(dmdtfs_, eqns); + this->addDmidtHef(dmidtfs_, eqns); return eqnsPtr; } @@ -357,8 +372,8 @@ Foam::PhaseTransferPhaseSystem::specieTransfer() const } } - this->addDmdtY(rDmdt_, eqns); - this->addDmidtY(specieDmdt_, eqns); + this->addDmdtYfs(dmdtfs_, eqns); + this->addDmidtYf(dmidtfs_, eqns); return eqnsPtr; } @@ -369,6 +384,7 @@ void Foam::PhaseTransferPhaseSystem::correct() { BasePhaseSystem::correct(); + // Reset all the mass transfer rates to zero forAllConstIter ( phaseTransferModelTable, @@ -376,25 +392,24 @@ void Foam::PhaseTransferPhaseSystem::correct() phaseTransferModelIter ) { - if (specieDmdt_.found(phaseTransferModelIter.key())) + const phasePair& pair = this->phasePairs_[phaseTransferModelIter.key()]; + + if (phaseTransferModelIter()->mixture()) { - forAllIter - ( - HashPtrTable, - *specieDmdt_(phaseTransferModelIter.key()), - sDmdtIter - ) - { - (*sDmdtIter)->ref() = Zero; - } + *dmdtfs_[pair] = Zero; } - else + + const hashedWordList species(phaseTransferModelIter()->species()); + + forAllConstIter(hashedWordList, species, specieIter) { - *rDmdt_[phaseTransferModelIter.key()] = - dimensionedScalar(dimDensity/dimTime, 0); + const word& specie = *specieIter; + + *(*dmidtfs_[pair])[specie] = Zero; } } + // Evaluate the models and sum the results into the mass transfer tables forAllIter ( phaseTransferModelTable, @@ -402,25 +417,21 @@ void Foam::PhaseTransferPhaseSystem::correct() phaseTransferModelIter ) { - phaseTransferModelIter()->correct(); + const phasePair& pair = this->phasePairs_[phaseTransferModelIter.key()]; - if (specieDmdt_.found(phaseTransferModelIter.key())) + if (phaseTransferModelIter()->mixture()) { - forAllIter - ( - HashPtrTable, - *specieDmdt_(phaseTransferModelIter.key()), - sDmdtIter - ) - { - (*sDmdtIter)->ref() += - phaseTransferModelIter()->speciesDmdt(sDmdtIter.key()); - } + *dmdtfs_[pair] += phaseTransferModelIter()->dmdtf(); } - else + + const HashPtrTable dmidtf + ( + phaseTransferModelIter()->dmidtf() + ); + + forAllConstIter(HashPtrTable, dmidtf, dmidtfIter) { - *rDmdt_[phaseTransferModelIter.key()] += - phaseTransferModelIter()->dmdt(); + *(*dmidtfs_[pair])[dmidtfIter.key()] += *dmidtfIter(); } } } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PhaseTransferPhaseSystem/PhaseTransferPhaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PhaseTransferPhaseSystem/PhaseTransferPhaseSystem.H index a52f0cc489..bb56adb09c 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PhaseTransferPhaseSystem/PhaseTransferPhaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PhaseTransferPhaseSystem/PhaseTransferPhaseSystem.H @@ -76,22 +76,16 @@ private: phaseTransferModelTable phaseTransferModels_; //- Bulk mass transfer rates - phaseSystem::dmdtTable rDmdt_; + phaseSystem::dmdtfTable dmdtfs_; //- Specie mass transfer rates - phaseSystem::dmidtTable specieDmdt_; + phaseSystem::dmidtfTable dmidtfs_; + // Private member functions - //- Add given species to the speciesDmdt for the given pair - virtual void addToSpeciesDmdt - ( - const phasePair& key, - const wordList species - ); - - //- Return the sum of specie transfers across each interface - autoPtr sumDmdts() const; + //- Return the summed mass transfers across each interface + autoPtr totalDmdtfs() const; protected: @@ -99,16 +93,16 @@ protected: // Protected member functions //- Add specie transfer terms which result from bulk mass transfers - void addDmdtY + void addDmdtYfs ( - const phaseSystem::dmdtTable& dmdts, + const phaseSystem::dmdtfTable& dmdtfs, phaseSystem::specieTransferTable& eqns ) const; //- Add specie transfer terms which result from specie mass transfers - void addDmidtY + void addDmidtYf ( - const phaseSystem::dmidtTable& dmidts, + const phaseSystem::dmidtfTable& dmidtfs, phaseSystem::specieTransferTable& eqns ) const; @@ -127,6 +121,9 @@ public: // Member Functions + //- Return the mass transfer rate for an interface + virtual tmp dmdtf(const phasePairKey& key) const; + //- Return the mass transfer rates for each phase virtual PtrList dmdts() const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.C index def72eba9f..278cf75283 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.C @@ -25,27 +25,6 @@ License #include "PopulationBalancePhaseSystem.H" -// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // - -template -Foam::tmp -Foam::PopulationBalancePhaseSystem::pDmdt -( - const phasePairKey& key -) const -{ - if (!pDmdt_.found(key)) - { - const phasePair& pair = this->phasePairs_[key]; - return zeroVolField(pair, "pDmdt", dimDensity/dimTime); - } - - const scalar pDmdtSign(Pair::compare(pDmdt_.find(key).key(), key)); - - return pDmdtSign**pDmdt_[key]; -} - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -60,7 +39,7 @@ PopulationBalancePhaseSystem populationBalances_ ( this->lookup("populationBalances"), - diameterModels::populationBalanceModel::iNew(*this, pDmdt_) + diameterModels::populationBalanceModel::iNew(*this, dmdtfs_) ) { forAll(populationBalances_, i) @@ -88,7 +67,7 @@ PopulationBalancePhaseSystem ); } - pDmdt_.insert + dmdtfs_.insert ( key, new volScalarField @@ -97,7 +76,7 @@ PopulationBalancePhaseSystem ( IOobject::groupName ( - "pDmdt", + "populationBalance:dmdtf", this->phasePairs_[key]->name() ), this->mesh().time().timeName(), @@ -124,16 +103,36 @@ Foam::PopulationBalancePhaseSystem:: // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // +template +Foam::tmp +Foam::PopulationBalancePhaseSystem::dmdtf +( + const phasePairKey& key +) const +{ + tmp tDmdt = BasePhaseSystem::dmdtf(key); + + if (!dmdtfs_.found(key)) + { + const label dmdtSign(Pair::compare(this->phasePairs_[key], key)); + + tDmdt.ref() += dmdtSign**dmdtfs_[key]; + } + + return tDmdt; +} + + template Foam::PtrList Foam::PopulationBalancePhaseSystem::dmdts() const { PtrList dmdts(BasePhaseSystem::dmdts()); - forAllConstIter(phaseSystem::dmdtTable, pDmdt_, pDmdtIter) + forAllConstIter(phaseSystem::dmdtfTable, dmdtfs_, dmdtfIter) { - const phasePair& pair = this->phasePairs_[pDmdtIter.key()]; - const volScalarField& pDmdt = *pDmdtIter(); + const phasePair& pair = this->phasePairs_[dmdtfIter.key()]; + const volScalarField& pDmdt = *dmdtfIter(); addField(pair.phase1(), "dmdt", pDmdt, dmdts); addField(pair.phase2(), "dmdt", - pDmdt, dmdts); @@ -152,7 +151,7 @@ Foam::PopulationBalancePhaseSystem::momentumTransfer() phaseSystem::momentumTransferTable& eqns = eqnsPtr(); - this->addDmdtU(pDmdt_, eqns); + this->addDmdtUfs(dmdtfs_, eqns); return eqnsPtr; } @@ -167,7 +166,7 @@ Foam::PopulationBalancePhaseSystem::momentumTransferf() phaseSystem::momentumTransferTable& eqns = eqnsPtr(); - this->addDmdtU(pDmdt_, eqns); + this->addDmdtUfs(dmdtfs_, eqns); return eqnsPtr; } @@ -182,7 +181,7 @@ Foam::PopulationBalancePhaseSystem::heatTransfer() const phaseSystem::heatTransferTable& eqns = eqnsPtr(); - this->addDmdtHe(pDmdt_, eqns); + this->addDmdtHefs(dmdtfs_, eqns); return eqnsPtr; } @@ -197,7 +196,7 @@ Foam::PopulationBalancePhaseSystem::specieTransfer() const phaseSystem::specieTransferTable& eqns = eqnsPtr(); - this->addDmdtY(pDmdt_, eqns); + this->addDmdtYfs(dmdtfs_, eqns); return eqnsPtr; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.H index 309e304e7a..b5c09de554 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/PopulationBalancePhaseSystem/PopulationBalancePhaseSystem.H @@ -55,21 +55,13 @@ class PopulationBalancePhaseSystem : public BasePhaseSystem { -protected: - - // Protected data + // Private data //- Population balances PtrList populationBalances_; //- Mass transfer rates - phaseSystem::dmdtTable pDmdt_; - - - // Protected member functions - - //- Return the population balance induced mass transfer rate - virtual tmp pDmdt(const phasePairKey& key) const; + phaseSystem::dmdtfTable dmdtfs_; public: @@ -86,6 +78,9 @@ public: // Member Functions + //- Return the mass transfer rate for an interface + virtual tmp dmdtf(const phasePairKey& key) const; + //- Return the mass transfer rates for each phase virtual PtrList dmdts() const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C index 10ffe0b1e6..34c233fef9 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C @@ -32,39 +32,28 @@ License template Foam::tmp -Foam::ThermalPhaseChangePhaseSystem::iDmdt +Foam::ThermalPhaseChangePhaseSystem::totalDmdtf ( const phasePairKey& key ) const { - if (!iDmdt_.found(key)) + tmp tTotalDmdtf = phaseSystem::dmdtf(key); + volScalarField& totalDmdtf = tTotalDmdtf.ref(); + + const scalar tTotalDmdtfSign = + Pair::compare(this->phasePairs_[key], key); + + if (dmdtfs_.found(key)) { - const phasePair& pair = this->phasePairs_[key]; - return zeroVolField(pair, "iDmdt", dimDensity/dimTime); + totalDmdtf += *dmdtfs_[key]; } - const scalar dmdtSign(Pair::compare(iDmdt_.find(key).key(), key)); - - return dmdtSign**iDmdt_[key]; -} - - -template -Foam::tmp -Foam::ThermalPhaseChangePhaseSystem::wDmdt -( - const phasePairKey& key -) const -{ - if (!wDmdt_.found(key)) + if (nDmdtfs_.found(key)) { - const phasePair& pair = this->phasePairs_[key]; - return zeroVolField(pair, "wDmdt", dimDensity/dimTime); + totalDmdtf += *nDmdtfs_[key]; } - const scalar dmdtSign(Pair::compare(wDmdt_.find(key).key(), key)); - - return dmdtSign**wDmdt_[key]; + return tTotalDmdtfSign*tTotalDmdtf; } @@ -85,7 +74,6 @@ ThermalPhaseChangePhaseSystem ), phaseChange_(this->lookup("phaseChange")) { - forAllConstIter ( phaseSystem::phasePairTable, @@ -101,14 +89,18 @@ ThermalPhaseChangePhaseSystem } // Initially assume no mass transfer - iDmdt_.insert + dmdtfs_.insert ( pair, new volScalarField ( IOobject ( - IOobject::groupName("iDmdt", pair.name()), + IOobject::groupName + ( + "thermalPhaseChange:dmdtf", + pair.name() + ), this->mesh().time().timeName(), this->mesh(), IOobject::READ_IF_PRESENT, @@ -120,14 +112,18 @@ ThermalPhaseChangePhaseSystem ); // Initially assume no mass transfer - wDmdt_.insert + nDmdtfs_.insert ( pair, new volScalarField ( IOobject ( - IOobject::groupName("wDmdt", pair.name()), + IOobject::groupName + ( + "thermalPhaseChange:nucleation:dmdtf", + pair.name() + ), this->mesh().time().timeName(), this->mesh(), IOobject::READ_IF_PRESENT, @@ -139,14 +135,18 @@ ThermalPhaseChangePhaseSystem ); // Initially assume no mass transfer - wMDotL_.insert + nDmdtLfs_.insert ( pair, new volScalarField ( IOobject ( - IOobject::groupName("wMDotL", pair.name()), + IOobject::groupName + ( + "thermalPhaseChange:nucleation:dmdtLf", + pair.name() + ), this->mesh().time().timeName(), this->mesh(), IOobject::READ_IF_PRESENT, @@ -178,28 +178,39 @@ Foam::ThermalPhaseChangePhaseSystem::saturation() const } +template +Foam::tmp +Foam::ThermalPhaseChangePhaseSystem::dmdtf +( + const phasePairKey& key +) const +{ + return BasePhaseSystem::dmdtf(key) + this->totalDmdtf(key); +} + + template Foam::PtrList Foam::ThermalPhaseChangePhaseSystem::dmdts() const { PtrList dmdts(BasePhaseSystem::dmdts()); - forAllConstIter(iDmdtTable, iDmdt_, iDmdtIter) + forAllConstIter(phaseSystem::dmdtfTable, dmdtfs_, dmdtfIter) { - const phasePair& pair = this->phasePairs_[iDmdtIter.key()]; - const volScalarField& iDmdt = *iDmdtIter(); + const phasePair& pair = this->phasePairs_[dmdtfIter.key()]; + const volScalarField& dmdtf = *dmdtfIter(); - addField(pair.phase1(), "dmdt", iDmdt, dmdts); - addField(pair.phase2(), "dmdt", - iDmdt, dmdts); + addField(pair.phase1(), "dmdt", dmdtf, dmdts); + addField(pair.phase2(), "dmdt", - dmdtf, dmdts); } - forAllConstIter(wDmdtTable, wDmdt_, wDmdtIter) + forAllConstIter(phaseSystem::dmdtfTable, nDmdtfs_, nDmdtfIter) { - const phasePair& pair = this->phasePairs_[wDmdtIter.key()]; - const volScalarField& wDmdt = *wDmdtIter(); + const phasePair& pair = this->phasePairs_[nDmdtfIter.key()]; + const volScalarField& nDmdtf = *nDmdtfIter(); - addField(pair.phase1(), "dmdt", wDmdt, dmdts); - addField(pair.phase2(), "dmdt", - wDmdt, dmdts); + addField(pair.phase1(), "dmdt", nDmdtf, dmdts); + addField(pair.phase2(), "dmdt", - nDmdtf, dmdts); } return dmdts; @@ -216,8 +227,8 @@ momentumTransfer() phaseSystem::momentumTransferTable& eqns = eqnsPtr(); - this->addDmdtU(iDmdt_, eqns); - this->addDmdtU(wDmdt_, eqns); + this->addDmdtUfs(dmdtfs_, eqns); + this->addDmdtUfs(nDmdtfs_, eqns); return eqnsPtr; } @@ -233,8 +244,8 @@ momentumTransferf() phaseSystem::momentumTransferTable& eqns = eqnsPtr(); - this->addDmdtU(iDmdt_, eqns); - this->addDmdtU(wDmdt_, eqns); + this->addDmdtUfs(dmdtfs_, eqns); + this->addDmdtUfs(nDmdtfs_, eqns); return eqnsPtr; } @@ -302,35 +313,35 @@ Foam::ThermalPhaseChangePhaseSystem::heatTransfer() const const volScalarField K1(phase1.K()); const volScalarField K2(phase2.K()); - const volScalarField dmdt(this->iDmdt(pair) + this->wDmdt(pair)); - const volScalarField dmdt21(posPart(dmdt)); - const volScalarField dmdt12(negPart(dmdt)); + const volScalarField dmdtf(this->totalDmdtf(pair)); + const volScalarField dmdtf21(posPart(dmdtf)); + const volScalarField dmdtf12(negPart(dmdtf)); - *eqns[phase1.name()] += - fvm::Sp(dmdt21, he1) + dmdt21*(K2 - K1); + *eqns[phase1.name()] += - fvm::Sp(dmdtf21, he1) + dmdtf21*(K2 - K1); - *eqns[phase2.name()] -= - fvm::Sp(dmdt12, he2) + dmdt12*(K1 - K2); + *eqns[phase2.name()] -= - fvm::Sp(dmdtf12, he2) + dmdtf12*(K1 - K2); if (this->heatTransferModels_.found(phasePairIter.key())) { const volScalarField& Tf(*this->Tf_[pair]); *eqns[phase1.name()] += - dmdt21*phase1.thermo().he(phase1.thermo().p(), Tf); + dmdtf21*phase1.thermo().he(phase1.thermo().p(), Tf); *eqns[phase2.name()] -= - dmdt12*phase2.thermo().he(phase2.thermo().p(), Tf); + dmdtf12*phase2.thermo().he(phase2.thermo().p(), Tf); } else { - *eqns[phase1.name()] += dmdt21*he2; + *eqns[phase1.name()] += dmdtf21*he2; - *eqns[phase2.name()] -= dmdt12*he1; + *eqns[phase2.name()] -= dmdtf12*he1; } - if (this->wMDotL_.found(phasePairIter.key())) + if (this->nDmdtLfs_.found(phasePairIter.key())) { - *eqns[phase1.name()] += negPart(*this->wMDotL_[pair]); - *eqns[phase2.name()] -= posPart(*this->wMDotL_[pair]); + *eqns[phase1.name()] += negPart(*this->nDmdtLfs_[pair]); + *eqns[phase2.name()] -= posPart(*this->nDmdtLfs_[pair]); if ( @@ -341,13 +352,13 @@ Foam::ThermalPhaseChangePhaseSystem::heatTransfer() const if (phase1.thermo().he().member() == "e") { *eqns[phase1.name()] += - phase1.thermo().p()*dmdt/phase1.thermo().rho(); + phase1.thermo().p()*dmdtf/phase1.thermo().rho(); } if (phase2.thermo().he().member() == "e") { *eqns[phase2.name()] -= - phase2.thermo().p()*dmdt/phase2.thermo().rho(); + phase2.thermo().p()*dmdtf/phase2.thermo().rho(); } } } @@ -413,10 +424,10 @@ Foam::ThermalPhaseChangePhaseSystem::specieTransfer() const // Note that the phase YiEqn does not contain a continuity error // term, so these additions represent the entire mass transfer - const volScalarField dmdt(this->iDmdt(pair) + this->wDmdt(pair)); + const volScalarField dmdtf(this->totalDmdtf(pair)); - *eqns[name] += dmdt; - *eqns[otherName] -= dmdt; + *eqns[name] += dmdtf; + *eqns[otherName] -= dmdtf; } } @@ -454,7 +465,7 @@ Foam::ThermalPhaseChangePhaseSystem::correctInterfaceThermo() const volScalarField& p(phase1.thermo().p()); - volScalarField& iDmdt(*this->iDmdt_[pair]); + volScalarField& dmdtf(*this->dmdtfs_[pair]); volScalarField& Tf(*this->Tf_[pair]); const volScalarField Tsat(saturationModel_->Tsat(phase1.thermo().p())); @@ -488,22 +499,22 @@ Foam::ThermalPhaseChangePhaseSystem::correctInterfaceThermo() volScalarField L ( - (neg0(iDmdt)*hf2 + pos(iDmdt)*h2) - - (pos0(iDmdt)*hf1 + neg(iDmdt)*h1) + (neg0(dmdtf)*hf2 + pos(dmdtf)*h2) + - (pos0(dmdtf)*hf1 + neg(dmdtf)*h1) ); - volScalarField iDmdtNew(iDmdt); + volScalarField dmdtfNew(dmdtf); if (phaseChange_) { volScalarField H1(heatTransferModelIter().first()->K(0)); volScalarField H2(heatTransferModelIter().second()->K(0)); - iDmdtNew = (H1*(Tsat - T1) + H2*(Tsat - T2))/L; + dmdtfNew = (H1*(Tsat - T1) + H2*(Tsat - T2))/L; } else { - iDmdtNew == dimensionedScalar(iDmdt.dimensions(), 0); + dmdtfNew == dimensionedScalar(dmdtf.dimensions(), 0); } volScalarField H1(heatTransferModelIter().first()->K()); @@ -513,7 +524,7 @@ Foam::ThermalPhaseChangePhaseSystem::correctInterfaceThermo() H1.max(small); H2.max(small); - Tf = (H1*T1 + H2*T2 + iDmdtNew*L)/(H1 + H2); + Tf = (H1*T1 + H2*T2 + dmdtfNew*L)/(H1 + H2); Info<< "Tf." << pair.name() << ": min = " << min(Tf.primitiveField()) @@ -521,23 +532,24 @@ Foam::ThermalPhaseChangePhaseSystem::correctInterfaceThermo() << ", max = " << max(Tf.primitiveField()) << endl; - scalar iDmdtRelax(this->mesh().fieldRelaxationFactor("iDmdt")); - iDmdt = (1 - iDmdtRelax)*iDmdt + iDmdtRelax*iDmdtNew; + scalar dmdtfRelax = + this->mesh().fieldRelaxationFactor(dmdtf.member()); + dmdtf = (1 - dmdtfRelax)*dmdtf + dmdtfRelax*dmdtfNew; if (phaseChange_) { - Info<< "iDmdt." << pair.name() - << ": min = " << min(iDmdt.primitiveField()) - << ", mean = " << average(iDmdt.primitiveField()) - << ", max = " << max(iDmdt.primitiveField()) - << ", integral = " << fvc::domainIntegrate(iDmdt).value() + Info<< dmdtf.name() + << ": min = " << min(dmdtf.primitiveField()) + << ", mean = " << average(dmdtf.primitiveField()) + << ", max = " << max(dmdtf.primitiveField()) + << ", integral = " << fvc::domainIntegrate(dmdtf).value() << endl; } - volScalarField& wDmdt(*this->wDmdt_[pair]); - volScalarField& wMDotL(*this->wMDotL_[pair]); - wDmdt = Zero; - wMDotL = Zero; + volScalarField& nDmdtf(*this->nDmdtfs_[pair]); + volScalarField& nDmdtLf(*this->nDmdtLfs_[pair]); + nDmdtf = Zero; + nDmdtLf = Zero; bool wallBoilingActive = false; @@ -550,14 +562,14 @@ Foam::ThermalPhaseChangePhaseSystem::correctInterfaceThermo() ( phase.mesh().foundObject ( - "alphat." + phase.name() + IOobject::groupName("alphat", phase.name()) ) ) { const volScalarField& alphat = phase.mesh().lookupObject ( - "alphat." + phase.name() + IOobject::groupName("alphat", phase.name()) ); const fvPatchList& patches = this->mesh().boundary(); @@ -585,22 +597,21 @@ Foam::ThermalPhaseChangePhaseSystem::correctInterfaceThermo() { wallBoilingActive = true; - const scalarField& patchDmdt = - PCpatch.dmdt(key); - const scalarField& patchMDotL = - PCpatch.mDotL(key); + const scalarField& patchDmdtf = PCpatch.dmdtf(key); + const scalarField& patchDmdtLf = + PCpatch.dmdtLf(key); const scalar sign ( Pair::compare(pair, key) ); - forAll(patchDmdt, facei) + forAll(patchDmdtf, facei) { const label faceCelli = currPatch.faceCells()[facei]; - wDmdt[faceCelli] -= sign*patchDmdt[facei]; - wMDotL[faceCelli] -= sign*patchMDotL[facei]; + nDmdtf[faceCelli] -= sign*patchDmdtf[facei]; + nDmdtLf[faceCelli] -= sign*patchDmdtLf[facei]; } } } @@ -610,11 +621,11 @@ Foam::ThermalPhaseChangePhaseSystem::correctInterfaceThermo() if (wallBoilingActive) { - Info<< "wDmdt." << pair.name() - << ": min = " << min(wDmdt.primitiveField()) - << ", mean = " << average(wDmdt.primitiveField()) - << ", max = " << max(wDmdt.primitiveField()) - << ", integral = " << fvc::domainIntegrate(wDmdt).value() + Info<< nDmdtf.name() + << ": min = " << min(nDmdtf.primitiveField()) + << ", mean = " << average(nDmdtf.primitiveField()) + << ", max = " << max(nDmdtf.primitiveField()) + << ", integral = " << fvc::domainIntegrate(nDmdtf).value() << endl; } } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H index 7ac90030dc..5012767fb7 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.H @@ -55,21 +55,7 @@ class ThermalPhaseChangePhaseSystem : public BasePhaseSystem { -protected: - - // Protected typedefs - - typedef HashPtrTable - iDmdtTable; - - typedef HashPtrTable - wDmdtTable; - - typedef HashPtrTable - wMDotLTable; - - - // Protected data + // Private data //- Name of the volatile specie word volatile_; @@ -80,23 +66,20 @@ protected: // Phase change enabled Switch phaseChange_; - //- Interfacial Mass transfer rate - iDmdtTable iDmdt_; + //- Mass transfer rates + phaseSystem::dmdtfTable dmdtfs_; - //- Boundary Mass transfer rate - wDmdtTable wDmdt_; + //- Nucleate Mass transfer rates + phaseSystem::dmdtfTable nDmdtfs_; - //- Boundary thermal energy transfer rate - wMDotLTable wMDotL_; + //- Nucleate thermal energy transfer rates + phaseSystem::dmdtfTable nDmdtLfs_; - // Protected member functions + // Private member functions - //- Return the interfacial mass transfer rate for a pair - tmp iDmdt(const phasePairKey& key) const; - - //- Return the boundary mass transfer rate for a pair - tmp wDmdt(const phasePairKey& key) const; + //- Return the total mass transfer rate for a pair + tmp totalDmdtf(const phasePairKey& key) const; public: @@ -116,6 +99,9 @@ public: //- Return the saturationModel const saturationModel& saturation() const; + //- Return the mass transfer rate for an interface + virtual tmp dmdtf(const phasePairKey& key) const; + //- Return the mass transfer rates for each phase virtual PtrList dmdts() const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C index 0199baf73e..62351536bb 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C @@ -32,9 +32,9 @@ License // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // template -void Foam::TwoResistanceHeatTransferPhaseSystem::addDmdtHe +void Foam::TwoResistanceHeatTransferPhaseSystem::addDmdtHefs ( - const phaseSystem::dmdtTable& dmdts, + const phaseSystem::dmdtfTable& dmdtfs, phaseSystem::heatTransferTable& eqns ) const { @@ -62,14 +62,14 @@ void Foam::TwoResistanceHeatTransferPhaseSystem::addDmdtHe // latent heat mDot*L terms are added below (as well as other standard // terms representing sensible energy and kinetic energy differences). - forAllConstIter(phaseSystem::dmdtTable, dmdts, dmdtIter) + forAllConstIter(phaseSystem::dmdtfTable, dmdtfs, dmdtfIter) { - const phasePairKey& key = dmdtIter.key(); + const phasePairKey& key = dmdtfIter.key(); const phasePair& pair(this->phasePairs_[key]); - const volScalarField dmdt(Pair::compare(pair, key)**dmdtIter()); - const volScalarField dmdt21(posPart(dmdt)); - const volScalarField dmdt12(negPart(dmdt)); + const volScalarField dmdtf(Pair::compare(pair, key)**dmdtfIter()); + const volScalarField dmdtf21(posPart(dmdtf)); + const volScalarField dmdtf12(negPart(dmdtf)); const phaseModel& phase1 = pair.phase1(); const phaseModel& phase2 = pair.phase2(); @@ -94,20 +94,20 @@ void Foam::TwoResistanceHeatTransferPhaseSystem::addDmdtHe const volScalarField& Tf(*Tf_[key]); const volScalarField hef1(thermo1.he(thermo1.p(), Tf)); const volScalarField hef2(thermo2.he(thermo2.p(), Tf)); - *eqns[phase1.name()] += dmdt*hef1 - fvm::Sp(dmdt, he1); - *eqns[phase2.name()] -= dmdt*hef2 - fvm::Sp(dmdt, he2); + *eqns[phase1.name()] += dmdtf*hef1 - fvm::Sp(dmdtf, he1); + *eqns[phase2.name()] -= dmdtf*hef2 - fvm::Sp(dmdtf, he2); // Latent heat contribution const volScalarField L(hef2 + thermo2.hc() - hef1 - thermo1.hc()); const volScalarField H1(heatTransferModels_[key].first()->K()); const volScalarField H2(heatTransferModels_[key].second()->K()); const volScalarField H1Fac(H1/(H1 + H2)); - *eqns[phase1.name()] += H1Fac*dmdt*L; - *eqns[phase2.name()] += (1 - H1Fac)*dmdt*L; + *eqns[phase1.name()] += H1Fac*dmdtf*L; + *eqns[phase2.name()] += (1 - H1Fac)*dmdtf*L; // Transfer of kinetic energy - *eqns[phase1.name()] += dmdt21*(K2 - K1); - *eqns[phase2.name()] -= dmdt12*(K1 - K2); + *eqns[phase1.name()] += dmdtf21*(K2 - K1); + *eqns[phase2.name()] -= dmdtf12*(K1 - K2); } else { @@ -116,29 +116,29 @@ void Foam::TwoResistanceHeatTransferPhaseSystem::addDmdtHe // change and therefore no interface state or latent heat... // Transfer of energy from bulk to bulk - *eqns[phase1.name()] += dmdt21*he2 - fvm::Sp(dmdt21, he1); - *eqns[phase2.name()] -= dmdt12*he1 - fvm::Sp(dmdt12, he2); + *eqns[phase1.name()] += dmdtf21*he2 - fvm::Sp(dmdtf21, he1); + *eqns[phase2.name()] -= dmdtf12*he1 - fvm::Sp(dmdtf12, he2); // Transfer of kinetic energy - *eqns[phase1.name()] += dmdt21*(K2 - K1); - *eqns[phase2.name()] -= dmdt12*(K1 - K2); + *eqns[phase1.name()] += dmdtf21*(K2 - K1); + *eqns[phase2.name()] -= dmdtf12*(K1 - K2); } } } template -void Foam::TwoResistanceHeatTransferPhaseSystem::addDmidtHe +void Foam::TwoResistanceHeatTransferPhaseSystem::addDmidtHef ( - const phaseSystem::dmidtTable& dmidts, + const phaseSystem::dmidtfTable& dmidtfs, phaseSystem::heatTransferTable& eqns ) const { // See the addDmdtHe method for a description of the latent heat terms - forAllConstIter(phaseSystem::dmidtTable, dmidts, dmidtIter) + forAllConstIter(phaseSystem::dmidtfTable, dmidtfs, dmidtfIter) { - const phasePairKey& key = dmidtIter.key(); + const phasePairKey& key = dmidtfIter.key(); const phasePair& pair(this->phasePairs_[key]); const phaseModel& phase1 = pair.phase1(); @@ -176,18 +176,18 @@ void Foam::TwoResistanceHeatTransferPhaseSystem::addDmidtHe forAllConstIter ( HashPtrTable, - *dmidtIter(), - dmidtJter + *dmidtfIter(), + dmidtfJter ) { - const word& member = dmidtJter.key(); + const word& member = dmidtfJter.key(); - const volScalarField dmidt + const volScalarField dmidtf ( - Pair::compare(pair, key)**dmidtJter() + Pair::compare(pair, key)**dmidtfJter() ); - const volScalarField dmidt21(posPart(dmidt)); - const volScalarField dmidt12(negPart(dmidt)); + const volScalarField dmidtf21(posPart(dmidtf)); + const volScalarField dmidtf12(negPart(dmidtf)); // Create the interface energies for the transferring specie volScalarField hefi1(hef1), hci1(hc1); @@ -233,16 +233,16 @@ void Foam::TwoResistanceHeatTransferPhaseSystem::addDmidtHe const volScalarField Li(hefi2 + hci2 - hefi1 - hci1); // Transfer of energy from the interface into the bulk - *eqns[phase1.name()] += dmidt*hefi1 - fvm::Sp(dmidt, he1); - *eqns[phase2.name()] -= dmidt*hefi2 - fvm::Sp(dmidt, he2); + *eqns[phase1.name()] += dmidtf*hefi1 - fvm::Sp(dmidtf, he1); + *eqns[phase2.name()] -= dmidtf*hefi2 - fvm::Sp(dmidtf, he2); // Latent heat contribution - *eqns[phase1.name()] += H1Fac*dmidt*Li; - *eqns[phase2.name()] += (1 - H1Fac)*dmidt*Li; + *eqns[phase1.name()] += H1Fac*dmidtf*Li; + *eqns[phase2.name()] += (1 - H1Fac)*dmidtf*Li; // Transfer of kinetic energy - *eqns[phase1.name()] += dmidt21*(K2 - K1); - *eqns[phase2.name()] -= dmidt12*(K1 - K2); + *eqns[phase1.name()] += dmidtf21*(K2 - K1); + *eqns[phase2.name()] -= dmidtf12*(K1 - K2); } } else @@ -255,18 +255,18 @@ void Foam::TwoResistanceHeatTransferPhaseSystem::addDmidtHe forAllConstIter ( HashPtrTable, - *dmidtIter(), - dmidtJter + *dmidtfIter(), + dmidtfJter ) { - const word& member = dmidtJter.key(); + const word& member = dmidtfJter.key(); - const volScalarField dmidt + const volScalarField dmidtf ( - Pair::compare(pair, key)**dmidtJter() + Pair::compare(pair, key)**dmidtfJter() ); - const volScalarField dmidt21(posPart(dmidt)); - const volScalarField dmidt12(negPart(dmidt)); + const volScalarField dmidtf21(posPart(dmidtf)); + const volScalarField dmidtf12(negPart(dmidtf)); // Create the energies for the transferring specie volScalarField hei1(he1); @@ -297,12 +297,12 @@ void Foam::TwoResistanceHeatTransferPhaseSystem::addDmidtHe } // Transfer of energy from bulk to bulk - *eqns[phase1.name()] += dmidt21*hei2 - fvm::Sp(dmidt21, he1); - *eqns[phase2.name()] -= dmidt12*hei1 - fvm::Sp(dmidt12, he2); + *eqns[phase1.name()] += dmidtf21*hei2 - fvm::Sp(dmidtf21, he1); + *eqns[phase2.name()] -= dmidtf12*hei1 - fvm::Sp(dmidtf12, he2); // Transfer of kinetic energy - *eqns[phase1.name()] += dmidt21*(K2 - K1); - *eqns[phase2.name()] -= dmidt12*(K1 - K2); + *eqns[phase1.name()] += dmidtf21*(K2 - K1); + *eqns[phase2.name()] -= dmidtf12*(K1 - K2); } } } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.H index 0859fbe6a3..260ec346b6 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/PhaseSystems/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.H @@ -90,16 +90,16 @@ protected: // Protected Member Functions //- Add energy transfer terms which result from bulk mass transfers - void addDmdtHe + void addDmdtHefs ( - const phaseSystem::dmdtTable& dmdts, + const phaseSystem::dmdtfTable& dmdtfs, phaseSystem::heatTransferTable& eqns ) const; //- Add energy transfer terms which result from specie mass transfers - void addDmidtHe + void addDmidtHef ( - const phaseSystem::dmidtTable& dmidts, + const phaseSystem::dmidtfTable& dmidtfs, phaseSystem::heatTransferTable& eqns ) const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C index 3af67b5681..7c6e9c3683 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/StationaryPhaseModel/StationaryPhaseModel.C @@ -83,7 +83,12 @@ template Foam::tmp Foam::StationaryPhaseModel::U() const { - return zeroVolField(*this, "U", dimVelocity); + return volVectorField::New + ( + IOobject::groupName("U", this->name()), + this->mesh(), + dimensionedVector(dimVelocity, Zero) + ); } @@ -103,7 +108,12 @@ template Foam::tmp Foam::StationaryPhaseModel::phi() const { - return zeroSurfaceField(*this, "phi", dimVolume/dimTime); + return surfaceScalarField::New + ( + IOobject::groupName("phi", this->name()), + this->mesh(), + dimensionedScalar(dimVolume/dimTime, 0) + ); } @@ -123,7 +133,12 @@ template Foam::tmp Foam::StationaryPhaseModel::alphaPhi() const { - return zeroSurfaceField(*this, "alphaPhi", dimVolume/dimTime); + return surfaceScalarField::New + ( + IOobject::groupName("alphaPhi", this->name()), + this->mesh(), + dimensionedScalar(dimVolume/dimTime, 0) + ); } @@ -143,7 +158,12 @@ template Foam::tmp Foam::StationaryPhaseModel::alphaRhoPhi() const { - return zeroSurfaceField(*this, "alphaRhoPhi", dimMass/dimTime); + return surfaceScalarField::New + ( + IOobject::groupName("alphaRhoPhi", this->name()), + this->mesh(), + dimensionedScalar(dimMass/dimTime, 0) + ); } @@ -163,7 +183,12 @@ template Foam::tmp Foam::StationaryPhaseModel::DUDt() const { - return zeroVolField(*this, "DUDt", dimVelocity/dimTime); + return volVectorField::New + ( + IOobject::groupName("DUDt", this->name()), + this->mesh(), + dimensionedVector(dimVelocity/dimTime, Zero) + ); } @@ -171,7 +196,12 @@ template Foam::tmp Foam::StationaryPhaseModel::DUDtf() const { - return zeroSurfaceField(*this, "DUDtf", dimVolume/sqr(dimTime)); + return surfaceScalarField::New + ( + IOobject::groupName("DUDtf", this->name()), + this->mesh(), + dimensionedScalar(dimVolume/sqr(dimTime), 0) + ); } @@ -179,7 +209,12 @@ template Foam::tmp Foam::StationaryPhaseModel::continuityError() const { - return zeroVolField(*this, "contErr", dimDensity/dimTime); + return volScalarField::New + ( + IOobject::groupName("continuityError", this->name()), + this->mesh(), + dimensionedScalar(dimDensity/dimTime, 0) + ); } @@ -187,7 +222,12 @@ template Foam::tmp Foam::StationaryPhaseModel::continuityErrorFlow() const { - return zeroVolField(*this, "contErrFlow", dimDensity/dimTime); + return volScalarField::New + ( + IOobject::groupName("continuityErrorFlow", this->name()), + this->mesh(), + dimensionedScalar(dimDensity/dimTime, 0) + ); } @@ -195,7 +235,12 @@ template Foam::tmp Foam::StationaryPhaseModel::continuityErrorSources() const { - return zeroVolField(*this, "contErrSources", dimDensity/dimTime); + return volScalarField::New + ( + IOobject::groupName("continuityErrorSources", this->name()), + this->mesh(), + dimensionedScalar(dimDensity/dimTime, 0) + ); } @@ -203,7 +248,12 @@ template Foam::tmp Foam::StationaryPhaseModel::K() const { - return zeroVolField(*this, "K", sqr(dimVelocity)); + return volScalarField::New + ( + IOobject::groupName("K", this->name()), + this->mesh(), + dimensionedScalar(sqr(dimVelocity), 0) + ); } @@ -231,7 +281,12 @@ template Foam::tmp Foam::StationaryPhaseModel::mut() const { - return zeroVolField(*this, "mut", dimDynamicViscosity); + return volScalarField::New + ( + IOobject::groupName("mut", this->name()), + this->mesh(), + dimensionedScalar(dimDynamicViscosity, 0) + ); } @@ -247,7 +302,12 @@ template Foam::tmp Foam::StationaryPhaseModel::nut() const { - return zeroVolField(*this, "nut", dimViscosity); + return volScalarField::New + ( + IOobject::groupName("nut", this->name()), + this->mesh(), + dimensionedScalar(dimViscosity, 0) + ); } @@ -295,7 +355,12 @@ template Foam::tmp Foam::StationaryPhaseModel::k() const { - return zeroVolField(*this, "k", sqr(dimVelocity)); + return volScalarField::New + ( + IOobject::groupName("k", this->name()), + this->mesh(), + dimensionedScalar(sqr(dimVelocity), 0) + ); } @@ -303,7 +368,12 @@ template Foam::tmp Foam::StationaryPhaseModel::pPrime() const { - return zeroVolField(*this, "pPrime", dimPressure); + return volScalarField::New + ( + IOobject::groupName("pPrime", this->name()), + this->mesh(), + dimensionedScalar(dimPressure, 0) + ); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H index fc7eb204a4..77db9e7b88 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.H @@ -222,12 +222,6 @@ public: // Thermo - //- Return whether the phase is isothermal - virtual bool isothermal() const = 0; - - //- Return the enthalpy equation - virtual tmp heEqn() = 0; - //- Return the thermophysical model virtual const rhoThermo& thermo() const = 0; @@ -237,6 +231,12 @@ public: //- Return the density field virtual tmp rho() const = 0; + //- Return whether the phase is isothermal + virtual bool isothermal() const = 0; + + //- Return the enthalpy equation + virtual tmp heEqn() = 0; + // Species diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C index 538b8379cc..75d385bad4 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.C @@ -302,7 +302,7 @@ Foam::phaseSystem::E(const phasePairKey& key) const return volScalarField::New ( aspectRatioModel::typeName + ":E", - this->mesh_, + mesh_, dimensionedScalar(dimless, 1) ); } @@ -321,7 +321,7 @@ Foam::phaseSystem::sigma(const phasePairKey& key) const return volScalarField::New ( surfaceTensionModel::typeName + ":sigma", - this->mesh_, + mesh_, dimensionedScalar(surfaceTensionModel::dimSigma, 0) ); } @@ -339,17 +339,36 @@ Foam::phaseSystem::sigma(const phasePairKey& key, label patchi) const { return tmp ( - new scalarField(this->mesh_.boundary()[patchi].size(), 0) + new scalarField(mesh_.boundary()[patchi].size(), 0) ); } } +Foam::tmp Foam::phaseSystem::dmdtf +( + const phasePairKey& key +) const +{ + const phasePair pair + ( + phaseModels_[key.first()], + phaseModels_[key.second()] + ); + + return volScalarField::New + ( + IOobject::groupName("dmdtf", pair.name()), + mesh(), + dimensionedScalar(dimDensity/dimTime, 0) + ); +} + + + Foam::PtrList Foam::phaseSystem::dmdts() const { - PtrList dmdts(this->phaseModels_.size()); - - return dmdts; + return PtrList(phaseModels_.size()); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H index da7c2ad354..4d0bf343fb 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystem.H @@ -89,7 +89,7 @@ public: typedef HashPtrTable - dmdtTable; + dmdtfTable; typedef HashPtrTable @@ -98,7 +98,7 @@ public: phasePairKey, phasePairKey::hash > - dmidtTable; + dmidtfTable; @@ -415,6 +415,9 @@ public: label patchi ) const; + //- Return the mass transfer rate for an interface + virtual tmp dmdtf(const phasePairKey& key) const; + //- Return the mass transfer rates for each phase virtual PtrList dmdts() const; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C index 9eab046fe0..960259490c 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseSystem/phaseSystemTemplates.C @@ -444,40 +444,6 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -template -inline tmp> zeroVolField -( - const Group& group, - const word& name, - const dimensionSet& dims -) -{ - return GeometricField::New - ( - IOobject::groupName(name, group.name()), - group.mesh(), - dimensioned(dims, pTraits::zero) - ); -} - - -template -inline tmp> zeroSurfaceField -( - const Group& group, - const word& name, - const dimensionSet& dims -) -{ - return GeometricField::New - ( - IOobject::groupName(name, group.name()), - group.mesh(), - dimensioned(dims, pTraits::zero) - ); -} - - template inline void addField ( diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/driftModels/phaseChange/phaseChange.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/driftModels/phaseChange/phaseChange.C index 550a4cac9c..7efce10bbe 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/driftModels/phaseChange/phaseChange.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/driftModels/phaseChange/phaseChange.C @@ -55,8 +55,8 @@ Foam::diameterModels::driftModels::phaseChange::phaseChange pairKeys_(dict.lookup("pairs")), numberWeighted_(dict.lookupOrDefault("numberWeighted", false)), W_(pairKeys_.size()), - specieName_(dict.lookupOrDefault("specie", word())), - dmdtName_(specieName_ == word::null ? "iDmdt" : specieName_+":dmdt") + dmdtfName_(dict.lookup("dmdtf")), + specieName_(dict.lookupOrDefault("specie", word())) { const phaseSystem& fluid = popBal_.fluid(); @@ -144,20 +144,28 @@ void Foam::diameterModels::driftModels::phaseChange::addToDriftRate if (pair.contains(vg.phase())) { - const volScalarField& iDmdt = + const volScalarField& dmidtf = popBal_.mesh().lookupObject ( - IOobject::groupName(dmdtName_, pair.name()) + IOobject::groupName + ( + IOobject::groupName + ( + dmdtfName_, + specieName_ + ), + pair.name() + ) ); - const scalar dmdtSign = + const scalar dmidtfSign = vg.phase().name() == pair.first() ? +1 : -1; const sizeGroup& fi = popBal_.sizeGroups()[i]; tmp dDriftRate ( - dmdtSign*iDmdt/(fi.phase().rho()*W_[k]) + dmidtfSign*dmidtf/(fi.phase().rho()*W_[k]) ); if (!numberWeighted_) diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/driftModels/phaseChange/phaseChange.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/driftModels/phaseChange/phaseChange.H index 6a8ad7f879..fdf27d4925 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/driftModels/phaseChange/phaseChange.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/driftModels/phaseChange/phaseChange.H @@ -64,17 +64,17 @@ class phaseChange //- Distribute phase change mass flux between sizeGroups based on the // number concentration, rather than the interfacial area - Switch numberWeighted_; + const Switch numberWeighted_; //- Weighting with which the phase change mass flux is distributed PtrList W_; + //- Name of the mass transfer rate + const word dmdtfName_; + //- Name of the specie which changes phase, empty by default const word specieName_; - //- The name of the relevant dmdt term for lookup - const word dmdtName_; - public: diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/reactionDriven/reactionDriven.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/reactionDriven/reactionDriven.C index 7ae9458901..5c89c687d2 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/reactionDriven/reactionDriven.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/reactionDriven/reactionDriven.C @@ -91,18 +91,8 @@ reactionDriven phasePair(velGroup_.phase(), reactingPhase_) ] ), - specie_(dict.lookup("specie")), - nDmdt_ - ( - IOobject - ( - IOobject::groupName(type() + ":N", pair_.name()), - popBal.time().timeName(), - popBal.mesh() - ), - popBal.mesh(), - dimensionedScalar(dimDensity/dimTime, Zero) - ) + dmdtfName_(dict.lookup("dmdtf")), + specieName_(dict.lookup("specie")) { if ( @@ -121,20 +111,6 @@ reactionDriven // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::diameterModels::nucleationModels::reactionDriven::correct() -{ - const volScalarField& speciesDmdt = - popBal_.mesh().lookupObject - ( - IOobject::groupName(specie_+":dmdt", pair_.name()) - ); - - const scalar sign = velGroup_.phase().name() == pair_.first() ? +1 : -1; - - nDmdt_ = sign*speciesDmdt; -} - - void Foam::diameterModels::nucleationModels::reactionDriven::addToNucleationRate ( @@ -145,8 +121,25 @@ Foam::diameterModels::nucleationModels::reactionDriven::addToNucleationRate const sizeGroup& fi = popBal_.sizeGroups()[i]; const volScalarField& rho = fi.phase().rho(); + const volScalarField& dmidtf = + popBal_.mesh().lookupObject + ( + IOobject::groupName + ( + IOobject::groupName + ( + dmdtfName_, + specieName_ + ), + pair_.name() + ) + ); + + const scalar dmidtfSign = + velGroup_.phase().name() == pair_.first() ? +1 : -1; + nucleationRate += - popBal_.eta(i, pi/6.0*pow3(dNuc_))*nDmdt_/rho/fi.x(); + popBal_.eta(i, pi/6.0*pow3(dNuc_))*dmidtfSign*dmidtf/rho/fi.x(); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/reactionDriven/reactionDriven.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/reactionDriven/reactionDriven.H index 6de281e7ed..d4fb880820 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/reactionDriven/reactionDriven.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/reactionDriven/reactionDriven.H @@ -58,7 +58,7 @@ class reactionDriven // Private Data //- Sphere-equivalent nucleation diameter - dimensionedScalar dNuc_; + const dimensionedScalar dNuc_; //- Velocity group in which the nucleation occurs const velocityGroup& velGroup_; @@ -67,13 +67,13 @@ class reactionDriven const phaseModel& reactingPhase_; //- PhasePair between which the nucleation occurs - phasePair pair_; + const phasePair pair_; - //- Names of the specie which nucleates - word specie_; + //- Name of the mass transfer rate + const word dmdtfName_; - //- Nucleation mass transfer rate - volScalarField nDmdt_; + //- Name of the specie which nucleates + const word specieName_; public: @@ -97,9 +97,6 @@ public: // Member Functions - //- Correct diameter independent expressions - virtual void correct(); - //- Add to nucleationRate virtual void addToNucleationRate ( diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/wallBoiling/wallBoiling.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/wallBoiling/wallBoiling.C index 7b1e910f74..e0ee89e8d4 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/wallBoiling/wallBoiling.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/populationBalanceModel/nucleationModels/wallBoiling/wallBoiling.C @@ -169,7 +169,7 @@ Foam::diameterModels::nucleationModels::wallBoiling::addToNucleationRate const alphatWallBoilingWallFunction& alphatw = refCast(alphatBf[patchi]); - const scalarField& dmdt = alphatw.dmdt(); + const scalarField& dmdt = alphatw.dmdtf(); const scalarField& dDep = alphatw.dDeparture(); const labelList& faceCells = alphatw.patch().faceCells(); diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C index 983ff0a30e..2b73e2f4e0 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATE.C @@ -106,6 +106,7 @@ Foam::tmp Foam::diameterModels::IATE::dsm() const return max(6/max(kappai_, 6/dMax_), dMin_); } + void Foam::diameterModels::IATE::correct() { volScalarField alphaAv diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.C index e364b98757..6c83200426 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,8 +55,9 @@ Foam::diameterModels::IATEsources::phaseChange::phaseChange ) : IATEsource(iate), - pairName_(dict.lookup("pairName")), - iDmdtPtr_(nullptr) + otherPhaseName_(dict.lookup("otherPhase")), + dmdtfName_(dict.lookup("dmdtf")), + specieName_(dict.lookupOrDefault("specie", word::null)) {} @@ -69,23 +70,26 @@ Foam::diameterModels::IATEsources::phaseChange::R volScalarField& kappai ) const { - if (!iDmdtPtr_) - { - iDmdtPtr_ = &alphai.mesh().lookupObject + const phasePair& pair = + phase().fluid().phasePairs() + [ + phasePairKey(phase().name(), otherPhaseName_) + ]; + + const volScalarField& dmdtf = + alphai.mesh().lookupObject ( - IOobject::groupName("iDmdt", pairName_) + IOobject::groupName + ( + IOobject::groupName(dmdtfName_, specieName_), + pair.name() + ) ); - } - const volScalarField& iDmdt = *iDmdtPtr_; + const label dmdtfSign = + phase().name() == pair.first() ? +1 : -1; - return -fvm::SuSp - ( - (1.0/3.0) - *iDmdt() - /(alphai()*phase().rho()()), - kappai - ); + return -fvm::SuSp(dmdtfSign*dmdtf/(3*alphai*phase().rho()), kappai); } diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.H b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.H index ad810011f2..e11c2ed68d 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.H +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/phaseChange/phaseChange.H @@ -56,11 +56,15 @@ class phaseChange { // Private Data - //- Phase pair name - word pairName_; + //- Name of the other phase + const word otherPhaseName_; + + //- Name of the interfacial mass transfer rate + const word dmdtfName_; + + //- Name of the specie which is transferring (optional) + const word specieName_; - //- Pointer to the corresponding iDmdt field - mutable const volScalarField* iDmdtPtr_; public: diff --git a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wallBoiling/wallBoiling.C b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wallBoiling/wallBoiling.C index 31e8dfbe75..fb79d14264 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wallBoiling/wallBoiling.C +++ b/applications/solvers/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/diameterModels/IATE/IATEsources/wallBoiling/wallBoiling.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -117,7 +117,7 @@ Foam::diameterModels::IATEsources::wallBoiling::R const alphatWallBoilingWallFunction& alphatw = refCast(alphatBf[patchi]); - const scalarField& dmdt = alphatw.dmdt(); + const scalarField& dmdt = alphatw.dmdtf(); const scalarField& dDep = alphatw.dDeparture(); const labelList& faceCells = alphatw.patch().faceCells(); diff --git a/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/phaseProperties b/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/phaseProperties index d5ad02d24f..d124ef07cc 100644 --- a/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/phaseProperties +++ b/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/constant/phaseProperties @@ -135,10 +135,13 @@ populationBalanceCoeffs ( phaseChange { - pairs ( (gas and liquid) (gas2 and liquid) ); + pairs ((gas and liquid) (gas2 and liquid)); + dmdtf thermalPhaseChange:dmdtf; } - densityChange{} + densityChange + { + } ); nucleationModels diff --git a/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/system/fvSolution b/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/system/fvSolution index 8f1069bbcd..817bb0a940 100644 --- a/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/system/fvSolution +++ b/tutorials/multiphase/reactingMultiphaseEulerFoam/RAS/wallBoilingPolydisperseTwoGroups/system/fvSolution @@ -108,7 +108,7 @@ relaxationFactors { fields { - iDmdt 0.8; + thermalPhaseChange:dmdtf 0.8; } equations diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/0/alphat.gas b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/0/alphat.gas index 9cf16067b1..752dbb8ddd 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/0/alphat.gas +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/0/alphat.gas @@ -33,7 +33,7 @@ boundaryField } wall { - type compressible::alphatPhaseChangeJayatillekeWallFunction; + type compressible::alphatPhaseJayatillekeWallFunction; Prt 0.85; Cmu 0.09; kappa 0.41; diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/0/alphat.liquid b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/0/alphat.liquid index 0fda68cdc5..b18305ec60 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/0/alphat.liquid +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/0/alphat.liquid @@ -33,7 +33,7 @@ boundaryField } wall { - type compressible::alphatPhaseChangeJayatillekeWallFunction; + type compressible::alphatPhaseJayatillekeWallFunction; Prt 0.85; Cmu 0.09; kappa 0.41; diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/system/fvSolution b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/system/fvSolution index fe685a9a9a..a623924ed7 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/system/fvSolution +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/bubblePipe/system/fvSolution @@ -81,7 +81,7 @@ relaxationFactors { fields { - iDmdt 1.0; + thermalPhaseChange:dmdtf 1.0; } equations diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/0/alphat.liquid b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/0/alphat.liquid index ebaa96d84d..14471b6c13 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/0/alphat.liquid +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/0/alphat.liquid @@ -39,7 +39,6 @@ boundaryField kappa 0.41; E 9.8; relax 0.2; - dmdt uniform 0; otherPhase gas; phaseType liquid; partitioningModel diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/system/fvSolution b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/system/fvSolution index 7e788884f7..4518f06c1b 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/system/fvSolution +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoiling/system/fvSolution @@ -108,7 +108,7 @@ relaxationFactors { fields { - iDmdt 1.0; + thermalPhaseChange:dmdtf 1.0; } equations diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/0/alphat.liquid b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/0/alphat.liquid index ebaa96d84d..14471b6c13 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/0/alphat.liquid +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/0/alphat.liquid @@ -39,7 +39,6 @@ boundaryField kappa 0.41; E 9.8; relax 0.2; - dmdt uniform 0; otherPhase gas; phaseType liquid; partitioningModel diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/phaseProperties b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/phaseProperties index 428ec116e2..f8d7f7f9c7 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/phaseProperties +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/constant/phaseProperties @@ -54,7 +54,8 @@ gas phaseChange { - pairName gasAndLiquid; + otherPhase liquid; + dmdtf thermalPhaseChange:dmdtf; } wallBoiling diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/system/fvSolution b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/system/fvSolution index 3e657af2cf..09d42ad38f 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/system/fvSolution +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingIATE/system/fvSolution @@ -118,7 +118,7 @@ relaxationFactors { fields { - iDmdt 0.8; + thermalPhaseChange:dmdtf 1.0; } equations diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/0/alphat.liquid b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/0/alphat.liquid index ebaa96d84d..14471b6c13 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/0/alphat.liquid +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/0/alphat.liquid @@ -39,7 +39,6 @@ boundaryField kappa 0.41; E 9.8; relax 0.2; - dmdt uniform 0; otherPhase gas; phaseType liquid; partitioningModel diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/phaseProperties b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/phaseProperties index 0be384ee38..cad1f4674d 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/phaseProperties +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/constant/phaseProperties @@ -111,10 +111,13 @@ populationBalanceCoeffs ( phaseChange { - pairs ( (gas and liquid) ); + pairs ((gas and liquid)); + dmdtf thermalPhaseChange:dmdtf; } - densityChange{} + densityChange + { + } ); nucleationModels diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/system/fvSolution b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/system/fvSolution index 8f1069bbcd..35b9d74a5a 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/system/fvSolution +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/RAS/wallBoilingPolydisperse/system/fvSolution @@ -108,7 +108,7 @@ relaxationFactors { fields { - iDmdt 0.8; + thermalPhaseChange:dmdtf 1.0; } equations diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/system/fvSolution b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/system/fvSolution index 4e76f88020..f4af8853b5 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/system/fvSolution +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/steamInjection/system/fvSolution @@ -89,7 +89,7 @@ relaxationFactors { fields { - iDmdt 1; + thermalPhaseChange:dmdtf 1.0; } equations diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/titaniaSynthesis/constant/phaseProperties b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/titaniaSynthesis/constant/phaseProperties index c3210be77a..7bf181ecce 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/titaniaSynthesis/constant/phaseProperties +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/titaniaSynthesis/constant/phaseProperties @@ -123,6 +123,7 @@ populationBalanceCoeffs nucleationDiameter 4E-10; velocityGroup particles; reactingPhase vapor; + dmdtf phaseTransfer:dmidtf; specie TiO2; } ); diff --git a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/titaniaSynthesisSurface/constant/phaseProperties b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/titaniaSynthesisSurface/constant/phaseProperties index bfc5f2c9d6..40261898a1 100644 --- a/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/titaniaSynthesisSurface/constant/phaseProperties +++ b/tutorials/multiphase/reactingTwoPhaseEulerFoam/laminar/titaniaSynthesisSurface/constant/phaseProperties @@ -123,9 +123,10 @@ populationBalanceCoeffs ( phaseChange { - pairs ( (particles and vapor) ); - specie TiO2_s; - surfaceGrowthType ParkRogak; + pairs ((particles and vapor)); + dmdtf phaseTransfer:dmidtf; + specie TiO2_s; + surfaceGrowthType ParkRogak; } ); @@ -136,6 +137,7 @@ populationBalanceCoeffs nucleationDiameter 4E-10; velocityGroup particles; reactingPhase vapor; + dmdtf phaseTransfer:dmidtf; specie TiO2; } );