1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright held by original author
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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "fluxFvPatchField.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 fluxFvPatchField<Type>::fluxFvPatchField
40 const DimensionedField<Type, volMesh>& iF
43 fixedGradientFvPatchField<Type>(p, iF),
47 this->gradient() = pTraits<Type>::zero;
52 fluxFvPatchField<Type>::fluxFvPatchField
54 const fluxFvPatchField<Type>& ptf,
56 const DimensionedField<Type, volMesh>& iF,
57 const fvPatchFieldMapper& mapper
60 fixedGradientFvPatchField<Type>(ptf, p, iF, mapper),
61 reactivity_(ptf.reactivity_),
62 gammaName_(ptf.gammaName_)
67 fluxFvPatchField<Type>::fluxFvPatchField
70 const DimensionedField<Type, volMesh>& iF,
71 const dictionary& dict
74 fixedGradientFvPatchField<Type>(p, iF),
75 reactivity_(readScalar(dict.lookup("reactivity"))),
76 gammaName_(dict.lookup("gamma"))
79 this->gradient() = pTraits<Type>::zero;
81 // Read the value entry from the dictionary
82 if (dict.found("value"))
84 fvPatchField<Type>::operator=
86 Field<Type>("value", dict, p.size())
93 "fluxFvPatchField<Type>::fluxFvPatchField"
96 "const DimensionedField<Type, volMesh>& iF,"
97 "const dictionary& dict,"
98 "const bool valueRequired"
101 ) << "Essential entry 'value' missing"
102 << exit(FatalIOError);
108 fluxFvPatchField<Type>::fluxFvPatchField
110 const fluxFvPatchField<Type>& ptf
113 fixedGradientFvPatchField<Type>(ptf),
114 reactivity_(ptf.reactivity_),
115 gammaName_(ptf.gammaName_)
120 fluxFvPatchField<Type>::fluxFvPatchField
122 const fluxFvPatchField<Type>& ptf,
123 const DimensionedField<Type, volMesh>& iF
126 fixedGradientFvPatchField<Type>(ptf, iF),
127 reactivity_(ptf.reactivity_),
128 gammaName_(ptf.gammaName_)
132 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
135 void fluxFvPatchField<Type>::updateCoeffs()
142 const Field<Type>& C = *this;
144 const fvPatchField<scalar>& gammap =
145 this->patch().lookupPatchField
148 reinterpret_cast<const volScalarField*>(NULL),
149 reinterpret_cast<const scalar*>(NULL)
152 this->gradient() = reactivity_*C/gammap;
154 fixedGradientFvPatchField<Type>::updateCoeffs();
159 void fluxFvPatchField<Type>::write(Ostream& os) const
161 fixedGradientFvPatchField<Type>::write(os);
162 os.writeKeyword("reactivity")
163 << reactivity_ << token::END_STATEMENT << nl;
164 os.writeKeyword("gamma")
165 << gammaName_ << token::END_STATEMENT << nl;
166 this->writeEntry("value", os);
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 } // End namespace Foam
174 // ************************************************************************* //