1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "temperatureCoupledBase.H"
27 #include "volFields.H"
28 #include "basicSolidThermo.H"
29 #include "turbulenceModel.H"
30 #include "basicThermo.H"
32 // * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
37 const char* Foam::NamedEnum
39 Foam::temperatureCoupledBase::KMethodType,
45 "directionalSolidThermo",
51 const Foam::NamedEnum<Foam::temperatureCoupledBase::KMethodType, 4>
52 Foam::temperatureCoupledBase::KMethodTypeNames_;
55 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
57 Foam::temperatureCoupledBase::temperatureCoupledBase
60 const word& calculationType,
65 method_(KMethodTypeNames_[calculationType]),
70 Foam::temperatureCoupledBase::temperatureCoupledBase
73 const dictionary& dict
77 method_(KMethodTypeNames_.read(dict.lookup("K"))),
78 KName_(dict.lookup("KName"))
82 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
84 Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::K
89 const fvMesh& mesh = patch_.boundaryMesh().mesh();
95 const compressible::turbulenceModel& model =
96 mesh.lookupObject<compressible::turbulenceModel>
102 model.alphaEff()().boundaryField()[patch_.index()]
103 *model.thermo().Cp(Tp, patch_.index());
109 const basicSolidThermo& thermo =
110 mesh.lookupObject<basicSolidThermo>
112 "solidThermophysicalProperties"
114 return thermo.K(patch_.index());
118 case DIRECTIONALSOLIDTHERMO:
120 const vectorField n(patch_.nf());
122 const basicSolidThermo& thermo =
123 mesh.lookupObject<basicSolidThermo>
125 "solidThermophysicalProperties"
127 return n & thermo.directionalK(patch_.index()) & n;
133 if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
135 return patch_.lookupPatchField<volScalarField, scalar>(KName_);
139 mesh.objectRegistry::foundObject<volSymmTensorField>(KName_)
142 const symmTensorField& KWall =
143 patch_.lookupPatchField<volSymmTensorField, scalar>(KName_);
145 const vectorField n(patch_.nf());
147 return n & KWall & n;
151 FatalErrorIn("temperatureCoupledBase::K() const")
152 << "Did not find field " << KName_
153 << " on mesh " << mesh.name() << " patch " << patch_.name()
155 << "Please set 'K' to one of " << KMethodTypeNames_.toc()
156 << " and 'KName' to the name of the volScalar"
157 << " or volSymmTensor field (if K=lookup)"
160 return scalarField(0);
166 FatalErrorIn("temperatureCoupledBase::K() const")
167 << "Unimplemented method " << method_ << endl
168 << "Please set 'K' to one of " << KMethodTypeNames_.toc()
169 << " and 'KName' to the name of the volScalar"
170 << " or volSymmTensor field (if K=lookup)"
175 return scalarField(0);
179 void Foam::temperatureCoupledBase::write(Ostream& os) const
181 os.writeKeyword("K") << KMethodTypeNames_[method_]
182 << token::END_STATEMENT << nl;
183 os.writeKeyword("KName") << KName_ << token::END_STATEMENT << nl;
187 // ************************************************************************* //