@@ -16,7 +16,7 @@ cdef class ReactorBase:
16
16
Common base class for reactors and reservoirs.
17
17
"""
18
18
reactor_type = " none"
19
- def __cinit__ (self , _SolutionBase contents = None , name = None , * , **kwargs ):
19
+ def __cinit__ (self , _SolutionBase contents = None , *, name = " (none) " , **kwargs ):
20
20
if isinstance (contents, _SolutionBase):
21
21
self ._reactor = newReactor(stringify(self .reactor_type),
22
22
contents._base, stringify(name))
@@ -26,8 +26,8 @@ cdef class ReactorBase:
26
26
self ._reactor.get().setName(stringify(name))
27
27
self .rbase = self ._reactor.get()
28
28
29
- def __init__ (self , _SolutionBase contents = None , name = None , *, volume = None ,
30
- node_attr = None ):
29
+ def __init__ (self , _SolutionBase contents = None , * ,
30
+ name = " (none) " , volume = None , node_attr = None ):
31
31
self ._inlets = []
32
32
self ._outlets = []
33
33
self ._walls = []
@@ -198,16 +198,19 @@ cdef class Reactor(ReactorBase):
198
198
def __cinit__ (self , *args , **kwargs ):
199
199
self .reactor = < CxxReactor* > (self .rbase)
200
200
201
- def __init__ (self , contents = None , *, name = None , energy = ' on' , group_name = " " , **kwargs ):
201
+ def __init__ (self , contents = None , *,
202
+ name = " (none)" , energy = ' on' , group_name = " " , **kwargs ):
202
203
"""
203
204
:param contents:
204
205
Reactor contents. If not specified, the reactor is initially empty.
205
206
In this case, call `insert` to specify the contents. Providing valid
206
207
contents will become mandatory after Cantera 3.1.
207
208
:param name:
208
- Used only to identify this reactor in output. If not specified,
209
- defaults to ``'Reactor_n'``, where *n* is an integer assigned in
210
- the order `Reactor` objects are created.
209
+ Name string. If not specified, the name initially defaults to ``'(none)'``
210
+ and changes to ``'<reactor_type>_n'`` when `Reactor` objects are installed
211
+ within a `ReactorNet`. For the latter, ``<reactor_type>`` is the type of
212
+ the reactor and *n* is an integer assigned in the order reactors are
213
+ installed.
211
214
:param energy:
212
215
Set to ``'on'`` or ``'off'``. If set to ``'off'``, the energy
213
216
equation is not solved, and the temperature is held at its
@@ -234,7 +237,7 @@ cdef class Reactor(ReactorBase):
234
237
>>> r3 = Reactor(name='adiabatic_reactor', contents=gas)
235
238
236
239
"""
237
- super ().__init__(contents, name, ** kwargs)
240
+ super ().__init__(contents, name = name , ** kwargs)
238
241
239
242
if energy == ' off' :
240
243
self .energy_enabled = False
@@ -787,8 +790,10 @@ cdef class ReactorSurface:
787
790
Represents a surface in contact with the contents of a reactor.
788
791
789
792
:param name:
790
- Name string. If omitted, the name is ``'ReactorSurface_n'``, where ``'n'``
791
- is an integer assigned in the order reactor surfaces are created.
793
+ Name string. If not specified, the name initially defaults to ``'(none)'`` and
794
+ changes to ``'ReactorSurface_n'`` when when associated `Reactor` objects are
795
+ installed within a `ReactorNet`. For the latter, *n* is an integer assigned in
796
+ the order reactor surfaces are detected.
792
797
:param kin:
793
798
The `Kinetics` or `Interface` object representing reactions on this
794
799
surface.
@@ -803,14 +808,14 @@ cdef class ReactorSurface:
803
808
.. versionadded:: 3.1
804
809
Added the ``node_attr`` parameter.
805
810
"""
806
- def __cinit__ (self , *args , **kwargs ):
807
- name = kwargs.get(" name" )
811
+ def __cinit__ (self , *args , name = " (none)" , **kwargs ):
808
812
self .surface = new CxxReactorSurface(stringify(name))
809
813
810
814
def __dealloc__ (self ):
811
815
del self .surface
812
816
813
- def __init__ (self , kin = None , Reactor r = None , *, name = None , A = None , node_attr = None ):
817
+ def __init__ (self , kin = None , Reactor r = None , *,
818
+ name = " (none)" , A = None , node_attr = None ):
814
819
if kin is not None :
815
820
self .kinetics = kin
816
821
if r is not None :
@@ -946,21 +951,23 @@ cdef class WallBase:
946
951
Common base class for walls.
947
952
"""
948
953
wall_type = " none"
949
- def __cinit__ (self , *args , **kwargs ):
950
- name = kwargs.get(" name" )
954
+ def __cinit__ (self , *args , name = " (none)" , **kwargs ):
951
955
self ._wall = newWall(stringify(self .wall_type), stringify(name))
952
956
self .wall = self ._wall.get()
953
957
954
- def __init__ (self , left , right , *, name = None , A = None , K = None , U = None ,
958
+ def __init__ (self , left , right , *, name = " (none) " , A = None , K = None , U = None ,
955
959
Q = None , velocity = None , edge_attr = None ):
956
960
"""
957
961
:param left:
958
962
Reactor or reservoir on the left. Required.
959
963
:param right:
960
964
Reactor or reservoir on the right. Required.
961
965
:param name:
962
- Name string. If omitted, the name is ``'Wall_n'``, where ``'n'``
963
- is an integer assigned in the order walls are created.
966
+ Name string. If not specified, the name initially defaults to ``'(none)'``
967
+ and changes to ``'<wall_type>_n'`` when when associated `Reactor` objects
968
+ are installed within a `ReactorNet`. For the latter, ``<wall_type>`` is
969
+ the type of the wall and *n* is an integer assigned in the order walls are
970
+ detected.
964
971
:param A:
965
972
Wall area [m^2]. Defaults to 1.0 m^2.
966
973
:param K:
@@ -1219,12 +1226,11 @@ cdef class FlowDevice:
1219
1226
pressure between the upstream and downstream reactors.
1220
1227
"""
1221
1228
flowdevice_type = " none"
1222
- def __cinit__ (self , *args , **kwargs ):
1223
- name = kwargs.get(" name" )
1229
+ def __cinit__ (self , *args , name = " (none)" , **kwargs ):
1224
1230
self ._dev = newFlowDevice(stringify(self .flowdevice_type), stringify(name))
1225
1231
self .dev = self ._dev.get()
1226
1232
1227
- def __init__ (self , upstream , downstream , *, name = None , edge_attr = None ):
1233
+ def __init__ (self , upstream , downstream , *, name = " (none) " , edge_attr = None ):
1228
1234
assert self .dev != NULL
1229
1235
self ._rate_func = None
1230
1236
self .edge_attr = edge_attr or {}
@@ -1390,7 +1396,7 @@ cdef class MassFlowController(FlowDevice):
1390
1396
"""
1391
1397
flowdevice_type = " MassFlowController"
1392
1398
1393
- def __init__ (self , upstream , downstream , *, name = None , mdot = 1. , **kwargs ):
1399
+ def __init__ (self , upstream , downstream , *, name = " (none) " , mdot = 1. , **kwargs ):
1394
1400
super ().__init__(upstream, downstream, name = name, ** kwargs)
1395
1401
self .mass_flow_rate = mdot
1396
1402
@@ -1464,7 +1470,7 @@ cdef class Valve(FlowDevice):
1464
1470
"""
1465
1471
flowdevice_type = " Valve"
1466
1472
1467
- def __init__ (self , upstream , downstream , *, name = None , K = 1. , **kwargs ):
1473
+ def __init__ (self , upstream , downstream , *, name = " (none) " , K = 1. , **kwargs ):
1468
1474
super ().__init__(upstream, downstream, name = name, ** kwargs)
1469
1475
if isinstance (K, _numbers.Real):
1470
1476
self .valve_coeff = K
@@ -1507,14 +1513,8 @@ cdef class PressureController(FlowDevice):
1507
1513
"""
1508
1514
flowdevice_type = " PressureController"
1509
1515
1510
- def __init__ (self , upstream , downstream , *,
1511
- name = None , primary = None , K = 1. , **kwargs ):
1512
- if " master" in kwargs:
1513
- warnings.warn(
1514
- " PressureController: The 'master' keyword argument is deprecated; "
1515
- " use 'primary' instead." , DeprecationWarning )
1516
- primary = kwargs[" master" ]
1517
- super ().__init__(upstream, downstream, name = name, ** kwargs)
1516
+ def __init__ (self , upstream , downstream , *, name = " (none)" , primary = None , K = 1. ):
1517
+ super ().__init__(upstream, downstream, name = name)
1518
1518
if primary is not None :
1519
1519
self .primary = primary
1520
1520
if isinstance (K, _numbers.Real):
0 commit comments