MCPcopy Create free account
hub / github.com/Cantera/cantera / create_reactors

Method create_reactors

test/python/test_reactor.py:1290–1356  ·  view source on GitHub ↗
(self, add_Q=False, add_mdot=False, add_surf=False)

Source from the content-addressed store, hash-verified

1288 reactorClass = ct.ConstPressureReactor
1289
1290 def create_reactors(self, add_Q=False, add_mdot=False, add_surf=False):
1291 gas_def = """
1292 phases:
1293 - name: gas
1294 species:
1295 - gri30.yaml/species: [H2, H, O, O2, OH, H2O, HO2, H2O2, CH3, CH4, CO, CO2,
1296 HCO, CH2O, CH3O, CH3OH, N2, AR]
1297 thermo: ideal-gas
1298 kinetics: gas
1299 reactions:
1300 - gri30.yaml/reactions: declared-species
1301 skip-undeclared-third-bodies: true
1302 """
1303 self.gas = ct.Solution(yaml=gas_def)
1304 self.gas.TPX = 900, 25*ct.one_atm, 'CO:0.5, H2O:0.2'
1305
1306 self.gas1 = ct.Solution(yaml=gas_def)
1307 self.gas2 = ct.Solution(yaml=gas_def)
1308 resGas = ct.Solution(yaml=gas_def)
1309 solid = ct.Solution('diamond.yaml', 'diamond')
1310
1311 T0 = 1200
1312 P0 = 25*ct.one_atm
1313 X0 = 'CH4:0.5, H2O:0.2, CO:0.3'
1314
1315 self.gas1.TPX = T0, P0, X0
1316 self.gas2.TPX = T0, P0, X0
1317
1318 self.r1 = ct.IdealGasReactor(self.gas1)
1319 self.r2 = self.reactorClass(self.gas2)
1320
1321 self.r1.volume = 0.2
1322 self.r2.volume = 0.2
1323
1324 resGas.TP = T0 - 300, P0
1325 env = ct.Reservoir(resGas)
1326
1327 U = 300 if add_Q else 0
1328
1329 self.w1 = ct.Wall(self.r1, env, K=1e3, A=0.1, U=U)
1330 self.w2 = ct.Wall(self.r2, env, A=0.1, U=U)
1331
1332 if add_mdot:
1333 mfc1 = ct.MassFlowController(env, self.r1, mdot=0.05)
1334 mfc2 = ct.MassFlowController(env, self.r2, mdot=0.05)
1335
1336 if add_surf:
1337 self.interface1 = ct.Interface('diamond.yaml', 'diamond_100',
1338 (self.gas1, solid))
1339 self.interface2 = ct.Interface('diamond.yaml', 'diamond_100',
1340 (self.gas2, solid))
1341
1342 C = np.zeros(self.interface1.n_species)
1343 C[0] = 0.3
1344 C[4] = 0.7
1345 self.surf1 = ct.ReactorSurface(self.interface1, A=0.2)
1346 self.surf2 = ct.ReactorSurface(self.interface2, A=0.2)
1347 self.surf1.coverages = C

Callers 9

test_component_indexMethod · 0.95
test_component_namesMethod · 0.95
test_closedMethod · 0.95
test_with_mdotMethod · 0.95
create_reactorsMethod · 0.45

Calls 5

SolutionMethod · 0.80
InterfaceMethod · 0.80
ReactorSurfaceMethod · 0.80
installMethod · 0.45
ReactorNetMethod · 0.45

Tested by

no test coverage detected