def init(self):
        """Set the initial guess for the solution. The adiabatic flame
        temperature and equilibrium composition are computed for the
        burner gas composition. The temperature profile rises linearly
        in the first 20% of the flame to Tad, then is flat. The mass
        fraction profiles are set similarly.
        """
        self.getInitialSoln()
        gas = self.gas
        nsp = gas.nSpecies()
        yin = zeros(nsp, 'd')
        for k in range(nsp):
            yin[k] = self.burner.massFraction(k)
        gas.setState_TPY(self.burner.temperature(), self.pressure, yin)
        u0 = self.burner.mdot() / gas.density()
        t0 = self.burner.temperature()

        # get adiabatic flame temperature and composition
        gas.equilibrate('HP', solver=1)
        teq = gas.temperature()
        yeq = gas.massFractions()
        u1 = self.burner.mdot() / gas.density()

        z1 = 0.2
        locs = array([0.0, z1, 1.0], 'd')
        self.setProfile('u', locs, [u0, u1, u1])
        self.setProfile('T', locs, [t0, teq, teq])
        for n in range(nsp):
            self.setProfile(gas.speciesName(n), locs, [yin[n], yeq[n], yeq[n]])
        self._initialized = 1
Exemple #2
0
    def init(self):
        """Set the initial guess for the solution. The adiabatic flame
        temperature and equilibrium composition are computed for the
        burner gas composition. The temperature profile rises linearly
        in the first 20% of the flame to Tad, then is flat. The mass
        fraction profiles are set similarly.
        """
        self.getInitialSoln()
        gas = self.gas
        nsp = gas.nSpecies()
        yin = zeros(nsp, 'd')
        for k in range(nsp):
            yin[k] = self.burner.massFraction(k)
        gas.setState_TPY(self.burner.temperature(), self.pressure, yin)
        u0 = self.burner.mdot()/gas.density()
        t0 = self.burner.temperature()

        # get adiabatic flame temperature and composition
        gas.equilibrate('HP')
        teq = gas.temperature()
        yeq = gas.massFractions()
        u1 = self.burner.mdot()/gas.density()

        z1 = 0.2
        locs = array([0.0, z1, 1.0],'d')
        self.setProfile('u', locs, [u0, u1, u1])
        self.setProfile('T', locs, [t0, teq, teq])
        for n in range(nsp):
            self.setProfile(gas.speciesName(n), locs, [yin[n], yeq[n], yeq[n]])
        self._initialized = 1
Exemple #3
0
 def massFractions(self):
     """Return an array of the species mass fractions."""
     nsp = self._contents.nSpecies()
     y = zeros(nsp,'d')
     for k in range(nsp):
         y[k] = self.massFraction(k)
     return y
Exemple #4
0
 def massFractions(self):
     """Return an array of the species mass fractions."""
     nsp = self._contents.nSpecies()
     y = zeros(nsp, 'd')
     for k in range(nsp):
         y[k] = self.massFraction(k)
     return y
Exemple #5
0
 def setValveCoeff(self, Kv=-1.0):
     """Set or reset the valve coefficient \f$ K_v \f$."""
     vv = zeros(1, 'd')
     vv[0] = Kv
     if self._verbose:
         print
         print self._name + ': setting valve coefficient to ' + ` Kv ` + ' kg/Pa-s'
     self._setParameters(vv)
 def saveState(self):
     """Return an array with state information that can later be
     used to restore the state."""
     state = zeros(self.nSpecies() + 2, 'd')
     state[0] = self.temperature()
     state[1] = self.density()
     state[2:] = self.massFractions()
     return state
Exemple #7
0
 def saveState(self):
     """Return an array with state information that can later be
     used to restore the state."""
     state = zeros(self.nSpecies()+2,'d')
     state[0] = self.temperature()
     state[1] = self.density()
     state[2:] = self.massFractions()
     return state
