From b9b2ac694ad2d7f4c90349816a9606424a68c754 Mon Sep 17 00:00:00 2001 From: sergio Date: Fri, 7 Oct 2016 10:17:43 -0700 Subject: [PATCH] ENH: Adding eddyDissipationDiffusionModel, thermocouple probe and thermocoupleTestCase --- src/combustionModels/Make/files | 2 + .../eddyDissipationDiffusionModel.C | 121 ++++++++++ .../eddyDissipationDiffusionModel.H | 124 ++++++++++ .../eddyDissipationDiffusionModels.C | 71 ++++++ .../eddyDissipationModelBase.C | 133 +++++++++++ .../eddyDissipationModelBase.H | 126 ++++++++++ src/functionObjects/utilities/Make/files | 2 + src/functionObjects/utilities/Make/options | 11 +- .../thermoCoupleProbes/thermoCoupleProbes.C | 219 ++++++++++++++++++ .../thermoCoupleProbes/thermoCoupleProbes.H | 217 +++++++++++++++++ .../thermoCoupleProbesTemplates.C | 53 +++++ src/sampling/Make/options | 1 + src/sampling/probes/patchProbes.C | 18 -- src/sampling/probes/patchProbes.H | 12 - src/sampling/probes/probes.C | 27 +-- src/sampling/probes/probes.H | 17 +- .../thermocoupleTestCase/0/IDefault | 32 +++ .../thermocoupleTestCase/0/T | 30 +++ .../thermocoupleTestCase/0/U | 30 +++ .../thermocoupleTestCase/0/p | 30 +++ .../thermocoupleTestCase/0/p_rgh | 30 +++ .../thermocoupleTestCase/Allclean | 9 + .../thermocoupleTestCase/Allrun | 13 ++ .../constant/boundaryRadiationProperties | 26 +++ .../thermocoupleTestCase/constant/g | 22 ++ .../constant/radiationProperties | 48 ++++ .../constant/thermophysicalProperties | 51 ++++ .../constant/turbulenceProperties | 20 ++ .../thermocoupleTestCase/system/blockMeshDict | 61 +++++ .../thermocoupleTestCase/system/controlDict | 90 +++++++ .../thermocoupleTestCase/system/fvSchemes | 60 +++++ .../thermocoupleTestCase/system/fvSolution | 85 +++++++ 32 files changed, 1720 insertions(+), 71 deletions(-) create mode 100644 src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.C create mode 100644 src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.H create mode 100644 src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModels.C create mode 100644 src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.C create mode 100644 src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H create mode 100644 src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.C create mode 100644 src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.H create mode 100644 src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/IDefault create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/T create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/U create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/p create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/p_rgh create mode 100755 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/Allclean create mode 100755 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/Allrun create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/boundaryRadiationProperties create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/g create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/radiationProperties create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/thermophysicalProperties create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/turbulenceProperties create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/blockMeshDict create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/controlDict create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/fvSchemes create mode 100644 tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/fvSolution diff --git a/src/combustionModels/Make/files b/src/combustionModels/Make/files index f1f87e9cfb..e04239c47b 100644 --- a/src/combustionModels/Make/files +++ b/src/combustionModels/Make/files @@ -15,6 +15,8 @@ infinitelyFastChemistry/infinitelyFastChemistrys.C PaSR/PaSRs.C +eddyDissipationDiffusionModel/eddyDissipationDiffusionModels.C + laminar/laminars.C /* diff --git a/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.C b/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.C new file mode 100644 index 0000000000..9c45002699 --- /dev/null +++ b/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.C @@ -0,0 +1,121 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "eddyDissipationDiffusionModel.H" + +namespace Foam +{ +namespace combustionModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +eddyDissipationDiffusionModel:: +eddyDissipationDiffusionModel +( + const word& modelType, const fvMesh& mesh, const word& phaseName +) +: + eddyDissipationModelBase + ( + modelType, + mesh, + phaseName + ), + Cd_(readScalar(this->coeffs().lookup("Cd"))) +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +template +eddyDissipationDiffusionModel:: +~eddyDissipationDiffusionModel() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + + +template +Foam::tmp +eddyDissipationDiffusionModel::timeScale() +{ + return (max(this->rtTurb(), this->rtDiff())); +} + + +template +Foam::tmp +eddyDissipationDiffusionModel::rtDiff() const +{ + tmp tdelta + ( + new volScalarField + ( + IOobject + ( + "tdelta", + this->mesh().time().timeName(), + this->mesh(), + IOobject::NO_READ, + IOobject::NO_WRITE + ), + this->mesh(), + dimensionedScalar("delta", dimLength, 0), + zeroGradientFvPatchScalarField::typeName + ) + ); + + volScalarField& delta = tdelta.ref(); + delta.ref() = pow(this->mesh().V(), 1.0/3.0); + delta.correctBoundaryConditions(); + + // NOTE: Assume Prt = 1 + return Cd_*this->turbulence().nuEff()/sqr(delta); +} + + +template +bool eddyDissipationDiffusionModel::read() +{ + if (eddyDissipationModelBase::read()) + { + this->coeffs().lookup("Cd") >> Cd_; + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.H b/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.H new file mode 100644 index 0000000000..ed3641f7d7 --- /dev/null +++ b/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModel.H @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::combustionModels::eddyDissipationDiffusionModel + +Description + Eddy dissipation model based on the principle of mixed is burnt. + +SourceFiles + eddyDissipationDiffusionModel.C + +\*---------------------------------------------------------------------------*/ + +#ifndef eddyDissipationDiffusionModel_H +#define eddyDissipationDiffusionModel_H + +#include "eddyDissipationModelBase.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + Class eddyDissipationDiffusionModel Declaration +\*---------------------------------------------------------------------------*/ + +template +class eddyDissipationDiffusionModel +: + public eddyDissipationModelBase +{ + // Private data + + //- Diffussivity constant + scalar Cd_; + + + // Private memeber functions + + //- Disallow copy construct + eddyDissipationDiffusionModel(const eddyDissipationDiffusionModel&); + + //- Disallow default bitwise assignment + void operator=(const eddyDissipationDiffusionModel&); + + +public: + + //- Runtime type information + TypeName("EDC"); + + + // Constructors + + //- Construct from components + eddyDissipationDiffusionModel + ( + const word& modelType, + const fvMesh& mesh, + const word& phaseName + ); + + + //- Destructor + virtual ~eddyDissipationDiffusionModel(); + + + // Member Functions + + //- Calculate time scale + virtual tmp timeScale(); + + //- Return the reciprocal of the diffusion time scale + tmp rtDiff() const; + + + // I-O + + //- Update properties + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "eddyDissipationDiffusionModel.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModels.C b/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModels.C new file mode 100644 index 0000000000..70c2c83791 --- /dev/null +++ b/src/combustionModels/eddyDissipationDiffusionModel/eddyDissipationDiffusionModels.C @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "makeCombustionTypes.H" + +#include "thermoPhysicsTypes.H" +#include "psiThermoCombustion.H" +#include "rhoThermoCombustion.H" + +#include "eddyDissipationDiffusionModel.H" +#include "eddyDissipationModelBase.H" +#include "singleStepCombustion.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +makeCombustionTypesThermo +( + eddyDissipationDiffusionModel, + psiThermoCombustion, + gasHThermoPhysics, + psiCombustionModel +); + +makeCombustionTypesThermo +( + eddyDissipationDiffusionModel, + psiThermoCombustion, + constGasHThermoPhysics, + psiCombustionModel +); + +makeCombustionTypesThermo +( + eddyDissipationDiffusionModel, + rhoThermoCombustion, + gasHThermoPhysics, + rhoCombustionModel +); + +makeCombustionTypesThermo +( + eddyDissipationDiffusionModel, + rhoThermoCombustion, + constGasHThermoPhysics, + rhoCombustionModel +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.C b/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.C new file mode 100644 index 0000000000..0387661354 --- /dev/null +++ b/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.C @@ -0,0 +1,133 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "eddyDissipationModelBase.H" +#include "zeroGradientFvPatchFields.H" + +namespace Foam +{ +namespace combustionModels +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +eddyDissipationModelBase::eddyDissipationModelBase +( + const word& modelType, const fvMesh& mesh, const word& phaseName +) +: + singleStepCombustion + ( + modelType, + mesh, + phaseName + ), + CEDC_(readScalar(this->coeffs().lookup("CEDC"))) +{} + + +// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * // + +template +eddyDissipationModelBase:: +~eddyDissipationModelBase() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +Foam::tmp +eddyDissipationModelBase::rtTurb() const +{ + return + CEDC_*this->turbulence().epsilon() + / max + ( + this->turbulence().k(), + dimensionedScalar("SMALL",sqr(dimVelocity), SMALL) + ); +} + + +template +void eddyDissipationModelBase::correct() +{ + this->wFuel_ == + dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0); + + if (this->active()) + { + this->singleMixturePtr_->fresCorrect(); + + const label fuelI = this->singleMixturePtr_->fuelIndex(); + + const volScalarField& YFuel = + this->thermoPtr_->composition().Y()[fuelI]; + + const dimensionedScalar s = this->singleMixturePtr_->s(); + + if (this->thermoPtr_->composition().contains("O2")) + { + const volScalarField& YO2 = + this->thermoPtr_->composition().Y("O2"); + + this->wFuel_ == + this->rho() + * min(YFuel, YO2/s.value()) + * timeScale(); + } + else + { + FatalErrorInFunction + << "You selected a combustion model which requieres O2 mass" + << " to be present in the mixture" + << exit(FatalError); + } + } +} + + +template +bool eddyDissipationModelBase::read() +{ + if (singleStepCombustion::read()) + { + this->coeffs().lookup("CEDC") >> CEDC_; + return true; + } + else + { + return false; + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H b/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H new file mode 100644 index 0000000000..56ce52e75f --- /dev/null +++ b/src/combustionModels/eddyDissipationModelBase/eddyDissipationModelBase.H @@ -0,0 +1,126 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd + \\/ M anipulation | +------------------------------------------------------------------------------- +License + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::combustionModels::eddyDissipationModelBase + +Description + + +SourceFiles + eddyDissipationModelBase.C + +\*---------------------------------------------------------------------------*/ + +#ifndef eddyDissipationModelBase_H +#define eddyDissipationModelBase_H + +#include "singleStepCombustion.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace combustionModels +{ + +/*---------------------------------------------------------------------------*\ + Class eddyDissipationModelBase Declaration +\*---------------------------------------------------------------------------*/ + +template +class eddyDissipationModelBase +: + public singleStepCombustion +{ + // Private data + + //- EDC model constant + scalar CEDC_; + + + // Private Member Functions + + //- Disallow copy construct + eddyDissipationModelBase(const eddyDissipationModelBase&); + + //- Disallow default bitwise assignment + void operator=(const eddyDissipationModelBase&); + + +public: + + //- Runtime type information + //TypeName("eddyDissipationModelBase"); + + + // Constructors + + //- Construct from components + eddyDissipationModelBase + ( + const word& modelType, + const fvMesh& mesh, + const word& phaseName + ); + + + //- Destructor + virtual ~eddyDissipationModelBase(); + + + // Member Functions + + //- Return the reciprocal of the turbulent mixing time scale + tmp rtTurb() const; + + //- Correct combustion rate + void correct(); + + //- Calculate time scale + virtual tmp timeScale() = 0; + + + // I-O + + //- Update properties + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace combustionModels +} // End namespace Foam + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "eddyDissipationModelBase.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/functionObjects/utilities/Make/files b/src/functionObjects/utilities/Make/files index 8a4d292c36..dbf8798938 100644 --- a/src/functionObjects/utilities/Make/files +++ b/src/functionObjects/utilities/Make/files @@ -25,4 +25,6 @@ writeDictionary/writeDictionary.C writeObjects/writeObjects.C +thermoCoupleProbes/thermoCoupleProbes.C + LIB = $(FOAM_LIBBIN)/libutilityFunctionObjects diff --git a/src/functionObjects/utilities/Make/options b/src/functionObjects/utilities/Make/options index 71b7873964..0efefc46fc 100644 --- a/src/functionObjects/utilities/Make/options +++ b/src/functionObjects/utilities/Make/options @@ -1,5 +1,12 @@ EXE_INC = \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/sampling/lnInclude \ + -I$(LIB_SRC)/ODE/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/transportModels/compressible/lnInclude LIB_LIBS = \ - -lfiniteVolume + -lfiniteVolume \ + -lfluidThermophysicalModels \ + -lcompressibleTransportModels \ + -lODE diff --git a/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.C b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.C new file mode 100644 index 0000000000..7e42f5368a --- /dev/null +++ b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.C @@ -0,0 +1,219 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "thermoCoupleProbes.H" +#include "mathematicalConstants.H" +#include "constants.H" +#include "addToRunTimeSelectionTable.H" + +using namespace Foam::constant; + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(thermoCoupleProbes, 0); + addToRunTimeSelectionTable(functionObject, thermoCoupleProbes, dictionary); +} + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + + +void Foam::thermoCoupleProbes::readDict(const dictionary& dict) +{ + rho_ = readScalar(dict.lookup("rho")); + Cp_ = readScalar(dict.lookup("Cp")); + d_ = readScalar(dict.lookup("d")); + epsilon_ = readScalar(dict.lookup("epsilon")); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::thermoCoupleProbes::thermoCoupleProbes +( + const word& name, + const Time& runTime, + const dictionary& dict, + const bool loadFromFiles, + const bool doFindElements +) +: + probes(name, runTime, dict, loadFromFiles, doFindElements), + ODESystem(), + radName_(dict.lookup("radName")), + thermo_ + ( + mesh_.lookupObject(basicThermo::dictName) + ), + odeSolver_(ODESolver::New(*this, dict)), + Ttc_(this->size(), 0.0) +{ + + readDict(dict); + + // Check if the property exist (resume old calculation) + // or of it is new. + if (foundProperty(typeName)) + { + const dictionary& dict = + this->stateDict().subDict(this->name()).subDict(typeName); + + dict.lookup("Tc") >> Ttc_; + } + else + { + Ttc_ = probes::sample(thermo_.T()); + } + + // Initialize thermocouple at initial T (room temperature) + + if (doFindElements) + { + // Find the elements + findElements(mesh_); + + // Open the probe streams + prepare(); + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::thermoCoupleProbes::~thermoCoupleProbes() +{} + + +Foam::label Foam::thermoCoupleProbes::nEqns() const +{ + return this->size(); +} + + +void Foam::thermoCoupleProbes::derivatives +( + const scalar x, + const scalarField& y, + scalarField& dydx +) const +{ + scalarField G(y.size(), 0.0); + scalarField Tc(y.size(), 0.0); + scalarField Uc(y.size(), 0.0); + scalarField rhoc(y.size(), 0.0); + scalarField muc(y.size(), 0.0); + scalarField Cpc(y.size(), 0.0); + scalarField kappac(y.size(), 0.0); + + if (radName_ != "none") + { + G = sample(mesh_.lookupObject(radName_)); + } + + Tc = probes::sample(thermo_.T()); + + Uc = mag(this->sample(mesh_.lookupObject("U"))); + + rhoc = this->sample(thermo_.rho()()); + kappac = this->sample(thermo_.kappa()()); + muc = this->sample(thermo_.mu()()); + Cpc = this->sample(thermo_.Cp()()); + + scalarField Re(rhoc*Uc*d_/(muc + ROOTVSMALL)); + scalarField Pr(Cpc*muc/(kappac + ROOTVSMALL)); + //scalarField Nu(2.0 + 0.6*sqrt(Re)*cbrt(Pr)); + scalarField Nu(2.0 + (0.4*sqrt(Re) + 0.06*pow(Re, 2/3))*pow(Pr, 0.4)); + scalarField htc(Nu*kappac/d_); + + const scalar sigma = physicoChemical::sigma.value(); + + scalar area = 4*constant::mathematical::pi*sqr(d_/2); + scalar volume = (4/3)*constant::mathematical::pi*pow(d_/2, 3); + + dydx = + (epsilon_*(G/4 - sigma*pow(y, 4.0))*area + htc*(Tc - y)*area) + / (rho_*Cp_*volume); +} + + +void Foam::thermoCoupleProbes::jacobian +( + const scalar x, + const scalarField& y, + scalarField& dfdt, + scalarSquareMatrix& dfdy +) const +{ + derivatives(x, y, dfdt); + for (label i=0; isize()) + { + sampleAndWrite(thermo_.T()); + + dictionary probeDict; + probeDict.add("Tc", Ttc_); + setProperty(typeName, probeDict); + return true; + } + return false; +} + + +bool Foam::thermoCoupleProbes::execute() +{ + if (this->size()) + { + scalar dt = mesh_.time().deltaTValue(); + scalar t = mesh_.time().value(); + odeSolver_->solve(t, t+dt, Ttc_, dt); + return true; + } + + return false; +} + + +bool Foam::thermoCoupleProbes::read(const dictionary& dict) +{ + readDict(dict); + probes::read(dict); + return true; +} + + +// ************************************************************************* // diff --git a/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.H b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.H new file mode 100644 index 0000000000..657c974fb2 --- /dev/null +++ b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbes.H @@ -0,0 +1,217 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD.Ltd + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +Class + Foam::functionObjects::thermoCoupleProbes + +Description + Sample probe for temperature using a thermocouple. Uses the correlation: + + Nu = 2.0 + (0.4*sqrt(Re) + 0.06*pow(Re, 2/3))*pow(Pr, 0.4) + + Example of function object specification: + \verbatim + probes + { + type thermoCoupleProbes; + + solver rodas23; + absTol 1e-12; + relTol 1e-8; + + interpolationScheme cellPoint; + + // thermocouple properties + rho 8908; + Cp 440; + d 1e-3; + epsilon 0.85; + + radName G; + + functionObjectLibs ("libsampling.so"); + outputControl timeStep; + outputInterval 1; + probeLocations + ( + ( 0.5 0.5 0.5 ) + ); + fields + ( + T + ); + } + \endverbatim + + +SourceFiles + thermoCoupleProbes.C + +\*---------------------------------------------------------------------------*/ + +#ifndef thermoCoupleProbes_H +#define thermoCoupleProbes_H + +#include "probes.H" +#include "ODESystem.H" +#include "ODESolver.H" +#include "basicThermo.H" +#include "fluidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class thermoCoupleProbes Declaration +\*---------------------------------------------------------------------------*/ + +class thermoCoupleProbes +: + public probes, + public ODESystem +{ +protected: + + // Protected data + + //- Thermocouple density + scalar rho_; + + //- Thermocouple heat capacity + scalar Cp_; + + //- Thermocouple diameter + scalar d_; + + //- Thermocouple emissivity + scalar epsilon_; + + //- Name for the incident radiation field + word radName_; + + //- Fluid thermo reference + const fluidThermo& thermo_; + + //- ODESolver + autoPtr odeSolver_; + + //- Cached thermocouple temperature + scalarField Ttc_; + + + // Protected Member Functions + + //- Sample and write a particular volume field + template + void sampleAndWrite + ( + const GeometricField& + ); + + + //- Read dictionary settings + void readDict(const dictionary& dict); + + +private: + + //- Disallow default bitwise copy construct + thermoCoupleProbes(const thermoCoupleProbes&); + + //- Disallow default bitwise assignment + void operator=(const thermoCoupleProbes&); + + +public: + + //- Runtime type information + TypeName("thermoCoupleProbes"); + + + // Constructors + + //- Construct for given objectRegistry and dictionary. + // Allow the possibility to load fields from files + thermoCoupleProbes + ( + const word& name, + const Time& runTime, + const dictionary& dict, + const bool loadFromFiles = false, + const bool findElements = true + ); + + + //- Destructor + virtual ~thermoCoupleProbes(); + + + // ODE functions (overriding abstract functions in ODE.H) + + //- Number of ODE's to solve + virtual label nEqns() const; + + virtual void derivatives + ( + const scalar t, + const scalarField& c, + scalarField& dcdt + ) const; + + virtual void jacobian + ( + const scalar t, + const scalarField& c, + scalarField& dcdt, + scalarSquareMatrix& dfdc + ) const; + + //- Public members + + //- Sample and write + virtual bool write(); + + //- Execute, currently does nothing + virtual bool execute(); + + //- Read + virtual bool read(const dictionary&); +}; + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "thermoCoupleProbesTemplates.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C new file mode 100644 index 0000000000..ee296ab80c --- /dev/null +++ b/src/functionObjects/utilities/thermoCoupleProbes/thermoCoupleProbesTemplates.C @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2016 OpenCFD.Ltd + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "thermoCoupleProbes.H" +#include "volFields.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::thermoCoupleProbes::sampleAndWrite +( + const GeometricField& vField +) +{ + if (Pstream::master()) + { + unsigned int w = IOstream::defaultPrecision() + 7; + OFstream& probeStream = *probeFilePtrs_[vField.name()]; + + probeStream + << setw(w) + << vField.time().timeToUserTime(vField.time().value()); + + forAll(*this, probeI) + { + probeStream << ' ' << setw(w) << Ttc_[probeI]; + } + probeStream << endl; + } +} +// ************************************************************************* // diff --git a/src/sampling/Make/options b/src/sampling/Make/options index 8e006e099c..0cf5b268b6 100644 --- a/src/sampling/Make/options +++ b/src/sampling/Make/options @@ -8,6 +8,7 @@ EXE_INC = \ -I$(LIB_SRC)/conversion/lnInclude \ -I$(LIB_SRC)/lagrangian/basic/lnInclude + LIB_LIBS = \ -lfiniteVolume \ -lmeshTools \ diff --git a/src/sampling/probes/patchProbes.C b/src/sampling/probes/patchProbes.C index f03c6c6cf7..225ee132d3 100644 --- a/src/sampling/probes/patchProbes.C +++ b/src/sampling/probes/patchProbes.C @@ -232,24 +232,6 @@ Foam::patchProbes::patchProbes } -Foam::patchProbes::patchProbes -( - const word& name, - const objectRegistry& obr, - const dictionary& dict, - const bool loadFromFiles, - const bool readFields -) -: - probes(name, obr, dict, loadFromFiles, false) -{ - if (readFields) - { - read(dict); - } -} - - // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::patchProbes::~patchProbes() diff --git a/src/sampling/probes/patchProbes.H b/src/sampling/probes/patchProbes.H index f290bd11e0..3feb7a2064 100644 --- a/src/sampling/probes/patchProbes.H +++ b/src/sampling/probes/patchProbes.H @@ -172,18 +172,6 @@ public: const bool readFields = true ); - //- Construct for given objectRegistry and dictionary. - // Allow the possibility to load fields from files - patchProbes - ( - const word& name, - const objectRegistry&, - const dictionary&, - const bool loadFromFiles = false, - const bool readFields = true - ); - - //- Destructor virtual ~patchProbes(); diff --git a/src/sampling/probes/probes.C b/src/sampling/probes/probes.C index 54e8d298ce..a8f217084c 100644 --- a/src/sampling/probes/probes.C +++ b/src/sampling/probes/probes.C @@ -273,7 +273,7 @@ Foam::probes::probes const bool readFields ) : - functionObject(name), + stateFunctionObject(name, runTime), pointField(0), mesh_ ( @@ -296,31 +296,6 @@ Foam::probes::probes } } - -Foam::probes::probes -( - const word& name, - const objectRegistry& obr, - const dictionary& dict, - const bool loadFromFiles, - const bool readFields -) -: - functionObject(name), - pointField(0), - mesh_(refCast(obr)), - loadFromFiles_(loadFromFiles), - fieldSelection_(), - fixedLocations_(true), - interpolationScheme_("cell") -{ - if (readFields) - { - read(dict); - } -} - - // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::probes::~probes() diff --git a/src/sampling/probes/probes.H b/src/sampling/probes/probes.H index 2f8bb4e138..28a7ac2e24 100644 --- a/src/sampling/probes/probes.H +++ b/src/sampling/probes/probes.H @@ -73,7 +73,7 @@ SourceFiles #ifndef probes_H #define probes_H -#include "functionObject.H" +#include "stateFunctionObject.H" #include "HashPtrTable.H" #include "OFstream.H" #include "polyMesh.H" @@ -83,6 +83,8 @@ SourceFiles #include "surfaceMesh.H" #include "wordReList.H" +using namespace Foam::functionObjects; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -101,7 +103,7 @@ class mapPolyMesh; class probes : - public functionObject, + public stateFunctionObject, public pointField { protected: @@ -241,17 +243,6 @@ public: const bool readFields = true ); - //- Construct for given objectRegistry and dictionary. - // Allow the possibility to load fields from files - probes - ( - const word& name, - const objectRegistry& obr, - const dictionary& dict, - const bool loadFromFiles = false, - const bool readFields = true - ); - //- Destructor virtual ~probes(); diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/IDefault b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/IDefault new file mode 100644 index 0000000000..d7b099ffaa --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/IDefault @@ -0,0 +1,32 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.org | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + location "0"; + object IDefault; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [ 1 0 -3 0 0 0 0 ]; + +internalField uniform 0; + +boundaryField +{ + walls + { + type greyDiffusiveRadiation; + value uniform 0; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/T b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/T new file mode 100644 index 0000000000..8f68c965e7 --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/T @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object T; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 0 0 1 0 0 0]; + +internalField uniform 298.15; + +boundaryField +{ + walls + { + type fixedValue; + value uniform 873.15; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/U b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/U new file mode 100644 index 0000000000..0175ed2621 --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/U @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volVectorField; + object U; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -1 0 0 0 0]; + +internalField uniform (0 0 0); + +boundaryField +{ + walls + { + type fixedValue; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/p b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/p new file mode 100644 index 0000000000..d68837c434 --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/p @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e5; + +boundaryField +{ + walls + { + type calculated; + value $internalField; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/p_rgh b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/p_rgh new file mode 100644 index 0000000000..31c9bd2383 --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/0/p_rgh @@ -0,0 +1,30 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class volScalarField; + object p_rgh; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [1 -1 -2 0 0 0 0]; + +internalField uniform 1e5; + +boundaryField +{ + walls + { + type fixedFluxPressure; + value uniform 1e5; + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/Allclean b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/Allclean new file mode 100755 index 0000000000..6b45f82a41 --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/Allclean @@ -0,0 +1,9 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial clean functions +. $WM_PROJECT_DIR/bin/tools/CleanFunctions + +cleanCase + +#------------------------------------------------------------------------------ diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/Allrun b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/Allrun new file mode 100755 index 0000000000..87eba62518 --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/Allrun @@ -0,0 +1,13 @@ +#!/bin/sh +cd ${0%/*} || exit 1 # Run from this directory + +# Source tutorial run functions +. $WM_PROJECT_DIR/bin/tools/RunFunctions + +# Get application name +application=$(getApplication) + +runApplication blockMesh +runApplication $application + +#------------------------------------------------------------------------------ diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/boundaryRadiationProperties b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/boundaryRadiationProperties new file mode 100644 index 0000000000..c8a183a959 --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/boundaryRadiationProperties @@ -0,0 +1,26 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object boundaryRadiationProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +".*" +{ + mode lookup; + emissivity 1.0; + absorptivity 1.0; +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/g b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/g new file mode 100644 index 0000000000..c387916ece --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/g @@ -0,0 +1,22 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class uniformDimensionedVectorField; + location "constant"; + object g; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +dimensions [0 1 -2 0 0 0 0]; +value (0 0 0); + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/radiationProperties b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/radiationProperties new file mode 100644 index 0000000000..48bff58948 --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/radiationProperties @@ -0,0 +1,48 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object radiationProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +radiation on; + +radiationModel fvDOM; + +fvDOMCoeffs +{ + nPhi 3; + nTheta 5; + convergence 1e-3; + maxIter 10; +} + +// Number of flow iterations per radiation iteration +solverFreq 10; + +absorptionEmissionModel constantAbsorptionEmission; + +constantAbsorptionEmissionCoeffs +{ + absorptivity absorptivity [ m^-1 ] 0.01; + emissivity emissivity [ m^-1 ] 0.01; + E E [ kg m^-1 s^-3 ] 0; +} + +scatterModel none; + +sootModel none; + +transmissivityModel none; + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/thermophysicalProperties b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/thermophysicalProperties new file mode 100644 index 0000000000..b34b46315c --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/thermophysicalProperties @@ -0,0 +1,51 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object thermophysicalProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +thermoType +{ + type heRhoThermo; + mixture pureMixture; + transport const; + thermo hConst; + equationOfState perfectGas; + specie specie; + energy sensibleEnthalpy; +} + +//pRef 100000; + +mixture +{ + specie + { + nMoles 1; + molWeight 28.9; + } + thermodynamics + { + Cp 1000; + Hf 0; + } + transport + { + mu 1.8e-05; + Pr 0.7; + } +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/turbulenceProperties b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/turbulenceProperties new file mode 100644 index 0000000000..e4ad75d18c --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/constant/turbulenceProperties @@ -0,0 +1,20 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "constant"; + object turbulenceProperties; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +simulationType laminar; + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/blockMeshDict b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/blockMeshDict new file mode 100644 index 0000000000..721d41763b --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/blockMeshDict @@ -0,0 +1,61 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + object blockMeshDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +convertToMeters 1; + +vertices +( + (0 0 0) + (1 0 0) + (1 1 0) + (0 1 0) + (0 0 1) + (1 0 1) + (1 1 1) + (0 1 1) +); + +blocks +( + hex (0 1 2 3 4 5 6 7) (20 20 20) simpleGrading (1 1 1) +); + +edges +( +); + +boundary +( + walls + { + type wall; + faces + ( + (1 5 4 0) + (3 7 6 2) + (0 4 7 3) + (2 6 5 1) + (0 3 2 1) + (4 5 6 7) + ); + } +); + +mergePatchPairs +( +); + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/controlDict b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/controlDict new file mode 100644 index 0000000000..3bd4130bfc --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/controlDict @@ -0,0 +1,90 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object controlDict; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +application buoyantPimpleFoam; + +startFrom latestTime; + +startTime 0; + +stopAt endTime; + +endTime 90; + +deltaT 0.1; + +writeControl adjustableRunTime; + +writeInterval 10; + +purgeWrite 0; + +writeFormat ascii; + +writePrecision 6; + +writeCompression off; + +timeFormat general; + +timePrecision 6; + +runTimeModifiable true; + +adjustTimeStep no; + +maxCo 0.5; + +functions +{ + + probes + { + type thermoCoupleProbes; + + solver rodas23; + absTol 1e-12; + relTol 1e-8; + + interpolationScheme cellPoint; + + // thermocouple properties + rho 8908; + Cp 440; + d 1e-3; + epsilon 0.85; + + radName G; + + functionObjectLibs + ( + "libutilityFunctionObjects.so" + ); + writeControl timeStep; + writeInterval 1; + probeLocations + ( + ( 0.5 0.5 0.5 ) + ); + fields + ( + T + ); + } +} + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/fvSchemes b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/fvSchemes new file mode 100644 index 0000000000..327257011c --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/fvSchemes @@ -0,0 +1,60 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSchemes; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +ddtSchemes +{ + default Euler; +} + +gradSchemes +{ + default Gauss linear; +} + +divSchemes +{ + default none; + div(phi,U) Gauss upwind; + div(phi,h) Gauss upwind; + div(phi,e) Gauss upwind; + div(phi,k) Gauss upwind; + div(phi,epsilon) Gauss upwind; + div(phi,R) Gauss upwind; + div(phi,K) Gauss linear; + div(phi,Ekp) Gauss linear; + div(R) Gauss linear; + div(((rho*nuEff)*dev2(T(grad(U))))) Gauss linear; + div(Ji,Ii_h) Gauss linearUpwind grad(Ii_h); +} + +laplacianSchemes +{ + default Gauss linear corrected; +} + +interpolationSchemes +{ + default linear; +} + +snGradSchemes +{ + default corrected; +} + + +// ************************************************************************* // diff --git a/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/fvSolution b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/fvSolution new file mode 100644 index 0000000000..e1d1d98ec6 --- /dev/null +++ b/tutorials/heatTransfer/buoyantPimpleFoam/thermocoupleTestCase/system/fvSolution @@ -0,0 +1,85 @@ +/*--------------------------------*- C++ -*----------------------------------*\ +| ========= | | +| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | +| \\ / O peration | Version: plus | +| \\ / A nd | Web: www.OpenFOAM.com | +| \\/ M anipulation | | +\*---------------------------------------------------------------------------*/ +FoamFile +{ + version 2.0; + format ascii; + class dictionary; + location "system"; + object fvSolution; +} +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +solvers +{ + "rho.*" + { + solver PCG; + preconditioner DIC; + tolerance 0; + relTol 0; + } + + p_rgh + { + solver PCG; + preconditioner DIC; + tolerance 1e-8; + relTol 0.01; + } + + p_rghFinal + { + $p_rgh; + relTol 0; + } + + "(U|h|e|k|epsilon|R)" + { + solver PBiCG; + preconditioner DILU; + tolerance 1e-6; + relTol 0.1; + maxIter 0; + } + + "(U|h|e|k|epsilon|R)Final" + { + $U; + relTol 0; + maxIter 0; + } + + Ii + { + solver GAMG; + tolerance 1e-4; + relTol 0; + smoother symGaussSeidel; + cacheAgglomeration true; + nCellsInCoarsestLevel 10; + agglomerator faceAreaPair; + mergeLevels 1; + maxIter 5; + nPreSweeps 0; + nPostSweeps 1; + } +} + +PIMPLE +{ + momentumPredictor no; + nOuterCorrectors 1; + nCorrectors 2; + nNonOrthogonalCorrectors 0; + pRefCell 0; + pRefValue 1e5; +} + + +// ************************************************************************* //