reboundVelocityLagrangianPatchVectorField.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) 2025-2026 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 
28 
29 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
30 
33 (
34  const LagrangianPatch& p,
35  const regIOobject& iIo,
36  const dictionary& dict
37 )
38 :
40  e_(dict.lookup<scalar>("e", units::unitless)),
41  mu_(dict.lookup<scalar>("mu", units::fraction))
42 {}
43 
44 
47 (
49 )
50 :
52  e_(ptf.e_),
53  mu_(ptf.mu_)
54 {}
55 
56 
59 (
61  const regIOobject& iIo
62 )
63 :
65  e_(ptf.e_),
66  mu_(ptf.mu_)
67 {}
68 
69 
70 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
71 
73 (
74  PstreamBuffers& pBufs,
76 )
77 {
79 
80  const SubField<vector> U = primitiveSubField();
81 
82  const vectorField np(patch().mesh().nf<vectorField>(fraction));
83  const vectorField Up(patch().mesh().Uf<vectorField>(fraction));
84 
85  // !!! Modify Up with tangential velocity from the carrier U boundary
86  // condition, to account for moving/not-moving walls, like the lid of a
87  // driven cavity
88 
89  const scalarField UReln((U - Up) & np);
90  const vectorField URelt((U - Up) - np*UReln);
91 
92  LagrangianPatchVectorField::operator=(Up - e_*UReln*np + (1 - mu_)*URelt);
93 }
94 
95 
97 {
99 
100  writeEntry(os, "e", e_);
101  writeEntry(os, "mu", mu_);
102 }
103 
104 
107 {
109 }
110 
111 
112 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113 
114 namespace Foam
115 {
117  (
118  LagrangianPatchVectorField,
120  );
121 }
122 
123 
124 // ************************************************************************* //
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...
Base class for Lagrangian patches.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Pre-declare related SubField type.
Definition: SubField.H:63
Base class for cloud velocity conditions. Accessed by the cloud velocity Lagrangian patch....
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A rebound velocity boundary condition. Particles that hit a patch with this condition will rebound ba...
reboundVelocityLagrangianPatchVectorField(const LagrangianPatch &, const regIOobject &, const dictionary &)
Construct from patch, internal field and dictionary.
virtual void evaluate(PstreamBuffers &, const LagrangianInternalScalarDynamicField &fraction)
Evaluate the patch field.
virtual LagrangianState state() const
Return the state after interaction with this patch.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
U
Definition: pEqn.H:72
const unitSet unitless
const unitSet fraction
const unitSet & lookup(const word &unitName)
Lookup and return the named unit from the table.
Definition: units.C:346
void write(std::ostream &os, const bool binary, List< floatScalar > &fField)
Write floats ascii or binary.
Namespace for OpenFOAM.
makeLagrangianPatchTypeField(LagrangianPatchVectorField, reboundVelocityLagrangianPatchVectorField)
LagrangianState
Lagrangian state enumeration.
void evaluate(GeometricField< Type, GeoMesh > &result, const Function1< Type > &func, const GeometricField< Type, GeoMesh > &x)
void writeEntry(Ostream &os, const word &key, const DimensionedFieldFunction< DimensionedFieldType > &f)
dictionary dict
volScalarField & p