binaryDiffusionCoefficient.H
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 Class
25  Foam::Function2s::binaryDiffusionCoefficient
26 
27 Description
28  Binary diffusion coefficient polynomial function of the log of temperature
29  correcting the standard kinetic theory temperature dependence.
30 
31  \verbatim
32  Dji = T^(3/2)*(c0 + c1*lnT + c2*lnT^2 + c3*lnT^3 + c4*lnT^4)/p
33  \endverbatim
34 
35 SourceFiles
36  binaryDiffusionCoefficient.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef binaryDiffusionCoefficient_H
41 #define binaryDiffusionCoefficient_H
42 
43 #include "Function2.H"
44 #include "Polynomial.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 namespace Function2s
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class binaryDiffusionCoefficient Declaration
55 \*---------------------------------------------------------------------------*/
56 
58 :
59  public FieldFunction2<scalar, binaryDiffusionCoefficient>
60 {
61  // Private Data
62 
63  //- Polynomial coefficients
64  Polynomial<5> coeffs_;
65 
66 
67 public:
68 
69  //- Runtime type information
70  TypeName("binaryDiffusionCoefficient");
71 
72 
73  // Constructors
74 
75  //- Construct from name and coefficients
77  (
78  const word& name,
79  const Polynomial<5> coeffs
80  );
81 
82  //- Construct from name and dictionary
84  (
85  const word& name,
86  const unitConversions& units,
87  const dictionary& dict
88  );
89 
90  //- Construct and return a clone
91  virtual tmp<Function2<scalar>> clone() const
92  {
93  return tmp<Function2<scalar>>
94  (
96  );
97  }
98 
99 
100  // Member Functions
101 
102  //- Binary diffusion coefficient function of pressure and temperature
103  virtual scalar value(scalar p, scalar T) const
104  {
105  return T*sqrt(T)*coeffs_.value(log(T))/p;
106  }
107 
108  //- Write the function coefficients
109  virtual void write(Ostream& os, const unitConversions& units) const;
110 };
111 
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 } // End namespace Function2s
116 } // End namespace Foam
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 #endif
121 
122 // ************************************************************************* //
const word & name() const
Return the name of the entry.
Definition: Function2.C:78
Binary diffusion coefficient polynomial function of the log of temperature correcting the standard ki...
virtual scalar value(scalar p, scalar T) const
Binary diffusion coefficient function of pressure and temperature.
binaryDiffusionCoefficient(const word &name, const Polynomial< 5 > coeffs)
Construct from name and coefficients.
virtual void write(Ostream &os, const unitConversions &units) const
Write the function coefficients.
TypeName("binaryDiffusionCoefficient")
Runtime type information.
virtual tmp< Function2< scalar > > clone() const
Construct and return a clone.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
scalar value(const scalar x) const
Return polynomial value.
Definition: Polynomial.C:134
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 managing temporary objects.
Definition: tmp.H:55
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
void T(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
dimensionedScalar log(const dimensionedScalar &ds)
const HashTable< unitConversion > & units()
Get the table of unit conversions.
void sqrt(LagrangianPatchField< scalar > &f, const LagrangianPatchField< scalar > &f1)
dictionary dict
volScalarField & p