ENH: Updated regionModels from internal development line

This commit is contained in:
Andrew Heather
2015-12-02 12:21:50 +00:00
parent e35afa35bf
commit 80f4227d40
21 changed files with 246 additions and 177 deletions

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -52,8 +52,10 @@ void noPyrolysis::constructThermoChemistry()
basicSolidChemistryModel::New(regionMesh()).ptr() basicSolidChemistryModel::New(regionMesh()).ptr()
); );
solidThermo_.reset(&solidChemistry_->solidThermo()); radiation_.reset(radiation::radiationModel::New
radiation_.reset(radiation::radiationModel::New(solidThermo_->T()).ptr()); (
solidChemistry_->thermo().T()
).ptr());
} }
@ -96,7 +98,6 @@ noPyrolysis::noPyrolysis
: :
pyrolysisModel(mesh, regionType), pyrolysisModel(mesh, regionType),
solidChemistry_(NULL), solidChemistry_(NULL),
solidThermo_(NULL),
radiation_(NULL) radiation_(NULL)
{ {
if (active()) if (active())
@ -116,7 +117,6 @@ noPyrolysis::noPyrolysis
: :
pyrolysisModel(mesh, regionType), pyrolysisModel(mesh, regionType),
solidChemistry_(NULL), solidChemistry_(NULL),
solidThermo_(NULL),
radiation_(NULL) radiation_(NULL)
{ {
if (active()) if (active())
@ -148,19 +148,19 @@ void noPyrolysis::evolveRegion()
const volScalarField& noPyrolysis::rho() const const volScalarField& noPyrolysis::rho() const
{ {
return solidThermo_->rho(); return solidChemistry_->thermo().rho();
} }
const volScalarField& noPyrolysis::T() const const volScalarField& noPyrolysis::T() const
{ {
return solidThermo_->T(); return solidChemistry_->thermo().T();
} }
const tmp<volScalarField> noPyrolysis::Cp() const const tmp<volScalarField> noPyrolysis::Cp() const
{ {
return solidThermo_->Cp(); return solidChemistry_->thermo().Cp();
} }
@ -172,7 +172,7 @@ tmp<volScalarField> noPyrolysis::kappaRad() const
tmp<volScalarField> noPyrolysis::kappa() const tmp<volScalarField> noPyrolysis::kappa() const
{ {
return solidThermo_->kappa(); return solidChemistry_->thermo().kappa();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -81,12 +81,9 @@ protected:
//- Reset solidChemistryModel and solidThermo pointers //- Reset solidChemistryModel and solidThermo pointers
void constructThermoChemistry(); void constructThermoChemistry();
//- Reference to the solid chemistry model //- Pointer to the solid chemistry model
autoPtr<basicSolidChemistryModel> solidChemistry_; autoPtr<basicSolidChemistryModel> solidChemistry_;
//- Reference to solid thermo
autoPtr<solidReactionThermo> solidThermo_;
//- Pointer to radiation model //- Pointer to radiation model
autoPtr<radiation::radiationModel> radiation_; autoPtr<radiation::radiationModel> radiation_;

View File

@ -53,7 +53,6 @@ namespace pyrolysisModels
pyrolysisModelCollection::pyrolysisModelCollection(const fvMesh& mesh) pyrolysisModelCollection::pyrolysisModelCollection(const fvMesh& mesh)
: :
PtrList<pyrolysisModel>() PtrList<pyrolysisModel>()
{ {
IOdictionary pyrolysisZonesDict IOdictionary pyrolysisZonesDict
( (
@ -162,12 +161,9 @@ scalar pyrolysisModelCollection::maxDiff() const
scalar maxDiff = 0.0; scalar maxDiff = 0.0;
forAll(*this, i) forAll(*this, i)
{ {
if (maxDiff < this->operator[](i).maxDiff()) maxDiff = max(maxDiff, this->operator[](i).maxDiff());
{
maxDiff = this->operator[](i).maxDiff();
} }
}
return maxDiff; return maxDiff;
} }
@ -175,16 +171,9 @@ scalar pyrolysisModelCollection::maxDiff() const
scalar pyrolysisModelCollection::solidRegionDiffNo() const scalar pyrolysisModelCollection::solidRegionDiffNo() const
{ {
scalar totalDiNum = GREAT; scalar totalDiNum = GREAT;
forAll(*this, i) forAll(*this, i)
{ {
if totalDiNum = min(totalDiNum, this->operator[](i).solidRegionDiffNo());
(
totalDiNum > this->operator[](i).solidRegionDiffNo()
)
{
totalDiNum = this->operator[](i).solidRegionDiffNo();
}
} }
return totalDiNum; return totalDiNum;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,6 +38,7 @@ inclinedFilmNusseltHeightFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
filmRegionName_("surfaceFilmProperties"),
GammaMean_(), GammaMean_(),
a_(), a_(),
omega_() omega_()
@ -54,6 +55,7 @@ inclinedFilmNusseltHeightFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(ptf, p, iF, mapper), fixedValueFvPatchScalarField(ptf, p, iF, mapper),
filmRegionName_(ptf.filmRegionName_),
GammaMean_(ptf.GammaMean_().clone().ptr()), GammaMean_(ptf.GammaMean_().clone().ptr()),
a_(ptf.a_().clone().ptr()), a_(ptf.a_().clone().ptr()),
omega_(ptf.omega_().clone().ptr()) omega_(ptf.omega_().clone().ptr())
@ -69,6 +71,10 @@ inclinedFilmNusseltHeightFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
filmRegionName_
(
dict.lookupOrDefault<word>("filmRegion", "surfaceFilmProperties")
),
GammaMean_(DataEntry<scalar>::New("GammaMean", dict)), GammaMean_(DataEntry<scalar>::New("GammaMean", dict)),
a_(DataEntry<scalar>::New("a", dict)), a_(DataEntry<scalar>::New("a", dict)),
omega_(DataEntry<scalar>::New("omega", dict)) omega_(DataEntry<scalar>::New("omega", dict))
@ -84,6 +90,7 @@ inclinedFilmNusseltHeightFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(wmfrhpsf), fixedValueFvPatchScalarField(wmfrhpsf),
filmRegionName_(wmfrhpsf.filmRegionName_),
GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()), GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()),
a_(wmfrhpsf.a_().clone().ptr()), a_(wmfrhpsf.a_().clone().ptr()),
omega_(wmfrhpsf.omega_().clone().ptr()) omega_(wmfrhpsf.omega_().clone().ptr())
@ -98,6 +105,7 @@ inclinedFilmNusseltHeightFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(wmfrhpsf, iF), fixedValueFvPatchScalarField(wmfrhpsf, iF),
filmRegionName_(wmfrhpsf.filmRegionName_),
GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()), GammaMean_(wmfrhpsf.GammaMean_().clone().ptr()),
a_(wmfrhpsf.a_().clone().ptr()), a_(wmfrhpsf.a_().clone().ptr()),
omega_(wmfrhpsf.omega_().clone().ptr()) omega_(wmfrhpsf.omega_().clone().ptr())
@ -118,10 +126,7 @@ void Foam::inclinedFilmNusseltHeightFvPatchScalarField::updateCoeffs()
// retrieve the film region from the database // retrieve the film region from the database
const regionModels::regionModel& region = const regionModels::regionModel& region =
db().time().lookupObject<regionModels::regionModel> db().time().lookupObject<regionModels::regionModel>(filmRegionName_);
(
"surfaceFilmProperties"
);
const regionModels::surfaceFilmModels::kinematicSingleLayer& film = const regionModels::surfaceFilmModels::kinematicSingleLayer& film =
dynamic_cast dynamic_cast
@ -134,8 +139,7 @@ void Foam::inclinedFilmNusseltHeightFvPatchScalarField::updateCoeffs()
// note: normal pointing into the domain // note: normal pointing into the domain
const vectorField n(-patch().nf()); const vectorField n(-patch().nf());
// TODO: currently re-evaluating the entire gTan field to return this patch const scalarField gTan(film.gTan(patchI) & n);
const scalarField gTan(film.gTan()().boundaryField()[patchI] & n);
if (patch().size() && (max(mag(gTan)) < SMALL)) if (patch().size() && (max(mag(gTan)) < SMALL))
{ {
@ -195,6 +199,13 @@ void Foam::inclinedFilmNusseltHeightFvPatchScalarField::write
) const ) const
{ {
fixedValueFvPatchScalarField::write(os); fixedValueFvPatchScalarField::write(os);
writeEntryIfDifferent<word>
(
os,
"filmRegion",
"surfaceFilmProperties",
filmRegionName_
);
GammaMean_->writeData(os); GammaMean_->writeData(os);
a_->writeData(os); a_->writeData(os);
omega_->writeData(os); omega_->writeData(os);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -56,6 +56,9 @@ class inclinedFilmNusseltHeightFvPatchScalarField
{ {
// Private data // Private data
//- Name of film region
word filmRegionName_;
//- Mean mass flow rate per unit length [kg/s/m] //- Mean mass flow rate per unit length [kg/s/m]
autoPtr<DataEntry<scalar> > GammaMean_; autoPtr<DataEntry<scalar> > GammaMean_;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -38,6 +38,7 @@ inclinedFilmNusseltInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchVectorField(p, iF), fixedValueFvPatchVectorField(p, iF),
filmRegionName_("surfaceFilmProperties"),
GammaMean_(), GammaMean_(),
a_(), a_(),
omega_() omega_()
@ -54,6 +55,7 @@ inclinedFilmNusseltInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchVectorField(ptf, p, iF, mapper), fixedValueFvPatchVectorField(ptf, p, iF, mapper),
filmRegionName_(ptf.filmRegionName_),
GammaMean_(ptf.GammaMean_().clone().ptr()), GammaMean_(ptf.GammaMean_().clone().ptr()),
a_(ptf.a_().clone().ptr()), a_(ptf.a_().clone().ptr()),
omega_(ptf.omega_().clone().ptr()) omega_(ptf.omega_().clone().ptr())
@ -69,6 +71,10 @@ inclinedFilmNusseltInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchVectorField(p, iF), fixedValueFvPatchVectorField(p, iF),
filmRegionName_
(
dict.lookupOrDefault<word>("filmRegion", "surfaceFilmProperties")
),
GammaMean_(DataEntry<scalar>::New("GammaMean", dict)), GammaMean_(DataEntry<scalar>::New("GammaMean", dict)),
a_(DataEntry<scalar>::New("a", dict)), a_(DataEntry<scalar>::New("a", dict)),
omega_(DataEntry<scalar>::New("omega", dict)) omega_(DataEntry<scalar>::New("omega", dict))
@ -84,6 +90,7 @@ inclinedFilmNusseltInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchVectorField(fmfrpvf), fixedValueFvPatchVectorField(fmfrpvf),
filmRegionName_(fmfrpvf.filmRegionName_),
GammaMean_(fmfrpvf.GammaMean_().clone().ptr()), GammaMean_(fmfrpvf.GammaMean_().clone().ptr()),
a_(fmfrpvf.a_().clone().ptr()), a_(fmfrpvf.a_().clone().ptr()),
omega_(fmfrpvf.omega_().clone().ptr()) omega_(fmfrpvf.omega_().clone().ptr())
@ -98,6 +105,7 @@ inclinedFilmNusseltInletVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchVectorField(fmfrpvf, iF), fixedValueFvPatchVectorField(fmfrpvf, iF),
filmRegionName_(fmfrpvf.filmRegionName_),
GammaMean_(fmfrpvf.GammaMean_().clone().ptr()), GammaMean_(fmfrpvf.GammaMean_().clone().ptr()),
a_(fmfrpvf.a_().clone().ptr()), a_(fmfrpvf.a_().clone().ptr()),
omega_(fmfrpvf.omega_().clone().ptr()) omega_(fmfrpvf.omega_().clone().ptr())
@ -118,10 +126,7 @@ void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::updateCoeffs()
// retrieve the film region from the database // retrieve the film region from the database
const regionModels::regionModel& region = const regionModels::regionModel& region =
db().time().lookupObject<regionModels::regionModel> db().time().lookupObject<regionModels::regionModel>(filmRegionName_);
(
"surfaceFilmProperties"
);
const regionModels::surfaceFilmModels::kinematicSingleLayer& film = const regionModels::surfaceFilmModels::kinematicSingleLayer& film =
dynamic_cast dynamic_cast
@ -133,8 +138,7 @@ void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::updateCoeffs()
// note: normal pointing into the domain // note: normal pointing into the domain
const vectorField n(-patch().nf()); const vectorField n(-patch().nf());
// TODO: currently re-evaluating the entire gTan field to return this patch const scalarField gTan(film.gTan(patchI) & n);
const scalarField gTan(film.gTan()().boundaryField()[patchI] & n);
if (patch().size() && (max(mag(gTan)) < SMALL)) if (patch().size() && (max(mag(gTan)) < SMALL))
{ {
@ -191,6 +195,13 @@ void Foam::inclinedFilmNusseltInletVelocityFvPatchVectorField::write
) const ) const
{ {
fvPatchVectorField::write(os); fvPatchVectorField::write(os);
writeEntryIfDifferent<word>
(
os,
"filmRegion",
"surfaceFilmProperties",
filmRegionName_
);
GammaMean_->writeData(os); GammaMean_->writeData(os);
a_->writeData(os); a_->writeData(os);
omega_->writeData(os); omega_->writeData(os);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2012-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -56,6 +56,9 @@ class inclinedFilmNusseltInletVelocityFvPatchVectorField
{ {
// Private data // Private data
//- Name of film region
word filmRegionName_;
//- Mean mass flow rate per unit length [kg/s/m] //- Mean mass flow rate per unit length [kg/s/m]
autoPtr<DataEntry<scalar> > GammaMean_; autoPtr<DataEntry<scalar> > GammaMean_;

View File

@ -51,6 +51,7 @@ alphatFilmWallFunctionFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF), fixedValueFvPatchScalarField(p, iF),
filmRegionName_("surfaceFilmProperties"),
B_(5.5), B_(5.5),
yPlusCrit_(11.05), yPlusCrit_(11.05),
Cmu_(0.09), Cmu_(0.09),
@ -69,6 +70,7 @@ alphatFilmWallFunctionFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(ptf, p, iF, mapper), fixedValueFvPatchScalarField(ptf, p, iF, mapper),
filmRegionName_(ptf.filmRegionName_),
B_(ptf.B_), B_(ptf.B_),
yPlusCrit_(ptf.yPlusCrit_), yPlusCrit_(ptf.yPlusCrit_),
Cmu_(ptf.Cmu_), Cmu_(ptf.Cmu_),
@ -86,6 +88,10 @@ alphatFilmWallFunctionFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(p, iF, dict), fixedValueFvPatchScalarField(p, iF, dict),
filmRegionName_
(
dict.lookupOrDefault<word>("filmRegion", "surfaceFilmProperties")
),
B_(dict.lookupOrDefault("B", 5.5)), B_(dict.lookupOrDefault("B", 5.5)),
yPlusCrit_(dict.lookupOrDefault("yPlusCrit", 11.05)), yPlusCrit_(dict.lookupOrDefault("yPlusCrit", 11.05)),
Cmu_(dict.lookupOrDefault("Cmu", 0.09)), Cmu_(dict.lookupOrDefault("Cmu", 0.09)),
@ -101,6 +107,7 @@ alphatFilmWallFunctionFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(fwfpsf), fixedValueFvPatchScalarField(fwfpsf),
filmRegionName_(fwfpsf.filmRegionName_),
B_(fwfpsf.B_), B_(fwfpsf.B_),
yPlusCrit_(fwfpsf.yPlusCrit_), yPlusCrit_(fwfpsf.yPlusCrit_),
Cmu_(fwfpsf.Cmu_), Cmu_(fwfpsf.Cmu_),
@ -117,6 +124,7 @@ alphatFilmWallFunctionFvPatchScalarField
) )
: :
fixedValueFvPatchScalarField(fwfpsf, iF), fixedValueFvPatchScalarField(fwfpsf, iF),
filmRegionName_(fwfpsf.filmRegionName_),
B_(fwfpsf.B_), B_(fwfpsf.B_),
yPlusCrit_(fwfpsf.yPlusCrit_), yPlusCrit_(fwfpsf.yPlusCrit_),
Cmu_(fwfpsf.Cmu_), Cmu_(fwfpsf.Cmu_),
@ -141,8 +149,7 @@ void alphatFilmWallFunctionFvPatchScalarField::updateCoeffs()
int oldTag = UPstream::msgType(); int oldTag = UPstream::msgType();
UPstream::msgType() = oldTag+1; UPstream::msgType() = oldTag+1;
bool foundFilm = bool foundFilm = db().time().foundObject<modelType>(filmRegionName_);
db().time().foundObject<modelType>("surfaceFilmProperties");
if (!foundFilm) if (!foundFilm)
{ {
@ -154,7 +161,7 @@ void alphatFilmWallFunctionFvPatchScalarField::updateCoeffs()
// Retrieve phase change mass from surface film model // Retrieve phase change mass from surface film model
const modelType& filmModel = const modelType& filmModel =
db().time().lookupObject<modelType>("surfaceFilmProperties"); db().time().lookupObject<modelType>(filmRegionName_);
const label filmPatchI = filmModel.regionPatchID(patchi); const label filmPatchI = filmModel.regionPatchID(patchi);
@ -230,6 +237,13 @@ void alphatFilmWallFunctionFvPatchScalarField::updateCoeffs()
void alphatFilmWallFunctionFvPatchScalarField::write(Ostream& os) const void alphatFilmWallFunctionFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
writeEntryIfDifferent<word>
(
os,
"filmRegion",
"surfaceFilmProperties",
filmRegionName_
);
os.writeKeyword("B") << B_ << token::END_STATEMENT << nl; os.writeKeyword("B") << B_ << token::END_STATEMENT << nl;
os.writeKeyword("yPlusCrit") << yPlusCrit_ << token::END_STATEMENT << nl; os.writeKeyword("yPlusCrit") << yPlusCrit_ << token::END_STATEMENT << nl;
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl; os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -92,6 +92,9 @@ protected:
// Protected data // Protected data
//- Name of film region
word filmRegionName_;
//- B Coefficient (default = 5.5) //- B Coefficient (default = 5.5)
scalar B_; scalar B_;

View File

@ -53,8 +53,7 @@ tmp<scalarField> nutkFilmWallFunctionFvPatchScalarField::calcUTau
typedef regionModels::surfaceFilmModels::surfaceFilmModel modelType; typedef regionModels::surfaceFilmModels::surfaceFilmModel modelType;
bool foundFilm = bool foundFilm = db().time().foundObject<modelType>(filmRegionName_);
db().time().foundObject<modelType>("surfaceFilmProperties");
if (!foundFilm) if (!foundFilm)
{ {
@ -66,7 +65,7 @@ tmp<scalarField> nutkFilmWallFunctionFvPatchScalarField::calcUTau
// Retrieve phase change mass from surface film model // Retrieve phase change mass from surface film model
const modelType& filmModel = const modelType& filmModel =
db().time().lookupObject<modelType>("surfaceFilmProperties"); db().time().lookupObject<modelType>(filmRegionName_);
const label filmPatchI = filmModel.regionPatchID(patchi); const label filmPatchI = filmModel.regionPatchID(patchi);
@ -158,6 +157,7 @@ nutkFilmWallFunctionFvPatchScalarField::nutkFilmWallFunctionFvPatchScalarField
) )
: :
nutkWallFunctionFvPatchScalarField(p, iF), nutkWallFunctionFvPatchScalarField(p, iF),
filmRegionName_("surfaceFilmProperties"),
B_(5.5), B_(5.5),
yPlusCrit_(11.05) yPlusCrit_(11.05)
{} {}
@ -172,6 +172,7 @@ nutkFilmWallFunctionFvPatchScalarField::nutkFilmWallFunctionFvPatchScalarField
) )
: :
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper), nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
filmRegionName_(ptf.filmRegionName_),
B_(5.5), B_(5.5),
yPlusCrit_(11.05) yPlusCrit_(11.05)
{} {}
@ -185,6 +186,10 @@ nutkFilmWallFunctionFvPatchScalarField::nutkFilmWallFunctionFvPatchScalarField
) )
: :
nutkWallFunctionFvPatchScalarField(p, iF, dict), nutkWallFunctionFvPatchScalarField(p, iF, dict),
filmRegionName_
(
dict.lookupOrDefault<word>("filmRegion", "surfaceFilmProperties")
),
B_(dict.lookupOrDefault("B", 5.5)), B_(dict.lookupOrDefault("B", 5.5)),
yPlusCrit_(dict.lookupOrDefault("yPlusCrit", 11.05)) yPlusCrit_(dict.lookupOrDefault("yPlusCrit", 11.05))
{} {}
@ -196,6 +201,7 @@ nutkFilmWallFunctionFvPatchScalarField::nutkFilmWallFunctionFvPatchScalarField
) )
: :
nutkWallFunctionFvPatchScalarField(wfpsf), nutkWallFunctionFvPatchScalarField(wfpsf),
filmRegionName_(wfpsf.filmRegionName_),
B_(wfpsf.B_), B_(wfpsf.B_),
yPlusCrit_(wfpsf.yPlusCrit_) yPlusCrit_(wfpsf.yPlusCrit_)
{} {}
@ -208,6 +214,7 @@ nutkFilmWallFunctionFvPatchScalarField::nutkFilmWallFunctionFvPatchScalarField
) )
: :
nutkWallFunctionFvPatchScalarField(wfpsf, iF), nutkWallFunctionFvPatchScalarField(wfpsf, iF),
filmRegionName_(wfpsf.filmRegionName_),
B_(wfpsf.B_), B_(wfpsf.B_),
yPlusCrit_(wfpsf.yPlusCrit_) yPlusCrit_(wfpsf.yPlusCrit_)
{} {}
@ -240,6 +247,13 @@ tmp<scalarField> nutkFilmWallFunctionFvPatchScalarField::yPlus() const
void nutkFilmWallFunctionFvPatchScalarField::write(Ostream& os) const void nutkFilmWallFunctionFvPatchScalarField::write(Ostream& os) const
{ {
fvPatchField<scalar>::write(os); fvPatchField<scalar>::write(os);
writeEntryIfDifferent<word>
(
os,
"filmRegion",
"surfaceFilmProperties",
filmRegionName_
);
writeLocalEntries(os); writeLocalEntries(os);
os.writeKeyword("B") << B_ << token::END_STATEMENT << nl; os.writeKeyword("B") << B_ << token::END_STATEMENT << nl;
os.writeKeyword("yPlusCrit") << yPlusCrit_ << token::END_STATEMENT << nl; os.writeKeyword("yPlusCrit") << yPlusCrit_ << token::END_STATEMENT << nl;

View File

@ -51,8 +51,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef compressibleNutSpalartAllmarasWallFunctionFvPatchScalarField_H #ifndef nutkFilmWallFunctionFvPatchScalarField_H
#define compressibleNutSpalartAllmarasWallFunctionFvPatchScalarField_H #define nutkFilmWallFunctionFvPatchScalarField_H
#include "nutkWallFunctionFvPatchScalarField.H" #include "nutkWallFunctionFvPatchScalarField.H"
@ -77,6 +77,9 @@ protected:
// Protected data // Protected data
//- Name of film region
word filmRegionName_;
//- B Coefficient (default = 5.5) //- B Coefficient (default = 5.5)
scalar B_; scalar B_;

View File

@ -140,6 +140,13 @@ void kinematicSingleLayer::transferPrimaryRegionSourceFields()
// update addedMassTotal counter // update addedMassTotal counter
if (time().outputTime()) if (time().outputTime())
{ {
if (debug)
{
rhoSp_.write();
USp_.write();
pSp_.write();
}
scalar addedMassTotal = 0.0; scalar addedMassTotal = 0.0;
outputProperties().readIfPresent("addedMassTotal", addedMassTotal); outputProperties().readIfPresent("addedMassTotal", addedMassTotal);
addedMassTotal += returnReduce(addedMassTotal_, sumOp<scalar>()); addedMassTotal += returnReduce(addedMassTotal_, sumOp<scalar>());
@ -422,6 +429,9 @@ void kinematicSingleLayer::solveThickness
U_.correctBoundaryConditions(); U_.correctBoundaryConditions();
// Update film wall and surface velocities
updateSurfaceVelocities();
// Continuity check // Continuity check
continuityCheck(); continuityCheck();
} }
@ -865,6 +875,10 @@ void kinematicSingleLayer::preEvolveRegion()
transferPrimaryRegionSourceFields(); transferPrimaryRegionSourceFields();
updateSurfaceVelocities();
correctAlpha();
// Reset transfer fields // Reset transfer fields
// availableMass_ = mass(); // availableMass_ = mass();
availableMass_ = netMass(); availableMass_ = netMass();
@ -880,12 +894,6 @@ void kinematicSingleLayer::evolveRegion()
Info<< "kinematicSingleLayer::evolveRegion()" << endl; Info<< "kinematicSingleLayer::evolveRegion()" << endl;
} }
// Update film coverage indicator
correctAlpha();
// Update film wall and surface velocities
updateSurfaceVelocities();
// Update sub-models to provide updated source contributions // Update sub-models to provide updated source contributions
updateSubmodels(); updateSubmodels();
@ -913,6 +921,15 @@ void kinematicSingleLayer::evolveRegion()
// Update deltaRho_ with new delta_ // Update deltaRho_ with new delta_
deltaRho_ == delta_*rho_; deltaRho_ == delta_*rho_;
}
void kinematicSingleLayer::postEvolveRegion()
{
if (debug)
{
Info<< "kinematicSingleLayer::postEvolveRegion()" << endl;
}
// Reset source terms for next time integration // Reset source terms for next time integration
resetPrimaryRegionSourceTerms(); resetPrimaryRegionSourceTerms();
@ -933,7 +950,7 @@ scalar kinematicSingleLayer::CourantNumber() const
forAll(delta_, i) forAll(delta_, i)
{ {
if (delta_[i] > deltaCoLimit_) if ((delta_[i] > deltaCoLimit_) && (alpha_[i] > 0.5))
{ {
CoNum = max(CoNum, sumPhi[i]/(delta_[i]*magSf()[i])); CoNum = max(CoNum, sumPhi[i]/(delta_[i]*magSf()[i]));
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -495,6 +495,9 @@ public:
//- Return the gravity tangential component contributions //- Return the gravity tangential component contributions
inline tmp<volVectorField> gTan() const; inline tmp<volVectorField> gTan() const;
//- Return the gravity tangential component contributions for patchI
inline tmp<vectorField> gTan(const label patchI) const;
// Evolution // Evolution
@ -504,6 +507,9 @@ public:
//- Evolve the film equations //- Evolve the film equations
virtual void evolveRegion(); virtual void evolveRegion();
//- Post-evolve film hook
virtual void postEvolveRegion();
// Source fields // Source fields

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -190,7 +190,7 @@ inline const filmTurbulenceModel& kinematicSingleLayer::turbulence() const
inline tmp<volScalarField> kinematicSingleLayer::mass() const inline tmp<volScalarField> kinematicSingleLayer::mass() const
{ {
return rho_*delta_*magSf(); return deltaRho_*magSf();
} }
@ -199,7 +199,7 @@ inline tmp<volScalarField> kinematicSingleLayer::netMass() const
return return
fvc::surfaceSum(pos(phi_)*phi_/(fvc::interpolate(delta_) + deltaSmall_)) fvc::surfaceSum(pos(phi_)*phi_/(fvc::interpolate(delta_) + deltaSmall_))
*time().deltaT() *time().deltaT()
+ rho_*delta_*magSf(); + deltaRho_*magSf();
} }
@ -280,6 +280,18 @@ inline tmp<volVectorField> kinematicSingleLayer::gTan() const
return tgTan; return tgTan;
} }
inline tmp<vectorField> kinematicSingleLayer::gTan
(
const label patchI
) const
{
const vectorField& nH = nHat().boundaryField()[patchI];
const vector& g = g_.value();
tmp<vectorField> tgTan(new vectorField(g - nH*(g & nH)));
return tgTan;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -261,10 +261,7 @@ tmp<volScalarField> liquidFilmThermo::rho() const
if (useReferenceValues_) if (useReferenceValues_)
{ {
forAll(rho, cellI) rho = this->rho(pRef_, TRef_);
{
rho[cellI] = this->rho(pRef_, TRef_);
}
} }
else else
{ {
@ -309,10 +306,7 @@ tmp<volScalarField> liquidFilmThermo::mu() const
if (useReferenceValues_) if (useReferenceValues_)
{ {
forAll(mu, cellI) mu = this->mu(pRef_, TRef_);
{
mu[cellI] = this->mu(pRef_, TRef_);
}
} }
else else
{ {
@ -357,10 +351,7 @@ tmp<volScalarField> liquidFilmThermo::sigma() const
if (useReferenceValues_) if (useReferenceValues_)
{ {
forAll(sigma, cellI) sigma = this->sigma(pRef_, TRef_);
{
sigma[cellI] = this->sigma(pRef_, TRef_);
}
} }
else else
{ {
@ -405,10 +396,7 @@ tmp<volScalarField> liquidFilmThermo::Cp() const
if (useReferenceValues_) if (useReferenceValues_)
{ {
forAll(Cp, cellI) Cp = this->Cp(pRef_, TRef_);
{
Cp[cellI] = this->Cp(pRef_, TRef_);
}
} }
else else
{ {
@ -453,10 +441,7 @@ tmp<volScalarField> liquidFilmThermo::kappa() const
if (useReferenceValues_) if (useReferenceValues_)
{ {
forAll(kappa, cellI) kappa = this->kappa(pRef_, TRef_);
{
kappa[cellI] = this->kappa(pRef_, TRef_);
}
} }
else else
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -63,12 +63,13 @@ thermocapillaryForce::~thermocapillaryForce()
tmp<fvVectorMatrix> thermocapillaryForce::correct(volVectorField& U) tmp<fvVectorMatrix> thermocapillaryForce::correct(volVectorField& U)
{ {
const volScalarField& alpha = owner_.alpha();
const volScalarField& sigma = owner_.sigma(); const volScalarField& sigma = owner_.sigma();
tmp<fvVectorMatrix> tmp<fvVectorMatrix>
tfvm(new fvVectorMatrix(U, dimForce/dimArea*dimVolume)); tfvm(new fvVectorMatrix(U, dimForce/dimArea*dimVolume));
tfvm() += fvc::grad(sigma); tfvm() += alpha*fvc::grad(sigma);
return tfvm; return tfvm;
} }

View File

@ -27,6 +27,7 @@ License
#include "fvcDiv.H" #include "fvcDiv.H"
#include "fvcLaplacian.H" #include "fvcLaplacian.H"
#include "fvm.H" #include "fvm.H"
#include "fvcDdt.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "zeroGradientFvPatchFields.H" #include "zeroGradientFvPatchFields.H"
#include "mappedFieldFvPatchField.H" #include "mappedFieldFvPatchField.H"
@ -188,6 +189,14 @@ void thermoSingleLayer::transferPrimaryRegionSourceFields()
// Apply enthalpy source as difference between incoming and actual states // Apply enthalpy source as difference between incoming and actual states
hsSp_ -= rhoSp_*hs_; hsSp_ -= rhoSp_*hs_;
if (time().outputTime())
{
if (debug)
{
hsSp_.write();
}
}
} }
@ -231,10 +240,12 @@ void thermoSingleLayer::updateSubmodels()
htcs_->correct(); htcs_->correct();
htcw_->correct(); htcw_->correct();
scalarField availableMass(alpha_*availableMass_);
phaseChange_->correct phaseChange_->correct
( (
time_.deltaTValue(), time_.deltaTValue(),
availableMass_, availableMass,
primaryMassPCTrans_, primaryMassPCTrans_,
primaryEnergyPCTrans_ primaryEnergyPCTrans_
); );
@ -256,6 +267,12 @@ void thermoSingleLayer::updateSubmodels()
tmp<fvScalarMatrix> thermoSingleLayer::q(volScalarField& hs) const tmp<fvScalarMatrix> thermoSingleLayer::q(volScalarField& hs) const
{ {
// Only apply heat transfer where the film is present
// - leads to temperature unboundedness?
// volScalarField boundedAlpha(max(alpha_, ROOTVSMALL));
// volScalarField htcst(htcs_->h()*boundedAlpha);
// volScalarField htcwt(htcw_->h()*boundedAlpha);
return return
( (
- fvm::Sp(htcs_->h()/Cp_, hs) - fvm::Sp(htcs_->h()/Cp_, hs)
@ -274,7 +291,13 @@ void thermoSingleLayer::solveEnergy()
Info<< "thermoSingleLayer::solveEnergy()" << endl; Info<< "thermoSingleLayer::solveEnergy()" << endl;
} }
updateSurfaceTemperatures();
dimensionedScalar residualDeltaRho
(
"residualDeltaRho",
deltaRho_.dimensions(),
1e-10
);
solve solve
( (
@ -282,16 +305,21 @@ void thermoSingleLayer::solveEnergy()
+ fvm::div(phi_, hs_) + fvm::div(phi_, hs_)
== ==
- hsSp_ - hsSp_
+ q(hs_) + alpha_*q(hs_)
+ radiation_->Shs() + alpha_*radiation_->Shs()
// - fvm::SuSp(rhoSp_, hs_) // - fvm::SuSp(rhoSp_, hs_)
- rhoSp_*hs_ - rhoSp_*hs_
+ fvc::ddt(residualDeltaRho + deltaRho_, hs_)
- fvm::ddt(residualDeltaRho + deltaRho_, hs_)
); );
correctThermoFields(); correctThermoFields();
// evaluate viscosity from user-model // evaluate viscosity from user-model
viscosity_->correct(pPrimary_, T_); viscosity_->correct(pPrimary_, T_);
// Update film wall and surface temperatures
updateSurfaceTemperatures();
} }
@ -611,10 +639,10 @@ void thermoSingleLayer::preEvolveRegion()
Info<< "thermoSingleLayer::preEvolveRegion()" << endl; Info<< "thermoSingleLayer::preEvolveRegion()" << endl;
} }
// correctHsForMappedT();
kinematicSingleLayer::preEvolveRegion(); kinematicSingleLayer::preEvolveRegion();
updateSurfaceTemperatures();
// Update phase change // Update phase change
primaryMassPCTrans_ == dimensionedScalar("zero", dimMass, 0.0); primaryMassPCTrans_ == dimensionedScalar("zero", dimMass, 0.0);
primaryEnergyPCTrans_ == dimensionedScalar("zero", dimEnergy, 0.0); primaryEnergyPCTrans_ == dimensionedScalar("zero", dimEnergy, 0.0);
@ -628,15 +656,6 @@ void thermoSingleLayer::evolveRegion()
Info<< "thermoSingleLayer::evolveRegion()" << endl; Info<< "thermoSingleLayer::evolveRegion()" << endl;
} }
// Update film coverage indicator
correctAlpha();
// Update film wall and surface velocities
updateSurfaceVelocities();
// Update film wall and surface temperatures
updateSurfaceTemperatures();
// Update sub-models to provide updated source contributions // Update sub-models to provide updated source contributions
updateSubmodels(); updateSubmodels();
@ -670,9 +689,6 @@ void thermoSingleLayer::evolveRegion()
// Update temperature using latest hs_ // Update temperature using latest hs_
T_ == T(hs_); T_ == T(hs_);
// Reset source terms for next time integration
resetPrimaryRegionSourceTerms();
} }
@ -739,7 +755,7 @@ tmp<DimensionedField<scalar, volMesh> > thermoSingleLayer::Srho() const
( (
IOobject IOobject
( (
"thermoSingleLayer::Srho", typeName + ":Srho",
time().timeName(), time().timeName(),
primaryMesh(), primaryMesh(),
IOobject::NO_READ, IOobject::NO_READ,
@ -791,7 +807,7 @@ tmp<DimensionedField<scalar, volMesh> > thermoSingleLayer::Srho
( (
IOobject IOobject
( (
"thermoSingleLayer::Srho(" + Foam::name(i) + ")", typeName + ":Srho(" + Foam::name(i) + ")",
time_.timeName(), time_.timeName(),
primaryMesh(), primaryMesh(),
IOobject::NO_READ, IOobject::NO_READ,
@ -841,7 +857,7 @@ tmp<DimensionedField<scalar, volMesh> > thermoSingleLayer::Sh() const
( (
IOobject IOobject
( (
"thermoSingleLayer::Sh", typeName + ":Sh",
time().timeName(), time().timeName(),
primaryMesh(), primaryMesh(),
IOobject::NO_READ, IOobject::NO_READ,

View File

@ -17,11 +17,7 @@ FoamFile
ddtSchemes ddtSchemes
{ {
default none; default Euler;
ddt(deltaf*rhof) Euler;
ddt(rhof,deltaf) Euler;
ddt(deltaf*rhof,Uf) Euler;
ddt(deltaf*rhof,hf) Euler;
} }
divSchemes divSchemes

View File

@ -17,11 +17,7 @@ FoamFile
ddtSchemes ddtSchemes
{ {
default none; default Euler;
ddt(deltaf*rhof) Euler;
ddt(rhof,deltaf) Euler;
ddt(deltaf*rhof,Uf) Euler;
ddt(deltaf*rhof,hf) Euler;
} }
divSchemes divSchemes

View File

@ -17,11 +17,7 @@ FoamFile
ddtSchemes ddtSchemes
{ {
default none; default Euler;
ddt(deltaf*rhof) Euler;
ddt(rhof,deltaf) Euler;
ddt(deltaf*rhof,Uf) Euler;
ddt(deltaf*rhof,hf) Euler;
} }
divSchemes divSchemes

View File

@ -17,11 +17,7 @@ FoamFile
ddtSchemes ddtSchemes
{ {
default none; default Euler;
ddt(deltaf*rhof) Euler;
ddt(rhof,deltaf) Euler;
ddt(deltaf*rhof,Uf) Euler;
ddt(deltaf*rhof,hf) Euler;
} }
divSchemes divSchemes