Rebound.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2016 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "Rebound.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
33 template<class CloudType>
35 (
36  const dictionary& dict,
38 )
39 :
41  UFactor_(this->coeffDict().getScalar("UFactor"))
42 {}
43 
44 
45 template<class CloudType>
47 :
49  UFactor_(pim.UFactor_)
50 {}
51 
52 
53 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
54 
55 template<class CloudType>
57 (
58  typename CloudType::parcelType& p,
59  const polyPatch& pp,
60  bool& keepParticle
61 )
62 {
63  vector& U = p.U();
64 
65  keepParticle = true;
66  p.active(true);
67 
68  vector nw;
69  vector Up;
70 
71  this->owner().patchData(p, pp, nw, Up);
72 
73  // Calculate motion relative to patch velocity
74  U -= Up;
75 
76  scalar Un = U & nw;
77 
78  if (Un > 0.0)
79  {
80  U -= UFactor_*2.0*Un*nw;
81  }
82 
83  // Return velocity to global space
84  U += Up;
85 
86  return true;
87 }
88 
89 
90 // ************************************************************************* //
Foam::Rebound
Simple rebound patch interaction model.
Definition: Rebound.H:50
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::Rebound::correct
virtual bool correct(typename CloudType::parcelType &p, const polyPatch &pp, bool &keepParticle)
Apply velocity correction.
Definition: Rebound.C:57
Foam::PatchInteractionModel
Templated patch interaction model class.
Definition: KinematicCloud.H:89
Foam::polyPatch
A patch is a list of labels that address the faces in the global face list.
Definition: polyPatch.H:68
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::cloud
A cloud is a registry collection of lagrangian particles.
Definition: cloud.H:57
U
U
Definition: pEqn.H:72
Foam::Vector< scalar >
Rebound.H
Foam::Rebound::Rebound
Rebound(const dictionary &dict, CloudType &cloud)
Construct from dictionary.
Definition: Rebound.C:35
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220