drag.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 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 "drag.H"
29 #include "coupledToFluid.H"
30 #include "LagrangianmSp.H"
31 
32 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36 namespace Lagrangian
37 {
39 }
40 }
41 
42 
43 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
44 
45 void Foam::Lagrangian::drag::addUSup
46 (
48  LagrangianEqn<vector>& eqn
49 ) const
50 {
51  const LagrangianSubScalarField& D = this->D(U.mesh());
52 
53  const LagrangianSubVectorField& Uc =
54  cloud<clouds::coupled>().Uc(U.mesh());
55 
56  if (eqn.isPsi(U))
57  {
58  eqn.Su += D*Uc;
59  eqn -= Lagrangianm::Sp(D, U);
60  }
61  else if (eqn.isPsi(Uc))
62  {
63  eqn += Lagrangianm::Sp(D, Uc);
64  eqn.Su -= D*U;
65  }
66  else
67  {
68  eqn.Su += D*(Uc - U);
69  }
70 }
71 
72 
73 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
74 
76 (
77  const word& name,
78  const LagrangianMesh& mesh,
79  const dictionary& modelDict,
80  const dictionary& stateDict
81 )
82 :
84  cloudLagrangianModel(static_cast<const LagrangianModel&>(*this)),
85  D
86  (
87  cloud().derivedField<scalar>
88  (
89  *this,
90  &drag::calcD
91  )
92  )
93 {}
94 
95 
96 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
97 
99 {
100  return wordList(1, cloud().U.name());
101 }
102 
103 
105 (
106  const LagrangianSubScalarField& deltaT,
109 ) const
110 {
111  assertCloud<clouds::coupledToIncompressibleFluid>();
112 
113  addUSup(U, eqn);
114 }
115 
116 
118 (
119  const LagrangianSubScalarField& deltaT,
120  const LagrangianSubScalarSubField& vOrM,
123 ) const
124 {
125  assertCloud<clouds::coupledToIncompressibleFluid, clouds::coupledToFluid>();
126 
127  addUSup(U, eqn);
128 }
129 
130 
131 // ************************************************************************* //
Functions for calculating sources in a Lagrangian equation.
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...
This class stores the coefficients of a Lagrangian equation, and facilitates solving that equation an...
Definition: LagrangianEqn.H:56
Class containing Lagrangian geometry and topology.
Base class for Lagrangian models.
virtual wordList addSupFields() const
Return the name of the velocity field.
Definition: drag.C:98
drag(const word &name, const LagrangianMesh &mesh, const dictionary &modelDict, const dictionary &stateDict)
Construct from components.
Definition: drag.C:76
virtual void addSup(const LagrangianSubScalarField &deltaT, const LagrangianSubVectorSubField &U, LagrangianEqn< vector > &eqn) const
Add a source term to the velocity equation.
Definition: drag.C:105
const CloudDerivedField< scalar > & D
Drag coefficient.
Definition: drag.H:84
Base class for Lagrangian models that refer to a cloud. Not a Lagrangian model in itself....
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
Definition: cloud.H:63
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
A class for handling words, derived from string.
Definition: word.H:62
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
U
Definition: pEqn.H:72
defineTypeNameAndDebug(constantCoefficientVirtualMass, 0)
tmp< LagrangianEqn< Type > > Sp(const LagrangianSubField< SpType > &Sp, const LagrangianSubSubField< Type > &psi)
static const coefficient D("D", dimTemperature, 257.14)
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:54
LagrangianSubSubField< vector > LagrangianSubVectorSubField
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
LagrangianSubField< scalar > LagrangianSubScalarField
LagrangianSubField< vector > LagrangianSubVectorField