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 "inletOutletFaPatchField.H"
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
37 inletOutletFaPatchField<Type>::inletOutletFaPatchField
40 const DimensionedField<Type, areaMesh>& iF
43 mixedFaPatchField<Type>(p, iF),
46 this->refValue() = pTraits<Type>::zero;
47 this->refGrad() = pTraits<Type>::zero;
48 this->valueFraction() = 0.0;
53 inletOutletFaPatchField<Type>::inletOutletFaPatchField
55 const inletOutletFaPatchField<Type>& ptf,
57 const DimensionedField<Type, areaMesh>& iF,
58 const faPatchFieldMapper& mapper
61 mixedFaPatchField<Type>(ptf, p, iF, mapper),
62 phiName_(ptf.phiName_)
67 inletOutletFaPatchField<Type>::inletOutletFaPatchField
70 const DimensionedField<Type, areaMesh>& iF,
71 const dictionary& dict
74 mixedFaPatchField<Type>(p, iF),
77 this->refValue() = Field<Type>("inletValue", dict, p.size());
79 if (dict.found("value"))
81 faPatchField<Type>::operator=
83 Field<Type>("value", dict, p.size())
88 faPatchField<Type>::operator=(this->refValue());
91 this->refGrad() = pTraits<Type>::zero;
92 this->valueFraction() = 0.0;
94 if (dict.found("phi"))
96 dict.lookup("phi") >> phiName_;
102 inletOutletFaPatchField<Type>::inletOutletFaPatchField
104 const inletOutletFaPatchField<Type>& ptf
107 mixedFaPatchField<Type>(ptf),
108 phiName_(ptf.phiName_)
113 inletOutletFaPatchField<Type>::inletOutletFaPatchField
115 const inletOutletFaPatchField<Type>& ptf,
116 const DimensionedField<Type, areaMesh>& iF
119 mixedFaPatchField<Type>(ptf, iF),
120 phiName_(ptf.phiName_)
124 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
127 void inletOutletFaPatchField<Type>::updateCoeffs()
134 const Field<scalar>& phip = this->patch().lookupPatchField
137 reinterpret_cast<const edgeScalarField*>(NULL),
138 reinterpret_cast<const scalar*>(NULL)
141 this->valueFraction() = 1.0 - pos(phip);
143 mixedFaPatchField<Type>::updateCoeffs();
148 void inletOutletFaPatchField<Type>::write(Ostream& os) const
150 faPatchField<Type>::write(os);
151 if (phiName_ != "phi")
153 os.writeKeyword("phi")
154 << phiName_ << token::END_STATEMENT << nl;
156 this->refValue().writeEntry("inletValue", os);
157 this->writeEntry("value", os);
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 } // End namespace Foam
165 // ************************************************************************* //