Exemple #8
0
 def setPressureCoeff(self, Kv):
     """Set or reset the pressure coefficient :math:`K_v`."""
     vv = zeros(1,'d')
     vv[0] = Kv
     if self._verbose:
         print
         print self._name+': setting pressure coefficient to '+`Kv`+' kg/Pa-s'
     self._setParameters(vv)
Exemple #9
0
 def __init__(self, domains = None):
     self._hndl = 0
     nd = len(domains)
     hndls = zeros(nd,'i')
     for n in range(nd):
         hndls[n] = domains[n].domain_hndl()
     self._hndl = _cantera.sim1D_new(hndls)
     self._domains = domains
Exemple #10
0
 def coverages(self):
     """The coverages of the surface species."""
     nsurf = self.surfchem.nSpecies()
     cov = zeros(nsurf,'d')
     for n in range(nsurf):
         nm = self.surfchem.speciesName(n)
         cov[n] = self.value(self.surface, nm, 0)
     return cov
Exemple #11
0
 def __init__(self, domains=None):
     self._hndl = 0
     nd = len(domains)
     hndls = zeros(nd, 'i')
     for n in range(nd):
         hndls[n] = domains[n].domain_hndl()
     self._hndl = _cantera.sim1D_new(hndls)
     self._domains = domains
Exemple #12
0
 def setPressureCoeff(self, Kv):
     """Set or reset the pressure coefficient :math:`K_v`."""
     vv = zeros(1, 'd')
     vv[0] = Kv
     if self._verbose:
         print
         print self._name + ': setting pressure coefficient to ' + ` Kv ` + ' kg/Pa-s'
     self._setParameters(vv)
 def coverages(self):
     """The coverages of the surface species."""
     nsurf = self.surfchem.nSpecies()
     cov = zeros(nsurf, 'd')
     for n in range(nsurf):
         nm = self.surfchem.speciesName(n)
         cov[n] = self.value(self.surface, nm, 0)
     return cov
Exemple #14
0
 def setValveCoeff(self, Kv = -1.0):
     """Set or reset the valve coefficient \f$ K_v \f$."""
     vv = zeros(1,'d')
     vv[0] = Kv
     if self._verbose:
         print
         print self._name+': setting valve coefficient to '+`Kv`+' kg/Pa-s'
     self._setParameters(vv)
Exemple #15
0
 def profile(self, domain, component):
     """Spatial profile of one component in one domain.
     >>> print s.profile(flow, 'T')
     """
     np = domain.nPoints()
     x = zeros(np, 'd')
     for n in range(np):
         x[n] = self.value(domain, component, n)
     return x
Exemple #16
0
 def profile(self, domain, component):
     """Spatial profile of one component in one domain.
     >>> print s.profile(flow, 'T')
     """
     np = domain.nPoints()
     x = zeros(np,'d')
     for n in range(np):
         x[n] = self.value(domain, component, n)
     return x
 def setGasState(self, j):
     """Set the state of the object representing the gas to the
     current solution at grid point j."""
     nsp = self.gas.nSpecies()
     y = zeros(nsp, 'd')
     for n in range(nsp):
         nm = self.gas.speciesName(n)
         y[n] = self.solution(nm, j)
     self.gas.setState_TPY(self.T(j), self.pressure, y)
Exemple #18
0
 def setGasState(self, j):
     """Set the state of the object representing the gas to the
     current solution at grid point *j*."""
     nsp = self.gas.nSpecies()
     y = zeros(nsp, 'd')
     for n in range(nsp):
         nm = self.gas.speciesName(n)
         y[n] = self.solution(nm, j)
     self.gas.setState_TPY(self.T(j), self.flow.pressure(), y)
Exemple #19
0
 def phaseMoles(self, n=-1):
     """Moles of phase n."""
     if n == -1:
         np = self.nPhases()
         moles = zeros(np, 'd')
         for m in range(np):
             moles[m] = _cantera.mix_phaseMoles(self.__mixid, m)
         return moles
     else:
         return _cantera.mix_phaseMoles(self.__mixid, n)
