maitlandSmith.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) 2011-2019 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 "maitlandSmith.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace pairPotentials
34 {
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 defineTypeNameAndDebug(maitlandSmith, 0);
39 
41 (
42  pairPotential,
43  maitlandSmith,
44  dictionary
45 );
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
51 (
52  const word& name,
53  const dictionary& maitlandSmith
54 )
55 :
56  pairPotential(name, maitlandSmith),
57  maitlandSmithCoeffs_(maitlandSmith.subDict(typeName + "Coeffs")),
58  m_(maitlandSmithCoeffs_.template lookup<scalar>("m")),
59  gamma_(maitlandSmithCoeffs_.template lookup<scalar>("gamma")),
60  rm_(maitlandSmithCoeffs_.template lookup<scalar>("rm")),
61  epsilon_(maitlandSmithCoeffs_.template lookup<scalar>("epsilon"))
62 {
63  setLookupTables();
64 }
65 
66 
67 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
68 
69 scalar maitlandSmith::unscaledEnergy(const scalar r) const
70 {
71  scalar nr = (m_ + gamma_*(r/rm_ - 1.0));
72 
73  return epsilon_
74  *(
75  (6.0 / (nr - 6.0))*Foam::pow(r/rm_, -nr)
76  - (nr / (nr - 6.0))*Foam::pow(r/rm_, -6)
77  );
78 }
79 
80 
81 bool maitlandSmith::read(const dictionary& maitlandSmith)
82 {
83  pairPotential::read(maitlandSmith);
84 
85  maitlandSmithCoeffs_ = maitlandSmith.subDict(typeName + "Coeffs");
86 
87  maitlandSmithCoeffs_.lookup("m") >> m_;
88  maitlandSmithCoeffs_.lookup("gamma") >> gamma_;
89  maitlandSmithCoeffs_.lookup("rm") >> rm_;
90  maitlandSmithCoeffs_.lookup("epsilon") >> epsilon_;
91 
92  return true;
93 }
94 
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 } // End namespace pairPotentials
99 } // End namespace Foam
100 
101 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
virtual bool read(const dictionary &pairPotentialProperties)=0
Read pairPotential dictionary.
Macros for easy insertion into run-time selection tables.
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:1002
A class for handling words, derived from string.
Definition: word.H:59
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
defineTypeNameAndDebug(azizChen, 0)
maitlandSmith(const word &name, const dictionary &pairPotentialProperties)
Construct from components.
Definition: maitlandSmith.C:51
addToRunTimeSelectionTable(pairPotential, azizChen, dictionary)
bool read(const dictionary &pairPotentialProperties)
Read dictionary.
Definition: maitlandSmith.C:81
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:864
scalar unscaledEnergy(const scalar r) const
Definition: maitlandSmith.C:69