Warning: This is no longer the latest available version of this module. Please see the releases page for the most recent version. The Webnucleo group strongly recommends the use of the latest version of any of its online modules.
This tutorial demonstrates how to use the example codes in the libstatmech distribution src/examples directory.
Example 1: Create a fermion and print out its data.
libstatmech routines demonstrated in example1.c are:
- Line 71: Libstatmech__Fermion__new()
- Line 84: Libstatmech__Fermion__getName()
- Line 89: Libstatmech__Fermion__getRestMass()
- Line 94: Libstatmech__Fermion__getMultiplicity()
- Line 99: Libstatmech__Fermion__getCharge()
- Line 106: Libstatmech__Fermion__free()
To run example1, type the following on the command line:
./example1 electron 0.511 2 -1 > ex1_output.txt
The result is ex1_output.txt
Example 2: Compute the chemical potential for an increasing degree of accuracy.
libstatmech routines demonstrated in example2.c are:
- Line 82: Libstatmech__Fermion__new()
- Line 98: Libstatmech__Fermion__updateQuantityIntegralAccuracy()
- Line 109: Libstatmech__Fermion__computeChemicalPotential()
- Line 124: Libstatmech__Fermion__free()
To run example2, type the following on the command line:
./example2 electron 0.511 2 -1 1.e6 1.e32 > ex2_output.txt
The result is ex2_output.txt
Example 3: Create a fermion and print out the pressure integrand as a function of the dimensionless energy using the default integrand and a user-supplied one for the input temperature and mu/kT.
libstatmech routines demonstrated in example3.c are:
- Line 97: Libstatmech__Fermion__new()
- Line 109: Libstatmech__Fermion__updateQuantity()
- Line 126: Libstatmech__Fermion__computeIntegrandValue()
- Line 203: Libstatmech__Fermion__free()
- Line 232: Libstatmech__Fermion__getRestMass()
To run example3, type the following on the command line:
./example3 electron 0.511 2 -1 1.e7 25. > ex3_output.txt
The result is ex3_output.txt
Example 4: Create a fermion gas and print out the thermodynamics quantities using the default integrands and user-supplied ones for the input temperature and number density.
libstatmech routines demonstrated in example4.c are:
- Line 95: Libstatmech__Fermion__new()
- Line 107: Libstatmech__Fermion__computeChemicalPotential()
- Line 128: Libstatmech__Fermion__computeQuantity()
- Line 184: Libstatmech__Fermion__updateQuantity()
- Line 301: Libstatmech__Fermion__free()
- Line 330: Libstatmech__Fermion__getRestMass()
To run example4, type the following on the command line:
./example4 electron 0.511 2 -1 1.e7 1.e25 > ex4_output.txt
The result is ex4_output.txt
Example 5: Create a fermion gas and print out the temperature derivatives of thermodynamics quantities as well as the heat capacity using the default integrands for the input temperature and number density.
libstatmech routines demonstrated in example5.c are:
- Line 81: Libstatmech__Fermion__new()
- Line 93: Libstatmech__Fermion__computeChemicalPotential()
- Line 106: Libstatmech__Fermion__computeTemperatureDerivative()
- Line 177: Libstatmech__Fermion__free()
To run example5, type the following on the command line:
./example5 electron 0.511 2 -1 1.e7 1.e25 > ex5_output.txt
The result is ex5_output.txt
Example 6: Compute the heat capacity of a fermion gas as a function of density.
libstatmech routines demonstrated in example6.c are:
- Line 82: Libstatmech__Fermion__new()
- Line 106: Libstatmech__Fermion__computeChemicalPotential()
- Line 116: Libstatmech__Fermion__computeTemperatureDerivative()
- Line 133: Libstatmech__Fermion__free()
To run example6, type the following on the command line:
./example6 electron 0.511 2 -1 1.e7 0.5 > ex6_output.txt
The result is ex6_output.txt
Example 7: Compute the number density of electrons in a Yukawa potential.
libstatmech routines demonstrated in example7.c are:
- Line 113: Libstatmech__Fermion__new()
- Line 125: Libstatmech__Fermion__updateQuantity()
- Line 199: Libstatmech__Fermion__free()
- Line 234: Libstatmech__exp()
- Line 253: Libstatmech__Fermion__getMultiplicity()
- Line 328: Libstatmech__Fermion__computeQuantity()
- Line 367: Libstatmech__bracket_root_of_function()
To run example7, type the following on the command line:
./example7 2000. 1 2. > ex7_output.txt
The result is ex7_output.txt
Example 8: Create a boson and print out its data.
libstatmech routines demonstrated in example8.c are:
- Line 71: Libstatmech__Boson__new()
- Line 84: Libstatmech__Boson__getName()
- Line 89: Libstatmech__Boson__getRestMass()
- Line 94: Libstatmech__Boson__getMultiplicity()
- Line 99: Libstatmech__Boson__getCharge()
- Line 106: Libstatmech__Boson__free()
To run example8, type the following on the command line:
./example8 boson 1. 3 -1 > ex8_output.txt
The result is ex8_output.txt
Example 9: Create a boson gas and print out the thermodynamics quantities using supplied functions for ground state properties and the default integrands for the input temperature and number density.
libstatmech routines demonstrated in example9.c are:
- Line 98: Libstatmech__Boson__new()
- Line 117: Libstatmech__Boson__getRestMass()
- Line 130: Libstatmech__Boson__updateQuantity()
- Line 169: Libstatmech__Boson__updateIntegralLowerLimit()
- Line 185: Libstatmech__Boson__computeChemicalPotential()
- Line 202: Libstatmech__Boson__computeQuantity()
- Line 274: Libstatmech__Boson__free()
To run example9, type the following on the command line:
./example9 boson 1. 3 -1 1.e7 1.e25 > ex9_output.txt
The result is ex9_output.txt
Example 10: Create a boson gas and print out the temperature derivatives of thermodynamics quantities as well as the heat capacity using the default integrands for the input temperature and number density.
libstatmech routines demonstrated in example10.c are:
- Line 81: Libstatmech__Boson__new()
- Line 93: Libstatmech__Boson__computeChemicalPotential()
- Line 110: Libstatmech__Boson__computeTemperatureDerivative()
- Line 177: Libstatmech__Boson__free()
To run example10, type the following on the command line:
./example10 boson 1. 3 -1 1.e7 1.e25 > ex10_output.txt
The result is ex10_output.txt
Example 11: Create a photon gas and print out the thermodynamics quantities using the default integrands and user-supplied ones for the input temperature.
libstatmech routines demonstrated in example11.c are:
- Line 76: Libstatmech__Boson__new()
- Line 86: Libstatmech__Boson__computeQuantity()
- Line 140: Libstatmech__Boson__updateQuantity()
- Line 251: Libstatmech__Boson__free()
- Line 284: Libstatmech__Boson__getMultiplicity()
To run example11, type the following on the command line:
./example11 1.e3 > ex11_output.txt
The result is ex11_output.txt
Example 12: Create a boson gas and print out the abundance of the ground state at a series of temperatures for the input number of particles, to show the Bose-Einstein condensate at low temperatures.
libstatmech routines demonstrated in example12.c are:
- Line 98: Libstatmech__Boson__new()
- Line 117: Libstatmech__Boson__getRestMass()
- Line 130: Libstatmech__Boson__updateQuantity()
- Line 182: Libstatmech__Boson__getMultiplicity()
- Line 202: Libstatmech__Boson__getName()
- Line 228: Libstatmech__Boson__updateIntegralLowerLimit()
- Line 264: Libstatmech__Boson__computeChemicalPotential()
- Line 286: Libstatmech__Boson__computeQuantity()
- Line 303: Libstatmech__Boson__computeTemperatureDerivative()
- Line 320: Libstatmech__Boson__free()
To run example12, type the following on the command line:
./example12 boson 1. 3 -1 1.e25 > ex12_output.txt
The result is ex12_output.txt
Example 13: Create a boson gas and print out the abundance of the ground state at a series of number densities for the input temperature, to show the Bose-Einstein condensate at high number densities.
libstatmech routines demonstrated in example13.c are:
- Line 88: Libstatmech__Boson__new()
- Line 107: Libstatmech__Boson__getRestMass()
- Line 120: Libstatmech__Boson__updateQuantity()
- Line 163: Libstatmech__Boson__updateIntegralLowerLimit()
- Line 205: Libstatmech__Boson__getName()
- Line 207: Libstatmech__Boson__getMultiplicity()
- Line 228: Libstatmech__Boson__computeChemicalPotential()
- Line 250: Libstatmech__Boson__computeQuantity()
- Line 282: Libstatmech__Boson__free()
To run example13, type the following on the command line:
./example13 boson 1. 3 -1 1.e7 > ex13_output.txt
The result is ex13_output.txt