Exemple #20
0
 def phaseMoles(self, n = -1):
     """Moles of phase n."""
     if n == -1:
         np = self.nPhases()
         moles = zeros(np,'d')
         for m in range(np):
             moles[m] = _cantera.mix_phaseMoles(self.__mixid, m)
         return moles
     else:   
         return _cantera.mix_phaseMoles(self.__mixid, n)
Exemple #21
0
    def _dict2arrays(self, d=None, array1=None, array2=None):
        nc = self.nComponents()
        if d.has_key('default'):
            a1 = zeros(nc, 'd') + d['default'][0]
            a2 = zeros(nc, 'd') + d['default'][1]
            del d['default']
        else:
            if array1: a1 = array(array1)
            else: a1 = zeros(nc, 'd')
            if array2: a2 = array(array2)
            else: a2 = zeros(nc, 'd')

        for k in d.keys():
            c = self.componentIndex(k)
            if c >= 0:
                a1[self.componentIndex(k)] = d[k][0]
                a2[self.componentIndex(k)] = d[k][1]
            else:
                raise CanteraError('unknown component ' + k)
        return (a1, a2)
Exemple #22
0
    def _dict2arrays(self, d = None, array1 = None, array2 = None):
        nc = self.nComponents()
        if d.has_key('default'):
            a1 = zeros(nc,'d') + d['default'][0]
            a2 = zeros(nc,'d') + d['default'][1]
            del d['default']
        else:
            if array1: a1 = array(array1)
            else: a1 = zeros(nc,'d')
            if array2: a2 = array(array2)
            else: a2 = zeros(nc,'d')

        for k in d.keys():
            c = self.componentIndex(k)
            if c >= 0:
                a1[self.componentIndex(k)] = d[k][0]
                a2[self.componentIndex(k)] = d[k][1]
            else:
                raise CanteraError('unknown component '+k)
        return (a1, a2)
Exemple #23
0
 def productStoichCoeffs(self):
     """The array of product stoichiometric coefficients. Element
     [k,i] of this array is the product stoichiometric
     coefficient of species k in reaction i."""
     nsp = _cantera.kin_nspecies(self.ckin)
     nr = _cantera.kin_nreactions(self.ckin)
     nu = zeros((nsp, nr), 'd')
     for i in range(nr):
         for k in range(nsp):
             nu[k, i] = _cantera.kin_pstoichcoeff(self.ckin, k, i)
     return nu
Exemple #24
0
 def productStoichCoeffs(self):
     """The array of product stoichiometric coefficients. Element
     [k,i] of this array is the product stoichiometric
     coefficient of species *k* in reaction *i*."""
     nsp = _cantera.kin_nspecies(self.ckin)
     nr = _cantera.kin_nreactions(self.ckin)
     nu = zeros((nsp,nr),'d')
     for i in range(nr):
         for k in range(nsp):
             nu[k,i] = _cantera.kin_pstoichcoeff(self.ckin,k,i)
     return nu
Exemple #25
0
def isentropic(g = None):
    """
    ISENTROPIC  isentropic, adiabatic flow example
    
    In this example, the area ratio vs. Mach number curve is
    computed. If a gas object is supplied, it will be used for the
    calculations, with the stagnation state given by the input gas
    state. Otherwise, the calculations will be done for a 10:1
    hydrogen/nitrogen mixture with stagnation T0 = 1200 K, P0 = 10
    atm.

    """

    if g == None:
        gas = GRI30()
        gas.set(T = 1200.0,P = 10.0*OneAtm,X = 'H2:1,N2:0.1')
    else:
        gas = g


    # get the stagnation state parameters
    s0 = gas.entropy_mass()
    h0 = gas.enthalpy_mass()
    p0 = gas.pressure()
    
    mdot = 1  # arbitrary
    amin = 1.e14
    
    data = zeros((200,4),'d')
    
    # compute values for a range of pressure ratios
    for r in range(200):
        p = p0*(r+1)/201.0

        # set the state using (p,s0)
        gas.set(S = s0, P = p)
   
        h = gas.enthalpy_mass()
        rho = gas.density()
   
        v2 = 2.0*(h0 - h)      #   h + V^2/2 = h0
        v = math.sqrt(v2)    
        area = mdot/(rho*v);   #   rho*v*A = constant
        if area < amin: amin = area
        data[r,:] = [area, v/soundspeed(gas), gas.temperature(), p/p0]

    data[:,0] /= amin

    return data
