All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
part.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2014, 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_PART_H
24 #define O2SCL_PART_H
25 
26 #include <string>
27 #include <iostream>
28 #include <cmath>
29 #include <o2scl/constants.h>
30 #include <o2scl/inte.h>
31 #include <o2scl/funct.h>
32 #include <o2scl/mroot.h>
33 
34 /** \file part.h
35  \brief File defining \ref o2scl::thermo and \ref o2scl::part
36 */
37 
38 #ifndef DOXYGEN_NO_O2NS
39 namespace o2scl {
40 #endif
41 
42  /** \brief A class holding some useful thermodynamical variables (energy
43  density, pressure, entropy density)
44  */
45  class thermo {
46 
47  public:
48 
49  /// pressure
50  double pr;
51  /// energy density
52  double ed;
53  /// entropy density
54  double en;
55 
56  /// Return string denoting type ("thermo")
57  const char *type() { return "thermo"; }
58 
59  };
60 
61  /** \brief Addition operator
62  */
63  extern thermo operator+(const thermo &left, const thermo &right);
64 
65  /** \brief Subtraction operator
66  */
67  extern thermo operator-(const thermo &left, const thermo &right);
68 
69  /** \brief Particle base class
70  */
71  class part {
72 
73  public:
74 
75  /// Degeneracy (e.g. spin and color if applicable)
76  double g;
77  /// Mass
78  double m;
79  /// Number density
80  double n;
81  /// Energy density
82  double ed;
83  /// Pressure
84  double pr;
85  /// Chemical potential
86  double mu;
87  /// Entropy density
88  double en;
89  /// Effective mass (Dirac unless otherwise specified)
90  double ms;
91  /// Effective chemical potential
92  double nu;
93  /** \brief If true, include the mass in the energy
94  density and chemical potential (default true)
95  */
97  /// True if the particle is non-interacting (default true)
99 
100  /// Make a particle of mass \c mass and degeneracy \c dof.
101  part(double mass=0.0, double dof=0.0);
102 
103  virtual ~part();
104 
105  /// Set the mass \c mass and degeneracy \c dof.
106  virtual void init(double mass, double dof);
107 
108  /** \brief Make \c ap an anti-particle with the same mass
109  and degeneracy
110 
111  This sets the \ref m, \ref g, \ref ms, \ref inc_rest_mass
112  and \ref non_interacting fields of \c ap equal to that
113  of the current object. If \ref inc_rest_mass is true,
114  then it sets
115  \f[
116  \mu_{\mathrm{anti}} = - \mu
117  \qquad\mathrm{and}\qquad
118  \nu_{\mathrm{anti}} = - \nu
119  \f]
120  and if \ref inc_rest_mass is false, it sets
121  \f[
122  \mu_{\mathrm{anti}} = - \mu - 2 m
123  \qquad\mathrm{and}\qquad
124  \nu_{\mathrm{anti}} = - \nu - 2 m
125  \f]
126  */
127  virtual void anti(part &ap);
128 
129  /// Return string denoting type ("part")
130  virtual const char *type() { return "part"; }
131 
132  };
133 
134  /** \brief Addition operator
135  */
136  extern thermo operator+(const thermo &left, const part &right);
137 
138  /** \brief Subtraction operator
139  */
140  extern thermo operator-(const thermo &left, const part &right);
141 
142 #ifndef DOXYGEN_NO_O2NS
143 }
144 #endif
145 
146 #endif
double pr
pressure
Definition: part.h:50
double nu
Effective chemical potential.
Definition: part.h:92
virtual const char * type()
Return string denoting type ("part")
Definition: part.h:130
double n
Number density.
Definition: part.h:80
double en
Entropy density.
Definition: part.h:88
double ed
energy density
Definition: part.h:52
double m
Mass.
Definition: part.h:78
part(double mass=0.0, double dof=0.0)
Make a particle of mass mass and degeneracy dof.
virtual void init(double mass, double dof)
Set the mass mass and degeneracy dof.
Particle base class.
Definition: part.h:71
double mu
Chemical potential.
Definition: part.h:86
double pr
Pressure.
Definition: part.h:84
double ms
Effective mass (Dirac unless otherwise specified)
Definition: part.h:90
double en
entropy density
Definition: part.h:54
A class holding some useful thermodynamical variables (energy density, pressure, entropy density) ...
Definition: part.h:45
double ed
Energy density.
Definition: part.h:82
const char * type()
Return string denoting type ("thermo")
Definition: part.h:57
bool non_interacting
True if the particle is non-interacting (default true)
Definition: part.h:98
virtual void anti(part &ap)
Make ap an anti-particle with the same mass and degeneracy.
bool inc_rest_mass
If true, include the mass in the energy density and chemical potential (default true) ...
Definition: part.h:96
double g
Degeneracy (e.g. spin and color if applicable)
Definition: part.h:76

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).
Hosted at Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads..