ENH: autoLayerDriver: better layering information message
[OpenFOAM-2.0.x.git] / src / thermophysicalModels / basicSolidThermo / isotropicKSolidThermo / isotropicKSolidThermo.C
blob7a8b659b88dd5bb784c8ebd9abd090457d21d9d4
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2011 OpenFOAM Foundation
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 "isotropicKSolidThermo.H"
27 #include "addToRunTimeSelectionTable.H"
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
31 namespace Foam
33     defineTypeNameAndDebug(isotropicKSolidThermo, 0);
34     addToRunTimeSelectionTable
35     (
36         basicSolidThermo,
37         isotropicKSolidThermo,
38         mesh
39     );
41     addToRunTimeSelectionTable
42     (
43         basicSolidThermo,
44         isotropicKSolidThermo,
45         dictionary
46     );
51 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
53 Foam::isotropicKSolidThermo::isotropicKSolidThermo
55     const fvMesh& mesh,
56     const dictionary& dict
59     interpolatedSolidThermo(mesh, typeName + "Coeffs", dict),
60     K_
61     (
62         IOobject
63         (
64             "K",
65             mesh.time().timeName(),
66             mesh,
67             IOobject::NO_READ,
68             IOobject::NO_WRITE
69         ),
70         mesh,
71         dimEnergy/dimTime/(dimLength*dimTemperature)
72     ),
73     KValues_ (Field<scalar>(subDict(typeName + "Coeffs").lookup("KValues")))
75     correct();
79 Foam::isotropicKSolidThermo::isotropicKSolidThermo(const fvMesh& mesh)
81     interpolatedSolidThermo(mesh, typeName + "Coeffs"),
82     K_
83     (
84         IOobject
85         (
86             "K",
87             mesh.time().timeName(),
88             mesh,
89             IOobject::NO_READ,
90             IOobject::NO_WRITE
91         ),
92         mesh,
93         dimEnergy/dimTime/(dimLength*dimTemperature)
94     ),
95     KValues_ (Field<scalar>(subDict(typeName + "Coeffs").lookup("KValues")))
97     correct();
101 void Foam::isotropicKSolidThermo::correct()
104     // Correct K
105     K_.internalField() = interpolateXY
106     (
107         T_.internalField(),
108         TValues_,
109         KValues_
110     );
112     forAll(K_.boundaryField(), patchI)
113     {
114         K_.boundaryField()[patchI] == this->K(patchI)();
115     }
117     interpolatedSolidThermo::calculate();
121 Foam::tmp<Foam::scalarField> Foam::isotropicKSolidThermo::K
123     const label patchI
124 ) const
127     return tmp<scalarField>
128     (
129         new scalarField
130         (
131             interpolateXY
132             (
133                 T_.boundaryField()[patchI],
134                 TValues_,
135                 KValues_
136             )
137         )
138     );
142 bool Foam::isotropicKSolidThermo::read()
144     KValues_  = Field<scalar>(subDict(typeName + "Coeffs").lookup("KValues"));
145     return true;
149 bool Foam::isotropicKSolidThermo::writeData(Ostream& os) const
151     os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl;
152     bool ok = interpolatedSolidThermo::writeData(os);
154     return ok && os.good();
157 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
159 Foam::isotropicKSolidThermo::~isotropicKSolidThermo()
163 // ************************************************************************* //