diff --git a/src/surfaceFilmModels/Make/files b/src/surfaceFilmModels/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..aecce33191d01abaec33ae21139c0c5730a27485 --- /dev/null +++ b/src/surfaceFilmModels/Make/files @@ -0,0 +1,26 @@ +/* Surface film models */ +surfaceFilmModel/surfaceFilmModel/surfaceFilmModel.C +surfaceFilmModel/surfaceFilmModel/newSurfaceFilmModel.C +surfaceFilmModel/noFilm/noFilm.C +surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C +surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.C + + +/* Sub-models */ +submodels/kinematic/injectionModel/injectionModel/injectionModel.C +submodels/kinematic/injectionModel/injectionModel/newInjectionModel.C +submodels/kinematic/injectionModel/noInjection/noInjection.C +submodels/kinematic/injectionModel/removeInjection/removeInjection.C + +submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C +submodels/thermo/phaseChangeModel/phaseChangeModel/newPhaseChangeModel.C +submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C + + +/* Boundary conditions */ +derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C +derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C +derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C + + +LIB = $(FOAM_LIBBIN)/libsurfaceFilmModels diff --git a/src/surfaceFilmModels/Make/options b/src/surfaceFilmModels/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..d27c95d033dd5d7b1995c8ff8dc406e35ca1f586 --- /dev/null +++ b/src/surfaceFilmModels/Make/options @@ -0,0 +1,7 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/meshTools/lnInclude + +EXE_LIBS = \ + -lfiniteVolume \ + -lmeshTools diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C new file mode 100644 index 0000000000000000000000000000000000000000..9c84101d853ce3d247013d327aa773bfbc66e2db --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.C @@ -0,0 +1,162 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "directMappedFixedInternalValueFvPatchField.H" +#include "UIndirectList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +directMappedFixedInternalValueFvPatchField<Type>:: +directMappedFixedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF +) +: + directMappedFixedValueFvPatchField<Type>(p, iF) +{} + + +template<class Type> +directMappedFixedInternalValueFvPatchField<Type>:: +directMappedFixedInternalValueFvPatchField +( + const directMappedFixedInternalValueFvPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + directMappedFixedValueFvPatchField<Type>(ptf, p, iF, mapper) +{} + + +template<class Type> +directMappedFixedInternalValueFvPatchField<Type>:: +directMappedFixedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const dictionary& dict +) +: + directMappedFixedValueFvPatchField<Type>(p, iF, dict) +{} + + +template<class Type> +directMappedFixedInternalValueFvPatchField<Type>:: +directMappedFixedInternalValueFvPatchField +( + const directMappedFixedInternalValueFvPatchField<Type>& ptf +) +: + directMappedFixedValueFvPatchField<Type>(ptf) +{} + + +template<class Type> +directMappedFixedInternalValueFvPatchField<Type>:: +directMappedFixedInternalValueFvPatchField +( + const directMappedFixedInternalValueFvPatchField<Type>& ptf, + const DimensionedField<Type, volMesh>& iF +) +: + directMappedFixedValueFvPatchField<Type>(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +void directMappedFixedInternalValueFvPatchField<Type>::updateCoeffs() +{ + typedef GeometricField<Type, fvPatchField, volMesh> FieldType; + + if (this->updated()) + { + return; + } + + // Retrieve the neighbour values and assign to this patch boundary field + directMappedFixedValueFvPatchField<Type>::updateCoeffs(); + + // Get the coupling information from the directMappedPatchBase + const directMappedPatchBase& mpp = + refCast<const directMappedPatchBase>(this->patch().patch()); + const polyMesh& nbrMesh = mpp.sampleMesh(); + const fvPatch& nbrPatch = + refCast<const fvMesh> + ( + nbrMesh + ).boundary()[mpp.samplePolyPatch().index()]; + + // Force recalculation of mapping and schedule + const mapDistribute& distMap = mpp.map(); + + // Retrieve the neighbour field + const fvPatchField<Type>& nbrField = + nbrPatch.lookupPatchField<FieldType, Type> + ( + this->dimensionedInternalField().name() + ); + + // Retrieve the neighbour patch internal field + Field<Type> nbrIntFld = nbrField.patchInternalField(); + mapDistribute::distribute + ( + Pstream::defaultCommsType, + distMap.schedule(), + distMap.constructSize(), + distMap.subMap(), // what to send + distMap.constructMap(), // what to receive + nbrIntFld + ); + + // Assign (this) patch internal field to its neighbour values + Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField()); + UIndirectList<Type>(intFld, this->patch().faceCells()) = nbrIntFld; +} + + +template<class Type> +void directMappedFixedInternalValueFvPatchField<Type>::write(Ostream& os) const +{ + directMappedFixedValueFvPatchField<Type>::write(os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.H new file mode 100644 index 0000000000000000000000000000000000000000..4aef5ebd2cc83330135ec3b5731e5431b08046f5 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchField.H @@ -0,0 +1,150 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::directMappedFixedInternalValueFvPatchField + +Description + Recycles the boundary and internal values of a neighbour patch field to + the boundary and internal values of *this. + +SourceFiles + directMappedFixedInternalValueFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedInternalValueFvPatchField_H +#define directMappedFixedInternalValueFvPatchField_H + +#include "directMappedFixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class directMappedFixedInternalValueFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class directMappedFixedInternalValueFvPatchField +: + public directMappedFixedValueFvPatchField<Type> +{ + +public: + + //- Runtime type information + TypeName("directMappedFixedInternalValue"); + + + // Constructors + + //- Construct from patch and internal field + directMappedFixedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + directMappedFixedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // directMappedFixedInternalValueFvPatchField onto a new patch + directMappedFixedInternalValueFvPatchField + ( + const directMappedFixedInternalValueFvPatchField<Type>&, + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + directMappedFixedInternalValueFvPatchField + ( + const directMappedFixedInternalValueFvPatchField<Type>& + ); + + //- Construct and return a clone + virtual tmp<fvPatchField<Type> > clone() const + { + return tmp<fvPatchField<Type> > + ( + new directMappedFixedInternalValueFvPatchField<Type>(*this) + ); + } + + //- Construct as copy setting internal field reference + directMappedFixedInternalValueFvPatchField + ( + const directMappedFixedInternalValueFvPatchField<Type>&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchField<Type> > clone + ( + const DimensionedField<Type, volMesh>& iF + ) const + { + return tmp<fvPatchField<Type> > + ( + new directMappedFixedInternalValueFvPatchField<Type>(*this, iF) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "directMappedFixedInternalValueFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C new file mode 100644 index 0000000000000000000000000000000000000000..11a290c3c19f5225a7482b242637f722d39de1e6 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "directMappedFixedInternalValueFvPatchFields.H" +#include "volMesh.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(directMappedFixedInternalValue); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.H new file mode 100644 index 0000000000000000000000000000000000000000..29301f9f0dcaaa7a745eb29f56282e1d2c4bc3e8 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedInternalValueFvPatchFields_H +#define directMappedFixedInternalValueFvPatchFields_H + +#include "directMappedFixedInternalValueFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(directMappedFixedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFieldsFwd.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFieldsFwd.H new file mode 100644 index 0000000000000000000000000000000000000000..55ee7d1ab695d9a0beeb27e71a5bc46c2a1255dd --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedInternalValue/directMappedFixedInternalValueFvPatchFieldsFwd.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedInternalValueFvPatchFieldsFwd_H +#define directMappedFixedInternalValueFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> class directMappedFixedInternalValueFvPatchField; + +makePatchTypeFieldTypedefs(directMappedFixedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.C b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.C new file mode 100644 index 0000000000000000000000000000000000000000..c9230d8adfa69bcea9cc704f76a9d891d6c0e57d --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.C @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "directMappedFixedPushedInternalValueFvPatchField.H" +#include "UIndirectList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template<class Type> +directMappedFixedPushedInternalValueFvPatchField<Type>:: +directMappedFixedPushedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF +) +: + directMappedFixedValueFvPatchField<Type>(p, iF) +{} + + +template<class Type> +directMappedFixedPushedInternalValueFvPatchField<Type>:: +directMappedFixedPushedInternalValueFvPatchField +( + const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf, + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + directMappedFixedValueFvPatchField<Type>(ptf, p, iF, mapper) +{} + + +template<class Type> +directMappedFixedPushedInternalValueFvPatchField<Type>:: +directMappedFixedPushedInternalValueFvPatchField +( + const fvPatch& p, + const DimensionedField<Type, volMesh>& iF, + const dictionary& dict +) +: + directMappedFixedValueFvPatchField<Type>(p, iF, dict) +{} + + +template<class Type> +directMappedFixedPushedInternalValueFvPatchField<Type>:: +directMappedFixedPushedInternalValueFvPatchField +( + const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf +) +: + directMappedFixedValueFvPatchField<Type>(ptf) +{} + + +template<class Type> +directMappedFixedPushedInternalValueFvPatchField<Type>:: +directMappedFixedPushedInternalValueFvPatchField +( + const directMappedFixedPushedInternalValueFvPatchField<Type>& ptf, + const DimensionedField<Type, volMesh>& iF +) +: + directMappedFixedValueFvPatchField<Type>(ptf, iF) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class Type> +void directMappedFixedPushedInternalValueFvPatchField<Type>::updateCoeffs() +{ + typedef GeometricField<Type, fvPatchField, volMesh> FieldType; + + if (this->updated()) + { + return; + } + + // Retrieve the neighbour values and assign to this patch boundary field + directMappedFixedValueFvPatchField<Type>::updateCoeffs(); + + // Assign the patch internal field to its boundary value + Field<Type>& intFld = const_cast<Field<Type>&>(this->internalField()); + UIndirectList<Type>(intFld, this->patch().faceCells()) = *this; +} + + +template<class Type> +void directMappedFixedPushedInternalValueFvPatchField<Type>::write +( + Ostream& os +) const +{ + directMappedFixedValueFvPatchField<Type>::write(os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.H new file mode 100644 index 0000000000000000000000000000000000000000..3074b80896f7d6ccb4997b841e3df46ae471dae4 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchField.H @@ -0,0 +1,157 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::directMappedFixedPushedInternalValueFvPatchField + +Description + Recycles the boundary values of a neighbour patch field to the boundary + and internal values of *this. + +SourceFiles + directMappedFixedPushedInternalValueFvPatchField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedPushedInternalValueFvPatchField_H +#define directMappedFixedPushedInternalValueFvPatchField_H + +#include "directMappedFixedValueFvPatchField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class directMappedFixedPushedInternalValueFvPatchField Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class directMappedFixedPushedInternalValueFvPatchField +: + public directMappedFixedValueFvPatchField<Type> +{ + +public: + + //- Runtime type information + TypeName("directMappedFixedPushedInternalValue"); + + + // Constructors + + //- Construct from patch and internal field + directMappedFixedPushedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + directMappedFixedPushedInternalValueFvPatchField + ( + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given a + // directMappedFixedPushedInternalValueFvPatchField onto a new patch + directMappedFixedPushedInternalValueFvPatchField + ( + const directMappedFixedPushedInternalValueFvPatchField<Type>&, + const fvPatch&, + const DimensionedField<Type, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + directMappedFixedPushedInternalValueFvPatchField + ( + const directMappedFixedPushedInternalValueFvPatchField<Type>& + ); + + //- Construct and return a clone + virtual tmp<fvPatchField<Type> > clone() const + { + return tmp<fvPatchField<Type> > + ( + new directMappedFixedPushedInternalValueFvPatchField<Type> + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + directMappedFixedPushedInternalValueFvPatchField + ( + const directMappedFixedPushedInternalValueFvPatchField<Type>&, + const DimensionedField<Type, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchField<Type> > clone + ( + const DimensionedField<Type, volMesh>& iF + ) const + { + return tmp<fvPatchField<Type> > + ( + new directMappedFixedPushedInternalValueFvPatchField<Type> + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Evaluation functions + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "directMappedFixedPushedInternalValueFvPatchField.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C new file mode 100644 index 0000000000000000000000000000000000000000..b7ab2101066670c00eb5bfca6fcec71d87f31249 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C @@ -0,0 +1,43 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "directMappedFixedPushedInternalValueFvPatchFields.H" +#include "volMesh.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +makePatchFields(directMappedFixedPushedInternalValue); + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.H new file mode 100644 index 0000000000000000000000000000000000000000..9d5a800af54d37013318efe158eeeb5b363a8a57 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedPushedInternalValueFvPatchFields_H +#define directMappedFixedPushedInternalValueFvPatchFields_H + +#include "directMappedFixedPushedInternalValueFvPatchField.H" +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeFieldTypedefs(directMappedFixedPushedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFieldsFwd.H b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFieldsFwd.H new file mode 100644 index 0000000000000000000000000000000000000000..5ef59b5645745ef3a095e9a5cd7db15c079d9d72 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFieldsFwd.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#ifndef directMappedFixedPushedInternalValueFvPatchFieldsFwd_H +#define directMappedFixedPushedInternalValueFvPatchFieldsFwd_H + +#include "fieldTypes.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +template<class Type> class directMappedFixedPushedInternalValueFvPatchField; + +makePatchTypeFieldTypedefs(directMappedFixedInternalValue) + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C b/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C new file mode 100644 index 0000000000000000000000000000000000000000..576d48d6635b910ad8eafe948bae5f3174febfde --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.C @@ -0,0 +1,167 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "filmHeightInletVelocityFvPatchVectorField.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" +#include "surfaceFields.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::filmHeightInletVelocityFvPatchVectorField:: +filmHeightInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF +) +: + fixedValueFvPatchVectorField(p, iF), + phiName_("phi"), + rhoName_("rho"), + deltafName_("deltaf") +{} + + +Foam::filmHeightInletVelocityFvPatchVectorField:: +filmHeightInletVelocityFvPatchVectorField +( + const filmHeightInletVelocityFvPatchVectorField& ptf, + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + fixedValueFvPatchVectorField(ptf, p, iF, mapper), + phiName_(ptf.phiName_), + rhoName_(ptf.rhoName_), + deltafName_(ptf.deltafName_) +{} + + +Foam::filmHeightInletVelocityFvPatchVectorField:: +filmHeightInletVelocityFvPatchVectorField +( + const fvPatch& p, + const DimensionedField<vector, volMesh>& iF, + const dictionary& dict +) +: + fixedValueFvPatchVectorField(p, iF), + phiName_(dict.lookupOrDefault<word>("phi", "phi")), + rhoName_(dict.lookupOrDefault<word>("rho", "rho")), + deltafName_(dict.lookupOrDefault<word>("deltaf", "deltaf")) +{ + fvPatchVectorField::operator=(vectorField("value", dict, p.size())); +} + + +Foam::filmHeightInletVelocityFvPatchVectorField:: +filmHeightInletVelocityFvPatchVectorField +( + const filmHeightInletVelocityFvPatchVectorField& fhivpvf +) +: + fixedValueFvPatchVectorField(fhivpvf), + phiName_(fhivpvf.phiName_), + rhoName_(fhivpvf.rhoName_), + deltafName_(fhivpvf.deltafName_) +{} + + +Foam::filmHeightInletVelocityFvPatchVectorField:: +filmHeightInletVelocityFvPatchVectorField +( + const filmHeightInletVelocityFvPatchVectorField& fhivpvf, + const DimensionedField<vector, volMesh>& iF +) +: + fixedValueFvPatchVectorField(fhivpvf, iF), + phiName_(fhivpvf.phiName_), + rhoName_(fhivpvf.rhoName_), + deltafName_(fhivpvf.deltafName_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::filmHeightInletVelocityFvPatchVectorField::updateCoeffs() +{ + if (updated()) + { + return; + } + + const fvsPatchField<scalar>& phip = + patch().lookupPatchField<surfaceScalarField, scalar>(phiName_); + + const fvPatchField<scalar>& rhop = + patch().lookupPatchField<volScalarField, scalar>(rhoName_); + + const fvPatchField<scalar>& deltafp = + patch().lookupPatchField<volScalarField, scalar>(deltafName_); + + vectorField n = patch().nf(); + const scalarField& magSf = patch().magSf(); + + operator==(deltafp*n*phip/(rhop*magSf*sqr(deltafp) + ROOTVSMALL)); + + fixedValueFvPatchVectorField::updateCoeffs(); +} + + +void Foam::filmHeightInletVelocityFvPatchVectorField::write(Ostream& os) const +{ + fvPatchVectorField::write(os); + writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); + writeEntryIfDifferent<word>(os, "deltaf", "deltaf", deltafName_); + writeEntry("value", os); +} + + +// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // + +void Foam::filmHeightInletVelocityFvPatchVectorField::operator= +( + const fvPatchField<vector>& pvf +) +{ + fvPatchField<vector>::operator=(patch().nf()*(patch().nf() & pvf)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makePatchTypeField + ( + fvPatchVectorField, + filmHeightInletVelocityFvPatchVectorField + ); +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H b/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H new file mode 100644 index 0000000000000000000000000000000000000000..3c6132cd6cc01fa315f2169d847a6be7c5426016 --- /dev/null +++ b/src/surfaceFilmModels/derivedFvPatchFields/filmHeightInletVelocity/filmHeightInletVelocityFvPatchVectorField.H @@ -0,0 +1,198 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::filmHeightInletVelocityFvPatchVectorField + +Description + Velocity inlet boundary condition for patches where the film height is + specified. The inflow velocity is obtained from the flux with a direction + normal to the patch faces. + +SourceFiles + filmHeightInletVelocityFvPatchVectorField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef filmHeightInletVelocityFvPatchVectorField_H +#define filmHeightInletVelocityFvPatchVectorField_H + +#include "fvPatchFields.H" +#include "fixedValueFvPatchFields.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class filmHeightInletVelocityFvPatchVectorField Declaration +\*---------------------------------------------------------------------------*/ + +class filmHeightInletVelocityFvPatchVectorField +: + public fixedValueFvPatchVectorField +{ + // Private data + + //- Name of flux field + word phiName_; + + //- Name of density field + word rhoName_; + + //- Name of film height field + word deltafName_; + + +public: + + //- Runtime type information + TypeName("filmHeightInletVelocity"); + + + // Constructors + + //- Construct from patch and internal field + filmHeightInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + filmHeightInletVelocityFvPatchVectorField + ( + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given filmHeightInletVelocityFvPatchVectorField + // onto a new patch + filmHeightInletVelocityFvPatchVectorField + ( + const filmHeightInletVelocityFvPatchVectorField&, + const fvPatch&, + const DimensionedField<vector, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct as copy + filmHeightInletVelocityFvPatchVectorField + ( + const filmHeightInletVelocityFvPatchVectorField& + ); + + //- Construct and return a clone + virtual tmp<fvPatchVectorField> clone() const + { + return tmp<fvPatchVectorField> + ( + new filmHeightInletVelocityFvPatchVectorField(*this) + ); + } + + //- Construct as copy setting internal field reference + filmHeightInletVelocityFvPatchVectorField + ( + const filmHeightInletVelocityFvPatchVectorField&, + const DimensionedField<vector, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchVectorField> clone + ( + const DimensionedField<vector, volMesh>& iF + ) const + { + return tmp<fvPatchVectorField> + ( + new filmHeightInletVelocityFvPatchVectorField(*this, iF) + ); + } + + + // Member functions + + // Access + + //- Return the name of phi + const word& phiName() const + { + return phiName_; + } + + //- Return reference to the name of phi to allow adjustment + word& phiName() + { + return phiName_; + } + + //- Return the name of rho + const word& rhoName() const + { + return rhoName_; + } + + //- Return reference to the name of rho to allow adjustment + word& rhoName() + { + return rhoName_; + } + + //- Return the name of deltaf + const word& deltafName() const + { + return deltafName_; + } + + //- Return reference to the name of df to allow adjustment + word& deltafName() + { + return deltafName_; + } + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; + + + // Member operators + + virtual void operator=(const fvPatchField<vector>& pvf); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C new file mode 100644 index 0000000000000000000000000000000000000000..96d59420ca4f66b848e688f27c10f5945d3a4b1f --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "injectionModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(injectionModel, 0); + defineRunTimeSelectionTable(injectionModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::injectionModel::injectionModel +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + owner_(owner), + coeffs_(dictionary::null) +{} + + +Foam::surfaceFilmModels::injectionModel::injectionModel +( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict +) +: + owner_(owner), + coeffs_(dict.subDict(type + "Coeffs")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::injectionModel::~injectionModel() +{} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H new file mode 100644 index 0000000000000000000000000000000000000000..bc140539bfe363aed1442739fa6606c745134062 --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModel.H @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::injectionModel + +Description + +SourceFiles + injectionModelI.H + injectionModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef injectionModel_H +#define injectionModel_H + +#include "surfaceFilmModel.H" +#include "runTimeSelectionTables.H" +#include "scalarField.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class injectionModel Declaration +\*---------------------------------------------------------------------------*/ + +class injectionModel +{ +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + injectionModel(const injectionModel&); + + //- Disallow default bitwise assignment + void operator=(const injectionModel&); + + +protected: + + // Protected data + + //- Reference to the owner surface film model + const surfaceFilmModel& owner_; + + //- Model coefficients dictionary + dictionary coeffs_; + + +public: + + //- Runtime type information + TypeName("injectionModel"); + + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + injectionModel, + dictionary, + ( + const surfaceFilmModel& owner, + const dictionary& dict + ), + (owner, dict) + ); + + // Constructors + + //- Construct null + injectionModel(const surfaceFilmModel& owner, const dictionary& dict); + + //- Construct from type name, dictionary and surface film model + injectionModel + ( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + // Selectors + + //- Return a reference to the selected phase change model + static autoPtr<injectionModel> New + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~injectionModel(); + + + // 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 + ( + scalarField& massToInject, + scalarField& diameterToInject + ) = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "injectionModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelI.H b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelI.H new file mode 100644 index 0000000000000000000000000000000000000000..2f3bf02ef1d04796d3696eb760e5022f0b58ceed --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/injectionModelI.H @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "injectionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline const Foam::surfaceFilmModels::surfaceFilmModel& +Foam::surfaceFilmModels::injectionModel::owner() const +{ + return owner_; +} + + +inline const Foam::dictionary& +Foam::surfaceFilmModels::injectionModel::coeffs() const +{ + return coeffs_; +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/newInjectionModel.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/newInjectionModel.C new file mode 100644 index 0000000000000000000000000000000000000000..7bddebcc8edbb1877addd38d0c2025c4373b3130 --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/injectionModel/newInjectionModel.C @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "injectionModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::surfaceFilmModels::injectionModel> +Foam::surfaceFilmModels::injectionModel::New +( + const surfaceFilmModel& model, + const dictionary& dict +) +{ + word modelType(dict.lookup("injectionModel")); + + Info<< " Selecting injectionModel " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "injectionModel::New(const surfaceFilmModel&, const dictionary&)" + ) << "Unknown injectionModel type " << modelType + << nl << nl << "Valid injectionModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr<injectionModel>(cstrIter()(model, dict)); +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C new file mode 100644 index 0000000000000000000000000000000000000000..39d2c3470692d95de324a7ff4b7df5003932af67 --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "noInjection.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(noInjection, 0); + addToRunTimeSelectionTable(injectionModel, noInjection, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::noInjection::noInjection +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + injectionModel(owner, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::noInjection::~noInjection() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::surfaceFilmModels::noInjection::correct +( + scalarField& massToInject, + scalarField& diameterToInject +) +{ + // no mass injected + massToInject = 0.0; +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.H b/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.H new file mode 100644 index 0000000000000000000000000000000000000000..7b1446ebab431e44a811177fd70e9bd7971f5451 --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/noInjection/noInjection.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::noInjection + +Description + Dummy injection model for 'none' + +SourceFiles + noInjection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noInjection_H +#define noInjection_H + +#include "injectionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class noInjection Declaration +\*---------------------------------------------------------------------------*/ + +class noInjection +: + public injectionModel +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + noInjection(const noInjection&); + + //- Disallow default bitwise assignment + void operator=(const noInjection&); + + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from surface film model + noInjection(const surfaceFilmModel& owner, const dictionary& dict); + + + //- Destructor + virtual ~noInjection(); + + + // 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/removeInjection/removeInjection.C b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C new file mode 100644 index 0000000000000000000000000000000000000000..58fbd9fe5afc97c7d36440098597e99aedb91455 --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "removeInjection.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(removeInjection, 0); + addToRunTimeSelectionTable(injectionModel, removeInjection, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::removeInjection::removeInjection +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + injectionModel(owner, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::removeInjection::~removeInjection() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::surfaceFilmModels::removeInjection::correct +( + scalarField&, + scalarField& +) +{ + // do nothing - all mass available to be removed +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H new file mode 100644 index 0000000000000000000000000000000000000000..4fc4a63fc4c173a5ee9acdaa1ccc4cca95fdee74 --- /dev/null +++ b/src/surfaceFilmModels/submodels/kinematic/injectionModel/removeInjection/removeInjection.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::removeInjection + +Description + All mass available to be removed from the system is removed. + +SourceFiles + removeInjection.C + +\*---------------------------------------------------------------------------*/ + +#ifndef removeInjection_H +#define removeInjection_H + +#include "injectionModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class removeInjection Declaration +\*---------------------------------------------------------------------------*/ + +class removeInjection +: + public injectionModel +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + removeInjection(const removeInjection&); + + //- Disallow default bitwise assignment + void operator=(const removeInjection&); + + +public: + + //- Runtime type information + TypeName("remove"); + + + // Constructors + + //- Construct from surface film model + removeInjection(const surfaceFilmModel& owner, const dictionary& dict); + + + //- Destructor + virtual ~removeInjection(); + + + // Member Functions + + // Evolution + + //- Correct + virtual void correct + ( + scalarField& massToInject, + scalarField& diameterToInject + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // 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 new file mode 100644 index 0000000000000000000000000000000000000000..551bfb2a4430e6e391c0e85f3132cb63e96a248e --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.C @@ -0,0 +1,67 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "noPhaseChange.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(noPhaseChange, 0); + addToRunTimeSelectionTable(phaseChangeModel, noPhaseChange, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::noPhaseChange::noPhaseChange +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + phaseChangeModel(owner, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::noPhaseChange::~noPhaseChange() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::surfaceFilmModels::noPhaseChange::correct() +{ + // do nothing +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H new file mode 100644 index 0000000000000000000000000000000000000000..487e3c2b3cf856b85b78a9a15ab657a0f1ac1487 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/noPhaseChange/noPhaseChange.H @@ -0,0 +1,100 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::noPhaseChange + +Description + Dummy phase change model for 'none' + +SourceFiles + noPhaseChange.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noPhaseChange_H +#define noPhaseChange_H + +#include "phaseChangeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class noPhaseChange Declaration +\*---------------------------------------------------------------------------*/ + +class noPhaseChange +: + public phaseChangeModel +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + noPhaseChange(const noPhaseChange&); + + //- Disallow default bitwise assignment + void operator=(const noPhaseChange&); + + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from surface film model + noPhaseChange(const surfaceFilmModel& owner, const dictionary& dict); + + + //- Destructor + virtual ~noPhaseChange(); + + + // Member Functions + + // Evolution + + //- Correct + virtual void correct(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/newPhaseChangeModel.C b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/newPhaseChangeModel.C new file mode 100644 index 0000000000000000000000000000000000000000..7cc04c0027d1bb732a3575fec82a51753d0f4c54 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/newPhaseChangeModel.C @@ -0,0 +1,59 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "phaseChangeModel.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::surfaceFilmModels::phaseChangeModel> +Foam::surfaceFilmModels::phaseChangeModel::New +( + const surfaceFilmModel& model, + const dictionary& dict +) +{ + word modelType(dict.lookup("phaseChangeModel")); + + Info<< " Selecting phaseChangeModel " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "phaseChangeModel::New(const surfaceFilmModel&, const dictionary&)" + ) << "Unknown phaseChangeModel type " << modelType + << nl << nl << "Valid phaseChangeModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr<phaseChangeModel>(cstrIter()(model, dict)); +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C new file mode 100644 index 0000000000000000000000000000000000000000..e2a0b93a754272b87eaaa67219b86ae767e99757 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.C @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "phaseChangeModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(phaseChangeModel, 0); + defineRunTimeSelectionTable(phaseChangeModel, dictionary); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::phaseChangeModel::phaseChangeModel +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + owner_(owner), + coeffs_(dictionary::null) +{} + + +Foam::surfaceFilmModels::phaseChangeModel::phaseChangeModel +( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict +) +: + owner_(owner), + coeffs_(dict.subDict(type + "Coeffs")) +{ + WarningIn + ( + "phaseChangeModel::phaseChangeModel" + "(" + "const word&, " + "const surfaceFilmModel&, " + "const dictionary&" + ")" + ) << "Phase change models not implemented!" << endl; +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::phaseChangeModel::~phaseChangeModel() +{} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H new file mode 100644 index 0000000000000000000000000000000000000000..87a08b10169444c12bfe73e8a1954eafe22decd4 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModel.H @@ -0,0 +1,155 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::phaseChangeModel + +Description + +SourceFiles + phaseChangeModelI.H + phaseChangeModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef phaseChangeModel_H +#define phaseChangeModel_H + +#include "surfaceFilmModel.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class phaseChangeModel Declaration +\*---------------------------------------------------------------------------*/ + +class phaseChangeModel +{ +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + phaseChangeModel(const phaseChangeModel&); + + //- Disallow default bitwise assignment + void operator=(const phaseChangeModel&); + + +protected: + + // Protected data + + //- Reference to the owner surface film model + const surfaceFilmModel& owner_; + + //- Model coefficients dictionary + dictionary coeffs_; + + +public: + + //- Runtime type information + TypeName("phaseChangeModel"); + + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + phaseChangeModel, + dictionary, + ( + const surfaceFilmModel& owner, + const dictionary& dict + ), + (owner, dict) + ); + + // Constructors + + //- Construct null + phaseChangeModel(const surfaceFilmModel& owner, const dictionary& dict); + + //- Construct from type name, dictionary and surface film model + phaseChangeModel + ( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + // Selectors + + //- Return a reference to the selected phase change model + static autoPtr<phaseChangeModel> New + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~phaseChangeModel(); + + + // 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 // TODO + virtual void correct() = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "phaseChangeModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelI.H b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelI.H new file mode 100644 index 0000000000000000000000000000000000000000..f893bbbfa7e69cf843b25a49af897dd19dff7980 --- /dev/null +++ b/src/surfaceFilmModels/submodels/thermo/phaseChangeModel/phaseChangeModel/phaseChangeModelI.H @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "phaseChangeModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline const Foam::surfaceFilmModels::surfaceFilmModel& +Foam::surfaceFilmModels::phaseChangeModel::owner() const +{ + return owner_; +} + + +inline const Foam::dictionary& +Foam::surfaceFilmModels::phaseChangeModel::coeffs() const +{ + return coeffs_; +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C new file mode 100644 index 0000000000000000000000000000000000000000..376d2cd199e563c2a962b0de80b8aaa4e1185f10 --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.C @@ -0,0 +1,1062 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "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<label> primaryPatchIDs; + DynamicList<label> filmBottomPatchIDs; + const polyBoundaryMesh& bm = filmRegion_.boundaryMesh(); + forAll(bm, patchI) + { + const polyPatch& pp = bm[patchI]; + if (isA<directMappedWallPolyPatch>(pp)) + { + if (debug) + { + Pout<< "found " << directMappedWallPolyPatch::typeName + << " " << pp.name() << endl; + } + + filmBottomPatchIDs.append(patchI); + const directMappedWallPolyPatch& dwpp = + refCast<const directMappedWallPolyPatch>(pp); + + primaryPatchIDs.append + ( + mesh_.boundaryMesh().findPatchID(dwpp.samplePatch()) + ); + + const labelList& fCells = pp.faceCells(); + nBoundaryFaces += fCells.size(); + + // Cache patch normals + UIndirectList<vector>(nHat_, fCells) = pp.faceNormals(); + + // Cache mesh face areas + UIndirectList<scalar>(magSf_, fCells) = mag(pp.faceAreas()); + } + } + nHat_.correctBoundaryConditions(); + magSf_.correctBoundaryConditions(); + + primaryPatchIDs_.transfer(primaryPatchIDs); + filmBottomPatchIDs_.transfer(filmBottomPatchIDs); + + if (nBoundaryFaces == 0) + { + WarningIn("kinematicSingleLayer::initialise()") + << "Film model being applied without direct mapped boundary " + << "conditions" << endl; + } + + if (nBoundaryFaces != filmRegion_.nCells()) + { + FatalErrorIn("kinematicSingleLayer::initialise()") + << "Number of primary region coupled boundary faces not equal to " + << "the number of cells in the film region" << nl + << abort(FatalError); + } + + scalarField topMagSf(magSf_.size(), 0.0); + filmTopPatchIDs_.setSize(filmBottomPatchIDs_.size(), -1); + forAll(filmBottomPatchIDs_, i) + { + const label patchI = filmBottomPatchIDs_[i]; + const polyPatch& ppBottom = bm[patchI]; + if (ppBottom.size() > 0) + { + label cellId = bm[patchI].faceCells()[0]; + const cell& cFaces = filmRegion_.cells()[cellId]; + + label faceBottom = ppBottom.start(); + label faceTop = + cFaces.opposingFaceLabel(faceBottom, filmRegion_.faces()); + + label topPatchI = bm.whichPatch(faceTop); + filmTopPatchIDs_[i] = topPatchI; + const polyPatch& ppTop = bm[topPatchI]; + UIndirectList<scalar>(topMagSf, ppTop.faceCells()) = + mag(ppTop.faceAreas()); + } + } + + Pstream::listCombineGather(filmTopPatchIDs_, maxEqOp<label>()); + Pstream::listCombineScatter(filmTopPatchIDs_); + + magSf_.field() = 0.5*(magSf_ + topMagSf); + magSf_.correctBoundaryConditions(); +} + + +void Foam::surfaceFilmModels::kinematicSingleLayer:: +resetPrimaryRegionSourceTerms() +{ + rhoSpPrimary_ == dimensionedScalar("zero", rhoSp_.dimensions(), 0.0); + USpPrimary_ == dimensionedVector("zero", USp_.dimensions(), vector::zero); + pSpPrimary_ == dimensionedScalar("zero", pSp_.dimensions(), 0.0); +} + + +void Foam::surfaceFilmModels::kinematicSingleLayer:: +transferPrimaryRegionFields() +{ + // Update pressure and velocity from primary region via direct mapped + // (coupled) boundary conditions + UPrimary_.correctBoundaryConditions(); + pPrimary_.correctBoundaryConditions(); + + // Retrieve the source fields from the primary region via direct mapped + // (coupled) boundary conditions + // - fields require transfer of values for both patch AND to push the + // values into the first layer of internal cells + rhoSp_.correctBoundaryConditions(); + USp_.correctBoundaryConditions(); + pSp_.correctBoundaryConditions(); + + // Convert accummulated source terms into per unit area per unit time + // Note: boundary values will still have original (neat) values + const scalar deltaT = filmRegion_.time().deltaTValue(); + rhoSp_.field() /= magSf_*deltaT; + USp_.field() /= magSf_*deltaT; + pSp_.field() /= magSf_*deltaT; +} + + +Foam::tmp<Foam::volScalarField> +Foam::surfaceFilmModels::kinematicSingleLayer::pu() +{ + return tmp<volScalarField> + ( + new volScalarField + ( + IOobject + ( + "pu", + filmRegion_.time().timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + pPrimary_ // pressure (mapped from primary region) + + pSp_ // accumulated particle impingement + - fvc::laplacian(sigma_, delta_) // surface tension + ) + ); +} + + +Foam::tmp<Foam::volScalarField> +Foam::surfaceFilmModels::kinematicSingleLayer::pp() +{ + return tmp<volScalarField> + ( + new volScalarField + ( + IOobject + ( + "pp", + filmRegion_.time().timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + -rho_*gNormClipped() // hydrostatic effect only + ) + ); +} + + +void Foam::surfaceFilmModels::kinematicSingleLayer::correctDetachedFilm() +{ + massForPrimary_ == dimensionedScalar("zero", dimMass, 0.0); + diametersForPrimary_ == dimensionedScalar("zero", dimLength, -1.0); + + const scalarField gNorm = this->gNorm(); + + forAll(gNorm, i) + { + if (gNorm[i] > SMALL) + { + scalar ddelta = max(0.0, delta_[i] - deltaStable_.value()); + massForPrimary_[i] = ddelta*rho_[i]*magSf_[i]; + } + } +} + + +void Foam::surfaceFilmModels::kinematicSingleLayer::updateSubmodels() +{ + correctDetachedFilm(); + + // Update injection model - mass returned is actual mass injected + injection_->correct(massForPrimary_, diametersForPrimary_); + + // Update cumulative detached mass counter + detachedMass_ += sum(massForPrimary_.field()); + + // Push values to boundaries ready for transfer to the primary region + massForPrimary_.correctBoundaryConditions(); + diametersForPrimary_.correctBoundaryConditions(); + + // Update source fields + const dimensionedScalar deltaT = filmRegion_.time().deltaT(); + rhoSp_ -= massForPrimary_/magSf_/deltaT; + USp_ -= massForPrimary_*U_/magSf_/deltaT; +} + + +Foam::scalar +Foam::surfaceFilmModels::kinematicSingleLayer::CourantNumber() const +{ + scalar CoNum = 0.0; + scalar meanCoNum = 0.0; + + if (filmRegion_.nInternalFaces()) + { + const scalar deltaT = time_.deltaTValue(); + + surfaceScalarField SfUfbyDelta = + filmRegion_.surfaceInterpolation::deltaCoeffs()*mag(phi_) + /fvc::interpolate + ( + rho_*(delta_ + dimensionedScalar("SMALL", dimLength, SMALL)) + ); + + CoNum = max(SfUfbyDelta/filmRegion_.magSf()).value()*deltaT; + + meanCoNum = (sum(SfUfbyDelta)/sum(filmRegion_.magSf())).value()*deltaT; + } + + Info<< " Courant number mean: " << meanCoNum << " max: " << CoNum + << endl; + + return CoNum; +} + + +void Foam::surfaceFilmModels::kinematicSingleLayer::continuityCheck() +{ + const volScalarField deltaRho0 = deltaRho_; + + solveContinuity(); + + if (debug) + { + volScalarField mass = deltaRho_*magSf_; + dimensionedScalar totalMass = + fvc::domainIntegrate(mass) + + dimensionedScalar("SMALL", dimMass*dimVolume, ROOTVSMALL); + + scalar sumLocalContErr = + ( + fvc::domainIntegrate(mag(mass - magSf_*deltaRho0))/totalMass + ).value(); + + scalar globalContErr = + ( + fvc::domainIntegrate(mass - magSf_*deltaRho0)/totalMass + ).value(); + + cumulativeContErr_ += globalContErr; + + Info<< "Surface film: " << type() << nl + << " time step continuity errors: sum local = " + << sumLocalContErr << ", global = " << globalContErr + << ", cumulative = " << cumulativeContErr_ << endl; + } +} + + +void Foam::surfaceFilmModels::kinematicSingleLayer::solveContinuity() +{ + if (debug) + { + Info<< "kinematicSingleLayer::solveContinuity()" << endl; + } + + solve + ( + fvm::ddt(deltaRho_) + + fvc::div(phi_) + == + rhoSp_ + ); +} + + +Foam::tmp<Foam::fvVectorMatrix> +Foam::surfaceFilmModels::kinematicSingleLayer::tau +( + volVectorField& U +) const +{ + DimensionedField<vector, volMesh> Uw + ( + IOobject + ( + "Uw", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + filmRegion_, + dimensionedVector("zero", dimVelocity, vector::zero) + ); + + for (label i=0; i<filmBottomPatchIDs_.size(); i++) + { + label patchI = filmBottomPatchIDs_[i]; + const polyPatch& pp = filmRegion_.boundaryMesh()[patchI]; + UIndirectList<vector>(Uw, pp.faceCells()) = + UPrimary_.boundaryField()[patchI]; + } + Uw -= nHat_*(Uw & nHat_); + + volVectorField Us + ( + IOobject + ( + "Us", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + filmRegion_, + dimensionedVector("zero", dimVelocity, vector::zero) + ); + + // TODO: use wall functions + Us.dimensionedInternalField() = UPrimary_.dimensionedInternalField(); + Us -= nHat_*(Us & nHat_); + + volScalarField Cs("Cs", rho_*Cf_*mag(Us - U_)); + volScalarField Cw + ( + "Cw", + mu_/(0.5*(delta_ + dimensionedScalar("SMALL", dimLength, SMALL))) + ); + Cw.min(1.0e+06); + + return + ( + - fvm::Sp(Cs, U) + Cs*Us + - fvm::Sp(Cw, U) + Cw*Uw + ); +} + + +Foam::tmp<Foam::fvVectorMatrix> +Foam::surfaceFilmModels::kinematicSingleLayer::solveMomentum +( + const volScalarField& pu, + const volScalarField& pp +) +{ + if (debug) + { + Info<< "kinematicSingleLayer::solveMomentum()" << endl; + } + + // Momentum + tmp<fvVectorMatrix> tUEqn + ( + fvm::ddt(deltaRho_, U_) + + fvm::div(phi_, U_) + == + USp_ + + tau(U_) + ); + + fvVectorMatrix& UEqn = tUEqn(); + + UEqn.relax(); + + if (momentumPredictor_) + { + solve + ( + UEqn + == + fvc::reconstruct + ( + - fvc::interpolate(delta_) + * ( + filmRegion_.magSf() + * ( + fvc::snGrad(pu, "snGrad(p)") + + fvc::snGrad(pp, "snGrad(p)")*fvc::interpolate(delta_) + + fvc::snGrad(delta_)*fvc::interpolate(pp) + ) + - (fvc::interpolate(rho_*gTan()) & filmRegion_.Sf()) + ) + ) + ); + + // Remove any patch-normal components of velocity + U_ -= nHat_*(nHat_ & U_); + U_.correctBoundaryConditions(); + } + + return tUEqn; +} + + +void Foam::surfaceFilmModels::kinematicSingleLayer::solveThickness +( + const volScalarField& pu, + const volScalarField& pp, + const fvVectorMatrix& UEqn +) +{ + if (debug) + { + Info<< "kinematicSingleLayer::solveThickness()" << endl; + } + + volScalarField rUA = 1.0/UEqn.A(); + U_ = rUA*UEqn.H(); + + surfaceScalarField deltarUAf = fvc::interpolate(delta_*rUA); + surfaceScalarField rhof = fvc::interpolate(rho_); + + surfaceScalarField phiAdd + ( + "phiAdd", + filmRegion_.magSf() + * ( + fvc::snGrad(pu, "snGrad(p)") + + fvc::snGrad(pp, "snGrad(p)")*fvc::interpolate(delta_) + ) + - (fvc::interpolate(rho_*gTan()) & filmRegion_.Sf()) + ); + constrainFilmField(phiAdd, 0.0); + + surfaceScalarField phid + ( + "phid", + (fvc::interpolate(U_*rho_) & filmRegion_.Sf()) + - deltarUAf*phiAdd*rhof + ); + constrainFilmField(phid, 0.0); + + surfaceScalarField ddrhorUAppf = + fvc::interpolate(delta_)*deltarUAf*rhof*fvc::interpolate(pp); +// constrainFilmField(ddrhorUAppf, 0.0); + + for (int nonOrth=0; nonOrth<=nNonOrthCorr_; nonOrth++) + { + // Film thickness equation + fvScalarMatrix deltaEqn + ( + fvm::ddt(rho_, delta_) + + fvm::div(phid, delta_) + - fvm::laplacian(ddrhorUAppf, delta_) + == + rhoSp_ + ); + + deltaEqn.solve(); + + if (nonOrth == nNonOrthCorr_) + { + phiAdd += + fvc::interpolate(pp) + * fvc::snGrad(delta_) + * filmRegion_.magSf(); + + phi_ == deltaEqn.flux(); + } + } + + // Bound film thickness by a minimum of zero + delta_.max(0.0); + + // Update U field + U_ -= fvc::reconstruct(deltarUAf*phiAdd); + + // Remove any patch-normal components of velocity + U_ -= nHat_*(nHat_ & U_); + + U_.correctBoundaryConditions(); + + // Continuity check + continuityCheck(); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::kinematicSingleLayer::kinematicSingleLayer +( + const word& modelType, + const fvMesh& mesh, + const dimensionedVector& g +) +: + surfaceFilmModel(modelType, mesh, g), + filmRegion_ + ( + IOobject + ( + filmRegionName_, + time_.timeName(), + time_, + IOobject::MUST_READ + ) + ), + nHat_ + ( + IOobject + ( + "nHat", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + filmRegion_, + dimensionedVector("zero", dimless, vector::zero), + zeroGradientFvPatchVectorField::typeName + ), + magSf_ + ( + IOobject + ( + "magSf", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + filmRegion_, + dimensionedScalar("zero", dimArea, 0.0), + zeroGradientFvPatchScalarField::typeName + ), + primaryPatchIDs_(0), + filmTopPatchIDs_(0), + filmBottomPatchIDs_(0), + + momentumPredictor_(true), + nOuterCorr_(-1), + nCorr_(-1), + nNonOrthCorr_(-1), + cumulativeContErr_(0.0), + + Cf_(0.0), + deltaStable_("deltaStable", dimLength, 0.0), + + rho_ + ( + IOobject + ( + "rhof", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + filmRegion_, + dimensionedScalar(coeffs_.lookup("rho")) + ), + mu_ + ( + IOobject + ( + "muf", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + filmRegion_, + dimensionedScalar(coeffs_.lookup("mu")) + ), + sigma_ + ( + IOobject + ( + "sigmaf", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + filmRegion_, + dimensionedScalar(coeffs_.lookup("sigma")) + ), + + delta_ + ( + IOobject + ( + "deltaf", + time_.timeName(), + filmRegion_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + filmRegion_ + ), + U_ + ( + IOobject + ( + "Uf", + time_.timeName(), + filmRegion_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + filmRegion_ + ), + deltaRho_ + ( + IOobject + ( + delta_.name() + "*" + rho_.name(), + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + delta_*rho_, + zeroGradientFvPatchScalarField::typeName + ), + + phi_ + ( + IOobject + ( + "phi", + time_.timeName(), + filmRegion_, + IOobject::READ_IF_PRESENT, + IOobject::AUTO_WRITE + ), + fvc::interpolate(delta_*rho_*U_) & filmRegion_.Sf() + ), + + massForPrimary_ + ( + IOobject + ( + "massForPrimary", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + filmRegion_, + dimensionedScalar("zero", dimMass, 0.0), + zeroGradientFvPatchScalarField::typeName + ), + diametersForPrimary_ + ( + IOobject + ( + "diametersForPrimary", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + filmRegion_, + dimensionedScalar("zero", dimLength, -1.0), + zeroGradientFvPatchScalarField::typeName + ), + + USp_ + ( + IOobject + ( + "USpf", + time_.timeName(), + filmRegion_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + filmRegion_ + ), + pSp_ + ( + IOobject + ( + "pSpf", + time_.timeName(), + filmRegion_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + filmRegion_ + ), + rhoSp_ + ( + IOobject + ( + "rhoSpf", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + filmRegion_, + dimensionedScalar("zero", dimMass/dimTime/dimArea, 0.0), + pSp_.boundaryField().types() + ), + + USpPrimary_ + ( + IOobject + ( + USp_.name(), // must have same name as USp_ to enable mapping + time_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedVector("zero", USp_.dimensions(), vector::zero) + ), + pSpPrimary_ + ( + IOobject + ( + pSp_.name(), // must have same name as pSp_ to enable mapping + time_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("zero", pSp_.dimensions(), 0.0) + ), + rhoSpPrimary_ + ( + IOobject + ( + rhoSp_.name(), // must have same name as rhoSp_ to enable mapping + time_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("zero", rhoSp_.dimensions(), 0.0) + ), + + UPrimary_ + ( + IOobject + ( + "U", // must have same name as U on primary region to enable mapping + time_.timeName(), + filmRegion_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + filmRegion_ + ), + pPrimary_ + ( + IOobject + ( + "p", // must have same name as p on primary region to enable mapping + time_.timeName(), + filmRegion_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + filmRegion_ + ), + + injection_(injectionModel::New(*this, coeffs_)), + + addedMass_(0.0), + detachedMass_(0.0) +{ + read(); + + initialise(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::kinematicSingleLayer::~kinematicSingleLayer() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +inline const Foam::fvMesh& +Foam::surfaceFilmModels::kinematicSingleLayer::film() const +{ + return filmRegion_; +} + + +const Foam::labelList& +Foam::surfaceFilmModels::kinematicSingleLayer::filmBottomPatchIDs() const +{ + return filmBottomPatchIDs_; +} + + +const Foam::labelList& +Foam::surfaceFilmModels::kinematicSingleLayer::filmTopPatchIDs() const +{ + return filmTopPatchIDs_; +} + + +const Foam::labelList& +Foam::surfaceFilmModels::kinematicSingleLayer::primaryPatchIDs() const +{ + return primaryPatchIDs_; +} + + +bool Foam::surfaceFilmModels::kinematicSingleLayer::isFilmPatch +( + const label patchI +) const +{ + if (!active_) + { + return false; + } + + forAll(primaryPatchIDs_, i) + { + if (primaryPatchIDs_[i] == patchI) + { + return true; + } + } + + return false; +} + + +void Foam::surfaceFilmModels::kinematicSingleLayer::addSources +( + const label patchI, + const label faceI, + const scalar massSource, + const vector& momentumSource, + const scalar pressureSource, + const scalar energySource +) +{ + if (debug) + { + Info<< "\nSurface film: " << type() << ": adding to film source:" << nl + << " mass = " << massSource << nl + << " momentum = " << momentumSource << nl + << " pressure = " << pressureSource << endl; + } + + rhoSpPrimary_.boundaryField()[patchI][faceI] += massSource; + USpPrimary_.boundaryField()[patchI][faceI] += momentumSource; + pSpPrimary_.boundaryField()[patchI][faceI] += pressureSource; + + addedMass_ += massSource; +} + + +void Foam::surfaceFilmModels::kinematicSingleLayer::evolveFilm() +{ + transferPrimaryRegionFields(); + + updateSubmodels(); + + // Solve continuity for deltaRho_ + solveContinuity(); + + for (int oCorr=0; oCorr<nOuterCorr_; oCorr++) + { + // Explicit pressure source contribution + tmp<volScalarField> pu = this->pu(); + + // Implicit pressure source coefficient + tmp<volScalarField> pp = this->pp(); + + // Solve for momentum for U_ + tmp<fvVectorMatrix> UEqn = solveMomentum(pu(), pp()); + + // Film thickness correction loop + for (int corr=1; corr<=nCorr_; corr++) + { + // Solve thickness for delta_ + solveThickness(pu(), pp(), UEqn()); + } + } + + // Update deltaRho_ with new delta_ + deltaRho_ == delta_*rho_; + + // Reset source terms for next time integration + resetPrimaryRegionSourceTerms(); +} + + +const Foam::volVectorField& +Foam::surfaceFilmModels::kinematicSingleLayer::U() const +{ + return U_; +} + + +const Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::rho() const +{ + return rho_; +} + + +const Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::T() const +{ + FatalErrorIn + ( + "const volScalarField& kinematicSingleLayer::T() const" + ) << "T field not available for " << type() << abort(FatalError); + + return reinterpret_cast<const volScalarField&>(null); +} + + +const Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::cp() const +{ + FatalErrorIn + ( + "const volScalarField& kinematicSingleLayer::cp() const" + ) << "cp field not available for " << type() << abort(FatalError); + + return reinterpret_cast<const volScalarField&>(null); +} + + + +const Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::massForPrimary() const +{ + return massForPrimary_; +} + + +const Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::diametersForPrimary() const +{ + return diametersForPrimary_; +} + + +void Foam::surfaceFilmModels::kinematicSingleLayer::info() const +{ + Info<< "\nSurface film: " << type() << endl; + + // Output Courant number for info only - does not change time step + CourantNumber(); + + Info<< indent << "added mass = " + << returnReduce<scalar>(addedMass_, sumOp<scalar>()) << nl + << indent << "current mass = " + << gSum((deltaRho_*magSf_)()) << nl + << indent << "detached mass = " + << returnReduce<scalar>(detachedMass_, sumOp<scalar>()) << nl + << indent << "min/max(mag(U)) = " << min(mag(U_)).value() << ", " + << max(mag(U_)).value() << nl + << indent << "min/max(delta) = " << min(delta_).value() << ", " + << max(delta_).value() << nl; +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.H b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.H new file mode 100644 index 0000000000000000000000000000000000000000..aa8df0ce85909feceb881e1d2eb1ced5d97ce63c --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayer.H @@ -0,0 +1,482 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::kinematicSingleLayer + +Description + Kinematic form of single-cell layer surface film model + +SourceFiles + kinematicSingleLayer.C + +\*---------------------------------------------------------------------------*/ + +#ifndef kinematicSingleLayer_H +#define kinematicSingleLayer_H + +#include "surfaceFilmModel.H" +#include "fvMesh.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "fvMatrices.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +// Forward declaration of classes +class injectionModel; + +/*---------------------------------------------------------------------------*\ + Class kinematicSingleLayer Declaration +\*---------------------------------------------------------------------------*/ + +class kinematicSingleLayer +: + public surfaceFilmModel +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + kinematicSingleLayer(const kinematicSingleLayer&); + + //- Disallow default bitwise assignment + void operator=(const kinematicSingleLayer&); + + +protected: + + // Protected data + + // Mesh databases + + //- Film region mesh database + fvMesh filmRegion_; + + //- Patch normal vectors + volVectorField nHat_; + + //- Face area magnitudes / [m2] + volScalarField magSf_; + + //- List of patch IDs on the primary region coupled with the film + // region + labelList primaryPatchIDs_; + + //- List of patch IDs on oppositte side of the film region + labelList filmTopPatchIDs_; + + //- List of patch IDs on the film region coupled with the primary + // region + labelList filmBottomPatchIDs_; + + + // Solution parameters + + //- Momentum predictor + Switch momentumPredictor_; + + //- Number of outer correctors + label nOuterCorr_; + + //- Number of PISO-like correctors + label nCorr_; + + //- Number of non-orthogonal correctors + label nNonOrthCorr_; + + //- Cumulative continuity error + scalar cumulativeContErr_; + + + // Model parameters + + //- Skin frition coefficient for film/main region interface + scalar Cf_; + + //- Stable film thickness - film cannot detach until this is reached + dimensionedScalar deltaStable_; + + + // Thermo properties + + //- Density / [kg/m3] + volScalarField rho_; + + //- Dynamic viscosity / [Pa.s] + volScalarField mu_; + + //- Surface tension / [m/s2] + volScalarField sigma_; + + + // Fields + + //- Film thickness / [m] + volScalarField delta_; + + //- Velocity / [m/s] + volVectorField U_; + + //- Film thickness*density (helper field) / [kg/m2] + volScalarField deltaRho_; + + //- Mass flux (includes film thickness) / [kg.m/s] + surfaceScalarField phi_; + + + // Transfer fields - to the primary region + + //- Return the film mass available for transfer + volScalarField massForPrimary_; + + //- Return the parcel diameters originating from film + volScalarField diametersForPrimary_; + + + // Source term fields + + // Film region - registered to the film region mesh + // Note: need boundary value mapped from primary region, and then + // pushed into the patch internal field + + //- Momementum / [kg/m/s2] + volVectorField USp_; + + //- Pressure / [Pa] + volScalarField pSp_; + + //- Mass / [kg/m2/s] + volScalarField rhoSp_; + + + // Primary region - registered to the primary region mesh + // Internal use only - not read-in + + //- Momementum / [kg/m/s2] + volVectorField USpPrimary_; + + //- Pressure / [Pa] + volScalarField pSpPrimary_; + + //- Mass / [kg/m2/s] + volScalarField rhoSpPrimary_; + + + // Fields mapped from primary region - registered to the film region + // Note: need both boundary AND patch internal fields to be mapped + + //- Velocity / [m/s] + volVectorField UPrimary_; + + //- Pressure / [Pa] + volScalarField pPrimary_; + + + // Sub-models + + //- Injection + autoPtr<injectionModel> injection_; + + + // Checks + + //- Cumulative mass added via sources [kg] + scalar addedMass_; + + + // Detached surface properties + + //- Cumulative mass detached [kg] + scalar detachedMass_; + + + // Protected member functions + + //- Initialise the film model - called on construction + void initialise(); + + //- Read control parameters from dictionary + virtual bool read(); + + //- Reset source term fields + virtual void resetPrimaryRegionSourceTerms(); + + //- Transfer fields from the primary region to the film region + virtual void transferPrimaryRegionFields(); + + //- Correct the source terms for film that detaches from film region + virtual void correctDetachedFilm(); + + // Explicit pressure source contribution + virtual tmp<volScalarField> pu(); + + // Implicit pressure source coefficient + virtual tmp<volScalarField> pp(); + + //- Update the film sub-models + virtual void updateSubmodels(); + + //- Courant number evaluation + virtual scalar CourantNumber() const; + + //- Continuity check + virtual void continuityCheck(); + + //- Return the stress term for the momentum equation + virtual tmp<fvVectorMatrix> tau(volVectorField& dU) const; + + //- Constrain a film region master/slave boundaries of a field to a + // given value + template<class Type> + void constrainFilmField + ( + Type& field, + const typename Type::cmptType& value + ); + + + // Equations + + //- Solve continuity equation + virtual void solveContinuity(); + + //- Solve for film velocity + virtual tmp<fvVectorMatrix> solveMomentum + ( + const volScalarField& pu, + const volScalarField& pp + ); + + //- Solve coupled velocity-thickness equations + virtual void solveThickness + ( + const volScalarField& pu, + const volScalarField& pp, + const fvVectorMatrix& UEqn + ); + + +public: + + //- Runtime type information + TypeName("kinematicSingleLayer"); + + + // Constructors + + //- Construct from components + kinematicSingleLayer + ( + const word& modelType, + const fvMesh& mesh, + const dimensionedVector& g + ); + + + //- Destructor + virtual ~kinematicSingleLayer(); + + + // Member Functions + + // Access + + //- Return the film mesh database + virtual const fvMesh& film() const; + + //- Return the patch normal vectors + inline const volVectorField& nHat() const; + + //- Return the face area magnitudes / [m2] + inline const volScalarField& magSf() const; + + //- Return the list of coupled patches on the film region + virtual const labelList& filmBottomPatchIDs() const; + + //- Return the list of patches oppositte coupled patches + virtual const labelList& filmTopPatchIDs() const; + + //- Return the list of coupled patches on the primary region + virtual const labelList& primaryPatchIDs() const; + + + // Solution parameters + + //- Return the momentum predictor + inline const Switch& momentumPredictor() const; + + //- Return the number of outer correctors + inline label nOuterCorr() const; + + //- Return the number of PISO correctors + inline label nCorr() const; + + //- Return the number of non-orthogonal correctors + inline label nNonOrthCorr() const; + + + // Model parameters + + //- Return the skin friction coefficient + inline scalar Cf() const; + + + // Thermo properties + + //- Return const access to the dynamic viscosity / [Pa.s] + inline const volScalarField& mu() const; + + //- Return const access to the surface tension / [m/s2] + inline const volScalarField& sigma() const; + + + // Fields + + //- Return const access to the film thickness / [m] + inline const volScalarField& delta() const; + + //- Return the film velocity [m/s] + virtual const volVectorField& U() const; + + //- Return the film density [kg/m3] + virtual const volScalarField& rho() const; + + //- Return the film temperature [K] + virtual const volScalarField& T() const; + + //- Return the film specific heat capacity [J/kg/K] + virtual const volScalarField& cp() const; + + + // Transfer fields - to the primary region + + //- Return the film mass available for transfer + virtual const volScalarField& massForPrimary() const; + + //- Return the parcel diameters originating from film + virtual const volScalarField& diametersForPrimary() const; + + + // External helper functions + + //- Return true if patchI on the primary region is a coupled patch + // to the film region + virtual bool isFilmPatch(const label patchI) const; + + //- External hook to add sources to the film + virtual void addSources + ( + const label patchI, // patchI on primary region + const label faceI, // faceI of patchI + const scalar massSource, // [kg] + const vector& momentumSource, // [kg.m/s] (tangential momentum) + const scalar pressureSource, // [kg.m/s] (normal momentum) + const scalar energySource = 0 // [J] + ); + + + // Source fields (read/write access) + + // Primary region + + //- Momementum / [kg/m/s2] + inline volVectorField& USpPrimary(); + + //- Pressure / [Pa] + inline volScalarField& pSpPrimary(); + + //- Mass / [kg/m2/s] + inline volScalarField& rhoSpPrimary(); + + + // Film region + + //- Momementum / [kg/m/s2] + inline volVectorField& USp(); + + //- Pressure / [Pa] + inline volScalarField& pSp(); + + //- Mass / [kg/m2/s] + inline volScalarField& rhoSp(); + + + // Sub-models + + //- Injection + inline injectionModel& injection(); + + + // Helper functions + + //- Return the gravity tangential component contributions + inline tmp<volVectorField> gTan() const; + + //- Return the gravity normal-to-patch component contribution + inline tmp<volScalarField> gNorm() const; + + //- Return the gravity normal-to-patch component contribution + // Clipped so that only non-zero if g & nHat_ < 0 + inline tmp<volScalarField> gNormClipped() const; + + + // Evolution + + //- Evolve the film equations + virtual void evolveFilm(); + + + // I-O + + //- Provide some feedback + virtual void info() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "kinematicSingleLayerTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "kinematicSingleLayerI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayerI.H b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayerI.H new file mode 100644 index 0000000000000000000000000000000000000000..521d460d44fc25f1e4457e7b54dcb8147b47827e --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayerI.H @@ -0,0 +1,221 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "kinematicSingleLayer.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline const Foam::volVectorField& +Foam::surfaceFilmModels::kinematicSingleLayer::nHat() const +{ + return nHat_; +} + + +inline const Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::magSf() const +{ + return magSf_; +} + + +inline const Foam::Switch& +Foam::surfaceFilmModels::kinematicSingleLayer::momentumPredictor() const +{ + return momentumPredictor_; +} + + +inline Foam::label +Foam::surfaceFilmModels::kinematicSingleLayer::nOuterCorr() const +{ + return nOuterCorr_; +} + + +inline Foam::label Foam::surfaceFilmModels::kinematicSingleLayer::nCorr() const +{ + return nCorr_; +} + + +inline Foam::label +Foam::surfaceFilmModels::kinematicSingleLayer::nNonOrthCorr() const +{ + return nNonOrthCorr_; +} + + +inline Foam::scalar Foam::surfaceFilmModels::kinematicSingleLayer::Cf() const +{ + return Cf_; +} + + +inline const Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::mu() const +{ + return mu_; +} + + +inline const Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::sigma() const +{ + return sigma_; +} + + +inline const Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::delta() const +{ + return delta_; +} + +inline Foam::volVectorField& +Foam::surfaceFilmModels::kinematicSingleLayer::USpPrimary() +{ + return USpPrimary_; +} + + +inline Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::pSpPrimary() +{ + return pSpPrimary_; +} + + +inline Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::rhoSpPrimary() +{ + return rhoSpPrimary_; +} + + +inline Foam::volVectorField& +Foam::surfaceFilmModels::kinematicSingleLayer::USp() +{ + return USp_; +} + + +inline Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::pSp() +{ + return pSp_; +} + + +inline Foam::volScalarField& +Foam::surfaceFilmModels::kinematicSingleLayer::rhoSp() +{ + return rhoSp_; +} + + +inline Foam::surfaceFilmModels::injectionModel& +Foam::surfaceFilmModels::kinematicSingleLayer::injection() +{ + return injection_(); +} + + +inline Foam::tmp<Foam::volScalarField> +Foam::surfaceFilmModels::kinematicSingleLayer::gNorm() const +{ + tmp<volScalarField> tgNorm + ( + new volScalarField + ( + IOobject + ( + "gNorm", + filmRegion_.time().timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + g_ & nHat_, + zeroGradientFvPatchScalarField::typeName + ) + ); + + return tgNorm; +} + + +inline Foam::tmp<Foam::volScalarField> +Foam::surfaceFilmModels::kinematicSingleLayer::gNormClipped() const +{ + tmp<volScalarField> tgNormClipped + ( + new volScalarField + ( + IOobject + ( + "gNormClipped", + filmRegion_.time().timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + g_ & nHat_, + zeroGradientFvPatchScalarField::typeName + ) + ); + + volScalarField& gNormClipped = tgNormClipped(); + gNormClipped.min(0.0); + + return tgNormClipped; +} + + +inline Foam::tmp<Foam::volVectorField> +Foam::surfaceFilmModels::kinematicSingleLayer::gTan() const +{ + tmp<volVectorField> tgTan + ( + new volVectorField + ( + IOobject + ( + "gTan", + filmRegion_.time().timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + g_ - nHat_*gNorm(), + zeroGradientFvPatchVectorField::typeName + ) + ); + + return tgTan; +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayerTemplates.C b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayerTemplates.C new file mode 100644 index 0000000000000000000000000000000000000000..de8a93b2708f59b6f70b955f581451f47810bdc7 --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/kinematicSingleLayer/kinematicSingleLayerTemplates.C @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "kinematicSingleLayer.H" + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +template<class Type> +void Foam::surfaceFilmModels::kinematicSingleLayer::constrainFilmField +( + Type& field, + const typename Type::cmptType& value +) +{ + forAll(filmBottomPatchIDs_, i) + { + label patchI = filmBottomPatchIDs_[i]; + field.boundaryField()[patchI] = value; + if (debug) + { + Info<< "Constraining " << field.name() + << " boundary " << field.boundaryField()[patchI].patch().name() + << " to " << value << endl; + } + } + forAll(filmTopPatchIDs_, i) + { + label patchI = filmTopPatchIDs_[i]; + field.boundaryField()[patchI] = value; + if (debug) + { + Info<< "Constraining " << field.name() + << " boundary " << field.boundaryField()[patchI].patch().name() + << " to " << value << endl; + } + } +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.C b/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.C new file mode 100644 index 0000000000000000000000000000000000000000..07750f876eedfbabb71be25b4fdc11b061fe7436 --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.C @@ -0,0 +1,209 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "noFilm.H" +#include "addToRunTimeSelectionTable.H" +#include "volFields.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(noFilm, 0); + addToRunTimeSelectionTable(surfaceFilmModel, noFilm, mesh); + } +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +bool Foam::surfaceFilmModels::noFilm::read() +{ + if (surfaceFilmModel::read()) + { + // no additional info to read + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::noFilm::noFilm +( + const word& modelType, + const fvMesh& mesh, + const dimensionedVector& g +) +: + surfaceFilmModel(modelType, mesh, g) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::noFilm::~noFilm() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::surfaceFilmModels::noFilm::evolveFilm() +{ + // do nothing +} + + +const Foam::fvMesh& Foam::surfaceFilmModels::noFilm::film() const +{ + FatalErrorIn("const fvMesh& noFilm::film() const") + << "Cannot return film for noFilm model" << abort(FatalError); + + return reinterpret_cast<const fvMesh&>(null); +} + + +const Foam::labelList& +Foam::surfaceFilmModels::noFilm::filmBottomPatchIDs() const +{ + return labelList::null(); +} + + +const Foam::labelList& Foam::surfaceFilmModels::noFilm::filmTopPatchIDs() const +{ + return labelList::null(); +} + + +const Foam::labelList& Foam::surfaceFilmModels::noFilm::primaryPatchIDs() const +{ + return labelList::null(); +} + + +bool Foam::surfaceFilmModels::noFilm::isFilmPatch(const label) const +{ + return false; +} + + +void Foam::surfaceFilmModels::noFilm::addSources +( + const label, + const label, + const scalar, + const vector&, + const scalar, + const scalar +) +{ + // do nothing +} + + +const Foam::volVectorField& Foam::surfaceFilmModels::noFilm::U() const +{ + FatalErrorIn + ( + "const volScalarField& noFilm::U() const" + ) << "U field not available for " << type() << abort(FatalError); + + return reinterpret_cast<const volVectorField&>(null); +} + + +const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::rho() const +{ + FatalErrorIn + ( + "const volScalarField& noFilm::rho() const" + ) << "rho field not available for " << type() << abort(FatalError); + + return reinterpret_cast<const volScalarField&>(null); +} + + +const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::T() const +{ + FatalErrorIn + ( + "const Foam::volScalarField& Foam::noFilm::T() const" + ) << "T field not available for " << type() << abort(FatalError); + + return reinterpret_cast<const volScalarField&>(null); +} + + +const Foam::volScalarField& Foam::surfaceFilmModels::noFilm::cp() const +{ + FatalErrorIn + ( + "const volScalarField& noFilm::cp() const" + ) << "cp field not available for " << type() << abort(FatalError); + + return reinterpret_cast<const volScalarField&>(null); +} + + +const Foam::volScalarField& +Foam::surfaceFilmModels::noFilm::massForPrimary() const +{ + FatalErrorIn + ( + "const volScalarField& noFilm::massForPrimary() const" + ) << "massForPrimary field not available for " << type() + << abort(FatalError); + + return reinterpret_cast<const volScalarField&>(null); +} + + +const Foam::volScalarField& +Foam::surfaceFilmModels::noFilm::diametersForPrimary() const +{ + FatalErrorIn + ( + "const volScalarField& noFilm::diametersForPrimary() const" + ) << "diametersForPrimary field not available for " << type() + << abort(FatalError); + + return reinterpret_cast<const volScalarField&>(null); +} + + +void Foam::surfaceFilmModels::noFilm::info() const +{ + // do nothing +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.H b/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.H new file mode 100644 index 0000000000000000000000000000000000000000..adc97166bbd681d7b44a9eb86f897a148012c425 --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/noFilm/noFilm.H @@ -0,0 +1,173 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::noFilm + +Description + Dummy surface film model for 'none' + +SourceFiles + noFilm.C + +\*---------------------------------------------------------------------------*/ + +#ifndef noFilm_H +#define noFilm_H + +#include "surfaceFilmModel.H" +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class noFilm Declaration +\*---------------------------------------------------------------------------*/ + +class noFilm +: + public surfaceFilmModel +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + noFilm(const noFilm&); + + //- Disallow default bitwise assignment + void operator=(const noFilm&); + + +protected: + + // Protected member functions + + //- Read control parameters from dictionary + virtual bool read(); + + +public: + + //- Runtime type information + TypeName("none"); + + + // Constructors + + //- Construct from components + noFilm + ( + const word& modelType, + const fvMesh& mesh, + const dimensionedVector& g + ); + + + //- Destructor + virtual ~noFilm(); + + + // Member Functions + + // Access + + //- Return the film mesh database + virtual const fvMesh& film() const; + + //- Return the list of coupled patches on the film region + virtual const labelList& filmBottomPatchIDs() const; + + //- Return the list of patches oppositte coupled patches + virtual const labelList& filmTopPatchIDs() const; + + //- Return the list of coupled patches on the primary region + virtual const labelList& primaryPatchIDs() const; + + //- Return true if patchI is a coupled patch to the film region + virtual bool isFilmPatch(const label patchI) const; + + //- External hook to add sources to the film + virtual void addSources + ( + const label patchI, + const label faceI, + const scalar massSource, + const vector& momentumSource, + const scalar pressureSource, + const scalar energySource + ); + + + // Fields + + //- Return the film velocity [m/s] + virtual const volVectorField& U() const; + + //- Return the film density [kg/m3] + virtual const volScalarField& rho() const; + + //- Return the film temperature [K] + virtual const volScalarField& T() const; + + //- Return the film specific heat capacity [J/kg/K] + virtual const volScalarField& cp() const; + + + // Transfer fields - to the primary region + + //- Return the film mass available for transfer + virtual const volScalarField& massForPrimary() const; + + //- Return the parcel diameters originating from film + virtual const volScalarField& diametersForPrimary() const; + + + // Evolution + + //- Evolve the film equations + virtual void evolveFilm(); + + + // I-O + + //- Provide some feedback + virtual void info() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/newSurfaceFilmModel.C b/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/newSurfaceFilmModel.C new file mode 100644 index 0000000000000000000000000000000000000000..fb9d7e3bb6c8d396a082d1a3688058ca794032b6 --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/newSurfaceFilmModel.C @@ -0,0 +1,78 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "surfaceFilmModel.H" +#include "fvMesh.H" +#include "Time.H" + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr<Foam::surfaceFilmModels::surfaceFilmModel> +Foam::surfaceFilmModels::surfaceFilmModel::New +( + const fvMesh& mesh, + const dimensionedVector& g +) +{ + word modelType; + + { + IOdictionary surfaceFilmPropertiesDict + ( + IOobject + ( + "surfaceFilmProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ); + + surfaceFilmPropertiesDict.lookup("surfaceFilmModel") >> modelType; + } + + Info<< "Selecting surfaceFilmModel " << modelType << endl; + + meshConstructorTable::iterator cstrIter = + meshConstructorTablePtr_->find(modelType); + + if (cstrIter == meshConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "surfaceFilmModel::New(const fvMesh&, const dimensionedVector&)" + ) << "Unknown surfaceFilmModel type " << modelType + << nl << nl << "Valid surfaceFilmModel types are:" << nl + << meshConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr<surfaceFilmModel>(cstrIter()(modelType, mesh, g)); +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModel.C b/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModel.C new file mode 100644 index 0000000000000000000000000000000000000000..6eeb1398fe0e9ccec110681d60381d1b51798f8c --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModel.C @@ -0,0 +1,166 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "surfaceFilmModel.H" +#include "fvc.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(surfaceFilmModel, 0); + defineRunTimeSelectionTable(surfaceFilmModel, mesh); + } +} + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +bool Foam::surfaceFilmModels::surfaceFilmModel::read() +{ + if (regIOobject::read()) + { + active_.readIfPresent("active", *this); + if (const dictionary* dictPtr = subDictPtr(type() + "Coeffs")) + { + coeffs_ <<= *dictPtr; + } + + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::surfaceFilmModel::surfaceFilmModel +( + const fvMesh& mesh, + const dimensionedVector& g +) +: + IOdictionary + ( + IOobject + ( + "surfaceFilmProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ), + mesh_(mesh), + time_(mesh.time()), + active_(false), + g_(g), + filmRegionName_("none"), + coeffs_(dictionary::null) +{} + + +Foam::surfaceFilmModels::surfaceFilmModel::surfaceFilmModel +( + const word& type, + const fvMesh& mesh, + const dimensionedVector& g +) +: + IOdictionary + ( + IOobject + ( + "surfaceFilmProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ) + ), + mesh_(mesh), + time_(mesh.time()), + + active_(lookup("active")), + g_(g), + filmRegionName_(lookup("filmRegionName")), + coeffs_(subDict(type + "Coeffs")) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::surfaceFilmModel::~surfaceFilmModel() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +const Foam::fvMesh& Foam::surfaceFilmModels::surfaceFilmModel::mesh() const +{ + return mesh_; +} + + +const Foam::Time& Foam::surfaceFilmModels::surfaceFilmModel::time() const +{ + return time_; +} + + +void Foam::surfaceFilmModels::surfaceFilmModel::evolve() +{ + if (active_) + { + if (mesh_.changing()) + { + FatalErrorIn("surfaceFilmModel::evolveFilm()") + << "Currently not possible to apply surface film model to " + << "moving mesh cases" << nl << abort(FatalError); + } + + Info<< "\nEvolving surface film for region " << filmRegionName_ + << endl; + + // Update any input information + read(); + + // Increment the film equations up to the new time level + evolveFilm(); + + // Provide some feedback + Info<< incrIndent; + info(); + Info<< endl << decrIndent; + } +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModel.H b/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModel.H new file mode 100644 index 0000000000000000000000000000000000000000..1be3ad456b89e95986d1ca877e1837e33ea852cf --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModel.H @@ -0,0 +1,250 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::surfaceFilmModel + +Description + +SourceFiles + surfaceFilmModelI.H + surfaceFilmModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef surfaceFilmModel_H +#define surfaceFilmModel_H + +#include "IOdictionary.H" +#include "Switch.H" +#include "dimensionedVector.H" +#include "runTimeSelectionTables.H" +#include "volFieldsFwd.H" +#include "labelList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class fvMesh; +class Time; + +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class surfaceFilmModel Declaration +\*---------------------------------------------------------------------------*/ + +class surfaceFilmModel +: + public IOdictionary +{ +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + surfaceFilmModel(const surfaceFilmModel&); + + //- Disallow default bitwise assignment + void operator=(const surfaceFilmModel&); + + +protected: + + // Protected data + + //- Reference to the mesh database + const fvMesh& mesh_; + + //- Reference to the time database + const Time& time_; + + //- Active flag + Switch active_; + + //- Acceleration due to gravity [m/s2] + const dimensionedVector& g_; + + //- Name of film region + word filmRegionName_; + + //- Model coefficients dictionary + dictionary coeffs_; + + + // Protected member functions + + //- Read control parameters from dictionary + virtual bool read(); + + //- Evolve the film + virtual void evolveFilm() = 0; + + +public: + + //- Runtime type information + TypeName("surfaceFilmModel"); + + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + surfaceFilmModel, + mesh, + ( + const word& type, + const fvMesh& mesh, + const dimensionedVector& g + ), + (type, mesh, g) + ); + + // Constructors + + //- Construct null + surfaceFilmModel(const fvMesh& mesh, const dimensionedVector& g); + + //- Construct from type name and fvMesh + surfaceFilmModel + ( + const word& type, + const fvMesh& mesh, + const dimensionedVector& g + ); + + + // Selectors + + //- Return a reference to the selected surface film model + static autoPtr<surfaceFilmModel> New + ( + const fvMesh& mesh, + const dimensionedVector& g + ); + + + //- Destructor + virtual ~surfaceFilmModel(); + + + // Member Functions + + // Access + + //- Return the reference to the primary mesh database + const fvMesh& mesh() const; + + //- Return the reference to the time database + const Time& time() const; + + //- Return the active flag + inline const Switch& active() const; + + //- Return the model coefficients dictionary + inline const dictionary& coeffs() const; + + //- Return the film mesh database + virtual const fvMesh& film() const = 0; + + //- Return the list of coupled patches on the film region + virtual const labelList& filmBottomPatchIDs() const = 0; + + //- Return the list of patches oppositte coupled patches + virtual const labelList& filmTopPatchIDs() const = 0; + + //- Return the list of coupled patches on the primary region + virtual const labelList& primaryPatchIDs() const = 0; + + //- Return true if primary patchI is coupled to the film region + virtual bool isFilmPatch(const label patchI) const = 0; + + //- External hook to add sources to the film + virtual void addSources + ( + const label patchI, + const label faceI, + const scalar massSource, + const vector& momentumSource, + const scalar pressureSource, + const scalar energySource + ) = 0; + + + // Fields + + //- Return the film velocity [m/s] + virtual const volVectorField& U() const = 0; + + //- Return the film density [kg/m3] + virtual const volScalarField& rho() const = 0; + + //- Return the film temperature [K] + virtual const volScalarField& T() const = 0; + + //- Return the film specific heat capacity [J/kg/K] + virtual const volScalarField& cp() const = 0; + + + // Transfer fields - to the primary region + + //- Return the film mass available for transfer + virtual const volScalarField& massForPrimary() const = 0; + + //- Return the parcel diameters originating from film + virtual const volScalarField& diametersForPrimary() const = 0; + + + // Evolution + + //- Evolve the film + virtual void evolve(); + + + // I-O + + //- Provide some feedback + virtual void info() const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "surfaceFilmModelI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModelI.H b/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModelI.H new file mode 100644 index 0000000000000000000000000000000000000000..9adf1d72cb2d128f8df4fdccd9fa015545d0941c --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/surfaceFilmModel/surfaceFilmModelI.H @@ -0,0 +1,44 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "surfaceFilmModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline const Foam::Switch& +Foam::surfaceFilmModels::surfaceFilmModel::active() const +{ + return active_; +} + + +inline const Foam::dictionary& +Foam::surfaceFilmModels::surfaceFilmModel::coeffs() const +{ + return coeffs_; +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.C b/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.C new file mode 100644 index 0000000000000000000000000000000000000000..d870b19a34ad1604461ee98ec52211fc2430c5cf --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.C @@ -0,0 +1,394 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "thermoSingleLayer.H" +#include "fvcDiv.H" +#include "fvcLaplacian.H" +#include "fvm.H" +#include "phaseChangeModel.H" +#include "addToRunTimeSelectionTable.H" + +// Sub-models +#include "injectionModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + namespace surfaceFilmModels + { + defineTypeNameAndDebug(thermoSingleLayer, 0); + addToRunTimeSelectionTable(surfaceFilmModel, thermoSingleLayer, mesh); + } +} + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +bool Foam::surfaceFilmModels::thermoSingleLayer::read() +{ + if (kinematicSingleLayer::read()) + { + coeffs_.lookup("htcw") >> htcw_; + coeffs_.lookup("htcs") >> htcs_; + + return true; + } + else + { + return false; + } +} + + +void Foam::surfaceFilmModels::thermoSingleLayer::initialise() +{ + if (debug) + { + Pout<< "thermoSingleLayer::initialise()" << endl; + } + + kinematicSingleLayer::initialise(); + + hs_ == hs(T_); +} + + +void Foam::surfaceFilmModels::thermoSingleLayer::resetPrimaryRegionSourceTerms() +{ + kinematicSingleLayer::resetPrimaryRegionSourceTerms(); + + hsSpPrimary_ == dimensionedScalar("zero", hsSp_.dimensions(), 0.0); +} + + +void Foam::surfaceFilmModels::thermoSingleLayer::transferPrimaryRegionFields() +{ + kinematicSingleLayer::transferPrimaryRegionFields(); + + // Update temperature from primary region via direct mapped (coupled) + // boundary conditions + TPrimary_.correctBoundaryConditions(); + + // Retrieve the source fields from the primary region via direct mapped + // (coupled) boundary conditions + // - fields require transfer of values for both patch AND to push the + // values into the first layer of internal cells + hsSp_.correctBoundaryConditions(); + + // Convert accummulated source terms into per unit area per unit time + // Note: boundary values will still have original (neat) values + const scalar deltaT = filmRegion_.time().deltaTValue(); + hsSp_.field() /= magSf_*deltaT; +} + + +void Foam::surfaceFilmModels::thermoSingleLayer::updateSubmodels() +{ + kinematicSingleLayer::updateSubmodels(); + + const dimensionedScalar deltaT = filmRegion_.time().deltaT(); + hsSp_ -= massForPrimary_*hs_/magSf_/deltaT; + + // Update the sub-models + phaseChange_->correct(); +} + + +Foam::tmp<Foam::fvScalarMatrix> Foam::surfaceFilmModels::thermoSingleLayer::q +( + volScalarField& hs +) const +{ + DimensionedField<scalar, volMesh> Tw + ( + IOobject + ( + "Tw", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE, + false + ), + filmRegion_, + dimensionedScalar("zero", dimTemperature, 0.0) + ); + + for (label i=0; i<filmBottomPatchIDs_.size(); i++) + { + label patchI = filmBottomPatchIDs_[i]; + const polyPatch& pp = filmRegion_.boundaryMesh()[patchI]; + UIndirectList<scalar>(Tw, pp.faceCells()) = + TPrimary_.boundaryField()[patchI]; + } + + // TODO: Use T at film thickness instead of cell value + DimensionedField<scalar, volMesh> Ts = + TPrimary_.dimensionedInternalField(); + + return + ( + - fvm::Sp(htcs_/cp_, hs) + + htcs_*(dimensionedScalar("Tstd", dimTemperature, 298.15) - Ts) + - fvm::Sp(htcw_/cp_, hs) + + htcw_*(dimensionedScalar("Tstd", dimTemperature, 298.15) - Tw) + ); +} + + +void Foam::surfaceFilmModels::thermoSingleLayer::solveEnergy() +{ + if (debug) + { + Info<< "thermoSingleLayer::solveEnergy()" << endl; + } + + solve + ( + fvm::ddt(deltaRho_, hs_) + + fvm::div(phi_, hs_) + == + hsSp_ + + q(hs_) + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::thermoSingleLayer::thermoSingleLayer +( + const word& modelType, + const fvMesh& mesh, + const dimensionedVector& g +) +: + kinematicSingleLayer(modelType, mesh, g), + cp_ + ( + IOobject + ( + "cp", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + filmRegion_, + dimensionedScalar(coeffs_.lookup("cp")) + ), + + htcw_ + ( + dimensionedScalar("htc", dimEnergy/dimTime/dimArea/dimTemperature, 0.0) + ), + htcs_ + ( + dimensionedScalar("htc", dimEnergy/dimTime/dimArea/dimTemperature, 0.0) + ), + + T_ + ( + IOobject + ( + "Tf", + time_.timeName(), + filmRegion_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + filmRegion_ + ), + hs_ + ( + IOobject + ( + "hsf", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + filmRegion_, + dimensionedScalar("zero", dimEnergy/dimMass, 0.0), + T_.boundaryField().types() + ), + + hsSp_ + ( + IOobject + ( + "hsSp", + time_.timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + filmRegion_, + dimensionedScalar("zero", dimEnergy/dimArea/dimTime, 0.0), + pSp_.boundaryField().types() + ), + + hsSpPrimary_ + ( + IOobject + ( + hsSp_.name(), // must have same name as hSp_ to enable mapping + time_.timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedScalar("zero", hsSp_.dimensions(), 0.0) + ), + + TPrimary_ + ( + IOobject + ( + "T", // must have same name as T on primary region to enable mapping + time_.timeName(), + filmRegion_, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + filmRegion_ + ), + + phaseChange_(phaseChangeModel::New(*this, coeffs_)), + + hsSpDetach_(filmRegion_.nCells(), 0.0) +{ + read(); + + initialise(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::surfaceFilmModels::thermoSingleLayer::~thermoSingleLayer() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +void Foam::surfaceFilmModels::thermoSingleLayer::addSources +( + const label patchI, + const label faceI, + const scalar massSource, + const vector& momentumSource, + const scalar pressureSource, + const scalar energySource +) +{ + kinematicSingleLayer::addSources + ( + patchI, + faceI, + massSource, + momentumSource, + pressureSource, + energySource + ); + + if (debug) + { + Info<< " energy = " << energySource << nl << endl; + } + + hsSpPrimary_.boundaryField()[patchI][faceI] += energySource; +} + + +void Foam::surfaceFilmModels::thermoSingleLayer::evolveFilm() +{ + transferPrimaryRegionFields(); + + updateSubmodels(); + + // Solve continuity for deltaRho_ + solveContinuity(); + + for (int oCorr=0; oCorr<nOuterCorr_; oCorr++) + { + // Explicit pressure source contribution + tmp<volScalarField> pu = this->pu(); + + // Implicit pressure source coefficient + tmp<volScalarField> pp = this->pp(); + + // Solve for momentum for U_ + tmp<fvVectorMatrix> UEqn = solveMomentum(pu(), pp()); + + // Film thickness correction loop + for (int corr=1; corr<=nCorr_; corr++) + { + // Solve energy for hs_ + solveEnergy(); + + // Solve thickness for delta_ + solveThickness(pu(), pp(), UEqn()); + } + } + + // Update deltaRho_ with new delta_ + deltaRho_ == delta_*rho_; + + // Update temperature using latest hs_ + T_ == T(hs_); + + // Reset source terms for next time integration + resetPrimaryRegionSourceTerms(); +} + + +const Foam::volScalarField& +Foam::surfaceFilmModels::thermoSingleLayer::T() const +{ + return T_; +} + + +const Foam::volScalarField& +Foam::surfaceFilmModels::thermoSingleLayer::cp() const +{ + return cp_; +} + + +void Foam::surfaceFilmModels::thermoSingleLayer::info() const +{ + kinematicSingleLayer::info(); + + Info<< indent<< "min/max(T) = " << min(T_).value() << ", " + << max(T_).value() << nl; +} + + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.H b/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.H new file mode 100644 index 0000000000000000000000000000000000000000..eb7fb7800a16bf10e5ba8c8165e7ea498db85d26 --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayer.H @@ -0,0 +1,280 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +Class + Foam::thermoSingleLayer + +Description + Thermodynamic form of single-cell layer surface film model + + Note: defining enthalpy as cp(T - Tstd) - when using liquids from the + thermophysical library, their enthalpies are calculated similarly, where + Tstd = 298.15 K + +SourceFiles + thermoSingleLayer.C + +\*---------------------------------------------------------------------------*/ + +#ifndef thermoSingleLayer_H +#define thermoSingleLayer_H + +#include "kinematicSingleLayer.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace surfaceFilmModels +{ + +// Forward declaration of classes +class phaseChangeModel; + +/*---------------------------------------------------------------------------*\ + Class thermoSingleLayer Declaration +\*---------------------------------------------------------------------------*/ + +class thermoSingleLayer +: + public kinematicSingleLayer +{ +private: + + // Private member functions + + //- Disallow default bitwise copy construct + thermoSingleLayer(const thermoSingleLayer&); + + //- Disallow default bitwise assignment + void operator=(const thermoSingleLayer&); + + +protected: + + // Protected data + + // Thermo properties TODO: currently read from coeffs dictionary + + //- Specific heat capacity / [J/kg/K] + volScalarField cp_; + + + // Model parameters + + //- Heat transfer coefficient bewteen wall and film [W/m2/K] + dimensionedScalar htcw_; + + //- Heat transfer coefficient bewteen film surface and primary + // region [W/m2/K] + dimensionedScalar htcs_; + + + // Fields + + //- Temperature / [K] + volScalarField T_; + + //- Sensible)enthalpy / [J/kg] + volScalarField hs_; + + + // Source term fields + + // Film region - registered to the film region mesh + // Note: need boundary value mapped from primary region, and then + // pushed into the patch internal field + + //- Energy / [J/m2/s] + volScalarField hsSp_; + + + // Primary region - registered to the primary region mesh + // Internal use only - not read-in + + //- Energy / [J/m2/s] + volScalarField hsSpPrimary_; + + + // Fields mapped from primary region - registered to the film region + // Note: need both boundary AND patch internal fields to be mapped + + //- Temperature / [K] + volScalarField TPrimary_; + + + // Sub-models + + //- Phase change + autoPtr<phaseChangeModel> phaseChange_; + + + // Detached surface properties + + //- Energy sink from film to carrier phase [kg] + scalarField hsSpDetach_; + + + // Protected member functions + + //- Initialise the film model - called on construction + void initialise(); + + //- Read control parameters from dictionary + virtual bool read(); + + //- Reset source term fields + virtual void resetPrimaryRegionSourceTerms(); + + //- Transfer fields from the primary region to the film region + virtual void transferPrimaryRegionFields(); + + //- Update the film sub-models + virtual void updateSubmodels(); + + //- Return the wall/surface heat transfer term for the enthalpy equation + virtual tmp<fvScalarMatrix> q(volScalarField& h) const; + + + // Equations + + //- Solve energy equation + virtual void solveEnergy(); + + +public: + + //- Runtime type information + TypeName("thermoSingleLayer"); + + + // Constructors + + //- Construct from components + thermoSingleLayer + ( + const word& modelType, + const fvMesh& mesh, + const dimensionedVector& g + ); + + + //- Destructor + virtual ~thermoSingleLayer(); + + + // Member Functions + + // Model parameters + + //- Return the heat transfer coefficient bewteen wall and film + inline const dimensionedScalar& htcw() const; + + //- Return the Heat transfer coefficient bewteen film surface and + // primary region + inline const dimensionedScalar& htcs() const; + + + // Thermo properties + + //- Return sensible enthalpy as a function of temperature + inline tmp<Foam::volScalarField> hs + ( + const volScalarField& T + ) const; + + //- Return temperature as a function of sensible enthalpy + inline tmp<Foam::volScalarField> T + ( + const volScalarField& hs + ) const; + + + // Fields + + //- Return the film temperature [K] + virtual const volScalarField& T() const; + + //- Return the film specific heat capacity [J/kg/K] + virtual const volScalarField& cp() const; + + + // Source fields (read/write access) + + //- External hook to add sources to the film + virtual void addSources + ( + const label patchI, // patchI on primary region + const label faceI, // faceI of patchI + const scalar massSource, // [kg] + const vector& momentumSource, // [kg.m/s] (tangential momentum) + const scalar pressureSource, // [kg.m/s] (normal momentum) + const scalar energySource // [J] + ); + + + // Primary region + + //- Energy / [J/m2/s] + inline volScalarField& hsSpPrimary(); + + + // Film region + + //- Energy / [J/m2/s] + inline volScalarField& hsSp(); + + + // Sub-models + + //- Phase change + inline phaseChangeModel& phaseChange(); + + + // Evolution + + //- Evolve the film equations + virtual void evolveFilm(); + + + // I-O + + //- Provide some feedback + virtual void info() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "thermoSingleLayerI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayerI.H b/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayerI.H new file mode 100644 index 0000000000000000000000000000000000000000..987816cd30abc5b3fa95e522f006b1cb1402c003 --- /dev/null +++ b/src/surfaceFilmModels/surfaceFilmModel/thermoSingleLayer/thermoSingleLayerI.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "thermoSingleLayer.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline const Foam::dimensionedScalar& +Foam::surfaceFilmModels::thermoSingleLayer::htcw() const +{ + return htcw_; +} + + +inline const Foam::dimensionedScalar& +Foam::surfaceFilmModels::thermoSingleLayer::htcs() const +{ + return htcs_; +} + + +inline Foam::tmp<Foam::volScalarField> +Foam::surfaceFilmModels::thermoSingleLayer::hs +( + const volScalarField& T +) const +{ + return tmp<volScalarField> + ( + new volScalarField + ( + IOobject + ( + "hs(" + T.name() + ")", + filmRegion_.time().timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + cp_*(T - (dimensionedScalar("Tstd", dimTemperature, 298.15))) + ) + ); +} + + +inline Foam::tmp<Foam::volScalarField> +Foam::surfaceFilmModels::thermoSingleLayer::T +( + const volScalarField& hs +) const +{ + return tmp<volScalarField> + ( + new volScalarField + ( + IOobject + ( + "T(" + hs.name() + ")", + filmRegion_.time().timeName(), + filmRegion_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + hs/cp_ + dimensionedScalar("Tstd", dimTemperature, 298.15) + ) + ); +} + + +inline Foam::volScalarField& +Foam::surfaceFilmModels::thermoSingleLayer::hsSpPrimary() +{ + return hsSpPrimary_; +} + + +inline Foam::volScalarField& +Foam::surfaceFilmModels::thermoSingleLayer::hsSp() +{ + return hsSp_; +} + + +inline Foam::surfaceFilmModels::phaseChangeModel& +Foam::surfaceFilmModels::thermoSingleLayer::phaseChange() +{ + return phaseChange_(); +} + + +// ************************************************************************* //