classical_deriv.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2020, Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 #ifndef O2SCL_CLASSICAL_DERIV_H
24 #define O2SCL_CLASSICAL_DERIV_H
25 
26 /** \file classical_deriv.h
27  \brief File defining \ref o2scl::classical_deriv_thermo_tl
28 */
29 
30 #include <string>
31 #include <iostream>
32 #include <fstream>
33 #include <cmath>
34 
35 #include <o2scl/constants.h>
36 #include <o2scl/part_deriv.h>
37 #include <o2scl/classical.h>
38 
39 #ifndef DOXYGEN_NO_O2NS
40 namespace o2scl {
41 #endif
42 
43  /** \brief Equation of state for a classical particle with derivatives
44  */
45  template<class fp_t=double>
47 
48  protected:
49 
50  /// For computing non-derivative properties
52 
53  public:
54 
56  }
57 
58  virtual ~classical_deriv_thermo_tl() {
59  }
60 
61  /** \brief Compute the properties of particle \c p at temperature
62  \c temper from its chemical potential
63  */
64  virtual void calc_mu(part_deriv &p, fp_t temper) {
65 
66  cl.calc_mu(p,temper);
67 
68  if (temper==0.0) {
69  p.dndT=0.0;
70  p.dndmu=0.0;
71  p.dsdT=0.0;
72  return;
73  }
74 
75  p.dndT=-p.nu/temper/temper*p.n+1.5*p.n/temper;
76  p.dndmu=p.n/temper;
77  p.dsdT=2.5*p.dndT-p.nu*p.dndT/temper+p.n*p.nu/temper/temper;
78 
79  return;
80  }
81 
82 
83  /** \brief Compute the properties of particle \c p at temperature
84  \c temper from its density
85  */
86  virtual void calc_density(part_deriv &p, fp_t temper) {
87 
88  cl.calc_density(p,temper);
89 
90  // Handle zero density first
91  if (p.n==0.0 || temper==0.0) {
92  p.dndT=0.0;
93  p.dndmu=0.0;
94  p.dsdT=0.0;
95  return;
96  }
97 
98  p.dndT=-p.nu/temper/temper*p.n+1.5*p.n/temper;
99  p.dndmu=p.n/temper;
100  p.dsdT=2.5*p.dndT-p.nu*p.dndT/temper+p.n*p.nu/temper/temper;
101 
102  return;
103  }
104 
105  /// Return string denoting type ("classical_deriv_thermo")
106  virtual const char *type() { return "classical_deriv_thermo"; };
107 
108  };
109 
110  /** \brief Double-precision version of
111  \ref o2scl::classical_deriv_thermo_tl
112  */
114 
115 #ifndef DOXYGEN_NO_O2NS
116 }
117 #endif
118 
119 #endif
o2scl::part_deriv_press_tl::dsdT
fp_t dsdT
Derivative of entropy density with respect to temperature.
Definition: part_deriv.h:135
o2scl::part_deriv_press_tl::dndT
fp_t dndT
Derivative of number density with respect to temperature.
Definition: part_deriv.h:132
o2scl::part_tl::n
fp_t n
Number density.
Definition: part.h:112
o2scl::deriv_thermo_base_tl
Base quantities for thermodynamic derivatives.
Definition: part_deriv.h:381
o2scl::classical_deriv_thermo_tl::type
virtual const char * type()
Return string denoting type ("classical_deriv_thermo")
Definition: classical_deriv.h:106
o2scl::part_deriv_press_tl::dndmu
fp_t dndmu
Derivative of number density with respect to chemical potential.
Definition: part_deriv.h:129
o2scl::part_deriv_tl
A part with derivative information.
Definition: part_deriv.h:270
o2scl::classical_thermo_tl
Classical particle class.
Definition: classical.h:51
o2scl::classical_deriv_thermo_tl::cl
classical_thermo_tl< fp_t > cl
For computing non-derivative properties.
Definition: classical_deriv.h:51
o2scl::classical_deriv_thermo_tl::calc_density
virtual void calc_density(part_deriv &p, fp_t temper)
Compute the properties of particle p at temperature temper from its density.
Definition: classical_deriv.h:86
o2scl::part_tl::nu
fp_t nu
Effective chemical potential.
Definition: part.h:124
o2scl::classical_deriv_thermo_tl::calc_mu
virtual void calc_mu(part_deriv &p, fp_t temper)
Compute the properties of particle p at temperature temper from its chemical potential.
Definition: classical_deriv.h:64
o2scl::classical_deriv_thermo_tl
Equation of state for a classical particle with derivatives.
Definition: classical_deriv.h:46

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).