24 namespace IdealGasFunctions {
67 bool signchange =
true;
70 else if (statistics == -1)
75 double tfug = exp((mu - m) / T);
77 double moverT = m / T;
79 for (
int i = 1; i <= order; ++i) {
82 if (signchange) sign = -sign;
91 bool signchange =
true;
94 else if (statistics == -1)
99 double tfug = exp((mu - m) / T);
101 double moverT = m / T;
103 for (
int i = 1; i <= order; ++i) {
104 ret += sign *
xMath::BesselKexp(2, i*moverT) * cfug /
static_cast<double>(i) / static_cast<double>(i);
106 if (signchange) sign = -sign;
115 bool signchange =
true;
118 else if (statistics == -1)
123 double tfug = exp((mu - m) / T);
125 double moverT = m / T;
127 for (
int i = 1; i <= order; ++i) {
130 if (signchange) sign = -sign;
138 return (
QuantumClusterExpansionPressure(statistics, T, mu, m, deg, order) +
QuantumClusterExpansionEnergyDensity(statistics, T, mu, m, deg, order) - mu *
QuantumClusterExpansionDensity(statistics, T, mu, m, deg, order)) / T;
144 bool signchange =
true;
147 else if (statistics == -1)
152 double tfug = exp((mu - m) / T);
154 double moverT = m / T;
156 for (
int i = 1; i <= order; ++i) {
159 if (signchange) sign = -sign;
168 bool signchange =
true;
171 else if (statistics == -1)
176 double tfug = exp((mu - m) / T);
178 double moverT = m / T;
180 for (
int i = 1; i <= order; ++i) {
181 ret += sign *
xMath::BesselKexp(2, i*moverT) * cfug * pow(static_cast<double>(i), N - 1);
183 if (signchange) sign = -sign;
206 if (statistics == -1 && mu > m) {
207 printf(
"**WARNING** QuantumNumericalIntegrationDensity: Bose-Einstein condensation, mass = %lf, mu = %lf\n", m, mu);
208 calculationHadBECIssue =
true;
213 double moverT = m / T;
214 double muoverT = mu / T;
215 for (
int i = 0; i < 32; i++) {
216 double tx = lagx32[i];
217 ret += lagw32[i] * T * tx * T * tx * T / (exp(sqrt(tx*tx + moverT * moverT) - muoverT) + statistics);
229 if (statistics == -1 && mu > m) {
230 printf(
"**WARNING** QuantumNumericalIntegrationPressure: Bose-Einstein condensation\n");
231 calculationHadBECIssue =
true;
236 double moverT = m / T;
237 double muoverT = mu / T;
238 for (
int i = 0; i < 32; i++) {
239 double tx = lagx32[i];
240 double x2 = tx * T * tx * T;
241 double E = sqrt(tx*tx + moverT * moverT);
242 ret += lagw32[i] * T * x2 * x2 / E / T / (exp(E - muoverT) + statistics);
254 if (statistics == -1 && mu > m) {
255 printf(
"**WARNING** QuantumNumericalIntegrationEnergyDensity: Bose-Einstein condensation\n");
256 calculationHadBECIssue =
true;
261 double moverT = m / T;
262 double muoverT = mu / T;
263 for (
int i = 0; i < 32; i++) {
264 double tx = lagx32[i];
265 ret += lagw32[i] * T * tx * T * tx * T * sqrt(tx*tx + moverT * moverT) * T / (exp(sqrt(tx*tx + moverT * moverT) - muoverT) + statistics);
275 return (
QuantumNumericalIntegrationPressure(statistics, T, mu, m, deg) +
QuantumNumericalIntegrationEnergyDensity(statistics, T, mu, m, deg) - mu *
QuantumNumericalIntegrationDensity(statistics, T, mu, m, deg)) / T;
282 if (statistics == -1 && mu > m) {
283 printf(
"**WARNING** QuantumNumericalIntegrationScalarDensity: Bose-Einstein condensation\n");
284 calculationHadBECIssue =
true;
289 double moverT = m / T;
290 double muoverT = mu / T;
291 for (
int i = 0; i < 32; i++) {
292 double tx = lagx32[i];
293 ret += lagw32[i] * T * tx * T * tx * T * moverT / sqrt(tx*tx + moverT * moverT) / (exp(sqrt(tx*tx + moverT * moverT) - muoverT) + statistics);
305 if (statistics == -1 && mu > m) {
306 printf(
"**WARNING** QuantumNumericalIntegrationT1dn1dmu1: Bose-Einstein condensation\n");
307 calculationHadBECIssue =
true;
312 double moverT = m / T;
313 double muoverT = mu / T;
314 for (
int i = 0; i < 32; i++) {
315 double tx = lagx32[i];
316 double Eexp = exp(sqrt(tx*tx + moverT * moverT) - muoverT);
317 ret += lagw32[i] * T * tx * T * tx * T * 1. / (1. + statistics / Eexp) / (Eexp + statistics);
329 if (statistics == -1 && mu > m) {
330 printf(
"**WARNING** QuantumNumericalIntegrationT2dn2dmu2: Bose-Einstein condensation\n");
331 calculationHadBECIssue =
true;
336 double moverT = m / T;
337 double muoverT = mu / T;
338 for (
int i = 0; i < 32; i++) {
339 double tx = lagx32[i];
340 double Eexp = exp(sqrt(tx*tx + moverT * moverT) - muoverT);
342 ret += lagw32[i] * T * tx * T * tx * T * (1. - statistics / Eexp) / (1. + statistics / Eexp) / (1. + statistics / Eexp) / (Eexp + statistics);
354 if (statistics == -1 && mu > m) {
355 printf(
"**WARNING** QuantumNumericalIntegrationT3dn3dmu3: Bose-Einstein condensation\n");
356 calculationHadBECIssue =
true;
363 double moverT = m / T;
364 double muoverT = mu / T;
365 for (
int i = 0; i < 32; i++) {
366 double tx = lagx32[i];
367 double Eexp = exp(sqrt(tx*tx + moverT * moverT) - muoverT);
369 ret += lagw32[i] * T * tx * T * tx * T * (1. - 4.*statistics / Eexp + statistics * statistics / Eexp / Eexp) / (1. + statistics / Eexp) / (1. + statistics / Eexp) / (1. + statistics / Eexp) / (Eexp + statistics);
382 printf(
"**WARNING** QuantumNumericalIntegrationTdndmu: N must be between 0 and 3!\n");
383 calculationHadBECIssue =
true;
408 double tmpsqrt = sqrt(1. + x2);
409 return (1. + x2 / 2.) * tmpsqrt - x2 * x2 / 2. * log((1. + tmpsqrt) / x);
417 double tmpsqrt = sqrt(1. + x2);
418 return 2. * tmpsqrt + 2. * x2 * log((1. + tmpsqrt) / x);
426 double pf = sqrt(mu*mu - m * m);
428 for (
int i = 0; i < 32; i++) {
429 ret1 += -legw32[i] * pf * legx32[i] * pf * legx32[i] * pf / (exp(-(sqrt(legx32[i] * legx32[i] * pf * pf + m * m) - mu) / T) + 1.);
432 double moverT = m / T;
433 double muoverT = mu / T;
434 for (
int i = 0; i < 32; i++) {
435 double tx = pf / T + lagx32[i];
436 ret1 += lagw32[i] * T * tx * T * tx * T / (exp(sqrt(tx*tx + moverT * moverT) - muoverT) + 1.);
452 double pf = sqrt(mu*mu - m * m);
454 for (
int i = 0; i < 32; i++) {
455 double x2 = legx32[i] * pf * legx32[i] * pf;
456 double E = sqrt(legx32[i] * legx32[i] * pf*pf + m * m);
457 ret1 += -legw32[i] * pf * x2 * x2 / E / (exp(-(E - mu) / T) + 1.);
460 double moverT = m / T;
461 double muoverT = mu / T;
462 for (
int i = 0; i < 32; i++) {
463 double tx = pf / T + lagx32[i];
464 double x2 = tx * T * tx * T;
465 double E = sqrt(tx*tx + moverT * moverT);
466 ret1 += lagw32[i] * T * x2 * x2 / E / T / (exp(E - muoverT) + 1.);
472 ret2 += mu * pf * pf * pf;
473 ret2 += -3. / 4. * pf * pf * pf * pf *
psi(m / pf);
484 double pf = sqrt(mu*mu - m * m);
486 for (
int i = 0; i < 32; i++) {
487 ret1 += -legw32[i] * pf * legx32[i] * pf * legx32[i] * pf * sqrt(legx32[i] * legx32[i] * pf*pf + m * m) / (exp(-(sqrt(legx32[i] * legx32[i] * pf*pf + m * m) - mu) / T) + 1.);
490 double moverT = m / T;
491 double muoverT = mu / T;
492 for (
int i = 0; i < 32; i++) {
493 double tx = pf / T + lagx32[i];
494 ret1 += lagw32[i] * T * tx * T * tx * T * sqrt(tx*tx + moverT * moverT) * T / (exp(sqrt(tx*tx + moverT * moverT) - muoverT) + 1.);
515 double pf = sqrt(mu*mu - m * m);
517 for (
int i = 0; i < 32; i++) {
518 ret1 += -legw32[i] * pf * legx32[i] * pf * legx32[i] * pf * m / sqrt(legx32[i] * legx32[i] * pf*pf + m * m) / (exp(-(sqrt(legx32[i] * legx32[i] * pf*pf + m * m) - mu) / T) + 1.);
521 double moverT = m / T;
522 double muoverT = mu / T;
523 for (
int i = 0; i < 32; i++) {
524 double tx = pf / T + lagx32[i];
525 ret1 += lagw32[i] * T * tx * T * tx * T * moverT / sqrt(tx*tx + moverT * moverT) / (exp(sqrt(tx*tx + moverT * moverT) - muoverT) + 1.);
541 double pf = sqrt(mu*mu - m * m);
543 for (
int i = 0; i < 32; i++) {
544 double Eexp = exp(-(sqrt(legx32[i] * legx32[i] * pf*pf + m * m) - mu) / T);
545 ret1 += legw32[i] * pf * legx32[i] * pf * legx32[i] * pf * 1. / (1. + 1./Eexp) / (Eexp + 1.);
549 double moverT = m / T;
550 double muoverT = mu / T;
551 for (
int i = 0; i < 32; i++) {
552 double tx = pf / T + lagx32[i];
553 double Eexp = exp(sqrt(tx*tx + moverT * moverT) - muoverT);
554 ret1 += lagw32[i] * T * tx * T * tx * T * 1. / (1. + 1. / Eexp) / (Eexp + 1.);
568 double pf = sqrt(mu*mu - m * m);
570 for (
int i = 0; i < 32; i++) {
571 double Eexp = exp(-(sqrt(legx32[i] * legx32[i] * pf*pf + m * m) - mu) / T);
572 ret1 += -legw32[i] * pf * legx32[i] * pf * legx32[i] * pf * (1. - 1. / Eexp) / (1. + 1. / Eexp) / (1. + 1. / Eexp) / (Eexp + 1.);
576 double moverT = m / T;
577 double muoverT = mu / T;
578 for (
int i = 0; i < 32; i++) {
579 double tx = pf / T + lagx32[i];
580 double Eexp = exp(sqrt(tx*tx + moverT * moverT) - muoverT);
581 ret1 += lagw32[i] * T * tx * T * tx * T * (1. - 1. / Eexp) / (1. + 1. / Eexp) / (1. + 1. / Eexp) / (Eexp + 1.);
595 double pf = sqrt(mu*mu - m * m);
597 for (
int i = 0; i < 32; i++) {
598 double Eexp = exp(-(sqrt(legx32[i] * legx32[i] * pf*pf + m * m) - mu) / T);
599 ret1 += legw32[i] * pf * legx32[i] * pf * legx32[i] * pf * (1. - 4./Eexp + 1./Eexp / Eexp) / (1. + 1. / Eexp) / (1. + 1. / Eexp) / (1. + 1. / Eexp) / (Eexp + 1.);
603 double moverT = m / T;
604 double muoverT = mu / T;
605 for (
int i = 0; i < 32; i++) {
606 double tx = pf / T + lagx32[i];
607 double Eexp = exp(sqrt(tx*tx + moverT * moverT) - muoverT);
608 ret1 += lagw32[i] * T * tx * T * tx * T * (1. - 4. / Eexp + 1. / Eexp / Eexp) / (1. + 1. / Eexp) / (1. + 1. / Eexp) / (1. + 1. / Eexp) / (Eexp + 1.);
620 printf(
"**ERROR** FermiNumericalIntegrationLargeMuTdndmu: N < 0 or N > 3\n");
642 if (statistics == 0) {
653 if (quantity ==
chi2)
655 if (quantity ==
chi3)
657 if (quantity ==
chi4)
672 if (quantity ==
chi2)
674 if (quantity ==
chi3)
676 if (quantity ==
chi4)
690 if (quantity ==
chi2)
692 if (quantity ==
chi3)
694 if (quantity ==
chi4)
698 printf(
"**WARNING** IdealGasFunctions::IdealGasQuantity: Unknown quantity\n");
double QuantumClusterExpansionTdndmu(int N, int statistics, double T, double mu, double m, double deg, int order=1)
Computes the chemical potential derivative of density for a quantum ideal gas using cluster expansion...
double FermiNumericalIntegrationLargeMuChiN(int N, double T, double mu, double m, double deg)
Computes the n-th order susceptibility for a Fermi-Dirac ideal gas at mu > m.
double QuantumClusterExpansionPressure(int statistics, double T, double mu, double m, double deg, int order=1)
Computes the pressure of a quantum ideal gas using cluster expansion.
double BesselKexp(int n, double x)
double QuantumNumericalIntegrationT3dn3dmu3(int statistics, double T, double mu, double m, double deg)
double QuantumClusterExpansionEnergyDensity(int statistics, double T, double mu, double m, double deg, int order=1)
Computes the energy density of a quantum ideal gas using cluster expansion.
double BoltzmannTdndmu(int N, double T, double mu, double m, double deg)
Computes the chemical potential derivative of density for a Maxwell-Boltzmann gas.
const double coefficients_wlag32[32]
Weights of the 32-point Gauss-Laguerre quadrature.
const double coefficients_xlag32[32]
Nodes of the 32-point Gauss-Laguerre quadrature.
const double coefficients_wleg32_zeroone[32]
Weights of the 32-point Gauss-Legendre quadrature in the interval [0,1].
double FermiNumericalIntegrationLargeMuEntropyDensity(double T, double mu, double m, double deg)
Computes the entropy density of a Fermi-Dirac ideal gas at mu > m.
double GeVtoifm3()
A constant to transform GeV into fm .
double QuantumNumericalIntegrationDensity(int statistics, double T, double mu, double m, double deg)
Computes the particle number density of a quantum ideal gas using 32-point Gauss-Laguerre quadratures...
double psi2(double x)
Auxiliary function.
double FermiNumericalIntegrationLargeMuT2dn2dmu2(double T, double mu, double m, double deg)
double IdealGasQuantity(Quantity quantity, QStatsCalculationType calctype, int statistics, double T, double mu, double m, double deg, int order=1)
Calculation of a generic ideal gas function.
double QuantumNumericalIntegrationPressure(int statistics, double T, double mu, double m, double deg)
Computes the pressure of a quantum ideal gas using 32-point Gauss-Laguerre quadratures.
double QuantumNumericalIntegrationEnergyDensity(int statistics, double T, double mu, double m, double deg)
Computes the energy density of a quantum ideal gas using 32-point Gauss-Laguerre quadratures.
double FermiNumericalIntegrationLargeMuScalarDensity(double T, double mu, double m, double deg)
Computes the scalar density of a Fermi-Dirac ideal gas at mu > m.
double QuantumNumericalIntegrationEntropyDensity(int statistics, double T, double mu, double m, double deg)
Computes the entropy density of a quantum ideal gas using 32-point Gauss-Laguerre quadratures...
double psi(double x)
Auxiliary function.
double QuantumClusterExpansionEntropyDensity(int statistics, double T, double mu, double m, double deg, int order=1)
Computes the entropy density of a quantum ideal gas using cluster expansion.
Contains some extra mathematical functions used in the code.
double QuantumNumericalIntegrationScalarDensity(int statistics, double T, double mu, double m, double deg)
Computes the scalar density of a quantum ideal gas using 32-point Gauss-Laguerre quadratures.
const double coefficients_xleg32_zeroone[32]
Nodes of the 32-point Gauss-Legendre quadrature in the interval [0,1].
double QuantumNumericalIntegrationTdndmu(int N, int statistics, double T, double mu, double m, double deg)
double FermiNumericalIntegrationLargeMuDensity(double T, double mu, double m, double deg)
Computes the particle number density of a Fermi-Dirac ideal gas at mu > m.
double QuantumNumericalIntegrationChiN(int N, int statistics, double T, double mu, double m, double deg)
Computes the n-th order susceptibility for a quantum ideal gas using 32-point Gauss-Laguerre quadratu...
Quantity
Identifies the thermodynamic function.
double QuantumClusterExpansionChiN(int N, int statistics, double T, double mu, double m, double deg, int order=1)
Computes the n-th order susceptibility for a quantum ideal gas using cluster expansion.
double BoltzmannChiN(int N, double T, double mu, double m, double deg)
Computes the n-th order susceptibility for a Maxwell-Boltzmann gas.
double BoltzmannPressure(double T, double mu, double m, double deg)
Computes the pressure of a Maxwell-Boltzmann gas.
double BoltzmannEnergyDensity(double T, double mu, double m, double deg)
Computes the energy density of a Maxwell-Boltzmann gas.
double BoltzmannDensity(double T, double mu, double m, double deg)
Computes the particle number density of a Maxwell-Boltzmann gas.
double QuantumClusterExpansionScalarDensity(int statistics, double T, double mu, double m, double deg, int order=1)
Computes the scalar density of a quantum ideal gas using cluster expansion.
double FermiNumericalIntegrationLargeMuEnergyDensity(double T, double mu, double m, double deg)
Computes the energy density of a Fermi-Dirac ideal gas at mu > m.
double FermiNumericalIntegrationLargeMuT1dn1dmu1(double T, double mu, double m, double deg)
double BoltzmannEntropyDensity(double T, double mu, double m, double deg)
Computes the entropy density of a Maxwell-Boltzmann gas.
double BoltzmannScalarDensity(double T, double mu, double m, double deg)
Computes the scalar density of a Maxwell-Boltzmann gas.
double FermiNumericalIntegrationLargeMuPressure(double T, double mu, double m, double deg)
Computes the pressure of a Fermi-Dirac ideal gas at mu > m.
double FermiNumericalIntegrationLargeMuTdndmu(int N, double T, double mu, double m, double deg)
bool calculationHadBECIssue
Whether > m Bose-Einstein condensation issue was encountered for a Bose gas.
double QuantumNumericalIntegrationT1dn1dmu1(int statistics, double T, double mu, double m, double deg)
double QuantumClusterExpansionDensity(int statistics, double T, double mu, double m, double deg, int order=1)
Computes the particle number density of a quantum ideal gas using cluster expansion.
QStatsCalculationType
Identifies whether quantum statistics are to be computed using the cluster expansion or numerical int...
double BesselK1exp(double x)
double QuantumNumericalIntegrationT2dn2dmu2(int statistics, double T, double mu, double m, double deg)
The main namespace where all classes and functions of the Thermal-FIST library reside.
double FermiNumericalIntegrationLargeMuT3dn3dmu3(double T, double mu, double m, double deg)