movingWallSlipVelocityFvPatchVectorField.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) 2021-2022 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 "volFields.H"
28 #include "surfaceFields.H"
29 #include "fvcMeshPhi.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
36 (
37  const fvPatch& p,
39 )
40 :
41  directionMixedFvPatchVectorField(p, iF)
42 {
43  const vectorField n(p.nf());
44 
45  refValue() = Zero;
46  refGrad() = Zero;
47  valueFraction() = sqr(n);
48 }
49 
50 
53 (
54  const fvPatch& p,
56  const dictionary& dict
57 )
58 :
59  directionMixedFvPatchVectorField(p, iF)
60 {
61  fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
62 
63  const vectorField n(p.nf());
64 
65  refValue() = sqr(n) & *this;
66  refGrad() = Zero;
67  valueFraction() = sqr(n);
68 }
69 
70 
73 (
75  const fvPatch& p,
77  const fvPatchFieldMapper& mapper
78 )
79 :
80  directionMixedFvPatchVectorField(ptf, p, iF, mapper)
81 {}
82 
83 
86 (
89 )
90 :
91  directionMixedFvPatchVectorField(mwvpvf, iF)
92 {}
93 
94 
95 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
96 
98 {
99  if (updated())
100  {
101  return;
102  }
103 
104  const fvMesh& mesh = internalField().mesh();
105 
106  if (mesh.moving())
107  {
108  const fvPatch& p = patch();
109 
110  const volVectorField& U =
111  static_cast<const volVectorField&>(internalField());
112 
113  const scalarField phip(fvc::meshPhi(U, p.index()));
114 
115  const vectorField n(p.nf());
116  const scalarField& magSf = p.magSf();
117 
118  tmp<scalarField> Un = phip/(magSf + vSmall);
119 
120  refValue() = n*Un;
121  refGrad() = Zero;
122  valueFraction() = sqr(n);
123  }
124 
125  directionMixedFvPatchVectorField::updateCoeffs();
127 }
128 
129 
131 {
133  writeEntry(os, "value", *this);
134 }
135 
136 
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
138 
139 namespace Foam
140 {
142  (
145  );
146 }
147 
148 // ************************************************************************* //
Foam::surfaceFields.
bool moving() const
Is mesh moving.
Definition: polyMesh.H:525
U
Definition: pEqn.H:72
const scalarField & magSf() const
Return face area magnitudes.
Definition: fvPatch.C:142
void evaluate(GeometricField< Type, PatchField, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, PatchField, GeoMesh > &x)
label index() const
Return the index of this patch in the fvBoundaryMesh.
Definition: fvPatch.H:175
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
tmp< vectorField > nf() const
Return face normals.
Definition: fvPatch.C:130
dimensionedSymmTensor sqr(const dimensionedVector &dv)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Definition: fvPatch.H:63
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:243
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
fvMesh & mesh
Macros for easy insertion into run-time selection tables.
This boundary condition provides a slip velocity condition for cases with moving walls.
Foam::fvPatchFieldMapper.
static const zero Zero
Definition: zero.H:97
virtual label size() const
Return size.
Definition: fvPatch.H:157
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
movingWallSlipVelocityFvPatchVectorField(const fvPatch &, const DimensionedField< vector, volMesh > &)
Construct from patch and internal field.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
Definition: HashTableIO.C:96
Calculate the mesh motion flux and convert fluxes from absolute to relative and back.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:95
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
tmp< surfaceScalarField > meshPhi(const volVectorField &U)
Definition: fvcMeshPhi.C:34
label n
A class for managing temporary objects.
Definition: PtrList.H:53
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
Namespace for OpenFOAM.