def isentropic(g=None):
    """
    ISENTROPIC  isentropic, adiabatic flow example
    
    In this example, the area ratio vs. Mach number curve is
    computed. If a gas object is supplied, it will be used for the
    calculations, with the stagnation state given by the input gas
    state. Otherwise, the calculations will be done for a 10:1
    hydrogen/nitrogen mixture with stagnation T0 = 1200 K, P0 = 10
    atm.

    """

    if g == None:
        gas = GRI30()
        gas.set(T=1200.0, P=10.0 * OneAtm, X='H2:1,N2:0.1')
    else:
        gas = g

    # get the stagnation state parameters
    s0 = gas.entropy_mass()
    h0 = gas.enthalpy_mass()
    p0 = gas.pressure()

    mdot = 1  # arbitrary
    amin = 1.e14

    data = zeros((200, 4), 'd')

    # compute values for a range of pressure ratios
    for r in range(200):
        p = p0 * (r + 1) / 201.0

        # set the state using (p,s0)
        gas.set(S=s0, P=p)

        h = gas.enthalpy_mass()
        rho = gas.density()

        v2 = 2.0 * (h0 - h)  #   h + V^2/2 = h0
        v = math.sqrt(v2)
        area = mdot / (rho * v)
        #   rho*v*A = constant
        if area < amin: amin = area
        data[r, :] = [area, v / soundspeed(gas), gas.temperature(), p / p0]

    data[:, 0] /= amin

    return data
Exemple #27
0
    def grid(self, n = -1):
        """ If *n* >= 0, return the value of the nth grid point
        from the left in this domain. If n is not supplied, return
        the entire grid.

        >>> z4 = d.grid(4)
        >>> z_array = d.grid()

        """
        if n >= 0:
            return _cantera.domain_grid(self._hndl, n)
        else:
            g = zeros(self.nPoints(),'d')
            for j in range(len(g)):
                g[j] = _cantera.domain_grid(self._hndl, j)
            return g
Exemple #28
0
    def grid(self, n=-1):
        """ If *n* >= 0, return the value of the nth grid point
        from the left in this domain. If n is not supplied, return
        the entire grid.

        >>> z4 = d.grid(4)
        >>> z_array = d.grid()

        """
        if n >= 0:
            return _cantera.domain_grid(self._hndl, n)
        else:
            g = zeros(self.nPoints(), 'd')
            for j in range(len(g)):
                g[j] = _cantera.domain_grid(self._hndl, j)
            return g
    def init(self, products='inlet'):
        """Set the initial guess for the solution. If products = 'equil',
        then the equilibrium composition at the adiabatic flame temperature
        will be used to form the initial guess. Otherwise the inlet composition
        will be used."""
        self.getInitialSoln()
        gas = self.gas
        nsp = gas.nSpecies()
        yin = zeros(nsp, 'd')
        for k in range(nsp):
            yin[k] = self.inlet.massFraction(k)
        gas.setState_TPY(self.inlet.temperature(), self.pressure, yin)
        u0 = self.inlet.mdot() / gas.density()
        t0 = self.inlet.temperature()
        V0 = 0.0

        tsurf = self.surface.temperature()

        zz = self.flow.grid()
        dz = zz[-1] - zz[0]

        if products == 'equil':
            gas.equilibrate('HP')
            teq = gas.temperature()
            yeq = gas.massFractions()
            locs = array([0.0, 0.3, 0.7, 1.0], 'd')
            self.setProfile('T', locs, [t0, teq, teq, tsurf])
            for n in range(nsp):
                self.setProfile(gas.speciesName(n), locs,
                                [yin[n], yeq[n], yeq[n], yeq[n]])
        else:
            locs = array([0.0, 1.0], 'd')
            self.setProfile('T', locs, [t0, tsurf])
            for n in range(nsp):
                self.setProfile(gas.speciesName(n), locs, [yin[n], yin[n]])

        locs = array([0.0, 1.0], 'd')
        self.setProfile('u', locs, [u0, 0.0])
        self.setProfile('V', locs, [V0, V0])

        self._initialized = 1
