From 047211b1f747587adc38262d01a660794a16b29b Mon Sep 17 00:00:00 2001 From: sergio <sergio> Date: Tue, 3 Nov 2015 14:42:08 -0800 Subject: [PATCH] ENH: Adding humidityTemperatureCoupledMixed BC and directionalPressureGradientExplicitSource and the corresponding tutorial tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation --- src/TurbulenceModels/compressible/Make/files | 1 + .../compressible/Make/options | 1 + ...emperatureCoupledMixedFvPatchScalarField.C | 799 ++++++++++++++++++ ...emperatureCoupledMixedFvPatchScalarField.H | 377 +++++++++ src/fvOptions/Make/files | 3 + src/fvOptions/Make/options | 6 +- ...irectionalPressureGradientExplicitSource.C | 579 +++++++++++++ ...irectionalPressureGradientExplicitSource.H | 268 ++++++ ...ectionalPressureGradientExplicitSourceIO.C | 73 ++ .../windshieldCondensation/0.org/cabin/H2O | 58 ++ .../windshieldCondensation/0.org/cabin/T | 76 ++ .../windshieldCondensation/0.org/cabin/U | 58 ++ .../windshieldCondensation/0.org/cabin/alphat | 53 ++ .../windshieldCondensation/0.org/cabin/k | 58 ++ .../windshieldCondensation/0.org/cabin/nut | 57 ++ .../windshieldCondensation/0.org/cabin/omega | 58 ++ .../windshieldCondensation/0.org/cabin/p | 51 ++ .../windshieldCondensation/0.org/cabin/p_rgh | 54 ++ .../windshieldCondensation/0.org/windshield/T | 51 ++ .../windshieldCondensation/0.org/windshield/p | 36 + .../windshieldCondensation/Allclean | 11 + .../windshieldCondensation/Allrun | 27 + .../windshieldCondensation/constant/cabin/g | 22 + .../constant/cabin/radiationProperties | 24 + .../constant/cabin/thermophysicalProperties | 55 ++ .../constant/cabin/turbulenceProperties | 29 + .../constant/polyMesh/boundary | 54 ++ .../constant/regionProperties | 24 + .../constant/windshield/radiationProperties | 24 + .../windshield/thermophysicalProperties | 53 ++ .../system/blockMeshDict | 154 ++++ .../system/cabin/fvOptions | 51 ++ .../system/cabin/fvSchemes | 75 ++ .../system/cabin/fvSolution | 94 +++ .../system/cabin/topoSetDict | 59 ++ .../system/cabin/topoSetDictRegister | 68 ++ .../windshieldCondensation/system/controlDict | 99 +++ .../system/controlDict.0 | 99 +++ .../system/controlDict.20 | 99 +++ .../system/controlDict.5 | 99 +++ .../system/controlDict.60 | 99 +++ .../windshieldCondensation/system/fvSchemes | 47 ++ .../windshieldCondensation/system/fvSolution | 24 + .../windshieldCondensation/system/topoSetDict | 59 ++ .../system/windshield/fvSchemes | 53 ++ .../system/windshield/fvSolution | 51 ++ 46 files changed, 4269 insertions(+), 1 deletion(-) create mode 100644 src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C create mode 100644 src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H create mode 100644 src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C create mode 100644 src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H create mode 100644 src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/H2O create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/T create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/U create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/alphat create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/k create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/nut create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/omega create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/p create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/p_rgh create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/windshield/T create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/windshield/p create mode 100755 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allclean create mode 100755 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allrun create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/g create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/radiationProperties create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/thermophysicalProperties create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/turbulenceProperties create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/polyMesh/boundary create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/regionProperties create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/windshield/radiationProperties create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/windshield/thermophysicalProperties create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/blockMeshDict create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvOptions create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvSchemes create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvSolution create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/topoSetDict create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/topoSetDictRegister create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.0 create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.20 create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.5 create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.60 create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/fvSchemes create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/fvSolution create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/topoSetDict create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/windshield/fvSchemes create mode 100644 tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/windshield/fvSolution diff --git a/src/TurbulenceModels/compressible/Make/files b/src/TurbulenceModels/compressible/Make/files index c4aab942510..90f6607d535 100644 --- a/src/TurbulenceModels/compressible/Make/files +++ b/src/TurbulenceModels/compressible/Make/files @@ -12,6 +12,7 @@ $(BCs)/externalWallHeatFluxTemperature/externalWallHeatFluxTemperatureFvPatchSca $(BCs)/wallHeatTransfer/wallHeatTransferFvPatchScalarField.C $(BCs)/externalCoupledTemperatureMixed/externalCoupledTemperatureMixedFvPatchScalarField.C $(BCs)/convectiveHeatTransfer/convectiveHeatTransferFvPatchScalarField.C +$(BCs)/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatWallFunction/alphatWallFunctionFvPatchScalarField.C turbulentFluidThermoModels/derivedFvPatchFields/wallFunctions/alphatWallFunctions/alphatJayatillekeWallFunction/alphatJayatillekeWallFunctionFvPatchScalarField.C diff --git a/src/TurbulenceModels/compressible/Make/options b/src/TurbulenceModels/compressible/Make/options index fa99ca3a58a..67954230583 100644 --- a/src/TurbulenceModels/compressible/Make/options +++ b/src/TurbulenceModels/compressible/Make/options @@ -5,6 +5,7 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/properties/liquidProperties/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C new file mode 100644 index 00000000000..05198a39bc7 --- /dev/null +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.C @@ -0,0 +1,799 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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/>. + +\*---------------------------------------------------------------------------*/ + +#include "humidityTemperatureCoupledMixedFvPatchScalarField.H" +#include "addToRunTimeSelectionTable.H" +#include "fvPatchFieldMapper.H" +#include "volFields.H" +#include "surfaceFields.H" +#include "mappedPatchBase.H" +#include "fixedGradientFvPatchFields.H" + +// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // + +namespace Foam +{ + template<> + const char* Foam::NamedEnum + < + Foam:: + humidityTemperatureCoupledMixedFvPatchScalarField:: + massTransferMode, + 4 + >::names[] = + { + "constantMass", + "condensation", + "evaporation", + "condensationAndEvaporation" + }; +} + +const Foam::NamedEnum +< + Foam:: + humidityTemperatureCoupledMixedFvPatchScalarField:: + massTransferMode, + 4 +> Foam:: +humidityTemperatureCoupledMixedFvPatchScalarField:: MassModeTypeNames_; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +humidityTemperatureCoupledMixedFvPatchScalarField:: +humidityTemperatureCoupledMixedFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF +) +: + mixedFvPatchScalarField(p, iF), + temperatureCoupledBase(patch(), "fluidThermo", "undefined", "undefined-K"), + mode_(mConstantMass), + TnbrName_("undefined-Tnbr"), + QrNbrName_("undefined-Qr"), + QrName_("undefined-Qr"), + specieName_("undefined"), + liquid_(NULL), + liquidDict_(NULL), + mass_(patch().size(), 0.0), + Tvap_(0.0), + myKDelta_(patch().size(), 0.0), + dmHfg_(patch().size(), 0.0), + mpCpTp_(patch().size(), 0.0), + Mcomp_(0.0), + L_(0.0), + fluid_(false), + cp_(patch().size(), 0.0), + thickness_(patch().size(), 0.0), + rho_(patch().size(), 0.0) +{ + this->refValue() = 0.0; + this->refGrad() = 0.0; + this->valueFraction() = 1.0; +} + + +humidityTemperatureCoupledMixedFvPatchScalarField:: +humidityTemperatureCoupledMixedFvPatchScalarField +( + const humidityTemperatureCoupledMixedFvPatchScalarField& psf, + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const fvPatchFieldMapper& mapper +) +: + mixedFvPatchScalarField(psf, p, iF, mapper), + temperatureCoupledBase(patch(), psf), + mode_(psf.mode_), + TnbrName_(psf.TnbrName_), + QrNbrName_(psf.QrNbrName_), + QrName_(psf.QrName_), + specieName_(psf.specieName_), + liquid_(psf.liquid_), + liquidDict_(psf.liquidDict_), + mass_(psf.mass_, mapper), + Tvap_(psf.Tvap_), + myKDelta_(psf.myKDelta_, mapper), + dmHfg_(psf.dmHfg_, mapper), + mpCpTp_(psf.mpCpTp_, mapper), + Mcomp_(psf.Mcomp_), + L_(psf.L_), + fluid_(psf.fluid_), + cp_(psf.cp_, mapper), + thickness_(psf.thickness_, mapper), + rho_(psf.rho_, mapper) +{} + + +humidityTemperatureCoupledMixedFvPatchScalarField:: +humidityTemperatureCoupledMixedFvPatchScalarField +( + const fvPatch& p, + const DimensionedField<scalar, volMesh>& iF, + const dictionary& dict +) +: + mixedFvPatchScalarField(p, iF), + temperatureCoupledBase(patch(), dict), + mode_(mCondensationAndEvaporation), + TnbrName_(dict.lookupOrDefault<word>("Tnbr", "T")), + QrNbrName_(dict.lookupOrDefault<word>("QrNbr", "none")), + QrName_(dict.lookupOrDefault<word>("Qr", "none")), + specieName_(dict.lookupOrDefault<word>("specieName", "none")), + liquid_(NULL), + liquidDict_(), + mass_(patch().size(), 0.0), + Tvap_(0.0), + myKDelta_(patch().size(), 0.0), + dmHfg_(patch().size(), 0.0), + mpCpTp_(patch().size(), 0.0), + Mcomp_(0.0), + L_(0.0), + fluid_(false), + cp_(patch().size(), 0.0), + thickness_(patch().size(), 0.0), + rho_(patch().size(), 0.0) +{ + if (!isA<mappedPatchBase>(this->patch().patch())) + { + FatalErrorIn + ( + "humidityTemperatureCoupledMixedFvPatchScalarField::" + "humidityTemperatureCoupledMixedFvPatchScalarField\n" + "(\n" + " const fvPatch&,\n" + " const DimensionedField<scalar, volMesh>&,\n" + " const dictionary&\n" + ")\n" + ) << "\n patch type '" << p.type() + << "' not type '" << mappedPatchBase::typeName << "'" + << "\n for patch " << p.name() + << " of field " << dimensionedInternalField().name() + << " in file " << dimensionedInternalField().objectPath() + << exit(FatalError); + } + + fvPatchScalarField::operator=(scalarField("value", dict, p.size())); + + if (dict.found("mode")) + { + mode_ = MassModeTypeNames_.read(dict.lookup("mode")); + fluid_ = true; + } + + if (fluid_) + { + if (mode_ == mConstantMass) + { + thickness_ = scalarField("thickness", dict, p.size()); + cp_ = scalarField("cp", dict, p.size()); + rho_ = scalarField("rho", dict, p.size()); + } + else if (mode_ > mConstantMass) + { + Mcomp_ = readScalar(dict.lookup("carrierMolWeight")); + L_ = readScalar(dict.lookup("L")); + Tvap_ = readScalar(dict.lookup("Tvap")); + liquidDict_ = dict.subDict("liquid"); + liquid_.reset + ( + liquidProperties::New(liquidDict_.subDict(specieName_)).ptr() + ); + if (dict.found("thickness")) + { + scalarField& Tp = *this; + const scalarField magSf = patch().magSf(); + // Assume initially standard pressure for rho calculation + scalar pf = 1e5; + thickness_ = scalarField("thickness", dict, p.size()); + forAll (thickness_, i) + { + mass_[i] = thickness_[i]*liquid_->rho(pf, Tp[i])*magSf[i]; + } + } + fluid_ = true; + } + else + { + FatalErrorIn + ( + "humidityTemperatureCoupledMixedFvPatchScalarField::" + "humidityTemperatureCoupledMixedFvPatchScalarField\n" + "(\n" + " const fvPatch&,\n" + " const DimensionedField<scalar, volMesh>&,\n" + " const dictionary& \n" + ")\n" + ) + << "Did not find mode " << mode_ + << " on patch " << patch().name() + << nl + << "Please set 'mode' to one of " + << MassModeTypeNames_.toc() + << exit(FatalError); + } + } + + + + if (dict.found("refValue")) + { + // Full restart + refValue() = scalarField("refValue", dict, p.size()); + refGrad() = scalarField("refGradient", dict, p.size()); + valueFraction() = scalarField("valueFraction", dict, p.size()); + } + else + { + // Start from user entered data. Assume fixedValue. + refValue() = *this; + refGrad() = 0.0; + valueFraction() = 1.0; + } +} + + +humidityTemperatureCoupledMixedFvPatchScalarField:: +humidityTemperatureCoupledMixedFvPatchScalarField +( + const humidityTemperatureCoupledMixedFvPatchScalarField& psf, + const DimensionedField<scalar, volMesh>& iF +) +: + mixedFvPatchScalarField(psf, iF), + temperatureCoupledBase(patch(), psf), + mode_(psf.mode_), + TnbrName_(psf.TnbrName_), + QrNbrName_(psf.QrNbrName_), + QrName_(psf.QrName_), + specieName_(psf.specieName_), + liquid_(psf.liquid_), + liquidDict_(psf.liquidDict_), + mass_(psf.mass_), + Tvap_(psf.Tvap_), + myKDelta_(psf.myKDelta_), + dmHfg_(psf.dmHfg_), + mpCpTp_(psf.mpCpTp_), + Mcomp_(psf.Mcomp_), + L_(psf.L_), + fluid_(psf.fluid_), + cp_(psf.cp_), + thickness_(psf.thickness_), + rho_(psf.rho_) +{} + +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // + +scalar humidityTemperatureCoupledMixedFvPatchScalarField::Sh +( + const scalar Re, + const scalar Sc +) const +{ + if (Re < 5.0E+05) + { + return 0.664*sqrt(Re)*cbrt(Sc); + } + else + { + return 0.037*pow(Re, 0.8)*cbrt(Sc); + } +} + + +scalar humidityTemperatureCoupledMixedFvPatchScalarField::htcCondensation +( + const scalar Tsat, + const scalar Re +) const +{ + if (Tsat > 295 && Tsat < 373) + { + return 51104 + 2044*Tsat; + } + else + { + return 255510; + } +} + + +volScalarField& humidityTemperatureCoupledMixedFvPatchScalarField:: +thicknessField +( + const word& fieldName, + const fvMesh& mesh +) +{ + if (!mesh.foundObject<volScalarField>(fieldName)) + { + tmp<volScalarField> tField + ( + new volScalarField + ( + IOobject + ( + fieldName, + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimensionedScalar("zero", dimLength, 0.0) + ) + ); + + volScalarField& field = tField(); + + field.rename(fieldName); + field.writeOpt() = IOobject::AUTO_WRITE; + + tField.ptr()->store(); + } + + return + const_cast<volScalarField&> + ( + mesh.lookupObject<volScalarField>(fieldName) + ); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void humidityTemperatureCoupledMixedFvPatchScalarField::autoMap +( + const fvPatchFieldMapper& m +) +{ + mixedFvPatchScalarField::autoMap(m); + + if (fluid_) + { + mass_.autoMap(m); + myKDelta_.autoMap(m); + dmHfg_.autoMap(m); + mpCpTp_.autoMap(m); + cp_.autoMap(m); + thickness_.autoMap(m); + rho_.autoMap(m); + } +} + + +void humidityTemperatureCoupledMixedFvPatchScalarField::rmap +( + const fvPatchScalarField& ptf, + const labelList& addr +) +{ + mixedFvPatchScalarField::rmap(ptf, addr); + + const humidityTemperatureCoupledMixedFvPatchScalarField& tiptf = + refCast<const humidityTemperatureCoupledMixedFvPatchScalarField> + ( + ptf + ); + + if (fluid_) + { + mass_.rmap(tiptf.mass_, addr); + myKDelta_.rmap(tiptf.myKDelta_, addr); + dmHfg_.rmap(tiptf.dmHfg_, addr); + mpCpTp_.rmap(tiptf.mpCpTp_, addr); + cp_.rmap(tiptf.cp_, addr); + thickness_.rmap(tiptf.thickness_, addr); + rho_.rmap(tiptf.rho_, addr); + } +} + + +void humidityTemperatureCoupledMixedFvPatchScalarField::updateCoeffs() +{ + if (updated()) + { + return; + } + + // Get the coupling information from the mappedPatchBase + const mappedPatchBase& mpp = + refCast<const mappedPatchBase>(patch().patch()); + + const scalarField magSf = patch().magSf(); + + const label nbrPatchI = mpp.samplePolyPatch().index(); + const polyMesh& mesh = patch().boundaryMesh().mesh(); + const polyMesh& nbrMesh = mpp.sampleMesh(); + const fvPatch& nbrPatch = + refCast<const fvMesh>(nbrMesh).boundary()[nbrPatchI]; + + const humidityTemperatureCoupledMixedFvPatchScalarField& + nbrField = + refCast + < + const humidityTemperatureCoupledMixedFvPatchScalarField + > + ( + nbrPatch.lookupPatchField<volScalarField, scalar>(TnbrName_) + ); + + // Swap to obtain full local values of neighbour internal field + scalarField nbrIntFld(nbrField.patchInternalField()); + mpp.distribute(nbrIntFld); + + scalarField& Tp = *this; + scalarField Tin(patchInternalField()); + + const scalarField K(this->kappa(*this)); + + // nrb kappa is done separatedly because I need kappa solid for + // htc correlation + scalarField nbrK(nbrField.kappa(*this)); + mpp.distribute(nbrK); + + scalarField nrbDeltaCoeffs(nbrPatch.deltaCoeffs()); + mpp.distribute(nrbDeltaCoeffs); + + scalarField KDeltaNbr(nbrK*nrbDeltaCoeffs); + + myKDelta_ = K*patch().deltaCoeffs(); + + scalarField dm(patch().size(), 0.0); + + //Fluid Side + if (fluid_) + { + scalarField Yvp(patch().size(), 0.0); + const scalar dt = mesh.time().deltaTValue(); + + const scalarField myDelta(patch().deltaCoeffs()); + + if (mode_ != mConstantMass) + { + scalarField cp(patch().size(), 0.0); + scalarField hfg(patch().size(), 0.0); + scalarField htc(patch().size(), GREAT); + scalarField liquidRho(patch().size(), 0.0); + + fixedGradientFvPatchField<scalar>& Yp = + const_cast<fixedGradientFvPatchField<scalar>& > + ( + refCast + < + const fixedGradientFvPatchField<scalar> + > + ( + patch().lookupPatchField<volScalarField, scalar> + ( + specieName_ + ) + ) + ); + + const fvPatchScalarField& pp = + patch().lookupPatchField<volScalarField, scalar>("p"); + + const fvPatchVectorField& Up = + patch().lookupPatchField<volVectorField, vector>("U"); + + const fvPatchScalarField& rhop = + patch().lookupPatchField<volScalarField, scalar>("rho"); + + const fvPatchScalarField& mup = + patch().lookupPatchField<volScalarField, scalar>("thermo:mu"); + + const vectorField Ui(Up.patchInternalField()); + const scalarField Yi(Yp.patchInternalField()); + + forAll (Tp, faceI) + { + const scalar Tf = Tp[faceI]; + const scalar Tint = Tin[faceI]; + const vector Uf = Ui[faceI]; + const scalar pf = pp[faceI]; + + const scalar muf = mup[faceI]; + const scalar rhof = rhop[faceI]; + const scalar nuf = muf/rhof; + const scalar pSat = liquid_->pv(pf, Tint); + const scalar Mv = liquid_->W(); + const scalar TSat = liquid_->pvInvert(pSat); + const scalar Re = mag(Uf)*L_/nuf; + + cp[faceI] = liquid_->Cp(pf, Tf); + hfg[faceI] = liquid_->hl(pf, Tf); + + // Calculate relative humidity + const scalar invMwmean = + Yi[faceI]/Mv + (1.0 - Yi[faceI])/Mcomp_; + const scalar Xv = Yi[faceI]/invMwmean/Mv; + const scalar RH = min(Xv*pf/pSat, 1.0); + + scalar RHmin = 0.01; + scalar Tdew = -GREAT; + + if (RH > RHmin) + { + scalar b = 243.5; + scalar c = 17.65; + scalar TintDeg = Tint - 273; + Tdew = + b* + ( + log(RH) + + (c*TintDeg)/(b + TintDeg) + ) + / + ( + c - log(RH) - ((c*TintDeg)/(b + TintDeg)) + ) + 273; + } + + if + ( + Tf < Tdew && RH > RHmin + && + ( + mode_ == mCondensation + || mode_ == mCondensationAndEvaporation + ) + ) + { + htc[faceI] = + this->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) + const scalar q = (Tint - Tf)*htcTotal*magSf[faceI]; + + // mass flux rate [Kg/s/m2] + dm[faceI] = q/hfg[faceI]/magSf[faceI]; + + mass_[faceI] += q/hfg[faceI]*dt; + + // -dYp/dn = q/Dab (fixedGradient) + const scalar Dab = liquid_->D(pf, Tf); + Yvp[faceI] = + -min(dm[faceI]/Dab/rhof, Yi[faceI]*myDelta[faceI]); + + } + else if + ( + Tf > Tvap_ && mass_[faceI] > 0.0 + && + ( + mode_ == mEvaporation + || mode_ == mCondensationAndEvaporation + ) + ) + { + const scalar Dab = liquid_->D(pf, Tf); + + const scalar Sc = nuf/Dab; + 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_; + + const scalar Yinf = max(Yi[faceI], 0.0); + + // mass flux rate [Kg/s/m2] + dm[faceI] = -rhof*hm*max((Ys - Yinf), 0.0)/(1.0 - Ys); + + // Set fixedGradient for carrier species. + Yvp[faceI] = -dm[faceI]/Dab/rhof; + + // Total mass accumulated [Kg] + mass_[faceI] += dm[faceI]*magSf[faceI]*dt; + + htc[faceI] = + this->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_; + } + else if (mass_[faceI] == 0.0) + { + //Do nothing + } + + liquidRho[faceI] = liquid_->rho(pf, Tf); + } + + mass_ = max(mass_, scalar(0)); + + Yp.gradient() = Yvp; + + // Output filmDelta [m] + const word fieldName(specieName_ + "Thickness"); + + scalarField& pDelta = + thicknessField + ( + fieldName, + refCast<const fvMesh>(mesh) + ).boundaryField()[patch().index()]; + + + pDelta = mass_/liquidRho/magSf; + + // Weight myKDelta and htc + myKDelta_ = 1.0/((1.0/myKDelta_) + (1.0/htc)); + + mpCpTp_ = mass_*cp/dt/magSf; + + // Heat flux due to change of phase [W/m2] + dmHfg_ = dm*hfg; + } + else + { + // inertia term [W/K/m2] + mpCpTp_ = thickness_*rho_*cp_/dt; + } + } + + scalarField myKDeltaNbr(patch().size(), 0.0); + scalarField mpCpTpNbr(patch().size(), 0.0); + scalarField dmHfgNbr(patch().size(), 0.0); + + if (!fluid_) + { + myKDeltaNbr = nbrField.myKDelta(); + mpp.distribute(myKDeltaNbr); + + mpCpTpNbr = nbrField.mpCpTp(); + mpp.distribute(mpCpTpNbr); + + dmHfgNbr = nbrField.dmHfg(); + mpp.distribute(dmHfgNbr); + } + + // Obtain Rad heat (Qr) + scalarField Qr(Tp.size(), 0.0); + if (QrName_ != "none") + { + Qr = patch().lookupPatchField<volScalarField, scalar>(QrName_); + } + + scalarField QrNbr(Tp.size(), 0.0); + if (QrNbrName_ != "none") + { + QrNbr = nbrPatch.lookupPatchField<volScalarField, scalar>(QrNbrName_); + mpp.distribute(QrNbr); + } + + const scalarField dmHfg(dmHfgNbr + dmHfg_); + + const scalarField mpCpdt(mpCpTpNbr + mpCpTp_); + + // Qr > 0 (heat up the wall) + scalarField alpha(KDeltaNbr + mpCpdt - (Qr + QrNbr + dmHfg)/Tp); + + valueFraction() = alpha/(alpha + myKDelta_); + + refValue() = (KDeltaNbr*nbrIntFld + mpCpdt*Tp)/alpha; + + mixedFvPatchScalarField::updateCoeffs(); + + + if (debug) + { + if (fluid_) + { + scalar Qdm = gSum(dm); + scalar QMass = gSum(mass_); + scalar Qt = gSum(myKDelta_*(Tp - Tin)*magSf); + scalar QtSolid = gSum(KDeltaNbr*(Tp - nbrIntFld)*magSf); + + Info<< mesh.name() << ':' + << patch().name() << ':' + << this->dimensionedInternalField().name() << " <- " + << nbrMesh.name() << ':' + << nbrPatch.name() << ':' + << this->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] : " + << Qt << nl + << " Total heat (>0 leaving the wall to the solid) [W] : " + << QtSolid << nl + << " wall temperature " + << " min:" << gMin(*this) + << " max:" << gMax(*this) + << " avg:" << gAverage(*this) + << endl; + } + } +} + + +void humidityTemperatureCoupledMixedFvPatchScalarField::write +( + Ostream& os +) const +{ + mixedFvPatchScalarField::write(os); + os.writeKeyword("QrNbr")<< QrNbrName_ << token::END_STATEMENT << nl; + os.writeKeyword("Qr")<< QrName_ << token::END_STATEMENT << nl; + + if (fluid_) + { + os.writeKeyword("mode")<< MassModeTypeNames_[mode_] + << token::END_STATEMENT <<nl; + os.writeKeyword("specieName")<< specieName_ + << token::END_STATEMENT <<nl; + os.writeKeyword("carrierMolWeight")<< Mcomp_ + << token::END_STATEMENT <<nl; + + os.writeKeyword("L")<< L_ << token::END_STATEMENT << nl; + os.writeKeyword("Tvap")<< Tvap_ << token::END_STATEMENT << nl; + os.writeKeyword("fluid")<< fluid_ << token::END_STATEMENT << nl; + mass_.writeEntry("mass", os); + + if (mode_ == mConstantMass) + { + cp_.writeEntry("cp", os); +// thickness_.writeEntry("thickness", os); + rho_.writeEntry("rho", os); + } + + thickness_.writeEntry("thickness", os); + word liq = "liquid"; + os << token::TAB << token::TAB << liq; + liquidDict_.write(os); + } + + temperatureCoupledBase::write(os); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makePatchTypeField +( + fvPatchScalarField, + humidityTemperatureCoupledMixedFvPatchScalarField +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + + +// ************************************************************************* // diff --git a/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H new file mode 100644 index 00000000000..e710c57e356 --- /dev/null +++ b/src/TurbulenceModels/compressible/turbulentFluidThermoModels/derivedFvPatchFields/humidityTemperatureCoupledMixed/humidityTemperatureCoupledMixedFvPatchScalarField.H @@ -0,0 +1,377 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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/>. + +Class + + Foam:: + compressible:: + 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 + inertia effects. + + It assumes a drop-wise type of condensation and its heat transfer Nu number + is: + + 51104 + 2044*T T > 295 T < 373 + 255510 T > 373 + + T. Bergam, A.Lavine, F. Incropera and D. Dewitt. Heat and Mass Transfer. + 7th Edition. Chapter 10. + + The mass transfer correlation used is hm = Dab*Sh/L + + where: + + Dab is the mass vapor difussivity + L is the characteristic lenght + Sc the Schmidt number and it is calculated as: + + 0.664*sqrt(Re)*cbrt(Sc) Re < 5.0E+05 + 0.037*pow(Re, 0.8)*cbrt(Sc) Re > 5.0E+05 + + 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 + + + Example usage: + + On the fluid side + + myInterfacePatchName + { + type thermalHumidityCoupledMixed; + kappa fluidThermo; + kappaName none; + + // Modes of operation: inert, condensation, vaporization, condEvap + mode condEvap; + + // Carrier species name + specieName H2O; + + // Carrier molecular weight + carrierMolWeight 28.9; + + // Characteristic lenght of the wall + L 0.1; + + // Vaporasation temperature + Tvap 273; + + // Liquid properties for the condensed mass + liquid + { + H2O + { + defaultCoeffs yes; + } + } + + // thickness, density and cp required for inert and condensation + // modes + + //thickness uniform 0; + //cp uniform 0; + //rho uniform 0; + + value $internalField; + } + + + On the solid side: + + myInterfacePatchName + { + type thermalInertiaMassTransferCoupledMixed; + kappa solidThermo; + kappaName none; + value uniform 260; + } + + +SourceFiles + humidityTemperatureCoupledMixedFvPatchScalarField.C + +\*---------------------------------------------------------------------------*/ + +#ifndef humidityTemperatureCoupledMixedFvPatchScalarField_H +#define humidityTemperatureCoupledMixedFvPatchScalarField_H + +#include "mixedFvPatchFields.H" +#include "temperatureCoupledBase.H" +#include "liquidProperties.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class humidityTemperatureCoupledMixedFvPatchScalarField Declaration +\*---------------------------------------------------------------------------*/ + +class humidityTemperatureCoupledMixedFvPatchScalarField +: + public mixedFvPatchScalarField, + public temperatureCoupledBase +{ +public: + + // Public enumeration + + //- Modes of mass transfer + enum massTransferMode + { + mConstantMass, + mCondensation, + mEvaporation, + mCondensationAndEvaporation + }; + + +private: + + // Private data + + static const NamedEnum<massTransferMode, 4> MassModeTypeNames_; + + //- BC 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_; + + //- Name of the radiative heat flux + const word QrName_; + + //- Name of the species on which the mass transfered (default H2O) + const word specieName_; + + //- Liquid properties + autoPtr<liquidProperties> liquid_; + + //- Liquid dictionary + dictionary liquidDict_; + + //- Mass accumulated on faces + scalarField mass_; + + //- Vaporization temperature + scalar Tvap_; + + //- Cache myDelta + scalarField myKDelta_; + + //- Phase change energy + scalarField dmHfg_; + + //- Thermal inertia + scalarField mpCpTp_; + + //- Average molecular weight for the carrier mixture in the gas phase + scalar Mcomp_; + + //- Characteristic length scale + scalar L_; + + //- Fluid side + bool fluid_; + + //- Cp field for inert mode + scalarField cp_; + + //- Thickness field for inert mode + scalarField thickness_; + + //- Density field for inert mode + scalarField rho_; + + + // Private members + + //- Calculation of Sh + scalar Sh(const scalar Re,const scalar Sc) const; + + //- Calculation of htc from the condensed surface + scalar htcCondensation(const scalar TSat,const scalar Re) const; + + //- Create thickness field for output + volScalarField& thicknessField(const word& , const fvMesh&); + + +public: + + //- Runtime type information + TypeName("humidityTemperatureCoupledMixed"); + + + // Constructors + + //- Construct from patch and internal field + humidityTemperatureCoupledMixedFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct from patch, internal field and dictionary + humidityTemperatureCoupledMixedFvPatchScalarField + ( + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const dictionary& + ); + + //- Construct by mapping given + // turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a + // new patch + humidityTemperatureCoupledMixedFvPatchScalarField + ( + const + humidityTemperatureCoupledMixedFvPatchScalarField&, + const fvPatch&, + const DimensionedField<scalar, volMesh>&, + const fvPatchFieldMapper& + ); + + //- Construct and return a clone + virtual tmp<fvPatchScalarField> clone() const + { + return tmp<fvPatchScalarField> + ( + new humidityTemperatureCoupledMixedFvPatchScalarField + ( + *this + ) + ); + } + + //- Construct as copy setting internal field reference + humidityTemperatureCoupledMixedFvPatchScalarField + ( + const humidityTemperatureCoupledMixedFvPatchScalarField&, + const DimensionedField<scalar, volMesh>& + ); + + //- Construct and return a clone setting internal field reference + virtual tmp<fvPatchScalarField> clone + ( + const DimensionedField<scalar, volMesh>& iF + ) const + { + return tmp<fvPatchScalarField> + ( + new humidityTemperatureCoupledMixedFvPatchScalarField + ( + *this, + iF + ) + ); + } + + + // Member functions + + // Mapping functions + + //- Map (and resize as needed) from self given a mapping object + virtual void autoMap + ( + const fvPatchFieldMapper& + ); + + //- Reverse map the given fvPatchField onto this fvPatchField + virtual void rmap + ( + const fvPatchScalarField&, + const labelList& + ); + + + //- Return myKDelta + const scalarField myKDelta() const + { + return myKDelta_; + } + + //- Return mpCpdTpd + const scalarField mpCpTp() const + { + return mpCpTp_; + } + + //- Return dmHfg + const scalarField dmHfg() const + { + return dmHfg_; + } + + + //- Update the coefficients associated with the patch field + virtual void updateCoeffs(); + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvOptions/Make/files b/src/fvOptions/Make/files index ff2f45032b1..fdb288839f5 100644 --- a/src/fvOptions/Make/files +++ b/src/fvOptions/Make/files @@ -38,6 +38,9 @@ $(derivedSources)/solidificationMeltingSource/solidificationMeltingSource.C $(derivedSources)/solidificationMeltingSource/solidificationMeltingSourceIO.C $(derivedSources)/tabulatedAccelerationSource/tabulatedAccelerationSource.C $(derivedSources)/tabulatedAccelerationSource/tabulated6DoFAcceleration/tabulated6DoFAcceleration.C +$(derivedSources)/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C +$(derivedSources)/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C + interRegion = sources/interRegion diff --git a/src/fvOptions/Make/options b/src/fvOptions/Make/options index 124084c0575..50b311988dc 100644 --- a/src/fvOptions/Make/options +++ b/src/fvOptions/Make/options @@ -3,15 +3,19 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/sampling/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \ + -I$(LIB_SRC)/transportModels \ -I$(LIB_SRC)/transportModels/compressible/lnInclude \ + -I$(LIB_SRC)/transportModels/incompressible/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \ - -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude + -I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \ + -I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude LIB_LIBS = \ -lfiniteVolume \ -lsampling \ -lmeshTools \ -lturbulenceModels \ + -lincompressibleTurbulenceModels \ -lcompressibleTurbulenceModels diff --git a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C new file mode 100644 index 00000000000..a63a606b2c4 --- /dev/null +++ b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.C @@ -0,0 +1,579 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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/>. + +\*---------------------------------------------------------------------------*/ + +#include "directionalPressureGradientExplicitSource.H" +#include "fvMatrices.H" +#include "DimensionedField.H" +#include "IFstream.H" +#include "addToRunTimeSelectionTable.H" +#include "transform.H" +#include "surfaceInterpolate.H" +#include "turbulenceModel.H" +#include "turbulentTransportModel.H" +#include "turbulentFluidThermoModel.H" +#include "vectorFieldIOField.H" +#include "FieldField.H" +#include "emptyFvPatchFields.H" + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + defineTypeNameAndDebug(directionalPressureGradientExplicitSource, 0); + + addToRunTimeSelectionTable + ( + option, + directionalPressureGradientExplicitSource, + dictionary + ); +} +} + + +// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * // + +namespace Foam +{ + template<> + const char* Foam::NamedEnum + < + Foam::fv:: + directionalPressureGradientExplicitSource:: + pressureDropModel, + 3 + >::names[] = + { + "volumetricFlowRateTable", + "constant", + "DarcyForchheimer" + }; +} + +const Foam::NamedEnum +< + Foam::fv::directionalPressureGradientExplicitSource::pressureDropModel, + 3 +> Foam::fv::directionalPressureGradientExplicitSource::PressureDropModelNames_; + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::fv::directionalPressureGradientExplicitSource::initialise() +{ + const faceZone& fZone = mesh_.faceZones()[zoneID_]; + + faceId_.setSize(fZone.size()); + facePatchId_.setSize(fZone.size()); + + label count = 0; + forAll(fZone, i) + { + label faceI = fZone[i]; + + label faceId = -1; + label facePatchId = -1; + if (mesh_.isInternalFace(faceI)) + { + faceId = faceI; + facePatchId = -1; + } + else + { + facePatchId = mesh_.boundaryMesh().whichPatch(faceI); + const polyPatch& pp = mesh_.boundaryMesh()[facePatchId]; + if (isA<coupledPolyPatch>(pp)) + { + if (refCast<const coupledPolyPatch>(pp).owner()) + { + faceId = pp.whichFace(faceI); + } + else + { + faceId = -1; + } + } + else if (!isA<emptyPolyPatch>(pp)) + { + faceId = faceI - pp.start(); + } + else + { + faceId = -1; + facePatchId = -1; + } + } + + if (faceId >= 0) + { + facePatchId_[count] = facePatchId; + faceId_[count] = faceId; + count++; + } + } + faceId_.setSize(count); + facePatchId_.setSize(count); +} + + +void Foam::fv::directionalPressureGradientExplicitSource::writeProps +( + const vectorField& gradP +) const +{ + // Only write on output time + if (mesh_.time().outputTime()) + { + IOdictionary propsDict + ( + IOobject + ( + name_ + "Properties", + mesh_.time().timeName(), + "uniform", + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ) + ); + propsDict.add("gradient", gradP); + propsDict.regIOobject::write(); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::fv::directionalPressureGradientExplicitSource:: +directionalPressureGradientExplicitSource +( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh +) +: + cellSetOption(sourceName, modelType, dict, mesh), + model_(PressureDropModelNames_.read(coeffs_.lookup("model"))), + gradP0_(cells_.size(), vector::zero), + dGradP_(cells_.size(), vector::zero), + gradPporous_(cells_.size(), vector::zero), + flowDir_(coeffs_.lookup("flowDir")), + invAPtr_(NULL), + D_(0), + I_(0), + length_(0), + pressureDrop_(0), + flowRate_(), + faceZoneName_(coeffs_.lookup("faceZone")), + zoneID_(mesh_.faceZones().findZoneID(faceZoneName_)), + faceId_(), + facePatchId_(), + relaxationFactor_(coeffs_.lookupOrDefault<scalar>("relaxationFactor",0.3)), + cellFaceMap_(cells_.size(), -1) +{ + coeffs_.lookup("fieldNames") >> fieldNames_; + + flowDir_ /= mag(flowDir_); + + if (fieldNames_.size() != 1) + { + FatalErrorIn + ( + "Foam::fv::directionalPressureGradientExplicitSource::" + "directionalPressureGradientExplicitSource" + "(" + "const word&, " + "const word&, " + "const dictionary&, " + "const fvMesh&" + ")" + ) << "Source can only be applied to a single field. Current " + << "settings are:" << fieldNames_ << exit(FatalError); + } + + if (zoneID_ < 0) + { + FatalErrorIn + ( + "directionalPressureGradientExplicitSource::" + "directionalPressureGradientExplicitSource\n" + "(\n" + "const word&,\n " + "const word&,\n " + "const dictionary&, \n" + "const fvMesh& \n" + ")\n" + ) + << type() << " " << this->name() << ": " + << " Unknown face zone name: " << faceZoneName_ + << ". Valid face zones are: " << mesh_.faceZones().names() + << nl << exit(FatalError); + } + + if (model_ == pVolumetricFlowRateTable) + { + flowRate_ = interpolationTable<scalar>(coeffs_); + } + else if (model_ == pConstant) + { + coeffs_.lookup("pressureDrop") >> pressureDrop_; + } + else if (model_ == pDarcyForchheimer) + { + coeffs_.lookup("D") >> D_; + coeffs_.lookup("I") >> I_; + coeffs_.lookup("length") >> length_; + } + else + { + FatalErrorIn + ( + "directionalPressureGradientExplicitSource::" + "directionalPressureGradientExplicitSource\n" + "(\n" + "const word&, \n" + "const word&, \n" + "const dictionary&, \n" + "const fvMesh& \n" + ") \n" + ) + << "Did not find mode " << model_ + << nl + << "Please set 'model' to one of " + << PressureDropModelNames_.toc() + << exit(FatalError); + } + + applied_.setSize(fieldNames_.size(), false); + + // Read the initial pressure gradient from file if it exists + IFstream propsFile + ( + mesh_.time().timePath()/"uniform"/(name_ + "Properties") + ); + + if (propsFile.good()) + { + Info<< " Reading pressure gradient from file" << endl; + dictionary propsDict(dictionary::null, propsFile); + propsDict.lookup("gradient") >> gradP0_; + } + + Info<< " Initial pressure gradient = " << gradP0_ << nl << endl; + + initialise(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::fv::directionalPressureGradientExplicitSource::correct +( + volVectorField& U +) +{ + const scalarField& rAU = invAPtr_().internalField(); + + const scalarField magUn(mag(U), cells_); + + const surfaceScalarField& phi = + mesh().lookupObject<surfaceScalarField>("phi"); + + switch (model_) + { + case pDarcyForchheimer: + { + if (phi.dimensions() == dimVelocity*dimArea) + { + const incompressible::turbulenceModel& turbModel = + mesh().lookupObject<incompressible::turbulenceModel> + ( + turbulenceModel::propertiesName + ); + + const scalarField nu(turbModel.nu(), cells_); + + gradPporous_ = -flowDir_*(D_*nu + I_*0.5*magUn)*magUn*length_; + break; + } + else + { + const compressible::turbulenceModel& turbModel = + mesh().lookupObject<compressible::turbulenceModel> + ( + turbulenceModel::propertiesName + ); + + const scalarField mu(turbModel.mu(),cells_); + + const scalarField rho(turbModel.rho(),cells_); + + gradPporous_ = + - flowDir_*(D_*mu + I_*0.5*rho*magUn)*magUn*length_; + } + } + case pConstant: + { + gradPporous_ = -flowDir_*pressureDrop_; + break; + } + + case pVolumetricFlowRateTable: + { + scalar volFlowRate = 0; + scalar totalphi = 0; + + forAll(faceId_, i) + { + label faceI = faceId_[i]; + if (facePatchId_[i] != -1) + { + label patchI = facePatchId_[i]; + totalphi += phi.boundaryField()[patchI][faceI]; + } + else + { + totalphi += phi[faceI]; + } + } + reduce(totalphi, sumOp<scalar>()); + + if (phi.dimensions() == dimVelocity*dimArea) + { + volFlowRate = mag(totalphi); + } + else + { + const compressible::turbulenceModel& turbModel = + mesh().lookupObject<compressible::turbulenceModel> + ( + turbulenceModel::propertiesName + ); + const scalarField rho(turbModel.rho(),cells_); + const scalarField cv(mesh_.V(), cells_); + scalar rhoAve = gSumProd(rho, cv)/gSum(cv); + volFlowRate = mag(totalphi)/rhoAve; + } + + gradPporous_ = -flowDir_*flowRate_(volFlowRate); + break; + } + } + + const faceZone& fZone = mesh_.faceZones()[zoneID_]; + + labelList meshToLocal(mesh_.nCells(), -1); + forAll(cells_, i) + { + meshToLocal[cells_[i]] = i; + } + + labelList faceToCellIndex(fZone.size(), -1); + const labelList& mc = fZone.masterCells(); + const labelList& sc = fZone.slaveCells(); + + forAll(fZone, i) + { + label masterCellI = mc[i]; + + if (meshToLocal[masterCellI] != -1 && masterCellI != -1) + { + faceToCellIndex[i] = meshToLocal[masterCellI]; + } + else if (meshToLocal[masterCellI] == -1) + { + FatalErrorIn + ( + "directionalPressureGradientExplicitSource::" + "directionalPressureGradientExplicitSource\n" + "correct" + "(" + " volVectorField& U \n" + ")" + ) << "Did not find cell " << masterCellI + << "in cellZone :" << cellSetName() + << exit(FatalError); + } + } + + // Accumulate 'upstream' velocity into cells + vectorField UfCells(cells_.size(), vector::zero); + scalarField UfCellWeights(cells_.size(), 0.0); + + const polyBoundaryMesh& pbm = mesh_.boundaryMesh(); + + FieldField<Field, vector> upwindValues(pbm.size()); + + forAll(U.boundaryField(), patchI) + { + const fvPatchVectorField& pf = U.boundaryField()[patchI]; + + if (pf.coupled()) + { + upwindValues.set(patchI, pf.patchNeighbourField()); + } + else if (!isA<emptyFvPatchScalarField>(pf)) + { + upwindValues.set(patchI, new vectorField(pf)); + } + } + + forAll(fZone, i) + { + label faceI = fZone[i]; + label cellId = faceToCellIndex[i]; + + if (cellId != -1) + { + label sourceCellId = sc[i]; + if (mesh_.isInternalFace(faceI)) + { + scalar w = mesh_.magSf()[faceI]; + UfCells[cellId] += U[sourceCellId]*w; + UfCellWeights[cellId] += w; + } + else if (fZone.flipMap()[i]) + { + label patchI = pbm.patchID()[faceI-mesh_.nInternalFaces()]; + label localFaceI = pbm[patchI].whichFace(faceI); + + scalar w = mesh_.magSf().boundaryField()[patchI][localFaceI]; + + if (upwindValues.set(patchI)) + { + UfCells[cellId] += upwindValues[patchI][localFaceI]*w; + UfCellWeights[cellId] += w; + } + } + } + } + + UfCells /= UfCellWeights; + + forAll(cells_, i) + { + label cellI = cells_[i]; + + const vector Ufnorm = UfCells[i]/mag(UfCells[i]); + + const tensor D = rotationTensor(Ufnorm, flowDir_); + + dGradP_[i] += + relaxationFactor_* + ( + (D & UfCells[i]) - U[cellI] + )/rAU[cellI]; + + + if (debug) + { + Info<< "Difference mag(U) = " + << mag(UfCells[i]) - mag(U[cellI]) + << endl; + Info<< "Pressure drop in flowDir direction : " + << gradPporous_[i] << endl; + Info<< "UfCell:= " << UfCells[i] << "U : " << U[cellI] << endl; + } + } + + writeProps(gradP0_ + dGradP_); +} + + +void Foam::fv::directionalPressureGradientExplicitSource::addSup +( + fvMatrix<vector>& eqn, + const label fieldI +) +{ + DimensionedField<vector, volMesh> Su + ( + IOobject + ( + name_ + fieldNames_[fieldI] + "Sup", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimensionedVector("zero", eqn.dimensions()/dimVolume, vector::zero) + ); + + UIndirectList<vector>(Su, cells_) = gradP0_ + dGradP_ + gradPporous_; + + eqn += Su; +} + + +void Foam::fv::directionalPressureGradientExplicitSource::addSup +( + const volScalarField& rho, + fvMatrix<vector>& eqn, + const label fieldI +) +{ + this->addSup(eqn, fieldI); +} + + +void Foam::fv::directionalPressureGradientExplicitSource::constrain +( + fvMatrix<vector>& eqn, + const label +) +{ + if (invAPtr_.empty()) + { + invAPtr_.reset + ( + new volScalarField + ( + IOobject + ( + name_ + ":invA", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + 1.0/eqn.A() + ) + ); + } + else + { + invAPtr_() = 1.0/eqn.A(); + } + + gradP0_ += dGradP_; + dGradP_ = vector::zero; +} + + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H new file mode 100644 index 00000000000..e1e79156295 --- /dev/null +++ b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSource.H @@ -0,0 +1,268 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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/>. + +Class + Foam::fv::directionalPressureGradientExplicitSource + +Description + Creates an explicit pressure gradient source in such a way to deflect the + flow towards an specific direction (flowDir). Alternatively add an extra + pressure drop in the flowDir direction using a model. + + \heading Source usage + Example usage: + \verbatim + airDeflection + { + type directionalPressureGradientExplicitSource; + active true; + + directionalPressureGradientExplicitSourceCoeffs + { + selectionMode cellZone; + cellZone cZone; + + fieldNames (U); // Name of the field + flowDir (1 1 0); // Desired flow direction + faceZone f0Zone; // Face zone upstream cell zone + relaxationFactor 0.3; // Relaxation factor for flow + // deflection (default 0.3) + + //Pressure drop model [Pa] + model volumetricFlowRateTable;//constant;//DarcyForchheimer; + + //DarcyForchheimer model + // deltaP = (D*mu + 0.5*rho*magUn)*magUn*length_ + + D 5e7; + I 0; + length 1e-3; + + //constant model + pressureDrop 40; + + //volumetricFlowRateTable model + outOfBounds clamp; + fileName "volFlowRateTable"; + } + } + \endverbatim + + NOTE: In order to obtain the upwind velocities this function loops over + the slaves cells of the faceZone specified in the dictionary, on the other + hand, the cellZone to which this source term is applied should be composed + of the master cells and they should be 'downwind' the faceZone. + +SourceFiles + directionalPressureGradientExplicitSource.C + +\*---------------------------------------------------------------------------*/ + +#ifndef directionalPressureGradientExplicitSource_H +#define directionalPressureGradientExplicitSource_H + +#include "cellSetOption.H" +#include "autoPtr.H" +#include "topoSetSource.H" +#include "cellSet.H" +#include "fvMesh.H" +#include "volFields.H" +#include "fvOption.H" +#include "interpolationTable.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace fv +{ + +/*---------------------------------------------------------------------------*\ + Class directionalPressureGradientExplicitSource Declaration +\*---------------------------------------------------------------------------*/ + +class directionalPressureGradientExplicitSource +: + public cellSetOption +{ +public: + + // Public enumeration + + //- Modes of pressure drop + enum pressureDropModel + { + pVolumetricFlowRateTable, + pConstant, + pDarcyForchheimer + }; + + +private: + + // Private data + + static const NamedEnum<pressureDropModel, 3> PressureDropModelNames_; + + //- Pressure drop model + pressureDropModel model_; + + //- Pressure gradient before correction + vectorField gradP0_; + + //- Change in pressure gradient + vectorField dGradP_; + + //- Pressure drop due to porous media + vectorField gradPporous_; + + //- Flow direction + vector flowDir_; + + //- Matrix 1/A coefficients field pointer + autoPtr<volScalarField> invAPtr_; + + //- Darcy pressure loss coefficient + scalar D_; + + //- Inertia pressure lost coefficient + scalar I_; + + //- Porous media length + scalar length_; + + //- Constant pressure drop + scalar pressureDrop_; + + //- Volumetric flow rate vs pressure drop table + interpolationTable<scalar> flowRate_; + + //- Name of the faceZone at the heat exchange inlet + word faceZoneName_; + + //- Id for the face zone + label zoneID_; + + //- Local list of face IDs + labelList faceId_; + + //- Local list of patch ID per face + labelList facePatchId_; + + //- Relaxation factor + scalar relaxationFactor_; + + //- Cells faces mapping + labelList cellFaceMap_; + + + // Private Member Functions + + //- Init + void initialise(); + + //- Write the pressure gradient to file (for restarts etc) + void writeProps(const vectorField& gradP) const; + + //- Correct driving force for a constant mass flow rate + void update(fvMatrix<vector>& eqn); + + //- Disallow default bitwise copy construct + directionalPressureGradientExplicitSource + ( + const directionalPressureGradientExplicitSource& + ); + + //- Disallow default bitwise assignment + void operator=(const directionalPressureGradientExplicitSource&); + + +public: + + //- Runtime type information + TypeName("directionalPressureGradientExplicitSource"); + + + // Constructors + + //- Construct from explicit source name and mesh + directionalPressureGradientExplicitSource + ( + const word& sourceName, + const word& modelType, + const dictionary& dict, + const fvMesh& mesh + ); + + + // Member Functions + + // Evaluate + + //- Correct the pressure gradient + virtual void correct(volVectorField& U); + + //- Add explicit contribution to momentum equation + virtual void addSup + ( + fvMatrix<vector>& eqn, + const label fieldI + ); + + //- Add explicit contribution to compressible momentum equation + virtual void addSup + ( + const volScalarField& rho, + fvMatrix<vector>& eqn, + const label fieldI + ); + + //- Set 1/A coefficient + virtual void constrain + ( + fvMatrix<vector>& eqn, + const label fieldI + ); + + + // I-O + + //- Write the source properties + virtual void writeData(Ostream&) const; + + //- Read source dictionary + virtual bool read(const dictionary& dict); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace fv +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C new file mode 100644 index 00000000000..08babda902c --- /dev/null +++ b/src/fvOptions/sources/derived/directionalPressureGradientExplicitSource/directionalPressureGradientExplicitSourceIO.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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/>. + +\*---------------------------------------------------------------------------*/ + +#include "directionalPressureGradientExplicitSource.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +void Foam::fv::directionalPressureGradientExplicitSource::writeData +( + Ostream& os +) const +{ + notImplemented + ( + "void Foam::fv::directionalPressureGradientExplicitSource::writeData" + "(" + "Ostream&" + ") const" + ); +} + + +bool Foam::fv::directionalPressureGradientExplicitSource::read +( + const dictionary& dict +) +{ + const dictionary coeffs(dict.subDict(typeName + "Coeffs")); + + relaxationFactor_ = + coeffs.lookupOrDefault<scalar>("relaxationFactor", 0.3); + + coeffs.lookup("flowDir") >> flowDir_; + flowDir_ /= mag(flowDir_); + + if (model_ == pConstant) + { + coeffs.lookup("pressureDrop") >> pressureDrop_; + } + else if (model_ == pDarcyForchheimer) + { + coeffs.lookup("D") >> D_; + coeffs.lookup("I") >> I_; + coeffs.lookup("length") >> length_; + } + + return false; +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/H2O b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/H2O new file mode 100644 index 00000000000..819feee65f6 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/H2O @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object H2O; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 0 0 0 0]; + +internalField uniform 0.01; + +boundaryField +{ + ".*" + { + type zeroGradient; + value uniform 0.01; + } + cabin_to_windshield + { + type fixedGradient; + gradient uniform 0.0; + } + inlet + { + type uniformFixedValue; + uniformValue table + ( + (0 0.01) + (60 0.01) + (61 0.00) + (100 0.00) + ); + } + outlet + { + type inletOutlet; + value uniform 0.01; + inletValue uniform 0.01; + } + symmetry + { + type symmetryPlane; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/T b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/T new file mode 100644 index 00000000000..6838cd71cf8 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/T @@ -0,0 +1,76 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0/cabin"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 300; + +boundaryField +{ + inlet + { + type uniformFixedValue; + uniformValue table + ( + (0 273) + (60 273) + (61 308) + (100 308) + ); + } + outlet + { + type inletOutlet; + inletValue $internalField; + value $internalField; + } + symmetry + { + type symmetryPlane; + } + walls + { + type zeroGradient; + } + cabin_to_windshield + { + type humidityTemperatureCoupledMixed; + kappa fluidThermo; + kappaName none; + + // Mode of operation: inert, condensation, vaporization, + // condensationAndEvaporation + mode condensationAndEvaporation; + specieName H2O; + carrierMolWeight 28.9 ;//Air from thermophysicalProperties + L 0.1; + Tvap 273; //Minimum temperature for evaporation + + liquid + { + H2O + { + defaultCoeffs yes; + } + } + + value $internalField; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/U b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/U new file mode 100644 index 00000000000..3d246399130 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/U @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volVectorField; + location "0/cabin"; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + inlet + { + type uniformFixedValue; + uniformValue table + ( + (0 (0 0 0)) + (60 (0 0 0)) + (61 (-2 0 0)) + (100 (-2 0 0)) + ); + } + outlet + { + type pressureInletOutletVelocity; + inletValue uniform (0 0 0); + value uniform (0 0 0); + } + symmetry + { + type symmetryPlane; + } + walls + { + type fixedValue; + value uniform (0 0 0); + } + cabin_to_windshield + { + type fixedValue; + value uniform (0 0 0); + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/alphat b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/alphat new file mode 100644 index 00000000000..4c439d355e6 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/alphat @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0/cabin"; + object alphat; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type calculated; + value uniform 0; + } + outlet + { + type calculated; + value uniform 0; + } + symmetry + { + type symmetryPlane; + } + walls + { + type compressible::alphatWallFunction; + Prt 0.85; + value uniform 0; + } + cabin_to_windshield + { + type compressible::alphatWallFunction; + Prt 0.85; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/k b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/k new file mode 100644 index 00000000000..5c3a519b9a3 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/k @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0/cabin"; + object k; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -2 0 0 0 0]; + +internalField uniform 0.00015; + +boundaryField +{ + inlet + { + type uniformFixedValue; + uniformValue table + ( + (0 0.00015) + (60 0.00015) + (61 0.00015) + (100 0.00015) + ); + } + outlet + { + type inletOutlet; + inletValue uniform 0.00015; + value uniform 0.00015; + } + symmetry + { + type symmetryPlane; + } + walls + { + type kqRWallFunction; + value uniform 0.00015; + } + cabin_to_windshield + { + type kqRWallFunction; + value uniform 0.00015; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/nut b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/nut new file mode 100644 index 00000000000..dcb61b252f1 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/nut @@ -0,0 +1,57 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0/cabin"; + object nut; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 2 -1 0 0 0 0]; + +internalField uniform 0; + +boundaryField +{ + inlet + { + type calculated; + value uniform 0; + } + outlet + { + type calculated; + value uniform 0; + } + symmetry + { + type symmetryPlane; + } + walls + { + type nutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } + cabin_to_windshield + { + type nutkWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/omega b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/omega new file mode 100644 index 00000000000..42c1f54622b --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/omega @@ -0,0 +1,58 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0/cabin"; + object omega; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 -1 0 0 0 0]; + +internalField uniform 0.2; + +boundaryField +{ + + inlet + { + type uniformFixedValue; + uniformValue table + ( + (0 0.2) + (60 0.2) + (61 0.2) + (100 0.2) + ); + } + outlet + { + type inletOutlet; + inletValue uniform 0.2; + value uniform 0.2; + } + symmetry + { + type symmetryPlane; + } + ".*" + { + type omegaWallFunction; + Cmu 0.09; + kappa 0.41; + E 9.8; + beta1 0.075; + value uniform 0.2; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/p b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/p new file mode 100644 index 00000000000..9b90ef42d30 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/p @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0/cabin"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 100000; + +boundaryField +{ + inlet + { + type calculated; + value uniform 100000; + } + outlet + { + type calculated; + value uniform 100000; + } + symmetry + { + type symmetryPlane; + } + walls + { + type calculated; + value uniform 100000; + } + cabin_to_windshield + { + type calculated; + value uniform 100000; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/p_rgh b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/p_rgh new file mode 100644 index 00000000000..c870c009515 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/cabin/p_rgh @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0/cabin"; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 100000; + +boundaryField +{ + inlet + { + type fixedFluxPressure; + gradient uniform 0; + value uniform 100000; + } + outlet + { + type fixedValue; + value uniform 100000; + } + symmetry + { + type symmetryPlane; + } + walls + { + type fixedFluxPressure; + gradient uniform 0; + value uniform 100000; + } + cabin_to_windshield + { + type fixedFluxPressure; + gradient uniform 0; + value uniform 100000; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/windshield/T b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/windshield/T new file mode 100644 index 00000000000..bf793c27802 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/windshield/T @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0/windshield"; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 260; + +boundaryField +{ + symmetry + { + type symmetryPlane; + } + walls + { + type zeroGradient; + } + windshield_to_cabin + { + type humidityTemperatureCoupledMixed; + kappa solidThermo; + kappaName none; + value uniform 260; + } + exterior + { + type externalWallHeatFluxTemperature; + kappa solidThermo; + kappaName none; + h uniform 10; + Ta uniform 260; + value uniform 260; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/windshield/p b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/windshield/p new file mode 100644 index 00000000000..9d178b76e6a --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/0.org/windshield/p @@ -0,0 +1,36 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class volScalarField; + location "0/windshield"; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 100000; + +boundaryField +{ + symmetry + { + type symmetryPlane; + } + ".*" + { + type calculated; + value uniform 100000; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allclean b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allclean new file mode 100755 index 00000000000..734eec89e40 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allclean @@ -0,0 +1,11 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase + +rm -rf 0 +rm -rf constant/windshield/polyMesh +rm -rf constant/cabin/polyMesh diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allrun b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allrun new file mode 100755 index 00000000000..0330f6a530d --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/Allrun @@ -0,0 +1,27 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# create the underlying block mesh +runApplication blockMesh + +# create the set for the obstacles +runApplication topoSet + +# mesh processing to generate the inlet duct +runApplication subsetMesh c0 -patch walls -overwrite + +# split into the cabin, ice and exterior regions +runApplication splitMeshRegions -cellZones -overwrite + +# create register face and cell zones +rm log.topoSet +runApplication topoSet -region cabin -dict system/topoSetDictRegister + +# set the initial fields +rm -rf 0 +cp -rf 0.org 0 + +runApplication $(getApplication) diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/g b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/g new file mode 100644 index 00000000000..e0ac2653b5b --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value ( 0 -9.81 0 ); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/radiationProperties b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/radiationProperties new file mode 100644 index 00000000000..ee2e56a39ea --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/radiationProperties @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object radiationProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +radiation off; + +radiationModel none; + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/thermophysicalProperties new file mode 100644 index 00000000000..f666cc7fe9a --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/thermophysicalProperties @@ -0,0 +1,55 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState incompressiblePerfectGas; + specie specie; + energy sensibleEnthalpy; +} + +dpdt no; + +mixture +{ + specie + { + nMoles 1; + molWeight 28.9; + } + thermodynamics + { + Cp 1007; + Hf 0; + } + equationOfState + { + pRef 1e5; + } + transport + { + mu 1.84e-05; + Pr 0.7; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/turbulenceProperties b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/turbulenceProperties new file mode 100644 index 00000000000..9203c7ba665 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/cabin/turbulenceProperties @@ -0,0 +1,29 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType RAS; + +RAS +{ + RASModel kOmegaSST; + + turbulence on; + + printCoeffs on; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/polyMesh/boundary b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/polyMesh/boundary new file mode 100644 index 00000000000..62bf6114b06 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/polyMesh/boundary @@ -0,0 +1,54 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev-OpenCFD | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format binary; + class polyBoundaryMesh; + location "constant/polyMesh"; + object boundary; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +5 +( + inlet + { + type patch; + nFaces 70; + startFace 648417; + } + outlet + { + type patch; + nFaces 2250; + startFace 648487; + } + exterior + { + type patch; + nFaces 2250; + startFace 650737; + } + symmetry + { + type symmetryPlane; + inGroups 1(symmetryPlane); + nFaces 4365; + startFace 652987; + } + walls + { + type wall; + inGroups 1(wall); + nFaces 15071; + startFace 657352; + } +) + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/regionProperties b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/regionProperties new file mode 100644 index 00000000000..34eac5b50e3 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/regionProperties @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object regionProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +regions +( + fluid (cabin) + solid (windshield) +); + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/windshield/radiationProperties b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/windshield/radiationProperties new file mode 100644 index 00000000000..ee2e56a39ea --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/windshield/radiationProperties @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ + +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object radiationProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +radiation off; + +radiationModel none; + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/windshield/thermophysicalProperties b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/windshield/thermophysicalProperties new file mode 100644 index 00000000000..839dd4bbb84 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/constant/windshield/thermophysicalProperties @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heSolidThermo; + mixture pureMixture; + transport constIso; + thermo hConst; + equationOfState rhoConst; + specie specie; + energy sensibleEnthalpy; +} + +mixture +{ + specie + { + nMoles 1; + molWeight 12; + } + + transport + { + kappa 0.9; + } + + thermodynamics + { + Hf 0; + Cp 500; + } + + equationOfState + { + rho 2400; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/blockMeshDict b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/blockMeshDict new file mode 100644 index 00000000000..643813c49f9 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/blockMeshDict @@ -0,0 +1,154 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + ( -0.10 0 0) // 0 // cabin interior + ( -0.05 0 0) // 1 + ( 0.20 0 0) // 2 + ( 0.20 0.05 0) // 3 + ( -0.05 0.05 0) // 4 + ( -0.05 0.10 0) // 5 + ( 1.00 0.10 0) // 6 + ( 1.00 0.50 0) // 7 + ( 0.35 0.50 0) // 8 + ( 0.30 0.50 0) // 9 + ( -0.10 0.10 0) // 10 + ( -0.10 0.05 0) // 11 + + ( -0.1005 0.10 0) // 12 // windshield (doubled vertices with 10, 9) + ( 0.2995 0.50 0) // 13 + + ( -0.50 0.50 0) // 14 // cabin exterior + ( -0.50 0.10 0) // 15 + + + ( 0 0 0.70) // 16 // cabin interior + ( 0.05 0 0.70) // 17 + ( 0.20 0 0.70) // 18 + ( 0.20 0.05 0.70) // 19 + ( 0.05 0.05 0.70) // 20 + ( 0.05 0.10 0.70) // 21 + ( 1.00 0.10 0.70) // 22 + ( 1.00 0.50 0.70) // 23 + ( 0.45 0.50 0.70) // 24 + ( 0.40 0.50 0.70) // 25 + ( 0 0.10 0.70) // 26 + ( 0 0.05 0.70) // 27 + + ( -0.0005 0.10 0.70) // 28 // windshield (doubled vertices with 26,25) + ( 0.3995 0.50 0.70) // 29 + + ( -0.50 0.50 0.70) // 30 // cabin exterior + ( -0.50 0.10 0.70) // 31 +); + + +blocks +( + hex ( 1 2 3 4 17 18 19 20) cabin (15 5 50) simpleGrading (1 1 1) + hex ( 0 1 4 11 16 17 20 27) cabin ( 7 5 50) simpleGrading (1 1 1) + hex (11 4 5 10 27 20 21 26) cabin ( 7 5 50) simpleGrading (1 1 1) + hex (10 5 8 9 26 21 24 25) cabin ( 7 45 50) simpleGrading (1 1 1) + hex ( 5 6 7 8 21 22 23 24) cabin (45 45 50) simpleGrading (3 1 1) + + hex ( 12 10 9 13 28 26 25 29) windshield (45 45 50) simpleGrading (1 1 1) + +); + + +edges +( + arc 9 10 (0.07 0.3 0) + arc 12 13 (0.0695 0.3 0) + + arc 25 26 (0.17 0.3 0.70) + arc 28 29 (0.1695 0.3 0.70) + + arc 9 25 (0.33 0.5 0.35) + arc 13 29 (0.3295 0.5 0.35) + + arc 10 26 (-0.07 0.1 0.35) + arc 12 28 (-0.0705 0.1 0.35) + + arc 5 8 (0.13 0.3 0) + arc 21 24 (0.23 0.3 0.70) + + arc 8 24 (0.38 0.5 0.35) + arc 5 21 (-0.02 0.1 0.35) + + arc 11 27 (-0.07 0.05 0.35) + arc 0 16 (-0.07 0 0.35) + + arc 4 20 (-0.02 0.05 0.35) + arc 1 17 (-0.02 0 0.35) +); + + +defaultPatch +{ + name walls; + type wall; +} + + +boundary +( + inlet + { + type patch; + faces + ( + (2 18 19 3) + ); + } + outlet + { + type patch; + faces + ( + (6 22 23 7) + ); + } + exterior + { + type patch; + faces + ( + (12 13 29 28) + ); + } + symmetry + { + type symmetryPlane; + faces + ( + (5 6 7 8) + (10 5 8 9) + (12 10 9 13) + ); + } +); + + +mergePatchPairs +( +); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvOptions b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvOptions new file mode 100644 index 00000000000..d9eb0cd3899 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvOptions @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvOptions; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +airDeflection +{ + type directionalPressureGradientExplicitSource; + active true; + + directionalPressureGradientExplicitSourceCoeffs + { + selectionMode cellZone; + cellZone c1Zone; + + fieldNames (U); + flowDir (1 2 0); // flow direction + relaxationFactor 0.3; + + faceZone f1Zone; + + //Pressure drop model [Pa] + model DarcyForchheimer;//volumetricFlowRateTable/constant + + //DarcyForchheimer + D 5e7; + I 0; + length 0.01; + + //constant + pressureDrop 8; + + //volumetricFlowRateTable + outOfBounds clamp; + fileName "volFlowRateTable"; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvSchemes new file mode 100644 index 00000000000..01521bab5ef --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvSchemes @@ -0,0 +1,75 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; + grad(p_rgh) Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss linearUpwind grad(U); + div(phi,H2O) Gauss upwind; + div(phi,K) Gauss linear; + div(phi,h) Gauss limitedLinear 1; + div(phi,k) Gauss limitedLinear 1; + div(phi,omega) Gauss limitedLinear 1; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; +} + +laplacianSchemes +{ + default none; + laplacian((rho*nuEff),U) Gauss linear corrected; + laplacian((rho*DkEff),k) Gauss linear corrected; + laplacian((rho*DomegaEff),omega) Gauss linear corrected; + laplacian(rhorAUf,p_rgh) Gauss linear corrected; + laplacian(alphaEff,h) Gauss linear corrected; + laplacian(((rho*nut)+thermo:mu),H2O) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; + directionalPressureGradient::Uf upwind phi; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; + p_rgh ; +} + +wallDist +{ + method meshWave; +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvSolution new file mode 100644 index 00000000000..07a7f39f417 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/fvSolution @@ -0,0 +1,94 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + p_rgh + { + solver GAMG; + tolerance 1e-06; + relTol 0.05; + smoother GaussSeidel; + nPreSweeps 0; + nPostSweeps 2; + nFinestSweeps 2; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + } + + p_rghFinal + { + $p_rgh; + smoother GaussSeidel; + relTol 0; + } + + "rho.*" + { + $p_rgh; + tolerance 1e-05; + relTol 0; + } + + + "(U|h|R|k|epsilon|omega)" + { + solver smoothSolver; + smoother symGaussSeidel; + tolerance 1e-05; + relTol 0.01; + } + + "(U|h|R|k|epsilon|omega)Final" + { + $U; + relTol 0; + } + + H2O + { + $U; + } + + H2OFinal + { + $U; + relTol 0; + } +} + +PIMPLE +{ + momentumPredictor no; + nCorrectors 2; + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/topoSetDict b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/topoSetDict new file mode 100644 index 00000000000..9e0e65420b4 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/topoSetDict @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + // make the mesh a little more interesting... + { + name c0; + type cellSet; + action new; + source boxToCell; + sourceInfo + { + box (-100 -100 -100) (100 0.1 0.25); + } + } + { + name c0; + type cellSet; + action add; + source boxToCell; + sourceInfo + { + box (-100 -100 0.45) (100 0.1 100); + } + } + { + name c0; + type cellSet; + action add; + source boxToCell; + sourceInfo + { + box (-100 0.05 0.33) (100 0.1 0.38); + } + } + { + name c0; + type cellSet; + action invert; + } +); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/topoSetDictRegister b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/topoSetDictRegister new file mode 100644 index 00000000000..096f40e83dd --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/cabin/topoSetDictRegister @@ -0,0 +1,68 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + { + name f1; + type faceSet; + action new; + source boxToFace; + sourceInfo + { + box (-0.126 0.08665 0.2565) (0.02 0.090665 0.446); + } + } + + { + name f1Zone; + type faceZoneSet; + action new; + source setAndNormalToFaceZone; + sourceInfo + { + faceSet f1; + normal (0 1 0); + } + } + + { + name c1; + type cellZoneSet; + action new; + source faceToCell; + sourceInfo + { + set f1Zone; + option neighbour; + } + } + + { + name c1Zone; + type cellZoneSet; + action new; + source setToCellZone; + sourceInfo + { + set c1; + } + } +); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict new file mode 100644 index 00000000000..23d064c2cf5 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict @@ -0,0 +1,99 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application chtMultiRegionFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 90; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 2.5; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 10; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +adjustTimeStep yes; + +maxCo 12; + +maxDi 10; + +maxDeltaT 1; + +functions +{ + H2O + { + type scalarTransport; + + functionObjectLibs ("libutilityFunctionObjects.so"); + + resetOnStartUp no; + + region cabin; + + + // employ schemes used by U to the scalar transport equation + // note: field name is given by the name of the function, in this case + // 'scalar1' + autoSchemes no; + + fvOptions + { + } + } + + fileUpdate + { + type timeActivatedFileUpdate; + functionObjectLibs ("libutilityFunctionObjects.so"); + outputControl timeStep; + outputInterval 1; + region cabin; + fileToUpdate "$FOAM_CASE/system/controlDict"; + + timeVsFile + ( + ( 1 "$FOAM_CASE/system/controlDict.0" ) + ( 5 "$FOAM_CASE/system/controlDict.5") + ( 20 "$FOAM_CASE/system/controlDict.20") + ( 60 "$FOAM_CASE/system/controlDict.60") + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.0 b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.0 new file mode 100644 index 00000000000..af2782ee0cb --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.0 @@ -0,0 +1,99 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application chtMultiRegionFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 90; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 10; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 10; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +adjustTimeStep yes; + +maxCo 2.5; + +maxDi 10; + +maxDeltaT 0.3; + +functions +{ + H2O + { + type scalarTransport; + + functionObjectLibs ("libutilityFunctionObjects.so"); + + resetOnStartUp no; + + region cabin; + + + // employ schemes used by U to the scalar transport equation + // note: field name is given by the name of the function, in this case + // 'scalar1' + autoSchemes no; + + fvOptions + { + } + } + + fileUpdate + { + type timeActivatedFileUpdate; + functionObjectLibs ("libutilityFunctionObjects.so"); + outputControl timeStep; + outputInterval 1; + region cabin; + fileToUpdate "$FOAM_CASE/system/controlDict"; + + timeVsFile + ( + ( 1 "$FOAM_CASE/system/controlDict.0" ) + ( 5 "$FOAM_CASE/system/controlDict.5") + ( 20 "$FOAM_CASE/system/controlDict.20") + ( 60 "$FOAM_CASE/system/controlDict.60") + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.20 b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.20 new file mode 100644 index 00000000000..ef6acf555ff --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.20 @@ -0,0 +1,99 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application chtMultiRegionFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 90; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 10; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 10; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +adjustTimeStep yes; + +maxCo 8; + +maxDi 10; + +maxDeltaT 1; + +functions +{ + H2O + { + type scalarTransport; + + functionObjectLibs ("libutilityFunctionObjects.so"); + + resetOnStartUp no; + + region cabin; + + + // employ schemes used by U to the scalar transport equation + // note: field name is given by the name of the function, in this case + // 'scalar1' + autoSchemes no; + + fvOptions + { + } + } + + fileUpdate + { + type timeActivatedFileUpdate; + functionObjectLibs ("libutilityFunctionObjects.so"); + outputControl timeStep; + outputInterval 1; + region cabin; + fileToUpdate "$FOAM_CASE/system/controlDict"; + + timeVsFile + ( + ( 1 "$FOAM_CASE/system/controlDict.0" ) + ( 5 "$FOAM_CASE/system/controlDict.5") + ( 20 "$FOAM_CASE/system/controlDict.20") + ( 60 "$FOAM_CASE/system/controlDict.60") + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.5 b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.5 new file mode 100644 index 00000000000..b9830325f9e --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.5 @@ -0,0 +1,99 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application chtMultiRegionFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 90; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 10; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 10; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +adjustTimeStep yes; + +maxCo 5; + +maxDi 10; + +maxDeltaT 1; + +functions +{ + H2O + { + type scalarTransport; + + functionObjectLibs ("libutilityFunctionObjects.so"); + + resetOnStartUp no; + + region cabin; + + + // employ schemes used by U to the scalar transport equation + // note: field name is given by the name of the function, in this case + // 'scalar1' + autoSchemes no; + + fvOptions + { + } + } + + fileUpdate + { + type timeActivatedFileUpdate; + functionObjectLibs ("libutilityFunctionObjects.so"); + outputControl timeStep; + outputInterval 1; + region cabin; + fileToUpdate "$FOAM_CASE/system/controlDict"; + + timeVsFile + ( + ( 1 "$FOAM_CASE/system/controlDict.0" ) + ( 5 "$FOAM_CASE/system/controlDict.5") + ( 20 "$FOAM_CASE/system/controlDict.20") + ( 60 "$FOAM_CASE/system/controlDict.60") + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.60 b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.60 new file mode 100644 index 00000000000..23d064c2cf5 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/controlDict.60 @@ -0,0 +1,99 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application chtMultiRegionFoam; + +startFrom startTime; + +startTime 0; + +stopAt endTime; + +endTime 90; + +deltaT 0.01; + +writeControl adjustableRunTime; + +writeInterval 2.5; + +purgeWrite 0; + +writeFormat binary; + +writePrecision 10; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +adjustTimeStep yes; + +maxCo 12; + +maxDi 10; + +maxDeltaT 1; + +functions +{ + H2O + { + type scalarTransport; + + functionObjectLibs ("libutilityFunctionObjects.so"); + + resetOnStartUp no; + + region cabin; + + + // employ schemes used by U to the scalar transport equation + // note: field name is given by the name of the function, in this case + // 'scalar1' + autoSchemes no; + + fvOptions + { + } + } + + fileUpdate + { + type timeActivatedFileUpdate; + functionObjectLibs ("libutilityFunctionObjects.so"); + outputControl timeStep; + outputInterval 1; + region cabin; + fileToUpdate "$FOAM_CASE/system/controlDict"; + + timeVsFile + ( + ( 1 "$FOAM_CASE/system/controlDict.0" ) + ( 5 "$FOAM_CASE/system/controlDict.5") + ( 20 "$FOAM_CASE/system/controlDict.20") + ( 60 "$FOAM_CASE/system/controlDict.60") + ); + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/fvSchemes new file mode 100644 index 00000000000..89e17c63878 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/fvSchemes @@ -0,0 +1,47 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ +} + +gradSchemes +{ +} + +divSchemes +{ +} + +laplacianSchemes +{ +} + +interpolationSchemes +{ +} + +snGradSchemes +{ +} + +fluxRequired +{ +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/fvSolution new file mode 100644 index 00000000000..57143ff80ea --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/fvSolution @@ -0,0 +1,24 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + +PIMPLE +{ + nOuterCorrectors 1; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/topoSetDict b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/topoSetDict new file mode 100644 index 00000000000..9e0e65420b4 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/topoSetDict @@ -0,0 +1,59 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object topoSetDict; +} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +actions +( + // make the mesh a little more interesting... + { + name c0; + type cellSet; + action new; + source boxToCell; + sourceInfo + { + box (-100 -100 -100) (100 0.1 0.25); + } + } + { + name c0; + type cellSet; + action add; + source boxToCell; + sourceInfo + { + box (-100 -100 0.45) (100 0.1 100); + } + } + { + name c0; + type cellSet; + action add; + source boxToCell; + sourceInfo + { + box (-100 0.05 0.33) (100 0.1 0.38); + } + } + { + name c0; + type cellSet; + action invert; + } +); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/windshield/fvSchemes b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/windshield/fvSchemes new file mode 100644 index 00000000000..8a14cb557ad --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/windshield/fvSchemes @@ -0,0 +1,53 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; +} + +laplacianSchemes +{ + default none; + laplacian(alpha,h) Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + +fluxRequired +{ + default no; +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/windshield/fvSolution b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/windshield/fvSolution new file mode 100644 index 00000000000..71ca6b11571 --- /dev/null +++ b/tutorials/heatTransfer/chtMultiRegionFoam/windshieldCondensation/system/windshield/fvSolution @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: dev | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + h + { + solver PCG; + preconditioner DIC; + tolerance 1e-06; + relTol 0.01; + } + + hFinal + { + $h; + tolerance 1e-06; + relTol 0; + } +} + +PIMPLE +{ + nNonOrthogonalCorrectors 0; +} + +relaxationFactors +{ + fields + { + } + equations + { + ".*" 1; + } +} + +// ************************************************************************* // -- GitLab