symmetryPlaneFvPatchField.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2013-2016 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26\*---------------------------------------------------------------------------*/
27
29
30
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
33template<class Type>
35(
36 const fvPatch& p,
38)
39:
41 symmetryPlanePatch_(refCast<const symmetryPlaneFvPatch>(p))
42{}
43
44
45template<class Type>
47(
49 const fvPatch& p,
51 const fvPatchFieldMapper& mapper
52)
53:
54 basicSymmetryFvPatchField<Type>(ptf, p, iF, mapper),
55 symmetryPlanePatch_(refCast<const symmetryPlaneFvPatch>(p))
56{
57 if (!isType<symmetryPlaneFvPatch>(this->patch()))
58 {
60 << "' not constraint type '" << typeName << "'"
61 << "\n for patch " << p.name()
62 << " of field " << this->internalField().name()
63 << " in file " << this->internalField().objectPath()
64 << exit(FatalError);
65 }
66}
67
68
69template<class Type>
71(
72 const fvPatch& p,
74 const dictionary& dict
75)
76:
78 symmetryPlanePatch_(refCast<const symmetryPlaneFvPatch>(p, dict))
79{
80 if (!isType<symmetryPlaneFvPatch>(p))
81 {
83 << "\n patch type '" << p.type()
84 << "' not constraint type '" << typeName << "'"
85 << "\n for patch " << p.name()
86 << " of field " << this->internalField().name()
87 << " in file " << this->internalField().objectPath()
89 }
90}
91
92
93template<class Type>
95(
97)
98:
100 symmetryPlanePatch_(ptf.symmetryPlanePatch_)
101{}
102
103
104template<class Type>
106(
109)
110:
111 basicSymmetryFvPatchField<Type>(ptf, iF),
112 symmetryPlanePatch_(ptf.symmetryPlanePatch_)
113{}
114
115
116// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
117
118template<class Type>
121{
122 vector nHat(symmetryPlanePatch_.n());
123
124 const Field<Type> iF(this->patchInternalField());
125
126 return
127 (transform(I - 2.0*sqr(nHat), iF) - iF)
128 *(this->patch().deltaCoeffs()/2.0);
129}
130
131
132template<class Type>
134{
135 if (!this->updated())
136 {
137 this->updateCoeffs();
138 }
139
140 vector nHat(symmetryPlanePatch_.n());
141
142 const Field<Type> iF(this->patchInternalField());
143
145 (
146 (iF + transform(I - 2.0*sqr(nHat), iF))/2.0
147 );
148
150}
151
152
153template<class Type>
156{
157 vector nHat(symmetryPlanePatch_.n());
158
159 const vector diag
160 (
161 mag(nHat.component(vector::X)),
162 mag(nHat.component(vector::Y)),
163 mag(nHat.component(vector::Z))
164 );
165
166 return tmp<Field<Type>>
167 (
168 new Field<Type>
169 (
170 this->size(),
171 transformMask<Type>
172 (
173 //pow<vector, pTraits<Type>::rank>(diag)
174 pow
175 (
176 diag,
178 ::type>::zero
179 )
180 )
181 )
182 );
183}
184
185
186// ************************************************************************* //
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static const char *const typeName
Typename for Field.
Definition: FieldBase.H:59
Generic templated field type.
Definition: Field.H:82
void evaluate()
Evaluate boundary conditions.
const word & name() const noexcept
Return the object name.
Definition: IOobjectI.H:65
commsTypes
Types of communications.
Definition: UPstream.H:67
const Cmpt & component(const direction) const
Definition: VectorSpaceI.H:87
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A FieldMapper for finite-volume patch fields.
const DimensionedField< Type, volMesh > & internalField() const
Return dimensioned internal field reference.
Definition: fvPatchField.H:368
const fvPatch & patch() const
Return patch.
Definition: fvPatchField.H:362
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:71
virtual const word & name() const
Return name.
Definition: fvPatch.H:173
A traits class, which is primarily used for primitives.
Definition: pTraits.H:59
This boundary condition enforces a symmetryPlane constraint.
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
virtual tmp< Field< Type > > snGradTransformDiag() const
Return face-gradient transform diagonal.
A class for managing temporary objects.
Definition: tmp.H:65
volScalarField & p
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:473
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:131
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static const Identity< scalar > I
Definition: Identity.H:94
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: MSwindows.C:598
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
IOerror FatalIOError
error FatalError
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
dictionary dict