cmake files
This commit is contained in:
parent
78d2c16d59
commit
73bebe4768
35 changed files with 512 additions and 570 deletions
|
|
@ -3,6 +3,7 @@ PROJECT (Cantera)
|
|||
#----------------------------
|
||||
# user-configurable settings
|
||||
#----------------------------
|
||||
|
||||
INCLUDE (config.cmake)
|
||||
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ CONFIGURE_FILE (
|
|||
${PROJECT_BINARY_DIR}/config.h )
|
||||
|
||||
INCLUDE_DIRECTORIES (${PROJECT_BINARY_DIR})
|
||||
INCLUDE_DIRECTORIES (${PROJECT_BINARY_DIR}/build/include/cantera)
|
||||
|
||||
SET (LIBRARY_OUTPUT_PATH
|
||||
${PROJECT_BINARY_DIR}/build/lib/${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_VERSION} CACHE PATH "Single directory for all libraries"
|
||||
|
|
@ -39,6 +41,10 @@ MARK_AS_ADVANCED (
|
|||
EXECUTABLE_OUTPUT_PATH
|
||||
)
|
||||
|
||||
ADD_SUBDIRECTORY (ext)
|
||||
ADD_SUBDIRECTORY (Cantera)
|
||||
|
||||
SET ( CANTERA_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/Cantera/cxx/include )
|
||||
|
||||
SET(CMAKE_INSTALL_PREFIX /Applications/Cantera/include )
|
||||
INSTALL_FILES ( /cantera .h ${CANTERA_CXX_HEADERS} )
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
add_subdirectory(src)
|
||||
#add_subdirectory(clib)
|
||||
add_subdirectory(clib)
|
||||
# add_subdirectory(python)
|
||||
#add_subdirectory(fortran)
|
||||
|
||||
|
||||
|
|
|
|||
1
Cantera/clib/CMakeLists.txt
Normal file
1
Cantera/clib/CMakeLists.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
add_subdirectory(src)
|
||||
25
Cantera/clib/src/CMakeLists.txt
Normal file
25
Cantera/clib/src/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
SET (CLIB_SRCS ct.cpp Storage.cpp ctsurf.cpp ctrpath.cpp ctreactor.cpp
|
||||
ctfunc.cpp ctxml.cpp ctonedim.cpp ctmultiphase.cpp )
|
||||
|
||||
INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/Cantera/src/base)
|
||||
INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/Cantera/src/thermo)
|
||||
INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/Cantera/src/equil)
|
||||
INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/Cantera/src/numerics)
|
||||
INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/Cantera/src/kinetics)
|
||||
INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/Cantera/src/transport)
|
||||
INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/Cantera/src/converters)
|
||||
INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/Cantera/src/zeroD)
|
||||
INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/Cantera/src/oneD)
|
||||
|
||||
SET (LIBRARY_OUTPUT_PATH
|
||||
${PROJECT_BINARY_DIR}/build/lib/${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_VERSION} CACHE PATH "Single directory for all libraries"
|
||||
)
|
||||
|
||||
ADD_LIBRARY(clib ${CLIB_SRCS})
|
||||
|
||||
SET (CLIB_H ct.h Storage.h ctsurf.h ctrpath.h ctreactor.h
|
||||
ctfunc.h ctxml.h ctonedim.h ctmultiphase.h )
|
||||
|
||||
TARGET_LINK_LIBRARIES (clib oneD zeroD equil kinetics thermo ctbase)
|
||||
|
||||
# @phase_header_files@)
|
||||
|
|
@ -557,7 +557,7 @@ extern "C" {
|
|||
thermo_t* thrm = th(n);
|
||||
int nsp = thrm->nSpecies();
|
||||
if (lenm >= nsp) {
|
||||
thrm->getEnthalpy_RT(h_rt);
|
||||
thrm->getEnthalpy_RT_ref(h_rt);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
|
@ -571,7 +571,7 @@ extern "C" {
|
|||
thermo_t* thrm = th(n);
|
||||
int nsp = thrm->nSpecies();
|
||||
if (lenm >= nsp) {
|
||||
thrm->getEntropy_R(s_r);
|
||||
thrm->getEntropy_R_ref(s_r);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
|
@ -585,10 +585,10 @@ extern "C" {
|
|||
thermo_t* thrm = th(n);
|
||||
int nsp = thrm->nSpecies();
|
||||
if (lenm >= nsp) {
|
||||
thrm->getCp_R(cp_r);
|
||||
thrm->getCp_R_ref(cp_r);
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
else
|
||||
return -10;
|
||||
}
|
||||
catch (CanteraError) {return -1;}
|
||||
|
|
|
|||
35
Cantera/cmake_install.cmake
Normal file
35
Cantera/cmake_install.cmake
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# Install script for directory: /Users/dgg/dv/sf/cantera/Cantera
|
||||
|
||||
# Set the install prefix
|
||||
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
SET(CMAKE_INSTALL_PREFIX "/Applications/Cantera")
|
||||
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
|
||||
STRING(REGEX REPLACE "/$" "" CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
|
||||
|
||||
# Set the install configuration name.
|
||||
IF(NOT CMAKE_INSTALL_CONFIG_NAME)
|
||||
IF(BUILD_TYPE)
|
||||
STRING(REGEX REPLACE "^[^A-Za-z0-9_]+" ""
|
||||
CMAKE_INSTALL_CONFIG_NAME "${BUILD_TYPE}")
|
||||
ELSE(BUILD_TYPE)
|
||||
SET(CMAKE_INSTALL_CONFIG_NAME "Release")
|
||||
ENDIF(BUILD_TYPE)
|
||||
MESSAGE(STATUS "Install configuration: \"${CMAKE_INSTALL_CONFIG_NAME}\"")
|
||||
ENDIF(NOT CMAKE_INSTALL_CONFIG_NAME)
|
||||
|
||||
# Set the component getting installed.
|
||||
IF(NOT CMAKE_INSTALL_COMPONENT)
|
||||
IF(COMPONENT)
|
||||
MESSAGE(STATUS "Install component: \"${COMPONENT}\"")
|
||||
SET(CMAKE_INSTALL_COMPONENT "${COMPONENT}")
|
||||
ELSE(COMPONENT)
|
||||
SET(CMAKE_INSTALL_COMPONENT)
|
||||
ENDIF(COMPONENT)
|
||||
ENDIF(NOT CMAKE_INSTALL_COMPONENT)
|
||||
|
||||
IF(NOT CMAKE_INSTALL_LOCAL_ONLY)
|
||||
# Include the install script for each subdirectory.
|
||||
INCLUDE("/Users/dgg/dv/sf/cantera/Cantera/src/cmake_install.cmake")
|
||||
INCLUDE("/Users/dgg/dv/sf/cantera/Cantera/clib/cmake_install.cmake")
|
||||
|
||||
ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)
|
||||
|
|
@ -18,221 +18,221 @@
|
|||
using namespace Cantera;
|
||||
|
||||
int flamespeed(int np, void* p) {
|
||||
try {
|
||||
int i;
|
||||
IdealGasMix gas("gri30.cti","gri30_mix");
|
||||
|
||||
doublereal temp = 300.0; // K
|
||||
doublereal pressure = 1.0*OneAtm; //atm
|
||||
doublereal uin=0.3; //m/sec
|
||||
|
||||
gas.setState_TPX(temp, pressure, "CH4:1.0, O2:2.0, N2:7.52");
|
||||
int nsp = gas.nSpecies();
|
||||
|
||||
vector_fp x;
|
||||
x.resize(nsp);
|
||||
|
||||
double phi = 0.0;
|
||||
if (np > 0) phi = *(double*)(p);
|
||||
if (phi == 0.0) {
|
||||
cout << "Enter phi: ";
|
||||
cin >> phi;
|
||||
}
|
||||
|
||||
doublereal C_atoms=1.0;
|
||||
doublereal H_atoms=4.0;
|
||||
doublereal ax=C_atoms+H_atoms/4.0;
|
||||
doublereal fa_stoic=1.0/(4.76*ax);
|
||||
for(int k=0;k<nsp;k++){
|
||||
if(k==gas.speciesIndex("CH4")){ x[k]=1.0; }
|
||||
else if(k==gas.speciesIndex("O2")){ x[k]=0.21/phi/fa_stoic; }
|
||||
else if(k==gas.speciesIndex("N2")){ x[k]=0.79/phi/fa_stoic; }
|
||||
else{ x[k]=0.0; }
|
||||
}
|
||||
|
||||
gas.setState_TPX(temp,pressure,DATA_PTR(x));
|
||||
doublereal rho_in=gas.density();
|
||||
|
||||
double *yin=new double[nsp];
|
||||
gas.getMassFractions(yin);
|
||||
|
||||
try {
|
||||
equilibrate(gas,"HP");
|
||||
int i;
|
||||
IdealGasMix gas("gri30.cti","gri30_mix");
|
||||
|
||||
doublereal temp = 300.0; // K
|
||||
doublereal pressure = 1.0*OneAtm; //atm
|
||||
doublereal uin=0.3; //m/sec
|
||||
|
||||
gas.setState_TPX(temp, pressure, "CH4:1.0, O2:2.0, N2:7.52");
|
||||
int nsp = gas.nSpecies();
|
||||
|
||||
vector_fp x;
|
||||
x.resize(nsp);
|
||||
|
||||
double phi = 0.0;
|
||||
if (np > 0) phi = *(double*)(p);
|
||||
if (phi == 0.0) {
|
||||
cout << "Enter phi: ";
|
||||
cin >> phi;
|
||||
}
|
||||
|
||||
doublereal C_atoms=1.0;
|
||||
doublereal H_atoms=4.0;
|
||||
doublereal ax=C_atoms+H_atoms/4.0;
|
||||
doublereal fa_stoic=1.0/(4.76*ax);
|
||||
for(int k=0;k<nsp;k++){
|
||||
if(k==gas.speciesIndex("CH4")){ x[k]=1.0; }
|
||||
else if(k==gas.speciesIndex("O2")){ x[k]=0.21/phi/fa_stoic; }
|
||||
else if(k==gas.speciesIndex("N2")){ x[k]=0.79/phi/fa_stoic; }
|
||||
else{ x[k]=0.0; }
|
||||
}
|
||||
|
||||
gas.setState_TPX(temp,pressure,DATA_PTR(x));
|
||||
doublereal rho_in=gas.density();
|
||||
|
||||
double *yin=new double[nsp];
|
||||
gas.getMassFractions(yin);
|
||||
|
||||
try {
|
||||
equilibrate(gas,"HP");
|
||||
}
|
||||
catch (CanteraError) {
|
||||
showErrors(cout);
|
||||
}
|
||||
double *yout=new double[nsp];
|
||||
gas.getMassFractions(yout);
|
||||
doublereal rho_out = gas.density();
|
||||
doublereal Tad=gas.temperature();
|
||||
cout << phi<<' '<<Tad<<endl;
|
||||
|
||||
//double Tin=temp;
|
||||
//double Tout=Tad;
|
||||
//double breakpt=0.2;
|
||||
|
||||
|
||||
//============= build each domain ========================
|
||||
|
||||
|
||||
//-------- step 1: create the flow -------------
|
||||
|
||||
//AxiStagnFlow flow(&gas);
|
||||
FreeFlame flow(&gas);
|
||||
|
||||
// create an initial grid
|
||||
int nz=5;
|
||||
doublereal lz=0.02;
|
||||
doublereal *z=new double[nz+1];
|
||||
doublereal dz=lz/((doublereal)(nz-1));
|
||||
for(int iz=0;iz<nz;iz++){
|
||||
z[iz]=((doublereal)iz)*dz;
|
||||
}
|
||||
//add one node onto end of domain to help with zero gradient at outlet
|
||||
z[nz]=lz*1.05;
|
||||
nz++;
|
||||
|
||||
flow.setupGrid(nz, z);
|
||||
|
||||
// specify the objects to use to compute kinetic rates and
|
||||
// transport properties
|
||||
|
||||
Transport* trmix = newTransportMgr("Mix", &gas);
|
||||
Transport* trmulti = newTransportMgr("Multi", &gas);
|
||||
|
||||
flow.setTransport(*trmix);
|
||||
flow.setKinetics(gas);
|
||||
flow.setPressure(pressure);
|
||||
|
||||
//------- step 2: create the inlet -----------------------
|
||||
|
||||
Inlet1D inlet;
|
||||
|
||||
inlet.setMoleFractions(DATA_PTR(x));
|
||||
doublereal mdot=uin*rho_in;
|
||||
inlet.setMdot(mdot);
|
||||
inlet.setTemperature(temp);
|
||||
|
||||
|
||||
//------- step 3: create the outlet ---------------------
|
||||
|
||||
Outlet1D outlet;
|
||||
|
||||
//=================== create the container and insert the domains =====
|
||||
|
||||
vector<Domain1D*> domains;
|
||||
domains.push_back(&inlet);
|
||||
domains.push_back(&flow);
|
||||
domains.push_back(&outlet);
|
||||
|
||||
// OneDim flamesim(domains);
|
||||
|
||||
Sim1D flame(domains);
|
||||
|
||||
//----------- Supply initial guess----------------------
|
||||
|
||||
vector_fp locs;
|
||||
vector_fp value;
|
||||
|
||||
locs.resize(3);
|
||||
value.resize(3);
|
||||
|
||||
//ramp values from inlet to adiabatic flame conditions
|
||||
// over 70% of domain and then level off at equilibrium
|
||||
double z1=0.7;
|
||||
|
||||
double uout;
|
||||
uout=inlet.mdot()/rho_out;
|
||||
uin=inlet.mdot()/rho_in;
|
||||
locs[0]=0.0; locs[1]=z1; locs[2]=1.0;
|
||||
value[0]=uin; value[1]=uout; value[2]=uout;
|
||||
flame.setInitialGuess("u",locs,value);
|
||||
|
||||
value[0]=temp; value[1]=Tad; value[2]=Tad;
|
||||
flame.setInitialGuess("T",locs,value);
|
||||
|
||||
for(i=0;i<nsp;i++){
|
||||
value[0]=yin[i]; value[1]=yout[i]; value[2]=yout[i];
|
||||
flame.setInitialGuess(gas.speciesName(i),locs,value);
|
||||
}
|
||||
|
||||
inlet.setMoleFractions(DATA_PTR(x));
|
||||
inlet.setMdot(mdot);
|
||||
inlet.setTemperature(temp);
|
||||
|
||||
flame.showSolution();
|
||||
|
||||
int flowdomain=1;
|
||||
double ratio=10.0;
|
||||
double slope=0.2;
|
||||
double curve=0.02;
|
||||
double prune=-0.00005;
|
||||
|
||||
flame.setRefineCriteria(flowdomain,ratio,slope,curve,prune);
|
||||
|
||||
int loglevel=1;
|
||||
bool refine_grid = true;
|
||||
|
||||
/* Solve species*/
|
||||
//flow.fixTemperature();
|
||||
//refine_grid=false;
|
||||
//flame.solve(loglevel,refine_grid);
|
||||
|
||||
/* Solve freely propagating flame*/
|
||||
|
||||
/* Linearally interpolate to find location where this
|
||||
temperature would exist. The temperature at this
|
||||
location will then be fixed for remainder of
|
||||
calculation.*/
|
||||
|
||||
flow.fixTemperature();
|
||||
refine_grid=false;
|
||||
flame.setFixedTemperature(900.0);
|
||||
// flame.setAdiabaticFlame();
|
||||
flame.solve(loglevel,refine_grid);
|
||||
refine_grid = true;
|
||||
flow.solveEnergyEqn();
|
||||
flame.solve(loglevel,refine_grid);
|
||||
cout << "Flame speed with mixture-averaged transport: " <<
|
||||
flame.value(flowdomain,flow.componentIndex("u"),0) << " m/s" << endl;
|
||||
|
||||
// now switch to multicomponent transport
|
||||
flow.setTransport(*trmulti);
|
||||
flame.solve(loglevel, refine_grid);
|
||||
cout << "Flame speed with multicomponent transport: " <<
|
||||
flame.value(flowdomain,flow.componentIndex("u"),0) << " m/s" << endl;
|
||||
|
||||
// now enable Soret diffusion
|
||||
flow.enableSoret(true);
|
||||
flame.solve(loglevel, refine_grid);
|
||||
cout << "Flame speed with multicomponent transport + Soret: " <<
|
||||
flame.value(flowdomain,flow.componentIndex("u"),0) << " m/s" << endl;
|
||||
|
||||
//
|
||||
int np=flow.nPoints();
|
||||
vector<doublereal> zvec,Tvec,COvec,CO2vec,Uvec;
|
||||
|
||||
printf("\n%9s\t%8s\t%5s\t%7s\n","z (m)", "T (K)", "U (m/s)", "Y(CO)");
|
||||
for(int n=0;n<np;n++){
|
||||
Tvec.push_back(flame.value(flowdomain,flow.componentIndex("T"),n));
|
||||
COvec.push_back(flame.value(flowdomain,flow.componentIndex("CO"),n));
|
||||
CO2vec.push_back(flame.value(flowdomain,flow.componentIndex("CO2"),n));
|
||||
Uvec.push_back(flame.value(flowdomain,flow.componentIndex("u"),n));
|
||||
zvec.push_back(flow.grid(n));
|
||||
printf("%9.6f\t%8.3f\t%5.3f\t%7.5f\n",flow.grid(n),Tvec[n],Uvec[n],COvec[n]);
|
||||
}
|
||||
|
||||
cout << endl<<"Adiabatic flame temperature from equilibrium is: "<<Tad<<endl;
|
||||
cout << "Flame speed for phi="<<phi<<" is "<<Uvec[0]<<" m/s."<<endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (CanteraError) {
|
||||
showErrors(cout);
|
||||
showErrors(cerr);
|
||||
cerr << "program terminating." << endl;
|
||||
return -1;
|
||||
}
|
||||
double *yout=new double[nsp];
|
||||
gas.getMassFractions(yout);
|
||||
doublereal rho_out = gas.density();
|
||||
doublereal Tad=gas.temperature();
|
||||
cout << phi<<' '<<Tad<<endl;
|
||||
|
||||
//double Tin=temp;
|
||||
//double Tout=Tad;
|
||||
//double breakpt=0.2;
|
||||
|
||||
|
||||
//============= build each domain ========================
|
||||
|
||||
|
||||
//-------- step 1: create the flow -------------
|
||||
|
||||
//AxiStagnFlow flow(&gas);
|
||||
FreeFlame flow(&gas);
|
||||
|
||||
// create an initial grid
|
||||
int nz=5;
|
||||
doublereal lz=0.02;
|
||||
doublereal *z=new double[nz+1];
|
||||
doublereal dz=lz/((doublereal)(nz-1));
|
||||
for(int iz=0;iz<nz;iz++){
|
||||
z[iz]=((doublereal)iz)*dz;
|
||||
}
|
||||
//add one node onto end of domain to help with zero gradient at outlet
|
||||
z[nz]=lz*1.05;
|
||||
nz++;
|
||||
|
||||
flow.setupGrid(nz, z);
|
||||
|
||||
// specify the objects to use to compute kinetic rates and
|
||||
// transport properties
|
||||
|
||||
Transport* trmix = newTransportMgr("Mix", &gas);
|
||||
Transport* trmulti = newTransportMgr("Multi", &gas);
|
||||
|
||||
flow.setTransport(*trmix);
|
||||
flow.setKinetics(gas);
|
||||
flow.setPressure(pressure);
|
||||
|
||||
//------- step 2: create the inlet -----------------------
|
||||
|
||||
Inlet1D inlet;
|
||||
|
||||
inlet.setMoleFractions(DATA_PTR(x));
|
||||
doublereal mdot=uin*rho_in;
|
||||
inlet.setMdot(mdot);
|
||||
inlet.setTemperature(temp);
|
||||
|
||||
|
||||
//------- step 3: create the outlet ---------------------
|
||||
|
||||
Outlet1D outlet;
|
||||
|
||||
//=================== create the container and insert the domains =====
|
||||
|
||||
vector<Domain1D*> domains;
|
||||
domains.push_back(&inlet);
|
||||
domains.push_back(&flow);
|
||||
domains.push_back(&outlet);
|
||||
|
||||
// OneDim flamesim(domains);
|
||||
|
||||
Sim1D flame(domains);
|
||||
|
||||
//----------- Supply initial guess----------------------
|
||||
|
||||
vector_fp locs;
|
||||
vector_fp value;
|
||||
|
||||
locs.resize(3);
|
||||
value.resize(3);
|
||||
|
||||
//ramp values from inlet to adiabatic flame conditions
|
||||
// over 70% of domain and then level off at equilibrium
|
||||
double z1=0.7;
|
||||
|
||||
double uout;
|
||||
uout=inlet.mdot()/rho_out;
|
||||
uin=inlet.mdot()/rho_in;
|
||||
locs[0]=0.0; locs[1]=z1; locs[2]=1.0;
|
||||
value[0]=uin; value[1]=uout; value[2]=uout;
|
||||
flame.setInitialGuess("u",locs,value);
|
||||
|
||||
value[0]=temp; value[1]=Tad; value[2]=Tad;
|
||||
flame.setInitialGuess("T",locs,value);
|
||||
|
||||
for(i=0;i<nsp;i++){
|
||||
value[0]=yin[i]; value[1]=yout[i]; value[2]=yout[i];
|
||||
flame.setInitialGuess(gas.speciesName(i),locs,value);
|
||||
}
|
||||
|
||||
inlet.setMoleFractions(DATA_PTR(x));
|
||||
inlet.setMdot(mdot);
|
||||
inlet.setTemperature(temp);
|
||||
|
||||
flame.showSolution();
|
||||
|
||||
int flowdomain=1;
|
||||
double ratio=10.0;
|
||||
double slope=0.2;
|
||||
double curve=0.02;
|
||||
double prune=-0.00005;
|
||||
|
||||
flame.setRefineCriteria(flowdomain,ratio,slope,curve,prune);
|
||||
|
||||
int loglevel=1;
|
||||
bool refine_grid = true;
|
||||
|
||||
/* Solve species*/
|
||||
//flow.fixTemperature();
|
||||
//refine_grid=false;
|
||||
//flame.solve(loglevel,refine_grid);
|
||||
|
||||
/* Solve freely propagating flame*/
|
||||
|
||||
/* Linearally interpolate to find location where this
|
||||
temperature would exist. The temperature at this
|
||||
location will then be fixed for remainder of
|
||||
calculation.*/
|
||||
|
||||
flow.fixTemperature();
|
||||
refine_grid=false;
|
||||
flame.setFixedTemperature(900.0);
|
||||
// flame.setAdiabaticFlame();
|
||||
flame.solve(loglevel,refine_grid);
|
||||
refine_grid = true;
|
||||
flow.solveEnergyEqn();
|
||||
flame.solve(loglevel,refine_grid);
|
||||
cout << "Flame speed with mixture-averaged transport: " <<
|
||||
flame.value(flowdomain,flow.componentIndex("u"),0) << " m/s" << endl;
|
||||
|
||||
// now switch to multicomponent transport
|
||||
flow.setTransport(*trmulti);
|
||||
flame.solve(loglevel, refine_grid);
|
||||
cout << "Flame speed with multicomponent transport: " <<
|
||||
flame.value(flowdomain,flow.componentIndex("u"),0) << " m/s" << endl;
|
||||
|
||||
// now enable Soret diffusion
|
||||
flow.enableSoret(true);
|
||||
flame.solve(loglevel, refine_grid);
|
||||
cout << "Flame speed with multicomponent transport + Soret: " <<
|
||||
flame.value(flowdomain,flow.componentIndex("u"),0) << " m/s" << endl;
|
||||
|
||||
//
|
||||
int np=flow.nPoints();
|
||||
vector<doublereal> zvec,Tvec,COvec,CO2vec,Uvec;
|
||||
|
||||
printf("\n%9s\t%8s\t%5s\t%7s\n","z (m)", "T (K)", "U (m/s)", "Y(CO)");
|
||||
for(int n=0;n<np;n++){
|
||||
Tvec.push_back(flame.value(flowdomain,flow.componentIndex("T"),n));
|
||||
COvec.push_back(flame.value(flowdomain,flow.componentIndex("CO"),n));
|
||||
CO2vec.push_back(flame.value(flowdomain,flow.componentIndex("CO2"),n));
|
||||
Uvec.push_back(flame.value(flowdomain,flow.componentIndex("u"),n));
|
||||
zvec.push_back(flow.grid(n));
|
||||
printf("%9.6f\t%8.3f\t%5.3f\t%7.5f\n",flow.grid(n),Tvec[n],Uvec[n],COvec[n]);
|
||||
}
|
||||
|
||||
cout << endl<<"Adiabatic flame temperature from equilibrium is: "<<Tad<<endl;
|
||||
cout << "Flame speed for phi="<<phi<<" is "<<Uvec[0]<<" m/s."<<endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
catch (CanteraError) {
|
||||
showErrors(cerr);
|
||||
cerr << "program terminating." << endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef CXX_DEMO
|
||||
|
|
|
|||
1
Cantera/python/CMakeLists.txt
Normal file
1
Cantera/python/CMakeLists.txt
Normal file
|
|
@ -0,0 +1 @@
|
|||
add_subdirectory (src)
|
||||
|
|
@ -19,7 +19,7 @@ class Func1:
|
|||
A Functor is an object that behaves like a function. Class 'Func1'
|
||||
is the base class from which several functor classes derive. These
|
||||
classes are designed to allow specifying functions of time from Python
|
||||
that can be used by the C++ kernel.
|
||||
that can be used by the C++ kernel.
|
||||
|
||||
Functors can be added, multiplied, and divided to yield new functors.
|
||||
>>> f1 = Polynomial([1.0, 0.0, 3.0]) # 3*t*t + 1
|
||||
|
|
@ -147,7 +147,7 @@ class Func1:
|
|||
|
||||
def write(self, arg = 'x', length = 1000):
|
||||
return _cantera.func_write(self._func_id, length, arg)
|
||||
|
||||
|
||||
|
||||
class Sin(Func1):
|
||||
def __init__(self,omega=1.0):
|
||||
|
|
@ -249,6 +249,15 @@ class Fourier(Func1):
|
|||
Func1.__init__(self, 1, n-1, ravel(transpose(cc)))
|
||||
|
||||
|
||||
##Sum of modified Arrhenius terms. Instances of class 'Arrhenius' evaluate
|
||||
# \f[
|
||||
# f(T) = \sum_{n=1}^N A_n T^{b_n}\exp(-E_n/T)
|
||||
# \f]
|
||||
#
|
||||
# Example:
|
||||
#
|
||||
# >>> f = Arrhenius([(a0, b0, e0), (a1, b1, e1)])
|
||||
#
|
||||
class Arrhenius(Func1):
|
||||
"""Sum of modified Arrhenius terms. Instances of class 'Arrhenius' evaluate
|
||||
\f[
|
||||
|
|
@ -306,6 +315,11 @@ class PeriodicFunction(Func1):
|
|||
# functions that combine two functions
|
||||
|
||||
class ComboFunc1(Func1):
|
||||
"""
|
||||
Combines two functions.
|
||||
This class is the base class for functors that combine two
|
||||
other functors in a binary operation.
|
||||
"""
|
||||
|
||||
def __init__(self, typ, f1, f2):
|
||||
self._own = 1
|
||||
|
|
@ -407,19 +421,21 @@ class RatioFunction(ComboFunc1):
|
|||
"""
|
||||
ComboFunc1.__init__(self, 40, f1, f2)
|
||||
|
||||
## Function of a function.
|
||||
# Instances of class CompositeFunction evaluate f(g(t)) for two supplied
|
||||
# functors f and g. It is not necessary to explicitly create an instance
|
||||
# of 'CompositeFunction', since the () operator of the base class is
|
||||
# overloaded to return a CompositeFunction when called with a functor
|
||||
# argument.
|
||||
# @example
|
||||
# >>> f1 = Polynomial([2.0, 1.0])
|
||||
# >>> f2 = Polynomial([3.0, -5.0])
|
||||
# >>> f3 = f1(f2) # functor to evaluate 2(3t - 5) + 1
|
||||
# In this example, object 'f3' is a functor of class'CompositeFunction'
|
||||
# that calls f1 and f2 and returns f1(f2(t)).
|
||||
|
||||
class CompositeFunction(ComboFunc1):
|
||||
"""Function of a function.
|
||||
Instances of class CompositeFunction evaluate f(g(t)) for two supplied
|
||||
functors f and g. It is not necessary to explicitly create an instance
|
||||
of 'CompositeFunction', since the () operator of the base class is
|
||||
overloaded to return a CompositeFunction when called with a functor
|
||||
argument.
|
||||
>>> f1 = Polynomial([2.0, 1.0])
|
||||
>>> f2 = Polynomial([3.0, -5.0])
|
||||
>>> f3 = f1(f2) # functor to evaluate 2(3t - 5) + 1
|
||||
In this example, object 'f3' is a functor of class'CompositeFunction'
|
||||
that calls f1 and f2 and returns f1(f2(t)).
|
||||
"""
|
||||
|
||||
def __init__(self, f1, f2):
|
||||
"""
|
||||
f1 - first functor.
|
||||
|
|
@ -427,6 +443,7 @@ class CompositeFunction(ComboFunc1):
|
|||
f2 - second functor.
|
||||
"""
|
||||
ComboFunc1.__init__(self, 60, f1, f2)
|
||||
|
||||
|
||||
class DerivativeFunction(Func1):
|
||||
def __init__(self, f):
|
||||
|
|
@ -435,9 +452,11 @@ class DerivativeFunction(Func1):
|
|||
self._own = 1
|
||||
self._func_id = _cantera.func_derivative(f.func_id())
|
||||
|
||||
##
|
||||
# The derivative of f
|
||||
#
|
||||
def derivative(f):
|
||||
return DerivativeFunction(f)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -28,13 +28,11 @@ class Kinetics:
|
|||
the specification of the parameters.
|
||||
"""
|
||||
np = len(phases)
|
||||
#self._np = np
|
||||
self._sp = []
|
||||
self._phnum = {}
|
||||
|
||||
# p0 through p4 are the integer indices of the phase objects
|
||||
# corresponding to the input sequence of phases
|
||||
|
||||
self._end = [0]
|
||||
p0 = phases[0].thermophase()
|
||||
p1 = -1
|
||||
|
|
|
|||
|
|
@ -1,180 +0,0 @@
|
|||
"""
|
||||
Write C functions implementing a surface reaction mechanism.
|
||||
NOT CURRENTLY FUNCTIONAL
|
||||
"""
|
||||
|
||||
from Cantera import CanteraError
|
||||
from Cantera import units
|
||||
from Numeric import array
|
||||
from Cantera import constants
|
||||
import math
|
||||
import types
|
||||
|
||||
hdr = """
|
||||
/*
|
||||
|
||||
The identity of the species in each phase is as listed below.
|
||||
"""
|
||||
|
||||
ropheader = """
|
||||
|
||||
/*
|
||||
Get the reaction rates of progress given the concentrations.
|
||||
|
||||
conc --- concentrations in kmol/m^3 or kmol/m^2. Array c
|
||||
must be dimensioned at least KB1 + KB2 + KS. The first
|
||||
KB1 entries are the concentrations of species in bulk phase 1,
|
||||
the next KB2 entries are the concentrations of species in bulk
|
||||
phase 2, and the final KS entries are the concentrations of the
|
||||
surface species.
|
||||
|
||||
ropf --- rates of progress of the surface reactions in kmol/m^2/s.
|
||||
Must be dimensioned at least NSR, the number of surface reactions.
|
||||
|
||||
*/
|
||||
|
||||
void get_rop(double* c, double* kf, double* ropf) {
|
||||
"""
|
||||
|
||||
sdotheader = """
|
||||
|
||||
void get_sdot(double* r, double* sdot) {
|
||||
"""
|
||||
|
||||
rateheader = """
|
||||
|
||||
/* get the forward reaction rates */
|
||||
void get_kf(double T, double* kf) {
|
||||
double logT = log(T);
|
||||
double rt = 1.0/T;
|
||||
"""
|
||||
|
||||
finaltxt = """
|
||||
}
|
||||
"""
|
||||
|
||||
class SurfWriter:
|
||||
|
||||
def __init__(self, iface, mechname):
|
||||
self.bulk1 = iface.p1
|
||||
self.bulk2 = iface.p2
|
||||
self.surf = iface
|
||||
self.sp = {}
|
||||
self.f = open(mechname+'.c', 'w')
|
||||
self.write_top()
|
||||
self.f.write('\n#ifdef __cplusplus\nextern "C" {\n#endif')
|
||||
self.rop = ropheader
|
||||
self.rate = rateheader
|
||||
self.nrxns = 0
|
||||
self.sdot = {}
|
||||
|
||||
def write(self):
|
||||
self.f.write(self.rop)
|
||||
self.f.write(' }\n\n')
|
||||
self.f.write(sdotheader)
|
||||
for k in self.sdot.keys():
|
||||
self.f.write('\n /* '+self.sp[k]+' */\n')
|
||||
self.f.write(' sdot['+`k`+'] = '+self.sdot[k]+';\n')
|
||||
self.f.write(' }\n\n')
|
||||
self.f.write(self.rate)
|
||||
self.f.write(' }\n')
|
||||
self.f.write('#ifdef __cplusplus\n}\n#endif\n')
|
||||
self.f.close()
|
||||
|
||||
def write_top(self):
|
||||
self.f.write(hdr)
|
||||
n1 = self.bulk1.nSpecies()
|
||||
self.f.write('Bulk phase 1 species: '+`n1`+' total.\n')
|
||||
|
||||
sp = self.bulk1.speciesNames()
|
||||
i = 0
|
||||
k = 0
|
||||
for s in sp:
|
||||
self.f.write('%3d %s\n' % (i, s))
|
||||
i += 1
|
||||
self.sp[k] = s
|
||||
k += 1
|
||||
self.f.write('\n\n')
|
||||
|
||||
if self.bulk2:
|
||||
n2 = self.bulk2.nSpecies()
|
||||
self.f.write('Bulk phase 2 species: '+`n2`+' total.\n')
|
||||
|
||||
sp = self.bulk2.speciesNames()
|
||||
i = 0
|
||||
for s in sp:
|
||||
self.f.write('%3d %s\n' % (i, s))
|
||||
i += 1
|
||||
self.sp[k] = s
|
||||
k += 1
|
||||
self.f.write('\n\n')
|
||||
|
||||
else:
|
||||
self.f.write('No second bulk phase.\n\n')
|
||||
|
||||
ns = self.surf.nSpecies()
|
||||
self.f.write('Surface species: '+`ns`+' total.\n')
|
||||
sp = self.surf.speciesNames()
|
||||
i = 0
|
||||
for s in sp:
|
||||
self.f.write('%3d %s\n' % (i, s))
|
||||
i += 1
|
||||
self.sp[k] = s
|
||||
k += 1
|
||||
self.f.write('\n\n*/')
|
||||
|
||||
self.f.write('\n\n')
|
||||
|
||||
|
||||
def write_update_rate(self, rate):
|
||||
i = self.nrxns
|
||||
self.rate += ' kf['+`i`+'] = '+'%17.10e' % (rate[0],)
|
||||
if rate[1] == 0.0 and rate[2] == 0.0:
|
||||
self.rate += ';\n'
|
||||
return
|
||||
self.rate += ' * exp('
|
||||
if rate[1] <> 0.0:
|
||||
self.rate += '%f * logT' % (rate[1],)
|
||||
if rate[2] <> 0.0:
|
||||
self.rate += '- %f * rt' % (rate[2],)
|
||||
self.rate += ');\n'
|
||||
|
||||
|
||||
def write_ROP(self, rindex, rstoich, rorder,
|
||||
pindex, pstoich, rate):
|
||||
f = ''
|
||||
i = self.nrxns
|
||||
f += ' ropf['+`i`+'] = kf['+`i`+']*'
|
||||
nr = len(rindex)
|
||||
for n in range(nr):
|
||||
k = rindex[n]
|
||||
if rorder[n] == rstoich[n]:
|
||||
for j in range(rstoich[n]):
|
||||
f +='c['+`k`+']*'
|
||||
else:
|
||||
f += 'pow(c['+`k`+'], '+`rorder[n]`+')*'
|
||||
f = f[:-1]+';\n'
|
||||
self.rop += f
|
||||
|
||||
def write_sdot(self, rindex, rstoich, pindex, pstoich):
|
||||
i = self.nrxns
|
||||
nr = len(rindex)
|
||||
for n in range(nr):
|
||||
k = rindex[n]
|
||||
if rstoich[n] == 1: st = ''
|
||||
else: st = `rstoich[n]`+'*'
|
||||
if not self.sdot.has_key(k):
|
||||
self.sdot[k] = ' -'+st+'r['+`i`+']'
|
||||
else:
|
||||
self.sdot[k] += ' - '+st+'r['+`i`+']'
|
||||
|
||||
np = len(pindex)
|
||||
for n in range(np):
|
||||
k = pindex[n]
|
||||
if pstoich[n] == 1: st = ''
|
||||
else: st = `pstoich[n]`+'*'
|
||||
if not self.sdot.has_key(k):
|
||||
self.sdot[k] = st+'r['+`i`+']'
|
||||
else:
|
||||
self.sdot[k] += ' + '+st+'r['+`i`+']'
|
||||
|
||||
|
|
@ -1,11 +1,10 @@
|
|||
""" This module implements class ThermoPhase, a class representing
|
||||
thermodynamic phases. """
|
||||
|
||||
"""
|
||||
This module implements class ThermoPhase, a class representing
|
||||
thermodynamic phases.
|
||||
"""
|
||||
from Cantera.num import zeros
|
||||
|
||||
from Cantera.Phase import Phase
|
||||
|
||||
|
||||
import _cantera
|
||||
import types
|
||||
|
||||
|
|
@ -13,7 +12,8 @@ def thermoIndex(id):
|
|||
return _cantera.thermo_thermoIndex(id)
|
||||
|
||||
class ThermoPhase(Phase):
|
||||
""" A phase with an equation of state.
|
||||
"""
|
||||
A phase with an equation of state.
|
||||
|
||||
Class ThermoPhase may be used to represent the intensive
|
||||
thermodynamic state of a phase of matter, which might be a gas,
|
||||
|
|
@ -23,10 +23,10 @@ class ThermoPhase(Phase):
|
|||
Class ThermoPhase is not usually instantiated directly. It is used
|
||||
as base class for classes Solution and Interface.
|
||||
|
||||
See: Solution, Interface
|
||||
@see Solution, Interface
|
||||
"""
|
||||
|
||||
#used in the 'equilibrate' method
|
||||
# used in the 'equilibrate' method
|
||||
_equilmap = {'TP':104,'TV':100,'HP':101,'SP':102,'SV':107,'UV':105,
|
||||
'PT':104,'VT':100,'PH':101,'PS':102,'VS':107,'VU':105}
|
||||
|
||||
|
|
@ -46,8 +46,8 @@ class ThermoPhase(Phase):
|
|||
self.idtag = ""
|
||||
|
||||
if index >= 0:
|
||||
# create a Python wrapper for an existing kernel
|
||||
# ThermoPhase instance
|
||||
# create a Python wrapper for an existing kernel
|
||||
# ThermoPhase instance
|
||||
self._phase_id = index
|
||||
|
||||
elif xml_phase:
|
||||
|
|
@ -67,9 +67,14 @@ class ThermoPhase(Phase):
|
|||
_cantera.thermo_delete(self._phase_id)
|
||||
|
||||
def name(self):
|
||||
"""The name assigned to the phase. The default value is the name
|
||||
attribute from the CTI file. But method setName can be used to
|
||||
set the name to anything desired, e.g. 'gas at inlet' or 'exhaust'
|
||||
"""
|
||||
return self.idtag
|
||||
|
||||
def setName(self, name):
|
||||
""" Set the name attribute. This can be any string"""
|
||||
self.idtag = name
|
||||
|
||||
def refPressure(self):
|
||||
|
|
@ -157,14 +162,14 @@ class ThermoPhase(Phase):
|
|||
return self.selectElements(lamb, elements)
|
||||
|
||||
def enthalpies_RT(self, species = []):
|
||||
"""Pure species non-dimensional enthalpies.
|
||||
"""Pure species non-dimensional reference state enthalpies.
|
||||
|
||||
This method returns an array containing the pure-species
|
||||
standard-state enthalpies divided by RT. For gaseous species,
|
||||
these values are ideal gas enthalpies."""
|
||||
hrt = _cantera.thermo_getarray(self._phase_id,23)
|
||||
return self.selectSpecies(hrt, species)
|
||||
|
||||
|
||||
def entropies_R(self, species = []):
|
||||
"""Pure species non-dimensional entropies.
|
||||
|
||||
|
|
@ -278,40 +283,39 @@ class ThermoPhase(Phase):
|
|||
|
||||
def equilibrate(self, XY, solver = -1, rtol = 1.0e-9,
|
||||
maxsteps = 1000, maxiter = 100, loglevel = 0):
|
||||
"""Set to a state of chemical equilibrium holding property pair
|
||||
'XY' constant.
|
||||
|
||||
XY -- A two-letter string, which must be one of the set
|
||||
['TP','TV','HP','SP','SV','UV','PT','VT','PH','PS','VS','VU'].
|
||||
If H, U, S, or V is specified, the value must be the specific
|
||||
value (per unit mass).
|
||||
|
||||
solver -- specifies the equilibrium solver to use. If solver =
|
||||
0, a fast solver using the element potential method will be
|
||||
used. If solver > 0, a slower but more robust Gibbs
|
||||
minimization solver will be used. If solver < 0 or
|
||||
unspecified, the fast solver will be tried first, then if it
|
||||
fails the other will be tried.
|
||||
|
||||
rtol -- the relative error tolerance.
|
||||
|
||||
maxsteps -- maximum number of steps in composition to take to
|
||||
find a converged solution.
|
||||
|
||||
maxiter -- for the Gibbs minimization solver only, this
|
||||
specifies the number of 'outer' iterations on T or P when some
|
||||
property pair other than TP is specified.
|
||||
|
||||
loglevel -- set to a value > 0 to write diagnostic output to a
|
||||
file in HTML format. Larger values generate more detailed
|
||||
information. The file will be named 'equilibrate_log.html.'
|
||||
Subsequent files will be named 'equillibrate_log1.html', etc.,
|
||||
so that log files are not overwritten.
|
||||
|
||||
"""
|
||||
""" Set to a state of chemical equilibrium holding property pair
|
||||
'XY' constant.
|
||||
|
||||
XY --- A two-letter string, which must be one of the set
|
||||
['TP','TV','HP','SP','SV','UV','PT','VT','PH','PS','VS','VU'].
|
||||
If H, U, S, or V is specified, the value must be the specific
|
||||
value (per unit mass)
|
||||
|
||||
solver --- Specifies the equilibrium solver to use. If solver =
|
||||
0, a fast solver using the element potential method will be
|
||||
used. If solver > 0, a slower but more robust Gibbs
|
||||
minimization solver will be used. If solver < 0 or
|
||||
unspecified, the fast solver will be tried first, then if it
|
||||
fails the other will be tried.
|
||||
|
||||
rtol -- the relative error tolerance.
|
||||
|
||||
maxsteps -- maximum number of steps in composition to take to
|
||||
find a converged solution.
|
||||
|
||||
maxiter -- for the Gibbs minimization solver only, this
|
||||
specifies the number of 'outer' iterations on T or P when some
|
||||
property pair other than TP is specified.
|
||||
|
||||
loglevel -- set to a value > 0 to write diagnostic output to a
|
||||
file in HTML format. Larger values generate more detailed
|
||||
information. The file will be named 'equilibrate_log.html.'
|
||||
Subsequent files will be named 'equillibrate_log1.html', etc.,
|
||||
so that log files are not overwritten.
|
||||
|
||||
"""
|
||||
_cantera.thermo_equil(self._phase_id, XY, solver,
|
||||
rtol, maxsteps, maxiter, loglevel)
|
||||
|
||||
|
||||
def saveState(self):
|
||||
"""Return an array with state information that can later be
|
||||
|
|
|
|||
|
|
@ -139,6 +139,11 @@ class Transport:
|
|||
return _cantera.tran_binaryDiffCoeffs(self.__tr_id,
|
||||
self.trnsp)
|
||||
|
||||
def diffusionCoeffs(self):
|
||||
"""Species diffusion coefficients. (m^2/s)."""
|
||||
return self.mixDiffCoeffs()
|
||||
|
||||
|
||||
def mixDiffCoeffs(self):
|
||||
"""Mixture-averaged diffusion coefficients."""
|
||||
return _cantera.tran_mixDiffCoeffs(self.__tr_id,
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
import types
|
||||
import _cantera
|
||||
from num import *
|
||||
from constants import *
|
||||
from exceptions import *
|
||||
from gases import *
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# homogeneous equilibrium of a gas
|
||||
# homogeneous equilibrium of a gas.
|
||||
|
||||
from Cantera import *
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,10 @@
|
|||
add_subdirectory(base)
|
||||
add_subdirectory(thermo)
|
||||
add_subdirectory(numerics)
|
||||
add_subdirectory(kinetics)
|
||||
add_subdirectory(transport)
|
||||
add_subdirectory(equil)
|
||||
add_subdirectory(spectra)
|
||||
|
||||
add_subdirectory(oneD)
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ namespace Cantera {
|
|||
normal_color = "steelblue";
|
||||
dashed_color = "gray";
|
||||
dot_options = "center=1;";
|
||||
m_font = RXNPATH_FONT;
|
||||
m_font = "Helvetica"; // RXNPATH_FONT;
|
||||
bold_min = 0.2;
|
||||
dashed_max = 0.0;
|
||||
label_min = 0.0;
|
||||
|
|
|
|||
|
|
@ -17,10 +17,6 @@
|
|||
#ifndef CT_DENSEMATRIX_H
|
||||
#define CT_DENSEMATRIX_H
|
||||
|
||||
//#include <iostream>
|
||||
//#include <vector>
|
||||
//using namespace std;
|
||||
|
||||
#include "ct_defs.h"
|
||||
#include "Array.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -63,9 +63,6 @@ const CBLAS_ORDER cblasOrder[2] = { CblasRowMajor, CblasColMajor };
|
|||
const CBLAS_TRANSPOSE cblasTrans[2] = { CblasNoTrans, CblasTrans };
|
||||
#endif
|
||||
|
||||
//#ifdef DARWIN
|
||||
//#include <Accelerate.h>
|
||||
//#else
|
||||
|
||||
// C interfaces for Fortran Lapack routines
|
||||
extern "C" {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,8 @@ SET (THERMO_SRCS State.cpp Elements.cpp Constituents.cpp Phase.cpp
|
|||
ThermoFactory.cpp phasereport.cpp SemiconductorPhase.cpp
|
||||
StoichSubstance.cpp PureFluidPhase.cpp LatticeSolidPhase.cpp
|
||||
LatticePhase.cpp)
|
||||
SET(CMAKE_CXX_FLAGS -I/${PROJECT_SOURCE_DIR}/Cantera/src/base)
|
||||
|
||||
INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/Cantera/src/base)
|
||||
|
||||
SET (LIBRARY_OUTPUT_PATH
|
||||
${PROJECT_BINARY_DIR}/build/lib/${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_VERSION} CACHE PATH "Single directory for all libraries"
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
/**
|
||||
* @file State.h
|
||||
* Header for the class State, that manages the independent variables of temperature, mass density,
|
||||
* and species mass/mole fraction that define the thermodynamic state (see \ref phases and
|
||||
* class \link Cantera::State State\endlink).
|
||||
* @file State.h Header for the class State, that manages the
|
||||
* independent variables of temperature, mass density, and species
|
||||
* mass/mole fraction that define the thermodynamic state (see \ref
|
||||
* phases and class \link Cantera::State State\endlink).
|
||||
*/
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* $Date$
|
||||
*/
|
||||
|
||||
// copyright 2003 California Institute of Technology
|
||||
// copyright 2008 California Institute of Technology
|
||||
|
||||
|
||||
// turn off warnings under Windows
|
||||
|
|
@ -27,16 +27,14 @@ using namespace std;
|
|||
|
||||
namespace Cantera {
|
||||
|
||||
//////////////////// class SolidTransport methods //////////////
|
||||
|
||||
SolidTransport::SolidTransport() {}
|
||||
|
||||
void SolidTransport::setParameters(int n, int k, double* p) {
|
||||
switch (n) {
|
||||
|
||||
|
||||
case 0:
|
||||
// set the Arrhenius parameters for the diffusion coefficient
|
||||
// of species k.
|
||||
case 0:
|
||||
m_sp.push_back(k);
|
||||
m_Adiff.push_back(p[0]);
|
||||
m_Ndiff.push_back(p[1]);
|
||||
|
|
@ -44,23 +42,19 @@ namespace Cantera {
|
|||
m_nmobile = m_sp.size();
|
||||
break;
|
||||
|
||||
// set the thermal conductivity.
|
||||
case 1:
|
||||
m_lam = p[0];
|
||||
// set the thermal conductivity Arrhenius parameters.
|
||||
m_Alam = p[0];
|
||||
m_Nlam = p[2];
|
||||
m_Elam = p[2];
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************
|
||||
*
|
||||
* Public methods
|
||||
*
|
||||
*********************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Compute the mobilities of the species from the diffusion coefficients,
|
||||
* using the Einstein relation.
|
||||
|
|
@ -76,9 +70,14 @@ namespace Cantera {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Thermal Conductivity.
|
||||
* \f[
|
||||
* \lambda = A T^n \exp(-E/RT)
|
||||
*/
|
||||
doublereal SolidTransport::thermalConductivity() {
|
||||
return m_lam;
|
||||
doublereal t = m_thermo->temperature();
|
||||
return m_Alam *pow(t, m_Nlam) * exp(-m_Elam/t);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,9 @@ namespace Cantera {
|
|||
vector_fp m_Ndiff;
|
||||
vector_fp m_Ediff;
|
||||
vector_int m_sp;
|
||||
doublereal m_lam;
|
||||
doublereal m_Alam;
|
||||
doublereal m_Nlam;
|
||||
doublereal m_Elam;
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
73
config.cmake
73
config.cmake
|
|
@ -1,77 +1,12 @@
|
|||
|
||||
|
||||
# WORK IN PROGRESS
|
||||
# This configuration file is not yet functional; use the "preconfig"
|
||||
# script instead.
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
# Cantera Configuration File
|
||||
#
|
||||
# Edit this file to control how Cantera is built. Parameters can be set
|
||||
# here, or alternatively environment variables may be set before calling
|
||||
# this script.
|
||||
#
|
||||
# The default configuration uses GNU compilers (gcc/g++/g77) and
|
||||
# builds as much of Cantera and its language interfaces as it can
|
||||
# (e.g. if MATLAB is installed on your system, the MATLAB toolbox
|
||||
# will be built automatically, otherwise it will be skipped. On linux
|
||||
# or Mac OS X, this default configuration should work, and most
|
||||
# likely you don't need to edit this file at all - just run it.
|
||||
#
|
||||
# NOTE: if you DO make changes to this file, save it with another name
|
||||
# so that it will not be overwritten if you update the source
|
||||
# distribution.
|
||||
|
||||
#######################################################################
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
# Language Interfaces
|
||||
#----------------------------------------------------------------------
|
||||
#
|
||||
# Cantera has several programming language interfaces. Select the ones
|
||||
# you want to build. The default is to try to build all language
|
||||
# interfaces.
|
||||
#
|
||||
#
|
||||
#----------------- Python --------------------------------------------
|
||||
#
|
||||
# In addition to being one of the supported language interfaces,
|
||||
# Python is used internally by Cantera, both in the build process and
|
||||
# at run time (to process .cti input files). Therefore, you generally
|
||||
# need to have Python on your system; if you don't, first install it
|
||||
# from http://www.python.org before proceeding with the installation
|
||||
# of Cantera.
|
||||
#
|
||||
# If you plan to work in Python, or you want to use the graphical
|
||||
# MixMaster application, then you need the full Cantera Python
|
||||
# Package. If, on the other hand, you will only use Cantera from some
|
||||
# other language (e.g. MATLAB or Fortran 90/95) and only need Python
|
||||
# to process .cti files, then you only need a minimal subset of the
|
||||
# package (actually, only one file).
|
||||
|
||||
OPTION(CANTERA_BUILD_FULL_PYTHON "Include support for using Cantera from Python?" ON)
|
||||
OPTION(CANTERA_BUILD_MIN_PYTHON "Include support for using CTI input files?" ON)
|
||||
|
||||
MARK_AS_ADVANCED (
|
||||
CANTERA_BUILD_FULL_PYTHON
|
||||
CANTERA_BUILD_MIN_PYTHON
|
||||
)
|
||||
OPTION(CANTERA_BUILD_WITH_F2C "Use f2c versions of 3rd party numerical routines" ON)
|
||||
|
||||
# Cantera needs to know where to find the Python interpreter. If
|
||||
# PYTHON_CMD is set to "default", then cmake will look for the Python
|
||||
# interpreter
|
||||
SET( PYTHON_CMD "default")
|
||||
OPTION (CANTERA_BUILD_LAPACK 0)
|
||||
OPTION (CANTERA_HAVE_SUNDIALS 1)
|
||||
|
||||
# The Cantera Python interface can be built with either the numarray
|
||||
# or Numeric packages. Set this to "y" to use Numeric, or anything
|
||||
# else to use numarray. Using numarray is preferred.
|
||||
SET( USE_NUMERIC "default")
|
||||
|
||||
# If numarray was installed using the --home option, set this to the
|
||||
# home directory for numarray.
|
||||
# SET( NUMARRAY_HOME "$HOME/python_packages")
|
||||
SET( PYTHON_CMD ${PYTHON_EXE})
|
||||
|
||||
SET( CANTERA_VERSION "1.7.1")
|
||||
|
||||
|
|
|
|||
7
ext/CMakeLists.txt
Normal file
7
ext/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
SET (CMAKE_C_FLAGS -DSkip_f2c_Undefs)
|
||||
add_subdirectory( f2c_libs)
|
||||
add_subdirectory( f2c_blas)
|
||||
add_subdirectory (f2c_lapack)
|
||||
add_subdirectory ( tpx )
|
||||
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#/bin/sh
|
||||
)))))))#/bin/sh
|
||||
#
|
||||
# $Source$
|
||||
# $Author$
|
||||
|
|
|
|||
10
ext/f2c_blas/CMakeLists.txt
Normal file
10
ext/f2c_blas/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
SET (F2C_BLAS_SRCS dasum.c daxpy.c dcabs1.c dcopy.c ddot.c
|
||||
dgbmv.c dgemm.c dgemv.c dger.c dnrm2.c drot.c drotg.c
|
||||
drotm.c drotmg.c dsbmv.c dscal.c dsdot.c dspmv.c dspr.c dspr2.c
|
||||
dswap.c dsymm.c dsymv.c dsyr.c dsyr2.c dsyr2k.c dsyrk.c dtbmv.c
|
||||
dtbsv.c dtpmv.c dtpsv.c dtrmm.c dtrmv.c dtrsm.c dtrsv.c
|
||||
dzasum.c dznrm2.c idamax.c lsame.c xerbla.c )
|
||||
|
||||
ADD_LIBRARY(ctblas ${F2C_BLAS_SRCS})
|
||||
|
||||
|
||||
14
ext/f2c_lapack/CMakeLists.txt
Normal file
14
ext/f2c_lapack/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
SET (F2C_LAPACK_SRCS dgbtrf.c dgbtrs.c dgbsv.c
|
||||
dgebd2.c dgebrd.c dgelq2.c dgelqf.c dgelss.c dgeqr2.c dgeqrf.c dgetf2.c
|
||||
dgetrf.c dgetri.c dgetrs.c dlabad.c dlabrd.c dlacpy.c dlamch.c dlange.c
|
||||
dlapy2.c dlarf.c dlarfb.c dlarfg.c dlarft.c dlartg.c dlas2.c dlascl.c dlaset.c
|
||||
dlasq1.c dlasq2.c dlasq3.c dlasq4.c dlasq5.c dlasq6.c dlasr.c dlasrt.c
|
||||
dlassq.c dlasv2.c dlaswp.c dorg2r.c dorgbr.c dorgl2.c dorglq.c dorgqr.c
|
||||
dorm2r.c dormbr.c dorml2.c dormlq.c dormqr.c drscl.c dtrtri.c
|
||||
dtrti2.c ieeeck.c ilaenv.c )
|
||||
|
||||
ADD_LIBRARY(ctlapack ${F2C_LAPACK_SRCS})
|
||||
|
||||
|
||||
|
||||
39
ext/f2c_libs/CMakeLists.txt
Normal file
39
ext/f2c_libs/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
SET (F2C_LIB_SRCS f77vers.c i77vers.c main.c s_rnge.c abort_.c
|
||||
exit_.c getarg_.c iargc_.c
|
||||
getenv_.c signal_.c s_stop.c s_paus.c
|
||||
system_.c cabs.c
|
||||
derf_.c derfc_.c erf_.c erfc_.c sig_die.c uninit.c
|
||||
pow_ci.c pow_dd.c pow_di.c pow_hh.c
|
||||
pow_ii.c pow_ri.c pow_zi.c pow_zz.c
|
||||
c_abs.c c_cos.c c_div.c c_exp.c c_log.c c_sin.c
|
||||
c_sqrt.c
|
||||
z_abs.c z_cos.c z_div.c z_exp.c z_log.c z_sin.c
|
||||
z_sqrt.c
|
||||
r_abs.c r_acos.c r_asin.c r_atan.c r_atn2.c
|
||||
r_cnjg.c r_cos.c
|
||||
r_cosh.c r_dim.c r_exp.c r_imag.c r_int.c
|
||||
r_lg10.c r_log.c r_mod.c r_nint.c r_sign.c
|
||||
r_sin.c r_sinh.c r_sqrt.c r_tan.c r_tanh.c
|
||||
d_abs.c d_acos.c d_asin.c d_atan.c d_atn2.c
|
||||
d_cnjg.c d_cos.c d_cosh.c d_dim.c d_exp.c
|
||||
d_imag.c d_int.c d_lg10.c d_log.c d_mod.c
|
||||
d_nint.c d_prod.c d_sign.c d_sin.c d_sinh.c
|
||||
d_sqrt.c d_tan.c d_tanh.c i_abs.c i_dim.c
|
||||
i_dnnt.c i_indx.c i_len.c i_mod.c i_nint.c i_sign.c
|
||||
lbitbits.c lbitshft.c h_abs.c h_dim.c h_dnnt.c
|
||||
h_indx.c h_len.c h_mod.c h_nint.c h_sign.c
|
||||
l_ge.c l_gt.c l_le.c l_lt.c hl_ge.c hl_gt.c
|
||||
hl_le.c hl_lt.c ef1asc_.c ef1cmc_.c
|
||||
f77_aloc.c s_cat.c s_cmp.c s_copy.c
|
||||
backspac.c close.c dfe.c dolio.c due.c
|
||||
endfile.c err.c
|
||||
fmt.c fmtlib.c ftell_.c iio.c ilnw.c
|
||||
inquire.c lread.c lwrite.c
|
||||
open.c rdfmt.c rewind.c rsfe.c rsli.c
|
||||
rsne.c sfe.c sue.c
|
||||
typesize.c uio.c util.c wref.c wrtfmt.c
|
||||
wsfe.c wsle.c wsne.c xwsne.c
|
||||
dtime_.c etime_.c)
|
||||
|
||||
ADD_LIBRARY(ctf2c ${F2C_LIB_SRCS})
|
||||
|
||||
|
|
@ -180,7 +180,7 @@ util.o: fio.h
|
|||
wref.o: fio.h
|
||||
wref.o: fmt.h
|
||||
wref.o: fp.h
|
||||
wrtfmt.o: fio.h
|
||||
wrtfmt.o: fio.h
|
||||
wrtfmt.o: fmt.h
|
||||
wsfe.o: fio.h
|
||||
wsfe.o: fmt.h
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#ifndef F2C_INCLUDE
|
||||
#define F2C_INCLUDE
|
||||
|
||||
#define
|
||||
#ifdef _WIN32
|
||||
#include <io.h> /* for real isatty() */
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
#include "f2c.h"
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
//#ifdef __cplusplus
|
||||
//extern "C" {
|
||||
//#endif
|
||||
|
||||
#ifdef KR_headers
|
||||
longint pow_qq(ap, bp) longint *ap, *bp;
|
||||
#else
|
||||
//#ifdef KR_headers
|
||||
//longint pow_qq(ap, bp) longint *ap, *bp;
|
||||
//#else
|
||||
longint pow_qq(longint *ap, longint *bp)
|
||||
#endif
|
||||
//#endif
|
||||
{
|
||||
longint pow, x, n;
|
||||
unsigned long long u; /* system-dependent */
|
||||
|
|
@ -34,6 +34,6 @@ longint pow_qq(longint *ap, longint *bp)
|
|||
}
|
||||
return(pow);
|
||||
}
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
//#ifdef __cplusplus
|
||||
//}
|
||||
//#endif
|
||||
|
|
|
|||
10
ext/f2c_math/CMakeLists.txt
Normal file
10
ext/f2c_math/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
SET ( CTMATH_SRCS mach.cpp ddaspk.c dgbefa.c dgbsl.c dgefa.c dgesl.c
|
||||
dp1vlu.c dpcoef.c dpolft.c fdump.c j4save.c pcoef.c polfit.c pvalue.c
|
||||
xercnt.c xerhlt.c xermsg.c xerprn.c xersve.c xgetua.c printstring.c)
|
||||
|
||||
INCLUDE_DIRECTORIES ( ${PROJECT_BINARY_DIR} )
|
||||
INCLUDE_DIRECTORIES ( ${PROJECT_BINARY_DIR}/ext/f2c_libs )
|
||||
INCLUDE_DIRECTORIES ( ${PROJECT_BINARY_DIR}/build/include/cantera )
|
||||
|
||||
ADD_LIBRARY( ctmath ${CTMATH_SRCS} )
|
||||
|
||||
9
ext/tpx/CMakeLists.txt
Normal file
9
ext/tpx/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
SET ( TPX_SRCS HFC134a.cpp Heptane.cpp Hydrogen.cpp Methane.cpp
|
||||
Nitrogen.cpp Oxygen.cpp RedlichKwong.cpp CarbonDioxide.cpp
|
||||
Sub.cpp Water.cpp utils.cpp lk.cpp )
|
||||
|
||||
INCLUDE_DIRECTORIES ( ${PROJECT_BINARY_DIR} )
|
||||
#IINCLUDE_DIRECTORIES ( ${PROJECT_BINARY_DIR}/build/include/cantera )
|
||||
|
||||
ADD_LIBRARY( tpx ${TPX_SRCS} )
|
||||
|
||||
|
|
@ -75,7 +75,7 @@ PYTHON_CMD=${PYTHON_CMD:="default"}
|
|||
# The Cantera Python interface can be built with either the numarray
|
||||
# or Numeric packages. Set this to "y" to use Numeric, or anything
|
||||
# else to use numarray. Using numarray is preferred.
|
||||
USE_NUMERIC=${USE_NUMERIC:="default"}
|
||||
USE_NUMERIC=${USE_NUMERIC:="n"}
|
||||
|
||||
# If numarray was installed using the --home option, set this to the
|
||||
# home directory for numarray.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue