From ec7afd8386789ed0caab52e2430c88fd00a4348d Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Fri, 13 Jan 2023 12:13:38 +0000 Subject: [PATCH] alphatPhaseChangeWallFunctions: Clean up The fixedDmdt phase change boundary condition has been removed as this is not a physical model and was only ever needed for testing. The phase change wall function interface has been simplified and made a mix-in, rather than a derivation from a fixed value patch field. This reduces forwarding and mapping code and permits wall functions to derive from patch fields other than fixed value. Minor style and consisteny improvements have been made to the wall boiling wall function. --- .../Make/files | 3 +- ...allBoilingWallFunctionFvPatchScalarField.C | 145 --- ...allBoilingWallFunctionFvPatchScalarField.H | 154 ---- ...haseChangeWallFunctionFvPatchScalarField.C | 216 ----- ...haseChangeWallFunctionFvPatchScalarField.H | 169 ---- .../alphatPhaseChangeWallFunctionBase.C | 125 +++ .../alphatPhaseChangeWallFunctionBase.H | 116 +++ ...allBoilingWallFunctionFvPatchScalarField.C | 854 +++++++++--------- ...allBoilingWallFunctionFvPatchScalarField.H | 104 ++- .../ThermalPhaseChangePhaseSystem.C | 61 +- 10 files changed, 745 insertions(+), 1202 deletions(-) delete mode 100644 applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C delete mode 100644 applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H delete mode 100644 applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C delete mode 100644 applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H create mode 100644 applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunctionBase/alphatPhaseChangeWallFunctionBase.C create mode 100644 applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunctionBase/alphatPhaseChangeWallFunctionBase.H diff --git a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/Make/files b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/Make/files index c717dd57f9..01bf80bb84 100644 --- a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/Make/files +++ b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/Make/files @@ -20,8 +20,7 @@ derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/departureFreq derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/Cole/Cole.C derivedFvPatchFields/wallBoilingSubModels/departureFrequencyModels/KocamustafaogullariIshiiDepartureFrequency/KocamustafaogullariIshiiDepartureFrequency.C -derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C -derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C +derivedFvPatchFields/alphatPhaseChangeWallFunctionBase/alphatPhaseChangeWallFunctionBase.C derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C derivedFvPatchFields/fixedMultiphaseHeatFlux/fixedMultiphaseHeatFluxFvPatchScalarField.C derivedFvPatchFields/coupledMultiphaseTemperature/coupledMultiphaseTemperatureFvPatchScalarField.C diff --git a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C deleted file mode 100644 index 6f0e5c874a..0000000000 --- a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C +++ /dev/null @@ -1,145 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2023 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 "alphatJayatillekeWallFunctionFvPatchScalarField.H" -#include "fluidThermophysicalTransportModel.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) -{} - - -alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: -alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF, dict), - fixedDmdtf_(dict.lookupOrDefault("fixedDmdtf", 0)) -{} - - -alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: -alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField -( - const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& psf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - alphatPhaseChangeWallFunctionFvPatchScalarField(psf, p, iF, mapper), - fixedDmdtf_(psf.fixedDmdtf_) -{} - - -alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField:: -alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField -( - const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& psf, - const DimensionedField& iF -) -: - alphatPhaseChangeWallFunctionFvPatchScalarField(psf, iF), - fixedDmdtf_(psf.fixedDmdtf_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() -{ - if (updated()) - { - return; - } - - dmdtf_ = (1 - relax_)*dmdtf_ + relax_*fixedDmdtf_; - - operator== - ( - alphatJayatillekeWallFunctionFvPatchScalarField::alphat - ( - db().lookupType - ( - internalField().group() - ), - 0.85, - patch().index() - ) - ); - - fixedValueFvPatchScalarField::updateCoeffs(); -} - - -void alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField::write -( - Ostream& os -) const -{ - alphatPhaseChangeWallFunctionFvPatchScalarField::write(os); - - writeEntry(os, "fixedDmdtf", fixedDmdtf_); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -makePatchTypeField -( - fvPatchScalarField, - alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField -); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H deleted file mode 100644 index a767237b44..0000000000 --- a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatFixedDmdtfWallBoilingWallFunction/alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.H +++ /dev/null @@ -1,154 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2022 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::compressible:: - alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField - -Description - A simple alphatPhaseChangeWallFunctionFvPatchScalarField with - a fixed volumetric phase-change mass flux. - -See also - Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField - -SourceFiles - alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField_H -#define alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField_H - -#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ - -/*---------------------------------------------------------------------------*\ - Class alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField -: - public alphatPhaseChangeWallFunctionFvPatchScalarField -{ - // Private Data - - //- Volumetric phase-change mass flux in near wall cells - scalar fixedDmdtf_; - - -public: - - //- Runtime type information - TypeName("compressible::alphatFixedDmdtfWallBoilingWallFunction"); - - - // Constructors - - //- Construct from patch and internal field - alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField - // onto a new patch - alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField - ( - const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Disallow copy without setting internal field reference - alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField - ( - const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField& - ) = delete; - - //- Copy constructor setting internal field reference - alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField - ( - const alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField&, - const DimensionedField& - ); - - //- Construct and return a clone setting internal field reference - virtual tmp clone - ( - const DimensionedField& iF - ) const - { - return tmp - ( - new alphatFixedDmdtfWallBoilingWallFunctionFvPatchScalarField - ( - *this, - iF - ) - ); - } - - - // Member Functions - - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs(); - - - // I-O - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C deleted file mode 100644 index 2b282f76ef..0000000000 --- a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.C +++ /dev/null @@ -1,216 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2023 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 "alphatPhaseChangeWallFunctionFvPatchScalarField.H" -#include "fvPatchFieldMapper.H" -#include "volFields.H" -#include "phaseInterface.H" -#include "phaseSystem.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ -namespace compressible -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -defineTypeNameAndDebug(alphatPhaseChangeWallFunctionFvPatchScalarField, 0); - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -alphatPhaseChangeWallFunctionFvPatchScalarField:: -alphatPhaseChangeWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF -) -: - fixedValueFvPatchScalarField(p, iF), - otherPhaseName_(word::null), - relax_(1), - dmdtf_(p.size(), 0) -{} - - -alphatPhaseChangeWallFunctionFvPatchScalarField:: -alphatPhaseChangeWallFunctionFvPatchScalarField -( - const fvPatch& p, - const DimensionedField& iF, - const dictionary& dict -) -: - fixedValueFvPatchScalarField(p, iF, dict), - otherPhaseName_(dict.lookup("otherPhase")), - relax_(dict.lookupOrDefault("relax", 1)), - dmdtf_(p.size(), 0) -{ - // 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 or vice versa" << nl - << "This phase: " << internalField().group() << nl - << "otherPhase: " << otherPhaseName_ - << abort(FatalError); - } - - if (dict.found("dmdtf")) - { - dmdtf_ = scalarField("dmdtf", dict, p.size()); - } -} - - -alphatPhaseChangeWallFunctionFvPatchScalarField:: -alphatPhaseChangeWallFunctionFvPatchScalarField -( - const alphatPhaseChangeWallFunctionFvPatchScalarField& ptf, - const fvPatch& p, - const DimensionedField& iF, - const fvPatchFieldMapper& mapper -) -: - fixedValueFvPatchScalarField(ptf, p, iF, mapper), - otherPhaseName_(ptf.otherPhaseName_), - relax_(ptf.relax_), - dmdtf_(mapper(ptf.dmdtf_)) -{} - - -alphatPhaseChangeWallFunctionFvPatchScalarField:: -alphatPhaseChangeWallFunctionFvPatchScalarField -( - const alphatPhaseChangeWallFunctionFvPatchScalarField& awfpsf, - const DimensionedField& iF -) -: - fixedValueFvPatchScalarField(awfpsf, iF), - otherPhaseName_(awfpsf.otherPhaseName_), - relax_(awfpsf.relax_), - dmdtf_(awfpsf.dmdtf_) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -bool alphatPhaseChangeWallFunctionFvPatchScalarField::activeInterface -( - const phaseInterface& interface -) const -{ - const phaseSystem& fluid = interface.fluid(); - - return - interface.contains(fluid.phases()[internalField().group()]) - && interface.contains(fluid.phases()[otherPhaseName_]); -} - - -const scalarField& -alphatPhaseChangeWallFunctionFvPatchScalarField::dmdtf() const -{ - return dmdtf_; -} - - -const scalarField& alphatPhaseChangeWallFunctionFvPatchScalarField::dmdtf -( - const phaseInterface& interface -) const -{ - if (!activeInterface(interface)) - { - FatalErrorInFunction - << "Phase change mass transfer rate requested for interface on " - << "which there is no phase change " - << abort(FatalError); - } - - return dmdtf_; -} - - -void alphatPhaseChangeWallFunctionFvPatchScalarField::autoMap -( - const fvPatchFieldMapper& m -) -{ - fixedValueFvPatchScalarField::autoMap(m); - - m(dmdtf_, dmdtf_); -} - - -void alphatPhaseChangeWallFunctionFvPatchScalarField::rmap -( - const fvPatchScalarField& ptf, - const labelList& addr -) -{ - fixedValueFvPatchScalarField::rmap(ptf, addr); - - const alphatPhaseChangeWallFunctionFvPatchScalarField& tiptf = - refCast(ptf); - - dmdtf_.rmap(tiptf.dmdtf_, addr); -} - - -void alphatPhaseChangeWallFunctionFvPatchScalarField::reset -( - const fvPatchScalarField& ptf -) -{ - fixedValueFvPatchScalarField::reset(ptf); - - const alphatPhaseChangeWallFunctionFvPatchScalarField& tiptf = - refCast(ptf); - - dmdtf_.reset(tiptf.dmdtf_); -} - - -void alphatPhaseChangeWallFunctionFvPatchScalarField::write(Ostream& os) const -{ - fixedValueFvPatchScalarField::write(os); - - writeEntry(os, "otherPhase", otherPhaseName_); - writeEntry(os, "relax", relax_); - writeEntry(os, "dmdtf", dmdtf_); -} - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - -// ************************************************************************* // diff --git a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H deleted file mode 100644 index 03ed219f14..0000000000 --- a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunction/alphatPhaseChangeWallFunctionFvPatchScalarField.H +++ /dev/null @@ -1,169 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software: you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM. If not, see . - -Class - Foam::compressible::alphatPhaseChangeWallFunctionFvPatchScalarField - -Description - Abstract base-class for all alphatWallFunctions supporting phase-change. - -SourceFiles - alphatPhaseChangeWallFunctionFvPatchScalarField.C - -\*---------------------------------------------------------------------------*/ - -#ifndef alphatPhaseChangeWallFunctionFvPatchScalarField_H -#define alphatPhaseChangeWallFunctionFvPatchScalarField_H - -#include "fixedValueFvPatchFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -class phaseInterface; - -namespace compressible -{ - -/*---------------------------------------------------------------------------*\ - Class alphatPhaseChangeWallFunctionFvPatchScalarField Declaration -\*---------------------------------------------------------------------------*/ - -class alphatPhaseChangeWallFunctionFvPatchScalarField -: - public fixedValueFvPatchScalarField -{ -protected: - - // Protected data - - //- Name of the other phase - const word otherPhaseName_; - - //- Relaxation factor - const scalar relax_; - - //- Rate of phase-change - scalarField dmdtf_; - - -public: - - //- Runtime type information - TypeName("compressible::alphatPhaseChangeWallFunction"); - - - // Constructors - - //- Construct from patch and internal field - alphatPhaseChangeWallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField& - ); - - //- Construct from patch, internal field and dictionary - alphatPhaseChangeWallFunctionFvPatchScalarField - ( - const fvPatch&, - const DimensionedField&, - const dictionary& - ); - - //- Construct by mapping given - // alphatPhaseChangeWallFunctionFvPatchScalarField - // onto a new patch - alphatPhaseChangeWallFunctionFvPatchScalarField - ( - const alphatPhaseChangeWallFunctionFvPatchScalarField&, - const fvPatch&, - const DimensionedField&, - const fvPatchFieldMapper& - ); - - //- Disallow copy without setting internal field reference - alphatPhaseChangeWallFunctionFvPatchScalarField - ( - const alphatPhaseChangeWallFunctionFvPatchScalarField& - ) = delete; - - //- Copy constructor setting internal field reference - alphatPhaseChangeWallFunctionFvPatchScalarField - ( - const alphatPhaseChangeWallFunctionFvPatchScalarField&, - const DimensionedField& - ); - - - // Member Functions - - //- Is there phase change mass transfer for this interface? - bool activeInterface(const phaseInterface&) const; - - //- Return the rate of phase-change - const scalarField& dmdtf() const; - - //- Return the rate of phase-change for an interface - const scalarField& dmdtf(const phaseInterface&) const; - - - // Mapping functions - - //- Map (and resize as needed) from self given a mapping object - // Used to update fields following mesh topology change - virtual void autoMap(const fvPatchFieldMapper&); - - //- Reverse map the given fvPatchField onto this fvPatchField - // Used to reconstruct fields - virtual void rmap(const fvPatchScalarField&, const labelList&); - - //- Reset the fvPatchField to the given fvPatchField - // Used for mesh to mesh mapping - virtual void reset(const fvPatchScalarField&); - - - // Evaluation functions - - //- Update the coefficients associated with the patch field - virtual void updateCoeffs() = 0; - - - // I-O - - //- Write - virtual void write(Ostream&) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace compressible -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunctionBase/alphatPhaseChangeWallFunctionBase.C b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunctionBase/alphatPhaseChangeWallFunctionBase.C new file mode 100644 index 0000000000..fb0ce53a43 --- /dev/null +++ b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunctionBase/alphatPhaseChangeWallFunctionBase.C @@ -0,0 +1,125 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2023 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 "alphatPhaseChangeWallFunctionBase.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "phaseInterface.H" +#include "phaseSystem.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace compressible +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(alphatPhaseChangeWallFunctionBase, 0); + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +alphatPhaseChangeWallFunctionBase::alphatPhaseChangeWallFunctionBase() +: + phaseName_(word::null), + otherPhaseName_(word::null) +{} + + +alphatPhaseChangeWallFunctionBase::alphatPhaseChangeWallFunctionBase +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + phaseName_(iF.group()), + otherPhaseName_(dict.lookup("otherPhase")) +{ + if (phaseName_== otherPhaseName_) + { + FatalErrorInFunction + << "otherPhase should be the name of the vapor phase that " + << "corresponds to the liquid base or vice versa" << nl + << "This phase: " << phaseName_ << nl + << "otherPhase: " << otherPhaseName_ + << abort(FatalError); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +alphatPhaseChangeWallFunctionBase::~alphatPhaseChangeWallFunctionBase() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool alphatPhaseChangeWallFunctionBase::activeInterface +( + const phaseInterface& interface +) const +{ + const phaseSystem& fluid = interface.fluid(); + + return + interface.contains(fluid.phases()[phaseName_]) + && interface.contains(fluid.phases()[otherPhaseName_]); +} + + +const scalarField& alphatPhaseChangeWallFunctionBase::dmdtf +( + const phaseInterface& interface +) const +{ + if (!activeInterface(interface)) + { + FatalErrorInFunction + << "Phase change mass transfer rate requested for interface on " + << "which there is no phase change " + << abort(FatalError); + } + + return dmdtf(); +} + + +void alphatPhaseChangeWallFunctionBase::write(Ostream& os) const +{ + writeEntry(os, "otherPhase", otherPhaseName_); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// ************************************************************************* // diff --git a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunctionBase/alphatPhaseChangeWallFunctionBase.H b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunctionBase/alphatPhaseChangeWallFunctionBase.H new file mode 100644 index 0000000000..c0beeaf51f --- /dev/null +++ b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatPhaseChangeWallFunctionBase/alphatPhaseChangeWallFunctionBase.H @@ -0,0 +1,116 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2015-2023 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::compressible::alphatPhaseChangeWallFunctionBase + +Description + Abstract base-class for all alphatWallFunctions supporting phase-change. + +SourceFiles + alphatPhaseChangeWallFunctionBase.C + +\*---------------------------------------------------------------------------*/ + +#ifndef alphatPhaseChangeWallFunctionBase_H +#define alphatPhaseChangeWallFunctionBase_H + +#include "fvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class phaseInterface; + +namespace compressible +{ + +/*---------------------------------------------------------------------------*\ + Class alphatPhaseChangeWallFunctionBase Declaration +\*---------------------------------------------------------------------------*/ + +class alphatPhaseChangeWallFunctionBase +{ +protected: + + // Protected data + + //- Name of the phase + const word phaseName_; + + //- Name of the other phase + const word otherPhaseName_; + + +public: + + //- Runtime type information + TypeName("compressible::alphatPhaseChangeWallFunctionBase"); + + + // Constructors + + //- Construct null + alphatPhaseChangeWallFunctionBase(); + + //- Construct from a patch, an internal field and a dictionary + alphatPhaseChangeWallFunctionBase + ( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& + ); + + + // Destructor + virtual ~alphatPhaseChangeWallFunctionBase(); + + + // Member Functions + + //- Is there phase change mass transfer for this interface? + bool activeInterface(const phaseInterface&) const; + + //- Return the rate of phase-change + virtual const scalarField& dmdtf() const = 0; + + //- Return the rate of phase-change for the given interface + const scalarField& dmdtf(const phaseInterface&) const; + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C index 0617f73704..c5b982092e 100644 --- a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +++ b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -72,31 +72,28 @@ alphatWallBoilingWallFunctionFvPatchScalarField const DimensionedField& iF ) : - alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF), + fixedValueFvPatchScalarField(p, iF), + alphatPhaseChangeWallFunctionBase(), + phaseType_(liquidPhase), useLiquidTemperatureWallFunction_(true), + relax_(1), Prt_(0.85), - AbyV_(p.size(), 0), - alphatConv_(p.size(), 0), + tau_(0.8), + + partitioningModel_(nullptr), + nucleationSiteModel_(nullptr), + departureDiameterModel_(nullptr), + departureFrequencyModel_(nullptr), + + fLiquid_(p.size(), 0), dDep_(p.size(), 1e-5), fDep_(p.size(), 0), N_(p.size(), 0), - fLiquid_(p.size(), 0), qq_(p.size(), 0), qe_(p.size(), 0), - tau_(0.8), - partitioningModel_(nullptr), - nucleationSiteModel_(nullptr), - departureDiamModel_(nullptr), - departureFreqModel_(nullptr) -{ - AbyV_ = this->patch().magSf(); - forAll(AbyV_, facei) - { - const label faceCelli = this->patch().faceCells()[facei]; - AbyV_[facei] /= iF.mesh().V()[faceCelli]; - } -} + dmdtf_(p.size(), 0) +{} alphatWallBoilingWallFunctionFvPatchScalarField:: @@ -107,122 +104,89 @@ alphatWallBoilingWallFunctionFvPatchScalarField const dictionary& dict ) : - alphatPhaseChangeWallFunctionFvPatchScalarField(p, iF, dict), + fixedValueFvPatchScalarField(p, iF, dict), + alphatPhaseChangeWallFunctionBase(p, iF, dict), + phaseType_(phaseTypeNames_.read(dict.lookup("phaseType"))), useLiquidTemperatureWallFunction_ ( dict.lookupOrDefault("useLiquidTemperatureWallFunction", true) ), + relax_(dict.lookupOrDefault("relax", 1)), Prt_(dict.lookupOrDefault("Prt", 0.85)), - AbyV_(p.size(), 0), - alphatConv_(p.size(), 0), + tau_(dict.lookupOrDefault("bubbleWaitingTimeRatio", 0.8)), + + partitioningModel_(nullptr), + nucleationSiteModel_(nullptr), + departureDiameterModel_(nullptr), + departureFrequencyModel_(nullptr), + + fLiquid_(p.size(), 0), dDep_(p.size(), 1e-5), fDep_(p.size(), 0), N_(p.size(), 0), - fLiquid_(p.size(), 0), qq_(p.size(), 0), qe_(p.size(), 0), - tau_(dict.lookupOrDefault("bubbleWaitingTimeRatio", 0.8)), - partitioningModel_(nullptr), - nucleationSiteModel_(nullptr), - departureDiamModel_(nullptr), - departureFreqModel_(nullptr) + dmdtf_(p.size(), 0) { - // Check that otherPhaseName != this phase - if (internalField().group() == otherPhaseName_) + // Sub-Models + partitioningModel_ = + wallBoilingModels::partitioningModel::New + ( + dict.subDict("partitioningModel") + ); + + if (phaseType_ == liquidPhase) { - 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); + nucleationSiteModel_ = + wallBoilingModels::nucleationSiteModel::New + ( + dict.subDict("nucleationSiteModel") + ); + departureDiameterModel_ = + wallBoilingModels::departureDiameterModel::New + ( + dict.subDict("departureDiamModel") + ); + departureFrequencyModel_ = + wallBoilingModels::departureFrequencyModel::New + ( + dict.subDict("departureFreqModel") + ); } - switch (phaseType_) + // State + if (dict.found("wallLiquidFraction")) { - case vaporPhase: + fLiquid_ = scalarField("wallLiquidFraction", dict, p.size()); + } + + if (phaseType_ == liquidPhase) + { + if (dict.found("dDeparture")) { - partitioningModel_ = - wallBoilingModels::partitioningModel::New - ( - dict.subDict("partitioningModel") - ); - - dmdtf_ = 0; - - break; + dDep_ = scalarField("dDeparture", dict, p.size()); } - case liquidPhase: + if (dict.found("depFrequency")) { - partitioningModel_ = - wallBoilingModels::partitioningModel::New - ( - dict.subDict("partitioningModel") - ); - - nucleationSiteModel_ = - wallBoilingModels::nucleationSiteModel::New - ( - dict.subDict("nucleationSiteModel") - ); - - departureDiamModel_ = - wallBoilingModels::departureDiameterModel::New - ( - dict.subDict("departureDiamModel") - ); - - departureFreqModel_ = - wallBoilingModels::departureFrequencyModel::New - ( - dict.subDict("departureFreqModel") - ); - - if (dict.found("dDeparture")) - { - dDep_ = scalarField("dDeparture", dict, p.size()); - } - - if (dict.found("depFrequency")) - { - fDep_ = scalarField("depFrequency", dict, p.size()); - } - - if (dict.found("nucSiteDensity")) - { - N_ = scalarField("nucSiteDensity", dict, p.size()); - } - - if (dict.found("wallLiquidFraction")) - { - fLiquid_ = scalarField("wallLiquidFraction", dict, p.size()); - } - - if (dict.found("qQuenching")) - { - qq_ = scalarField("qQuenching", dict, p.size()); - } - - if (dict.found("qEvaporation")) - { - qq_ = scalarField("qEvaporation", dict, p.size()); - } - - break; + fDep_ = scalarField("depFrequency", dict, p.size()); + } + if (dict.found("nucSiteDensity")) + { + N_ = scalarField("nucSiteDensity", dict, p.size()); + } + if (dict.found("qQuenching")) + { + qq_ = scalarField("qQuenching", dict, p.size()); + } + if (dict.found("qEvaporation")) + { + qe_ = scalarField("qEvaporation", dict, p.size()); + } + if (dict.found("dmdtf")) + { + dmdtf_ = scalarField("dmdtf", dict, p.size()); } - } - - if (dict.found("alphatConv")) - { - alphatConv_ = scalarField("alphatConv", dict, p.size()); - } - - AbyV_ = this->patch().magSf(); - forAll(AbyV_, facei) - { - const label faceCelli = this->patch().faceCells()[facei]; - AbyV_[facei] /= iF.mesh().V()[faceCelli]; } } @@ -236,23 +200,27 @@ alphatWallBoilingWallFunctionFvPatchScalarField const fvPatchFieldMapper& mapper ) : - alphatPhaseChangeWallFunctionFvPatchScalarField(psf, p, iF, mapper), + fixedValueFvPatchScalarField(psf, p, iF, mapper), + alphatPhaseChangeWallFunctionBase(psf), + phaseType_(psf.phaseType_), useLiquidTemperatureWallFunction_(psf.useLiquidTemperatureWallFunction_), + relax_(psf.relax_), Prt_(psf.Prt_), - AbyV_(mapper(psf.AbyV_)), - alphatConv_(mapper(psf.alphatConv_)), + tau_(psf.tau_), + + partitioningModel_(psf.partitioningModel_, false), + nucleationSiteModel_(psf.nucleationSiteModel_, false), + departureDiameterModel_(psf.departureDiameterModel_, false), + departureFrequencyModel_(psf.departureFrequencyModel_, false), + + fLiquid_(mapper(psf.fLiquid_)), dDep_(mapper(psf.dDep_)), fDep_(mapper(psf.fDep_)), N_(mapper(psf.N_)), - fLiquid_(mapper(psf.fLiquid_)), qq_(mapper(psf.qq_)), qe_(mapper(psf.qe_)), - tau_(psf.tau_), - partitioningModel_(psf.partitioningModel_, false), - nucleationSiteModel_(psf.nucleationSiteModel_, false), - departureDiamModel_(psf.departureDiamModel_, false), - departureFreqModel_(psf.departureFreqModel_, false) + dmdtf_(mapper(psf.dmdtf_)) {} @@ -263,23 +231,27 @@ alphatWallBoilingWallFunctionFvPatchScalarField const DimensionedField& iF ) : - alphatPhaseChangeWallFunctionFvPatchScalarField(psf, iF), + fixedValueFvPatchScalarField(psf, iF), + alphatPhaseChangeWallFunctionBase(psf), + phaseType_(psf.phaseType_), useLiquidTemperatureWallFunction_(psf.useLiquidTemperatureWallFunction_), + relax_(psf.relax_), Prt_(psf.Prt_), - AbyV_(psf.AbyV_), - alphatConv_(psf.alphatConv_), + tau_(psf.tau_), + + partitioningModel_(psf.partitioningModel_, false), + nucleationSiteModel_(psf.nucleationSiteModel_, false), + departureDiameterModel_(psf.departureDiameterModel_, false), + departureFrequencyModel_(psf.departureFrequencyModel_, false), + + fLiquid_(psf.fLiquid_), dDep_(psf.dDep_), fDep_(psf.fDep_), N_(psf.N_), - fLiquid_(psf.fLiquid_), qq_(psf.qq_), qe_(psf.qe_), - tau_(psf.tau_), - partitioningModel_(psf.partitioningModel_, false), - nucleationSiteModel_(psf.nucleationSiteModel_, false), - departureDiamModel_(psf.departureDiamModel_, false), - departureFreqModel_(psf.departureFreqModel_, false) + dmdtf_(psf.dmdtf_) {} @@ -290,16 +262,15 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::autoMap const fvPatchFieldMapper& m ) { - alphatPhaseChangeWallFunctionFvPatchScalarField::autoMap(m); + fixedValueFvPatchScalarField::autoMap(m); - m(AbyV_, AbyV_); - m(alphatConv_, alphatConv_); + m(fLiquid_, fLiquid_); m(dDep_, dDep_); m(fDep_, fDep_); m(N_, N_); - m(fLiquid_, fLiquid_); m(qq_, qq_); m(qe_, qe_); + m(dmdtf_, dmdtf_); } @@ -309,19 +280,18 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::rmap const labelList& addr ) { - alphatPhaseChangeWallFunctionFvPatchScalarField::rmap(ptf, addr); + fixedValueFvPatchScalarField::rmap(ptf, addr); const alphatWallBoilingWallFunctionFvPatchScalarField& tiptf = refCast(ptf); - AbyV_.rmap(tiptf.AbyV_, addr); - alphatConv_.rmap(tiptf.alphatConv_, addr); + fLiquid_.rmap(tiptf.fLiquid_, addr); dDep_.rmap(tiptf.dDep_, addr); fDep_.rmap(tiptf.fDep_, addr); N_.rmap(tiptf.N_, addr); - fLiquid_.rmap(tiptf.fLiquid_, addr); qq_.rmap(tiptf.qq_, addr); qe_.rmap(tiptf.qe_, addr); + dmdtf_.rmap(tiptf.dmdtf_, addr); } @@ -330,19 +300,18 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::reset const fvPatchScalarField& ptf ) { - alphatPhaseChangeWallFunctionFvPatchScalarField::reset(ptf); + fixedValueFvPatchScalarField::reset(ptf); const alphatWallBoilingWallFunctionFvPatchScalarField& tiptf = refCast(ptf); - AbyV_.reset(tiptf.AbyV_); - alphatConv_.reset(tiptf.alphatConv_); + fLiquid_.reset(tiptf.fLiquid_); dDep_.reset(tiptf.dDep_); fDep_.reset(tiptf.fDep_); N_.reset(tiptf.N_); - fLiquid_.reset(tiptf.fLiquid_); qq_.reset(tiptf.qq_); qe_.reset(tiptf.qe_); + dmdtf_.reset(tiptf.dmdtf_); } @@ -399,8 +368,10 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() alphatConv*(vaporw/(1 - liquidw + small) ) *(1 - fLiquid_)/max(vaporw, scalar(1e-8)) ); + break; } + case liquidPhase: { const phaseModel& liquid = fluid.phases()[internalField().group()]; @@ -408,173 +379,187 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() const phaseInterface interface(vapor, liquid); + // Liquid thermophysical and momentum transport models + const fluidThermophysicalTransportModel& liquidTtm = + db().lookupType + ( + liquid.name() + ); + const compressibleMomentumTransportModel& liquidMtm = + liquidTtm.momentumTransport(); + + // Convective thermal diffusivity + const scalarField alphatConv + ( + alphatJayatillekeWallFunctionFvPatchScalarField::alphat + ( + liquidTtm, + Prt_, + patch().index() + ) + ); + + // Quit if no saturation temperature model exists for this + // interface. Saturation modelling is considered to be the + // fundamental enabling model for thermal mass transfers. if ( - fluid.foundInterfacialModel + !fluid.foundInterfacialModel < interfaceSaturationTemperatureModel > (interface) ) { - // Liquid thermophysical and momentum transport models - const fluidThermophysicalTransportModel& liquidTtm = - db().lookupType - ( - liquid.name() - ); - const compressibleMomentumTransportModel& liquidMtm = - liquidTtm.momentumTransport(); + Info<< "Saturation model for interface " << interface.name() + << " not found. Wall boiling disabled." << endl; - const nutWallFunctionFvPatchScalarField& nutw = - nutWallFunctionFvPatchScalarField::nutw(liquidMtm, patchi); + operator==(alphatConv); - const scalar Cmu25(pow025(nutw.Cmu())); + break; + } - const scalarField& y = liquidMtm.y()[patchi]; + // Lookup and calculate turbulent and thermal properties + const nutWallFunctionFvPatchScalarField& nutw = + nutWallFunctionFvPatchScalarField::nutw(liquidMtm, patchi); - const tmp tnuw = liquidMtm.nu(patchi); - const scalarField& nuw = tnuw(); + const scalar Cmu25(pow025(nutw.Cmu())); - const tmp talphaw + const scalarField& y = liquidMtm.y()[patchi]; + + const tmp tnuw = liquidMtm.nu(patchi); + const scalarField& nuw = tnuw(); + + const tmp talphaw + ( + liquid.thermo().kappa().boundaryField()[patchi] + /liquid.thermo().Cp().boundaryField()[patchi] + ); + const scalarField& alphaw = talphaw(); + + const tmp tk = liquidMtm.k(); + const volScalarField& k = tk(); + const fvPatchScalarField& kw = k.boundaryField()[patchi]; + + const fvPatchVectorField& Uw = + liquidMtm.U().boundaryField()[patchi]; + const scalarField magUp(mag(Uw.patchInternalField() - Uw)); + const scalarField magGradUw(mag(Uw.snGrad())); + + const tmp trhoLiquidw = liquid.thermo().rho(patchi); + const scalarField rhoLiquidw = trhoLiquidw(); + + const tmp trhoVaporw = vapor.thermo().rho(patchi); + const scalarField rhoVaporw = trhoVaporw(); + + const fvPatchScalarField& hew = + liquid.thermo().he().boundaryField()[patchi]; + + const fvPatchScalarField& Tw = + liquid.thermo().T().boundaryField()[patchi]; + + const scalarField Tc(Tw.patchInternalField()); + + const scalarField uTau(Cmu25*sqrt(kw)); + + const scalarField yPlus(uTau*y/nuw); + + const scalarField Pr(rhoLiquidw*nuw/alphaw); + + // Molecular-to-turbulent Prandtl number ratio + const scalarField Prat(Pr/Prt_); + + // Thermal sublayer thickness + const scalarField P + ( + alphatJayatillekeWallFunctionFvPatchScalarField::P(Prat) + ); + const scalarField yPlusTherm + ( + alphatJayatillekeWallFunctionFvPatchScalarField::yPlusTherm ( - liquid.thermo().kappa().boundaryField()[patchi] - /liquid.thermo().Cp().boundaryField()[patchi] - ); - const scalarField& alphaw = talphaw(); + nutw, + P, + Prat + ) + ); - const tmp tk = liquidMtm.k(); - const volScalarField& k = tk(); - const fvPatchScalarField& kw = k.boundaryField()[patchi]; + const scalarField Cpw(liquid.thermo().Cp(Tw, patchi)); - const fvPatchVectorField& Uw = - liquidMtm.U().boundaryField()[patchi]; - const scalarField magUp(mag(Uw.patchInternalField() - Uw)); - const scalarField magGradUw(mag(Uw.snGrad())); + // Saturation temperature + const interfaceSaturationTemperatureModel& satModel = + fluid.lookupInterfacialModel + < + interfaceSaturationTemperatureModel + >(interface); + const tmp tTsat = + satModel.Tsat(liquid.thermo().p()); + const volScalarField& Tsat = tTsat(); + const fvPatchScalarField& Tsatw(Tsat.boundaryField()[patchi]); - const tmp trhoLiquidw = - liquid.thermo().rho(patchi); - const scalarField rhoLiquidw = trhoLiquidw(); - - const tmp trhoVaporw = - vapor.thermo().rho(patchi); - const scalarField rhoVaporw = trhoVaporw(); - - const fvPatchScalarField& hew = - liquid.thermo().he().boundaryField()[patchi]; - - const fvPatchScalarField& Tw = - liquid.thermo().T().boundaryField()[patchi]; - - const scalarField Tc(Tw.patchInternalField()); - - const scalarField uTau(Cmu25*sqrt(kw)); - - const scalarField yPlus(uTau*y/nuw); - - const scalarField Pr(rhoLiquidw*nuw/alphaw); - - // Molecular-to-turbulent Prandtl number ratio - const scalarField Prat(Pr/Prt_); - - // Thermal sublayer thickness - const scalarField P + // Latent heat + const scalarField L + ( + volatileSpecie != "none" + ? -refCast(fluid) + .Li + ( + interface, + volatileSpecie, + dmdtf_, + Tsat, + patch().faceCells(), + heatTransferPhaseSystem::latentHeatScheme::upwind + ) + : -refCast(fluid) + .L ( - alphatJayatillekeWallFunctionFvPatchScalarField::P(Prat) - ); - const scalarField yPlusTherm - ( - alphatJayatillekeWallFunctionFvPatchScalarField::yPlusTherm - ( - nutw, - P, - Prat - ) - ); + interface, + dmdtf_, + Tsat, + patch().faceCells(), + heatTransferPhaseSystem::latentHeatScheme::upwind + ) + ); - const scalarField Cpw(liquid.thermo().Cp(Tw, patchi)); + // Liquid phase fraction at the wall + const scalarField liquidw(liquid.boundaryField()[patchi]); - // Saturation temperature - const interfaceSaturationTemperatureModel& satModel = - fluid.lookupInterfacialModel - < - interfaceSaturationTemperatureModel - >(interface); - const tmp tTsat = - satModel.Tsat(liquid.thermo().p()); - const volScalarField& Tsat = tTsat(); - const fvPatchScalarField& Tsatw(Tsat.boundaryField()[patchi]); + // Partitioning + fLiquid_ = partitioningModel_->fLiquid(liquidw); - // Latent heat - const scalarField L - ( - volatileSpecie != "none" - ? -refCast(fluid) - .Li - ( - interface, - volatileSpecie, - dmdtf_, - Tsat, - patch().faceCells(), - heatTransferPhaseSystem::latentHeatScheme::upwind - ) - : -refCast(fluid) - .L - ( - interface, - dmdtf_, - Tsat, - patch().faceCells(), - heatTransferPhaseSystem::latentHeatScheme::upwind - ) - ); + // Iterative solution for the wall temperature + label maxIter(10); + for (label i=0; ifLiquid(liquidw); - - // Convective thermal diffusivity - alphatConv_ = - alphatJayatillekeWallFunctionFvPatchScalarField::alphat - ( - liquidTtm, - Prt_, - patch().index() - ); - - label maxIter(10); - for (label i=0; idDeparture + // Bubble departure diameter + dDep_ = + departureDiameterModel_->dDeparture ( liquid, vapor, @@ -584,136 +569,128 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() L ); - // Bubble departure frequency: - fDep_ = - departureFreqModel_->fDeparture - ( - liquid, - vapor, - patchi, - Tl, - Tsatw, - L, - dDep_ - ); - - // Nucleation site density: - N_ = - nucleationSiteModel_->N - ( - liquid, - vapor, - patchi, - Tl, - Tsatw, - L, - dDep_, - fDep_ - ); - - // Area fractions: - - // Del Valle & Kenning (1985) - const scalarField Ja + // Bubble departure frequency + fDep_ = + departureFrequencyModel_->fDeparture ( - rhoLiquidw*Cpw*(Tsatw - Tl)/(rhoVaporw*L) + liquid, + vapor, + patchi, + Tl, + Tsatw, + L, + dDep_ ); - const scalarField Al + // Nucleation site density + N_ = + nucleationSiteModel_->N ( - fLiquid_*4.8*exp(min(-Ja/80, log(vGreat))) + liquid, + vapor, + patchi, + Tl, + Tsatw, + L, + dDep_, + fDep_ ); - scalarField A2(min(pi*sqr(dDep_)*N_*Al/4, scalar(1))); - const scalarField A1(max(1 - A2, scalar(1e-4))); - scalarField A2E(min(pi*sqr(dDep_)*N_*Al/4, scalar(5))); + // Del Valle & Kenning (1985) + const scalarField Ja + ( + rhoLiquidw*Cpw*(Tsatw - Tl)/(rhoVaporw*L) + ); - if (volatileSpecie != "none" && !liquid.pure()) - { - const volScalarField& Yvolatile = - liquid.Y(volatileSpecie); - A2E *= Yvolatile.boundaryField()[patchi]; - A2 *= Yvolatile.boundaryField()[patchi]; - } + const scalarField Al + ( + fLiquid_*4.8*exp(min(-Ja/80, log(vGreat))) + ); - // Volumetric mass source in the near wall cell due to the - // wall boiling - dmdtf_ = - (1 - relax_)*dmdtf_ - + relax_*(1.0/6.0)*A2E*dDep_*rhoVaporw*fDep_*AbyV_; - - // Quenching heat transfer coefficient - const scalarField hQ - ( - 2*(alphaw*Cpw)*fDep_ - *sqrt - ( - (tau_/max(fDep_, small))/(pi*alphaw/rhoLiquidw) - ) - ); - - // Quenching heat flux - qq_ = - (1 - relax_)*qq_ - + relax_*(A2*hQ*max(Tw - Tl, scalar(0))); - - // Evaporation heat flux - qe_ = dmdtf_*L/AbyV_; - - // Effective thermal diffusivity that corresponds to the - // calculated convective, quenching and evaporative heat - // fluxes - - operator== - ( - ( - A1*alphatConv_ - + (qq_ + qe_)/max(hew.snGrad(), scalar(1e-16)) - ) - /max(liquidw, scalar(1e-8)) - ); - - const scalarField TsupPrev(max((Tw - Tsatw), scalar(0))); - const_cast(Tw).evaluate(); - const scalarField TsupNew(max((Tw - Tsatw), scalar(0))); - - const scalar maxErr(gMax(mag(TsupPrev - TsupNew))); - - if (maxErr < 1e-1) - { - if (i > 0) - { - Info<< "Wall boiling wall function iterations: " - << i + 1 << endl; - } - break; - } - else if (i == (maxIter - 1)) - { - Info<< "Maximum number of wall boiling wall function " - << "iterations (" << maxIter << ") reached." << endl - << "Maximum change in wall temperature on last " - << "iteration: " << maxErr << endl; - } + scalarField A2(min(pi*sqr(dDep_)*N_*Al/4, scalar(1))); + const scalarField A1(max(1 - A2, scalar(1e-4))); + scalarField A2E(min(pi*sqr(dDep_)*N_*Al/4, scalar(5))); + if (volatileSpecie != "none" && !liquid.pure()) + { + const volScalarField& Yvolatile = + liquid.Y(volatileSpecie); + A2E *= Yvolatile.boundaryField()[patchi]; + A2 *= Yvolatile.boundaryField()[patchi]; } - break; - } - else - { - Info<< "Saturation model for interface " << interface.name() - << " not found. Wall boiling disabled." << endl; - operator== (alphatConv_); + // Patch area by neighbouring cell volume ratio + const scalarField AbyV + ( + patch().magSf() + /scalarField + ( + patch().boundaryMesh().mesh().V(), + patch().faceCells() + ) + ); + + // Volumetric mass source in the near wall cell due to the + // wall boiling + dmdtf_ = + (1 - relax_)*dmdtf_ + + relax_*(1.0/6.0)*A2E*dDep_*rhoVaporw*fDep_*AbyV; + + // Quenching heat transfer coefficient + const scalarField hQ + ( + 2*alphaw*Cpw*fDep_ + *sqrt((tau_/max(fDep_, small))/(pi*alphaw/rhoLiquidw)) + ); + + // Quenching heat flux + qq_ = + (1 - relax_)*qq_ + + relax_*(A2*hQ*max(Tw - Tl, scalar(0))); + + // Evaporation heat flux + qe_ = dmdtf_*L/AbyV; + + // Set an effective thermal diffusivity that corresponds to the + // calculated convective, quenching and evaporative heat fluxes + operator== + ( + ( + A1*alphatConv + + (qq_ + qe_)/max(hew.snGrad(), scalar(1e-16)) + ) + /max(liquidw, scalar(1e-8)) + ); + + // Evaluate the temperature condition and estimate the + // remaining residual error + const scalarField TsupPrev(max((Tw - Tsatw), scalar(0))); + const_cast(Tw).evaluate(); + const scalarField TsupNew(max((Tw - Tsatw), scalar(0))); + const scalar maxErr(gMax(mag(TsupPrev - TsupNew))); + + if (maxErr < 1e-1) + { + if (i > 0) + { + Info<< "Wall boiling wall function iterations: " + << i + 1 << endl; + } + + break; + } + + if (i == maxIter - 1) + { + Info<< "Maximum number of wall boiling wall function " + << "iterations (" << maxIter << ") reached." << endl + << "Maximum change in wall temperature on last " + << "iteration: " << maxErr << endl; + } } + break; } - default: - { - FatalErrorInFunction - << "Unknown phase type. Valid types are: " - << phaseTypeNames_ << nl << exit(FatalError); - } } fixedValueFvPatchScalarField::updateCoeffs(); @@ -722,8 +699,10 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs() void alphatWallBoilingWallFunctionFvPatchScalarField::write(Ostream& os) const { - alphatPhaseChangeWallFunctionFvPatchScalarField::write(os); + fixedValueFvPatchScalarField::write(os); + alphatPhaseChangeWallFunctionBase::write(os); + // Controls writeEntry(os, "phaseType", phaseTypeNames_[phaseType_]); writeEntry ( @@ -731,49 +710,50 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::write(Ostream& os) const "useLiquidTemperatureWallFunction", useLiquidTemperatureWallFunction_ ); + writeEntry(os, "relax", relax_); + writeEntry(os, "Prt", Prt_); writeEntry(os, "bubbleWaitingTimeRatio", tau_); - writeEntry(os, "alphatConv", alphatConv_); - writeEntry(os, "dDeparture", dDep_); - writeEntry(os, "depFrequency", fDep_); - writeEntry(os, "nucSiteDensity", N_); - writeEntry(os, "wallLiquidFraction", fLiquid_); - writeEntry(os, "qQuenching", qq_); - writeEntry(os, "qEvaporative", qe_); - switch (phaseType_) + // Sub-models + writeKeyword(os, "partitioningModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + partitioningModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + + if (phaseType_ == liquidPhase) { - case vaporPhase: - { - writeKeyword(os, "partitioningModel") << nl; - os << indent << token::BEGIN_BLOCK << incrIndent << nl; - partitioningModel_->write(os); - os << decrIndent << indent << token::END_BLOCK << nl; - break; - } - case liquidPhase: - { - writeKeyword(os, "partitioningModel") << nl; - os << indent << token::BEGIN_BLOCK << incrIndent << nl; - partitioningModel_->write(os); - os << decrIndent << indent << token::END_BLOCK << nl; + writeKeyword(os, "partitioningModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + partitioningModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; - writeKeyword(os, "nucleationSiteModel") << nl; - os << indent << token::BEGIN_BLOCK << incrIndent << nl; - nucleationSiteModel_->write(os); - os << decrIndent << indent << token::END_BLOCK << nl; + writeKeyword(os, "nucleationSiteModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + nucleationSiteModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; - writeKeyword(os, "departureDiamModel") << nl; - os << indent << token::BEGIN_BLOCK << incrIndent << nl; - departureDiamModel_->write(os); - os << decrIndent << indent << token::END_BLOCK << nl; + writeKeyword(os, "departureDiamModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + departureDiameterModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; - writeKeyword(os, "departureFreqModel") << nl; - os << indent << token::BEGIN_BLOCK << incrIndent << nl; - departureFreqModel_->write(os); - os << decrIndent << indent << token::END_BLOCK << nl; + writeKeyword(os, "departureFreqModel") << nl; + os << indent << token::BEGIN_BLOCK << incrIndent << nl; + departureFrequencyModel_->write(os); + os << decrIndent << indent << token::END_BLOCK << nl; + } - break; - } + // State + writeEntry(os, "wallLiquidFraction", fLiquid_); + + if (phaseType_ == liquidPhase) + { + writeEntry(os, "dDeparture", dDep_); + writeEntry(os, "depFrequency", fDep_); + writeEntry(os, "nucSiteDensity", N_); + writeEntry(os, "qQuenching", qq_); + writeEntry(os, "qEvaporative", qe_); + writeEntry(os, "dmdtf", dmdtf_); } } diff --git a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H index c398098e06..73d625a62e 100644 --- a/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H +++ b/applications/solvers/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.H @@ -128,7 +128,8 @@ SourceFiles #ifndef compressible_alphatWallBoilingWallFunctionFvPatchScalarField_H #define compressible_alphatWallBoilingWallFunctionFvPatchScalarField_H -#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H" +#include "alphatPhaseChangeWallFunctionBase.H" +#include "fixedValueFvPatchFields.H" #include "partitioningModel.H" #include "nucleationSiteModel.H" #include "departureDiameterModel.H" @@ -147,7 +148,8 @@ namespace compressible class alphatWallBoilingWallFunctionFvPatchScalarField : - public alphatPhaseChangeWallFunctionFvPatchScalarField + public fixedValueFvPatchScalarField, + public alphatPhaseChangeWallFunctionBase { public: @@ -168,57 +170,65 @@ private: // Private Data - //- Heat source type - phaseType phaseType_; + // Controls - //- Estimate liquid temperature using logarithmic wall function? - Switch useLiquidTemperatureWallFunction_; + //- Heat source type + phaseType phaseType_; - //- Turbulent Prandtl number - scalar Prt_; + //- Estimate liquid temperature using logarithmic wall function? + Switch useLiquidTemperatureWallFunction_; - //- Patch face area by cell volume - scalarField AbyV_; + //- Relaxation factor + scalar relax_; - //- Convective turbulent thermal diffusivity - scalarField alphatConv_; + //- Turbulent Prandtl number + scalar Prt_; - //- Departure diameter - scalarField dDep_; + //- Bubble waiting time ratio + scalar tau_; - //- Departure frequency - scalarField fDep_; - //- Nucleation site density - scalarField N_; + // Sub-Models - //- Wall liquid fraction - scalarField fLiquid_; + //- Heat flux partitioning model + autoPtr + partitioningModel_; - //- Quenching surface heat flux - scalarField qq_; + //- Nucleation site density model + autoPtr + nucleationSiteModel_; - //- Evaporative surface heat flux - scalarField qe_; + //- Bubble departure diameter model + autoPtr + departureDiameterModel_; - //- Bubble waiting time ratio - scalar tau_; + //- Bubble departure frequency model + autoPtr + departureFrequencyModel_; - //- Run-time selected heat flux partitioning model - autoPtr - partitioningModel_; - //- Run-time selected nucleation site density model - autoPtr - nucleationSiteModel_; + // State - //- Run-time selected bubble departure diameter model - autoPtr - departureDiamModel_; + //- Wall liquid fraction + scalarField fLiquid_; - //- Run-time selected bubble departure frequency model - autoPtr - departureFreqModel_; + //- Departure diameter + scalarField dDep_; + + //- Departure frequency + scalarField fDep_; + + //- Nucleation site density + scalarField N_; + + //- Quenching surface heat flux + scalarField qq_; + + //- Evaporative surface heat flux + scalarField qe_; + + //- Mass transfer rate + scalarField dmdtf_; public: @@ -283,6 +293,12 @@ public: // Member Functions + //- Return the wall liquid fraction field [-] + const scalarField& wetFraction() const + { + return fLiquid_; + } + //- Return the departure diameter field [m] const scalarField& dDeparture() const { @@ -301,12 +317,6 @@ public: return N_; } - //- Return the wall liquid fraction field [-] - const scalarField& wetFraction() const - { - return fLiquid_; - } - //- Return the quenching surface heat flux field [W/m^2] const scalarField& qQuenching() const { @@ -319,6 +329,12 @@ public: return qe_; } + //- Return the rate of phase change + virtual const scalarField& dmdtf() const + { + return dmdtf_; + } + // Mapping functions diff --git a/applications/solvers/modules/multiphaseEuler/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C b/applications/solvers/modules/multiphaseEuler/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C index ca2f4b9aa0..484a5b272e 100644 --- a/applications/solvers/modules/multiphaseEuler/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C +++ b/applications/solvers/modules/multiphaseEuler/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C @@ -25,7 +25,7 @@ License #include "ThermalPhaseChangePhaseSystem.H" #include "heatTransferModel.H" -#include "alphatPhaseChangeWallFunctionFvPatchScalarField.H" +#include "alphatPhaseChangeWallFunctionBase.H" #include "fvcVolumeIntegrate.H" #include "fvmSup.H" #include "rhoMulticomponentThermo.H" @@ -513,9 +513,6 @@ template void Foam::ThermalPhaseChangePhaseSystem::correctInterfaceThermo() { - typedef compressible::alphatPhaseChangeWallFunctionFvPatchScalarField - alphatPhaseChangeWallFunction; - forAllConstIter ( saturationModelTable, @@ -627,8 +624,9 @@ Foam::ThermalPhaseChangePhaseSystem::correctInterfaceThermo() // Nucleation mass transfer update { - volScalarField& nDmdtf(*this->nDmdtfs_[interface]); + typedef compressible::alphatPhaseChangeWallFunctionBase alphatwType; + volScalarField& nDmdtf(*this->nDmdtfs_[interface]); nDmdtf = Zero; bool wallBoilingActive = false; @@ -640,43 +638,36 @@ Foam::ThermalPhaseChangePhaseSystem::correctInterfaceThermo() const word alphatName = IOobject::groupName("alphat", phase.name()); - if (phase.mesh().foundObject(alphatName)) + if (!phase.mesh().foundObject(alphatName)) + continue; + + const volScalarField& alphat = + phase.mesh().lookupObject(alphatName); + + forAll(alphat.boundaryField(), patchi) { - const volScalarField& alphat = - phase.mesh().lookupObject(alphatName); + const fvPatchScalarField& alphatp = + alphat.boundaryField()[patchi]; - forAll(alphat.boundaryField(), patchi) - { - const fvPatchScalarField& alphatp = - alphat.boundaryField()[patchi]; + if (!isA(alphatp)) continue; - if (isA(alphatp)) - { - const alphatPhaseChangeWallFunction& alphatw = - refCast - ( - alphatp - ); + const alphatwType& alphatw = + refCast(alphatp); - if (alphatw.activeInterface(interface)) - { - wallBoilingActive = true; + if (!alphatw.activeInterface(interface)) continue; - const scalarField& patchDmdtf = - alphatw.dmdtf(interface); + wallBoilingActive = true; - const scalar sign = - interfaceIter.index() == 0 ? +1 : -1; + UIndirectList nDmdtfp + ( + nDmdtf.primitiveFieldRef(), + alphatp.patch().faceCells() + ); - forAll(patchDmdtf, facei) - { - const label celli = - alphatw.patch().faceCells()[facei]; - nDmdtf[celli] -= sign*patchDmdtf[facei]; - } - } - } - } + nDmdtfp = + scalarField(nDmdtfp) + - (interfaceIter.index() == 0 ? +1 : -1) + *alphatw.dmdtf(interface); } }