ENH: Merge recent surface film developments into main line

This commit is contained in:
andy
2010-09-07 09:43:03 +01:00
parent d67d23278e
commit 973be0cf7a
51 changed files with 5989 additions and 1824 deletions

View File

@ -10,17 +10,30 @@ surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.C
submodels/kinematic/injectionModel/injectionModel/injectionModel.C
submodels/kinematic/injectionModel/injectionModel/injectionModelNew.C
submodels/kinematic/injectionModel/noInjection/noInjection.C
submodels/kinematic/injectionModel/cloudInjection/cloudInjection.C
submodels/kinematic/injectionModel/removeInjection/removeInjection.C
submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C
submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelNew.C
submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C
submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C
submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModel.C
submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModelNew.C
submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.C
submodels/thermo/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveHeatTransfer.C
/* Boundary conditions */
derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C
derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.C
derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C
derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C
derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.C
/* Wall functions for primary region */
derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.C
derivedFvPatchFields/wallFunctions/mutFilmWallFunction/mutFilmWallFunctionFvPatchScalarField.C
LIB = $(FOAM_LIBBIN)/libsurfaceFilmModels

View File

@ -1,7 +1,23 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
-I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude
EXE_LIBS = \
-lSLGThermo \
-lfiniteVolume \
-lmeshTools
-lmeshTools \
-lpdf \
-lcompressibleRASModels \
-lcompressibleLESModels

View File

@ -111,10 +111,8 @@ void directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs()
directMappedFixedValueFvPatchField<Type>::updateCoeffs();
// Get the coupling information from the directMappedPatchBase
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
(
this->patch().patch()
);
const directMappedPatchBase& mpp =
refCast<const directMappedPatchBase>(this->patch().patch());
const polyMesh& nbrMesh = mpp.sampleMesh();
const fvPatch& nbrPatch =
refCast<const fvMesh>

View File

