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 -------------------------------------------------------------------------------
10 License
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 
33 template<class Type>
35 (
36  const fvPatch& p,
38 )
39 :
41  symmetryPlanePatch_(refCast<const symmetryPlaneFvPatch>(p))
42 {}
43 
44 
45 template<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 
69 template<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()
88  << exit(FatalIOError);
89  }
90 }
91 
92 
93 template<class Type>
95 (
97 )
98 :
100  symmetryPlanePatch_(ptf.symmetryPlanePatch_)
101 {}
102 
103 
104 template<class Type>
106 (
109 )
110 :
112  symmetryPlanePatch_(ptf.symmetryPlanePatch_)
113 {}
114 
115 
116 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
117 
118 template<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 
132 template<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 
153 template<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 // ************************************************************************* //
Foam::symmetryPlaneFvPatchField::symmetryPlaneFvPatchField
symmetryPlaneFvPatchField(const fvPatch &, const DimensionedField< Type, volMesh > &)
Construct from patch and internal field.
Definition: symmetryPlaneFvPatchField.C:35
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::symmetryPlaneFvPatchField::snGrad
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
Definition: symmetryPlaneFvPatchField.C:120
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:61
Foam::diag
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
Definition: pointPatchFieldFunctions.H:287
Foam::FatalIOError
IOerror FatalIOError
Foam::symmetryPlaneFvPatchField::snGradTransformDiag
virtual tmp< Field< Type > > snGradTransformDiag() const
Return face-gradient transform diagonal.
Definition: symmetryPlaneFvPatchField.C:155
Foam::basicSymmetryFvPatchField
A symmetry patch.
Definition: basicSymmetryFvPatchField.H:55
Foam::transform
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:521
symmetryPlaneFvPatchField.H
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::fvPatch
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:65
Foam::pow
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Definition: dimensionedScalar.C:75
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::powProduct
Definition: products.H:162
Y
PtrList< volScalarField > & Y
Definition: createFieldRefs.H:7
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:130
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:69
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:453
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:51
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::Vector< scalar >
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition: pTraits.H:56
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Foam::roots::type
type
Types of root.
Definition: Roots.H:54
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:473
Foam::fvPatchFieldMapper
Foam::fvPatchFieldMapper.
Definition: fvPatchFieldMapper.H:47
Foam::symmetryPlaneFvPatchField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
Definition: symmetryPlaneFvPatchField.C:133
Foam::symmetryPlaneFvPatchField
This boundary condition enforces a symmetryPlane constraint.
Definition: symmetryPlaneFvPatchField.H:67
Foam::I
static const Identity< scalar > I
Definition: Identity.H:95
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:54
Foam::zero
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
Definition: zero.H:62
Foam::stringOps::evaluate
string evaluate(label fieldWidth, const std::string &s, size_t pos=0, size_t len=std::string::npos)
String evaluation with specified (positive, non-zero) field width.
Definition: stringOpsEvaluate.C:37