diff --git a/src/TurbulenceModels/Allwmake b/src/TurbulenceModels/Allwmake index fb0c219f581dc540c6c38916047fa430fcd2c89a..d76497d6674a725dff4d6a3080f807da29a572bb 100755 --- a/src/TurbulenceModels/Allwmake +++ b/src/TurbulenceModels/Allwmake @@ -9,6 +9,7 @@ set -x wmake $targetType turbulenceModels wmake $targetType incompressible wmake $targetType compressible +wmake $targetType schemes wmakeLnInclude phaseIncompressible wmakeLnInclude phaseCompressible diff --git a/src/TurbulenceModels/compressible/CompressibleTurbulenceModel/CompressibleTurbulenceModel.H b/src/TurbulenceModels/compressible/CompressibleTurbulenceModel/CompressibleTurbulenceModel.H index 0a9cdfe58b810af67c363ce2b74148318389c9ba..363bd7540e7b7e1bab1db5e121e17fa40d95b08c 100644 --- a/src/TurbulenceModels/compressible/CompressibleTurbulenceModel/CompressibleTurbulenceModel.H +++ b/src/TurbulenceModels/compressible/CompressibleTurbulenceModel/CompressibleTurbulenceModel.H @@ -78,7 +78,7 @@ public: const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, - const transportModel& trasport, + const transportModel& transport, const word& propertiesName ); @@ -91,7 +91,7 @@ public: const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - const transportModel& trasportModel, + const transportModel& transport, const word& propertiesName = turbulenceModel::propertiesName ); diff --git a/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.H b/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.H index 82ba1221d91f90deff988277d4d4fd1fd535723c..3b4f935a856f40604b767cdc0d42f67d0e0c2d99 100644 --- a/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.H +++ b/src/TurbulenceModels/compressible/EddyDiffusivity/EddyDiffusivity.H @@ -87,7 +87,7 @@ public: const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, - const transportModel& trasport, + const transportModel& transport, const word& propertiesName ); diff --git a/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.H b/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.H index 2066e44a1daf176f4e74a088359358f4636bee30..bcda2305219d14ec3ad678c3c54840316636791d 100644 --- a/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.H +++ b/src/TurbulenceModels/compressible/ThermalDiffusivity/ThermalDiffusivity.H @@ -69,7 +69,7 @@ public: const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, - const transportModel& trasport, + const transportModel& transport, const word& propertiesName ); @@ -83,7 +83,7 @@ public: const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - const transportModel& trasportModel, + const transportModel& transportModel, const word& propertiesName = turbulenceModel::propertiesName ); @@ -94,7 +94,7 @@ public: const volScalarField& rho, const volVectorField& U, const surfaceScalarField& phi, - const transportModel& trasportModel, + const transportModel& transportModel, const word& propertiesName = turbulenceModel::propertiesName ); diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C index b4346d59c2952804fe905f61d1ab68e97e1a7c6f..9fc0a01311a14a76c4ddc0cffad10c7b77789171 100644 --- a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchScalarField.C @@ -136,9 +136,30 @@ externalWallHeatFluxTemperatureFvPatchScalarField h_ = scalarField("h", dict, p.size()); Ta_ = scalarField("Ta", dict, p.size()); if (dict.found("thicknessLayers")) + + if (dict.readIfPresent("thicknessLayers", thicknessLayers_)) { - dict.lookup("thicknessLayers") >> thicknessLayers_; dict.lookup("kappaLayers") >> kappaLayers_; + + if (thicknessLayers_.size() != kappaLayers_.size()) + { + FatalIOErrorIn + ( + "externalWallHeatFluxTemperatureFvPatchScalarField::" + "externalWallHeatFluxTemperatureFvPatchScalarField\n" + "(\n" + " const fvPatch&,\n" + " const DimensionedField<scalar, volMesh>&,\n" + " const dictionary&\n" + ")\n", + dict + ) << "\n number of layers for thicknessLayers and " + << "kappaLayers must be the same" + << "\n for patch " << p.name() + << " of field " << dimensionedInternalField().name() + << " in file " << dimensionedInternalField().objectPath() + << exit(FatalIOError); + } } } else @@ -148,9 +169,9 @@ externalWallHeatFluxTemperatureFvPatchScalarField "externalWallHeatFluxTemperatureFvPatchScalarField::" "externalWallHeatFluxTemperatureFvPatchScalarField\n" "(\n" - " const fvPatch& p,\n" - " const DimensionedField<scalar, volMesh>& iF,\n" - " const dictionary& dict\n" + " const fvPatch&,\n" + " const DimensionedField<scalar, volMesh>&,\n" + " const dictionary&\n" ")\n" ) << "\n patch type '" << p.type() << "' either q or h and Ta were not found '" @@ -330,7 +351,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::updateCoeffs() << patch().name() << ':' << this->dimensionedInternalField().name() << " :" << " heat transfer rate:" << Q - << " walltemperature " + << " wall temperature " << " min:" << gMin(*this) << " max:" << gMax(*this) << " avg:" << gAverage(*this) @@ -374,7 +395,7 @@ void Foam::externalWallHeatFluxTemperatureFvPatchScalarField::write ( "void externalWallHeatFluxTemperatureFvPatchScalarField::write" "(" - "Ostream& os" + "Ostream&" ") const" ) << "Illegal heat flux mode " << operationModeNames[mode_] << abort(FatalError); diff --git a/src/TurbulenceModels/incompressible/IncompressibleTurbulenceModel/IncompressibleTurbulenceModel.H b/src/TurbulenceModels/incompressible/IncompressibleTurbulenceModel/IncompressibleTurbulenceModel.H index eb9d8bfb06a4ce1f7151cd7879fee47b713fc27e..dd6899d3b077dd3344ff1bdc7231f740a4c11d2e 100644 --- a/src/TurbulenceModels/incompressible/IncompressibleTurbulenceModel/IncompressibleTurbulenceModel.H +++ b/src/TurbulenceModels/incompressible/IncompressibleTurbulenceModel/IncompressibleTurbulenceModel.H @@ -91,7 +91,7 @@ public: ( const volVectorField& U, const surfaceScalarField& phi, - const TransportModel& trasportModel, + const TransportModel& transportModel, const word& propertiesName = turbulenceModel::propertiesName ); diff --git a/src/TurbulenceModels/phaseCompressible/PhaseCompressibleTurbulenceModel/PhaseCompressibleTurbulenceModel.H b/src/TurbulenceModels/phaseCompressible/PhaseCompressibleTurbulenceModel/PhaseCompressibleTurbulenceModel.H index 7ebabf307275e407c7b7b9fee65e7e818e2991e5..d3d19edc4d168cde4e38a8e07e255a4f2b986b85 100644 --- a/src/TurbulenceModels/phaseCompressible/PhaseCompressibleTurbulenceModel/PhaseCompressibleTurbulenceModel.H +++ b/src/TurbulenceModels/phaseCompressible/PhaseCompressibleTurbulenceModel/PhaseCompressibleTurbulenceModel.H @@ -78,7 +78,7 @@ public: const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, - const transportModel& trasport, + const transportModel& transport, const word& propertiesName ); @@ -93,7 +93,7 @@ public: const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, - const transportModel& trasportModel, + const transportModel& transportModel, const word& propertiesName = turbulenceModel::propertiesName ); diff --git a/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.H b/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.H index fb4ee56c3230b5489091e99367f56008059fb69a..17b6f0a01e357bdc5d1e3abad8ea7c035b61c437 100644 --- a/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.H +++ b/src/TurbulenceModels/phaseIncompressible/PhaseIncompressibleTurbulenceModel/PhaseIncompressibleTurbulenceModel.H @@ -78,7 +78,7 @@ public: const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, - const TransportModel& trasportModel, + const TransportModel& transportModel, const word& propertiesName ); @@ -92,7 +92,7 @@ public: const volVectorField& U, const surfaceScalarField& alphaRhoPhi, const surfaceScalarField& phi, - const TransportModel& trasportModel, + const TransportModel& transportModel, const word& propertiesName = turbulenceModel::propertiesName ); diff --git a/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.C b/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.C new file mode 100644 index 0000000000000000000000000000000000000000..d18c0f007bc9497b65fc00fd9f037af8271000f4 --- /dev/null +++ b/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.C @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "fvMesh.H" +#include "DEShybrid.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + makeSurfaceInterpolationScheme(DEShybrid); +} + +// ************************************************************************* // diff --git a/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.H b/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.H new file mode 100644 index 0000000000000000000000000000000000000000..e7607005ea476838f2da8d2715dfcf53b285dfd6 --- /dev/null +++ b/src/TurbulenceModels/schemes/DEShybrid/DEShybrid.H @@ -0,0 +1,413 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 2 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, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +Class + Foam::DEShybrid + +Description + Hybrid convection scheme of Travin et al. for hybrid RAS/LES calculations. + The scheme blends between a low-dissipative convection scheme within the + LES region (e.g. linear) and a numerically more robust convection scheme in + the RAS region (e.g. upwind-biased schemes). + + The routine calculates the blending factor denoted as "sigma" in the + literature reference, where 0 <= sigma <= sigmaMax, which is then employed + to set the weights: + \f[ + weight = (1-sigma) w_1 + sigma w_2 + \f] + + where + \vartable + sigma | blending factor + w_1 | scheme 1 weights + w_2 | scheme 2 weights + \endvartable + + Reference: + \verbatim + A. Travin, M. Shur, M. Strelets, P. Spalart (2000). + Physical and numerical upgrades in the detached-eddy simulation of + complex turbulent flows. + In Proceedings of the 412th Euromech Colloquium on LES and Complex + Transition and Turbulent Flows, Munich, Germany + \endverbatim + + Example of the DEShybrid scheme specification using linear within the LES + region and linearUpwind within the RAS region: + \verbatim + divSchemes + { + . + . + div(phi,U) Gauss DEShybrid + linear // scheme 1 + linearUpwind grad(U) // scheme 2 + 0.65 // DES coefficient, typically = 0.65 + 10 // Reference time scale (Uref/Lref) + 1; // Maximum sigma limit (0-1) + . + . + } + \endverbatim + +Notes + - Scheme 1 should be linear (or other low-dissipative schemes) which will + be used in the detached/vortex shedding regions. + - Scheme 2 should be an upwind/deferred correction/TVD scheme which will + be used in the free-stream/Euler/boundary layer regions. + +SourceFiles + DEShybrid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DEShybrid_H +#define DEShybrid_H + +#include "surfaceInterpolationScheme.H" +#include "surfaceInterpolate.H" +#include "fvcGrad.H" +#include "blendedSchemeBase.H" +#include "turbulentTransportModel.H" +#include "turbulentFluidThermoModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + class DEShybrid Declaration +\*---------------------------------------------------------------------------*/ + +template<class Type> +class DEShybrid +: + public surfaceInterpolationScheme<Type>, + public blendedSchemeBase<Type> +{ + // Private Data + + //- Scheme 1 + tmp<surfaceInterpolationScheme<Type> > tScheme1_; + + //- Scheme 2 + tmp<surfaceInterpolationScheme<Type> > tScheme2_; + + //- DES Coefficient + scalar CDES_; + + //- Time scale coefficient [1/s] + dimensionedScalar invTau_; + + //- Maximum bound for sigma (limited to 1) + scalar sigmaMax_; + + //- Lower limit for `B' coefficient + dimensionedScalar B0_; + + //- Small length scale to avoid division by zero + dimensionedScalar d0_; + + //- Disallow default bitwise copy construct + DEShybrid(const DEShybrid&); + + //- Disallow default bitwise assignment + void operator=(const DEShybrid&); + + + // Private Member Functions + + //- Calculate the blending factor + tmp<surfaceScalarField> calcBlendingFactor + ( + const GeometricField<Type, fvPatchField, volMesh>& vf, + const volScalarField& nuEff, + const volVectorField& U, + const volScalarField& delta + ) const + { + tmp<volTensorField> gradU(fvc::grad(U)); + const volScalarField S(sqrt(2.0)*mag(symm(gradU()))); + const volScalarField Omega(sqrt(2.0)*mag(skew(gradU()))); + const volScalarField magSqrGradU(magSqr(gradU)); + + const volScalarField B + ( + 0.5*Omega*max(S, Omega) + /max(0.5*magSqrGradU, B0_) + ); + const volScalarField K + ( + max(Foam::sqrt(0.5*magSqrGradU), 0.1*invTau_) + ); + const volScalarField lTurb(Foam::sqrt(nuEff/(pow(0.09, 1.5)*K))); + const volScalarField g(tanh(pow4(B))); + const volScalarField A + ( + max(scalar(0), CDES_*delta/max(lTurb*g, d0_) - 0.5) + ); + const surfaceScalarField Af(fvc::interpolate(A)); + + return tmp<surfaceScalarField> + ( + new surfaceScalarField + ( + vf.name() + "BlendingFactor", + max(sigmaMax_*tanh(pow3(Af)), scalar(0)) + ) + ); + } + + +public: + + //- Runtime type information + TypeName("DEShybrid"); + + + // Constructors + + //- Construct from mesh and Istream. + // The name of the flux field is read from the Istream and looked-up + // from the mesh objectRegistry + DEShybrid(const fvMesh& mesh, Istream& is) + : + surfaceInterpolationScheme<Type>(mesh), + tScheme1_ + ( + surfaceInterpolationScheme<Type>::New(mesh, is) + ), + tScheme2_ + ( + surfaceInterpolationScheme<Type>::New(mesh, is) + ), + CDES_(readScalar(is)), + invTau_("invTau", dimless/dimTime, readScalar(is)), + sigmaMax_(readScalar(is)), + B0_("B0", dimless/sqr(dimTime), 1e-20), + d0_("d0", dimLength, SMALL) + { + if (invTau_.value() <= 0) + { + FatalErrorIn("DEShybrid(const fvMesh&, Istream&)") + << "invTau coefficient must be greater than 0. " + << "Current value: " << invTau_ << exit(FatalError); + } + if (sigmaMax_ > 1) + { + FatalErrorIn("DEShybrid(const fvMesh&, Istream&)") + << "sigmaMax coefficient must be less than or equal to 1. " + << "Current value: " << sigmaMax_ << exit(FatalError); + } + } + + //- Construct from mesh, faceFlux and Istream + DEShybrid + ( + const fvMesh& mesh, + const surfaceScalarField& faceFlux, + Istream& is + ) + : + surfaceInterpolationScheme<Type>(mesh), + tScheme1_ + ( + surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is) + ), + tScheme2_ + ( + surfaceInterpolationScheme<Type>::New(mesh, faceFlux, is) + ), + CDES_(readScalar(is)), + invTau_("invTau", dimless/dimTime, readScalar(is)), + sigmaMax_(readScalar(is)), + B0_("B0", dimless/sqr(dimTime), 1e-20), + d0_("d0", dimLength, SMALL) + { + if (invTau_.value() <= 0) + { + FatalErrorIn("DEShybrid(const fvMesh&, Istream&)") + << "invTau coefficient must be greater than 0. " + << "Current value: " << invTau_ << exit(FatalError); + } + if (sigmaMax_ > 1) + { + FatalErrorIn("DEShybrid(const fvMesh&, Istream&)") + << "sigmaMax coefficient must be less than or equal to 1. " + << "Current value: " << sigmaMax_ << exit(FatalError); + } + } + + + // Member Functions + + //- Return the face-based blending factor + virtual tmp<surfaceScalarField> blendingFactor + ( + const GeometricField<Type, fvPatchField, volMesh>& vf + ) const + { + const fvMesh& mesh = this->mesh(); + + typedef compressible::turbulenceModel cmpModel; + typedef incompressible::turbulenceModel icoModel; + + // Assuming that LES delta field is called "delta" + const volScalarField& delta = this->mesh().template + lookupObject<const volScalarField>("delta"); + + // Could avoid the compressible/incompressible case by looking + // up all fields from the database - but retrieving from model + // ensures consistent fields are being employed e.g. for multiphase + // where group name is used + + if (mesh.foundObject<icoModel>(icoModel::propertiesName)) + { + const icoModel& model = + mesh.lookupObject<icoModel>(icoModel::propertiesName); + + return calcBlendingFactor(vf, model.nuEff(), model.U(), delta); + } + else if (mesh.foundObject<cmpModel>(cmpModel::propertiesName)) + { + const cmpModel& model = + mesh.lookupObject<cmpModel>(cmpModel::propertiesName); + + return calcBlendingFactor + ( + vf, model.muEff()/model.rho(), model.U(), delta + ); + } + else + { + FatalErrorIn + ( + "virtual tmp<surfaceScalarField> DEShybrid::blendingFactor" + "(" + "const GeometricField<Type, fvPatchField, volMesh>&" + ") const" + ) + << "Scheme requires a turbulence model to be present. " + << "Unable to retrieve turbulence model from the mesh " + << "database" << exit(FatalError); + + return tmp<surfaceScalarField>(NULL); + } + } + + + //- Return the interpolation weighting factors + tmp<surfaceScalarField> weights + ( + const GeometricField<Type, fvPatchField, volMesh>& vf + ) const + { + surfaceScalarField bf(blendingFactor(vf)); + + return + (scalar(1) - bf)*tScheme1_().weights(vf) + + bf*tScheme2_().weights(vf); + } + + + //- Return the face-interpolate of the given cell field + // with explicit correction + tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > + interpolate + ( + const GeometricField<Type, fvPatchField, volMesh>& vf + ) const + { + surfaceScalarField bf(blendingFactor(vf)); + + return + (scalar(1) - bf)*tScheme1_().interpolate(vf) + + bf*tScheme2_().interpolate(vf); + } + + + //- Return true if this scheme uses an explicit correction + virtual bool corrected() const + { + return tScheme1_().corrected() || tScheme2_().corrected(); + } + + + //- Return the explicit correction to the face-interpolate + // for the given field + virtual tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > + correction + ( + const GeometricField<Type, fvPatchField, volMesh>& vf + ) const + { + surfaceScalarField bf(blendingFactor(vf)); + + if (tScheme1_().corrected()) + { + if (tScheme2_().corrected()) + { + return + ( + (scalar(1) - bf) + * tScheme1_().correction(vf) + + bf + * tScheme2_().correction(vf) + ); + } + else + { + return + ( + (scalar(1) - bf) + * tScheme1_().correction(vf) + ); + } + } + else if (tScheme2_().corrected()) + { + return (bf*tScheme2_().correction(vf)); + } + else + { + return tmp<GeometricField<Type, fvsPatchField, surfaceMesh> > + ( + NULL + ); + } + } +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/schemes/Make/files b/src/TurbulenceModels/schemes/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..49f0357b642acb406d5ca87311bac2b779126f33 --- /dev/null +++ b/src/TurbulenceModels/schemes/Make/files @@ -0,0 +1,3 @@ +DEShybrid/DEShybrid.C + +LIB = $(FOAM_LIBBIN)/libturbulenceModelSchemes \ No newline at end of file diff --git a/src/TurbulenceModels/schemes/Make/options b/src/TurbulenceModels/schemes/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..29eef672dfee322ef13cf787eeb2506d314432a5 --- /dev/null +++ b/src/TurbulenceModels/schemes/Make/options @@ -0,0 +1,17 @@ +EXE_INC = \ + -I$(LIB_SRC)/transportModels \ + -I$(LIB_SRC)/transportModels/compressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +LIB_LIBS = \ + -lcompressibleTransportModels \ + -lturbulenceModels \ + -lincompressibleTurbulenceModels \ + -lincompressibleTransportModels \ + -lcompressibleTurbulenceModels \ + -lfluidThermophysicalModels \ + -lfiniteVolume diff --git a/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.C b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.C new file mode 100644 index 0000000000000000000000000000000000000000..cd57c02597dd76b987680c49e18c9216fb419548 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.C @@ -0,0 +1,76 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2015 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "DESModel.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace LESModels +{ + +// * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +DESModel<BasicTurbulenceModel>::DESModel +( + const word& type, + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName +) +: + LESeddyViscosity<BasicTurbulenceModel> + ( + type, + alpha, + rho, + U, + alphaRhoPhi, + phi, + transport, + propertiesName + ) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +DESModel<BasicTurbulenceModel>::~DESModel() +{} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace LESModels +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.H b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.H new file mode 100644 index 0000000000000000000000000000000000000000..1e27387650a81019ad6302d9843d17be83e20135 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModel.H @@ -0,0 +1,117 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012-2015 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 <http://www.gnu.org/licenses/>. + +Class + Foam::DESModel + +Description + Templated abstract base class for DES models + +SourceFiles + DESModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DESModel_H +#define DESModel_H + +#include "DESModelBase.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace LESModels +{ + +/*---------------------------------------------------------------------------*\ + Class DESModel Declaration +\*---------------------------------------------------------------------------*/ + +template<class BasicTurbulenceModel> +class DESModel +: + public DESModelBase, + public LESeddyViscosity<BasicTurbulenceModel> +{ + +private: + + // Private Member Functions + + //- Disallow default bitwise copy construct + DESModel(const DESModel&); + + //- Disallow default bitwise assignment + DESModel& operator=(const DESModel&); + + +public: + + typedef typename BasicTurbulenceModel::alphaField alphaField; + typedef typename BasicTurbulenceModel::rhoField rhoField; + typedef typename BasicTurbulenceModel::transportModel transportModel; + + // Constructors + + //- Construct from components + DESModel + ( + const word& type, + const alphaField& alpha, + const rhoField& rho, + const volVectorField& U, + const surfaceScalarField& alphaRhoPhi, + const surfaceScalarField& phi, + const transportModel& transport, + const word& propertiesName = turbulenceModel::propertiesName + ); + + + //- Destructor + virtual ~DESModel(); + + + // Public Member Functions + + //- Return the LES field indicator + virtual tmp<volScalarField> LESRegion() const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace LESModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "DESModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModelBase.C b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModelBase.C new file mode 100644 index 0000000000000000000000000000000000000000..401c74a8684a63f7f313da00ad6d348b86d5aeda --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModelBase.C @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>. + +Class + Foam::DESModelBase + +Description + Base class for DES models providing an interfaces to the LESRegion + function. + +SourceFiles + DESModelBase.C + +\*---------------------------------------------------------------------------*/ + +#include "DESModelBase.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(DESModelBase, 0); +} + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModelBase.H b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModelBase.H new file mode 100644 index 0000000000000000000000000000000000000000..7378eab3062b8aa79fd7df761e6cbd0bf101e1c4 --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModelBase.H @@ -0,0 +1,81 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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 <http://www.gnu.org/licenses/>. + +Class + Foam::DESModelBase + +Description + Base class for DES models providing an interfaces to the LESRegion + function. + +SourceFiles + DESModelBase.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DESModelBase_H +#define DESModelBase_H + +#include "className.H" +#include "tmp.H" +#include "volFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + class DESModelBase Declaration +\*---------------------------------------------------------------------------*/ + +class DESModelBase +{ +public: + + //- Constructor + DESModelBase() + {} + + //- Destructor + virtual ~DESModelBase() + {} + + ClassName("DESModelBase"); + + + // Public Member Functions + + //- Return the LES field indicator + virtual tmp<volScalarField> LESRegion() const = 0; +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModelDoc.H b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModelDoc.H new file mode 100644 index 0000000000000000000000000000000000000000..df3671a24aeccbfa4aae2ddf601b0a146e0a5ccc --- /dev/null +++ b/src/TurbulenceModels/turbulenceModels/DES/DESModel/DESModelDoc.H @@ -0,0 +1,32 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2015 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/>. + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +\defgroup grpDESTurbulence DES +@{ + \ingroup grpTurbulence + This group contains DES turbulence models. +@} + +\*---------------------------------------------------------------------------*/ diff --git a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.C b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.C similarity index 81% rename from src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.C rename to src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.C index 186970ca6137e643fce28ebb4cb1676d01cbc66a..075b61388d134194722da23a68e8fefb2151fe52 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.C +++ b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.C @@ -68,7 +68,7 @@ tmp<volScalarField> SpalartAllmarasDDES<BasicTurbulenceModel>::fd const volScalarField& magGradU ) const { - return 1 - tanh(pow3(8*rd(magGradU))); + return 1 - tanh(pow(fdFactor_*rd(magGradU), fdExponent_)); } @@ -120,10 +120,46 @@ SpalartAllmarasDDES<BasicTurbulenceModel>::SpalartAllmarasDDES phi, transport, propertiesName + ), + fdFactor_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "fdFactor", + this->coeffDict_, + 8 + ) + ), + fdExponent_ + ( + dimensioned<scalar>::lookupOrAddToDict + ( + "fdExponent", + this->coeffDict_, + 3 + ) ) {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template<class BasicTurbulenceModel> +bool SpalartAllmarasDDES<BasicTurbulenceModel>::read() +{ + if (SpalartAllmarasDES<BasicTurbulenceModel>::read()) + { + fdFactor_.readIfPresent(this->coeffDict()); + fdExponent_.readIfPresent(this->coeffDict()); + return true; + } + else + { + return false; + } +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace LESModels diff --git a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.H b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.H similarity index 94% rename from src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.H rename to src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.H index addcb635a4c1dfebf0dd5bf7154b411d517133c0..80fb8c3cef5a435078389eaa374411a743e8a59f 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDDES/SpalartAllmarasDDES.H +++ b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDDES/SpalartAllmarasDDES.H @@ -79,6 +79,15 @@ class SpalartAllmarasDDES protected: + // Protected data + + //- fd function pre-factor + dimensionedScalar fdFactor_; + + //- fd function exponent + dimensionedScalar fdExponent_; + + // Protected Member Functions //- Length scale @@ -120,6 +129,12 @@ public: //- Destructor virtual ~SpalartAllmarasDDES() {} + + + // Member Functions + + //- Read from dictionary + virtual bool read(); }; diff --git a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.C similarity index 98% rename from src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C rename to src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.C index 53e22dd3847db4e6af8499c0a8d49aa7253387ec..d1b0da8341899a0f56944dde577c7d7bb3f8bca2 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.C +++ b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.C @@ -197,7 +197,7 @@ SpalartAllmarasDES<BasicTurbulenceModel>::SpalartAllmarasDES const word& type ) : - LESeddyViscosity<BasicTurbulenceModel> + DESModel<BasicTurbulenceModel> ( type, alpha, @@ -329,7 +329,7 @@ SpalartAllmarasDES<BasicTurbulenceModel>::SpalartAllmarasDES template<class BasicTurbulenceModel> bool SpalartAllmarasDES<BasicTurbulenceModel>::read() { - if (LESeddyViscosity<BasicTurbulenceModel>::read()) + if (DESModel<BasicTurbulenceModel>::read()) { sigmaNut_.readIfPresent(this->coeffDict()); kappa_.readIfPresent(*this); @@ -414,7 +414,7 @@ void SpalartAllmarasDES<BasicTurbulenceModel>::correct() const surfaceScalarField& alphaRhoPhi = this->alphaRhoPhi_; const volVectorField& U = this->U_; - LESeddyViscosity<BasicTurbulenceModel>::correct(); + DESModel<BasicTurbulenceModel>::correct(); const volScalarField chi(this->chi()); const volScalarField fv1(this->fv1(chi)); diff --git a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.H b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.H similarity index 98% rename from src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.H rename to src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.H index 4c512487a3fee7c5015f41307990af99dc4af588..3a560be0c8ec55ab55c1a388a517a5a879e2cd66 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasDES/SpalartAllmarasDES.H +++ b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasDES/SpalartAllmarasDES.H @@ -47,7 +47,7 @@ SourceFiles #ifndef SpalartAllmarasDES_H #define SpalartAllmarasDES_H -#include "LESeddyViscosity.H" +#include "DESModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -63,7 +63,7 @@ namespace LESModels template<class BasicTurbulenceModel> class SpalartAllmarasDES : - public LESeddyViscosity<BasicTurbulenceModel> + public DESModel<BasicTurbulenceModel> { // Private Member Functions diff --git a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C similarity index 100% rename from src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C rename to src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.C diff --git a/src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H b/src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H similarity index 100% rename from src/TurbulenceModels/turbulenceModels/LES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H rename to src/TurbulenceModels/turbulenceModels/DES/SpalartAllmarasIDDES/SpalartAllmarasIDDES.H diff --git a/src/TurbulenceModels/turbulenceModels/LES/LESeddyViscosity/LESeddyViscosity.H b/src/TurbulenceModels/turbulenceModels/LES/LESeddyViscosity/LESeddyViscosity.H index 1a71e556bfbed5ee52cef755fc2d64ac736cab67..a8d82752f5f488492371ea1d1dedd2780ca5812c 100644 --- a/src/TurbulenceModels/turbulenceModels/LES/LESeddyViscosity/LESeddyViscosity.H +++ b/src/TurbulenceModels/turbulenceModels/LES/LESeddyViscosity/LESeddyViscosity.H @@ -49,7 +49,7 @@ namespace LESModels { /*---------------------------------------------------------------------------*\ - Class LESeddyViscosity Declaration + Class LESeddyViscosity Declaration \*---------------------------------------------------------------------------*/ template<class BasicTurbulenceModel> diff --git a/src/TurbulenceModels/turbulenceModels/Make/files b/src/TurbulenceModels/turbulenceModels/Make/files index 028ed811b40bed4f12d895b2de9c36328969173e..a22069a952dcda5d9685c1b8c00b367bab6ca00c 100644 --- a/src/TurbulenceModels/turbulenceModels/Make/files +++ b/src/TurbulenceModels/turbulenceModels/Make/files @@ -20,6 +20,10 @@ $(LESfilters)/laplaceFilter/laplaceFilter.C $(LESfilters)/anisotropicFilter/anisotropicFilter.C +/* Base class for DES models */ +DES/DESModel/DESModelBase.C + + /* Turbulence BCs */ derivedFvPatchFields/fixedShearStress/fixedShearStressFvPatchVectorField.C derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C diff --git a/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSSTSAS/kOmegaSSTSAS.C b/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSSTSAS/kOmegaSSTSAS.C index 08b3b5af432119200b5061cea684f1db6d42a7fc..7f14345c13f6547308620be2f328fd9412180fdd 100644 --- a/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSSTSAS/kOmegaSSTSAS.C +++ b/src/TurbulenceModels/turbulenceModels/RAS/kOmegaSSTSAS/kOmegaSSTSAS.C @@ -113,7 +113,8 @@ kOmegaSSTSAS<BasicTurbulenceModel>::kOmegaSSTSAS alphaRhoPhi, phi, transport, - propertiesName + propertiesName, + type ), Cs_ @@ -171,7 +172,12 @@ kOmegaSSTSAS<BasicTurbulenceModel>::kOmegaSSTSAS this->coeffDict_ ) ) -{} +{ + if (type == typeName) + { + this->printCoeffs(type); + } +} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C index 5abd82f3ebd22ecb32c91a88825b4cf9a2a1b908..4940cacefb86f645c2f01e2bd6543d2da3523af5 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.C @@ -39,9 +39,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField fixedJumpFvPatchField<scalar>(p, iF), phiName_("phi"), rhoName_("rho"), - D_(0), - I_(0), - length_(0) + D_(), + I_(), + length_(0), + uniformJump_(false) {} @@ -55,9 +56,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField fixedJumpFvPatchField<scalar>(p, iF), phiName_(dict.lookupOrDefault<word>("phi", "phi")), rhoName_(dict.lookupOrDefault<word>("rho", "rho")), - D_(readScalar(dict.lookup("D"))), - I_(readScalar(dict.lookup("I"))), - length_(readScalar(dict.lookup("length"))) + D_(DataEntry<scalar>::New("D", dict)), + I_(DataEntry<scalar>::New("I", dict)), + length_(readScalar(dict.lookup("length"))), + uniformJump_(dict.lookupOrDefault<bool>("uniformJump", false)) { fvPatchField<scalar>::operator= ( @@ -77,9 +79,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField fixedJumpFvPatchField<scalar>(ptf, p, iF, mapper), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - D_(ptf.D_), - I_(ptf.I_), - length_(ptf.length_) + D_(ptf.D_, false), + I_(ptf.I_, false), + length_(ptf.length_), + uniformJump_(ptf.uniformJump_) {} @@ -92,9 +95,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField fixedJumpFvPatchField<scalar>(ptf), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - D_(ptf.D_), - I_(ptf.I_), - length_(ptf.length_) + D_(ptf.D_, false), + I_(ptf.I_, false), + length_(ptf.length_), + uniformJump_(ptf.uniformJump_) {} @@ -107,9 +111,10 @@ Foam::porousBafflePressureFvPatchField::porousBafflePressureFvPatchField fixedJumpFvPatchField<scalar>(ptf, iF), phiName_(ptf.phiName_), rhoName_(ptf.rhoName_), - D_(ptf.D_), - I_(ptf.I_), - length_(ptf.length_) + D_(ptf.D_, false), + I_(ptf.I_, false), + length_(ptf.length_), + uniformJump_(ptf.uniformJump_) {} @@ -130,11 +135,15 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs() scalarField Un(phip/patch().magSf()); - if (phi.dimensions() == dimensionSet(0, 3, -1, 0, 0)) + if (phi.dimensions() == dimMass/dimTime) { Un /= patch().lookupPatchField<volScalarField, scalar>(rhoName_); } + if (uniformJump_) + { + Un = gAverage(Un); + } scalarField magUn(mag(Un)); const turbulenceModel& turbModel = db().lookupObject<turbulenceModel> @@ -146,11 +155,15 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs() ) ); + const scalar t = db().time().timeOutputValue(); + const scalar D = D_->value(t); + const scalar I = I_->value(t); + jump_ = -sign(Un) *( - D_*turbModel.nu(patch().index()) - + I_*0.5*magUn + D*turbModel.nu(patch().index()) + + I*0.5*magUn )*magUn*length_; if (dimensionedInternalField().dimensions() == dimPressure) @@ -161,7 +174,7 @@ void Foam::porousBafflePressureFvPatchField::updateCoeffs() if (debug) { scalar avePressureJump = gAverage(jump_); - scalar aveVelocity = gAverage(mag(Un)); + scalar aveVelocity = gAverage(Un); Info<< patch().boundaryMesh().mesh().name() << ':' << patch().name() << ':' @@ -179,9 +192,11 @@ void Foam::porousBafflePressureFvPatchField::write(Ostream& os) const fixedJumpFvPatchField<scalar>::write(os); writeEntryIfDifferent<word>(os, "phi", "phi", phiName_); writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); - os.writeKeyword("D") << D_ << token::END_STATEMENT << nl; - os.writeKeyword("I") << I_ << token::END_STATEMENT << nl; + D_->writeData(os); + I_->writeData(os); os.writeKeyword("length") << length_ << token::END_STATEMENT << nl; + os.writeKeyword("uniformJump") << uniformJump_ + << token::END_STATEMENT << nl; } diff --git a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.H b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.H index 496ba8154830ce8b314a7e6123603c350ce2a6ff..9257e941191d4614d570f0916526d2c513aa62d9 100644 --- a/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.H +++ b/src/TurbulenceModels/turbulenceModels/derivedFvPatchFields/porousBafflePressure/porousBafflePressureFvPatchField.H @@ -59,6 +59,8 @@ Description D | Darcy coefficient | yes | I | inertial coefficient | yes | L | porous media length in the flow direction | yes | + uniformJump | applies a uniform pressure drop on the patch based on the + net velocity across the baffle | no | no \endtable Example of the boundary condition specification: @@ -71,6 +73,7 @@ Description D 0.001; I 1000000; L 0.1; + uniformJump false; value uniform 0; } \endverbatim @@ -87,6 +90,7 @@ SourceFiles #define porousBafflePressureFvPatchField_H #include "fixedJumpFvPatchField.H" +#include "DataEntry.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -110,14 +114,17 @@ class porousBafflePressureFvPatchField const word rhoName_; //- Darcy pressure loss coefficient - scalar D_; + autoPtr<DataEntry<scalar> > D_; //- Inertia pressure lost coefficient - scalar I_; + autoPtr<DataEntry<scalar> > I_; //- Porous media length scalar length_; + //- Aplies uniform pressure drop + bool uniformJump_; + public: diff --git a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H index 552c3d8531a4a50fd60e496abb44a550b9d9dcd0..14a34a82f52e94350cc110a4224b12edceb9b625 100644 --- a/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H +++ b/src/fvOptions/sources/derived/solidificationMeltingSource/solidificationMeltingSource.H @@ -34,13 +34,12 @@ Description phase change is added as an enthalpy contribution. Based on the references: - - 1. V.R. Voller and C. Prakash, A fixed grid numerical modelling - methodology for convection-diffusion mushy phase-change problems, - Int. J. Heat Mass Transfer 30(8):17091719, 1987. - 2. C.R. Swaminathan. and V.R. Voller, A general enthalpy model for - modeling solidification processes, Metallurgical Transactions - 23B:651664, 1992. + -# V.R. Voller and C. Prakash, A fixed grid numerical modelling + methodology for convection-diffusion mushy phase-change problems, + Int. J. Heat Mass Transfer 30(8):17091719, 1987. + -# C.R. Swaminathan. and V.R. Voller, A general enthalpy model for + modeling solidification processes, Metallurgical Transactions + 23B:651664, 1992. The model generates a field \c \<name\>:alpha1 which can be visualised to to show the melt distribution as a fraction [0-1] diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C new file mode 100644 index 0000000000000000000000000000000000000000..53e961de554b4b4cbb80e3347e4a832583bb8b34 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.C @@ -0,0 +1,217 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013-2015 OpenFOAM Foundation + \\/ M anipulation | Copyright (C) 2015 OpenCFD Ltd. +------------------------------------------------------------------------------- +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 "DESModelRegions.H" +#include "volFields.H" +#include "DESModelBase.H" +#include "turbulenceModel.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ +defineTypeNameAndDebug(DESModelRegions, 0); +} + + +// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * // + +void Foam::DESModelRegions::writeFileHeader(Ostream& os) const +{ + writeHeader(os, "DES model region coverage (% volume)"); + + writeCommented(os, "Time"); + writeTabbed(os, "LES"); + writeTabbed(os, "RAS"); + os << endl; +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::DESModelRegions::DESModelRegions +( + const word& name, + const objectRegistry& obr, + const dictionary& dict, + const bool loadFromFiles +) +: + functionObjectFile(obr, name, typeName, dict), + name_(name), + obr_(obr), + active_(true), + resultName_(name), + log_(true) +{ + // Check if the available mesh is an fvMesh, otherwise deactivate + if (!isA<fvMesh>(obr_)) + { + active_ = false; + WarningIn + ( + "DESModelRegions::DESModelRegions" + "(" + "const word&, " + "const objectRegistry&, " + "const dictionary&, " + "const bool" + ")" + ) << "No fvMesh available, deactivating " << name_ << nl + << endl; + } + + read(dict); + + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + volScalarField* DESModelRegionsPtr + ( + new volScalarField + ( + IOobject + ( + resultName_, + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimensionedScalar("0", dimless, 0.0) + ) + ); + + mesh.objectRegistry::store(DESModelRegionsPtr); + + writeFileHeader(file()); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::DESModelRegions::~DESModelRegions() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::DESModelRegions::read(const dictionary& dict) +{ + if (active_) + { + functionObjectFile::read(dict); + + log_.readIfPresent("log", dict); + dict.readIfPresent("resultName", resultName_); + } +} + + +void Foam::DESModelRegions::execute() +{ + if (active_) + { + const fvMesh& mesh = refCast<const fvMesh>(obr_); + + if (log_) Info<< type() << " " << name_ << " output:" << nl; + + volScalarField& DESModelRegions = + const_cast<volScalarField&> + ( + mesh.lookupObject<volScalarField>(resultName_) + ); + + + if (mesh.foundObject<DESModelBase>(turbulenceModel::propertiesName)) + { + const DESModelBase& model = + mesh.lookupObject<DESModelBase> + ( + turbulenceModel::propertiesName + ); + + DESModelRegions == model.LESRegion(); + + scalar prc = + gSum(DESModelRegions.internalField()*mesh.V()) + /gSum(mesh.V())*100.0; + + file() << obr_.time().value() + << token::TAB << prc + << token::TAB << 100.0 - prc + << endl; + + if (log_) Info + << " LES = " << prc << " % (volume)" << nl + << " RAS = " << 100.0 - prc << " % (volume)" << nl + << endl; + } + else + { + if (log_) Info + << " No DES turbulence model found in database" << nl + << endl; + } + } +} + + +void Foam::DESModelRegions::end() +{ + if (active_) + { + execute(); + } +} + + +void Foam::DESModelRegions::timeSet() +{ + // Do nothing +} + + +void Foam::DESModelRegions::write() +{ + if (active_) + { + const volScalarField& DESModelRegions = + obr_.lookupObject<volScalarField>(resultName_); + + if (log_) Info + << type() << " " << name_ << " output:" << nl + << " writing field " << DESModelRegions.name() << nl + << endl; + + DESModelRegions.write(); + } +} + + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H new file mode 100644 index 0000000000000000000000000000000000000000..2db27d53f2bda1735a5c2f6cc38b0462c2278302 --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegions.H @@ -0,0 +1,186 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2013-2015 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 <http://www.gnu.org/licenses/>. + +Class + Foam::DESModelRegions + +Group + grpUtilitiesFunctionObjects + +Description + This function object writes out an indicator field for DES turbulence + calculations, that is: + - 0 for RAS regions + - 1 for LES regions + + The field is stored on the mesh database so that it can be retrieved and + used for other applications. + + Example of function object specification to generate DES indicator field: + \verbatim + DESModelRegions1 + { + type DESModelRegions; + functionObjectLibs ("libutilityFunctionObjects.so"); + ... + } + \endverbatim + + \heading Function object usage + \table + Property | Description | Required | Default value + type | type name: DESModelRegions| yes | + resultName | Name of DES indicator field | no | <function name> + log | log to standard output | no | yes + \endtable + +SourceFiles + DESModelRegions.C + IODESModelRegions.H + +\*---------------------------------------------------------------------------*/ + +#ifndef DESModelRegions_H +#define DESModelRegions_H + +#include "functionObjectFile.H" +#include "volFieldsFwd.H" +#include "Switch.H" +#include "OFstream.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// Forward declaration of classes +class objectRegistry; +class dictionary; +class polyMesh; +class mapPolyMesh; +class fvMesh; + +/*---------------------------------------------------------------------------*\ + Class DESModelRegions Declaration +\*---------------------------------------------------------------------------*/ + +class DESModelRegions +: + public functionObjectFile +{ +protected: + + // Protected data + + //- Name of this set of DESModelRegions object + word name_; + + const objectRegistry& obr_; + + //- on/off switch + bool active_; + + //- Result name + word resultName_; + + //- Switch to send output to Info as well as to file + Switch log_; + + + // Protected Member Functions + + //- File header information + virtual void writeFileHeader(Ostream& os) const; + + //- Disallow default bitwise copy construct + DESModelRegions(const DESModelRegions&); + + //- Disallow default bitwise assignment + void operator=(const DESModelRegions&); + + +public: + + //- Runtime type information + TypeName("DESModelRegions"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + DESModelRegions + ( + const word& name, + const objectRegistry&, + const dictionary&, + const bool loadFromFiles = false + ); + + + //- Destructor + virtual ~DESModelRegions(); + + + // Member Functions + + //- Return name of the set of DESModelRegions + virtual const word& name() const + { + return name_; + } + + //- Read the DESModelRegions data + virtual void read(const dictionary&); + + //- Execute, currently does nothing + virtual void execute(); + + //- Execute at the final time-loop, currently does nothing + virtual void end(); + + //- Called when time was set at the end of the Time::operator++ + virtual void timeSet(); + + //- Calculate the DESModelRegions and write + virtual void write(); + + //- Update for changes of mesh + virtual void updateMesh(const mapPolyMesh&) + {} + + //- Update for changes of mesh + virtual void movePoints(const polyMesh&) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.C b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.C new file mode 100644 index 0000000000000000000000000000000000000000..2312e6f5fb80bbedada0e434316541b3c73b570a --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "DESModelRegionsFunctionObject.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineNamedTemplateTypeNameAndDebug(DESModelRegionsFunctionObject, 0); + + addToRunTimeSelectionTable + ( + functionObject, + DESModelRegionsFunctionObject, + dictionary + ); +} + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.H b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.H new file mode 100644 index 0000000000000000000000000000000000000000..7e9a6ba45cb21063912f193edc4b07fb4d1a066f --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/DESModelRegionsFunctionObject.H @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 <http://www.gnu.org/licenses/>. + +Typedef + Foam::DESModelRegionsFunctionObject + +Description + FunctionObject wrapper around DESModelRegions to allow it to be created + via the functions entry within controlDict. + +SourceFiles + DESModelRegionsFunctionObject.C + +\*---------------------------------------------------------------------------*/ + +#ifndef DESModelRegionsFunctionObject_H +#define DESModelRegionsFunctionObject_H + +#include "DESModelRegions.H" +#include "OutputFilterFunctionObject.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef OutputFilterFunctionObject<DESModelRegions> + DESModelRegionsFunctionObject; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/DESModelRegions/IODESModelRegions.H b/src/postProcessing/functionObjects/utilities/DESModelRegions/IODESModelRegions.H new file mode 100644 index 0000000000000000000000000000000000000000..17cc16b74ee973ad00035c04db02cb6dd9abe2de --- /dev/null +++ b/src/postProcessing/functionObjects/utilities/DESModelRegions/IODESModelRegions.H @@ -0,0 +1,49 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2012 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 <http://www.gnu.org/licenses/>. + +Typedef + Foam::IODESModelRegions + +Description + Instance of the generic IOOutputFilter for DESModelRegions. + +\*---------------------------------------------------------------------------*/ + +#ifndef IODESModelRegions_H +#define IODESModelRegions_H + +#include "DESModelRegions.H" +#include "IOOutputFilter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef IOOutputFilter<DESModelRegions> IODESModelRegions; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/postProcessing/functionObjects/utilities/Make/files b/src/postProcessing/functionObjects/utilities/Make/files index 8e4eaaf81cb5b464d7220c9a68150211cda6c168..f42510d7a5dcd07e7c975a6c24dfc8dd867496d1 100644 --- a/src/postProcessing/functionObjects/utilities/Make/files +++ b/src/postProcessing/functionObjects/utilities/Make/files @@ -6,6 +6,9 @@ codedFunctionObject/codedFunctionObject.C CourantNo/CourantNo.C CourantNo/CourantNoFunctionObject.C +DESModelRegions/DESModelRegions.C +DESModelRegions/DESModelRegionsFunctionObject.C + dsmcFields/dsmcFields.C dsmcFields/dsmcFieldsFunctionObject.C diff --git a/src/thermophysicalModels/properties/liquidPropertiesFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C b/src/thermophysicalModels/properties/liquidPropertiesFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C index 4839fbddb765066f3c794f2fc20d663435f7b15c..1bc31648218a5b655657c1574bf85cdf9636d2c3 100644 --- a/src/thermophysicalModels/properties/liquidPropertiesFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/properties/liquidPropertiesFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C @@ -53,11 +53,9 @@ namespace Foam const Foam::NamedEnum < - Foam:: - humidityTemperatureCoupledMixedFvPatchScalarField:: - massTransferMode, + Foam::humidityTemperatureCoupledMixedFvPatchScalarField::massTransferMode, 4 -> Foam::humidityTemperatureCoupledMixedFvPatchScalarField::MassModeTypeNames_; +> Foam::humidityTemperatureCoupledMixedFvPatchScalarField::massModeTypeNames_; // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // @@ -145,11 +143,15 @@ humidityTemperatureCoupledMixedFvPatchScalarField : mixedFvPatchScalarField(p, iF), temperatureCoupledBase(patch(), "fluidThermo", "undefined", "undefined-K"), - mode_(mConstantMass), - TnbrName_("undefined-Tnbr"), - QrNbrName_("undefined-Qr"), - QrName_("undefined-Qr"), - specieName_("undefined"), + mode_(mtConstantMass), + pName_("p"), + UName_("U"), + rhoName_("rho"), + muName_("thermo:mu"), + TnbrName_("T"), + QrNbrName_("none"), + QrName_("none"), + specieName_("none"), liquid_(NULL), liquidDict_(NULL), mass_(patch().size(), 0.0), @@ -182,6 +184,10 @@ humidityTemperatureCoupledMixedFvPatchScalarField mixedFvPatchScalarField(psf, p, iF, mapper), temperatureCoupledBase(patch(), psf), mode_(psf.mode_), + pName_(psf.pName_), + UName_(psf.UName_), + rhoName_(psf.rhoName_), + muName_(psf.muName_), TnbrName_(psf.TnbrName_), QrNbrName_(psf.QrNbrName_), QrName_(psf.QrName_), @@ -212,7 +218,11 @@ humidityTemperatureCoupledMixedFvPatchScalarField : mixedFvPatchScalarField(p, iF), temperatureCoupledBase(patch(), dict), - mode_(mCondensationAndEvaporation), + mode_(mtCondensationAndEvaporation), + pName_(dict.lookupOrDefault<word>("p", "p")), + UName_(dict.lookupOrDefault<word>("U", "U")), + rhoName_(dict.lookupOrDefault<word>("rho", "rho")), + muName_(dict.lookupOrDefault<word>("mu", "thermo:mu")), TnbrName_(dict.lookupOrDefault<word>("Tnbr", "T")), QrNbrName_(dict.lookupOrDefault<word>("QrNbr", "none")), QrName_(dict.lookupOrDefault<word>("Qr", "none")), @@ -255,7 +265,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField if (dict.found("mode")) { - mode_ = MassModeTypeNames_.read(dict.lookup("mode")); + mode_ = massModeTypeNames_.read(dict.lookup("mode")); fluid_ = true; } @@ -263,7 +273,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField { switch(mode_) { - case mConstantMass: + case mtConstantMass: { thickness_ = scalarField("thickness", dict, p.size()); cp_ = scalarField("cp", dict, p.size()); @@ -271,9 +281,9 @@ humidityTemperatureCoupledMixedFvPatchScalarField break; } - case mCondensation: - case mEvaporation: - case mCondensationAndEvaporation: + case mtCondensation: + case mtEvaporation: + case mtCondensationAndEvaporation: { Mcomp_ = readScalar(dict.lookup("carrierMolWeight")); L_ = readScalar(dict.lookup("L")); @@ -286,6 +296,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField { scalarField& Tp = *this; const scalarField& magSf = patch().magSf(); + // Assume initially standard pressure for rho calculation scalar pf = 1e5; thickness_ = scalarField("thickness", dict, p.size()); @@ -316,7 +327,7 @@ humidityTemperatureCoupledMixedFvPatchScalarField << " on patch " << patch().name() << nl << "Please set 'mode' to one of " - << MassModeTypeNames_.sortedToc() + << massModeTypeNames_.sortedToc() << exit(FatalIOError); } } @@ -351,6 +362,10 @@ humidityTemperatureCoupledMixedFvPatchScalarField mixedFvPatchScalarField(psf, iF), temperatureCoupledBase(patch(), psf), mode_(psf.mode_), + pName_(psf.pName_), + UName_(psf.UName_), + rhoName_(psf.rhoName_), + muName_(psf.muName_), TnbrName_(psf.TnbrName_), QrNbrName_(psf.QrNbrName_), QrName_(psf.QrName_), @@ -458,7 +473,7 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs() const scalarField K(this->kappa(*this)); - // nrb kappa is done separately because I need kappa solid for + // Neighbour kappa done separately because we need kappa solid for the // htc correlation scalarField nbrK(nbrField.kappa(*this)); mpp.distribute(nbrK); @@ -480,7 +495,7 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs() const scalarField myDelta(patch().deltaCoeffs()); - if (mode_ != mConstantMass) + if (mode_ != mtConstantMass) { scalarField cp(patch().size(), 0.0); scalarField hfg(patch().size(), 0.0); @@ -503,16 +518,16 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs() ); const fvPatchScalarField& pp = - patch().lookupPatchField<volScalarField, scalar>("p"); + patch().lookupPatchField<volScalarField, scalar>(pName_); const fvPatchVectorField& Up = - patch().lookupPatchField<volVectorField, vector>("U"); + patch().lookupPatchField<volVectorField, vector>(UName_); const fvPatchScalarField& rhop = - patch().lookupPatchField<volScalarField, scalar>("rho"); + patch().lookupPatchField<volScalarField, scalar>(rhoName_); const fvPatchScalarField& mup = - patch().lookupPatchField<volScalarField, scalar>("thermo:mu"); + patch().lookupPatchField<volScalarField, scalar>(muName_); const vectorField Ui(Up.patchInternalField()); const scalarField Yi(Yp.patchInternalField()); @@ -550,15 +565,8 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs() scalar c = 17.65; scalar TintDeg = Tint - 273; Tdew = - b* - ( - log(RH) - + (c*TintDeg)/(b + TintDeg) - ) - / - ( - c - log(RH) - ((c*TintDeg)/(b + TintDeg)) - ) + 273; + b*(log(RH) + (c*TintDeg)/(b + TintDeg)) + /(c - log(RH) - ((c*TintDeg)/(b + TintDeg))) + 273; } if @@ -566,18 +574,17 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs() Tf < Tdew && RH > RHmin && ( - mode_ == mCondensation - || mode_ == mCondensationAndEvaporation + mode_ == mtCondensation + || mode_ == mtCondensationAndEvaporation ) ) { - htc[faceI] = - this->htcCondensation(TSat, Re)*nbrK[faceI]/L_; + htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_; scalar htcTotal = 1.0/((1.0/myKDelta_[faceI]) + (1.0/htc[faceI])); - // Heat flux W (>0 heat is converted into mass) + // Heat flux [W] (>0 heat is converted into mass) const scalar q = (Tint - Tf)*htcTotal*magSf[faceI]; // Mass flux rate [Kg/s/m2] @@ -595,8 +602,8 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs() Tf > Tvap_ && mass_[faceI] > 0.0 && ( - mode_ == mEvaporation - || mode_ == mCondensationAndEvaporation + mode_ == mtEvaporation + || mode_ == mtCondensationAndEvaporation ) ) { @@ -606,6 +613,7 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs() const scalar Sh = this->Sh(Re, Sc); const scalar Ys = Mv*pSat/(Mv*pSat + Mcomp_*(pf - pSat)); + // Mass transfer coefficient [m/s] const scalar hm = Dab*Sh/L_; @@ -620,12 +628,11 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs() // Total mass accumulated [Kg] mass_[faceI] += dm[faceI]*magSf[faceI]*dt; - htc[faceI] = - this->htcCondensation(TSat, Re)*nbrK[faceI]/L_; + htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_; } else if (Tf > Tdew && Tf < Tvap_ && mass_[faceI] > 0.0) { - htc[faceI] = this->htcCondensation(TSat, Re)*nbrK[faceI]/L_; + htc[faceI] = htcCondensation(TSat, Re)*nbrK[faceI]/L_; } else if (mass_[faceI] == 0.0) { @@ -722,10 +729,10 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs() Info<< mesh.name() << ':' << patch().name() << ':' - << this->dimensionedInternalField().name() << " <- " + << dimensionedInternalField().name() << " <- " << nbrMesh.name() << ':' << nbrPatch.name() << ':' - << this->dimensionedInternalField().name() << " :" << nl + << dimensionedInternalField().name() << " :" << nl << " Total mass flux [Kg/s] : " << Qdm << nl << " Total mass on the wall [Kg] : " << QMass << nl << " Total heat (>0 leaving the wall to the fluid) [W] : " @@ -748,15 +755,21 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::write ) const { mixedFvPatchScalarField::write(os); - os.writeKeyword("QrNbr")<< QrNbrName_ << token::END_STATEMENT << nl; - os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl; + writeEntryIfDifferent<word>(os, "p", "p", pName_); + writeEntryIfDifferent<word>(os, "U", "U", UName_); + writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_); + writeEntryIfDifferent<word>(os, "mu", "thermo:mu", muName_); + writeEntryIfDifferent<word>(os, "Tnbr", "T", TnbrName_); + writeEntryIfDifferent<word>(os, "QrNbr", "none", QrNbrName_); + writeEntryIfDifferent<word>(os, "Qr", "none", QrName_); if (fluid_) { - os.writeKeyword("mode")<< MassModeTypeNames_[mode_] - << token::END_STATEMENT <<nl; - os.writeKeyword("specieName")<< specieName_ + os.writeKeyword("mode")<< massModeTypeNames_[mode_] << token::END_STATEMENT <<nl; + + writeEntryIfDifferent<word>(os, "specieName", "none", specieName_); + os.writeKeyword("carrierMolWeight")<< Mcomp_ << token::END_STATEMENT <<nl; @@ -765,7 +778,7 @@ void Foam::humidityTemperatureCoupledMixedFvPatchScalarField::write os.writeKeyword("fluid")<< fluid_ << token::END_STATEMENT << nl; mass_.writeEntry("mass", os); - if (mode_ == mConstantMass) + if (mode_ == mtConstantMass) { cp_.writeEntry("cp", os); rho_.writeEntry("rho", os); diff --git a/src/thermophysicalModels/properties/liquidPropertiesFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H b/src/thermophysicalModels/properties/liquidPropertiesFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H index 95e119eb8cf2fc4ef949209bec3928d80016f1ee..9c94c4fcec3a7e49a88b753beb0e69b41a5e3678 100644 --- a/src/thermophysicalModels/properties/liquidPropertiesFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H +++ b/src/thermophysicalModels/properties/liquidPropertiesFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H @@ -28,112 +28,120 @@ Class humidityTemperatureCoupledMixedFvPatchScalarField Description - Mixed boundary condition for temperature to be used on coupling flow and - solid regions. This BC can operate in four modes: - - 1) 'inert' : thermal inertia is important and no condensation/evaporation - is taken place. - 2) 'condensation' : just condensation is taken place - 3) 'vaporization' : just evaporation is take place - 4) 'condEvap' : both condensation and evaporation take place - - For 'inert' operation the 'rho', 'thickness' and 'cp' entries are needed. - - In 'condensation' mode when the wall temperature (Tw) is bellow the dew - temperature (Tdew) condesation takes place and the resulting condensed mass - is stored on the wall. - - In 'vaporization' the initial mass is vaporized when Tw is above the - input vaporization temperature (Tvap). - - In 'condEvap', condensation and evaporation take place simultaneously. - - The BC assumes no mass flow on the wall.i.e the mass condensed on a face - remains on that face. It uses a 'lump mass' model to include thermal + Mixed boundary condition for temperature to be used at the coupling + interface between fluid solid regions. + + This boundary condition can operate in four modes: + - \c constantMass: thermal inertia only + - requires \c rho, \c thickness and \cp + - \c condensation: condensation only + - when the wall temperature (Tw) is below the dew temperature (Tdew) + condesation takes place and the resulting condensed mass is stored + on the wall + - \c evaporation: evaporation only + - initial mass is vaporized when Tw is above the input vaporization + temperature (Tvap). + - \c condensationAndEvaporation : condensation and evaporation take place + simultaneously. + + There is no mass flow on the wall, i.e. the mass condensed on a face + remains on that face. It uses a 'lumped mass' model to include thermal inertia effects. - It assumes a drop-wise type of condensation and its heat transfer Nu number - is: + It assumes a drop-wise type of condensation, whereby its heat transfer + Nusselt number is calculated using: + \f{eqnarray*}{ + 51104 + 2044 T & T > 295 & T < 373 \\ + 255510 & T > 373 & + \f} - 51104 + 2044*T T > 295 T < 373 - 255510 T > 373 + Reference: + - T. Bergam, A.Lavine, F. Incropera and D. Dewitt. Heat and Mass Transfer. + 7th Edition. Chapter 10. - T. Bergam, A.Lavine, F. Incropera and D. Dewitt. Heat and Mass Transfer. - 7th Edition. Chapter 10. + The mass transfer correlation used is: - The mass transfer correlation used is hm = Dab*Sh/L + \f[ h_m = D_{ab} \frac{Sc}{L} \f] where: + \vartable + D_{ab} | mass vapour difussivity + L | characteristic length + Sc | Schmidt number + \endvartable - Dab is the mass vapor difussivity - L is the characteristic lenght - Sc the Schmidt number and it is calculated as: + The Schmidt number is calculated using: - 0.664*sqrt(Re)*cbrt(Sc) Re < 5.0E+05 - 0.037*pow(Re, 0.8)*cbrt(Sc) Re > 5.0E+05 + \f{eqnarray*}{ + 0.664 Re^\frac{1}{2} Sc^\frac{1}{3} & Re < 5.0E+05 \\ + 0.037 Re^\frac{4}{5} Sc^\frac{1}{3} & Re > 5.0E+05 + \f} - NOTE: The correclation used to calculate Tdew is for water vapor. - In addition a scalar transport for the carrier specie have to be specified - via function objects or in the main solver. This specie transports the - vapour phase in the main ragion. The BC of this specie on the coupled wall - has to fixedGradient in order to allow condensation or evaporation of the - vapor in or out of this wall + NOTE: + - The correlation used to calculate Tdew is for water vapour. + - A scalar transport equation for the carrier specie is required, e.g. + supplied via a function object or in the main solver. This specie + transports the vapour phase in the main ragion. + - The boundary condition of this specie on the coupled wall must be + fixedGradient in order to allow condensation or evaporation of the + vapour in or out of this wall Example usage: On the fluid side + \verbatim + myInterfacePatchName + { + type thermalHumidityCoupledMixed; + kappa fluidThermo; + kappaName none; - myInterfacePatchName - { - type thermalHumidityCoupledMixed; - kappa fluidThermo; - kappaName none; - - // Modes of operation: inert, condensation, vaporization, condEvap - mode condEvap; + // Modes of operation: inert, condensation, vaporization, condEvap + mode condEvap; - // Carrier species name - specieName H2O; + // Carrier species name + specieName H2O; - // Carrier molecular weight - carrierMolWeight 28.9; + // Carrier molecular weight + carrierMolWeight 28.9; - // Characteristic lenght of the wall - L 0.1; + // Characteristic lenght of the wall + L 0.1; - // Vaporasation temperature - Tvap 273; + // Vaporasation temperature + Tvap 273; - // Liquid properties for the condensed mass - liquid + // Liquid properties for the condensed mass + liquid + { + H2O { - H2O - { - defaultCoeffs yes; - } + defaultCoeffs yes; } + } - // thickness, density and cp required for inert and condensation - // modes - - //thickness uniform 0; - //cp uniform 0; - //rho uniform 0; + // thickness, density and cp required for inert and condensation + // modes - value $internalField; - } + //thickness uniform 0; + //cp uniform 0; + //rho uniform 0; + value $internalField; + } + \endverbatim On the solid side: - - myInterfacePatchName - { - type thermalInertiaMassTransferCoupledMixed; - kappa solidThermo; - kappaName none; - value uniform 260; - } + \verbatim + myInterfacePatchName + { + type thermalInertiaMassTransferCoupledMixed; + kappa solidThermo; + kappaName none; + value uniform 260; + } + \endverbatim SourceFiles @@ -170,10 +178,10 @@ public: //- Modes of mass transfer enum massTransferMode { - mConstantMass, - mCondensation, - mEvaporation, - mCondensationAndEvaporation + mtConstantMass, + mtCondensation, + mtEvaporation, + mtCondensationAndEvaporation }; @@ -181,22 +189,38 @@ private: // Private data - static const NamedEnum<massTransferMode, 4> MassModeTypeNames_; + static const NamedEnum<massTransferMode, 4> massModeTypeNames_; - //- BC mode + //- Operating mode massTransferMode mode_; - //- Name of field on the neighbour region - const word TnbrName_; - //- Name of the radiative heat flux in the neighbout region - const word QrNbrName_; + // Field names + + //- Name of the pressure field + const word pName_; + + //- Name of the velocity field + const word UName_; + + //- Name of the density field + const word rhoName_; - //- Name of the radiative heat flux - const word QrName_; + //- Name of the dynamic viscosity field + const word muName_; + + //- Name of temperature field on the neighbour region + const word TnbrName_; + + //- Name of the radiative heat flux in the neighbout region + const word QrNbrName_; + + //- Name of the radiative heat flux field + const word QrName_; + + //- Name of the species on which the mass transfered (default H2O) + const word specieName_; - //- Name of the species on which the mass transfered (default H2O) - const word specieName_; //- Liquid properties autoPtr<liquidProperties> liquid_; @@ -345,7 +369,7 @@ public: return myKDelta_; } - //- Return mpCpdTpd + //- Return mpCpTp const scalarField mpCpTp() const { return mpCpTp_; @@ -357,7 +381,6 @@ public: return dmHfg_; } - //- Update the coefficients associated with the patch field virtual void updateCoeffs();