@ -0,0 +1,334 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "directMappedNamedFixedValueFvPatchField.H"
#include "directMappedPatchBase.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
directMappedNamedFixedValueFvPatchField<Type>::
directMappedNamedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(p, iF),
fieldName_(iF.name()),
setAverage_(false),
average_(pTraits<Type>::zero)
{}
template<class Type>
directMappedNamedFixedValueFvPatchField<Type>::
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<Type>(ptf, p, iF, mapper),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"directMappedNamedFixedValueFvPatchField<Type>::"
"directMappedNamedFixedValueFvPatchField\n"
"(\n"
" const directMappedNamedFixedValueFvPatchField<Type>&,\n"
" const fvPatch&,\n"
" const Field<Type>&,\n"
" const fvPatchFieldMapper&\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
}
}
template<class Type>
directMappedNamedFixedValueFvPatchField<Type>::
directMappedNamedFixedValueFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<Type>(p, iF, dict),
fieldName_(dict.lookupOrDefault<word>("fieldName", iF.name())),
setAverage_(readBool(dict.lookup("setAverage"))),
average_(pTraits<Type>(dict.lookup("average")))
{
if (!isA<directMappedPatchBase>(this->patch().patch()))
{
FatalErrorIn
(
"directMappedNamedFixedValueFvPatchField<Type>::"
"directMappedNamedFixedValueFvPatchField"
"("
" const fvPatch&, "
" const DimensionedField<Type, volMesh>& iF, "
" const dictionary&"
")"
) << "\n patch type '" << p.type()
<< "' not type '" << directMappedPatchBase::typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << fieldName_
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalError);
}
//// Force calculation of schedule (uses parallel comms)
//const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
//(
// this->patch().patch()
//);
//(void)mpp.map().schedule();
}
template<class Type>
directMappedNamedFixedValueFvPatchField<Type>::
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<Type>& ptf
)
:
fixedValueFvPatchField<Type>(ptf),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{}
template<class Type>
directMappedNamedFixedValueFvPatchField<Type>::
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
fixedValueFvPatchField<Type>(ptf, iF),
fieldName_(ptf.fieldName_),
setAverage_(ptf.setAverage_),
average_(ptf.average_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void directMappedNamedFixedValueFvPatchField<Type>::updateCoeffs()
{
if (this->updated())
{
return;
}
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
// Get the scheduling information from the directMappedPatchBase
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
(
directMappedNamedFixedValueFvPatchField<Type>::patch().patch()
);
const mapDistribute& distMap = mpp.map();
// Force recalculation of schedule
(void)distMap.schedule();
const fvMesh& nbrMesh = refCast<const fvMesh>(mpp.sampleMesh());
// Result of obtaining remote values
Field<Type> newValues;
switch (mpp.mode())
{
case directMappedPatchBase::NEARESTCELL:
{
if (mpp.sameRegion())
{
newValues = this->internalField();
}
else
{
newValues = nbrMesh.lookupObject<fieldType>
(
fieldName_
).internalField();
}
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
newValues
);
break;
}
case directMappedPatchBase::NEARESTPATCHFACE:
{
const label nbrPatchID =
nbrMesh.boundaryMesh().findPatchID(mpp.samplePatch());
if (nbrPatchID < 0)
{
FatalErrorIn
(
"void directMappedNamedFixedValueFvPatchField<Type>::"
"updateCoeffs()"
)<< "Unable to find sample patch " << mpp.samplePatch()
<< " in region " << mpp.sampleRegion()
<< " for patch " << this->patch().name() << nl
<< abort(FatalError);
}
const fieldType& nbrField =
nbrMesh.lookupObject<fieldType>(fieldName_);
newValues = nbrField.boundaryField()[nbrPatchID];
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
newValues
);
break;
}
case directMappedPatchBase::NEARESTFACE:
{
Field<Type> allValues(nbrMesh.nFaces(), pTraits<Type>::zero);
const fieldType& nbrField =
nbrMesh.lookupObject<fieldType>(fieldName_);
forAll(nbrField.boundaryField(), patchI)
{
const fvPatchField<Type>& pf =
nbrField.boundaryField()[patchI];
label faceStart = pf.patch().patch().start();
forAll(pf, faceI)
{
allValues[faceStart++] = pf[faceI];
}
}
mapDistribute::distribute
(
Pstream::defaultCommsType,
distMap.schedule(),
distMap.constructSize(),
distMap.subMap(),
distMap.constructMap(),
allValues
);
newValues = this->patch().patchSlice(allValues);
break;
}
default:
{
FatalErrorIn
(
"directMappedNamedFixedValueFvPatchField<Type>::updateCoeffs()"
)<< "Unknown sampling mode: " << mpp.mode()
<< nl << abort(FatalError);
}
}
if (setAverage_)
{
Type averagePsi =
gSum(this->patch().magSf()*newValues)
/gSum(this->patch().magSf());
if (mag(averagePsi)/mag(average_) > 0.5)
{
newValues *= mag(average_)/mag(averagePsi);
}
else
{
newValues += (average_ - averagePsi);
}
}
this->operator==(newValues);
if (debug)
{
Info<< "directMapped on field:" << fieldName_
<< " patch:" << this->patch().name()
<< " avg:" << gAverage(*this)
<< " min:" << gMin(*this)
<< " max:" << gMax(*this)
<< endl;
}
fixedValueFvPatchField<Type>::updateCoeffs();
}
template<class Type>
void directMappedNamedFixedValueFvPatchField<Type>::write(Ostream& os) const
{
fvPatchField<Type>::write(os);
os.writeKeyword("fieldName") << fieldName_ << token::END_STATEMENT << nl;
os.writeKeyword("setAverage") << setAverage_ << token::END_STATEMENT << nl;
os.writeKeyword("average") << average_ << token::END_STATEMENT << nl;
this->writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,164 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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::directMappedNamedFixedValueFvPatchField
Description
Variant of directMappedFixedValueFvPatch where the name of the field to
map is input.
SourceFiles
directMappedNamedFixedValueFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef directMappedNamedFixedValueFvPatchField_H
#define directMappedNamedFixedValueFvPatchField_H
#include "fixedValueFvPatchField.H"
#include "directMappedFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class directMappedNamesFixedValueFvPatchField Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class directMappedNamedFixedValueFvPatchField
:
public fixedValueFvPatchField<Type>
{
// Private data
//- Name of field to sample - defaults to field associated with this
// patch if not specified
word fieldName_;
//- If true adjust the mapped field to maintain average value average_
bool setAverage_;
//- Average value the mapped field is adjusted to maintain if
// setAverage_ is set true
Type average_;
public:
//- Runtime type information
TypeName("directMappedNamedFixedValue");
// Constructors
//- Construct from patch and internal field
directMappedNamedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch, internal field and dictionary
directMappedNamedFixedValueFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given directMappedNamedFixedValueFvPatchField
// onto a new patch
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<Type>&
);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new directMappedNamedFixedValueFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
directMappedNamedFixedValueFvPatchField
(
const directMappedNamedFixedValueFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new directMappedNamedFixedValueFvPatchField<Type>(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "directMappedNamedFixedValueFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "directMappedNamedFixedValueFvPatchFields.H"
#include "volMesh.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(directMappedNamedFixedValue);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,49 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#ifndef directMappedNamedFixedValueFvPatchFields_H
#define directMappedNamedFixedValueFvPatchFields_H
#include "directMappedNamedFixedValueFvPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(directMappedNamedFixedValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#ifndef directMappedNamedFixedValueFvPatchFieldsFwd_H
#define directMappedNamedFixedValueFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class directMappedNamedFixedValueFvPatchField;
makePatchTypeFieldTypedefs(directMappedNamedFixedValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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/>.
\*---------------------------------------------------------------------------*/
#ifndef directMappedNamedFixedValueFvPatchFieldsFwd_H
#define directMappedNamedFixedValueFvPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class directMappedNamedFixedValueFvPatchField;
makePatchTypeFieldTypedefs(directMappedNamedFixedValue)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,165 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "htcConvFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
htcConvFvPatchScalarField::htcConvFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
L_(1.0)
{}
htcConvFvPatchScalarField::htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
L_(ptf.L_)
{}
htcConvFvPatchScalarField::htcConvFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
L_(readScalar(dict.lookup("L")))
{}
htcConvFvPatchScalarField::htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField& htcpsf
)
:
fixedValueFvPatchScalarField(htcpsf),
L_(htcpsf.L_)
{}
htcConvFvPatchScalarField::htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField& htcpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(htcpsf, iF),
L_(htcpsf.L_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void htcConvFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField alphaEffw = rasModel.alphaEff()().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const vectorField& Uc = rasModel.U();
const vectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField& Tw = rasModel.thermo().T().boundaryField()[patchI];
const scalarField Cpw = rasModel.thermo().Cp(Tw, patchI);
const scalarField kappaw = Cpw*alphaEffw;
const scalarField Pr = muw*Cpw/kappaw;
scalarField& htc = *this;
forAll(htc, faceI)
{
label faceCellI = patch().faceCells()[faceI];
scalar Re = rhow[faceI]*mag(Uc[faceCellI] - Uw[faceI])*L_/muw[faceI];
if (Re < 5.0E+05)
{
htc[faceI] = 0.664*sqrt(Re)*cbrt(Pr[faceI])*kappaw[faceI]/L_;
}
else
{
htc[faceI] = 0.037*pow(Re, 0.8)*cbrt(Pr[faceI])*kappaw[faceI]/L_;
}
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void htcConvFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("L") << L_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
htcConvFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,159 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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::compressible::RASModels::htcConvFvPatchScalarField
Description
Convective heat transfer boundary condition
SourceFiles
htcConvFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleMutRoughWallFunctionFvPatchScalarField_H
#define compressibleMutRoughWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class htcConvFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class htcConvFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
protected:
// Protected data
//- L Length scale [m]
const scalar L_;
public:
//- Runtime type information
TypeName("htcConvection");
// Constructors
//- Construct from patch and internal field
htcConvFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
htcConvFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// htcConvFvPatchScalarField
// onto a new patch
htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new htcConvFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
htcConvFvPatchScalarField
(
const htcConvFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new htcConvFvPatchScalarField(*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 RASModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,247 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "alphatFilmWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "surfaceFilmModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "directMappedWallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphatFilmWallFunctionFvPatchScalarField::
alphatFilmWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(p, iF),
B_(5.5),
yPlusCrit_(11.05),
Cmu_(0.09),
kappa_(0.41),
Prt_(0.85)
{}
alphatFilmWallFunctionFvPatchScalarField::
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
B_(ptf.B_),
yPlusCrit_(ptf.yPlusCrit_),
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
Prt_(ptf.Prt_)
{}
alphatFilmWallFunctionFvPatchScalarField::
alphatFilmWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchScalarField(p, iF, dict),
B_(dict.lookupOrDefault("B", 5.5)),
yPlusCrit_(dict.lookupOrDefault("yPlusCrit", 11.05)),
Cmu_(dict.lookupOrDefault("Cmu", 0.09)),
kappa_(dict.lookupOrDefault("kappa", 0.41)),
Prt_(dict.lookupOrDefault("Prt", 0.85))
{}
alphatFilmWallFunctionFvPatchScalarField::
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField& fwfpsf
)
:
fixedValueFvPatchScalarField(fwfpsf),
B_(fwfpsf.B_),
yPlusCrit_(fwfpsf.yPlusCrit_),
Cmu_(fwfpsf.Cmu_),
kappa_(fwfpsf.kappa_),
Prt_(fwfpsf.Prt_)
{}
alphatFilmWallFunctionFvPatchScalarField::
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField& fwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
fixedValueFvPatchScalarField(fwfpsf, iF),
B_(fwfpsf.B_),
yPlusCrit_(fwfpsf.yPlusCrit_),
Cmu_(fwfpsf.Cmu_),
kappa_(fwfpsf.kappa_),
Prt_(fwfpsf.Prt_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphatFilmWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
{
return;
}
bool ok =
db().objectRegistry::foundObject
<surfaceFilmModels::surfaceFilmModel>("surfaceFilmProperties");
if (!ok)
{
// do nothing on construction - film model doesn't exist yet
return;
}
const label patchI = patch().index();
// Retrieve phase change mass from surface film model
const surfaceFilmModels::surfaceFilmModel& filmModel =
db().objectRegistry::lookupObject
<surfaceFilmModels::surfaceFilmModel>("surfaceFilmProperties");
const directMappedWallPolyPatch& wpp =
refCast<const directMappedWallPolyPatch>(patch().patch());
const mapDistribute& distMap = wpp.map();
label filmPatchI = -1;
forAll(filmModel.primaryPatchIDs(), i)
{
if (filmModel.primaryPatchIDs()[i] == patchI)
{
filmPatchI = filmModel.filmBottomPatchIDs()[i];
break;
}
}
scalarField mDotFilm =
filmModel.massPhaseChangeForPrimary().boundaryField()[filmPatchI];
distMap.distribute(mDotFilm);
// Retrieve RAS turbulence model
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const tmp<volScalarField> tk = rasModel.k();
const volScalarField& k = tk();
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
const scalarField& alphaw = rasModel.alpha().boundaryField()[patchI];
const scalar Cmu25 = pow(Cmu_, 0.25);
// Populate alphat field values
scalarField& alphat = *this;
forAll(alphat, faceI)
{
label faceCellI = patch().faceCells()[faceI];
scalar uTau = Cmu25*sqrt(k[faceCellI]);
scalar yPlus = y[faceI]*uTau/(muw[faceI]/rhow[faceI]);
scalar Pr = muw[faceI]/alphaw[faceI];
scalar factor = 0.0;
scalar mStar = mDotFilm[faceI]/(y[faceI]*uTau);
if (yPlus > yPlusCrit_)
{
scalar expTerm = exp(min(50.0, yPlusCrit_*mStar*Pr));
scalar yPlusRatio = yPlus/yPlusCrit_;
scalar powTerm = mStar*Prt_/kappa_;
factor =
mStar/(expTerm*(pow(yPlusRatio, powTerm)) - 1.0 + ROOTVSMALL);
}
else
{
scalar expTerm = exp(min(50.0, yPlus*mStar*Pr));
factor = mStar/(expTerm - 1.0 + ROOTVSMALL);
}
scalar dx = patch().deltaCoeffs()[faceI];
scalar alphaEff = dx*rhow[faceI]*uTau*factor;
alphat[faceI] = max(alphaEff - alphaw[faceI], 0.0);
}
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphatFilmWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
os.writeKeyword("B") << B_ << token::END_STATEMENT << nl;
os.writeKeyword("yPlusCrit") << yPlusCrit_ << token::END_STATEMENT << nl;
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("Prt") << Prt_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
alphatFilmWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,172 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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::compressible::RASModels::alphatFilmWallFunctionFvPatchScalarField
Description
Turbulent thermal diffusivity boundary conditions for use with surface
film models.
SourceFiles
alphatFilmWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleMutRoughWallFunctionFvPatchScalarField_H
#define compressibleMutRoughWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class alphatFilmWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class alphatFilmWallFunctionFvPatchScalarField
:
public fixedValueFvPatchScalarField
{
protected:
// Protected data
//- B Coefficient (default = 5.5)
scalar B_;
//- y+ value for laminar -> turbulent transition (default = 11.05)
scalar yPlusCrit_;
//- Turbulent Cmu coefficient (default = 0.09)
scalar Cmu_;
//- Von-Karman constant (default = 0.41)
scalar kappa_;
//- Turbulent Prandtl number (default = 0.85)
scalar Prt_;
public:
//- Runtime type information
TypeName("alphatFilmWallFunction");
// Constructors
//- Construct from patch and internal field
alphatFilmWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
alphatFilmWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// alphatFilmWallFunctionFvPatchScalarField
// onto a new patch
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new alphatFilmWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
alphatFilmWallFunctionFvPatchScalarField
(
const alphatFilmWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new alphatFilmWallFunctionFvPatchScalarField(*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 RASModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,246 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 (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 "mutFilmWallFunctionFvPatchScalarField.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "RASModel.H"
#include "addToRunTimeSelectionTable.H"
#include "surfaceFilmModel.H"
#include "directMappedWallPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> mutFilmWallFunctionFvPatchScalarField::calcUTau
(
const scalarField& magGradU
) const
{
tmp<scalarField> tuTau(new scalarField(patch().size(), 0.0));
scalarField& uTau = tuTau();
bool ok =
db().objectRegistry::foundObject
<surfaceFilmModels::surfaceFilmModel>("surfaceFilmProperties");
if (!ok)
{
// do nothing on construction - film model doesn't exist yet
return tuTau;
}
const label patchI = patch().index();
// Retrieve phase change mass from surface film model
const surfaceFilmModels::surfaceFilmModel& filmModel =
db().objectRegistry::lookupObject
<surfaceFilmModels::surfaceFilmModel>("surfaceFilmProperties");
const directMappedWallPolyPatch& wpp =
refCast<const directMappedWallPolyPatch>(patch().patch());
const mapDistribute& distMap = wpp.map();
label filmPatchI = -1;
forAll(filmModel.primaryPatchIDs(), i)
{
if (filmModel.primaryPatchIDs()[i] == patchI)
{
filmPatchI = filmModel.filmBottomPatchIDs()[i];
break;
}
}
scalarField mDotFilm =
filmModel.massPhaseChangeForPrimary().boundaryField()[filmPatchI];
distMap.distribute(mDotFilm);
// Retrieve RAS turbulence model
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const fvPatchScalarField& rhow = rasModel.rho().boundaryField()[patchI];
const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI];
const tmp<volScalarField> tk = rasModel.k();
const volScalarField& k = tk();
const scalar Cmu25 = pow(Cmu_, 0.25);
forAll(uTau, faceI)
{
label faceCellI = patch().faceCells()[faceI];
scalar ut = Cmu25*sqrt(k[faceCellI]);
scalar yPlus = y[faceI]*ut/(muw[faceI]/rhow[faceI]);
scalar mStar = mDotFilm[faceI]/(y[faceI]*ut);
scalar factor = 0.0;
if (yPlus > yPlusCrit_)
{
scalar expTerm = exp(min(50.0, B_*mStar));
scalar powTerm = pow(yPlus, mStar/kappa_);
factor = mStar/(expTerm*powTerm - 1.0 + ROOTVSMALL);
}
else
{
scalar expTerm = exp(min(50.0, mStar));
factor = mStar/(expTerm*yPlus - 1.0 + ROOTVSMALL);
}
uTau[faceI] = sqrt(max(0, magGradU[faceI]*ut*factor));
}
return tuTau;
}
tmp<scalarField> mutFilmWallFunctionFvPatchScalarField::calcMut() const
{
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField magGradU = mag(Uw.snGrad());
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
return max
(
scalar(0),
rhow*sqr(calcUTau(magGradU))/(magGradU + ROOTVSMALL) - muw
);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mutFilmWallFunctionFvPatchScalarField::mutFilmWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(p, iF),
B_(5.5),
yPlusCrit_(11.05)
{}
mutFilmWallFunctionFvPatchScalarField::mutFilmWallFunctionFvPatchScalarField
(
const mutFilmWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper),
B_(5.5),
yPlusCrit_(11.05)
{}
mutFilmWallFunctionFvPatchScalarField::mutFilmWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mutkWallFunctionFvPatchScalarField(p, iF, dict),
B_(dict.lookupOrDefault("B", 5.5)),
yPlusCrit_(dict.lookupOrDefault("yPlusCrit", 11.05))
{}
mutFilmWallFunctionFvPatchScalarField::mutFilmWallFunctionFvPatchScalarField
(
const mutFilmWallFunctionFvPatchScalarField& wfpsf
)
:
mutkWallFunctionFvPatchScalarField(wfpsf),
B_(wfpsf.B_),
yPlusCrit_(wfpsf.yPlusCrit_)
{}
mutFilmWallFunctionFvPatchScalarField::mutFilmWallFunctionFvPatchScalarField
(
const mutFilmWallFunctionFvPatchScalarField& wfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(wfpsf, iF),
B_(wfpsf.B_),
yPlusCrit_(wfpsf.yPlusCrit_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
tmp<scalarField> mutFilmWallFunctionFvPatchScalarField::yPlus() const
{
const label patchI = patch().index();
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
const scalarField& y = rasModel.y()[patchI];
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
return y*calcUTau(mag(Uw.snGrad()))/(muw/rhow);
}
void mutFilmWallFunctionFvPatchScalarField::write(Ostream& os) const
{
fvPatchField<scalar>::write(os);
writeLocalEntries(os);
os.writeKeyword("B") << B_ << token::END_STATEMENT << nl;
os.writeKeyword("yPlusCrit") << yPlusCrit_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, mutFilmWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,172 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 (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::compressible::RASModels::
mutFilmWallFunctionFvPatchScalarField
Description
Wall function boundary condition for use with surface film models.
SourceFiles
mutFilmWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleMutSpalartAllmarasWallFunctionFvPatchScalarField_H
#define compressibleMutSpalartAllmarasWallFunctionFvPatchScalarField_H
#include "mutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutFilmWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class mutFilmWallFunctionFvPatchScalarField
:
public mutkWallFunctionFvPatchScalarField
{
protected:
// Protected data
//- B Coefficient (default = 5.5)
scalar B_;
//- y+ value for laminar -> turbulent transition (default = 11.05)
scalar yPlusCrit_;
// Protected member functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const;
//- Calculate the friction velocity
virtual tmp<scalarField> calcUTau(const scalarField& magGradU) const;
public:
//- Runtime type information
TypeName("mutFilmWallFunction");
// Constructors
//- Construct from patch and internal field
mutFilmWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
mutFilmWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// mutFilmWallFunctionFvPatchScalarField
// onto a new patch
mutFilmWallFunctionFvPatchScalarField
(
const mutFilmWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
mutFilmWallFunctionFvPatchScalarField
(
const mutFilmWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new mutFilmWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
mutFilmWallFunctionFvPatchScalarField
(
const mutFilmWallFunctionFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new mutFilmWallFunctionFvPatchScalarField(*this, iF)
);
}
// Member functions
// Evaluation functions
//- Calculate and return the yPlus at the boundary
virtual tmp<scalarField> yPlus() const;
// I-O
//- Write
virtual void write(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ 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 "cloudInjection.H"
#include "addToRunTimeSelectionTable.H"
#include "fvMesh.H"
#include "Time.H"
#include "mathematicalConstants.H"
#include "Random.H"
#include "volFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceFilmModels
{
defineTypeNameAndDebug(cloudInjection, 0);
addToRunTimeSelectionTable(injectionModel, cloudInjection, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceFilmModels::cloudInjection::cloudInjection
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
injectionModel(type(), owner, dict),
particlesPerParcel_(readScalar(coeffs_.lookup("particlesPerParcel"))),
rndGen_(label(0)),
parcelPDF_(pdfs::pdf::New(coeffs_.subDict("parcelPDF"), rndGen_)),
diameter_(owner.film().nCells(), 0.0)
{
forAll(diameter_, faceI)
{
diameter_[faceI] = parcelPDF_->sample();
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceFilmModels::cloudInjection::~cloudInjection()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::surfaceFilmModels::cloudInjection::correct
(
scalarField& massToInject,
scalarField& diameterToInject
)
{
const scalar pi = constant::mathematical::pi;
const scalarField& rhoFilm = owner().rho();
// Collect the data to be transferred
forAll(massToInject, cellI)
{
scalar rho = rhoFilm[cellI];
scalar diam = diameter_[cellI];
scalar minMass = particlesPerParcel_*rho*pi/6*pow3(diam);
if (massToInject[cellI] > minMass)
{
// All mass can be injected - set particle diameter
diameterToInject[cellI] = diameter_[cellI];
// Retrieve new particle diameter sample
diameter_[cellI] = parcelPDF_->sample();
}
else
{
// Mass below minimum threshold - cannot be injected
massToInject[cellI] = 0.0;
diameterToInject[cellI] = -1.0;
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,122 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ 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::cloudInjection
Description
Cloud injection model
SourceFiles
cloudInjection.C
\*---------------------------------------------------------------------------*/
#ifndef cloudInjection_H
#define cloudInjection_H
#include "injectionModel.H"
#include "pdf.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class cloudInjection Declaration
\*---------------------------------------------------------------------------*/
class cloudInjection
:
public injectionModel
{
private:
// Private member functions
//- Disallow default bitwise copy construct
cloudInjection(const cloudInjection&);
//- Disallow default bitwise assignment
void operator=(const cloudInjection&);
protected:
// Protected data
//- Number of particles per parcel
scalar particlesPerParcel_;
//- Random number generator
Random rndGen_;
//- Parcel size PDF model
const autoPtr<pdfs::pdf> parcelPDF_;
//- Diameters of particles to inject into the cloud
scalarList diameter_;
public:
//- Runtime type information
TypeName("cloudInjection");
// Constructors
//- Construct from surface film model
cloudInjection(const surfaceFilmModel& owner, const dictionary& dict);
//- Destructor
virtual ~cloudInjection();
// Member Functions
// Evolution
//- Correct
virtual void correct
(
scalarField& massToInject,
scalarField& diameterToInject
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -41,8 +41,7 @@ namespace Foam
Foam::surfaceFilmModels::injectionModel::injectionModel
(
const surfaceFilmModel& owner,
const dictionary& dict
const surfaceFilmModel& owner
)
:
owner_(owner),

View File

@ -97,7 +97,7 @@ public:
// Constructors
//- Construct null
injectionModel(const surfaceFilmModel& owner, const dictionary& dict);
injectionModel(const surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
injectionModel

View File

@ -34,7 +34,7 @@ Foam::surfaceFilmModels::injectionModel::New
const dictionary& dict
)
{
const word modelType(dict.lookup("injectionModel"));
word modelType(dict.lookup("injectionModel"));
Info<< " Selecting injectionModel " << modelType << endl;

View File

@ -43,10 +43,10 @@ namespace Foam
Foam::surfaceFilmModels::noInjection::noInjection
(
const surfaceFilmModel& owner,
const dictionary& dict
const dictionary&
)
:
injectionModel(owner, dict)
injectionModel(owner)
{}

View File

@ -43,10 +43,10 @@ namespace Foam
Foam::surfaceFilmModels::removeInjection::removeInjection
(
const surfaceFilmModel& owner,
const dictionary& dict
const dictionary&
)
:
injectionModel(owner, dict)
injectionModel(owner)
{}

View File

@ -66,7 +66,7 @@ private:
public:
//- Runtime type information
TypeName("remove");
TypeName("removeInjection");
// Constructors

View File

@ -0,0 +1,105 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ 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 "constantHeatTransfer.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceFilmModels
{
defineTypeNameAndDebug(constantHeatTransfer, 0);
addToRunTimeSelectionTable
(
heatTransferModel,
constantHeatTransfer,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceFilmModels::constantHeatTransfer::constantHeatTransfer
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
heatTransferModel(typeName, owner, dict),
c0_(readScalar(coeffs_.lookup("c0")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceFilmModels::constantHeatTransfer::~constantHeatTransfer()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::surfaceFilmModels::constantHeatTransfer::correct()
{
// do nothing
}
Foam::tmp<Foam::volScalarField>
Foam::surfaceFilmModels::constantHeatTransfer::h() const
{
return tmp<volScalarField>
(
new volScalarField
(
IOobject
(
"htc",
owner_.time().timeName(),
owner_.film(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
owner_.film(),
dimensionedScalar
(
"c0",
dimEnergy/dimTime/sqr(dimLength)/dimTemperature,
c0_
),
zeroGradientFvPatchScalarField::typeName
)
);
}
// ************************************************************************* //

View File

@ -0,0 +1,114 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
\\/ 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::constantHeatTransfer
Description
Constant heat transfer model
SourceFiles
constantHeatTransfer.C
\*---------------------------------------------------------------------------*/
#ifndef constantHeatTransfer_H
#define constantHeatTransfer_H
#include "heatTransferModel.H"
#include "volFieldsFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class constantHeatTransfer Declaration
\*---------------------------------------------------------------------------*/
class constantHeatTransfer
:
public heatTransferModel
{
private:
// Private data
//- Constant heat transfer coefficient [W/m2/K]
scalar c0_;
// Private member functions
//- Disallow default bitwise copy construct
constantHeatTransfer(const constantHeatTransfer&);
//- Disallow default bitwise assignment
void operator=(const constantHeatTransfer&);
public:
//- Runtime type information
TypeName("constant");
// Constructors
//- Construct from surface film model and dictionary
constantHeatTransfer
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~constantHeatTransfer();
// Member Functions
// Evolution
//- Correct
virtual void correct();
//- Return the heat transfer coefficient [W/m2/K]
virtual tmp<volScalarField> h() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,69 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "heatTransferModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceFilmModels
{
defineTypeNameAndDebug(heatTransferModel, 0);
defineRunTimeSelectionTable(heatTransferModel, dictionary);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceFilmModels::heatTransferModel::heatTransferModel
(
const surfaceFilmModel& owner
)
:
owner_(owner)
{}
Foam::surfaceFilmModels::heatTransferModel::heatTransferModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
)
:
owner_(owner),
coeffs_(dict.subDict(type + "Coeffs"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceFilmModels::heatTransferModel::~heatTransferModel()
{}
// ************************************************************************* //

View File

@ -0,0 +1,159 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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::heatTransferModel
Description
Base class for heat transfer models
SourceFiles
heatTransferModelI.H
heatTransferModel.C
\*---------------------------------------------------------------------------*/
#ifndef heatTransferModel_H
#define heatTransferModel_H
#include "surfaceFilmModel.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class heatTransferModel Declaration
\*---------------------------------------------------------------------------*/
class heatTransferModel
{
private:
// Private Member Functions
//- Disallow default bitwise copy construct
heatTransferModel(const heatTransferModel&);
//- Disallow default bitwise assignment
void operator=(const heatTransferModel&);
protected:
// Protected data
//- Reference to the owner surface film model
const surfaceFilmModel& owner_;
//- Model coefficients dictionary
dictionary coeffs_;
public:
//- Runtime type information
TypeName("heatTransferModel");
// Declare runtime constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
heatTransferModel,
dictionary,
(
const surfaceFilmModel& owner,
const dictionary& dict
),
(owner, dict)
);
// Constructors
//- Construct null
heatTransferModel(const surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
heatTransferModel
(
const word& type,
const surfaceFilmModel& owner,
const dictionary& dict
);
// Selectors
//- Return a reference to the selected phase change model
static autoPtr<heatTransferModel> New
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~heatTransferModel();
// Member Functions
// Access
//- Return the reference to the owner surface film model
inline const surfaceFilmModel& owner() const;
//- Return the model coefficients dictionary
inline const dictionary& coeffs() const;
// Evolution
//- Correct
virtual void correct() = 0;
//- Return the heat transfer coefficient [W/m2/K]
virtual tmp<volScalarField> h() const = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "heatTransferModelI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "heatTransferModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::surfaceFilmModels::surfaceFilmModel&
Foam::surfaceFilmModels::heatTransferModel::owner() const
{
return owner_;
}
inline const Foam::dictionary&
Foam::surfaceFilmModels::heatTransferModel::coeffs() const
{
return coeffs_;
}
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "heatTransferModel.H"
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::surfaceFilmModels::heatTransferModel>
Foam::surfaceFilmModels::heatTransferModel::New
(
const surfaceFilmModel& model,
const dictionary& dict
)
{
word modelType(dict.lookup("heatTransferModel"));
Info<< " Selecting heatTransferModel " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"heatTransferModel::New(const surfaceFilmModel&, const dictionary&)"
) << "Unknown heatTransferModel type " << modelType << nl << nl
<< "Valid heatTransferModel types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<heatTransferModel>(cstrIter()(model, dict));
}
// ************************************************************************* //

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "mappedConvectiveHeatTransfer.H"
#include "zeroGradientFvPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "kinematicSingleLayer.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceFilmModels
{
defineTypeNameAndDebug(mappedConvectiveHeatTransfer, 0);
addToRunTimeSelectionTable
(
heatTransferModel,
mappedConvectiveHeatTransfer,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceFilmModels::mappedConvectiveHeatTransfer::
mappedConvectiveHeatTransfer
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
// heatTransferModel(typeName, owner, dict),
heatTransferModel(owner),
htcConvPrimary_
(
IOobject
(
"htcConv",
owner.time().timeName(),
owner.mesh(),
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
owner.mesh()
),
htcConvFilm_
(
IOobject
(
htcConvPrimary_.name(), // must have same name as above for mapping
owner.time().timeName(),
owner.film(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
owner.film(),
dimensionedScalar("zero", dimMass/pow3(dimTime)/dimTemperature, 0.0),
refCast<const kinematicSingleLayer>(owner).pSp().boundaryField().types()
)
{
// Update the primary-side convective heat transfer coefficient
htcConvPrimary_.correctBoundaryConditions();
// Pull the data from the primary region via direct mapped BCs
htcConvFilm_.correctBoundaryConditions();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceFilmModels::mappedConvectiveHeatTransfer::
~mappedConvectiveHeatTransfer()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::surfaceFilmModels::mappedConvectiveHeatTransfer::correct()
{
// Update the primary-side convective heat transfer coefficient
htcConvPrimary_.correctBoundaryConditions();
// Pull the data from the primary region via direct mapped BCs
htcConvFilm_.correctBoundaryConditions();
}
Foam::tmp<Foam::volScalarField>
Foam::surfaceFilmModels::mappedConvectiveHeatTransfer::h() const
{
return htcConvFilm_;
}
// ************************************************************************* //

View File

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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::mappedConvectiveHeatTransfer
Description
Convective heat transfer model based on a re-working of a Nusselt number
correlation
SourceFiles
mappedConvectiveHeatTransfer.C
\*---------------------------------------------------------------------------*/
#ifndef mappedConvectiveHeatTransfer_H
#define mappedConvectiveHeatTransfer_H
#include "heatTransferModel.H"
#include "volFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class mappedConvectiveHeatTransfer Declaration
\*---------------------------------------------------------------------------*/
class mappedConvectiveHeatTransfer
:
public heatTransferModel
{
private:
// Private data
//- Heat transfer coefficient - primary region [W/m2/K]
volScalarField htcConvPrimary_;
//- Heat transfer coefficient - film region [W/m2/K]
// Assumes that the primary regtion to film region boundaries are
// described as directMappedPushed types
volScalarField htcConvFilm_;
// Private member functions
//- Disallow default bitwise copy construct
mappedConvectiveHeatTransfer(const mappedConvectiveHeatTransfer&);
//- Disallow default bitwise assignment
void operator=(const mappedConvectiveHeatTransfer&);
public:
//- Runtime type information
TypeName("mappedConvectiveHeatTransfer");
// Constructors
//- Construct from surface film model and dictionary
mappedConvectiveHeatTransfer
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~mappedConvectiveHeatTransfer();
// Member Functions
// Evolution
//- Correct
virtual void correct();
//- Return the heat transfer coefficient [W/m2/K]
virtual tmp<volScalarField> h() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -43,10 +43,10 @@ namespace Foam
Foam::surfaceFilmModels::noPhaseChange::noPhaseChange
(
const surfaceFilmModel& owner,
const dictionary& dict
const dictionary&
)
:
phaseChangeModel(owner, dict)
phaseChangeModel(owner)
{}
@ -58,7 +58,11 @@ Foam::surfaceFilmModels::noPhaseChange::~noPhaseChange()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::surfaceFilmModels::noPhaseChange::correct()
void Foam::surfaceFilmModels::noPhaseChange::correct
(
const scalar,
scalarField&
)
{
// do nothing
}

View File

@ -84,7 +84,7 @@ public:
// Evolution
//- Correct
virtual void correct();
virtual void correct(const scalar dt, scalarField& dMass);
};

View File

@ -41,8 +41,7 @@ namespace Foam
Foam::surfaceFilmModels::phaseChangeModel::phaseChangeModel
(
const surfaceFilmModel& owner,
const dictionary& dict
const surfaceFilmModel& owner
)
:
owner_(owner),
@ -59,17 +58,7 @@ Foam::surfaceFilmModels::phaseChangeModel::phaseChangeModel
:
owner_(owner),
coeffs_(dict.subDict(type + "Coeffs"))
{
WarningIn
(
"phaseChangeModel::phaseChangeModel"
"("
"const word&, "
"const surfaceFilmModel&, "
"const dictionary&"
")"
) << "Phase change models not implemented!" << endl;
}
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //

View File

@ -25,6 +25,7 @@ Class
Foam::phaseChangeModel
Description
Phase change model for surface film modelling.
SourceFiles
phaseChangeModelI.H
@ -37,6 +38,7 @@ SourceFiles
#include "surfaceFilmModel.H"
#include "runTimeSelectionTables.H"
#include "scalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -96,7 +98,7 @@ public:
// Constructors
//- Construct null
phaseChangeModel(const surfaceFilmModel& owner, const dictionary& dict);
phaseChangeModel(const surfaceFilmModel& owner);
//- Construct from type name, dictionary and surface film model
phaseChangeModel
@ -134,8 +136,8 @@ public:
// Evolution
//- Correct // TODO
virtual void correct() = 0;
//- Correct
virtual void correct(const scalar dt, scalarField& dMass) = 0;
};

View File

@ -34,7 +34,7 @@ Foam::surfaceFilmModels::phaseChangeModel::New
const dictionary& dict
)
{
const word modelType(dict.lookup("phaseChangeModel"));
word modelType(dict.lookup("phaseChangeModel"));
Info<< " Selecting phaseChangeModel " << modelType << endl;

View File

@ -0,0 +1,185 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "standardPhaseChange.H"
#include "addToRunTimeSelectionTable.H"
#include "thermoSingleLayer.H"
#include "specie.H"
#include "heatTransferModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceFilmModels
{
defineTypeNameAndDebug(standardPhaseChange, 0);
addToRunTimeSelectionTable
(
phaseChangeModel,
standardPhaseChange,
dictionary
);
}
}
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
Foam::scalar Foam::surfaceFilmModels::standardPhaseChange::Sh
(
const scalar Re,
const scalar Sc
) const
{
if (Re < 5.0E+05)
{
return 0.664*sqrt(Re)*cbrt(Sc);
}
else
{
return 0.037*pow(Re, 0.8)*cbrt(Sc);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceFilmModels::standardPhaseChange::standardPhaseChange
(
const surfaceFilmModel& owner,
const dictionary& dict
)
:
phaseChangeModel(typeName, owner, dict),
deltaMin_(readScalar(coeffs_.lookup("deltaMin"))),
L_(readScalar(coeffs_.lookup("L")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::surfaceFilmModels::standardPhaseChange::~standardPhaseChange()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::surfaceFilmModels::standardPhaseChange::correct
(
const scalar dt,
scalarField& dMass
)
{
const thermoSingleLayer& film = refCast<const thermoSingleLayer>(owner_);
// set local thermo properties
const SLGThermo& thermo = film.thermo();
const label liqId = film.liquidId();
const liquid& liq = thermo.liquids().properties()[liqId];
const label vapId = thermo.carrierId(thermo.liquids().components()[liqId]);
// retrieve fields from film model
const scalarField& delta = film.delta();
const scalarField& YInf = film.YPrimary()[vapId];
const scalarField& pInf = film.pPrimary();
const scalarField& T = film.T();
const scalarField& Ts = film.Ts();
const scalarField& Tw = film.Tw();
const scalarField& TInf = film.TPrimary();
const scalarField& rho = film.rho();
const scalarField& mu = film.mu();
const scalarField& hs = film.hs();
const scalarField& magSf = film.magSf();
const scalarField hInf = film.htcs().h();
const scalarField hFilm = film.htcw().h();
const vectorField dU = film.UPrimary() - film.Us();
// Reynolds number
const scalarField Re = rho*mag(dU)*L_/mu;
// molecular weight of vapour
const scalar Wvap = thermo.carrier().W(vapId);
// molecular weight of liquid
const scalar Wliq = liq.W();
forAll(dMass, cellI)
{
if (delta[cellI] > deltaMin_)
{
// cell pressure
const scalar pc = pInf[cellI];
// saturation pressure
const scalar pSat = liq.pv(pc, Ts[cellI]);
// calculate mass transfer
if (pSat > pc)
{
// boiling
const scalar qDotInf = hInf[cellI]*(TInf[cellI] - T[cellI]);
const scalar qDotFilm = hFilm[cellI]*(T[cellI] - Tw[cellI]);
dMass[cellI] +=
max
(
0.0,
dt*magSf[cellI]/hs[cellI]*(qDotInf - qDotFilm)
);
}
else
{
// vapour mass fraction at interface
const scalar Ys = Wliq*pSat/(Wliq*pSat + Wvap*(pc - pSat));
// bulk gas average density
const scalar rhoAve = pc/(specie::RR*Ts[cellI]);
// vapour diffusivity [m2/s]
const scalar Dab = liq.D(pc, Ts[cellI]);
// Schmidt number
const scalar Sc = mu[cellI]/(rho[cellI]*(Dab + ROOTVSMALL));
// Sherwood number
const scalar Sh = this->Sh(Re[cellI], Sc);
// mass transfer coefficient [m/s]
const scalar hm = Sh*Dab/L_;
// add mass contribution to source
dMass[cellI] =
max
(
0.0,
dt*magSf[cellI]*rhoAve*hm*(Ys - YInf[cellI])/(1.0 - Ys)
);
}
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,121 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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::standardPhaseChange
Description
SourceFiles
standardPhaseChange.C
\*---------------------------------------------------------------------------*/
#ifndef standardPhaseChange_H
#define standardPhaseChange_H
#include "phaseChangeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceFilmModels
{
/*---------------------------------------------------------------------------*\
Class standardPhaseChange Declaration
\*---------------------------------------------------------------------------*/
class standardPhaseChange
:
public phaseChangeModel
{
private:
// Private member functions
//- Disallow default bitwise copy construct
standardPhaseChange(const standardPhaseChange&);
//- Disallow default bitwise assignment
void operator=(const standardPhaseChange&);
protected:
// Protected data
//- Minimum film height for model to be active
const scalar deltaMin_;
//- Length scalae / [m]
const scalar L_;
// Protected member functions
//- Return Sherwood number as a function of Reynolds and Schmidt numbers
scalar Sh(const scalar Re, const scalar Sc) const;
public:
//- Runtime type information
TypeName("standardPhaseChange");
// Constructors
//- Construct from surface film model
standardPhaseChange
(
const surfaceFilmModel& owner,
const dictionary& dict
);
//- Destructor
virtual ~standardPhaseChange();
// Member Functions
// Evolution
//- Correct
virtual void correct(const scalar dt, scalarField& dMass);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceFilmModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -136,6 +136,41 @@ Foam::surfaceFilmModels::kinematicSingleLayer::rhoSp()
}
inline const Foam::volVectorField&
Foam::surfaceFilmModels::kinematicSingleLayer::USp() const
{
return USp_;
}
inline const Foam::volScalarField&
Foam::surfaceFilmModels::kinematicSingleLayer::pSp() const
{
return pSp_;
}
inline const Foam::volScalarField&
Foam::surfaceFilmModels::kinematicSingleLayer::rhoSp() const
{
return rhoSp_;
}
inline const Foam::volVectorField&
Foam::surfaceFilmModels::kinematicSingleLayer::UPrimary() const
{
return UPrimary_;
}
inline const Foam::volScalarField&
Foam::surfaceFilmModels::kinematicSingleLayer::pPrimary() const
{
return pPrimary_;
}
inline Foam::surfaceFilmModels::injectionModel&
Foam::surfaceFilmModels::kinematicSingleLayer::injection()
{

View File

@ -1,62 +1,62 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "kinematicSingleLayer.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::surfaceFilmModels::kinematicSingleLayer::constrainFilmField
(
Type& field,
const typename Type::cmptType& value
)
{
forAll(filmBottomPatchIDs_, i)
{
label patchI = filmBottomPatchIDs_[i];
field.boundaryField()[patchI] = value;
if (debug)
{
Info<< "Constraining " << field.name()
<< " boundary " << field.boundaryField()[patchI].patch().name()
<< " to " << value << endl;
}
}
forAll(filmTopPatchIDs_, i)
{
label patchI = filmTopPatchIDs_[i];
field.boundaryField()[patchI] = value;
if (debug)
{
Info<< "Constraining " << field.name()
<< " boundary " << field.boundaryField()[patchI].patch().name()
<< " to " << value << endl;
}
}
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ 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 "kinematicSingleLayer.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
void Foam::surfaceFilmModels::kinematicSingleLayer::constrainFilmField
(
Type& field,
const typename Type::cmptType& value
)
{
forAll(filmBottomPatchIDs_, i)
{
label patchI = filmBottomPatchIDs_[i];
field.boundaryField()[patchI] = value;
if (debug)
{
Info<< "Constraining " << field.name()
<< " boundary " << field.boundaryField()[patchI].patch().name()
<< " to " << value << endl;
}
}
forAll(filmTopPatchIDs_, i)
{
label patchI = filmTopPatchIDs_[i];
field.boundaryField()[patchI] = value;
if (debug)
{
Info<< "Constraining " << field.name()
<< " boundary " << field.boundaryField()[patchI].patch().name()
<< " to " << value << endl;
}
}
}
// ************************************************************************* //

View File

@ -76,6 +76,12 @@ Foam::surfaceFilmModels::noFilm::~noFilm()
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::surfaceFilmModels::noFilm::preEvolveFilm()
{
// do nothing
}
void Foam::surfaceFilmModels::noFilm::evolveFilm()
{
// do nothing
@ -87,7 +93,7 @@ const Foam::fvMesh& Foam::surfaceFilmModels::noFilm::film() const
FatalErrorIn("const fvMesh& noFilm::film() const")
<< "Cannot return film for noFilm model" << abort(FatalError);
return reinterpret_cast<const fvMesh&>(null);
return mesh();
}
@ -141,6 +147,28 @@ const Foam::volVectorField& Foam::surfaceFilmModels::noFilm::U() const
}
const Foam::volVectorField& Foam::surfaceFilmModels::noFilm::Us() const
{
FatalErrorIn
(
"const volScalarField& noFilm::Us() const"
) << "Us field not available for " << type() << abort(FatalError);
return volVectorField::null();
}
const Foam::volVectorField& Foam::surfaceFilmModels::noFilm::Uw() const
{
FatalErrorIn
(
"const volScalarField& noFilm::Uw() const"
) << "Uw field not available for " << type() << abort(FatalError);
return volVectorField::null();
}
const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::rho() const
{
FatalErrorIn
@ -163,6 +191,28 @@ const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::T() const
}
const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::Ts() const
{
FatalErrorIn
(
"const Foam::volScalarField& Foam::noFilm::Ts() const"
) << "Ts field not available for " << type() << abort(FatalError);
return volScalarField::null();
}
const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::Tw() const
{
FatalErrorIn
(
"const Foam::volScalarField& Foam::noFilm::Tw() const"
) << "Tw field not available for " << type() << abort(FatalError);
return volScalarField::null();
}
const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::cp() const
{
FatalErrorIn
@ -174,6 +224,17 @@ const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::cp() const
}
const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::kappa() const
{
FatalErrorIn
(
"const volScalarField& noFilm::kappa() const"
) << "kappa field not available for " << type() << abort(FatalError);
return volScalarField::null();
}
const Foam::volScalarField&
Foam::surfaceFilmModels::noFilm::massForPrimary() const
{
@ -200,6 +261,19 @@ Foam::surfaceFilmModels::noFilm::diametersForPrimary() const
}
const Foam::volScalarField&
Foam::surfaceFilmModels::noFilm::massPhaseChangeForPrimary() const
{
FatalErrorIn
(
"const volScalarField& noFilm::massPhaseChangeForPrimary() const"
) << "massPhaseChangeForPrimary field not available for " << type()
<< abort(FatalError);
return volScalarField::null();
}
void Foam::surfaceFilmModels::noFilm::info() const
{
// do nothing

View File

@ -132,12 +132,27 @@ public:
//- Return the film density [kg/m3]
virtual const volScalarField& rho() const;
//- Return the film temperature [K]
//- Return the film surface velocity [m/s]
virtual const volVectorField& Us() const;
//- Return the film wall velocity [m/s]
virtual const volVectorField& Uw() const;
//- Return the film mean temperature [K]
virtual const volScalarField& T() const;
//- Return the film surface temperature [K]
virtual const volScalarField& Ts() const;
//- Return the film wall temperature [K]
virtual const volScalarField& Tw() const;
//- Return the film specific heat capacity [J/kg/K]
virtual const volScalarField& cp() const;
//- Return the film thermal conductivity [W/m/K]
virtual const volScalarField& kappa() const;
// Transfer fields - to the primary region
@ -147,8 +162,14 @@ public:
//- Return the parcel diameters originating from film
virtual const volScalarField& diametersForPrimary() const;
//- Return the film mass evolved via phase change
virtual const volScalarField& massPhaseChangeForPrimary() const;
// Evolution
// Evolution
//- Pre-evolve film hook
virtual void preEvolveFilm();
//- Evolve the film equations
virtual void evolveFilm();

View File

@ -38,6 +38,22 @@ namespace Foam
}
}
template<>
const char*
Foam::NamedEnum<Foam::surfaceFilmModels::surfaceFilmModel::thermoModelType, 2>::
names[] =
{
"constant",
"singleComponent"
};
const
Foam::NamedEnum<Foam::surfaceFilmModels::surfaceFilmModel::thermoModelType, 2>
Foam::surfaceFilmModels::surfaceFilmModel::thermoModelTypeNames_;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
bool Foam::surfaceFilmModels::surfaceFilmModel::read()
@ -74,7 +90,7 @@ Foam::surfaceFilmModels::surfaceFilmModel::surfaceFilmModel
"surfaceFilmProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
@ -83,7 +99,8 @@ Foam::surfaceFilmModels::surfaceFilmModel::surfaceFilmModel
active_(false),
g_(g),
filmRegionName_("none"),
coeffs_(dictionary::null)
coeffs_(dictionary::null),
thermoModel_(tmConstant)
{}
@ -101,7 +118,7 @@ Foam::surfaceFilmModels::surfaceFilmModel::surfaceFilmModel
"surfaceFilmProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
@ -111,7 +128,8 @@ Foam::surfaceFilmModels::surfaceFilmModel::surfaceFilmModel
active_(lookup("active")),
g_(g),
filmRegionName_(lookup("filmRegionName")),
coeffs_(subDict(type + "Coeffs"))
coeffs_(subDict(type + "Coeffs")),
thermoModel_(thermoModelTypeNames_.read(coeffs_.lookup("thermoModel")))
{}
@ -152,6 +170,9 @@ void Foam::surfaceFilmModels::surfaceFilmModel::evolve()
// Update any input information
read();
// Pre-evolve
preEvolveFilm();
// Increment the film equations up to the new time level
evolveFilm();
@ -163,4 +184,40 @@ void Foam::surfaceFilmModels::surfaceFilmModel::evolve()
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::surfaceFilmModel::Srho() const
{
notImplemented
(
"Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> > "
"Foam::surfaceFilmModels::surfaceFilmModel::Srho() const"
)
return tmp<DimensionedField<scalar, volMesh> >(NULL);
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::surfaceFilmModel::Srho(const label) const
{
notImplemented
(
"Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> > "
"Foam::surfaceFilmModels::surfaceFilmModel::Srho(const label) const"
)
return tmp<DimensionedField<scalar, volMesh> >(NULL);
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::surfaceFilmModel::Sh() const
{
notImplemented
(
"Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> > "
"Foam::surfaceFilmModels::surfaceFilmModel::Sh() const"
)
return tmp<DimensionedField<scalar, volMesh> >(NULL);
}
// ************************************************************************* //

View File

@ -40,7 +40,9 @@ SourceFiles
#include "dimensionedVector.H"
#include "runTimeSelectionTables.H"
#include "volFieldsFwd.H"
#include "DimensionedField.H"
#include "labelList.H"
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -62,6 +64,21 @@ class surfaceFilmModel
:
public IOdictionary
{
public:
// Data types
//- Enumeration listing the possible thermo types
enum thermoModelType
{
tmConstant,
tmSingleComponent
};
//- Named enumeration for the thermoType
static const NamedEnum<thermoModelType, 2> thermoModelTypeNames_;
private:
// Private Member Functions
@ -95,15 +112,15 @@ protected:
//- Model coefficients dictionary
dictionary coeffs_;
//- Thermo type
thermoModelType thermoModel_;
// Protected member functions
//- Read control parameters from dictionary
virtual bool read();
//- Evolve the film
virtual void evolveFilm() = 0;
public:
@ -170,6 +187,9 @@ public:
//- Return the model coefficients dictionary
inline const dictionary& coeffs() const;
//- Return the thermo type
inline const thermoModelType& thermoModel() const;
//- Return the film mesh database
virtual const fvMesh& film() const = 0;
@ -202,15 +222,30 @@ public:
//- Return the film velocity [m/s]
virtual const volVectorField& U() const = 0;
//- Return the film surface velocity [m/s]
virtual const volVectorField& Us() const = 0;
//- Return the film wall velocity [m/s]
virtual const volVectorField& Uw() const = 0;
//- Return the film density [kg/m3]
virtual const volScalarField& rho() const = 0;
//- Return the film temperature [K]
//- Return the film mean temperature [K]
virtual const volScalarField& T() const = 0;
//- Return the film specific heat capacity [J/kg/K]
//- Return the film surface temperature [K]
virtual const volScalarField& Ts() const = 0;
//- Return the film wall temperature [K]
virtual const volScalarField& Tw() const = 0;
//- Return the film specific heat capacity [J/kg/K]
virtual const volScalarField& cp() const = 0;
//- Return the film thermal conductivity [W/m/K]
virtual const volScalarField& kappa() const = 0;
// Transfer fields - to the primary region
@ -220,14 +255,41 @@ public:
//- Return the parcel diameters originating from film
virtual const volScalarField& diametersForPrimary() const = 0;
//- Return the film mass evolved via phase change
virtual const volScalarField& massPhaseChangeForPrimary()
const = 0;
// Evolution
//- Evolve the film
virtual void evolve();
//- Pre-evolve film hook
virtual void preEvolveFilm() = 0;
// I-O
//- Evolve the film
virtual void evolveFilm() = 0;
// Source fields
// Mapped into primary region
//- Return total mass source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho() const;
//- Return mass source for specie i - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho
(
const label i
) const;
//- Return enthalpy source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Sh() const;
// I-O
//- Provide some feedback
virtual void info() const = 0;

View File

@ -41,4 +41,11 @@ Foam::surfaceFilmModels::surfaceFilmModel::coeffs() const
}
inline const Foam::surfaceFilmModels::surfaceFilmModel::thermoModelType&
Foam::surfaceFilmModels::surfaceFilmModel::thermoModel() const
{
return thermoModel_;
}
// ************************************************************************* //

View File

@ -36,22 +36,24 @@ Foam::surfaceFilmModels::surfaceFilmModel::New
const dimensionedVector& g
)
{
// get model name, but do not register the dictionary
const word modelType
(
IOdictionary
word modelType;
{
IOdictionary surfaceFilmPropertiesDict
(
IOobject
(
"surfaceFilmProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
).lookup("surfaceFilmModel")
);
);
surfaceFilmPropertiesDict.lookup("surfaceFilmModel") >> modelType;
}
Info<< "Selecting surfaceFilmModel " << modelType << endl;

View File

@ -27,11 +27,13 @@ License
#include "fvcDiv.H"
#include "fvcLaplacian.H"
#include "fvm.H"
#include "phaseChangeModel.H"
#include "addToRunTimeSelectionTable.H"
#include "zeroGradientFvPatchFields.H"
#include "directMappedWallPolyPatch.H"
// Sub-models
#include "injectionModel.H"
#include "heatTransferModel.H"
#include "phaseChangeModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -49,30 +51,8 @@ namespace Foam
bool Foam::surfaceFilmModels::thermoSingleLayer::read()
{
if (kinematicSingleLayer::read())
{
coeffs_.lookup("htcw") >> htcw_;
coeffs_.lookup("htcs") >> htcs_;
return true;
}
else
{
return false;
}
}
void Foam::surfaceFilmModels::thermoSingleLayer::initialise()
{
if (debug)
{
Pout<< "thermoSingleLayer::initialise()" << endl;
}
kinematicSingleLayer::initialise();
hs_ == hs(T_);
// no additional properties to read
return kinematicSingleLayer::read();
}
@ -84,13 +64,95 @@ void Foam::surfaceFilmModels::thermoSingleLayer::resetPrimaryRegionSourceTerms()
}
void Foam::surfaceFilmModels::thermoSingleLayer::correctThermoFields()
{
switch (thermoModel_)
{
case tmConstant:
{
rho_ == dimensionedScalar(coeffs_.lookup("rho0"));
mu_ == dimensionedScalar(coeffs_.lookup("mu0"));
sigma_ == dimensionedScalar(coeffs_.lookup("sigma0"));
cp_ == dimensionedScalar(coeffs_.lookup("cp0"));
kappa_ == dimensionedScalar(coeffs_.lookup("kappa0"));
break;
}
case tmSingleComponent:
{
const liquid& liq = thermo_.liquids().properties()[liquidId_];
forAll(rho_, cellI)
{
const scalar T = T_[cellI];
const scalar p = pPrimary_[cellI];
rho_[cellI] = liq.rho(p, T);
mu_[cellI] = liq.mu(p, T);
sigma_[cellI] = liq.sigma(p, T);
cp_[cellI] = liq.cp(p, T);
kappa_[cellI] = liq.K(p, T);
}
rho_.correctBoundaryConditions();
mu_.correctBoundaryConditions();
sigma_.correctBoundaryConditions();
cp_.correctBoundaryConditions();
kappa_.correctBoundaryConditions();
break;
}
default:
{
FatalErrorIn
(
"void Foam::surfaceFilmModels::thermoSingleLayer::"
"correctThermoFields()"
) << "Unknown thermoType enumeration" << abort(FatalError);
}
}
}
void Foam::surfaceFilmModels::thermoSingleLayer::updateSurfaceTemperatures()
{
// Push boundary film temperature values into internal field
for (label i=0; i<filmBottomPatchIDs_.size(); i++)
{
label patchI = filmBottomPatchIDs_[i];
const polyPatch& pp = filmRegion_.boundaryMesh()[patchI];
UIndirectList<scalar>(Tw_, pp.faceCells()) =
T_.boundaryField()[patchI];
}
Tw_.correctBoundaryConditions();
// Update film surface temperature
dimensionedScalar deltaSmall("SMALL", dimLength, SMALL);
volScalarField kappaDeltaBy2 = kappa_/(0.5*delta_ + deltaSmall);
Ts_ =
(
// qRad
- massPhaseChangeForPrimary_*hs_/(time_.deltaT()*magSf_)
+ TPrimary_*htcs_->h()
+ kappaDeltaBy2*T_
)
/(
htcs_->h()
+ kappaDeltaBy2
);
Ts_.correctBoundaryConditions();
}
void Foam::surfaceFilmModels::thermoSingleLayer::transferPrimaryRegionFields()
{
kinematicSingleLayer::transferPrimaryRegionFields();
// Update temperature from primary region via direct mapped (coupled)
// Update primary region fileds via direct mapped (coupled)
// boundary conditions
TPrimary_.correctBoundaryConditions();
forAll(YPrimary_, i)
{
YPrimary_[i].correctBoundaryConditions();
}
// Retrieve the source fields from the primary region via direct mapped
// (coupled) boundary conditions
@ -100,20 +162,31 @@ void Foam::surfaceFilmModels::thermoSingleLayer::transferPrimaryRegionFields()
// Convert accummulated source terms into per unit area per unit time
// Note: boundary values will still have original (neat) values
const scalar deltaT = filmRegion_.time().deltaTValue();
const scalar deltaT = time_.deltaTValue();
hsSp_.field() /= magSf_*deltaT;
}
void Foam::surfaceFilmModels::thermoSingleLayer::updateSubmodels()
{
// Update heat transfer coefficient sub-models
htcs_->correct();
htcw_->correct();
// Update phase change
massPhaseChangeForPrimary_ == dimensionedScalar("zero", dimMass, 0.0);
phaseChange_->correct(time_.deltaTValue(), massPhaseChangeForPrimary_);
massPhaseChangeForPrimary_.correctBoundaryConditions();
totalMassPhaseChange_ += sum(massPhaseChangeForPrimary_).value();
// Update kinematic sub-models
kinematicSingleLayer::updateSubmodels();
const dimensionedScalar deltaT = filmRegion_.time().deltaT();
hsSp_ -= massForPrimary_*hs_/magSf_/deltaT;
// Update the sub-models
phaseChange_->correct();
// Update source fields
const dimensionedScalar deltaT = time_.deltaT();
rhoSp_ -= massPhaseChangeForPrimary_/magSf_/deltaT;
USp_ -= massPhaseChangeForPrimary_*U_/magSf_/deltaT;
hsSp_ -= (massForPrimary_ + massPhaseChangeForPrimary_)*hs_/magSf_/deltaT;
}
@ -122,39 +195,12 @@ Foam::tmp<Foam::fvScalarMatrix> Foam::surfaceFilmModels::thermoSingleLayer::q
volScalarField& hs
) const
{
DimensionedField<scalar, volMesh> Tw
(
IOobject
(
"Tw",
time_.timeName(),
filmRegion_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
filmRegion_,
dimensionedScalar("zero", dimTemperature, 0.0)
);
forAll(filmBottomPatchIDs_, i)
{
label patchI = filmBottomPatchIDs_[i];
const polyPatch& pp = filmRegion_.boundaryMesh()[patchI];
UIndirectList<scalar>(Tw, pp.faceCells()) =
TPrimary_.boundaryField()[patchI];
}
// TODO: Use T at film thickness instead of cell value
DimensionedField<scalar, volMesh> Ts =
TPrimary_.dimensionedInternalField();
return
(
- fvm::Sp(htcs_/cp_, hs)
+ htcs_*(dimensionedScalar("Tstd", dimTemperature, 298.15) - Ts)
- fvm::Sp(htcw_/cp_, hs)
+ htcw_*(dimensionedScalar("Tstd", dimTemperature, 298.15) - Tw)
- fvm::Sp(htcs_->h()/cp_, hs)
- htcs_->h()*(dimensionedScalar("Tstd", dimTemperature, 298.15) - Ts_)
- fvm::Sp(htcw_->h()/cp_, hs)
- htcw_->h()*(dimensionedScalar("Tstd", dimTemperature, 298.15) - Tw_)
);
}
@ -166,6 +212,8 @@ void Foam::surfaceFilmModels::thermoSingleLayer::solveEnergy()
Info<< "thermoSingleLayer::solveEnergy()" << endl;
}
updateSurfaceTemperatures();
solve
(
fvm::ddt(deltaRho_, hs_)
@ -174,6 +222,8 @@ void Foam::surfaceFilmModels::thermoSingleLayer::solveEnergy()
hsSp_
+ q(hs_)
);
correctThermoFields();
}
@ -187,6 +237,8 @@ Foam::surfaceFilmModels::thermoSingleLayer::thermoSingleLayer
)
:
kinematicSingleLayer(modelType, mesh, g),
thermo_(mesh.lookupObject<SLGThermo>("SLGThermo")),
liquidId_(thermo_.liquidId(coeffs_.lookup("liquid"))),
cp_
(
IOobject
@ -195,19 +247,30 @@ Foam::surfaceFilmModels::thermoSingleLayer::thermoSingleLayer
time_.timeName(),
filmRegion_,
IOobject::NO_READ,
IOobject::NO_WRITE
IOobject::AUTO_WRITE
),
filmRegion_,
dimensionedScalar(coeffs_.lookup("cp"))
dimensionedScalar("cp", dimEnergy/dimMass/dimTemperature, 0.0),
zeroGradientFvPatchScalarField::typeName
),
htcw_
kappa_
(
dimensionedScalar("htc", dimEnergy/dimTime/dimArea/dimTemperature, 0.0)
),
htcs_
(
dimensionedScalar("htc", dimEnergy/dimTime/dimArea/dimTemperature, 0.0)
IOobject
(
"kappa",
time_.timeName(),
filmRegion_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
filmRegion_,
dimensionedScalar
(
"kappa",
dimEnergy/dimTime/dimLength/dimTemperature,
0.0
),
zeroGradientFvPatchScalarField::typeName
),
T_
@ -222,6 +285,32 @@ Foam::surfaceFilmModels::thermoSingleLayer::thermoSingleLayer
),
filmRegion_
),
Ts_
(
IOobject
(
"Tsf",
time_.timeName(),
filmRegion_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
T_,
zeroGradientFvPatchScalarField::typeName
),
Tw_
(
IOobject
(
"Twf",
time_.timeName(),
filmRegion_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
T_,
zeroGradientFvPatchScalarField::typeName
),
hs_
(
IOobject
@ -279,13 +368,46 @@ Foam::surfaceFilmModels::thermoSingleLayer::thermoSingleLayer
filmRegion_
),
YPrimary_(),
htcs_
(
heatTransferModel::New(*this, coeffs_.subDict("upperSurfaceModels"))
),
htcw_
(
heatTransferModel::New(*this, coeffs_.subDict("lowerSurfaceModels"))
),
phaseChange_(phaseChangeModel::New(*this, coeffs_)),
hsSpDetach_(filmRegion_.nCells(), 0.0)
totalMassPhaseChange_(0.0)
{
read();
if (thermo_.hasMultiComponentCarrier())
{
YPrimary_.setSize(thermo_.carrier().species().size());
forAll(thermo_.carrier().species(), i)
{
YPrimary_.set
(
i,
new volScalarField
(
IOobject
(
thermo_.carrier().species()[i],
time_.timeName(),
filmRegion_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
filmRegion_,
dimensionedScalar("zero", dimless, 0.0),
pSp_.boundaryField().types()
)
);
}
}
initialise();
}
@ -326,6 +448,25 @@ void Foam::surfaceFilmModels::thermoSingleLayer::addSources
}
void Foam::surfaceFilmModels::thermoSingleLayer::preEvolveFilm()
{
if (!initialisedThermo_)
{
// Retreive pressure from primary region
pPrimary_.correctBoundaryConditions();
// Correct (temperature dependent) thermo fields
correctThermoFields();
// Update derived fields
hs_ == hs(T_);
deltaRho_ == delta_*rho_;
phi_ = fvc::interpolate(deltaRho_*U_) & filmRegion_.Sf();
initialisedThermo_ = true;
}
}
void Foam::surfaceFilmModels::thermoSingleLayer::evolveFilm()
{
transferPrimaryRegionFields();
@ -338,22 +479,22 @@ void Foam::surfaceFilmModels::thermoSingleLayer::evolveFilm()
for (int oCorr=0; oCorr<nOuterCorr_; oCorr++)
{
// Explicit pressure source contribution
tmp<volScalarField> pu = this->pu();
tmp<volScalarField> tpu = this->pu();
// Implicit pressure source coefficient
tmp<volScalarField> pp = this->pp();
tmp<volScalarField> tpp = this->pp();
// Solve for momentum for U_
tmp<fvVectorMatrix> UEqn = solveMomentum(pu(), pp());
tmp<fvVectorMatrix> UEqn = solveMomentum(tpu(), tpp());
// Solve energy for hs_
solveEnergy();
// Film thickness correction loop
for (int corr=1; corr<=nCorr_; corr++)
{
// Solve energy for hs_
solveEnergy();
// Solve thickness for delta_
solveThickness(pu(), pp(), UEqn());
solveThickness(tpu(), tpp(), UEqn());
}
}
@ -363,11 +504,31 @@ void Foam::surfaceFilmModels::thermoSingleLayer::evolveFilm()
// Update temperature using latest hs_
T_ == T(hs_);
// Update film wall and surface velocities
updateSurfaceVelocities();
// Update film wall and surface temperatures
updateSurfaceTemperatures();
// Reset source terms for next time integration
resetPrimaryRegionSourceTerms();
}
const Foam::volScalarField&
Foam::surfaceFilmModels::thermoSingleLayer::cp() const
{
return cp_;
}
const Foam::volScalarField&
Foam::surfaceFilmModels::thermoSingleLayer::kappa() const
{
return kappa_;
}
const Foam::volScalarField&
Foam::surfaceFilmModels::thermoSingleLayer::T() const
{
@ -376,9 +537,23 @@ Foam::surfaceFilmModels::thermoSingleLayer::T() const
const Foam::volScalarField&
Foam::surfaceFilmModels::thermoSingleLayer::cp() const
Foam::surfaceFilmModels::thermoSingleLayer::Ts() const
{
return cp_;
return Ts_;
}
const Foam::volScalarField&
Foam::surfaceFilmModels::thermoSingleLayer::Tw() const
{
return Tw_;
}
const Foam::volScalarField&
Foam::surfaceFilmModels::thermoSingleLayer::hs() const
{
return hs_;
}
@ -386,8 +561,128 @@ void Foam::surfaceFilmModels::thermoSingleLayer::info() const
{
kinematicSingleLayer::info();
Info<< indent<< "min/max(T) = " << min(T_).value() << ", "
<< max(T_).value() << nl;
Info<< indent << "min/max(T) = " << min(T_).value() << ", "
<< max(T_).value() << nl
<< indent << "mass phase change = "
<< returnReduce(totalMassPhaseChange_, sumOp<scalar>()) << nl;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::thermoSingleLayer::Srho(const label i) const
{
const label vapId =
thermo_.carrierId(thermo_.liquids().components()[liquidId_]);
tmp<DimensionedField<scalar, volMesh> > tSrho
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"thermoSingleLayer::Srho(i)",
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
);
if (vapId == i)
{
scalarField& Srho = tSrho();
const scalarField& V = mesh_.V();
const scalar dt = time_.deltaTValue();
forAll(filmBottomPatchIDs_, i)
{
const label primaryPatchI = primaryPatchIDs_[i];
const directMappedWallPolyPatch& wpp =
refCast<const directMappedWallPolyPatch>
(
mesh_.boundaryMesh()[primaryPatchI]
);
const mapDistribute& distMap = wpp.map();
const label filmPatchI = filmBottomPatchIDs_[i];
scalarField patchMass =
massPhaseChangeForPrimary().boundaryField()[filmPatchI];
distMap.distribute(patchMass);
const unallocLabelList& cells = wpp.faceCells();
forAll(patchMass, j)
{
Srho[cells[j]] = patchMass[j]/(V[cells[j]]*dt);
}
}
}
return tSrho;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::surfaceFilmModels::thermoSingleLayer::Sh() const
{
tmp<DimensionedField<scalar, volMesh> > tSh
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
"thermoSingleLayer::Sh",
time_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0)
)
);
scalarField& Sh = tSh();
const scalarField& V = mesh_.V();
const scalar dt = time_.deltaTValue();
forAll(filmBottomPatchIDs_, i)
{
const label primaryPatchI = primaryPatchIDs_[i];
const directMappedWallPolyPatch& wpp =
refCast<const directMappedWallPolyPatch>
(
mesh_.boundaryMesh()[primaryPatchI]
);
const mapDistribute& distMap = wpp.map();
const label filmPatchI = filmBottomPatchIDs_[i];
scalarField patchMass =
massPhaseChangeForPrimary().boundaryField()[filmPatchI];
distMap.distribute(patchMass);
scalarField patchEnthalpy = hs_.boundaryField()[filmPatchI];
distMap.distribute(patchEnthalpy);
const unallocLabelList& cells = wpp.faceCells();
forAll(patchMass, j)
{
Sh[cells[j]] += patchMass[j]*patchEnthalpy[j]/(V[cells[j]]*dt);
}
}
return tSh;
}

View File

@ -40,6 +40,7 @@ SourceFiles
#define thermoSingleLayer_H
#include "kinematicSingleLayer.H"
#include "SLGThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,6 +50,7 @@ namespace surfaceFilmModels
{
// Forward declaration of classes
class heatTransferModel;
class phaseChangeModel;
/*---------------------------------------------------------------------------*\
@ -74,29 +76,36 @@ protected:
// Protected data
// Thermo properties TODO: currently read from coeffs dictionary
// Thermo properties
//- Specific heat capacity / [J/kg/K]
volScalarField cp_;
//- Reference to the SLGThermo
const SLGThermo& thermo_;
// Single component
//- Id of component in thermo database
label liquidId_;
// Model parameters
// Fields
//- Heat transfer coefficient bewteen wall and film [W/m2/K]
dimensionedScalar htcw_;
//- Specific heat capacity / [J/kg/K]
volScalarField cp_;
//- Heat transfer coefficient bewteen film surface and primary
// region [W/m2/K]
dimensionedScalar htcs_;
//- Thermal conductivity / [W/m/K]
volScalarField kappa_;
//- Temperature - mean / [K]
volScalarField T_;
// Fields
//- Temperature - surface / [K]
volScalarField Ts_;
//- Temperature / [K]
volScalarField T_;
//- Temperature - wall / [K]
volScalarField Tw_;
//- Sensible)enthalpy / [J/kg]
volScalarField hs_;
//- Sensible enthalpy / [J/kg]
volScalarField hs_;
// Source term fields
@ -122,27 +131,37 @@ protected:
//- Temperature / [K]
volScalarField TPrimary_;
//- List of specie mass fractions / [0-1]
PtrList<volScalarField> YPrimary_;
// Sub-models
//- Heat transfer coefficient bewteen film surface and primary
// region [W/m2/K]
autoPtr<heatTransferModel> htcs_;
//- Heat transfer coefficient bewteen wall and film [W/m2/K]
autoPtr<heatTransferModel> htcw_;
//- Phase change
autoPtr<phaseChangeModel> phaseChange_;
// Detached surface properties
//- Energy sink from film to carrier phase [kg]
scalarField hsSpDetach_;
//- Total mass transferred to primary region [kg]
scalar totalMassPhaseChange_;
// Protected member functions
//- Initialise the film model - called on construction
void initialise();
//- Read control parameters from dictionary
virtual bool read();
//- Correct the thermo fields
virtual void correctThermoFields();
//- Correct the film surface and wall temperatures
virtual void updateSurfaceTemperatures();
//- Reset source term fields
virtual void resetPrimaryRegionSourceTerms();
@ -185,38 +204,51 @@ public:
// Member Functions
// Model parameters
//- Return the heat transfer coefficient bewteen wall and film
inline const dimensionedScalar& htcw() const;
//- Return the Heat transfer coefficient bewteen film surface and
// primary region
inline const dimensionedScalar& htcs() const;
// Thermo properties
//- Return sensible enthalpy as a function of temperature
inline tmp<Foam::volScalarField> hs
(
const volScalarField& T
) const;
//- Return const reference to the SLGThermo object
inline const SLGThermo& thermo() const;
//- Return temperature as a function of sensible enthalpy
inline tmp<Foam::volScalarField> T
(
const volScalarField& hs
) const;
// Single component
//- Return the Id of component in thermo database
inline label liquidId() const;
// Fields
// Fields
//- Return the film temperature [K]
virtual const volScalarField& T() const;
//- Return the film specific heat capacity [J/kg/K]
virtual const volScalarField& cp() const;
//- Return the film specific heat capacity [J/kg/K]
virtual const volScalarField& cp() const;
//- Return the film thermal conductivity [W/m/K]
virtual const volScalarField& kappa() const;
//- Return the film mean temperature [K]
virtual const volScalarField& T() const;
//- Return the film surface temperature [K]
virtual const volScalarField& Ts() const;
//- Return the film wall temperature [K]
virtual const volScalarField& Tw() const;
//- Return the film sensible enthalpy [J/kg]
virtual const volScalarField& hs() const;
// Helper functions
//- Return sensible enthalpy as a function of temperature
inline tmp<Foam::volScalarField> hs
(
const volScalarField& T
) const;
//- Return temperature as a function of sensible enthalpy
inline tmp<Foam::volScalarField> T
(
const volScalarField& hs
) const;
// Source fields (read/write access)
@ -233,30 +265,65 @@ public:
);
// Primary region
//- Energy / [J/m2/s]
inline volScalarField& hsSpPrimary();
// Source term fields
// Film region
//- Energy / [J/m2/s]
inline volScalarField& hsSp();
inline const volScalarField& hsSp() const;
// Primary region
//- Energy / [J/m2/s]
inline const volScalarField& hsSpPrimary() const;
// Fields mapped from the primary region
//- Temperature / [K]
inline const volScalarField& TPrimary() const;
//- Specie mass fractions / [0-1]
inline const PtrList<volScalarField>& YPrimary() const;
// Sub-models
//- Phase change
inline phaseChangeModel& phaseChange();
//- Return const access to the (surface) heat transfer model
inline const heatTransferModel& htcs() const;
//- Return const access to the (wall) heat transfer model
inline const heatTransferModel& htcw() const;
//- Return const access to the phawse change model
inline const phaseChangeModel& phaseChange() const;
// Evolution
//- Pre-evolve film hook
virtual void preEvolveFilm();
//- Evolve the film equations
virtual void evolveFilm();
// Source fields
// Mapped into primary region
//- Return mass source for specie i - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Srho
(
const label i
) const;
//- Return enthalpy source - Eulerian phase only
virtual tmp<DimensionedField<scalar, volMesh> > Sh() const;
// I-O
//- Provide some feedback

View File

@ -27,17 +27,16 @@ License
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::dimensionedScalar&
Foam::surfaceFilmModels::thermoSingleLayer::htcw() const
inline const Foam::SLGThermo&
Foam::surfaceFilmModels::thermoSingleLayer::thermo() const
{
return htcw_;
return thermo_;
}
inline const Foam::dimensionedScalar&
Foam::surfaceFilmModels::thermoSingleLayer::htcs() const
inline Foam::label Foam::surfaceFilmModels::thermoSingleLayer::liquidId() const
{
return htcs_;
return liquidId_;
}
@ -59,7 +58,8 @@ Foam::surfaceFilmModels::thermoSingleLayer::hs
IOobject::NO_READ,
IOobject::NO_WRITE
),
cp_*(T - (dimensionedScalar("Tstd", dimTemperature, 298.15)))
cp_*(T - (dimensionedScalar("Tstd", dimTemperature, 298.15))),
zeroGradientFvPatchScalarField::typeName
)
);
}
@ -83,28 +83,57 @@ Foam::surfaceFilmModels::thermoSingleLayer::T
IOobject::NO_READ,
IOobject::NO_WRITE
),
hs/cp_ + dimensionedScalar("Tstd", dimTemperature, 298.15)
hs/cp_ + dimensionedScalar("Tstd", dimTemperature, 298.15),
zeroGradientFvPatchScalarField::typeName
)
);
}
inline Foam::volScalarField&
Foam::surfaceFilmModels::thermoSingleLayer::hsSpPrimary()
{
return hsSpPrimary_;
}
inline Foam::volScalarField&
Foam::surfaceFilmModels::thermoSingleLayer::hsSp()
inline const Foam::volScalarField&
Foam::surfaceFilmModels::thermoSingleLayer::hsSp() const
{
return hsSp_;
}
inline Foam::surfaceFilmModels::phaseChangeModel&
Foam::surfaceFilmModels::thermoSingleLayer::phaseChange()
inline const Foam::volScalarField&
Foam::surfaceFilmModels::thermoSingleLayer::hsSpPrimary() const
{
return hsSpPrimary_;
}
inline const Foam::volScalarField&
Foam::surfaceFilmModels::thermoSingleLayer::TPrimary() const
{
return TPrimary_;
}
inline const Foam::PtrList<Foam::volScalarField>&
Foam::surfaceFilmModels::thermoSingleLayer::YPrimary() const
{
return YPrimary_;
}
inline const Foam::surfaceFilmModels::heatTransferModel&
Foam::surfaceFilmModels::thermoSingleLayer::htcs() const
{
return htcs_();
}
inline const Foam::surfaceFilmModels::heatTransferModel&
Foam::surfaceFilmModels::thermoSingleLayer::htcw() const
{
return htcw_();
}
inline const Foam::surfaceFilmModels::phaseChangeModel&
Foam::surfaceFilmModels::thermoSingleLayer::phaseChange() const
{
return phaseChange_();
}