inletOutletFaPatchField.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  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class Type>
35 (
36  const faPatch& p,
38 )
39 :
41  phiName_("phi")
42 {
43  this->refValue() = pTraits<Type>::zero;
44  this->refGrad() = pTraits<Type>::zero;
45  this->valueFraction() = 0.0;
46 }
47 
48 
49 template<class Type>
51 (
53  const faPatch& p,
55  const faPatchFieldMapper& mapper
56 )
57 :
58  mixedFaPatchField<Type>(ptf, p, iF, mapper),
59  phiName_(ptf.phiName_)
60 {}
61 
62 
63 template<class Type>
65 (
66  const faPatch& p,
68  const dictionary& dict
69 )
70 :
72  phiName_(dict.getOrDefault<word>("phi", "phi"))
73 {
74  this->refValue() = Field<Type>("inletValue", dict, p.size());
75 
76  if (dict.found("value"))
77  {
79  (
80  Field<Type>("value", dict, p.size())
81  );
82  }
83  else
84  {
85  faPatchField<Type>::operator=(this->refValue());
86  }
87 
88  this->refGrad() = pTraits<Type>::zero;
89  this->valueFraction() = 0.0;
90 }
91 
92 
93 template<class Type>
95 (
97 )
98 :
100  phiName_(ptf.phiName_)
101 {}
102 
103 
104 template<class Type>
106 (
109 )
110 :
111  mixedFaPatchField<Type>(ptf, iF),
112  phiName_(ptf.phiName_)
113 {}
114 
115 
116 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
117 
118 template<class Type>
120 {
121  if (this->updated())
122  {
123  return;
124  }
125 
126  const Field<scalar>& phip =
127  this->patch(). template lookupPatchField<edgeScalarField, scalar>
128  (
129  phiName_
130  );
131 
132  this->valueFraction() = 1.0 - pos(phip);
133 
135 }
136 
137 
138 template<class Type>
140 {
142  os.writeEntryIfDifferent<word>("phi", "phi", phiName_);
143  this->refValue().writeEntry("inletValue", os);
144  this->writeEntry("value", os);
145 }
146 
147 
148 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::faPatchField
faPatchField<Type> abstract base class. This class gives a fat-interface to all derived classes cover...
Definition: areaFieldsFwd.H:50
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::faPatchFieldMapper
Definition: faPatchFieldMapper.H:44
Foam::inletOutletFaPatchField::write
virtual void write(Ostream &) const
Write.
Definition: inletOutletFaPatchField.C:139
Foam::inletOutletFaPatchField::phiName_
word phiName_
Definition: inletOutletFaPatchField.H:64
Foam::Field
Generic templated field type.
Definition: Field.H:63
inletOutletFaPatchField.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::mixedFaPatchField
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
Definition: mixedFaPatchField.H:54
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::inletOutletFaPatchField::inletOutletFaPatchField
inletOutletFaPatchField(const faPatch &, const DimensionedField< Type, areaMesh > &)
Construct from patch and internal field.
Definition: inletOutletFaPatchField.C:35
Foam::inletOutletFaPatchField
Author Zeljko Tukovic, FMENA Hrvoje Jasak, Wikki Ltd.
Definition: inletOutletFaPatchField.H:55
Foam::foamVersion::patch
const std::string patch
OpenFOAM patch number as a std::string.
Foam::inletOutletFaPatchField::updateCoeffs
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Definition: inletOutletFaPatchField.C:119
Foam::pTraits
A traits class, which is primarily used for primitives.
Definition: pTraits.H:56
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:36
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::faPatch
Finite area patch class. Used for 2-D non-Euclidian finite area method.
Definition: faPatch.H:69
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::pos
dimensionedScalar pos(const dimensionedScalar &ds)
Definition: dimensionedScalar.C:177