wedgeFaPatchField.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) 2016-2017 Wikki Ltd
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
28#include "wedgeFaPatch.H"
29#include "wedgeFaPatchField.H"
30#include "transformField.H"
31#include "symmTransform.H"
32#include "diagTensor.H"
33
34// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
35
36template<class Type>
38(
39 const faPatch& p,
41)
42:
43 transformFaPatchField<Type>(p, iF)
44{}
45
46
47template<class Type>
49(
50 const wedgeFaPatchField<Type>& ptf,
51 const faPatch& p,
53 const faPatchFieldMapper& mapper
54)
55:
56 transformFaPatchField<Type>(ptf, p, iF, mapper)
57{
58 if (!isType<wedgeFaPatch>(this->patch()))
59 {
61 << "Field type does not correspond to patch type for patch "
62 << this->patch().index() << "." << endl
63 << "Field type: " << typeName << endl
64 << "Patch type: " << this->patch().type()
65 << exit(FatalError);
66 }
67}
68
69
70template<class Type>
72(
73 const faPatch& p,
75 const dictionary& dict
76)
77:
78 transformFaPatchField<Type>(p, iF, dict)
79{
80 if (!isType<wedgeFaPatch>(p))
81 {
83 << "patch " << this->patch().index() << " not wedge type. "
84 << "Patch type = " << p.type()
86 }
87
88 this->evaluate();
89}
90
91
92template<class Type>
94(
95 const wedgeFaPatchField<Type>& ptf,
97)
98:
99 transformFaPatchField<Type>(ptf, iF)
100{}
101
102
103// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
104
105template<class Type>
107{
108 const Field<Type> pif (this->patchInternalField());
109
110 return
111 (
112 transform(refCast<const wedgeFaPatch>(this->patch()).faceT(), pif)
113 - pif
114 )*(0.5*this->patch().deltaCoeffs());
115}
116
117
118template<class Type>
120{
121 if (!this->updated())
122 {
123 this->updateCoeffs();
124 }
125
127 (
129 (
130 refCast<const wedgeFaPatch>(this->patch()).edgeT(),
131 this->patchInternalField()
132 )
133 );
134}
135
136
137template<class Type>
140{
141 const diagTensor diagT =
142 0.5*diag(I - refCast<const wedgeFaPatch>(this->patch()).faceT());
143
144 const vector diagV(diagT.xx(), diagT.yy(), diagT.zz());
145
146 return tmp<Field<Type>>
147 (
148 new Field<Type>
149 (
150 this->size(),
151 transformMask<Type>
152 (
153 pow
154 (
155 diagV,
157 ::type>::zero
158 )
159 )
160 )
161 );
162}
163
164
165// ************************************************************************* //
const Cmpt & xx() const
Definition: DiagTensorI.H:76
const Cmpt & zz() const
Definition: DiagTensorI.H:88
const Cmpt & yy() const
Definition: DiagTensorI.H:82
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.
commsTypes
Types of communications.
Definition: UPstream.H:67
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A FieldMapper for finite-area patch fields.
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: faPatchField.H:82
const faPatch & patch() const
Return patch.
Definition: faPatchField.H:286
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:78
A traits class, which is primarily used for primitives.
Definition: pTraits.H:59
label index() const noexcept
The index of this patch in the boundaryMesh.
A class for managing temporary objects.
Definition: tmp.H:65
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
virtual void evaluate(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking)
Evaluate the patch field.
virtual tmp< Field< Type > > snGrad() const
Return gradient at boundary.
virtual tmp< Field< Type > > snGradTransformDiag() const
Return face-gradient transform diagonal.
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
dimensionSet transform(const dimensionSet &ds)
Return the argument; transformations do not change the dimensions.
Definition: dimensionSet.C:536
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)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:372
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
3D symmetric tensor transformation operations.
Spatial transformation functions for primitive fields.