mirror of
https://github.com/Cantera/cantera.git
synced 2025-02-25 18:55:29 -06:00
added SemiconductorPhase
This commit is contained in:
@@ -59,6 +59,10 @@ class ReactorNet:
|
||||
using the current state as the initial condition. Default: 0.0 s"""
|
||||
_cantera.reactornet_setInitialTime(self.__reactornet_id, t0)
|
||||
|
||||
def setTolerances(self, rtol, atol):
|
||||
"""Set the relative and absolute error tolerances."""
|
||||
_cantera.reactornet_setTolerances(self.__reactornet_id, rtol, atol)
|
||||
|
||||
def advance(self, time):
|
||||
"""Advance the state of the reactor network in time from the current
|
||||
time to time 'time'."""
|
||||
|
||||
@@ -33,7 +33,7 @@ for n in range(500):
|
||||
|
||||
# set the mixture to a state of chemical equilibrium holding
|
||||
# temperature and pressure fixed
|
||||
mix.equilibrate("TP",maxsteps=1000,loglevel=0)
|
||||
mix.equilibrate("TP",maxsteps=10000,loglevel=1)
|
||||
|
||||
# write out the moles of each species
|
||||
writeCSV(f,[t]+ list(mix.speciesMoles()))
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#else
|
||||
//#ifdef HAS_NUMARRAY
|
||||
#include "numarray/arrayobject.h"
|
||||
//#include "numpy/libnumarray.h"
|
||||
|
||||
//#else
|
||||
//#include "numpy/arrayobject.h"
|
||||
//#endif
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
//#define DEBUG_PATHS
|
||||
#undef DEBUG_PATHS
|
||||
|
||||
using namespace Cantera;
|
||||
|
||||
@@ -34,14 +34,26 @@ namespace ctml {
|
||||
// environment variable PYTHON_CMD if it is set. If not, return
|
||||
// the string 'python'.
|
||||
static string pypath() {
|
||||
string s = "python";
|
||||
string s = "ctpython";
|
||||
const char* py = getenv("PYTHON_CMD");
|
||||
if (!py) {
|
||||
const char* hm = getenv("HOME");
|
||||
string home = stripws(string(hm));
|
||||
string cmd = string("source ")+home
|
||||
+string("/setup_cantera &> /dev/null");
|
||||
system(cmd.c_str());
|
||||
py = getenv("PYTHON_CMD");
|
||||
}
|
||||
if (py) {
|
||||
string sp = stripws(string(py));
|
||||
if (sp.size() > 0) {
|
||||
s = sp;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw CanteraError("ct2ctml",
|
||||
"set environment variable PYTHON_CMD");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -58,6 +70,7 @@ namespace ctml {
|
||||
"python cti to ctml conversion requested for file, " + ppath +
|
||||
", but not available in this computational environment");
|
||||
#endif
|
||||
|
||||
time_t aclock;
|
||||
time( &aclock );
|
||||
int ia = static_cast<int>(aclock);
|
||||
|
||||
64
Cantera/src/thermo/SemiconductorPhase.cpp
Normal file
64
Cantera/src/thermo/SemiconductorPhase.cpp
Normal file
@@ -0,0 +1,64 @@
|
||||
|
||||
#include "SemiconductorPhase.h"
|
||||
|
||||
namespace Cantera {
|
||||
|
||||
const doublereal JD_const1 = 1.0/sqrt(8.0);
|
||||
const doublereal JD_const2 = 3.0/16.0 - sqrt(3.0)/9.0;
|
||||
|
||||
static doublereal JoyceDixon(doublereal r) {
|
||||
return log(r) + JD_const1*r - JD_const2*r*r;
|
||||
}
|
||||
|
||||
// doublereal SemiconductorPhase::ionizedDonorConcentration() {
|
||||
// return 1.0/(1.0 + 2.0*exp( fermiLevel() - m_edonor));
|
||||
//}
|
||||
|
||||
//doublereal SemiconductorPhase::ionizedAcceptorConcentration() {
|
||||
// return 1.0/(1.0 + 2.0*exp( m_eacceptor - fermiLevel()));
|
||||
//}
|
||||
|
||||
//doublereal SemiconductorPhase::_dn(doublereal efermi) {
|
||||
// m_fermi_level = efermi;
|
||||
// return electronConcentration() - holeConcentration() +
|
||||
// ionizedAcceptorConcentration() - ionizedDonorConcentration();
|
||||
//}
|
||||
void SemiconductorPhase::getChemPotentials(doublereal* mu) const {
|
||||
getActivityConcentrations(DATA_PTR(m_work));
|
||||
doublereal r = m_work[0]/nc();
|
||||
mu[0] = ec() + GasConstant*temperature()*(JoyceDixon(r));
|
||||
mu[1] = ev() + + GasConstant*temperature()*(log(m_work[1]/nv()));
|
||||
}
|
||||
|
||||
// units: kmol/m^3
|
||||
doublereal SemiconductorPhase::nc() const {
|
||||
doublereal fctr = effectiveMass_e() * Boltzmann * temperature()/
|
||||
(2.0*Pi*Planck_bar*Planck_bar);
|
||||
return 2.0*pow(fctr, 1.5)/Avogadro;
|
||||
}
|
||||
|
||||
doublereal SemiconductorPhase::nv() const {
|
||||
doublereal fctr = effectiveMass_h() * Boltzmann * temperature()/
|
||||
(2.0*Pi*Planck_bar*Planck_bar);
|
||||
return 2.0*pow(fctr, 1.5)/Avogadro;
|
||||
}
|
||||
|
||||
doublereal SemiconductorPhase::ev() const {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
doublereal SemiconductorPhase::ec() const {
|
||||
return ev() + bandgap();
|
||||
}
|
||||
|
||||
doublereal SemiconductorPhase::bandgap() const {
|
||||
return m_gap;
|
||||
}
|
||||
|
||||
|
||||
// private
|
||||
void SemiconductorPhase::initLengths() {
|
||||
int ns = nSpecies();
|
||||
m_work.resize(ns);
|
||||
}
|
||||
}
|
||||
1121
Cantera/src/thermo/SemiconductorPhase.h
Normal file
1121
Cantera/src/thermo/SemiconductorPhase.h
Normal file
File diff suppressed because it is too large
Load Diff
@@ -40,6 +40,7 @@ namespace Cantera {
|
||||
const int cMetal = 4; // MetalPhase in MetalPhase.h
|
||||
// const int cSolidCompound = 5; // SolidCompound in SolidCompound.h
|
||||
const int cStoichSubstance = 5; // StoichSubstance.h
|
||||
const int cSemiconductor = 7;
|
||||
|
||||
const int cLatticeSolid = 20; // LatticeSolidPhase.h
|
||||
const int cLattice = 21;
|
||||
@@ -69,3 +70,4 @@ namespace Cantera {
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
15
configure
vendored
15
configure
vendored
@@ -2505,6 +2505,15 @@ _ACEOF
|
||||
|
||||
hdrs=$hdrs' MetalPhase.h'
|
||||
fi
|
||||
|
||||
if test "$WITH_SEMICONDUCTOR" = "y"; then
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define WITH_SEMICONDUCTOR 1
|
||||
_ACEOF
|
||||
|
||||
hdrs=$hdrs' SemiconductorPhase.h'
|
||||
objs=$objs' SemiconductorPhase.o'
|
||||
fi
|
||||
if test "$WITH_STOICH_SUBSTANCE" = "y"; then
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define WITH_STOICH_SUBSTANCE 1
|
||||
@@ -8476,7 +8485,7 @@ fi
|
||||
|
||||
|
||||
# Provide some information about the compiler.
|
||||
echo "$as_me:8479:" \
|
||||
echo "$as_me:8488:" \
|
||||
"checking for Fortran 77 compiler version" >&5
|
||||
ac_compiler=`set X $ac_compile; echo $2`
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
|
||||
@@ -8679,7 +8688,7 @@ _ACEOF
|
||||
# flags.
|
||||
ac_save_FFLAGS=$FFLAGS
|
||||
FFLAGS="$FFLAGS $ac_verb"
|
||||
(eval echo $as_me:8682: \"$ac_link\") >&5
|
||||
(eval echo $as_me:8691: \"$ac_link\") >&5
|
||||
ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
|
||||
echo "$ac_f77_v_output" >&5
|
||||
FFLAGS=$ac_save_FFLAGS
|
||||
@@ -8757,7 +8766,7 @@ _ACEOF
|
||||
# flags.
|
||||
ac_save_FFLAGS=$FFLAGS
|
||||
FFLAGS="$FFLAGS $ac_cv_prog_f77_v"
|
||||
(eval echo $as_me:8760: \"$ac_link\") >&5
|
||||
(eval echo $as_me:8769: \"$ac_link\") >&5
|
||||
ac_f77_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
|
||||
echo "$ac_f77_v_output" >&5
|
||||
FFLAGS=$ac_save_FFLAGS
|
||||
|
||||
@@ -430,6 +430,12 @@ if test "$WITH_METAL" = "y"; then
|
||||
AC_DEFINE(WITH_METAL)
|
||||
hdrs=$hdrs' MetalPhase.h'
|
||||
fi
|
||||
|
||||
if test "$WITH_SEMICONDUCTOR" = "y"; then
|
||||
AC_DEFINE(WITH_SEMICONDUCTOR)
|
||||
hdrs=$hdrs' SemiconductorPhase.h'
|
||||
objs=$objs' SemiconductorPhase.o'
|
||||
fi
|
||||
if test "$WITH_STOICH_SUBSTANCE" = "y"; then
|
||||
AC_DEFINE(WITH_STOICH_SUBSTANCE)
|
||||
hdrs=$hdrs' StoichSubstance.h'
|
||||
|
||||
@@ -61,7 +61,7 @@ CANTERA_CONFIG_PREFIX=${CANTERA_CONFIG_PREFIX:=""}
|
||||
# default try to do a full installation, but fall back to a minimal
|
||||
# one in case of errors
|
||||
|
||||
PYTHON_PACKAGE=${PYTHON_PACKAGE:="default"}
|
||||
PYTHON_PACKAGE=${PYTHON_PACKAGE:="full"}
|
||||
|
||||
# Cantera needs to know where to find the Python interpreter. If
|
||||
# PYTHON_CMD is set to "default", then the configuration process will
|
||||
@@ -179,6 +179,7 @@ DEBUG_MODE="n"
|
||||
|
||||
# thermodynamic properties
|
||||
ENABLE_THERMO='y'
|
||||
|
||||
######################################################################
|
||||
# optional phase types. These may not be needed by all users. Set them
|
||||
# to 'n' to omit them from the kernel.
|
||||
@@ -186,6 +187,8 @@ ENABLE_THERMO='y'
|
||||
WITH_LATTICE_SOLID=${WITH_LATTICE_SOLID:="y"}
|
||||
WITH_METAL=${WITH_METAL:="y"}
|
||||
WITH_STOICH_SUBSTANCE='y'
|
||||
WITH_SEMICONDUCTOR='y'
|
||||
|
||||
|
||||
# This flag enables the inclusion of accurate liquid/vapor equations
|
||||
# of state for several fluids, including water, nitrogen, hydrogen,
|
||||
@@ -523,6 +526,7 @@ export SUNDIALS_VERSION
|
||||
|
||||
export WITH_LATTICE_SOLID
|
||||
export WITH_METAL
|
||||
export WITH_SEMICONDUCTOR
|
||||
export WITH_STOICH_SUBSTANCE
|
||||
export WITH_PURE_FLUIDS
|
||||
export WITH_IDEAL_SOLUTIONS
|
||||
|
||||
Reference in New Issue
Block a user