filmSeparation.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) 2011-2017 OpenFOAM Foundation
9  Copyright (C) 2020-2024 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "filmSeparation.H"
30 #include "filmSeparationModel.H"
32 
33 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
34 
35 namespace Foam
36 {
37 namespace regionModels
38 {
39 namespace areaSurfaceFilmModels
40 {
41 
42 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
43 
44 defineTypeNameAndDebug(filmSeparation, 0);
46 (
47  injectionModel,
48  filmSeparation,
50 );
51 }
52 }
53 }
54 
55 
56 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
57 
59 (
60  liquidFilmBase& film,
61  const dictionary& dict
62 )
63 :
65  filmSeparationModelPtr_(filmSeparationModel::New(film, coeffDict_))
66 {}
67 
68 
69 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
70 
72 {} // filmSeparationModel was forward declared
73 
74 
75 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
76 
78 (
79  scalarField& availableMass,
80  scalarField& massToInject,
81  scalarField& diameterToInject
82 )
83 {
84  const faMesh& mesh = film().regionMesh();
85 
86  // Calculate the mass ratio of film separation
87  tmp<scalarField> tmassRatio = filmSeparationModelPtr_->separatedMassRatio();
88  const auto& massRatio = tmassRatio.cref();
89 
90  // Update various film properties based on the mass ratio
91  massToInject = massRatio*availableMass;
92  diameterToInject = massRatio*film().h();
93  availableMass -= massRatio*availableMass;
94 
95  addToInjectedMass(sum(massToInject));
96 
98 
99 
100  if (debug && mesh.time().writeTime())
101  {
102  {
103  areaScalarField areaSeparated
104  (
105  mesh.newIOobject("separated"),
106  mesh,
108  );
109  areaSeparated.primitiveFieldRef() = massRatio;
110  areaSeparated.write();
111  }
112 
113  {
114  areaScalarField areaMassToInject
115  (
116  mesh.newIOobject("massToInject"),
117  mesh,
119  );
120  areaMassToInject.primitiveFieldRef() = massToInject;
121  areaMassToInject.write();
122  }
123  }
124 }
125 
126 
127 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:133
dictionary dict
type
Types of root.
Definition: Roots.H:52
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
const T & cref() const
Return const reference to the object or to the contents of a (non-null) managed pointer.
Definition: tmpI.H:221
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
filmSeparation(liquidFilmBase &film, const dictionary &dict)
Construct from base film model and dictionary.
bool writeTime() const noexcept
True if this is a write interval.
Definition: TimeStateI.H:73
const Time & time() const
Return the top-level database.
Definition: fvMesh.H:360
defineTypeNameAndDebug(kinematicThinFilm, 0)
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &f1, const label comm)
Base class for liquid-film models.
Base class for film injection models, handling mass transfer from the film.
Macros for easy insertion into run-time selection tables.
dynamicFvMesh & mesh
addToRunTimeSelectionTable(liquidFilmBase, kinematicThinFilm, dictionary)
const areaScalarField & h() const noexcept
Access const reference h.
const faMesh & regionMesh() const
Return the region mesh database.
int debug
Static debugging option.
A base class for filmSeparation models.
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
Definition: dimensionSets.H:49
IOobject newIOobject(const word &name, IOobjectOption ioOpt) const
Create an IOobject at the current time instance (timeName) with the specified options.
A class for managing temporary objects.
Definition: HashPtrTable.H:50
Namespace for OpenFOAM.
static constexpr const zero Zero
Global zero (0)
Definition: zero.H:127