deriv_part.h

00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006, 2007, Andrew W. Steiner
00005   
00006   This file is part of O2scl.
00007   
00008   O2scl is free software; you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation; either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   O2scl is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017   
00018   You should have received a copy of the GNU General Public License
00019   along with O2scl. If not, see <http://www.gnu.org/licenses/>.
00020 
00021   -------------------------------------------------------------------
00022 */
00023 #ifndef O2SCL_DERIV_PART_H
00024 #define O2SCL_DERIV_PART_H
00025 
00026 #include <string>
00027 #include <iostream>
00028 #include <fstream>
00029 #include <cmath>
00030 #include <o2scl/boson.h>
00031 #include <o2scl/fermion.h>
00032 #include <o2scl/classical.h>
00033 
00034 #ifndef DOXYGENP
00035 namespace o2scl {
00036 #endif
00037 
00038   /** 
00039       \brief Storage for deriviatives wrt \f$ \mu \f$ and T.
00040 
00041       The variables \c dndmu, \c dndT, and \c dsdT correspond
00042       to 
00043       \f[
00044       \left(\frac{d n}{d \mu}\right)_{T}, \quad
00045       \left(\frac{d n}{d T}\right)_{\mu}, \quad \mathrm{and} \quad
00046       \left(\frac{d s}{d T}\right)_{\mu}
00047       \f]
00048       respectively.
00049 
00050       All other derivatives can be expressed simply in terms of these
00051       three. 
00052 
00053       \hline
00054 
00055       <b>Derivatives wrt to chemical potential and temperature:</b>
00056 
00057       There is a Maxwell relation
00058       \f[
00059       \left(\frac{d s}{d \mu}\right)_T =
00060       \left(\frac{d n}{d T}\right)_{\mu}
00061       \f]
00062       The pressure derivatives are trivial
00063       \f[
00064       \left(\frac{d P}{d \mu}\right)_{T}=n, \quad
00065       \left(\frac{d P}{d T}\right)_{\mu}=s
00066       \f]
00067       The energy density derivatives are related through the 
00068       thermodynamic identity:
00069       \f[
00070       \left(\frac{d \varepsilon}{d \mu}\right)_{T}=
00071       \mu \left(\frac{d n}{d \mu}\right)_{T}+
00072       T \left(\frac{d s}{d \mu}\right)_{T}
00073       \f]
00074       \f[
00075       \left(\frac{d \varepsilon}{d T}\right)_{\mu}=
00076       \mu \left(\frac{d n}{d T}\right)_{\mu}+
00077       T \left(\frac{d s}{d T}\right)_{\mu}
00078       \f]
00079 
00080       \hline
00081 
00082       <b>Other derivatives:</b>
00083 
00084       Note that the derivative of the entropy with respect to the
00085       temperature above is not the specific heat, \f$ c_V \f$.
00086       The specific heat is
00087       \f[
00088       C_V = \frac{T}{N} \left( \frac{\partial S}{\partial T} \right)_{V,N}
00089       = \frac{T}{n} \left( \frac{\partial s}{\partial T} \right)_{V,n}
00090       \f] 
00091       To compute the specific heat in terms of the derivatives above,
00092       note that the descendants of deriv_part provide all of the
00093       thermodynamic functions in terms of \f$ \mu, V \f$ and \f$ T
00094       \f$, so we have
00095       \f[
00096       s=s(\mu,V,T) \quad \mathrm{and} \quad n=n(\mu,V,T) \, .
00097       \f]
00098       We can then construct a function
00099       \f[
00100       s=s[\mu(n,V,T),V,T]
00101       \f]
00102       and then write the required derivative directly
00103       \f[
00104       \left(\frac{\partial s}{\partial T}\right)_{n,V} =
00105       \left(\frac{\partial s}{\partial \mu}\right)_{T,V}
00106       \left(\frac{\partial \mu}{\partial T}\right)_{n,V} +
00107       \left(\frac{\partial s}{\partial T}\right)_{\mu,V} \, .
00108       \f]
00109       Now we use the identity
00110       \f[
00111       \left(\frac{\partial \mu}{\partial T}\right)_{n,V} = -
00112       \left(\frac{\partial n}{\partial T}\right)_{\mu,V} 
00113       \left(\frac{\partial n}{\partial \mu}\right)_{T,V}^{-1} \, ,
00114       \f]
00115       and the Maxwell relation above to give
00116       \f[
00117       C_V = \frac{T}{n}
00118       \left[ 
00119       \left(\frac{\partial s}{\partial T}\right)_{\mu,V}
00120       -\left(\frac{\partial n}{\partial T}\right)_{\mu,V}^2
00121       \left(\frac{\partial n}{\partial \mu}\right)_{T,V}^{-1}
00122       \right]
00123       \f]
00124       which expresses the specific heat in terms of the three
00125       derivatives which are given.
00126 
00127       Note that this is the specific heat per particle, and 
00128       has no units. If specific heat per unit volume is required,
00129       you must multiply by the number density. 
00130 
00131   */
00132   class deriv_part {
00133     
00134   public:
00135 
00136     deriv_part();
00137 
00138     /// Derivative of number density with respect to chemical potential
00139     double dndmu;
00140 
00141     /// Derivative of number density with respect to temperature
00142     double dndT;
00143 
00144     /// Derivative of entropy density with respect to temperature
00145     double dsdT;
00146 
00147     /// Derivative of number density with respect to the effective mass
00148     double dndm;
00149 
00150   };
00151 
00152   /// Fermion with derivatives
00153   class deriv_fermion : public fermion, public deriv_part {
00154   public:
00155     deriv_fermion(double mass, double dof) : part(mass,dof), 
00156       fermion(mass,dof) {
00157     }
00158       
00159   };
00160 
00161   /// Boson with derivatives
00162   class deriv_boson : public boson, public deriv_part {
00163   public:
00164     deriv_boson(double mass, double dof) : part(mass,dof),
00165       boson(mass,dof) {
00166     }
00167   };
00168 
00169   /// Classical particle with derivatives
00170   class deriv_classical : public classical, public deriv_part {
00171   public:
00172     deriv_classical(double mass, double dof) : part(mass,dof),
00173       classical(mass,dof) {
00174     }
00175   };
00176 
00177   template<> int io_tlate<deriv_part>::input
00178     (cinput *co, in_file_format *ins, deriv_part *f);
00179   template<> int io_tlate<deriv_part>::output
00180     (coutput *co, out_file_format *ins, deriv_part *f);
00181   template<> const char *io_tlate<deriv_part>::type();
00182 
00183   typedef io_tlate<deriv_part> deriv_part_io_type;
00184 
00185 #ifndef DOXYGENP
00186 }
00187 #endif
00188 
00189 #endif

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page