EMH: Adding layers option and writing out HR and Tdew fields for

humidityTemperature BC
This commit is contained in:
sergio
2021-11-24 15:52:24 -08:00
parent 6712548137
commit ccb0fd9cf0
2 changed files with 68 additions and 15 deletions

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2020 OpenCFD Ltd. Copyright (C) 2015-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -120,6 +120,7 @@ Foam::humidityTemperatureCoupledMixedFvPatchScalarField::thicknessField
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::humidityTemperatureCoupledMixedFvPatchScalarField:: Foam::humidityTemperatureCoupledMixedFvPatchScalarField::
@ -159,7 +160,9 @@ humidityTemperatureCoupledMixedFvPatchScalarField
fluid_(false), fluid_(false),
cp_(patch().size(), Zero), cp_(patch().size(), Zero),
thickness_(patch().size(), Zero), thickness_(patch().size(), Zero),
rho_(patch().size(), Zero) rho_(patch().size(), Zero),
thicknessLayers_(0),
kappaLayers_(0)
{ {
this->refValue() = 0.0; this->refValue() = 0.0;
this->refGrad() = 0.0; this->refGrad() = 0.0;
@ -199,7 +202,9 @@ humidityTemperatureCoupledMixedFvPatchScalarField
fluid_(psf.fluid_), fluid_(psf.fluid_),
cp_(psf.cp_, mapper), cp_(psf.cp_, mapper),
thickness_(psf.thickness_, mapper), thickness_(psf.thickness_, mapper),
rho_(psf.rho_, mapper) rho_(psf.rho_, mapper),
thicknessLayers_(psf.thicknessLayers_),
kappaLayers_(psf.kappaLayers_)
{} {}
@ -234,7 +239,9 @@ humidityTemperatureCoupledMixedFvPatchScalarField
fluid_(false), fluid_(false),
cp_(patch().size(), Zero), cp_(patch().size(), Zero),
thickness_(patch().size(), Zero), thickness_(patch().size(), Zero),
rho_(patch().size(), Zero) rho_(patch().size(), Zero),
thicknessLayers_(0),
kappaLayers_(0)
{ {
if (!isA<mappedPatchBase>(this->patch().patch())) if (!isA<mappedPatchBase>(this->patch().patch()))
{ {
@ -254,6 +261,11 @@ humidityTemperatureCoupledMixedFvPatchScalarField
fluid_ = true; fluid_ = true;
} }
if (dict.readIfPresent("thicknessLayers", thicknessLayers_))
{
dict.readEntry("kappaLayers", kappaLayers_);
}
if (fluid_) if (fluid_)
{ {
switch(mode_) switch(mode_)
@ -357,7 +369,9 @@ humidityTemperatureCoupledMixedFvPatchScalarField
fluid_(psf.fluid_), fluid_(psf.fluid_),
cp_(psf.cp_), cp_(psf.cp_),
thickness_(psf.thickness_), thickness_(psf.thickness_),
rho_(psf.rho_) rho_(psf.rho_),
thicknessLayers_(psf.thicknessLayers_),
kappaLayers_(psf.kappaLayers_)
{} {}
@ -468,6 +482,16 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
myKDelta_ = K*patch().deltaCoeffs(); myKDelta_ = K*patch().deltaCoeffs();
if (thicknessLayers_.size() > 0)
{
myKDelta_ = 1.0/myKDelta_;
forAll(thicknessLayers_, iLayer)
{
myKDelta_ += thicknessLayers_[iLayer]/kappaLayers_[iLayer];
}
myKDelta_ = 1.0/myKDelta_;
}
scalarField dm(patch().size(), Zero); scalarField dm(patch().size(), Zero);
// Fluid Side // Fluid Side
@ -484,6 +508,8 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
scalarField hfg(patch().size(), Zero); scalarField hfg(patch().size(), Zero);
scalarField htc(patch().size(), GREAT); scalarField htc(patch().size(), GREAT);
scalarField liquidRho(patch().size(), Zero); scalarField liquidRho(patch().size(), Zero);
scalarField Tdew(patch().size(), Zero);
scalarField RH(patch().size(), Zero);
fixedGradientFvPatchField<scalar>& Yp = fixedGradientFvPatchField<scalar>& Yp =
const_cast<fixedGradientFvPatchField<scalar>&> const_cast<fixedGradientFvPatchField<scalar>&>
@ -537,25 +563,26 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
const scalar invMwmean = const scalar invMwmean =
Yi[faceI]/Mv + (1.0 - Yi[faceI])/Mcomp_; Yi[faceI]/Mv + (1.0 - Yi[faceI])/Mcomp_;
const scalar Xv = Yi[faceI]/invMwmean/Mv; const scalar Xv = Yi[faceI]/invMwmean/Mv;
const scalar RH = min(Xv*pf/pSat, 1.0); RH[faceI] = min(Xv*pf/pSat, 1.0);
scalar RHmin = 0.01; scalar RHmin = 0.01;
scalar Tdew = -GREAT; Tdew[faceI] = -GREAT;
if (RH > RHmin) if (RH[faceI] > RHmin)
{ {
scalar b = 243.5; scalar b = 243.5;
scalar c = 17.65; scalar c = 17.65;
scalar TintDeg = Tint - 273; scalar TintDeg = Tint - 273;
Tdew = Tdew[faceI] =
b*(log(RH) + (c*TintDeg)/(b + TintDeg)) b*(log(RH[faceI]) + (c*TintDeg)/(b + TintDeg))
/(c - log(RH) - ((c*TintDeg)/(b + TintDeg))) + 273; /(c - log(RH[faceI]) - ((c*TintDeg)/(b + TintDeg)))
+ 273;
} }
if if
( (
Tf < Tdew Tf < Tdew[faceI]
&& RH > RHmin && RH[faceI] > RHmin
&& ( && (
mode_ == mtCondensation mode_ == mtCondensation
|| mode_ == mtCondensationAndEvaporation || mode_ == mtCondensationAndEvaporation
@ -613,7 +640,7 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_; htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_;
} }
else if (Tf > Tdew && Tf < Tvap_ && mass_[faceI] > 0.0) else if (Tf > Tdew[faceI] && Tf < Tvap_ && mass_[faceI] > 0.0)
{ {
htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_; htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_;
} }
@ -649,6 +676,15 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs()
// Heat flux due to change of phase [W/m2] // Heat flux due to change of phase [W/m2]
dmHfg_ = dm*hfg; dmHfg_ = dm*hfg;
// Output RH and Tdew
scalarField& bRH =
thicknessField("RH", refCast<const fvMesh>(mesh));
bRH = RH;
scalarField& bTdew =
thicknessField("Tdew", refCast<const fvMesh>(mesh));
bTdew = Tdew;
} }
else else
{ {
@ -763,6 +799,12 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::write
liquidDict_.write(os); liquidDict_.write(os);
} }
if (thicknessLayers_.size())
{
thicknessLayers_.writeEntry("thicknessLayers", os);
kappaLayers_.writeEntry("kappaLayers", os);
}
temperatureCoupledBase::write(os); temperatureCoupledBase::write(os);
} }

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015-2016 OpenCFD Ltd. Copyright (C) 2015-2021 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -91,6 +91,8 @@ Description
- The boundary condition of this specie on the coupled wall must be - The boundary condition of this specie on the coupled wall must be
fixedGradient in order to allow condensation or evaporation of the fixedGradient in order to allow condensation or evaporation of the
vapour in or out of this wall vapour in or out of this wall
- Addition of extra layers in possible using thicknessLayers and
kappaLayers
Example usage: Example usage:
@ -127,6 +129,9 @@ Description
} }
} }
thicknessLayers (0.1 0.2 0.3 0.4);
kappaLayers (1 2 3 4);
// thickness, density and cp required for inert and condensation // thickness, density and cp required for inert and condensation
// modes // modes
@ -267,6 +272,12 @@ private:
//- Density field for inert mode //- Density field for inert mode
scalarField rho_; scalarField rho_;
//- Thickness of layers
scalarList thicknessLayers_;
//- Conductivity of layers
scalarList kappaLayers_;
// Private members // Private members