[cantera]: adding and updating spectra tests
This commit is contained in:
parent
483bcab744
commit
2f197f0dc0
5 changed files with 76 additions and 5 deletions
|
|
@ -1,8 +1,8 @@
|
|||
#ifndef CT_SPECTRA_H_INCL
|
||||
#define CT_SECTRA_H_INCL
|
||||
|
||||
#include "kernel/LineBroadener.h"
|
||||
#include "kernel/rotor.h"
|
||||
#include "LineBroadener.h"
|
||||
#include "rotor.h"
|
||||
//#include "kernel/AbsorptionLine.h"
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ AC_OUTPUT(Makefile \
|
|||
test_problems/printUtilUnitTest/Makefile \
|
||||
test_problems/pureFluidTest/Makefile \
|
||||
test_problems/silane_equil/Makefile \
|
||||
test_problems/spectroscopy/Makefile \
|
||||
test_problems/cathermo/Makefile \
|
||||
test_problems/cathermo/DH_graph_1/Makefile \
|
||||
test_problems/cathermo/DH_graph_acommon/Makefile \
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ SUBDIRS = cathermo mixGasTransport ChemEquil_gri_matrix ChemEquil_gri_pairs
|
|||
SUBDIRS += ChemEquil_ionizedGas ChemEquil_red1 CpJump cxx_ex diamondSurf
|
||||
SUBDIRS += diamondSurf_dupl fracCoeff multiGasTransport NASA9poly_test
|
||||
SUBDIRS += negATest printUtilUnitTest pureFluidTest silane_equil
|
||||
SUBDIRS += spectroscopy
|
||||
|
||||
|
||||
# skipped:
|
||||
|
|
|
|||
23
test_problems/spectroscopy/Makefile.am
Normal file
23
test_problems/spectroscopy/Makefile.am
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
cc_sources = spectratest.cpp
|
||||
|
||||
INC = -I. -I$(top_builddir)/build/include/
|
||||
AM_CPPFLAGS = $(INC)
|
||||
AM_CXXFLAGS = $(AM_CPPFLAGS)
|
||||
|
||||
LINK = -luser -loneD -lzeroD -lequil -lkinetics -ltransport -lthermo
|
||||
LINK += -lctnumerics -lctmath -ltpx -lctspectra -lconverters -lctbase -lcvode
|
||||
LINK += -lctlapack -lctblas -lctf2c -lctcxx -lm -lctf2c -lstdc++
|
||||
AM_LDFLAGS = -L$(top_builddir)/build/lib/
|
||||
LIBS = $(LINK)
|
||||
|
||||
bin_PROGRAMS = spectroscopy
|
||||
library_includedir = $(INC)
|
||||
|
||||
#-----------------------
|
||||
# Cantera DH graph test
|
||||
#-----------------------
|
||||
|
||||
spectroscopy_SOURCES = $(cc_sources)
|
||||
|
||||
TESTS_ENVIRONMENT =
|
||||
TESTS = spectroscopy
|
||||
|
|
@ -1,7 +1,16 @@
|
|||
/**
|
||||
* @file spectratest.cpp
|
||||
*
|
||||
* $Author: $
|
||||
* $Date: 2007/05/04 15:18:45 $
|
||||
* $Revision: 1.3 $
|
||||
*
|
||||
* nick adding more useful on 2/7/12
|
||||
*/
|
||||
|
||||
#include "Cantera.h"
|
||||
#include "spectra.h"
|
||||
#include "kernel/Nuclei.h"
|
||||
#include "Nuclei.h"
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
using namespace CanteraSpectra;
|
||||
|
|
@ -13,6 +22,11 @@ int main() {
|
|||
if (*a == *b) {
|
||||
cout << "a and b and indistinguishable" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cout << "\nwhy are a and b not indistinguishable?\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// test line broading classes
|
||||
double gam = 2.0e0;
|
||||
|
|
@ -32,10 +46,42 @@ int main() {
|
|||
sumg += gaus->profile(nu)*dnu;
|
||||
sum += voig->profile(nu)*dnu;
|
||||
sumlor += lor->profile(nu)*dnu;
|
||||
cout << nu << ", " << (*lor)(nu) << ", " << (*gaus)(nu)
|
||||
<< ", " << (*voig)(nu) << endl;
|
||||
//cout << nu << ", " << (*lor)(nu) << ", " << (*gaus)(nu)
|
||||
// << ", " << (*voig)(nu) << endl;
|
||||
}
|
||||
|
||||
/* old output
|
||||
cout << "Voigt area = " << sum << endl;
|
||||
cout << "Gaussian area = " << sumg << endl;
|
||||
cout << "Lorentzian area = " << sumlor << endl;
|
||||
*/
|
||||
|
||||
// 'blessed' output:
|
||||
// Voigt area = 0.99363
|
||||
// Gaussian area = 1
|
||||
// Lorentzian area = 0.993634
|
||||
|
||||
// guessing a sane tolerance
|
||||
double TOL = .0001;
|
||||
|
||||
if(abs(sum-.99363) > TOL)
|
||||
{
|
||||
cout << "\nVOIGT AREA REGRESSION TEST FAILURE\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(abs(sumg-1.0) > TOL)
|
||||
{
|
||||
cout << "\nGAUSSIAN AREA REGRESSION TEST FAILURE\n";
|
||||
return 1;
|
||||
}
|
||||
if(abs(sumlor-.993634) > TOL)
|
||||
{
|
||||
cout << "\nLORENTZIAN AREA REGRESSION TEST FAILURE\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
// steady as she goes
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue