mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
*** empty log message ***
This commit is contained in:
@@ -42,7 +42,7 @@ namespace Cantera {
|
||||
*
|
||||
* \include edemo.cpp
|
||||
*
|
||||
* The function showErrors() will print out the fatal error condition to standard output.
|
||||
* The function showErrors() will p//rint out the fatal error condition to standard output.
|
||||
*
|
||||
* A group of defines may be used during debugging to assert conditions which should
|
||||
* be true. These are named AssertTrace(), AssertThrow(), and AssertThrowMsg().
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/**
|
||||
* @file GasKinetics.h
|
||||
*
|
||||
* @ingroup chemkinetics
|
||||
*
|
||||
* $Author$
|
||||
* $Revision$
|
||||
* $Date$
|
||||
|
||||
@@ -70,9 +70,17 @@ namespace CanteraSpectra {
|
||||
m_gamma_lor = gamma;
|
||||
m_sigsqrt2 = SqrtTwo*m_sigma;
|
||||
m_gamma = gamma/m_sigsqrt2;
|
||||
m_eps = 1.0e-9;
|
||||
m_eps = 1.0e-20;
|
||||
}
|
||||
|
||||
void Voigt::testv() {
|
||||
m_gamma = 1.0e1;
|
||||
cout << F(1.0) << endl;
|
||||
m_gamma = 0.5;
|
||||
cout << F(1.0) << endl;
|
||||
m_gamma = 0.0001;
|
||||
cout << F(10.0) << endl;
|
||||
}
|
||||
/**
|
||||
* This method evaluates the function
|
||||
* \f[
|
||||
@@ -90,14 +98,18 @@ namespace CanteraSpectra {
|
||||
double b = (tau + x)/y;
|
||||
double t = b*y;
|
||||
double f1, f2, f3;
|
||||
double c0 = 2.0/(Pi*m_eps);
|
||||
double c0 = 2.0/(Pi*m_eps); // eps or e?
|
||||
const double c1 = 1.0/SqrtTwo;
|
||||
const double c2 = 2.0/SqrtPi;
|
||||
|
||||
if (y > c0/m_eps) {
|
||||
throw CanteraError("Voigt::F",
|
||||
"condition that y < c0/epsion violated");
|
||||
//cout << "returning 0.0 since y > c0/m_eps" << endl;
|
||||
return 0.0;
|
||||
}
|
||||
//{
|
||||
// throw CanteraError("Voigt::F",
|
||||
// "condition that y < c0/epsilon violated");
|
||||
//}
|
||||
while (1 > 0) {
|
||||
f1 = c2*y*exp(-Pi*Pi/(t*t));
|
||||
f2 = fabs(y*y - Pi*Pi/(t*t));
|
||||
@@ -107,7 +119,7 @@ namespace CanteraSpectra {
|
||||
if ((f1/(f2*f3)) < 0.5*m_eps) break;
|
||||
}
|
||||
double h = t/y;
|
||||
int N = int(0.5*b/h);
|
||||
int N = int(0.5 + b/h);
|
||||
double S = 0.0;
|
||||
double u = h/2;
|
||||
for (int i = 0; i < N; i++) {
|
||||
@@ -120,17 +132,21 @@ namespace CanteraSpectra {
|
||||
C = 2.0*exp(y*y - x*x)*cos(2*x*y)/(1.0 + exp(2*Pi/h));
|
||||
}
|
||||
else {
|
||||
//cout << "returning 0, since y2 > Pi/h" << endl;
|
||||
return 0.0;
|
||||
}
|
||||
//cout << "for x = " << x << ", y = " << y << endl;
|
||||
//cout << "V(x,y) = " << Q+C << endl;
|
||||
return Q + C;
|
||||
}
|
||||
|
||||
/**
|
||||
* Voigt profile.
|
||||
*
|
||||
* Not sure that constant is right.
|
||||
*/
|
||||
doublereal Voigt::profile(doublereal deltaFreq) {
|
||||
const double ff = m_gamma_lor*m_gamma_lor/(2.0*Pi*m_sigma*m_sigma);
|
||||
const double ff = 1.0/(m_sigsqrt2*SqrtPi);
|
||||
return ff*F(deltaFreq/m_sigsqrt2);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,8 @@ namespace CanteraSpectra {
|
||||
//virtual doublereal cumulative(doublereal deltaFreq)
|
||||
//virtual doublereal width()
|
||||
|
||||
void testv();
|
||||
|
||||
protected:
|
||||
|
||||
doublereal F(doublereal x);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "spectra.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
using namespace Cantera;
|
||||
using namespace CanteraSpectra;
|
||||
|
||||
int main() {
|
||||
// double B;
|
||||
@@ -24,31 +24,25 @@ int main() {
|
||||
// }
|
||||
|
||||
// test line broading classes
|
||||
double gam = 2.0;
|
||||
double sigma = 10.0;
|
||||
double gam = 2.0e0;
|
||||
double sigma = 5.0;
|
||||
|
||||
LineBroadener* lor = new Lorentzian(gam);
|
||||
LineBroadener* gaus = new Gaussian(sigma);
|
||||
LineBroadener* voig = new Voigt(sigma, gam);
|
||||
Voigt* voig = new Voigt(sigma, gam);
|
||||
//voig->testv();
|
||||
|
||||
double nu0 = 1000.0;
|
||||
double dnu = 0.2;
|
||||
double dnu = 0.1;
|
||||
double nu;
|
||||
double gw = gaus->width();
|
||||
double sum = 0.0, sumg = 0.0, sumlor = 0.0;
|
||||
for (int n = -1000; n < 1000; n++) {
|
||||
for (int n = -2000; n < 2000; n++) {
|
||||
//cout << n << endl;
|
||||
nu = n*dnu;
|
||||
sumg += gaus->profile(nu)*dnu;
|
||||
sum += voig->profile(nu)*dnu;
|
||||
sumlor += lor->profile(nu)*dnu;
|
||||
try {
|
||||
cout << nu << ", " << (*lor)(nu) << ", " << (*gaus)(nu)
|
||||
<< ", " << (*voig)(nu) << endl;
|
||||
}
|
||||
catch (CanteraError) {
|
||||
showErrors();
|
||||
}
|
||||
cout << nu << ", " << (*lor)(nu) << ", " << (*gaus)(nu)
|
||||
<< ", " << (*voig)(nu) << endl;
|
||||
}
|
||||
cout << "Voigt area = " << sum << endl;
|
||||
cout << "Gaussian area = " << sumg << endl;
|
||||
|
||||
Reference in New Issue
Block a user