BUG: UListIO: byteSize overflowing on really big faceLists
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / derived / partialSlip / partialSlipFvPatchField.C
blob1c4a891b05cb01906bddca46761b08dd59c9a4b1
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 "partialSlipFvPatchField.H"
27 #include "symmTransformField.H"
29 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
31 template<class Type>
32 Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
34     const fvPatch& p,
35     const DimensionedField<Type, volMesh>& iF
38     transformFvPatchField<Type>(p, iF),
39     valueFraction_(p.size(), 1.0)
43 template<class Type>
44 Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
46     const partialSlipFvPatchField<Type>& ptf,
47     const fvPatch& p,
48     const DimensionedField<Type, volMesh>& iF,
49     const fvPatchFieldMapper& mapper
52     transformFvPatchField<Type>(ptf, p, iF, mapper),
53     valueFraction_(ptf.valueFraction_, mapper)
57 template<class Type>
58 Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
60     const fvPatch& p,
61     const DimensionedField<Type, volMesh>& iF,
62     const dictionary& dict
65     transformFvPatchField<Type>(p, iF),
66     valueFraction_("valueFraction", dict, p.size())
68     evaluate();
72 template<class Type>
73 Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
75     const partialSlipFvPatchField<Type>& ptf
78     transformFvPatchField<Type>(ptf),
79     valueFraction_(ptf.valueFraction_)
83 template<class Type>
84 Foam::partialSlipFvPatchField<Type>::partialSlipFvPatchField
86     const partialSlipFvPatchField<Type>& ptf,
87     const DimensionedField<Type, volMesh>& iF
90     transformFvPatchField<Type>(ptf, iF),
91     valueFraction_(ptf.valueFraction_)
95 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
97 template<class Type>
98 void Foam::partialSlipFvPatchField<Type>::autoMap
100     const fvPatchFieldMapper& m
103     transformFvPatchField<Type>::autoMap(m);
104     valueFraction_.autoMap(m);
108 template<class Type>
109 void Foam::partialSlipFvPatchField<Type>::rmap
111     const fvPatchField<Type>& ptf,
112     const labelList& addr
115     transformFvPatchField<Type>::rmap(ptf, addr);
117     const partialSlipFvPatchField<Type>& dmptf =
118         refCast<const partialSlipFvPatchField<Type> >(ptf);
120     valueFraction_.rmap(dmptf.valueFraction_, addr);
124 template<class Type>
125 Foam::tmp<Foam::Field<Type> >
126 Foam::partialSlipFvPatchField<Type>::snGrad() const
128     tmp<vectorField> nHat = this->patch().nf();
129     const Field<Type> pif(this->patchInternalField());
131     return
132     (
133         (1.0 - valueFraction_)*transform(I - sqr(nHat), pif) - pif
134     )*this->patch().deltaCoeffs();
138 template<class Type>
139 void Foam::partialSlipFvPatchField<Type>::evaluate
141     const Pstream::commsTypes
144     if (!this->updated())
145     {
146         this->updateCoeffs();
147     }
149     tmp<vectorField> nHat = this->patch().nf();
151     Field<Type>::operator=
152     (
153         (1.0 - valueFraction_)
154        *transform(I - sqr(nHat), this->patchInternalField())
155     );
157     transformFvPatchField<Type>::evaluate();
161 template<class Type>
162 Foam::tmp<Foam::Field<Type> >
163 Foam::partialSlipFvPatchField<Type>::snGradTransformDiag() const
165     const vectorField nHat(this->patch().nf());
166     vectorField diag(nHat.size());
168     diag.replace(vector::X, mag(nHat.component(vector::X)));
169     diag.replace(vector::Y, mag(nHat.component(vector::Y)));
170     diag.replace(vector::Z, mag(nHat.component(vector::Z)));
172     return
173         valueFraction_*pTraits<Type>::one
174       + (1.0 - valueFraction_)
175        *transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
179 template<class Type>
180 void Foam::partialSlipFvPatchField<Type>::write(Ostream& os) const
182     transformFvPatchField<Type>::write(os);
183     valueFraction_.writeEntry("valueFraction", os);
187 // ************************************************************************* //