diff --git a/src/regionModels/surfaceFilmModels/Make/files b/src/regionModels/surfaceFilmModels/Make/files index f14a789338..859d6de612 100644 --- a/src/regionModels/surfaceFilmModels/Make/files +++ b/src/regionModels/surfaceFilmModels/Make/files @@ -24,6 +24,10 @@ $(KINEMATICMODELS)/injectionModel/drippingInjection/drippingInjection.C $(KINEMATICMODELS)/injectionModel/removeInjection/removeInjection.C $(KINEMATICMODELS)/injectionModel/curvatureSeparation/curvatureSeparation.C +$(KINEMATICMODELS)/filmThermoModel/constantFilmThermo/constantFilmThermo.C +$(KINEMATICMODELS)/filmThermoModel/filmThermoModel/filmThermoModel.C +$(KINEMATICMODELS)/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C + $(KINEMATICMODELS)/filmTurbulenceModel/filmTurbulenceModel/filmTurbulenceModel.C $(KINEMATICMODELS)/filmTurbulenceModel/filmTurbulenceModel/filmTurbulenceModelNew.C $(KINEMATICMODELS)/filmTurbulenceModel/laminar/laminar.C diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.C new file mode 100644 index 0000000000..38aa29885f --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.C @@ -0,0 +1,398 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "constantFilmThermo.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(constantFilmThermo, 0); + +addToRunTimeSelectionTable +( + filmThermoModel, + constantFilmThermo, + dictionary +); + + +void constantFilmThermo::init(thermoData& td) +{ + if (coeffs_.readIfPresent(td.name_, td.value_)) + { + td.set_ = true; + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +constantFilmThermo::constantFilmThermo +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + filmThermoModel(typeName, owner, dict), + name_(coeffs_.lookup("specieName")), + rho0_("rho0"), + mu0_("mu0"), + sigma0_("sigma0"), + Cp0_("Cp0"), + kappa0_("kappa0"), + hl0_("hl0"), + pv0_("pv0"), + W0_("W0"), + Tb0_("Tb0") +{ + init(rho0_); + init(mu0_); + init(sigma0_); + init(Cp0_); + init(kappa0_); + init(hl0_); + init(pv0_); + init(W0_); + init(Tb0_); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +constantFilmThermo::~constantFilmThermo() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +const word& constantFilmThermo::name() const +{ + return name_; +} + + +scalar constantFilmThermo::rho +( + const scalar p, + const scalar T +) const +{ + if (!rho0_.set_) + { + coeffs_.lookup(rho0_.name_) >> rho0_.value_; + rho0_.set_ = true; + } + + return rho0_.value_; +} + + +scalar constantFilmThermo::mu +( + const scalar p, + const scalar T +) const +{ + if (!mu0_.set_) + { + coeffs_.lookup(mu0_.name_) >> mu0_.value_; + mu0_.set_ = true; + } + + return mu0_.value_; +} + + +scalar constantFilmThermo::sigma +( + const scalar p, + const scalar T +) const +{ + if (!sigma0_.set_) + { + coeffs_.lookup(sigma0_.name_) >> sigma0_.value_; + sigma0_.set_ = true; + } + + return sigma0_.value_; +} + + +scalar constantFilmThermo::Cp +( + const scalar p, + const scalar T +) const +{ + if (!Cp0_.set_) + { + coeffs_.lookup(Cp0_.name_) >> Cp0_.value_; + Cp0_.set_ = true; + } + + return Cp0_.value_; +} + + +scalar constantFilmThermo::kappa +( + const scalar p, + const scalar T +) const +{ + if (!kappa0_.set_) + { + coeffs_.lookup(kappa0_.name_) >> kappa0_.value_; + kappa0_.set_ = true; + } + + return kappa0_.value_; +} + + +scalar constantFilmThermo::D +( + const scalar p, + const scalar T +) const +{ + if (!D0_.set_) + { + coeffs_.lookup(D0_.name_) >> D0_.value_; + D0_.set_ = true; + } + + return D0_.value_; +} + + +scalar constantFilmThermo::hl +( + const scalar p, + const scalar T +) const +{ + if (!hl0_.set_) + { + coeffs_.lookup(hl0_.name_) >> hl0_.value_; + hl0_.set_ = true; + } + + return hl0_.value_; +} + + +scalar constantFilmThermo::pv +( + const scalar p, + const scalar T +) const +{ + if (!pv0_.set_) + { + coeffs_.lookup(pv0_.name_) >> pv0_.value_; + pv0_.set_ = true; + } + + return pv0_.value_; +} + + +scalar constantFilmThermo::W() const +{ + if (!W0_.set_) + { + coeffs_.lookup(W0_.name_) >> W0_.value_; + W0_.set_ = true; + } + + return W0_.value_; +} + + +scalar constantFilmThermo::Tb(const scalar p) const +{ + if (!Tb0_.set_) + { + coeffs_.lookup(Tb0_.name_) >> Tb0_.value_; + Tb0_.set_ = true; + } + + return Tb0_.value_; +} + + +tmp constantFilmThermo::rho() const +{ + tmp trho + ( + new volScalarField + ( + IOobject + ( + type() + ':' + rho0_.name_, + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("0", dimDensity, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + trho().internalField() = this->rho(0, 0); + trho().correctBoundaryConditions(); + + return trho; +} + + +tmp constantFilmThermo::mu() const +{ + tmp tmu + ( + new volScalarField + ( + IOobject + ( + type() + ':' + mu0_.name_, + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("0", dimPressure*dimTime, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + tmu().internalField() = this->mu(0, 0); + tmu().correctBoundaryConditions(); + + return tmu; +} + + +tmp constantFilmThermo::sigma() const +{ + tmp tsigma + ( + new volScalarField + ( + IOobject + ( + type() + ':' + sigma0_.name_, + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("0", dimMass/sqr(dimTime), 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + tsigma().internalField() = this->sigma(0, 0); + tsigma().correctBoundaryConditions(); + + return tsigma; +} + + +tmp constantFilmThermo::Cp() const +{ + tmp tCp + ( + new volScalarField + ( + IOobject + ( + type() + ':' + Cp0_.name_, + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("0", dimEnergy/dimMass/dimTemperature, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + tCp().internalField() = this->Cp(0, 0); + tCp().correctBoundaryConditions(); + + return tCp; +} + + +tmp constantFilmThermo::kappa() const +{ + tmp tkappa + ( + new volScalarField + ( + IOobject + ( + type() + ':' + kappa0_.name_, + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("0", dimPower/dimLength/dimTemperature, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + tkappa().internalField() = this->kappa(0, 0); + tkappa().correctBoundaryConditions(); + + return tkappa; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.H new file mode 100644 index 0000000000..cfb2ec4088 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.H @@ -0,0 +1,224 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::constantFilmThermo + +Description + Constant thermo model + +SourceFiles + constantFilmThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constantFilmThermo_H +#define constantFilmThermo_H + +#include "filmThermoModel.H" +#include "dimensionSet.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class constantFilmThermo Declaration +\*---------------------------------------------------------------------------*/ + +class constantFilmThermo +: + public filmThermoModel +{ +public: + + struct thermoData + { +// private: + word name_; + scalar value_; + bool set_; + +// public: + thermoData() + : + name_("unknown"), + value_(0.0), + set_(false) + {} + thermoData(const word& n) + : + name_(n), + value_(0.0), + set_(false) + {} + +// virtual ~thermoData() +// {} + }; + + +private: + + // Private data + + //- Specie name + word name_; + + //- Density [kg/m3] + mutable thermoData rho0_; + + //- Dynamic viscosity [Pa.s] + mutable thermoData mu0_; + + //- Surface tension [kg/s2] + mutable thermoData sigma0_; + + //- Specific heat capacity [J/kg/K] + mutable thermoData Cp0_; + + //- Thermal conductivity [W/m/K] + mutable thermoData kappa0_; + + //- Diffusivity [m2/s] + mutable thermoData D0_; + + //- Latent heat [J/kg] + mutable thermoData hl0_; + + //- Vapour pressure [Pa] + mutable thermoData pv0_; + + //- Molecular weight [kg/kmol] + mutable thermoData W0_; + + //- Boiling temperature [K] + mutable thermoData Tb0_; + + + // Private member functions + + //- Initialise thermoData object + void init(thermoData& td); + + //- Disallow default bitwise copy construct + constantFilmThermo(const constantFilmThermo&); + + //- Disallow default bitwise assignment + void operator=(const constantFilmThermo&); + + +public: + + //- Runtime type information + TypeName("constant"); + + + // Constructors + + //- Construct from surface film model and dictionary + constantFilmThermo + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~constantFilmThermo(); + + + // Member Functions + + //- Return the specie name + virtual const word& name() const; + + + // Elemental access + + //- Return density [kg/m3] + virtual scalar rho(const scalar p, const scalar T) const; + + //- Return dynamic viscosity [Pa.s] + virtual scalar mu(const scalar p, const scalar T) const; + + //- Return surface tension [kg/s2] + virtual scalar sigma(const scalar p, const scalar T) const; + + //- Return specific heat capacity [J/kg/K] + virtual scalar Cp(const scalar p, const scalar T) const; + + //- Return thermal conductivity [W/m/K] + virtual scalar kappa(const scalar p, const scalar T) const; + + //- Return diffusivity [m2/s] + virtual scalar D(const scalar p, const scalar T) const; + + //- Return latent heat [J/kg] + virtual scalar hl(const scalar p, const scalar T) const; + + //- Return vapour pressure [Pa] + virtual scalar pv(const scalar p, const scalar T) const; + + //- Return molecular weight [kg/kmol] + virtual scalar W() const; + + //- Return boiling temperature [K] + virtual scalar Tb(const scalar p) const; + + + // Field access + + //- Return density [kg/m3] + virtual tmp rho() const; + + //- Return dynamic viscosity [Pa.s] + virtual tmp mu() const; + + //- Return surface tension [kg/s2] + virtual tmp sigma() const; + + //- Return specific heat capacity [J/kg/K] + virtual tmp Cp() const; + + //- Return thermal conductivity [W/m/K] + virtual tmp kappa() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/filmThermoModel/filmThermoModel.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/filmThermoModel/filmThermoModel.C new file mode 100644 index 0000000000..f6bd0c21d3 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/filmThermoModel/filmThermoModel.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "filmThermoModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(filmThermoModel, 0); +defineRunTimeSelectionTable(filmThermoModel, dictionary); + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +filmThermoModel::filmThermoModel +( + const surfaceFilmModel& owner +) +: + subModelBase(owner) +{} + + +filmThermoModel::filmThermoModel +( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict +) +: + subModelBase(type, owner, dict) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +filmThermoModel::~filmThermoModel() +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/filmThermoModel/filmThermoModel.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/filmThermoModel/filmThermoModel.H new file mode 100644 index 0000000000..135122b9e6 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/filmThermoModel/filmThermoModel.H @@ -0,0 +1,186 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::filmThermoModel + +Description + Base class for film thermo models + +SourceFiles + filmThermoModel.C + filmThermoModelNew.C + +\*---------------------------------------------------------------------------*/ + +#ifndef filmThermoModel_H +#define filmThermoModel_H + +#include "subModelBase.H" +#include "runTimeSelectionTables.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +/*---------------------------------------------------------------------------*\ + Class filmThermoModel Declaration +\*---------------------------------------------------------------------------*/ + +class filmThermoModel +: + public subModelBase +{ +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + filmThermoModel(const filmThermoModel&); + + //- Disallow default bitwise assignment + void operator=(const filmThermoModel&); + + +public: + + //- Runtime type information + TypeName("filmThermoModel"); + + + // Declare runtime constructor selection table + + declareRunTimeSelectionTable + ( + autoPtr, + filmThermoModel, + dictionary, + ( + const surfaceFilmModel& owner, + const dictionary& dict + ), + (owner, dict) + ); + + // Constructors + + //- Construct null + filmThermoModel(const surfaceFilmModel& owner); + + //- Construct from type name, dictionary and surface film model + filmThermoModel + ( + const word& type, + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + // Selectors + + //- Return a reference to the selected phase change model + static autoPtr New + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~filmThermoModel(); + + + // Member Functions + + //- Return the specie name + virtual const word& name() const = 0; + + + // Elemental access + + //- Return density [kg/m3] + virtual scalar rho(const scalar p, const scalar T) const = 0; + + //- Return dynamic viscosity [Pa.s] + virtual scalar mu(const scalar p, const scalar T) const = 0; + + //- Return surface tension [kg/s2] + virtual scalar sigma(const scalar p, const scalar T) const = 0; + + //- Return specific heat capacity [J/kg/K] + virtual scalar Cp(const scalar p, const scalar T) const = 0; + + //- Return thermal conductivity [W/m/K] + virtual scalar kappa(const scalar p, const scalar T) const = 0; + + //- Return diffusivity [m2/s] + virtual scalar D(const scalar p, const scalar T) const = 0; + + //- Return latent heat [J/kg] + virtual scalar hl(const scalar p, const scalar T) const = 0; + + //- Return vapour pressure [Pa] + virtual scalar pv(const scalar p, const scalar T) const = 0; + + //- Return molecular weight [kg/kmol] + virtual scalar W() const = 0; + + //- Return boiling temperature [K] + virtual scalar Tb(const scalar p) const = 0; + + + // Field access + + //- Return density [kg/m3] + virtual tmp rho() const = 0; + + //- Return dynamic viscosity [Pa.s] + virtual tmp mu() const = 0; + + //- Return surface tension [kg/s2] + virtual tmp sigma() const = 0; + + //- Return specific heat capacity [J/kg/K] + virtual tmp Cp() const = 0; + + //- Return thermal conductivity [W/m/K] + virtual tmp kappa() const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/filmThermoModel/filmThermoModelNew.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/filmThermoModel/filmThermoModelNew.C new file mode 100644 index 0000000000..be21e34483 --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/filmThermoModel/filmThermoModelNew.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "filmThermoModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +autoPtr filmThermoModel::New +( + const surfaceFilmModel& model, + const dictionary& dict +) +{ + word modelType(dict.lookup("filmThermoModel")); + + Info<< " Selecting filmThermoModel " << modelType << endl; + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(modelType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "filmThermoModel::New(const surfaceFilmModel&, const dictionary&)" + ) << "Unknown filmThermoModel type " << modelType << nl << nl + << "Valid filmThermoModel types are:" << nl + << dictionaryConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(model, dict)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C new file mode 100644 index 0000000000..2b012fd61f --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C @@ -0,0 +1,486 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "liquidFilmThermo.H" +#include "demandDrivenData.H" +#include "thermoSingleLayer.H" +#include "SLGThermo.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +defineTypeNameAndDebug(liquidFilmThermo, 0); + +addToRunTimeSelectionTable +( + filmThermoModel, + liquidFilmThermo, + dictionary +); + + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +const thermoSingleLayer& liquidFilmThermo::thermoFilm() const +{ + if (!isA(owner_)) + { + FatalErrorIn + ( + "const thermoSingleLayer& liquidFilmThermo::thermoFilm() const" + ) + << "Thermo model requires a " << thermoSingleLayer::typeName + << " film to supply the pressure and temperature, but " + << owner_.type() << " film model selected. " + << "Use the 'useReferenceValues' flag to employ reference " + << "pressure and temperature" << exit(FatalError); + } + + return refCast(owner_); +} + + +void liquidFilmThermo::initLiquid(const dictionary& dict) +{ + if (liquidPtr_ != NULL) + { + return; + } + + dict.lookup("liquid") >> name_; + + if (owner_.primaryMesh().foundObject("SLGThermo")) + { + // retrieve from film thermo + ownLiquid_ = false; + + const SLGThermo& thermo = + owner_.primaryMesh().lookupObject("SLGThermo"); + label id = thermo.liquidId(name_); + liquidPtr_ = &thermo.liquids().properties()[id]; + } + else + { + // new liquid create + ownLiquid_ = true; + + liquidPtr_ = new liquidProperties(dict.subDict(name_ + "Coeffs")); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +liquidFilmThermo::liquidFilmThermo +( + const surfaceFilmModel& owner, + const dictionary& dict +) +: + filmThermoModel(typeName, owner, dict), + name_("unknown_liquid"), + liquidPtr_(NULL), + ownLiquid_(false), + useReferenceValues_(readBool(coeffs_.lookup("useReferenceValues"))), + pRef_(0.0), + TRef_(0.0) +{ + initLiquid(coeffs_); + + if (useReferenceValues_) + { + coeffs_.lookup("pRef") >> pRef_; + coeffs_.lookup("TRef") >> TRef_; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +liquidFilmThermo::~liquidFilmThermo() +{ + if (ownLiquid_) + { + deleteDemandDrivenData(liquidPtr_); + } +} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +const word& liquidFilmThermo::name() const +{ + return name_; +} + + +scalar liquidFilmThermo::rho +( + const scalar p, + const scalar T +) const +{ + return liquidPtr_->rho(p, T); +} + + +scalar liquidFilmThermo::mu +( + const scalar p, + const scalar T +) const +{ + return liquidPtr_->mu(p, T); +} + + +scalar liquidFilmThermo::sigma +( + const scalar p, + const scalar T +) const +{ + return liquidPtr_->sigma(p, T); +} + + +scalar liquidFilmThermo::Cp +( + const scalar p, + const scalar T +) const +{ + return liquidPtr_->Cp(p, T); +} + + +scalar liquidFilmThermo::kappa +( + const scalar p, + const scalar T +) const +{ + return liquidPtr_->K(p, T); +} + + +scalar liquidFilmThermo::D +( + const scalar p, + const scalar T +) const +{ + return liquidPtr_->D(p, T); +} + + +scalar liquidFilmThermo::hl +( + const scalar p, + const scalar T +) const +{ + return liquidPtr_->hl(p, T); +} + + +scalar liquidFilmThermo::pv +( + const scalar p, + const scalar T +) const +{ + return liquidPtr_->pv(p, T); +} + + +scalar liquidFilmThermo::W() const +{ + return liquidPtr_->W(); +} + + +scalar liquidFilmThermo::Tb(const scalar p) const +{ + return liquidPtr_->pvInvert(p); +} + + +tmp liquidFilmThermo::rho() const +{ + tmp trho + ( + new volScalarField + ( + IOobject + ( + type() + ":rho", + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("0", dimDensity, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + scalarField& rho = trho().internalField(); + + if (useReferenceValues_) + { + forAll(rho, cellI) + { + rho[cellI] = this->rho(pRef_, TRef_); + } + } + else + { + const thermoSingleLayer& film = thermoFilm(); + + const volScalarField& T = film.T(); + const volScalarField& p = film.pPrimary(); + + forAll(rho, cellI) + { + rho[cellI] = this->rho(p[cellI], T[cellI]); + } + } + + trho().correctBoundaryConditions(); + + return trho; +} + + +tmp liquidFilmThermo::mu() const +{ + tmp tmu + ( + new volScalarField + ( + IOobject + ( + type() + ":mu", + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("0", dimPressure*dimTime, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + scalarField& mu = tmu().internalField(); + + if (useReferenceValues_) + { + forAll(mu, cellI) + { + mu[cellI] = this->mu(pRef_, TRef_); + } + } + else + { + const thermoSingleLayer& film = thermoFilm(); + + const volScalarField& T = film.T(); + const volScalarField& p = film.pPrimary(); + + forAll(mu, cellI) + { + mu[cellI] = this->mu(p[cellI], T[cellI]); + } + } + + tmu().correctBoundaryConditions(); + + return tmu; +} + + +tmp liquidFilmThermo::sigma() const +{ + tmp tsigma + ( + new volScalarField + ( + IOobject + ( + type() + ":sigma", + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("0", dimMass/sqr(dimTime), 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + scalarField& sigma = tsigma().internalField(); + + if (useReferenceValues_) + { + forAll(sigma, cellI) + { + sigma[cellI] = this->sigma(pRef_, TRef_); + } + } + else + { + const thermoSingleLayer& film = thermoFilm(); + + const volScalarField& T = film.T(); + const volScalarField& p = film.pPrimary(); + + forAll(sigma, cellI) + { + sigma[cellI] = this->sigma(p[cellI], T[cellI]); + } + } + + tsigma().correctBoundaryConditions(); + + return tsigma; +} + + +tmp liquidFilmThermo::Cp() const +{ + tmp tCp + ( + new volScalarField + ( + IOobject + ( + type() + ":Cp", + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("0", dimEnergy/dimMass/dimTemperature, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + scalarField& Cp = tCp().internalField(); + + if (useReferenceValues_) + { + forAll(Cp, cellI) + { + Cp[cellI] = this->Cp(pRef_, TRef_); + } + } + else + { + const thermoSingleLayer& film = thermoFilm(); + + const volScalarField& T = film.T(); + const volScalarField& p = film.pPrimary(); + + forAll(Cp, cellI) + { + Cp[cellI] = this->Cp(p[cellI], T[cellI]); + } + } + + tCp().correctBoundaryConditions(); + + return tCp; +} + + +tmp liquidFilmThermo::kappa() const +{ + tmp tkappa + ( + new volScalarField + ( + IOobject + ( + type() + ":kappa", + owner().time().timeName(), + owner().regionMesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + owner().regionMesh(), + dimensionedScalar("0", dimPower/dimLength/dimTemperature, 0.0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + scalarField& kappa = tkappa().internalField(); + + if (useReferenceValues_) + { + forAll(kappa, cellI) + { + kappa[cellI] = this->kappa(pRef_, TRef_); + } + } + else + { + const thermoSingleLayer& film = thermoFilm(); + + const volScalarField& T = film.T(); + const volScalarField& p = film.pPrimary(); + + forAll(kappa, cellI) + { + kappa[cellI] = this->kappa(p[cellI], T[cellI]); + } + } + + tkappa().correctBoundaryConditions(); + + return tkappa; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.H b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.H new file mode 100644 index 0000000000..1b12bec4de --- /dev/null +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.H @@ -0,0 +1,187 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013 OpenFOAM Foundation + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::liquidFilmThermo + +Description + Liquid thermo model + +SourceFiles + liquidFilmThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef liquidFilmThermo_H +#define liquidFilmThermo_H + +#include "filmThermoModel.H" +#include "liquidProperties.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace regionModels +{ +namespace surfaceFilmModels +{ + +// Forward class declarations +class thermoSingleLayer; + +/*---------------------------------------------------------------------------*\ + Class liquidFilmThermo Declaration +\*---------------------------------------------------------------------------*/ + +class liquidFilmThermo +: + public filmThermoModel +{ +protected: + + // Protected data + + //- Liquid name + word name_; + + //- Pointer to the liquid properties + const liquidProperties* liquidPtr_; + + //- Flag to indicate that model owns the liquid object + bool ownLiquid_; + + //- Flag to indicate that reference values of p and T should be used + bool useReferenceValues_; + + //- Reference pressure [pa] + scalar pRef_; + + //- Reference temperature [K] + scalar TRef_; + + + // Protected member functions + + //- Return a reference to a thermo film + const thermoSingleLayer& thermoFilm() const; + + //- Initialise the liquid pointer + void initLiquid(const dictionary& dict); + + //- Disallow default bitwise copy construct + liquidFilmThermo(const liquidFilmThermo&); + + //- Disallow default bitwise assignment + void operator=(const liquidFilmThermo&); + + +public: + + //- Runtime type information + TypeName("liquid"); + + + // Constructors + + //- Construct from surface film model and dictionary + liquidFilmThermo + ( + const surfaceFilmModel& owner, + const dictionary& dict + ); + + + //- Destructor + virtual ~liquidFilmThermo(); + + + // Member Functions + + //- Return the specie name + virtual const word& name() const; + + + // Elemental access + + //- Return density [kg/m3] + virtual scalar rho(const scalar p, const scalar T) const; + + //- Return dynamic viscosity [Pa.s] + virtual scalar mu(const scalar p, const scalar T) const; + + //- Return surface tension [kg/s2] + virtual scalar sigma(const scalar p, const scalar T) const; + + //- Return specific heat capacity [J/kg/K] + virtual scalar Cp(const scalar p, const scalar T) const; + + //- Return thermal conductivity [W/m/K] + virtual scalar kappa(const scalar p, const scalar T) const; + + //- Return diffusivity [m2/s] + virtual scalar D(const scalar p, const scalar T) const; + + //- Return latent heat [J/kg] + virtual scalar hl(const scalar p, const scalar T) const; + + //- Return vapour pressure [Pa] + virtual scalar pv(const scalar p, const scalar T) const; + + //- Return molecular weight [kg/kmol] + virtual scalar W() const; + + //- Return boiling temperature [K] + virtual scalar Tb(const scalar p) const; + + + // Field access + + //- Return density [kg/m3] + virtual tmp rho() const; + + //- Return dynamic viscosity [Pa.s] + virtual tmp mu() const; + + //- Return surface tension [kg/s2] + virtual tmp sigma() const; + + //- Return specific heat capacity [J/kg/K] + virtual tmp Cp() const; + + //- Return thermal conductivity [W/m/K] + virtual tmp kappa() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace surfaceFilmModels +} // End namespace regionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* //