Particles and Nuclei Sub-Library: Version 0.910
deriv_part.h
00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006-2012, 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/part.h>
00031 #include <o2scl/fermion.h>
00032 
00033 #ifndef DOXYGENP
00034 namespace o2scl {
00035 #endif
00036 
00037   /** \brief Storage for deriviatives wrt \f$ \mu \f$ and T.
00038 
00039       The variables \c dndmu, \c dndT, and \c dsdT correspond
00040       to 
00041       \f[
00042       \left(\frac{d n}{d \mu}\right)_{T,V}, \quad
00043       \left(\frac{d n}{d T}\right)_{\mu,V}, \quad \mathrm{and} \quad
00044       \left(\frac{d s}{d T}\right)_{\mu,V}
00045       \f]
00046       respectively. All other derivatives can be expressed simply in
00047       terms of these three. Note that volume derivatives are trivial,
00048       since both the entropy and number scale linearly with the
00049       volume.
00050 
00051       \hline
00052 
00053       <b>Derivatives wrt to chemical potential and temperature:</b>
00054 
00055       There is a Maxwell relation
00056       \f[
00057       \left(\frac{d s}{d \mu}\right)_{T,V} =
00058       \left(\frac{d n}{d T}\right)_{\mu,V}
00059       \f]
00060       The pressure derivatives are trivial
00061       \f[
00062       \left(\frac{d P}{d \mu}\right)_{T,V}=n, \quad
00063       \left(\frac{d P}{d T}\right)_{\mu,V}=s
00064       \f]
00065       The energy density derivatives are related through the 
00066       thermodynamic identity:
00067       \f[
00068       \left(\frac{d \varepsilon}{d \mu}\right)_{T,V}=
00069       \mu \left(\frac{d n}{d \mu}\right)_{T,V}+
00070       T \left(\frac{d s}{d \mu}\right)_{T,V}
00071       \f]
00072       \f[
00073       \left(\frac{d \varepsilon}{d T}\right)_{\mu,V}=
00074       \mu \left(\frac{d n}{d T}\right)_{\mu,V}+
00075       T \left(\frac{d s}{d T}\right)_{\mu,V}
00076       \f]
00077 
00078       \hline
00079 
00080       <b>Other derivatives:</b>
00081 
00082       Note that the derivative of the entropy with respect to the
00083       temperature above is not the specific heat per particle, \f$ c_V \f$.
00084       The specific heat per particle is
00085       \f[
00086       c_V = \frac{T}{N} \left( \frac{\partial S}{\partial T} \right)_{V,N}
00087       = \frac{T}{n} \left( \frac{\partial s}{\partial T} \right)_{V,n}
00088       \f] 
00089       As noted in \ref part_section in the User's Guide for \o2p, we
00090       work in units so that \f$ \hbar = c = k_B = 1 \f$. In this case,
00091       \f$ c_V \f$ is unitless as defined here. To compute \f$ c_V \f$
00092        in terms of the derivatives above, note that the
00093       descendants of deriv_part provide all of the thermodynamic
00094       functions in terms of \f$ \mu, V \f$ and \f$ T \f$, so we have
00095       \f[
00096       s=s(\mu,T,V) \quad \mathrm{and} \quad n=n(\mu,T,V) \, .
00097       \f]
00098       We can then construct a function
00099       \f[
00100       s=s[\mu(n,T,V),T,V]
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       For, \f$ c_P \f$, defined as
00128       \f[
00129       c_P = \frac{T}{N} \left( \frac{\partial S}{\partial T} 
00130       \right)_{N,P}
00131       \f] 
00132       (which is also unitless) we can write functions
00133       \f[
00134       S=S(N,T,V) \qquad \mathrm{and} \qquad V=V(N,P,T)
00135       \f]
00136       which imply
00137       \f[
00138       \left( \frac{\partial S}{\partial T} \right)_{N,P} =
00139       \left( \frac{\partial S}{\partial T} \right)_{N,V} +
00140       \left( \frac{\partial S}{\partial V} \right)_{N,T}
00141       \left( \frac{\partial V}{\partial T} \right)_{N,P} \, .
00142       \f]
00143       Thus we require the derivatives
00144       \f[
00145       \left( \frac{\partial S}{\partial T} \right)_{N,V} ,
00146       \left( \frac{\partial S}{\partial V} \right)_{N,T} ,
00147       \qquad\mathrm{and}\qquad
00148       \left( \frac{\partial V}{\partial T} \right)_{N,P}
00149        \, .
00150       \f]
00151 
00152       To compute the new entropy derivatives, we can write
00153       \f[
00154       S=S(\mu(N,T,V),T,V)
00155       \f]
00156       to get
00157       \f[
00158       \left( \frac{\partial S}{\partial T} \right)_{N,V} =
00159       \left( \frac{\partial S}{\partial \mu} \right)_{T,V}
00160       \left( \frac{\partial \mu}{\partial T} \right)_{N,V} +
00161       \left( \frac{\partial S}{\partial T} \right)_{\mu,V} \, ,
00162       \f]
00163       and
00164       \f[
00165       \left( \frac{\partial S}{\partial V} \right)_{N,T} =
00166       \left( \frac{\partial S}{\partial \mu} \right)_{T,V}
00167       \left( \frac{\partial \mu}{\partial V} \right)_{N,T} +
00168       \left( \frac{\partial S}{\partial V} \right)_{\mu,T} \, .
00169       \f]
00170       These require the chemical potential derivatives which have
00171       associated Maxwell relations
00172       \f[
00173       \left( \frac{\partial \mu}{\partial T} \right)_{N,V} =
00174       -\left( \frac{\partial S}{\partial N} \right)_{T,V} 
00175       \qquad\mathrm{and}\qquad
00176       \left( \frac{\partial \mu}{\partial V} \right)_{N,T} =
00177       -\left( \frac{\partial P}{\partial N} \right)_{T,V} \, .
00178       \f]
00179       Finally, we can rewrite the derivatives on the right hand sides
00180       in terms of derivatives of functions of \f$ \mu, V \f$ and
00181       \f$ T \f$,
00182       \f[
00183       \left( \frac{\partial S}{\partial N} \right)_{T,V} =
00184       \left( \frac{\partial S}{\partial \mu} \right)_{T,V} 
00185       \left( \frac{\partial N}{\partial \mu} \right)_{T,V}^{-1} \, ,
00186       \f]
00187       and
00188       \f[
00189       \left( \frac{\partial P}{\partial N} \right)_{T,V} =
00190       \left( \frac{\partial P}{\partial \mu} \right)_{T,V} 
00191       \left( \frac{\partial N}{\partial \mu} \right)_{T,V}^{-1} \, .
00192       \f]
00193 
00194       The volume derivative,
00195       \f[
00196       \left( \frac{\partial V}{\partial T} \right)_{N,P} \, ,
00197       \f]
00198       is related to the coefficient of thermal expansion, sometimes 
00199       called \f$ \alpha \f$,
00200       \f[
00201       \alpha \equiv \frac{1}{V}
00202       \left( \frac{\partial V}{\partial T} \right)_{N,P} \, .
00203       \f]
00204       We can rewrite the derivative 
00205       \f[
00206       \left( \frac{\partial V}{\partial T} \right)_{N,P} =
00207       -\left( \frac{\partial P}{\partial T} \right)_{N,V} 
00208       \left( \frac{\partial P}{\partial V} \right)_{N,T}^{-1} \, .
00209       \f]
00210       The first term can be computed from the Maxwell relation
00211       \f[
00212       \left( \frac{\partial P}{\partial T} \right)_{N,V} = 
00213       \left( \frac{\partial S}{\partial V} \right)_{N,T} \, ,
00214       \f]
00215       where the entropy derivative was computed above. The second term
00216       (related to the inverse of the isothermal compressibility, \f$
00217       \kappa_T \equiv (-1/V) (\partial V/\partial P)_{T,N} \f$ can be
00218       computed from the function \f$ P = P(\mu(N,V,T),V,T) \f$
00219       \f[
00220       \left( \frac{\partial P}{\partial V} \right)_{N,T} = 
00221       \left( \frac{\partial P}{\partial \mu} \right)_{T,V} 
00222       \left( \frac{\partial \mu}{\partial V} \right)_{N,T} +
00223       \left( \frac{\partial P}{\partial V} \right)_{\mu,T} 
00224       \f]
00225       where the chemical potential derivative was computed above.
00226 
00227       The results above can be collected to give
00228       \f[
00229       \left( \frac{\partial S}{\partial T} \right)_{N,P} =
00230       \left( \frac{\partial S}{\partial T} \right)_{\mu,V} +
00231       \frac{S^2}{N^2}
00232       \left( \frac{\partial N}{\partial \mu} \right)_{T,V} -
00233       \frac{2 S}{N}
00234       \left( \frac{\partial N}{\partial T} \right)_{\mu,V} \, ,
00235       \f]
00236       which implies
00237       \f[
00238       c_P = 
00239       \frac{T}{n}
00240       \left( \frac{\partial s}{\partial T} \right)_{\mu,V} +
00241       \frac{s^2 T}{n^3}
00242       \left( \frac{\partial n}{\partial \mu} \right)_{T,V} -
00243       \frac{2 s T}{n^2}
00244       \left( \frac{\partial n}{\partial T} \right)_{\mu,V} \, ,
00245       \f]
00246 
00247       This derivation also gives the well-known relationship between
00248       the specific heats at constant volume and constant pressure,
00249       \f[
00250       c_P = c_V + \frac{T \alpha^2}{n \kappa_T} \, .
00251       \f]
00252 
00253       No derivative with respect to the bare mass is given, since
00254       classes cannot know how to relate the effective mass to the
00255       bare mass. 
00256 
00257   */
00258   class part_deriv : public part {
00259     
00260   public:
00261     
00262     /// Derivative of number density with respect to chemical potential
00263     double dndmu;
00264     
00265     /// Derivative of number density with respect to temperature
00266     double dndT;
00267 
00268     /// Derivative of entropy density with respect to temperature
00269     double dsdT;
00270 
00271     /// Derivative of number density with respect to the effective mass
00272     double dndm;
00273 
00274   part_deriv(double mass=0.0, double dof=0.0) : part(mass,dof) {
00275     }
00276 
00277   };
00278   
00279   class fermion_deriv : public part_deriv {
00280     
00281   public:
00282     
00283     /// Fermi momentum
00284     double kf;
00285     
00286   fermion_deriv(double mass=0.0, double dof=0.0) : part_deriv(mass,dof) {
00287     }
00288     
00289   };
00290 
00291   class fermion_deriv_thermo {
00292 
00293   public:
00294 
00295     virtual ~fermion_deriv_thermo() {
00296     }
00297 
00298     /** \brief Calculate properties as function of chemical potential
00299     */
00300     virtual void calc_mu(fermion_deriv &f, double temper)=0;
00301 
00302     /** \brief Calculate properties as function of density
00303      */
00304     virtual void calc_density(fermion_deriv &f, double temper)=0;
00305 
00306     /** \brief Calculate properties with antiparticles as function of
00307         chemical potential
00308     */
00309     virtual void pair_mu(fermion_deriv &f, double temper)=0;
00310 
00311     /** \brief Calculate properties with antiparticles as function of
00312         density
00313      */
00314     virtual void pair_density(fermion_deriv &f, double temper)=0;
00315 
00316     /// Calculate effective chemical potential from density
00317     virtual void nu_from_n(fermion_deriv &f, double temper)=0;
00318 
00319   };
00320 
00321 
00322 #ifndef DOXYGENP
00323 }
00324 #endif
00325 
00326 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Friends

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

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.