Exemple #30
0
    def init(self, products = 'inlet'):
        """Set the initial guess for the solution. If products = 'equil',
        then the equilibrium composition at the adiabatic flame temperature
        will be used to form the initial guess. Otherwise the inlet composition
        will be used."""
        self.getInitialSoln()
        gas = self.gas
        nsp = gas.nSpecies()
        yin = zeros(nsp, 'd')
        for k in range(nsp):
            yin[k] = self.inlet.massFraction(k)
        gas.setState_TPY(self.inlet.temperature(), self.flow.pressure(), yin)
        u0 = self.inlet.mdot()/gas.density()
        t0 = self.inlet.temperature()
        V0 = 0.0

        tsurf = self.surface.temperature()

        zz = self.flow.grid()
        dz = zz[-1] - zz[0]

        if products == 'equil':
            gas.equilibrate('HP')
            teq = gas.temperature()
            yeq = gas.massFractions()
            locs = array([0.0, 0.3, 0.7, 1.0],'d')
            self.setProfile('T', locs, [t0, teq, teq, tsurf])
            for n in range(nsp):
                self.setProfile(gas.speciesName(n), locs, [yin[n], yeq[n], yeq[n], yeq[n]])
        else:
            locs = array([0.0, 1.0],'d')
            self.setProfile('T', locs, [t0, tsurf])
            for n in range(nsp):
                self.setProfile(gas.speciesName(n), locs, [yin[n], yin[n]])

        locs = array([0.0, 1.0],'d')
        self.setProfile('u', locs, [u0, 0.0])
        self.setProfile('V', locs, [V0, V0])

        self._initialized = 1
Exemple #31
0
 def __init__(self, g):
     self.g = g
     self._mech = g
     self.nsp = g.nSpecies()
     self._moles = zeros(self.nsp, 'd')
     self.wt = g.molecularWeights()
