LiftForce.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) 2012-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "LiftForce.H"
29 #include "fvcCurl.H"
30 
31 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
32 
33 template<class CloudType>
35 (
36  const typename CloudType::parcelType& p,
37  const typename CloudType::parcelType::trackingData& td,
38  const vector& curlUc,
39  const scalar Re,
40  const scalar muc
41 ) const
42 {
43  // dummy
44  return 0.0;
45 }
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
50 template<class CloudType>
52 (
53  CloudType& owner,
54  const fvMesh& mesh,
55  const dictionary& dict,
56  const word& forceType
57 )
58 :
59  ParticleForce<CloudType>(owner, mesh, dict, forceType, true),
60  UName_(this->coeffs().template lookupOrDefault<word>("U", "U")),
61  curlUcInterpPtr_(nullptr)
62 {}
63 
64 
65 template<class CloudType>
67 :
69  UName_(lf.UName_),
70  curlUcInterpPtr_(nullptr)
71 {}
72 
73 
74 // * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
75 
76 template<class CloudType>
78 {}
79 
80 
81 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
82 
83 template<class CloudType>
85 {
86  static word fName("curlUcDt");
87 
88  bool fieldExists = this->mesh().template foundObject<volVectorField>(fName);
89 
90  if (store)
91  {
92  if (!fieldExists)
93  {
94  const volVectorField& Uc = this->mesh().template
95  lookupObject<volVectorField>(UName_);
96 
97  volVectorField* curlUcPtr =
98  new volVectorField(fName, fvc::curl(Uc));
99 
100  curlUcPtr->store();
101  }
102 
103  const volVectorField& curlUc = this->mesh().template
104  lookupObject<volVectorField>(fName);
105 
106  curlUcInterpPtr_.reset
107  (
109  (
110  this->owner().solution().interpolationSchemes(),
111  curlUc
112  ).ptr()
113  );
114  }
115  else
116  {
117  curlUcInterpPtr_.clear();
118 
119  if (fieldExists)
120  {
121  volVectorField& curlUc =
122  this->mesh().template lookupObjectRef<volVectorField>(fName);
123 
124  curlUc.checkOut();
125  }
126  }
127 }
128 
129 
130 template<class CloudType>
132 (
133  const typename CloudType::parcelType& p,
134  const typename CloudType::parcelType::trackingData& td,
135  const scalar dt,
136  const scalar mass,
137  const scalar Re,
138  const scalar muc
139 ) const
140 {
141  forceSuSp value(Zero);
142 
143  vector curlUc =
144  curlUcInterp().interpolate(p.coordinates(), p.currentTetIndices());
145 
146  scalar Cl = this->Cl(p, td, curlUc, Re, muc);
147 
148  value.Su() = mass/p.rho()*td.rhoc()*Cl*((td.Uc() - p.U())^curlUc);
149 
150  return value;
151 }
152 
153 
154 // ************************************************************************* //
p
volScalarField & p
Definition: createFieldRefs.H:8
Foam::fvc::curl
tmp< GeometricField< Type, fvPatchField, volMesh > > curl(const GeometricField< Type, fvPatchField, volMesh > &vf)
Definition: fvcCurl.C:47
Foam::solution
Selector class for relaxation factors, solver type and solution.
Definition: solution.H:50
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::Zero
static constexpr const zero Zero
Global zero.
Definition: zero.H:128
Foam::forceSuSp::Su
const vector & Su() const
Return const access to the explicit contribution [kg.m/s2].
Definition: forceSuSpI.H:64
Foam::LiftForce::LiftForce
LiftForce(CloudType &owner, const fvMesh &mesh, const dictionary &dict, const word &forceType)
Construct from mesh.
Definition: LiftForce.C:52
fvcCurl.H
Calculate the curl of the given volField by constructing the Hodge-dual of the symmetric part of the ...
Foam::forceSuSp
Helper container for force Su and Sp terms.
Definition: forceSuSp.H:63
Foam::ParticleForce
Abstract base class for particle forces.
Definition: ParticleForce.H:59
Foam::LiftForce::calcCoupled
virtual forceSuSp calcCoupled(const typename CloudType::parcelType &p, const typename CloudType::parcelType::trackingData &td, const scalar dt, const scalar mass, const scalar Re, const scalar muc) const
Calculate the non-coupled force.
Definition: LiftForce.C:132
Foam::DSMCCloud
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:71
Foam::LiftForce
Base class for particle lift force models.
Definition: LiftForce.H:57
Foam::interpolation
Abstract base class for interpolation.
Definition: mappedPatchFieldBase.H:95
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:121
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:84
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::volVectorField
GeometricField< vector, fvPatchField, volMesh > volVectorField
Definition: volFieldsFwd.H:60
Foam::Vector< scalar >
Foam::LiftForce::cacheFields
virtual void cacheFields(const bool store)
Cache fields.
Definition: LiftForce.C:84
Foam::Re
scalarField Re(const UList< complex > &cf)
Extract real component.
Definition: complexField.C:159
LiftForce.H
Foam::LiftForce::~LiftForce
virtual ~LiftForce()
Destructor.
Definition: LiftForce.C:77
Foam::DSMCCloud::parcelType
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:220
Foam::GeometricField< vector, fvPatchField, volMesh >