mappedVelocityFluxFvPatchField.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) 2011-2023 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 #include "fieldMapper.H"
28 #include "mappedFvPatchBaseBase.H"
29 #include "volFields.H"
30 #include "surfaceFields.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
36 (
37  const fvPatch& p,
39  const dictionary& dict
40 )
41 :
42  fixedValueFvPatchVectorField(p, iF, dict),
43  phiName_(dict.lookupOrDefault<word>("phi", "phi"))
44 {
46  (
47  *this,
48  iF,
49  dict,
51  );
52 }
53 
54 
56 (
58  const fvPatch& p,
60  const fieldMapper& mapper
61 )
62 :
63  fixedValueFvPatchVectorField(ptf, p, iF, mapper),
64  phiName_(ptf.phiName_)
65 {}
66 
67 
69 (
72 )
73 :
74  fixedValueFvPatchVectorField(ptf, iF),
75  phiName_(ptf.phiName_)
76 {}
77 
78 
79 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
80 
82 {
83  if (updated())
84  {
85  return;
86  }
87 
88  // Since we're inside initEvaluate/evaluate there might be processor
89  // comms underway. Change the tag we use.
90  int oldTag = UPstream::msgType();
91  UPstream::msgType() = oldTag+1;
92 
93  // Get the mapper and the neighbouring mesh and patch
94  const mappedFvPatchBaseBase& mapper =
96  const fvMesh& nbrMesh = mapper.nbrMesh();
97  const label nbrPatchi = mapper.nbrFvPatch().index();
98 
99  const volVectorField& UField =
100  nbrMesh.lookupObjectRef<volVectorField>(internalField().name());
101  surfaceScalarField& phiField =
102  nbrMesh.lookupObjectRef<surfaceScalarField>(phiName_);
103 
104  operator==(mapper.fromNeighbour(UField.boundaryField()[nbrPatchi]));
105  phiField.boundaryFieldRef()[patch().index()] ==
106  mapper.fromNeighbour(phiField.boundaryField()[nbrPatchi]);
107 
108  // Restore tag
109  UPstream::msgType() = oldTag;
110 
111  fixedValueFvPatchVectorField::updateCoeffs();
112 }
113 
114 
116 (
117  Ostream& os
118 ) const
119 {
121  writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
122  writeEntry(os, "value", *this);
123 }
124 
125 
126 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
127 
128 namespace Foam
129 {
131  (
134  );
135 }
136 
137 
138 // ************************************************************************* //
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
static int & msgType()
Message tag of standard messages.
Definition: UPstream.H:476
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Abstract base class for field mapping.
Definition: fieldMapper.H:48
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
Definition: fvPatchField.H:88
virtual void write(Ostream &) const
Write.
Definition: fvPatchField.C:229
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
label index() const
Return the index of this patch in the fvBoundaryMesh.
Definition: fvPatch.H:156
Base class for fv patches that provide mapping between two fv patches.
const fvPatch & nbrFvPatch() const
Get the patch to map from.
static const mappedFvPatchBaseBase & getMap(const fvPatch &patch)
Cast the given fvPatch to a mappedFvPatchBaseBase. Handle errors.
const fvMesh & nbrMesh() const
Get the mesh for the region to map from.
static void validateMapForField(const PatchField &field, const FieldType &iF, const dictionary &context, const label froms=from::any)
Validate that the map exists and is appropriate for the given.
This boundary condition maps the velocity and flux from a neighbouring patch to this patch.
virtual void write(Ostream &) const
Write.
mappedVelocityFluxFvPatchField(const fvPatch &, const DimensionedField< vector, volMesh > &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
Type & lookupObjectRef(const word &name) const
Lookup and return the object reference of the given Type.
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
tmp< fvMatrix< Type > > operator==(const fvMatrix< Type > &, const fvMatrix< Type > &)
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
dictionary dict
volScalarField & p
Foam::surfaceFields.