Merge branch 'master' of github.com-OpenFOAM:OpenFOAM/OpenFOAM-dev

This commit is contained in:
Henry Weller
2018-11-03 10:01:18 +00:00
14 changed files with 330 additions and 57 deletions

View File

@ -19,7 +19,7 @@
==
rho*(U&g)
+ rad.Sh(thermo, he)
+ Qdot
+ reaction.Qdot()
+ fvOptions(rho, he)
);

View File

@ -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<volScalarField> Yt(nullptr);
if (Y.size())
{
Yt = tmp<volScalarField>
(
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;
}
}

View File

@ -15,7 +15,6 @@ PtrList<volScalarField> KFluid(fluidRegions.size());
PtrList<volScalarField> dpdtFluid(fluidRegions.size());
PtrList<multivariateSurfaceInterpolationScheme<scalar>::fieldTable>
fieldsFluid(fluidRegions.size());
PtrList<volScalarField> QdotFluid(fluidRegions.size());
List<scalar> 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
(

View File

@ -43,8 +43,6 @@
multivariateSurfaceInterpolationScheme<scalar>::fieldTable& fields =
fieldsFluid[i];
volScalarField& Qdot = QdotFluid[i];
radiation::radiationModel& rad = radiation[i];
IOMRFZoneList& MRF = MRFfluid[i];

View File

@ -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

View File

@ -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");

View File

@ -120,9 +120,6 @@ public:
//- Return the phase mean diameter field
virtual tmp<volScalarField> d() const = 0;
//- Correct the diameter field
virtual void correct();
//- Read phaseProperties dictionary
virtual bool read(const dictionary& phaseProperties) = 0;
};

View File

@ -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::volScalarField> Foam::diameterModels::isothermal::d() const
{
const volScalarField& p = phase_.db().lookupObject<volScalarField>
(
"p"
);
const volScalarField& p = phase_.db().lookupObject<volScalarField>("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_;
}

View File

@ -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<volScalarField> d() const;
//- Correct the diameter field
virtual void correct();
//- Read phaseProperties dictionary
virtual bool read(const dictionary& phaseProperties);
};

View File

@ -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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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::volScalarField> Foam::diameterModels::linearTsub::d() const
{
// Lookup the fluid model
const phaseSystem& fluid =
refCast<const phaseSystem>
(
phase_.mesh().lookupObject<phaseSystem>("phaseProperties")
);
const phaseModel& liquid(fluid.phases()[liquidPhaseName_]);
if (phase_.mesh().foundObject<saturationModel>("saturationModel"))
{
const saturationModel& satModel =
phase_.mesh().lookupObject<saturationModel>("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;
}
// ************************************************************************* //

View File

@ -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 <http://www.gnu.org/licenses/>.
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<volScalarField> d() const;
//- Read phaseProperties dictionary
virtual bool read(const dictionary& phaseProperties);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace diameterModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -51,7 +51,22 @@ Foam::IsothermalPhaseModel<BasePhaseModel>::~IsothermalPhaseModel()
template<class BasePhaseModel>
void Foam::IsothermalPhaseModel<BasePhaseModel>::correctThermo()
{}
{
BasePhaseModel::correctThermo();
// Correct the thermo, but make sure that the temperature remains the same
tmp<volScalarField> 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<class BasePhaseModel>

View File

@ -138,9 +138,7 @@ const Foam::autoPtr<Foam::diameterModel>& Foam::phaseModel::dPtr() const
void Foam::phaseModel::correct()
{
diameterModel_->correct();
}
{}
void Foam::phaseModel::correctKinematics()

View File

@ -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