MRFslipFvPatchVectorField.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) 2022-2024 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 "symmTransformField.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 (
34  const fvPatch& p,
36  const dictionary& dict
37 )
38 :
39  fixedValueFvPatchVectorField(p, iF, dict, false),
41 {
42  if (dict.found("value"))
43  {
45  (
46  vectorField("value", iF.dimensions(), dict, p.size())
47  );
48  }
49  else
50  {
52  }
53 }
54 
55 
57 (
58  const MRFslipFvPatchVectorField& pvf,
59  const fvPatch& p,
61  const fieldMapper& mapper
62 )
63 :
64  fixedValueFvPatchVectorField(pvf, p, iF, mapper),
65  MRFPatchField(pvf)
66 {}
67 
68 
70 (
71  const MRFslipFvPatchVectorField& pvf,
73 )
74 :
75  fixedValueFvPatchVectorField(pvf, iF),
76  MRFPatchField(pvf)
77 {}
78 
79 
80 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 
83 {
84  if (updated())
85  {
86  return;
87  }
88 
89  tmp<vectorField> nHat(patch().nf());
90 
91  // Set the patch velocity to the neighbouring cell value
92  vectorField::operator=(patchInternalField());
93 
94  // Transform the patch velocity relative to the rotating frame
95  makeRelative(*this);
96 
97  // Transform the patch velocity which removes the normal component
98  vectorField::operator=((*this + transform(I - 2*sqr(nHat), *this))/2);
99 
100  // Transform the patch velocity absolute to the rotating frame
101  makeAbsolute(*this);
102 
103  fixedValueFvPatchVectorField::updateCoeffs();
104 }
105 
106 
108 {
111  writeEntry(os, "value", *this);
112 }
113 
114 
115 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
116 
117 namespace Foam
118 {
120  (
123  );
124 }
125 
126 // ************************************************************************* //
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...
const dimensionSet & dimensions() const
Return dimensions.
void operator=(const Field< vector > &)
Definition: Field.C:550
void write(Ostream &) const
Definition: MRFPatchField.C:99
Rotating wall-velocity condition to be used for a slip-wall rotating with the moving frame in an MRF ...
virtual void write(Ostream &) const
Write.
MRFslipFvPatchVectorField(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.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
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
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
virtual void operator=(const UList< Type > &)
Definition: fvPatchField.C:249
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:64
A class for managing temporary objects.
Definition: tmp.H:55
void makeAbsolute(surfaceScalarField &phi, const volVectorField &U)
Make the given flux absolute.
Definition: fvcMeshPhi.C:128
void makeRelative(surfaceScalarField &phi, const volVectorField &U)
Make the given flux relative.
Definition: fvcMeshPhi.C:89
Namespace for OpenFOAM.
static const zero Zero
Definition: zero.H:97
dimensionedSymmTensor sqr(const dimensionedVector &dv)
static const Identity< scalar > I
Definition: Identity.H:93
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
dimensionSet transform(const dimensionSet &)
Definition: dimensionSet.C:504
Field< vector > vectorField
Specialisation of Field<T> for vector.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
dictionary dict
volScalarField & p
Spatial transformation functions for symmTensor fields.