@@ -259,7 +259,7 @@ def test_equalize_pressure(self):
259
259
self .net .advance (1.0 )
260
260
261
261
assert self .net .time == approx (1.0 )
262
- assert self .gas1 . P == approx (self .gas2 .P )
262
+ assert self .r1 . thermo . P == approx (self .r2 . thermo .P )
263
263
assert self .r1 .T != approx (self .r2 .T )
264
264
265
265
def test_tolerances (self , rtol_lim = 1e-10 , atol_lim = 1e-20 ):
@@ -1203,7 +1203,7 @@ def test_nonreacting(self):
1203
1203
mdot_o = 5.0
1204
1204
T0 = 900.0
1205
1205
self .setup_reactor (T0 , 10 * ct .one_atm , mdot_f , mdot_o )
1206
- self .gas .set_multiplier (0.0 )
1206
+ self .combustor . thermo .set_multiplier (0.0 )
1207
1207
t ,T = self .integrate (100.0 )
1208
1208
1209
1209
for i in range (len (t )):
@@ -1406,7 +1406,7 @@ def test_with_surface_reactions(self):
1406
1406
self .net1 .rtol = self .net2 .rtol = 1e-9
1407
1407
self .integrate (surf = True )
1408
1408
1409
- def test_surf_install_deprecated (self ):
1409
+ def test_surf_install_deprecated (self , allow_deprecated ):
1410
1410
self .create_reactors (add_surf = True , use_surf_install = True )
1411
1411
self .net1 .atol = self .net2 .atol = 1e-18
1412
1412
self .net1 .rtol = self .net2 .rtol = 1e-9
@@ -1642,9 +1642,10 @@ def update(self, gas):
1642
1642
1643
1643
@ct .extension (name = "fail-rate" , data = FailRateData )
1644
1644
class FailRate (ct .ExtensibleRate ):
1645
- def __init__ (self , * args , recoverable , ** kwargs ):
1645
+ def __init__ (self , * args , recoverable = None , ** kwargs ):
1646
1646
super ().__init__ (* args , ** kwargs )
1647
- self .recoverable = recoverable
1647
+ if recoverable is not None :
1648
+ self .recoverable = recoverable
1648
1649
self .count = 0
1649
1650
1650
1651
def eval (self , data ):
@@ -1654,6 +1655,12 @@ def eval(self, data):
1654
1655
raise ValueError ("spam" )
1655
1656
return 0.0
1656
1657
1658
+ def get_parameters (self , params ):
1659
+ params ["recoverable" ] = self .recoverable
1660
+
1661
+ def set_parameters (self , params , rate_coeff_units ):
1662
+ self .recoverable = params ["recoverable" ]
1663
+
1657
1664
1658
1665
class TestFlowReactor :
1659
1666
gas_def = """
@@ -1859,7 +1866,7 @@ def test_recoverable_integrator_errors(self):
1859
1866
sim .step ()
1860
1867
1861
1868
# At least some "recoverable" errors occurred
1862
- assert fail .rate .count > 0
1869
+ assert r . thermo . reaction ( gas . n_reactions - 1 ) .rate .count > 0
1863
1870
1864
1871
def test_max_steps (self ):
1865
1872
surf , gas = self .import_phases ()
@@ -1982,8 +1989,8 @@ def test_reinitialization(self):
1982
1989
cov1 = rsurf .kinetics .coverages
1983
1990
1984
1991
# Reset the reactor to the same initial state
1985
- gas .TPX = 1700 , 4000 , 'NH3:1.0, SiF4:0.4'
1986
- surf .TP = gas . TP
1992
+ r . thermo .TPX = 1700 , 4000 , 'NH3:1.0, SiF4:0.4'
1993
+ surf .TP = 1700 , 4000
1987
1994
r .mass_flow_rate = 0.01
1988
1995
r .syncState ()
1989
1996
@@ -2354,7 +2361,7 @@ def integrate(r, net):
2354
2361
2355
2362
rA , rB , surfX , surfY , net = setup (order )
2356
2363
for (obj ,k ) in [(surfY ,2 ), (surfX ,2 ), (rB ,18 ),
2357
- (surfX ,0 ), (rB ,2 )]:
2364
+ (surfY ,0 ), (rB ,2 )]:
2358
2365
obj .add_sensitivity_reaction (k )
2359
2366
2360
2367
integrate (rB , net )
@@ -2963,7 +2970,7 @@ def after_eval(self,t,LHS,RHS):
2963
2970
# compare heat added (add_heat) to the equivalent energy contained by the solid
2964
2971
# and gaseous mass in the reactor
2965
2972
r1_heat = (mass_lump * cp_lump * (r1 .thermo .T - 500 ) +
2966
- mass_gas * (self . gas .enthalpy_mass - gas_initial_enthalpy ))
2973
+ mass_gas * (r1 . thermo .enthalpy_mass - gas_initial_enthalpy ))
2967
2974
add_heat = Q * time
2968
2975
assert add_heat == approx (r1_heat , abs = 1e-5 )
2969
2976
@@ -3051,9 +3058,9 @@ def replace_update_surface_state(self, y):
3051
3058
Hweight = ct .Element ("H" ).weight
3052
3059
total_sites = rsurf .area * surf .site_density
3053
3060
def masses ():
3054
- mass_H = (gas .elemental_mass_fraction ("H" ) * r1 .mass +
3061
+ mass_H = (r1 . thermo .elemental_mass_fraction ("H" ) * r1 .mass +
3055
3062
total_sites * r1 .surfaces [0 ].kinetics ["H(s)" ].X * Hweight )
3056
- mass_O = gas .elemental_mass_fraction ("O" ) * r1 .mass
3063
+ mass_O = r1 . thermo .elemental_mass_fraction ("O" ) * r1 .mass
3057
3064
return mass_H , mass_O
3058
3065
3059
3066
net .step ()
@@ -3263,11 +3270,11 @@ def test_jacobian(self):
3263
3270
3264
3271
upstream = ct .Reservoir (gas )
3265
3272
gas .equilibrate ("HP" )
3266
- gas .set_multiplier (0.0 )
3267
3273
downstream = ct .Reservoir (gas )
3268
3274
V0 = 1e-3
3269
3275
mdot = 120
3270
3276
r = ct .MoleReactor (gas , volume = V0 )
3277
+ r .thermo .set_multiplier (0.0 )
3271
3278
inlet = ct .MassFlowController (upstream , r , mdot = mdot )
3272
3279
ct .MassFlowController (r , downstream , mdot = mdot )
3273
3280
net = ct .ReactorNet ([r ])
0 commit comments