Exemple #32
0
    def init(self, fuel = '', oxidizer = 'O2', stoich = -1.0):
        """Set the initial guess for the solution. The fuel species
        must be specified, and the oxidizer may be

        >>> f.init(fuel = 'CH4')

        The initial guess is generated by assuming infinitely-fast
        chemistry."""
        self.getInitialSoln()        
        gas = self.gas
        nsp = gas.nSpecies()
        wt = gas.molecularWeights()

        # find the fuel and oxidizer species
        iox = gas.speciesIndex(oxidizer)
        ifuel = gas.speciesIndex(fuel)

        # if no stoichiometric ratio was input, compute it
        if stoich < 0.0:
            if oxidizer == 'O2':
                nh = gas.nAtoms(fuel, 'H')
                nc = gas.nAtoms(fuel, 'C')
                stoich = 1.0*nc + 0.25*nh
            else:
                raise CanteraError('oxidizer/fuel stoichiometric ratio must'+
                            ' be specified, since  the oxidizer is not O2')

        s = stoich*wt[iox]/wt[ifuel]
        y0f = self.fuel_inlet.massFraction(ifuel)
        y0ox = self.oxidizer_inlet.massFraction(iox)
        phi = s*y0f/y0ox
        zst = 1.0/(1.0 + phi)
        
        yin_f = zeros(nsp, 'd')
        yin_o = zeros(nsp, 'd')
        yst = zeros(nsp, 'd')        
        for k in range(nsp):
            yin_f[k] = self.fuel_inlet.massFraction(k)
            yin_o[k] = self.oxidizer_inlet.massFraction(k)
            yst[k] = zst*yin_f[k] + (1.0 - zst)*yin_o[k]
            
        gas.setState_TPY(self.fuel_inlet.temperature(), self.pressure, yin_f)
        mdotf = self.fuel_inlet.mdot()
        u0f = mdotf/gas.density()        
        t0f = self.fuel_inlet.temperature()
 
        gas.setState_TPY(self.oxidizer_inlet.temperature(),
                         self.pressure, yin_o)
        mdoto = self.oxidizer_inlet.mdot()
        u0o = mdoto/gas.density()                
        t0o = self.oxidizer_inlet.temperature()       
        
        # get adiabatic flame temperature and composition
        tbar = 0.5*(t0o + t0f)
        gas.setState_TPY(tbar, self.pressure, yst)
        gas.equilibrate('HP')
        teq = gas.temperature()
        yeq = gas.massFractions()

        # estimate strain rate
        zz = self.flame.grid()
        dz = zz[-1] - zz[0]
        a = (u0o + u0f)/dz
        diff = gas.mixDiffCoeffs()
        f = math.sqrt(a/(2.0*diff[iox]))

        x0 = mdotf*dz/(mdotf + mdoto)
        nz = len(zz)

        y = zeros([nz,nsp],'d')
        t = zeros(nz,'d')        
        for j in range(nz):
            x = zz[j]
            zeta = f*(x - x0)
            zmix = 0.5*(1.0 - erf(zeta))
            if zmix > zst:
                for k in range(nsp):
                    y[j,k] = yeq[k] + (zmix - zst)*(yin_f[k]
                                                    - yeq[k])/(1.0 - zst)
                t[j] = teq + (t0f - teq)*(zmix - zst)/(1.0 - zst)
            else:
                for k in range(nsp):
                    y[j,k] = yin_o[k] + zmix*(yeq[k] - yin_o[k])/zst
                t[j] = t0o + (teq - t0o)*zmix/zst
            
        t[0] = t0f
        t[-1] = t0o
        zrel = zz/dz
        self.setProfile('u', [0.0, 1.0], [u0f, -u0o])
        self.setProfile('V', [0.0, x0/dz, 1.0], [0.0, a, 0.0])
        self.setProfile('T', zrel, t)
        for k in range(nsp):
            self.setProfile(gas.speciesName(k), zrel, y[:,k])
            
        self._initialized = 1
Exemple #33
0
 def speciesMoles(self, species=""):
     """Moles of species k."""
     moles = zeros(self.nSpecies(), 'd')
     for k in range(self.nSpecies()):
         moles[k] = _cantera.mix_speciesMoles(self.__mixid, k)
     return self.selectSpecies(moles, species)
Exemple #34
0
 def chemPotentials(self, species=[]):
     """The chemical potentials of all species [J/kmol]."""
     mu = zeros(self.nSpecies(), 'd')
     _cantera.mix_getChemPotentials(self.__mixid, mu)
     return self.selectSpecies(mu, species)
Exemple #35
0
 def chemPotentials(self, species=[]):
     """The chemical potentials of all species [J/kmol]."""
     mu = zeros(self.nSpecies(),'d')
     _cantera.mix_getChemPotentials(self.__mixid, mu)
     return self.selectSpecies(mu, species)
Exemple #36
0
 def speciesMoles(self, species = ""):
     """Moles of species k."""
     moles = zeros(self.nSpecies(),'d')
     for k in range(self.nSpecies()):
         moles[k] = _cantera.mix_speciesMoles(self.__mixid, k)
     return self.selectSpecies(moles, species)
