Transferred copyright to the OpenFOAM Foundation
[OpenFOAM-2.0.x.git] / src / regionModels / pyrolysisModels / pyrolysisModel / pyrolysisModel.C
blob05c684c0430d41d7cb08ba41a201c396ce862abf
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 "pyrolysisModel.H"
27 #include "fvMesh.H"
28 #include "directMappedFieldFvPatchField.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
34 namespace regionModels
36 namespace pyrolysisModels
39 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
41 defineTypeNameAndDebug(pyrolysisModel, 0);
42 defineRunTimeSelectionTable(pyrolysisModel, mesh);
44 // * * * * * * * * * * * * Private Member Functions  * * * * * * * * * * * * //
46 void pyrolysisModel::constructMeshObjects()
48     // construct filmDelta field if coupled to film model
49     if (filmCoupled_)
50     {
51         filmDeltaPtr_.reset
52         (
53             new volScalarField
54             (
55                 IOobject
56                 (
57                     "filmDelta",
58                     time_.timeName(),
59                     regionMesh(),
60                     IOobject::MUST_READ,
61                     IOobject::AUTO_WRITE
62                 ),
63                 regionMesh()
64             )
65         );
67         const volScalarField& filmDelta = filmDeltaPtr_();
69         bool foundCoupledPatch = false;
70         forAll(filmDelta.boundaryField(), patchI)
71         {
72             const fvPatchField<scalar>& fvp = filmDelta.boundaryField()[patchI];
73             if (isA<directMappedFieldFvPatchField<scalar> >(fvp))
74             {
75                 foundCoupledPatch = true;
76                 break;
77             }
78         }
80         if (!foundCoupledPatch)
81         {
82             WarningIn("void pyrolysisModels::constructMeshObjects()")
83                 << "filmCoupled flag set to true, but no "
84                 << directMappedFieldFvPatchField<scalar>::typeName
85                 << " patches found on " << filmDelta.name() << " field"
86                 << endl;
87         }
88     }
92 // * * * * * * * * * * * * Protected Member Functions  * * * * * * * * * * * //
94 bool pyrolysisModel::read()
96     if (regionModel1D::read())
97     {
98         filmCoupled_ = readBool(coeffs_.lookup("filmCoupled"));
99         reactionDeltaMin_ =
100             coeffs_.lookupOrDefault<scalar>("reactionDeltaMin", 0.0);
102         return true;
103     }
104     else
105     {
106         return false;
107     }
111 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
113 pyrolysisModel::pyrolysisModel(const fvMesh& mesh)
115     regionModel1D(mesh),
116     filmCoupled_(false),
117     filmDeltaPtr_(NULL),
118     reactionDeltaMin_(0.0)
122 pyrolysisModel::pyrolysisModel(const word& modelType, const fvMesh& mesh)
124     regionModel1D(mesh, "pyrolysis", modelType),
125     filmCoupled_(false),
126     filmDeltaPtr_(NULL),
127     reactionDeltaMin_(0.0)
129     if (active_)
130     {
131         read();
132         constructMeshObjects();
133     }
137 // * * * * * * * * * * * * * * * * Destructor  * * * * * * * * * * * * * * * //
139 pyrolysisModel::~pyrolysisModel()
143 // * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * * //
145 scalar pyrolysisModel::addMassSources
147     const label patchI,
148     const label faceI
151     return 0.0;
155 void pyrolysisModel::preEvolveRegion()
157     if (filmCoupled_)
158     {
159         filmDeltaPtr_->correctBoundaryConditions();
160     }
164 scalar pyrolysisModel::solidRegionDiffNo() const
166     return VSMALL;
170 scalar pyrolysisModel::maxDiff() const
172     return GREAT;
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
178 } // End namespace surfaceFilmModels
179 } // End namespace regionModels
180 } // End namespace Foam
182 // ************************************************************************* //