ScaledForce.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) 2018-2023 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 
26 #include "ScaledForce.H"
27 
28 
29 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
30 
31 template<class CloudType>
33 (
34  const dictionary& dict
35 ) const
36 {
37  dictionary modelDict(dict);
38  modelDict.add<word>("type", dict.lookup<word>("forceType"), true);
39  return modelDict;
40 }
41 
42 
43 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
44 
45 template<class CloudType>
47 (
48  CloudType& owner,
49  const fvMesh& mesh,
50  const dictionary& dict
51 )
52 :
53  ParticleForce<CloudType>(owner, mesh, dict, typeName, true),
54  model_
55  (
57  (
58  owner,
59  mesh,
60  modelDict(dict),
61  dict.lookup<word>("forceType")
62  )
63  ),
64  factor_(this->coeffs().template lookup<scalar>("factor"))
65 {}
66 
67 
68 template<class CloudType>
70 (
71  const ScaledForce<CloudType>& df
72 )
73 :
75  model_(df.model_, false),
76  factor_(1)
77 {}
78 
79 
80 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
81 
82 template<class CloudType>
84 {}
85 
86 
87 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
88 
89 template<class CloudType>
91 (
92  const typename CloudType::parcelType& p,
93  const typename CloudType::parcelType::trackingData& td,
94  const scalar dt,
95  const scalar mass,
96  const scalar Re,
97  const scalar muc
98 ) const
99 {
100  return factor_*model_->calcCoupled(p, td, dt, mass, Re, muc);
101 }
102 
103 
104 template<class CloudType>
106 (
107  const typename CloudType::parcelType& p,
108  const typename CloudType::parcelType::trackingData& td,
109  const scalar dt,
110  const scalar mass,
111  const scalar Re,
112  const scalar muc
113 ) const
114 {
115  return factor_*model_->calcCoupled(p, td, dt, mass, Re, muc);
116 }
117 
118 
119 template<class CloudType>
121 (
122  const typename CloudType::parcelType& p,
123  const typename CloudType::parcelType::trackingData& td,
124  const scalar mass
125 ) const
126 {
127  return factor_*model_->massAdd(p, td, mass);
128 }
129 
130 
131 // ************************************************************************* //
Templated base class for dsmc cloud.
Definition: DSMCCloud.H:80
ParcelType parcelType
Type of parcel the cloud was instantiated for.
Definition: DSMCCloud.H:225
Abstract base class for particle forces.
Definition: ParticleForce.H:54
Particle force model scaled by a constant value.
Definition: ScaledForce.H:48
virtual forceSuSp calcNonCoupled(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: ScaledForce.C:106
ScaledForce(CloudType &owner, const fvMesh &mesh, const dictionary &dict)
Construct from mesh.
Definition: ScaledForce.C:47
virtual scalar massAdd(const typename CloudType::parcelType &p, const typename CloudType::parcelType::trackingData &td, const scalar mass) const
Return the added mass.
Definition: ScaledForce.C:121
virtual ~ScaledForce()
Destructor.
Definition: ScaledForce.C:83
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 coupled force.
Definition: ScaledForce.C:91
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Helper container for force Su and Sp terms.
Definition: forceSuSp.H:64
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:99
A class for handling words, derived from string.
Definition: word.H:62
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
scalarField Re(const UList< complex > &cf)
Definition: complexFields.C:97
dictionary dict
volScalarField & p