symmetryPlanePointPatchField.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 | Copyright (C) 2013-2015 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 
28 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
29 
30 namespace Foam
31 {
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 template<class Type>
37 (
38  const pointPatch& p,
40 )
41 :
43  symmetryPlanePatch_(refCast<const symmetryPlanePointPatch>(p))
44 {}
45 
46 
47 template<class Type>
49 (
50  const pointPatch& p,
52  const dictionary& dict
53 )
54 :
56  symmetryPlanePatch_(refCast<const symmetryPlanePointPatch>(p))
57 {
58  if (!isType<symmetryPlanePointPatch>(p))
59  {
61  (
62  dict
63  ) << "patch " << this->patch().index() << " not symmetry type. "
64  << "Patch type = " << p.type()
65  << exit(FatalIOError);
66  }
67 }
68 
69 
70 template<class Type>
72 (
74  const pointPatch& p,
76  const pointPatchFieldMapper& mapper
77 )
78 :
79  basicSymmetryPointPatchField<Type>(ptf, p, iF, mapper),
80  symmetryPlanePatch_(refCast<const symmetryPlanePointPatch>(p))
81 {
82  if (!isType<symmetryPlanePointPatch>(this->patch()))
83  {
85  << "Field type does not correspond to patch type for patch "
86  << this->patch().index() << "." << endl
87  << "Field type: " << typeName << endl
88  << "Patch type: " << this->patch().type()
89  << exit(FatalError);
90  }
91 }
92 
93 
94 template<class Type>
96 (
99 )
100 :
102  symmetryPlanePatch_(ptf.symmetryPlanePatch_)
103 {}
104 
105 
106 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
107 
108 template<class Type>
110 (
111  const Pstream::commsTypes
112 )
113 {
114  vector nHat = symmetryPlanePatch_.n();
115 
116  tmp<Field<Type> > tvalues =
117  (
118  (
119  this->patchInternalField()
120  + transform(I - 2.0*sqr(nHat), this->patchInternalField())
121  )/2.0
122  );
123 
124  // Get internal field to insert values into
125  Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());
126 
127  this->setInInternalField(iF, tvalues());
128 }
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 } // End namespace Foam
134 
135 // ************************************************************************* //
p
p
Definition: pEqn.H:62
Foam::tmp
A class for managing temporary objects.
Definition: PtrList.H:118
Foam::symmetryPlanePointPatchField
A symmetry-plane boundary condition for pointField.
Definition: symmetryPlanePointPatchField.H:50
Foam::symmetryPlanePointPatchField::evaluate
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::blocking)
Update the patch field.
Definition: symmetryPlanePointPatchField.C:110
Foam::FatalIOError
IOerror FatalIOError
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
Foam::pointPatch
Basic pointPatch represents a set of points from the mesh.
Definition: pointPatch.H:56
Foam::basicSymmetryPointPatchField
A Symmetry boundary condition for pointField.
Definition: basicSymmetryPointPatchField.H:50
Foam::pointPatchFieldMapper
Foam::pointPatchFieldMapper.
Definition: pointPatchFieldMapper.H:46
Foam::transform
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:465
Foam::Field< Type >
Foam::I
static const sphericalTensor I(1)
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::FatalError
error FatalError
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::exit
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
internalField
conserve internalField()+
Foam::UPstream::commsTypes
commsTypes
Types of communications.
Definition: UPstream.H:64
FatalErrorInFunction
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:318
Foam::sqr
dimensionedSymmTensor sqr(const dimensionedVector &dv)
Definition: dimensionedSymmTensor.C:49
Foam::Vector< scalar >
Foam::symmetryPlanePointPatchField::symmetryPlanePatch_
const symmetryPlanePointPatch & symmetryPlanePatch_
Local reference cast into the symmetryPlane patch.
Definition: symmetryPlanePointPatchField.H:57
symmetryPlanePointPatchField.H
FatalIOErrorInFunction
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:330
Foam::symmetryPlanePointPatchField::symmetryPlanePointPatchField
symmetryPlanePointPatchField(const pointPatch &, const DimensionedField< Type, pointMesh > &)
Construct from patch and internal field.
Definition: symmetryPlanePointPatchField.C:37
Foam::DimensionedField
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Definition: DimensionedField.H:51