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 "constSolidThermo.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 defineTypeNameAndDebug(constSolidThermo, 0);
34 addToRunTimeSelectionTable(basicSolidThermo, constSolidThermo, mesh);
35 addToRunTimeSelectionTable(basicSolidThermo, constSolidThermo, dictionary);
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 Foam::constSolidThermo::constSolidThermo
44 const dictionary& dict
47 basicSolidThermo(mesh, dict),
48 dict_(dict.subDict(typeName + "Coeffs")),
49 constK_(dimensionedScalar(dict_.lookup("K"))),
55 mesh.time().timeName(),
63 constRho_(dimensionedScalar(dict_.lookup("rho"))),
64 constCp_(dimensionedScalar(dict_.lookup("Cp"))),
65 constHf_(dimensionedScalar(dict_.lookup("Hf"))),
66 constEmissivity_(dimensionedScalar(dict_.lookup("emissivity"))),
67 constKappa_(dimensionedScalar(dict_.lookup("kappa"))),
68 constSigmaS_(dimensionedScalar(dict_.lookup("sigmaS")))
76 emissivity_ = constEmissivity_;
80 sigmaS_ = constSigmaS_;
84 Foam::constSolidThermo::constSolidThermo(const fvMesh& mesh)
86 basicSolidThermo(mesh),
87 dict_(subDict(typeName + "Coeffs")),
88 constK_(dimensionedScalar(dict_.lookup("K"))),
94 mesh.time().timeName(),
102 constRho_(dimensionedScalar(dict_.lookup("rho"))),
103 constCp_(dimensionedScalar(dict_.lookup("Cp"))),
104 constHf_(dimensionedScalar(dict_.lookup("Hf"))),
105 constEmissivity_(dimensionedScalar(dict_.lookup("emissivity"))),
106 constKappa_(dimensionedScalar(dict_.lookup("kappa"))),
107 constSigmaS_(dimensionedScalar(dict_.lookup("sigmaS")))
115 emissivity_ = constEmissivity_;
117 kappa_ = constKappa_;
119 sigmaS_ = constSigmaS_;
123 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
125 Foam::constSolidThermo::~constSolidThermo()
129 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
131 void Foam::constSolidThermo::correct()
135 Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::Cp() const
137 return tmp<volScalarField>
144 mesh_.time().timeName(),
156 const Foam::volScalarField& Foam::constSolidThermo::K() const
162 const Foam::volSymmTensorField& Foam::constSolidThermo::directionalK() const
164 dimensionedSymmTensor t
167 constK_.dimensions(),
178 return tmp<volSymmTensorField>
180 new volSymmTensorField
185 mesh_.time().timeName(),
197 Foam::tmp<Foam::volScalarField> Foam::constSolidThermo::Hf() const
199 return tmp<volScalarField>
206 mesh_.time().timeName(),
218 Foam::tmp<Foam::scalarField> Foam::constSolidThermo::rho
223 return tmp<scalarField>
227 T_.boundaryField()[patchI].size(),
234 Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Cp
239 return tmp<scalarField>
243 T_.boundaryField()[patchI].size(),
250 Foam::tmp<Foam::scalarField> Foam::constSolidThermo::K
255 return (K_.boundaryField()[patchI]);
259 Foam::tmp<Foam::symmTensorField> Foam::constSolidThermo::directionalK
273 return tmp<symmTensorField>
277 T_.boundaryField()[patchI].size(),
284 Foam::tmp<Foam::scalarField> Foam::constSolidThermo::Hf
289 return tmp<scalarField>
293 T_.boundaryField()[patchI].size(),
300 Foam::tmp<Foam::scalarField> Foam::constSolidThermo::emissivity
305 return tmp<scalarField>
309 T_.boundaryField()[patchI].size(),
310 constEmissivity_.value()
316 Foam::tmp<Foam::scalarField> Foam::constSolidThermo::kappa
321 return tmp<scalarField>
325 T_.boundaryField()[patchI].size(),
332 Foam::tmp<Foam::scalarField> Foam::constSolidThermo::sigmaS
337 return tmp<scalarField>
341 T_.boundaryField()[patchI].size(),
348 bool Foam::constSolidThermo::read()
350 return read(subDict(typeName + "Coeffs"));
354 bool Foam::constSolidThermo::read(const dictionary& dict)
356 constRho_ = dimensionedScalar(dict.lookup("rho"));
357 constCp_ = dimensionedScalar(dict.lookup("Cp"));
358 constK_ = dimensionedScalar(dict.lookup("K"));
359 constHf_ = dimensionedScalar(dict.lookup("Hf"));
360 constEmissivity_ = dimensionedScalar(dict.lookup("emissivity"));
361 constKappa_ = dimensionedScalar(dict_.lookup("kappa"));
362 constSigmaS_ = dimensionedScalar(dict_.lookup("sigmaS"));
364 Info<< "Constructed constSolidThermo with" << nl
365 << " rho : " << constRho_ << nl
366 << " Cp : " << constCp_ << nl
367 << " K : " << constK_ << nl
368 << " Hf : " << constHf_ << nl
369 << " emissivity : " << constEmissivity_ << nl
370 << " kappa : " << constKappa_ << nl
371 << " sigmaS : " << constSigmaS_ << nl
378 bool Foam::constSolidThermo::writeData(Ostream& os) const
380 bool ok = basicSolidThermo::writeData(os);
381 os.writeKeyword("rho") << constRho_ << token::END_STATEMENT << nl;
382 os.writeKeyword("Cp") << constCp_ << token::END_STATEMENT << nl;
383 os.writeKeyword("K") << constK_ << token::END_STATEMENT << nl;
384 os.writeKeyword("Hf") << constHf_ << token::END_STATEMENT << nl;
385 os.writeKeyword("kappa") << constKappa_ << token::END_STATEMENT << nl;
386 os.writeKeyword("sigmaS") << constSigmaS_ << token::END_STATEMENT << nl;
387 os.writeKeyword("emissivity") << constEmissivity_ << token::END_STATEMENT
389 return ok && os.good();
393 // * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * //
395 Foam::Ostream& Foam::operator<<(Ostream& os, const constSolidThermo& s)
402 // ************************************************************************* //