1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
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
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
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 * * * * * * * * * * * * * * //
33 Foam::basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
36 const DimensionedField<Type, volMesh>& iF
39 transformFvPatchField<Type>(p, iF)
44 Foam::basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
46 const basicSymmetryFvPatchField<Type>& ptf,
48 const DimensionedField<Type, volMesh>& iF,
49 const fvPatchFieldMapper& mapper
52 transformFvPatchField<Type>(ptf, p, iF, mapper)
57 Foam::basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
60 const DimensionedField<Type, volMesh>& iF,
61 const dictionary& dict
64 transformFvPatchField<Type>(p, iF, dict)
71 Foam::basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
73 const basicSymmetryFvPatchField<Type>& ptf
76 transformFvPatchField<Type>(ptf)
81 Foam::basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
83 const basicSymmetryFvPatchField<Type>& ptf,
84 const DimensionedField<Type, volMesh>& iF
87 transformFvPatchField<Type>(ptf, iF)
91 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
94 Foam::tmp<Foam::Field<Type> >
95 Foam::basicSymmetryFvPatchField<Type>::snGrad() const
97 tmp<vectorField> nHat = this->patch().nf();
101 transform(I - 2.0*sqr(nHat), this->patchInternalField())
102 - this->patchInternalField()
103 )*(this->patch().deltaCoeffs()/2.0);
108 void Foam::basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes)
110 if (!this->updated())
112 this->updateCoeffs();
115 tmp<vectorField> nHat = this->patch().nf();
117 Field<Type>::operator=
120 this->patchInternalField()
121 + transform(I - 2.0*sqr(nHat), this->patchInternalField())
125 transformFvPatchField<Type>::evaluate();
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 // ************************************************************************* //