Exemple #37
0
 def __init__(self, g):
     self.g = g
     self._mech = g
     self.nsp = g.nSpecies()
     self._moles = zeros(self.nsp, "d")
     self.wt = g.molecularWeights()
    def init(self, fuel='', oxidizer='O2', stoich=-1.0):
        """Set the initial guess for the solution. The fuel species
        must be specified, and the oxidizer may be

        >>> f.init(fuel='CH4')

        The initial guess is generated by assuming infinitely-fast
        chemistry."""
        self.getInitialSoln()
        gas = self.gas
        nsp = gas.nSpecies()
        wt = gas.molecularWeights()

        # find the fuel and oxidizer species
        iox = gas.speciesIndex(oxidizer)
        ifuel = gas.speciesIndex(fuel)

        # if no stoichiometric ratio was input, compute it
        if stoich < 0.0:
            if oxidizer == 'O2':
                nh = gas.nAtoms(fuel, 'H')
                nc = gas.nAtoms(fuel, 'C')
                stoich = 1.0 * nc + 0.25 * nh
            else:
                raise CanteraError(
                    'oxidizer/fuel stoichiometric ratio must' +
                    ' be specified, since  the oxidizer is not O2')

        s = stoich * wt[iox] / wt[ifuel]
        y0f = self.fuel_inlet.massFraction(ifuel)
        y0ox = self.oxidizer_inlet.massFraction(iox)
        phi = s * y0f / y0ox
        zst = 1.0 / (1.0 + phi)

        yin_f = zeros(nsp, 'd')
        yin_o = zeros(nsp, 'd')
        yst = zeros(nsp, 'd')
        for k in range(nsp):
            yin_f[k] = self.fuel_inlet.massFraction(k)
            yin_o[k] = self.oxidizer_inlet.massFraction(k)
            yst[k] = zst * yin_f[k] + (1.0 - zst) * yin_o[k]

        gas.setState_TPY(self.fuel_inlet.temperature(), self.pressure, yin_f)
        mdotf = self.fuel_inlet.mdot()
        u0f = mdotf / gas.density()
        t0f = self.fuel_inlet.temperature()

        gas.setState_TPY(self.oxidizer_inlet.temperature(), self.pressure,
                         yin_o)
        mdoto = self.oxidizer_inlet.mdot()
        u0o = mdoto / gas.density()
        t0o = self.oxidizer_inlet.temperature()

        # get adiabatic flame temperature and composition
        tbar = 0.5 * (t0o + t0f)
        gas.setState_TPY(tbar, self.pressure, yst)
        gas.equilibrate('HP')
        teq = gas.temperature()
        yeq = gas.massFractions()

        # estimate strain rate
        zz = self.flame.grid()
        dz = zz[-1] - zz[0]
        a = (u0o + u0f) / dz
        diff = gas.mixDiffCoeffs()
        f = math.sqrt(a / (2.0 * diff[iox]))

        x0 = mdotf * dz / (mdotf + mdoto)
        nz = len(zz)

        y = zeros([nz, nsp], 'd')
        t = zeros(nz, 'd')
        for j in range(nz):
            x = zz[j]
            zeta = f * (x - x0)
            zmix = 0.5 * (1.0 - erf(zeta))
            if zmix > zst:
                for k in range(nsp):
                    y[j, k] = yeq[k] + (zmix - zst) * (yin_f[k] -
                                                       yeq[k]) / (1.0 - zst)
                t[j] = teq + (t0f - teq) * (zmix - zst) / (1.0 - zst)
            else:
                for k in range(nsp):
                    y[j, k] = yin_o[k] + zmix * (yeq[k] - yin_o[k]) / zst
                t[j] = t0o + (teq - t0o) * zmix / zst

        t[0] = t0f
        t[-1] = t0o
        zrel = zz / dz
        self.setProfile('u', [0.0, 1.0], [u0f, -u0o])
        self.setProfile('V', [0.0, x0 / dz, 1.0], [0.0, a, 0.0])
        self.setProfile('T', zrel, t)
        for k in range(nsp):
            self.setProfile(gas.speciesName(k), zrel, y[:, k])

        self._initialized = 1