diff --git a/src/surfaceFilmModels/Make/files b/src/surfaceFilmModels/Make/files index cbaf49b810..8b84a94e14 100644 --- a/src/surfaceFilmModels/Make/files +++ b/src/surfaceFilmModels/Make/files @@ -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 diff --git a/src/surfaceFilmModels/Make/options b/src/surfaceFilmModels/Make/options index d27c95d033..bd04197ec3 100644 --- a/src/surfaceFilmModels/Make/options +++ b/src/surfaceFilmModels/Make/options @@ -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 diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C index 0f5c3db7c1..9c84101d85 100644 --- a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C @@ -111,10 +111,8 @@ void directMappedFixedInternalValueFvPatchField::updateCoeffs() directMappedFixedValueFvPatchField::updateCoeffs(); // Get the coupling information from the directMappedPatchBase - const directMappedPatchBase& mpp = refCast - ( - this->patch().patch() - ); + const directMappedPatchBase& mpp = + refCast(this->patch().patch()); const polyMesh& nbrMesh = mpp.sampleMesh(); const fvPatch& nbrPatch = refCast diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.C b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.C new file mode 100644 index 0000000000..0be8a36bd1 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "directMappedNamedFixedValueFvPatchField.H" +#include "directMappedPatchBase.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +directMappedNamedFixedValueFvPatchField:: +directMappedNamedFixedValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF +) +: + fixedValueFvPatchField(p, iF), + fieldName_(iF.name()), + setAverage_(false), + average_(pTraits::zero) +{} + + +template +directMappedNamedFixedValueFvPatchField:: +directMappedNamedFixedValueFvPatchField +( + const directMappedNamedFixedValueFvPatchField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchField(ptf, p, iF, mapper), + fieldName_(ptf.fieldName_), + setAverage_(ptf.setAverage_), + average_(ptf.average_) +{ + if (!isA(this->patch().patch())) + { + FatalErrorIn + ( + "directMappedNamedFixedValueFvPatchField::" + "directMappedNamedFixedValueFvPatchField\n" + "(\n" + " const directMappedNamedFixedValueFvPatchField&,\n" + " const fvPatch&,\n" + " const Field&,\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 +directMappedNamedFixedValueFvPatchField:: +directMappedNamedFixedValueFvPatchField +( + const fvPatch& p, + const DimensionedField& iF, + const dictionary& dict +) +: + fixedValueFvPatchField(p, iF, dict), + fieldName_(dict.lookupOrDefault("fieldName", iF.name())), + setAverage_(readBool(dict.lookup("setAverage"))), + average_(pTraits(dict.lookup("average"))) +{ + if (!isA(this->patch().patch())) + { + FatalErrorIn + ( + "directMappedNamedFixedValueFvPatchField::" + "directMappedNamedFixedValueFvPatchField" + "(" + " const fvPatch&, " + " const DimensionedField& 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 + //( + // this->patch().patch() + //); + //(void)mpp.map().schedule(); +} + + +template +directMappedNamedFixedValueFvPatchField:: +directMappedNamedFixedValueFvPatchField +( + const directMappedNamedFixedValueFvPatchField& ptf +) +: + fixedValueFvPatchField(ptf), + fieldName_(ptf.fieldName_), + setAverage_(ptf.setAverage_), + average_(ptf.average_) +{} + + +template +directMappedNamedFixedValueFvPatchField:: +directMappedNamedFixedValueFvPatchField +( + const directMappedNamedFixedValueFvPatchField& ptf, + const DimensionedField& iF +) +: + fixedValueFvPatchField(ptf, iF), + fieldName_(ptf.fieldName_), + setAverage_(ptf.setAverage_), + average_(ptf.average_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void directMappedNamedFixedValueFvPatchField::updateCoeffs() +{ + if (this->updated()) + { + return; + } + + typedef GeometricField fieldType; + + // Get the scheduling information from the directMappedPatchBase + const directMappedPatchBase& mpp = refCast + ( + directMappedNamedFixedValueFvPatchField::patch().patch() + ); + const mapDistribute& distMap = mpp.map(); + + // Force recalculation of schedule + (void)distMap.schedule(); + + const fvMesh& nbrMesh = refCast(mpp.sampleMesh()); + + // Result of obtaining remote values + Field newValues; + + switch (mpp.mode()) + { + case directMappedPatchBase::NEARESTCELL: + { + if (mpp.sameRegion()) + { + newValues = this->internalField(); + } + else + { + newValues = nbrMesh.lookupObject + ( + 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::" + "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(fieldName_); + newValues = nbrField.boundaryField()[nbrPatchID]; + mapDistribute::distribute + ( + Pstream::defaultCommsType, + distMap.schedule(), + distMap.constructSize(), + distMap.subMap(), + distMap.constructMap(), + newValues + ); + + break; + } + case directMappedPatchBase::NEARESTFACE: + { + Field allValues(nbrMesh.nFaces(), pTraits::zero); + + const fieldType& nbrField = + nbrMesh.lookupObject(fieldName_); + forAll(nbrField.boundaryField(), patchI) + { + const fvPatchField& 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::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::updateCoeffs(); +} + + +template +void directMappedNamedFixedValueFvPatchField::write(Ostream& os) const +{ + fvPatchField::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 + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.H new file mode 100644 index 0000000000..711ed1ec98 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchField.H @@ -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 . + +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 directMappedNamedFixedValueFvPatchField +: + public fixedValueFvPatchField +{ + // 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& + ); + + //- Construct from patch, internal field and dictionary + directMappedNamedFixedValueFvPatchField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given directMappedNamedFixedValueFvPatchField + // onto a new patch + directMappedNamedFixedValueFvPatchField + ( + const directMappedNamedFixedValueFvPatchField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + directMappedNamedFixedValueFvPatchField + ( + const directMappedNamedFixedValueFvPatchField& + ); + + //- Construct and return a clone + virtual tmp > clone() const + { + return tmp > + ( + new directMappedNamedFixedValueFvPatchField(*this) + ); + } + + //- Construct as copy setting internal field reference + directMappedNamedFixedValueFvPatchField + ( + const directMappedNamedFixedValueFvPatchField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp > clone + ( + const DimensionedField& iF + ) const + { + return tmp > + ( + new directMappedNamedFixedValueFvPatchField(*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 + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.C b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.C new file mode 100644 index 0000000000..849cc55825 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "directMappedNamedFixedValueFvPatchFields.H" +#include "volMesh.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(directMappedNamedFixedValue); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.H new file mode 100644 index 0000000000..2f815fb81a --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFields.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedNamedFixedValueFvPatchFields_H +#define directMappedNamedFixedValueFvPatchFields_H + +#include "directMappedNamedFixedValueFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(directMappedNamedFixedValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFieldsFwd.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFieldsFwd.H new file mode 100644 index 0000000000..c7d6e5c11c --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamedFixedValueFvPatchFieldsFwd.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedNamedFixedValueFvPatchFieldsFwd_H +#define directMappedNamedFixedValueFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class directMappedNamedFixedValueFvPatchField; + +makePatchTypeFieldTypedefs(directMappedNamedFixedValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamesFixedValueFvPatchFieldsFwd.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamesFixedValueFvPatchFieldsFwd.H new file mode 100644 index 0000000000..c7d6e5c11c --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedNamedFixedValue/directMappedNamesFixedValueFvPatchFieldsFwd.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedNamedFixedValueFvPatchFieldsFwd_H +#define directMappedNamedFixedValueFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template class directMappedNamedFixedValueFvPatchField; + +makePatchTypeFieldTypedefs(directMappedNamedFixedValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.C b/src/surfaceFilmModels/derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.C new file mode 100644 index 0000000000..c8ca479b6a --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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& iF +) +: + fixedValueFvPatchScalarField(p, iF), + L_(1.0) +{} + + +htcConvFvPatchScalarField::htcConvFvPatchScalarField +( + const htcConvFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchScalarField(ptf, p, iF, mapper), + L_(ptf.L_) +{} + + +htcConvFvPatchScalarField::htcConvFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& 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& 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("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::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 + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.H b/src/surfaceFilmModels/derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.H new file mode 100644 index 0000000000..4b5585e578 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/htcConv/htcConvFvPatchScalarField.H @@ -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 . + +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& + ); + + //- Construct from patch, internal field and dictionary + htcConvFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // htcConvFvPatchScalarField + // onto a new patch + htcConvFvPatchScalarField + ( + const htcConvFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + htcConvFvPatchScalarField + ( + const htcConvFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new htcConvFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + htcConvFvPatchScalarField + ( + const htcConvFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + 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 + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.C b/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..3a43ceaa7a --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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& 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& 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& 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& 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 + ("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 + ("surfaceFilmProperties"); + + const directMappedWallPolyPatch& wpp = + refCast(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("RASProperties"); + + const scalarField& y = rasModel.y()[patchI]; + const scalarField& rhow = rasModel.rho().boundaryField()[patchI]; + const tmp 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::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 + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.H b/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..c899e853da --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/alphatFilmWallFunction/alphatFilmWallFunctionFvPatchScalarField.H @@ -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 . + +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& + ); + + //- Construct from patch, internal field and dictionary + alphatFilmWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // alphatFilmWallFunctionFvPatchScalarField + // onto a new patch + alphatFilmWallFunctionFvPatchScalarField + ( + const alphatFilmWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + alphatFilmWallFunctionFvPatchScalarField + ( + const alphatFilmWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new alphatFilmWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + alphatFilmWallFunctionFvPatchScalarField + ( + const alphatFilmWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + 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 + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/mutFilmWallFunction/mutFilmWallFunctionFvPatchScalarField.C b/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/mutFilmWallFunction/mutFilmWallFunctionFvPatchScalarField.C new file mode 100644 index 0000000000..f7a44c586a --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/mutFilmWallFunction/mutFilmWallFunctionFvPatchScalarField.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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 mutFilmWallFunctionFvPatchScalarField::calcUTau +( + const scalarField& magGradU +) const +{ + tmp tuTau(new scalarField(patch().size(), 0.0)); + scalarField& uTau = tuTau(); + + bool ok = + db().objectRegistry::foundObject + ("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 + ("surfaceFilmProperties"); + + const directMappedWallPolyPatch& wpp = + refCast(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("RASProperties"); + const scalarField& y = rasModel.y()[patchI]; + const fvPatchScalarField& rhow = rasModel.rho().boundaryField()[patchI]; + const fvPatchScalarField& muw = rasModel.mu().boundaryField()[patchI]; + const tmp 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 mutFilmWallFunctionFvPatchScalarField::calcMut() const +{ + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject("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& iF +) +: + mutkWallFunctionFvPatchScalarField(p, iF), + B_(5.5), + yPlusCrit_(11.05) +{} + + +mutFilmWallFunctionFvPatchScalarField::mutFilmWallFunctionFvPatchScalarField +( + const mutFilmWallFunctionFvPatchScalarField& ptf, + const fvPatch& p, + const DimensionedField& iF, + const fvPatchFieldMapper& mapper +) +: + mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper), + B_(5.5), + yPlusCrit_(11.05) +{} + + +mutFilmWallFunctionFvPatchScalarField::mutFilmWallFunctionFvPatchScalarField +( + const fvPatch& p, + const DimensionedField& 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& iF +) +: + mutkWallFunctionFvPatchScalarField(wfpsf, iF), + B_(wfpsf.B_), + yPlusCrit_(wfpsf.yPlusCrit_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +tmp mutFilmWallFunctionFvPatchScalarField::yPlus() const +{ + const label patchI = patch().index(); + + const RASModel& rasModel = db().lookupObject("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::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 + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/mutFilmWallFunction/mutFilmWallFunctionFvPatchScalarField.H b/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/mutFilmWallFunction/mutFilmWallFunctionFvPatchScalarField.H new file mode 100644 index 0000000000..e6a40f5f78 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/wallFunctions/mutFilmWallFunction/mutFilmWallFunctionFvPatchScalarField.H @@ -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 . + +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 calcMut() const; + + //- Calculate the friction velocity + virtual tmp calcUTau(const scalarField& magGradU) const; + + +public: + + //- Runtime type information + TypeName("mutFilmWallFunction"); + + + // Constructors + + //- Construct from patch and internal field + mutFilmWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField& + ); + + //- Construct from patch, internal field and dictionary + mutFilmWallFunctionFvPatchScalarField + ( + const fvPatch&, + const DimensionedField&, + const dictionary& + ); + + //- Construct by mapping given + // mutFilmWallFunctionFvPatchScalarField + // onto a new patch + mutFilmWallFunctionFvPatchScalarField + ( + const mutFilmWallFunctionFvPatchScalarField&, + const fvPatch&, + const DimensionedField&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + mutFilmWallFunctionFvPatchScalarField + ( + const mutFilmWallFunctionFvPatchScalarField& + ); + + //- Construct and return a clone + virtual tmp clone() const + { + return tmp + ( + new mutFilmWallFunctionFvPatchScalarField(*this) + ); + } + + //- Construct as copy setting internal field reference + mutFilmWallFunctionFvPatchScalarField + ( + const mutFilmWallFunctionFvPatchScalarField&, + const DimensionedField& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp clone + ( + const DimensionedField& iF + ) const + { + return tmp + ( + new mutFilmWallFunctionFvPatchScalarField(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Calculate and return the yPlus at the boundary + virtual tmp yPlus() const; + + + // I-O + + //- Write + virtual void write(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace RASModels +} // End namespace compressible +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/cloudInjection/cloudInjection.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/cloudInjection/cloudInjection.C new file mode 100644 index 0000000000..a1993a7e33 --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/cloudInjection/cloudInjection.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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; + } + } +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/cloudInjection/cloudInjection.H b/src/surfaceFilmModels/submodels/kinematic/injectionModel/cloudInjection/cloudInjection.H new file mode 100644 index 0000000000..01c9f5eedb --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/cloudInjection/cloudInjection.H @@ -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 . + +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 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 + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C index 96d59420ca..fe3e0d9e77 100644 --- a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C @@ -41,8 +41,7 @@ namespace Foam Foam::surfaceFilmModels::injectionModel::injectionModel ( - const surfaceFilmModel& owner, - const dictionary& dict + const surfaceFilmModel& owner ) : owner_(owner), diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H index bc140539bf..a05d028ffd 100644 --- a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H @@ -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 diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelNew.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelNew.C index 07bfb64cdf..7bddebcc8e 100644 --- a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelNew.C +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelNew.C @@ -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; diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C index 39d2c34706..f696f1a1bc 100644 --- a/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C @@ -43,10 +43,10 @@ namespace Foam Foam::surfaceFilmModels::noInjection::noInjection ( const surfaceFilmModel& owner, - const dictionary& dict + const dictionary& ) : - injectionModel(owner, dict) + injectionModel(owner) {} diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C index 58fbd9fe5a..97d9bb00aa 100644 --- a/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C @@ -43,10 +43,10 @@ namespace Foam Foam::surfaceFilmModels::removeInjection::removeInjection ( const surfaceFilmModel& owner, - const dictionary& dict + const dictionary& ) : - injectionModel(owner, dict) + injectionModel(owner) {} diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H index 4fc4a63fc4..9c651560f8 100644 --- a/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H @@ -66,7 +66,7 @@ private: public: //- Runtime type information - TypeName("remove"); + TypeName("removeInjection"); // Constructors diff --git a/src/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.C b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.C new file mode 100644 index 0000000000..682971f3a6 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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::surfaceFilmModels::constantHeatTransfer::h() const +{ + return tmp + ( + 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 + ) + ); +} + + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.H b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.H new file mode 100644 index 0000000000..537e70fae2 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.H @@ -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 . + +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 h() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModel.C b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModel.C new file mode 100644 index 0000000000..b7ee185225 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModel.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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() +{} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModel.H b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModel.H new file mode 100644 index 0000000000..25caf051d9 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModel.H @@ -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 . + +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 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 h() const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "heatTransferModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModelI.H b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModelI.H new file mode 100644 index 0000000000..c9a99ffe29 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModelI.H @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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_; +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModelNew.C b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModelNew.C new file mode 100644 index 0000000000..e16c40afaf --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/heatTransferModel/heatTransferModelNew.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#include "heatTransferModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr +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(cstrIter()(model, dict)); +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveHeatTransfer.C b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveHeatTransfer.C new file mode 100644 index 0000000000..cfe6d577fe --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveHeatTransfer.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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(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::surfaceFilmModels::mappedConvectiveHeatTransfer::h() const +{ + return htcConvFilm_; +} + + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveHeatTransfer.H b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveHeatTransfer.H new file mode 100644 index 0000000000..8f02cb61ba --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/heatTransferModel/mappedConvectiveHeatTransfer/mappedConvectiveHeatTransfer.H @@ -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 . + +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 h() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C index 551bfb2a44..67094e226d 100644 --- a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C @@ -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 } diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H index 487e3c2b3c..22a2a17e47 100644 --- a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H @@ -84,7 +84,7 @@ public: // Evolution //- Correct - virtual void correct(); + virtual void correct(const scalar dt, scalarField& dMass); }; diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C index e2a0b93a75..7e7e310d61 100644 --- a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C @@ -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 * * * * * * * * * * * * * * * // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H index 87a08b1016..8421520d98 100644 --- a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H @@ -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; }; diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelNew.C b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelNew.C index 1ad7bd0b71..7cc04c0027 100644 --- a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelNew.C +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelNew.C @@ -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; diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C new file mode 100644 index 0000000000..9011d02fca --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.C @@ -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 . + +\*---------------------------------------------------------------------------*/ + +#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(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) + ); + } + } + } +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H new file mode 100644 index 0000000000..dd16488e03 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/standardPhaseChange/standardPhaseChange.H @@ -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 . + +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 + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C index 36f2899353..cdfc81d774 100644 --- a/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C @@ -1,1062 +1,1302 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 . - -\*---------------------------------------------------------------------------*/ - -#include "kinematicSingleLayer.H" -#include "fvm.H" -#include "fvcDiv.H" -#include "fvcLaplacian.H" -#include "fvcSnGrad.H" -#include "fvcReconstruct.H" -#include "fvcVolumeIntegrate.H" -#include "addToRunTimeSelectionTable.H" -#include "directMappedWallPolyPatch.H" - -// Sub-models -#include "injectionModel.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - namespace surfaceFilmModels - { - defineTypeNameAndDebug(kinematicSingleLayer, 0); - addToRunTimeSelectionTable - ( - surfaceFilmModel, - kinematicSingleLayer, - mesh - ); - } -} - - -// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // - -bool Foam::surfaceFilmModels::kinematicSingleLayer::read() -{ - if (surfaceFilmModel::read()) - { - const dictionary& solution = filmRegion_.solutionDict().subDict("PISO"); - solution.lookup("momentumPredictor") >> momentumPredictor_; - solution.lookup("nOuterCorr") >> nOuterCorr_; - solution.lookup("nCorr") >> nCorr_; - solution.lookup("nNonOrthCorr") >> nNonOrthCorr_; - - coeffs_.lookup("Cf") >> Cf_; - coeffs_.lookup("deltaStable") >> deltaStable_; - - return true; - } - else - { - return false; - } -} - - -void Foam::surfaceFilmModels::kinematicSingleLayer::initialise() -{ - if (debug) - { - Pout<< "kinematicSingleLayer::initialise()" << endl; - } - - label nBoundaryFaces = 0; - DynamicList