Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / finiteVolume / fields / fvPatchFields / basic / basicSymmetry / basicSymmetryFvPatchField.C
blob21f0d9f49ce230fb1160abd3e6d0c717936e0514
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2010 OpenCFD Ltd.
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 "basicSymmetryFvPatchField.H"
27 #include "symmTransformField.H"
30 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
32 template<class Type>
33 Foam::basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
35     const fvPatch& p,
36     const DimensionedField<Type, volMesh>& iF
39     transformFvPatchField<Type>(p, iF)
43 template<class Type>
44 Foam::basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
46     const basicSymmetryFvPatchField<Type>& ptf,
47     const fvPatch& p,
48     const DimensionedField<Type, volMesh>& iF,
49     const fvPatchFieldMapper& mapper
52     transformFvPatchField<Type>(ptf, p, iF, mapper)
56 template<class Type>
57 Foam::basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
59     const fvPatch& p,
60     const DimensionedField<Type, volMesh>& iF,
61     const dictionary& dict
64     transformFvPatchField<Type>(p, iF, dict)
66     this->evaluate();
70 template<class Type>
71 Foam::basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
73     const basicSymmetryFvPatchField<Type>& ptf
76     transformFvPatchField<Type>(ptf)
80 template<class Type>
81 Foam::basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
83     const basicSymmetryFvPatchField<Type>& ptf,
84     const DimensionedField<Type, volMesh>& iF
87     transformFvPatchField<Type>(ptf, iF)
91 // * * * * * * * * * * * * * * * Member Functions  * * * * * * * * * * * * * //
93 template<class Type>
94 Foam::tmp<Foam::Field<Type> >
95 Foam::basicSymmetryFvPatchField<Type>::snGrad() const
97     tmp<vectorField> nHat = this->patch().nf();
99     return
100     (
101         transform(I - 2.0*sqr(nHat), this->patchInternalField())
102       - this->patchInternalField()
103     )*(this->patch().deltaCoeffs()/2.0);
107 template<class Type>
108 void Foam::basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes)
110     if (!this->updated())
111     {
112         this->updateCoeffs();
113     }
115     tmp<vectorField> nHat = this->patch().nf();
117     Field<Type>::operator=
118     (
119         (
120             this->patchInternalField()
121           + transform(I - 2.0*sqr(nHat), this->patchInternalField())
122         )/2.0
123     );
125     transformFvPatchField<Type>::evaluate();
129 template<class Type>
130 Foam::tmp<Foam::Field<Type> >
131 Foam::basicSymmetryFvPatchField<Type>::snGradTransformDiag() const
133     const vectorField nHat(this->patch().nf());
135     vectorField diag(nHat.size());
137     diag.replace(vector::X, mag(nHat.component(vector::X)));
138     diag.replace(vector::Y, mag(nHat.component(vector::Y)));
139     diag.replace(vector::Z, mag(nHat.component(vector::Z)));
141     return transformFieldMask<Type>(pow<vector, pTraits<Type>::rank>(diag));
145 // ************************************************************************* //