diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H index ab467c50e2..7accb05971 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/EEqn.H @@ -19,7 +19,7 @@ == rho*(U&g) + rad.Sh(thermo, he) - + Qdot + + reaction.Qdot() + fvOptions(rho, he) ); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/YEqn.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/YEqn.H index c32c1fdab2..ef730cec6f 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/YEqn.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/YEqn.H @@ -16,13 +16,21 @@ if (Y.size()) { reaction.correct(); - Qdot = reaction.Qdot(); - volScalarField Yt - ( - IOobject("Yt", runTime.timeName(), mesh), - mesh, - dimensionedScalar("Yt", dimless, 0) - ); + + tmp Yt(nullptr); + + if (Y.size()) + { + Yt = tmp + ( + new volScalarField + ( + IOobject("Yt", runTime.timeName(), mesh), + mesh, + dimensionedScalar("Yt", dimless, 0) + ) + ); + } forAll(Y, i) { @@ -49,7 +57,7 @@ if (Y.size()) fvOptions.correct(Yi); Yi.max(0.0); - Yt += Yi; + Yt.ref() += Yi; } } diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H index a38cffc637..f8f8c66382 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/createFluidFields.H @@ -15,7 +15,6 @@ PtrList KFluid(fluidRegions.size()); PtrList dpdtFluid(fluidRegions.size()); PtrList::fieldTable> fieldsFluid(fluidRegions.size()); -PtrList QdotFluid(fluidRegions.size()); List initialMassFluid(fluidRegions.size()); @@ -245,25 +244,6 @@ forAll(fluidRegions, i) } fieldsFluid[i].add(thermoFluid[i].he()); - Info<< " Adding to QdotFluid\n" << endl; - QdotFluid.set - ( - i, - new volScalarField - ( - IOobject - ( - "Qdot", - runTime.timeName(), - fluidRegions[i], - IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE - ), - fluidRegions[i], - dimensionedScalar("Qdot", dimEnergy/dimVolume/dimTime, 0.0) - ) - ); - Info<< " Adding MRF\n" << endl; MRFfluid.set ( diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H index 6ef10d410e..827987963b 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/fluid/setRegionFluidFields.H @@ -43,8 +43,6 @@ multivariateSurfaceInterpolationScheme::fieldTable& fields = fieldsFluid[i]; - volScalarField& Qdot = QdotFluid[i]; - radiation::radiationModel& rad = radiation[i]; IOMRFZoneList& MRF = MRFfluid[i]; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/Make/files b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/Make/files index ee88bf056c..3428d0d562 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/Make/files +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/Make/files @@ -12,6 +12,7 @@ diameterModels/diameterModel/diameterModel.C diameterModels/diameterModel/newDiameterModel.C diameterModels/constantDiameter/constantDiameter.C diameterModels/isothermalDiameter/isothermalDiameter.C +diameterModels/linearTsubDiameter/linearTsubDiameter.C diameterModels/velocityGroup/velocityGroup.C populationBalanceModel/populationBalanceModel/populationBalanceModel.C diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.C index d63b91af48..bbf6f17dd0 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.C @@ -55,10 +55,6 @@ Foam::diameterModel::~diameterModel() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::diameterModel::correct() -{} - - bool Foam::diameterModel::read(const dictionary& phaseProperties) { diameterProperties_ = phaseProperties.optionalSubDict(type() + "Coeffs"); diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.H index f447cec10d..6c70ea4151 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/diameterModel/diameterModel.H @@ -120,9 +120,6 @@ public: //- Return the phase mean diameter field virtual tmp d() const = 0; - //- Correct the diameter field - virtual void correct(); - //- Read phaseProperties dictionary virtual bool read(const dictionary& phaseProperties) = 0; }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C index 6cc41f4830..cc8ce61e4d 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.C @@ -66,7 +66,7 @@ Foam::diameterModels::isothermal::isothermal IOobject::AUTO_WRITE ), phase_.mesh(), - dimensionedScalar("d", dimLength, 0.0) + d0_ ) {} @@ -81,18 +81,11 @@ Foam::diameterModels::isothermal::~isothermal() Foam::tmp Foam::diameterModels::isothermal::d() const { - const volScalarField& p = phase_.db().lookupObject - ( - "p" - ); + const volScalarField& p = phase_.db().lookupObject("p"); - return d0_*pow(p0_/p, 1.0/3.0); -} + d_ = d0_*pow(p0_/p, 1.0/3.0); - -void Foam::diameterModels::isothermal::correct() -{ - d_ = d(); + return d_; } diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.H index 768ad080a5..ba9c84e109 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.H +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/isothermalDiameter/isothermalDiameter.H @@ -61,7 +61,7 @@ class isothermal dimensionedScalar p0_; //- Actual diameter field - volScalarField d_; + mutable volScalarField d_; public: @@ -89,9 +89,6 @@ public: //- Return the diameter field virtual tmp d() const; - //- Correct the diameter field - virtual void correct(); - //- Read phaseProperties dictionary virtual bool read(const dictionary& phaseProperties); }; diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.C new file mode 100644 index 0000000000..e543453398 --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.C @@ -0,0 +1,151 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2018 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 "linearTsubDiameter.H" +#include "phaseSystem.H" +#include "saturationModel.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +namespace diameterModels +{ + defineTypeNameAndDebug(linearTsub, 0); + + addToRunTimeSelectionTable + ( + diameterModel, + linearTsub, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::diameterModels::linearTsub::linearTsub +( + const dictionary& diameterProperties, + const phaseModel& phase +) +: + diameterModel(diameterProperties, phase), + liquidPhaseName_(diameterProperties.lookup("liquidPhase")), + d2_("d2", dimLength, diameterProperties.lookupOrDefault("d2", 0.0015)), + Tsub2_ + ( + "Tsub2", + dimTemperature, + diameterProperties.lookupOrDefault("Tsub2", 0) + ), + d1_ + ( + "d1", + dimLength, + diameterProperties.lookupOrDefault("d1", 0.00015) + ), + Tsub1_ + ( + "Tsub1", + dimTemperature, + diameterProperties.lookupOrDefault("Tsub1", 13.5) + ), + d_ + ( + IOobject + ( + IOobject::groupName("d", phase.name()), + phase_.time().timeName(), + phase_.mesh(), + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + phase_.mesh(), + d1_ + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::diameterModels::linearTsub::~linearTsub() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp Foam::diameterModels::linearTsub::d() const +{ + // Lookup the fluid model + const phaseSystem& fluid = + refCast + ( + phase_.mesh().lookupObject("phaseProperties") + ); + + const phaseModel& liquid(fluid.phases()[liquidPhaseName_]); + + if (phase_.mesh().foundObject("saturationModel")) + { + const saturationModel& satModel = + phase_.mesh().lookupObject("saturationModel"); + + const volScalarField Tsub + ( + liquid.thermo().T() - satModel.Tsat(liquid.thermo().p()) + ); + + d_ = max + ( + d1_, + min + ( + d2_, + (d1_*(Tsub - Tsub2_) + d2_*(Tsub - Tsub1_))/(Tsub2_ - Tsub1_) + ) + ); + } + + return d_; +} + + +bool Foam::diameterModels::linearTsub::read(const dictionary& phaseProperties) +{ + diameterModel::read(phaseProperties); + diameterProperties_.lookup("liquidPhase") >> liquidPhaseName_; + diameterProperties_.lookup("d2") >> d2_; + diameterProperties_.lookup("Tsub2") >> Tsub2_; + diameterProperties_.lookup("d1") >> d1_; + diameterProperties_.lookup("Tsub1") >> Tsub1_; + + return true; +} + + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.H b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.H new file mode 100644 index 0000000000..2739e4db4c --- /dev/null +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/diameterModels/linearTsubDiameter/linearTsubDiameter.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2018 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::linearTsub + +Description + Vapour bubble diameter model for modelling of condensation of vapour + bubbles. Calculates bubble diameter as a function of liquid phase + subcooling. + + Reference: + \verbatim + Anglart, H., Nylund, O., Kurul, N., & Podowski, M. Z. (1997). + CFD prediction of flow and phase distribution in fuel assemblies with + spacers. + Nuclear Engineering and Design, 177(1-3), 215-228. + \endverbatim + +SourceFiles + linearTsub.C + +\*---------------------------------------------------------------------------*/ + +#ifndef linearTsubDiameter_H +#define linearTsubDiameter_H + +#include "diameterModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace diameterModels +{ + +/*---------------------------------------------------------------------------*\ + Class linearTsub Declaration +\*---------------------------------------------------------------------------*/ + +class linearTsub +: + public diameterModel +{ + // Private data + + //- Name of the liquid phase that is used to determine subcooling + // temperature + word liquidPhaseName_; + + //- Reference diameter for low subcooling temperature + dimensionedScalar d2_; + + //- Subcooling temperature where low subcooling diamter is reached + dimensionedScalar Tsub2_; + + //- Reference diameter for high subcooling temperature + dimensionedScalar d1_; + + //- Subcooling temperature where high subcooling diamter is reached + dimensionedScalar Tsub1_; + + //- Actual diameter field + mutable volScalarField d_; + + +public: + + //- Runtime type information + TypeName("linearTsub"); + + + // Constructors + + //- Construct from components + linearTsub + ( + const dictionary& diameterProperties, + const phaseModel& phase + ); + + + //- Destructor + virtual ~linearTsub(); + + + // Member Functions + + //- Return the diameter field + virtual tmp d() const; + + //- Read phaseProperties dictionary + virtual bool read(const dictionary& phaseProperties); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace diameterModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C index ffbbafdeb9..253427a6d1 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/IsothermalPhaseModel/IsothermalPhaseModel.C @@ -51,7 +51,22 @@ Foam::IsothermalPhaseModel::~IsothermalPhaseModel() template void Foam::IsothermalPhaseModel::correctThermo() -{} +{ + BasePhaseModel::correctThermo(); + + // Correct the thermo, but make sure that the temperature remains the same + tmp TCopy + ( + new volScalarField + ( + this->thermo().T().name() + ":Copy", + this->thermo().T() + ) + ); + this->thermo_->he() = this->thermo().he(this->thermo().p(), TCopy); + this->thermo_->correct(); + this->thermo_->T() = TCopy; +} template diff --git a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C index 93f7842458..bdd02059f1 100644 --- a/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C +++ b/applications/solvers/multiphase/reactingEulerFoam/phaseSystems/phaseModel/phaseModel/phaseModel.C @@ -138,9 +138,7 @@ const Foam::autoPtr& Foam::phaseModel::dPtr() const void Foam::phaseModel::correct() -{ - diameterModel_->correct(); -} +{} void Foam::phaseModel::correctKinematics() diff --git a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermos.C b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermos.C index 6dc7e4ae9d..ece7588b51 100644 --- a/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermos.C +++ b/src/thermophysicalModels/reactionThermo/rhoReactionThermo/rhoReactionThermos.C @@ -42,6 +42,7 @@ License #include "constTransport.H" #include "sutherlandTransport.H" +#include "WLFTransport.H" #include "homogeneousMixture.H" #include "inhomogeneousMixture.H" @@ -471,6 +472,18 @@ makeReactionThermo specie ); +makeReactionThermo +( + rhoReactionThermo, + heRhoThermo, + singleComponentMixture, + WLFTransport, + sensibleInternalEnergy, + eConstThermo, + rhoConst, + specie +); + // Multi-component thermo for sensible enthalpy