coupledToFluid.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 "coupledToFluid.H"
27 #include "fluidThermo.H"
28 
29 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace clouds
34 {
36 }
37 }
38 
39 
40 // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
41 
43 Foam::clouds::coupledToFluid::getRhocVf() const
44 {
45  if (mesh_.mesh().foundObject<volScalarField>("rho"))
46  {
47  return mesh_.mesh().lookupObject<volScalarField>("rho");
48  }
49 
50  if (mesh_.mesh().foundObject<basicThermo>(physicalProperties::typeName))
51  {
52  return
53  mesh_.mesh().lookupObject<basicThermo>
54  (
55  physicalProperties::typeName
56  ).rho();
57  }
58 
60  << "Could not determine the carrier density"
61  << exit(FatalError);
62 
63  return tmp<volScalarField>(nullptr);
64 }
65 
66 
68 Foam::clouds::coupledToFluid::calcNuc
69 (
70  const LagrangianModelRef& model,
71  const LagrangianSubMesh& subMesh
72 ) const
73 {
74  return muc(model, subMesh)/rhoc(model, subMesh);
75 }
76 
77 
78 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
79 
81 {
82  if (trhocVf_.isTmp())
83  {
84  trhocVf_ = getRhocVf();
85  }
86 }
87 
88 
89 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
90 
92 :
93  coupled(c),
94  mesh_(c.mesh()),
95  trhocVf_(getRhocVf()),
96  rhoc(carrierField<scalar>(trhocVf_())),
97  muc
98  (
99  carrierField<scalar>
100  (
101  mesh_
102  .mesh()
103  .lookupObject<fluidThermo>(physicalProperties::typeName)
104  .mu()
105  )
106  )
107 {}
108 
109 
110 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
111 
113 {}
114 
115 
116 // ************************************************************************* //
const polyMesh & mesh() const
Access the mesh.
Base class for clouds. Provides a basic evolution algorithm, models, and a database for caching deriv...
Definition: cloud.H:63
Base class for clouds which are coupled to a fluid.
void updateRhoc()
Update the carrier density.
coupledToFluid(const cloud &)
Construct from a reference to the cloud.
virtual ~coupledToFluid()
Destructor.
Base class for clouds which are coupled to a fluid.
Definition: coupled.H:60
Base-class for fluid thermodynamic properties.
Definition: fluidThermo.H:56
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
bool foundObject(const word &name) const
Is the named Type in registry.
A base class for physical properties.
A class for managing temporary objects.
Definition: tmp.H:55
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
defineTypeNameAndDebug(coupled, 0)
const dimensionedScalar mu
Atomic mass unit.
const dimensionedScalar c
Speed of light in a vacuum.
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:62
error FatalError