VoFSurfaceFilm.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) 2021-2022 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 "VoFSurfaceFilm.H"
28 #include "fvmSup.H"
31 
32 // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
33 
34 namespace Foam
35 {
36  namespace fv
37  {
38  defineTypeNameAndDebug(VoFSurfaceFilm, 0);
39 
41  (
42  fvModel,
43  VoFSurfaceFilm,
44  dictionary
45  );
46  }
47 }
48 
49 
50 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
51 
53 (
54  const word& sourceName,
55  const word& modelType,
56  const dictionary& dict,
57  const fvMesh& mesh
58 )
59 :
60  fvModel(sourceName, modelType, dict, mesh),
61  surfaceFilm_
62  (
63  regionModels::surfaceFilmModels::thermoSingleLayer::typeName,
64  mesh,
65  mesh.lookupObject<uniformDimensionedVectorField>("g"),
66  "surfaceFilm"
67  ),
68  curTimeIndex_(-1)
69 {}
70 
71 
72 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
73 
75 {
76  return wordList
77  (
78  {
79  surfaceFilm_.rhoPrimary().name(),
80  surfaceFilm_.UPrimary().name(),
81  surfaceFilm_.TPrimary().name()
82  }
83  );
84 }
85 
86 
87 Foam::scalar Foam::fv::VoFSurfaceFilm::maxDeltaT() const
88 {
89  return surfaceFilm_.maxDeltaT();
90 }
91 
92 
94 {
95  if (curTimeIndex_ == mesh().time().timeIndex())
96  {
97  return;
98  }
99 
100  surfaceFilm_.evolve();
101 
102  curTimeIndex_ = mesh().time().timeIndex();
103 }
104 
105 
107 (
108  const volScalarField& rho,
109  fvMatrix<scalar>& eqn,
110  const word& fieldName
111 ) const
112 {
113  if (debug)
114  {
115  Info<< type() << ": applying source to " << eqn.psi().name() << endl;
116  }
117 
118  if (fieldName == surfaceFilm_.rhoPrimary().name())
119  {
120  eqn += surfaceFilm_.Srho();
121  }
122  else if (fieldName == surfaceFilm_.TPrimary().name())
123  {
124  const volScalarField::Internal Cv(surfaceFilm_.primaryThermo().Cv());
125 
126  eqn +=
127  surfaceFilm_.Sh()()/Cv
128  + surfaceFilm_.Srho()
129  *(eqn.psi() - surfaceFilm_.primaryThermo().he()/Cv);
130  }
131  else
132  {
134  << "Support for field " << fieldName << " is not implemented"
135  << exit(FatalError);
136  }
137 }
138 
139 
141 (
142  const volScalarField& rho,
143  fvMatrix<vector>& eqn,
144  const word& fieldName
145 ) const
146 {
147  if (debug)
148  {
149  Info<< type() << ": applying source to " << eqn.psi().name() << endl;
150  }
151 
152  eqn += surfaceFilm_.SU();
153 }
154 
155 
156 void Foam::fv::VoFSurfaceFilm::topoChange(const polyTopoChangeMap&)
157 {
159 }
160 
161 
162 void Foam::fv::VoFSurfaceFilm::mapMesh(const polyMeshMap& map)
163 {
165 }
166 
167 
168 void Foam::fv::VoFSurfaceFilm::distribute(const polyDistributionMap&)
169 {
171 }
172 
173 
175 {
176  return true;
177 }
178 
179 
180 // ************************************************************************* //
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
scalar Cv(const scalar p, const scalar T) const
Definition: HtoEthermo.H:2
dictionary dict
defineTypeNameAndDebug(fixedTemperatureConstraint, 0)
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
UniformDimensionedField< vector > uniformDimensionedVectorField
error FatalError
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:306
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
fvMesh & mesh
DimensionedField< scalar, volMesh > Internal
Type of the internal field from which this GeometricField is derived.
Macros for easy insertion into run-time selection tables.
virtual void correct()
Solve the film and update the sources.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Definition: volFieldsFwd.H:58
virtual void addSup(const volScalarField &rho, fvMatrix< scalar > &eqn, const word &fieldName) const
Add explicit contribution to compressible enthalpy equation.
virtual bool movePoints()
Update for mesh motion.
virtual scalar maxDeltaT() const
Return the maximum time-step for stable operation.
labelList fv(nPoints)
addToRunTimeSelectionTable(fvConstraint, fixedTemperatureConstraint, dictionary)
List< word > wordList
A List of words.
Definition: fileName.H:54
virtual wordList addSupFields() const
Return the list of fields for which the option adds source term.
label timeIndex
Definition: getTimeIndex.H:4
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
VoFSurfaceFilm(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
messageStream Info
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:353
Calculate the matrix for implicit and explicit sources.
Namespace for OpenFOAM.