semiPermeableBaffleVelocityFvPatchVectorField.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2017-2019 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 
29 #include "fvPatchFieldMapper.H"
30 #include "volFields.H"
31 #include "surfaceFields.H"
32 #include "psiReactionThermo.H"
33 #include "rhoReactionThermo.H"
34 
35 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
36 
39 (
40  const fvPatch& p,
42 )
43 :
44  fixedValueFvPatchVectorField(p, iF),
45  rhoName_("rho")
46 {}
47 
48 
51 (
52  const fvPatch& p,
54  const dictionary& dict
55 )
56 :
57  fixedValueFvPatchVectorField(p, iF),
58  rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
59 {
60  fvPatchVectorField::operator==(vectorField("value", dict, p.size()));
61 }
62 
63 
66 (
68  const fvPatch& p,
70  const fvPatchFieldMapper& mapper
71 )
72 :
73  fixedValueFvPatchVectorField(ptf, p, iF, mapper),
74  rhoName_(ptf.rhoName_)
75 {}
76 
77 
80 (
82 )
83 :
84  fixedValueFvPatchVectorField(ptf),
85  rhoName_(ptf.rhoName_)
86 {}
87 
88 
91 (
94 )
95 :
96  fixedValueFvPatchVectorField(ptf, iF),
97  rhoName_(ptf.rhoName_)
98 {}
99 
100 
101 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
102 
104 {
105  if (updated())
106  {
107  return;
108  }
109 
111 
112  const scalarField& rhop =
113  patch().lookupPatchField<volScalarField, scalar>(rhoName_);
114 
116 
117  scalarField phip(patch().size(), Zero);
118  forAll(Y, i)
119  {
120  const fvPatchScalarField& Yp = Y[i].boundaryField()[patch().index()];
121 
122  if (!isA<YBCType>(Yp))
123  {
125  << "The mass-fraction condition on patch " << patch().name()
126  << " is not of type " << YBCType::typeName << "."
127  << exit(FatalError);
128  }
129 
130  phip += refCast<const YBCType>(Yp).phiY();
131  }
132 
133  this->operator==(patch().nf()*phip/(rhop*patch().magSf()));
134 
135  fixedValueFvPatchVectorField::updateCoeffs();
136 }
137 
138 
140 (
141  Ostream& os
142 ) const
143 {
145  writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
146  writeEntry(os, "value", *this);
147 }
148 
149 
150 // * * * * * * * * * * * * * * Build Macro Function * * * * * * * * * * * * //
151 
152 namespace Foam
153 {
155  (
158  );
159 }
160 
161 // ************************************************************************* //
Foam::surfaceFields.
#define forAll(list, i)
Loop across all elements in list.
Definition: UList.H:434
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
error FatalError
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:319
basicSpecieMixture & composition
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:61
This is a mass-fraction boundary condition for a semi-permeable baffle.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:66
volVectorField vectorField(fieldObject, mesh)
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:280
Macros for easy insertion into run-time selection tables.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:52
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
A class for handling words, derived from string.
Definition: word.H:59
Foam::fvPatchFieldMapper.
static const zero Zero
Definition: zero.H:97
virtual label size() const
Return size.
Definition: fvPatch.H:155
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:53
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
semiPermeableBaffleVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
This is a velocity boundary condition for a semi-permeable baffle.
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
A templated 1D list of pointers to objects of type <T>, where the size of the array is known and used...
Definition: List.H:70
PtrList< volScalarField > & Y
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Namespace for OpenFOAM.