BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / derived / fixedNormalSlip / fixedNormalSlipFvPatchField.C
blobdb06a2a0033fc84fdd554bf68220f226d6e6b354
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 "fixedNormalSlipFvPatchField.H"
27 #include "symmTransformField.H"
30 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
32 template<class Type>
33 Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
35     const fvPatch& p,
36     const DimensionedField<Type, volMesh>& iF
39     transformFvPatchField<Type>(p, iF),
40     fixedValue_(p.size(), pTraits<Type>::zero)
44 template<class Type>
45 Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
47     const fixedNormalSlipFvPatchField<Type>& ptf,
48     const fvPatch& p,
49     const DimensionedField<Type, volMesh>& iF,
50     const fvPatchFieldMapper& mapper
53     transformFvPatchField<Type>(ptf, p, iF, mapper),
54     fixedValue_(ptf.fixedValue_, mapper)
58 template<class Type>
59 Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
61     const fvPatch& p,
62     const DimensionedField<Type, volMesh>& iF,
63     const dictionary& dict
66     transformFvPatchField<Type>(p, iF),
67     fixedValue_("fixedValue", dict, p.size())
69     evaluate();
73 template<class Type>
74 Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
76     const fixedNormalSlipFvPatchField<Type>& ptf
79     transformFvPatchField<Type>(ptf),
80     fixedValue_(ptf.fixedValue_)
84 template<class Type>
85 Foam::fixedNormalSlipFvPatchField<Type>::fixedNormalSlipFvPatchField
87     const fixedNormalSlipFvPatchField<Type>& ptf,
88     const DimensionedField<Type, volMesh>& iF
91     transformFvPatchField<Type>(ptf, iF),
92     fixedValue_(ptf.fixedValue_)
96 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
98 template<class Type>
99 void Foam::fixedNormalSlipFvPatchField<Type>::autoMap
101     const fvPatchFieldMapper& m
104     transformFvPatchField<Type>::autoMap(m);
105     fixedValue_.autoMap(m);
109 template<class Type>
110 void Foam::fixedNormalSlipFvPatchField<Type>::rmap
112     const fvPatchField<Type>& ptf,
113     const labelList& addr
116     transformFvPatchField<Type>::rmap(ptf, addr);
118     const fixedNormalSlipFvPatchField<Type>& dmptf =
119         refCast<const fixedNormalSlipFvPatchField<Type> >(ptf);
121     fixedValue_.rmap(dmptf.fixedValue_, addr);
125 template<class Type>
126 Foam::tmp<Foam::Field<Type> >
127 Foam::fixedNormalSlipFvPatchField<Type>::snGrad() const
129     const vectorField nHat(this->patch().nf());
130     const Field<Type> pif(this->patchInternalField());
132     return
133     (
134         (nHat*(nHat & fixedValue_) + transform(I - sqr(nHat), pif)) - pif
135     )*this->patch().deltaCoeffs();
139 template<class Type>
140 void Foam::fixedNormalSlipFvPatchField<Type>::evaluate
142     const Pstream::commsTypes
145     if (!this->updated())
146     {
147         this->updateCoeffs();
148     }
150     const vectorField nHat(this->patch().nf());
152     Field<Type>::operator=
153     (
154         nHat*(nHat & fixedValue_)
155       + transform(I - sqr(nHat), this->patchInternalField())
156     );
158     transformFvPatchField<Type>::evaluate();
162 template<class Type>
163 Foam::tmp<Foam::Field<Type> >
164 Foam::fixedNormalSlipFvPatchField<Type>::snGradTransformDiag() const
166     const vectorField nHat(this->patch().nf());
167     vectorField diag(nHat.size());
169     diag.replace(vector::X, mag(nHat.component(vector::X)));
170     diag.replace(vector::Y, mag(nHat.component(vector::Y)));
171     diag.replace(vector::Z, mag(nHat.component(vector::Z)));
173     return transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
177 template<class Type>
178 void Foam::fixedNormalSlipFvPatchField<Type>::write(Ostream& os) const
180     transformFvPatchField<Type>::write(os);
181     fixedValue_.writeEntry("fixedValue", os);
185 // ************************************************************************* //