[Cython] Use scipy when necessary to support older Python versions
Fixes an incompatibility with Python 2.6 and 3.1. Scipy is not required when using Python 2.7 or 3.2+.
This commit is contained in:
parent
346f9e196f
commit
fa1d9e1ca9
1 changed files with 7 additions and 1 deletions
|
|
@ -1,6 +1,12 @@
|
|||
import csv
|
||||
import interrupts
|
||||
|
||||
try:
|
||||
# Python 2.7 or 3.2+
|
||||
from math import erf
|
||||
except ImportError:
|
||||
from scipy.special import erf
|
||||
|
||||
cdef class Domain1D:
|
||||
cdef CxxDomain1D* domain
|
||||
def __cinit__(self, *args, **kwargs):
|
||||
|
|
@ -1200,7 +1206,7 @@ class CounterflowDiffusionFlame(FlameBase):
|
|||
for j in range(nz):
|
||||
x = zz[j]
|
||||
zeta = f * (x - x0)
|
||||
zmix = 0.5 * (1.0 - math.erf(zeta))
|
||||
zmix = 0.5 * (1.0 - erf(zeta))
|
||||
if zmix > zst:
|
||||
Y[j] = Yeq + (Yin_f - Yeq) * (zmix - zst) / (1.0 - zst)
|
||||
T[j] = Teq + (T0f - Teq) * (zmix - zst) / (1.0 - zst)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue