slepicka-craig / cantera

Automatically exported from code.google.com/p/cantera
0 stars 0 forks source link

Python: Func.Polynomial() in Reactor.wall(...K) gives error message #20

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Time dependent expansion of a Reactor wall using a Polynomial leads to an 
error message, as soon as the wall is defined. (AttributeError: Polynomial 
instance has no attribute '__float__') I am attaching a small script to 
reproduce the problem.

The error message on my computer is the following:

--------------------------------------------
Traceback (most recent call last):
  File "D:\Python\Cantera\Polygeneration\ReactorTest.py", line 20, in <module>
    w = Wall(left = r1, right = r2, K=K1, U=120.)
  File "C:\Python26\lib\site-packages\Cantera\Reactor.py", line 907, in __init__
    self.setExpansionRateCoeff(K)
  File "C:\Python26\lib\site-packages\Cantera\Reactor.py", line 973, in setExpansionRateCoeff
    _cantera.wall_setExpansionRateCoeff(self.__wall_id, k)
AttributeError: Polynomial instance has no attribute '__float__'
------------------------------------

What is the expected output? What do you see instead?
at that point there should be no output yet

What version of the product are you using? On what operating system?
Cantera 1.8, Python 2.6, Windows XP

Please provide any additional information below.

The code:

from Cantera import *
from Cantera.Reactor import *
import Cantera.Func as fu
Pin=1e5
Pfinal=1.1e5
K1=fu.Polynomial([1,1])
gas1 = GRI30() #importPhase('mmc1.cti')
gas1.set(T = 629.0, P = Pin, X = 'CH4:1.2, O2:1., N2:3.76')
r1 = Reactor(gas1, volume = 1.)
gas2 = GRI30()
gas2.set(T = 300.0, P = Pfinal, X = 'O2:21., N2:79.')
r2 = Reactor(gas2,volume=10.)
w = Wall(left = r1, right = r2, K=K1, U=120.)

Original issue reported on code.google.com by Burak.At...@gmail.com on 10 Jun 2010 at 12:01

Attachments:

GoogleCodeExporter commented 9 years ago
This error is generated because the current Wall implementation doesn't support 
specifying K as a function of time.

Original comment by yarmond on 27 May 2011 at 11:42

GoogleCodeExporter commented 9 years ago

Original comment by yarmond on 22 Jun 2012 at 10:38

GoogleCodeExporter commented 9 years ago

Original comment by yarmond on 10 Jun 2013 at 8:53