5 #include <boost/math/special_functions/erf.hpp>
6 using boost::math::erf;
12 using namespace Cantera;
17 LorentzianProfile::LorentzianProfile(doublereal gamma)
20 m_hwhm2 = m_hwhm*m_hwhm;
31 doublereal LorentzianProfile::profile(doublereal deltaFreq)
33 return (1.0/
Cantera::Pi) *m_hwhm/(deltaFreq*deltaFreq + m_hwhm2);
43 doublereal LorentzianProfile::cumulative(doublereal deltaFreq)
45 return (1.0/
Pi) * atan(deltaFreq/m_hwhm) + 0.5;
48 doublereal LorentzianProfile::width()
53 GaussianProfile::GaussianProfile(doublereal sigma)
56 m_sigma2 = m_sigma*m_sigma;
59 doublereal GaussianProfile::profile(doublereal deltaFreq)
65 exp(-deltaFreq*deltaFreq/(2.0*m_sigma2));
68 doublereal GaussianProfile::cumulative(doublereal deltaFreq)
70 return 0.5*(1.0 + erf(deltaFreq/(m_sigma*
SqrtTwo)));
73 doublereal GaussianProfile::width()
75 return 2.0*m_sigma*sqrt(log(4.0));
84 Voigt::Voigt(doublereal sigma, doublereal gamma)
87 m_sigma2 = m_sigma*m_sigma;
90 m_gamma = gamma/m_sigsqrt2;
97 cout << F(1.0) << endl;
99 cout << F(1.0) << endl;
101 cout << F(10.0) << endl;
115 doublereal Voigt::F(doublereal x)
123 double c3 = log(
Pi*m_eps/2.0);
124 double tau = sqrt(-log(y) - c3);
125 double b = (tau + x)/y;
128 const double c0 = 2.0/(
Pi*exp(0.0));
130 const double c2 = 2.0/
SqrtPi;
140 f2 = fabs(y*y -
Pi*
Pi/(t*t));
143 if (f1/(f2*f3) < 0.5*m_eps) {
148 int N = int(0.5 + b/h);
151 for (
int i = 0; i < N; i++) {
152 S += (1.0 + exp(-4.0*x*y*u))*exp(-pow(y*u-x,2))/(u*u+1.0);
158 C = 2.0*exp(y*y - x*x)*cos(2*x*y)/(1.0 + exp(2*
Pi/h));
170 doublereal Voigt::profile(doublereal deltaFreq)
172 const double ff = 1.0/(m_sigsqrt2*
SqrtPi);
173 return ff*F(deltaFreq/m_sigsqrt2);