1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
24 \*---------------------------------------------------------------------------*/
26 #include "fluxFvPatchField.H"
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 fluxFvPatchField<Type>::fluxFvPatchField
39 const DimensionedField<Type, volMesh>& iF
42 fixedGradientFvPatchField<Type>(p, iF),
43 flux_(p.size(), pTraits<Type>::zero),
44 reactivity_(p.size(), 0),
47 this->gradient() = pTraits<Type>::zero;
52 fluxFvPatchField<Type>::fluxFvPatchField
55 const DimensionedField<Type, volMesh>& iF,
56 const dictionary& dict
59 fixedGradientFvPatchField<Type>(p, iF),
60 flux_("flux", dict, p.size()),
61 reactivity_("reactivity", dict, p.size()),
62 gammaName_(dict.lookup("gamma"))
65 this->gradient() = pTraits<Type>::zero;
67 // Read the value entry from the dictionary
68 if (dict.found("value"))
70 fvPatchField<Type>::operator=
72 Field<Type>("value", dict, p.size())
79 "fluxFvPatchField<Type>::fluxFvPatchField"
82 "const DimensionedField<Type, volMesh>& iF,"
83 "const dictionary& dict,"
84 "const bool valueRequired"
87 ) << "Essential entry 'value' missing"
88 << exit(FatalIOError);
94 fluxFvPatchField<Type>::fluxFvPatchField
96 const fluxFvPatchField<Type>& ptf,
98 const DimensionedField<Type, volMesh>& iF,
99 const fvPatchFieldMapper& mapper
102 fixedGradientFvPatchField<Type>(ptf, p, iF, mapper),
104 reactivity_(ptf.reactivity_),
105 gammaName_(ptf.gammaName_)
110 fluxFvPatchField<Type>::fluxFvPatchField
112 const fluxFvPatchField<Type>& ptf
115 fixedGradientFvPatchField<Type>(ptf),
117 reactivity_(ptf.reactivity_),
118 gammaName_(ptf.gammaName_)
123 fluxFvPatchField<Type>::fluxFvPatchField
125 const fluxFvPatchField<Type>& ptf,
126 const DimensionedField<Type, volMesh>& iF
129 fixedGradientFvPatchField<Type>(ptf, iF),
131 reactivity_(ptf.reactivity_),
132 gammaName_(ptf.gammaName_)
136 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
139 void fluxFvPatchField<Type>::updateCoeffs()
146 const fvPatchField<scalar>& gammap =
147 this->lookupPatchField
150 reinterpret_cast<const volScalarField*>(NULL),
151 reinterpret_cast<const scalar*>(NULL)
154 this->gradient() = reactivity_*flux_/gammap;
156 fixedGradientFvPatchField<Type>::updateCoeffs();
161 void fluxFvPatchField<Type>::write(Ostream& os) const
163 fixedGradientFvPatchField<Type>::write(os);
164 flux_.writeEntry("flux", os);
165 reactivity_.writeEntry("reactivity", os);
166 this->writeEntry("value", os);
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 } // End namespace Foam
174 // ************************************************************************* //