1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
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 "fixedTemperature.H"
27 #include "addToRunTimeSelectionTable.H"
28 #include "basicThermo.H"
29 #include "volFields.H"
30 #include "fvMatrices.H"
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
38 defineTypeNameAndDebug(fixedTemperature, 0);
40 addToRunTimeSelectionTable
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
52 Foam::porousMedia::fixedTemperature::fixedTemperature(const porousZone& pZone)
55 T_(readScalar(thermalCoeffs_.lookup("T")))
59 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
61 Foam::porousMedia::fixedTemperature::~fixedTemperature()
65 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
67 void Foam::porousMedia::fixedTemperature::addEnthalpySource
69 const basicThermo& thermo,
70 const volScalarField& rho,
74 const labelList& zones = pZone_.zoneIds();
75 if (zones.empty() || T_ < 0.0)
80 const fvMesh& mesh = pZone_.mesh();
81 const scalarField& V = mesh.V();
82 scalarField& hDiag = hEqn.diag();
83 scalarField& hSource = hEqn.source();
85 // TODO: generalize for non-fixedTemperature methods
86 const scalar rate = 1e6;
90 const labelList& cells = mesh.cellZones()[zones[zoneI]];
94 hDiag[cells[i]] += rate*V[cells[i]]*rho[cells[i]];
95 hSource[cells[i]] += rate*V[cells[i]]*rho[cells[i]]*T_;
101 // ************************************************************************* //