azizChen.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 "azizChen.H"
28 
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
30 
31 namespace Foam
32 {
33 namespace pairPotentials
34 {
35 
36 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
37 
38 defineTypeNameAndDebug(azizChen, 0);
39 
41 (
43  azizChen,
45 );
46 
47 
48 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
49 
51 (
52  const word& name,
53  const dictionary& azizChen
54 )
55 :
56  pairPotential(name, azizChen),
57  azizChenCoeffs_(azizChen.subDict(typeName + "Coeffs")),
58  epsilon_(azizChenCoeffs_.template lookup<scalar>("epsilon")),
59  rm_(azizChenCoeffs_.template lookup<scalar>("rm")),
60  A_(azizChenCoeffs_.template lookup<scalar>("A")),
61  alpha_(azizChenCoeffs_.template lookup<scalar>("alpha")),
62  C6_(azizChenCoeffs_.template lookup<scalar>("C6")),
63  C8_(azizChenCoeffs_.template lookup<scalar>("C8")),
64  C10_(azizChenCoeffs_.template lookup<scalar>("C10")),
65  D_(azizChenCoeffs_.template lookup<scalar>("D")),
66  gamma_(azizChenCoeffs_.template lookup<scalar>("gamma"))
67 {
68  setLookupTables();
69 }
70 
71 
72 // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
73 
74 scalar azizChen::unscaledEnergy(const scalar r) const
75 {
76  scalar x = r/rm_;
77 
78  scalar F = 1.0;
79 
80  if (x < D_)
81  {
82  F = exp(-pow(((D_ / x) - 1.0),2));
83  }
84 
85  return
86  epsilon_
87  *(
88  A_ * Foam::pow(x, gamma_)*exp(-alpha_*x)
89  - (
90  (C6_/ Foam::pow(x, 6))
91  + (C8_/ Foam::pow(x, 8))
92  + (C10_/ Foam::pow(x, 10))
93  )
94  *F
95  );
96 }
97 
98 
99 bool azizChen::read(const dictionary& azizChen)
100 {
101  pairPotential::read(azizChen);
102 
103  azizChenCoeffs_ = azizChen.subDict(typeName + "Coeffs");
104 
105  azizChenCoeffs_.lookup("epsilon") >> epsilon_;
106  azizChenCoeffs_.lookup("rm") >> rm_;
107  azizChenCoeffs_.lookup("A") >> A_;
108  azizChenCoeffs_.lookup("alpha") >> alpha_;
109  azizChenCoeffs_.lookup("C6") >> C6_;
110  azizChenCoeffs_.lookup("C8") >> C8_;
111  azizChenCoeffs_.lookup("C10") >> C10_;
112  azizChenCoeffs_.lookup("D") >> D_;
113  azizChenCoeffs_.lookup("gamma") >> gamma_;
114 
115  return true;
116 }
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 } // End namespace pairPotentials
122 } // End namespace Foam
123 
124 // ************************************************************************* //
azizChen(const word &name, const dictionary &pairPotentialProperties)
Construct from components.
Definition: azizChen.C:51
const dimensionedScalar F
Faraday constant: default SI units: [C/mol].
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:982
scalar unscaledEnergy(const scalar r) const
Definition: azizChen.C:74
dimensionedScalar exp(const dimensionedScalar &ds)
A class for handling words, derived from string.
Definition: word.H:59
bool read(const dictionary &pairPotentialProperties)
Read dictionary.
Definition: azizChen.C:99
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
defineTypeNameAndDebug(azizChen, 0)
addToRunTimeSelectionTable(pairPotential, azizChen, dictionary)
Namespace for OpenFOAM.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:844