fixed writing out entries in advective bc
[OpenFOAM-1.6-ext.git] / src / finiteVolume / fields / fvPatchFields / derived / fixedNormalSlip / fixedNormalSlipFvPatchField.C
blobcbfc0e804e9faaee4087dcd14703bd3f71bca01d
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
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 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
19     for more details.
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 "fixedNormalSlipFvPatchField.H"
28 #include "symmTransformField.H"
30 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 namespace Foam
35 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
37 template<class Type>
38 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
40     const fvPatch& p,
41     const DimensionedField<Type, volMesh>& iF
44     transformFvPatchField<Type>(p, iF),
45     fixedValue_(p.size(), pTraits<Type>::zero)
49 template<class Type>
50 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
52     const fixedNormalSlipFvPatchField<Type>& ptf,
53     const fvPatch& p,
54     const DimensionedField<Type, volMesh>& iF,
55     const fvPatchFieldMapper& mapper
58     transformFvPatchField<Type>(ptf, p, iF, mapper),
59     fixedValue_(ptf.fixedValue_, mapper)
63 template<class Type>
64 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
66     const fvPatch& p,
67     const DimensionedField<Type, volMesh>& iF,
68     const dictionary& dict
71     transformFvPatchField<Type>(p, iF),
72     fixedValue_("fixedValue", dict, p.size())
74     evaluate();
78 template<class Type>
79 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
81     const fixedNormalSlipFvPatchField<Type>& ptf
84     transformFvPatchField<Type>(ptf),
85     fixedValue_(ptf.fixedValue_)
89 template<class Type>
90 fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
92     const fixedNormalSlipFvPatchField<Type>& ptf,
93     const DimensionedField<Type, volMesh>& iF
96     transformFvPatchField<Type>(ptf, iF),
97     fixedValue_(ptf.fixedValue_)
101 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
103 template<class Type>
104 void fixedNormalSlipFvPatchField<Type>::autoMap
106     const fvPatchFieldMapper& m
109     transformFvPatchField<Type>::autoMap(m);
110     fixedValue_.autoMap(m);
114 template<class Type>
115 void fixedNormalSlipFvPatchField<Type>::rmap
117     const fvPatchField<Type>& ptf,
118     const labelList& addr
121     transformFvPatchField<Type>::rmap(ptf, addr);
123     const fixedNormalSlipFvPatchField<Type>& dmptf =
124         refCast<const fixedNormalSlipFvPatchField<Type> >(ptf);
126     fixedValue_.rmap(dmptf.fixedValue_, addr);
130 template<class Type>
131 tmp<Field<Type> > fixedNormalSlipFvPatchField<Type>::snGrad() const
133     vectorField nHat = this->patch().nf();
134     Field<Type> pif = this->patchInternalField();
136     return
137     (
138         (nHat*(nHat & fixedValue_) + transform(I - sqr(nHat), pif)) - pif
139     )*this->patch().deltaCoeffs();
143 template<class Type>
144 void fixedNormalSlipFvPatchField<Type>::evaluate(const Pstream::commsTypes)
146     if (!this->updated())
147     {
148         this->updateCoeffs();
149     }
151     vectorField nHat = this->patch().nf();
153     Field<Type>::operator=
154     (
155         nHat*(nHat & fixedValue_)
156       + transform(I - sqr(nHat), this->patchInternalField())
157     );
159     transformFvPatchField<Type>::evaluate();
163 template<class Type>
164 tmp<Field<Type> >
165 fixedNormalSlipFvPatchField<Type>::snGradTransformDiag() const
167     vectorField nHat = this->patch().nf();
168     vectorField diag(nHat.size());
170     diag.replace(vector::X, mag(nHat.component(vector::X)));
171     diag.replace(vector::Y, mag(nHat.component(vector::Y)));
172     diag.replace(vector::Z, mag(nHat.component(vector::Z)));
174     return transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
178 template<class Type>
179 void fixedNormalSlipFvPatchField<Type>::write(Ostream& os) const
181     transformFvPatchField<Type>::write(os);
182     fixedValue_.writeEntry("fixedValue", os);
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 } // End namespace Foam
190 // ************************************************************************* //