coupledToIncompressibleFluid.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 
27 #include "viscosity.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::coupledToIncompressibleFluid::getNucVf() const
44 {
45  if (mesh_.mesh().foundObject<volScalarField>("nu"))
46  {
47  return mesh_.mesh().lookupObject<volScalarField>("nu");
48  }
49 
50  if (mesh_.mesh().foundObject<viscosity>(physicalProperties::typeName))
51  {
52  return
53  mesh_.mesh().lookupObject<viscosity>
54  (
55  physicalProperties::typeName
56  ).nu();
57  }
58 
60  << "Could not determine the carrier viscosity"
61  << exit(FatalError);
62 
63  return tmp<volScalarField>(nullptr);
64 }
65 
66 
68 Foam::clouds::coupledToIncompressibleFluid::calcNuc
69 (
70  const LagrangianModelRef& model,
71  const LagrangianSubMesh& subMesh
72 ) const
73 {
74  return nuc(model, subMesh);
75 }
76 
77 
78 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
79 
81 {
82  if (tnucVf_.isTmp())
83  {
84  tnucVf_ = getNucVf();
85  }
86 }
87 
88 
89 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
90 
92 (
93  const cloud& c
94 )
95 :
96  coupled(c),
97  mesh_(c.mesh()),
98  physicalProperties_(c.mesh(), word::null),
99  tnucVf_(getNucVf()),
100  rhoByRhoc("rhoByRhoc", dimless, physicalProperties_),
101  nuc(carrierField<scalar>(tnucVf_()))
102 {}
103 
104 
105 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
106 
108 {}
109 
110 
111 // ************************************************************************* //
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 an incompressible fluid.
void updateNuc()
Update the carrier kinematic viscosity.
coupledToIncompressibleFluid(const cloud &)
Construct from a reference to the cloud.
Base class for clouds which are coupled to a fluid.
Definition: coupled.H:60
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 class for managing temporary objects.
Definition: tmp.H:55
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)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
defineTypeNameAndDebug(coupled, 0)
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
const dimensionSet dimless
VolField< scalar > volScalarField
Definition: volFieldsFwd.H:62
error FatalError
Info<< "Reading field U\n"<< endl;volVectorField U(IOobject("U", runTime.name(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);Info<< "Creating face flux\n"<< endl;surfaceScalarField phi(IOobject("phi", runTime.name(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), mesh, dimensionedScalar(mesh.Sf().dimensions() *U.dimensions(), 0));autoPtr< viscosityModel > viscosity(viscosityModel::New(mesh))