Newer
Older
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2010 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 "temperatureCoupledBase.H"
#include "volFields.H"
#include "basicSolidThermo.H"
#include "turbulenceModel.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum
<
Foam::temperatureCoupledBase::KMethodType,
4
>::names[] =
{
"basicThermo",
"solidThermo",
"directionalSolidThermo",
"lookup"
};
}
const Foam::NamedEnum<Foam::temperatureCoupledBase::KMethodType, 4>
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
Foam::temperatureCoupledBase::KMethodTypeNames_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::temperatureCoupledBase::temperatureCoupledBase
(
const fvPatch& patch,
const word& calculationType,
const word& KName
)
:
patch_(patch),
method_(KMethodTypeNames_[calculationType]),
KName_(KName)
{}
Foam::temperatureCoupledBase::temperatureCoupledBase
(
const fvPatch& patch,
const dictionary& dict
)
:
patch_(patch),
method_(KMethodTypeNames_.read(dict.lookup("K"))),
KName_(dict.lookup("KName"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::scalarField> Foam::temperatureCoupledBase::K
(
const scalarField& Tp
) const
{
const fvMesh& mesh = patch_.boundaryMesh().mesh();
switch (method_)
{
case BASICTHERMO:
{
const compressible::turbulenceModel& model =
mesh.lookupObject<compressible::turbulenceModel>
(
"turbulenceModel"
);
model.alphaEff()().boundaryField()[patch_.index()]
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
*model.thermo().Cp(Tp, patch_.index());
}
break;
case SOLIDTHERMO:
{
const basicSolidThermo& thermo =
mesh.lookupObject<basicSolidThermo>
(
"solidThermophysicalProperties"
);
return thermo.K(patch_.index());
}
break;
case DIRECTIONALSOLIDTHERMO:
{
vectorField n = patch_.nf();
const basicSolidThermo& thermo =
mesh.lookupObject<basicSolidThermo>
(
"solidThermophysicalProperties"
);
return n & thermo.directionalK(patch_.index()) & n;
}
break;
case LOOKUP:
{
if (mesh.objectRegistry::foundObject<volScalarField>(KName_))
{
return patch_.lookupPatchField<volScalarField, scalar>(KName_);
}
else if
(
mesh.objectRegistry::foundObject<volSymmTensorField>(KName_)
)
{
const symmTensorField& KWall =
patch_.lookupPatchField<volSymmTensorField, scalar>(KName_);
vectorField n = patch_.nf();
return n & KWall & n;
}
else
{
FatalErrorIn("temperatureCoupledBase::K() const")
<< "Did not find field " << KName_
<< " on mesh " << mesh.name() << " patch " << patch_.name()
<< endl
<< "Please set 'K' to one of " << KMethodTypeNames_.toc()
<< " and 'KName' to the name of the volScalar"
<< " or volSymmTensor field (if K=lookup)"
<< exit(FatalError);
return scalarField(0);
}
}
default:
{
FatalErrorIn("temperatureCoupledBase::K() const")
<< "Unimplemented method " << method_ << endl
<< "Please set 'K' to one of " << KMethodTypeNames_.toc()
<< " and 'KName' to the name of the volScalar"
<< " or volSymmTensor field (if K=lookup)"
<< exit(FatalError);
}
break;
}
return scalarField(0);
}
void Foam::temperatureCoupledBase::write(Ostream& os) const
{
os.writeKeyword("K") << KMethodTypeNames_[method_]
<< token::END_STATEMENT << nl;
os.writeKeyword("KName") << KName_ << token::END_STATEMENT << nl;
}
// ************************************************************************* //