You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The FlameBase.set_initial_guess method does not work for counterflow flame configurations (for example, CounterflowDiffusionFlame.
Steps to reproduce
frompathlibimportPathimportcanteraasctp=ct.one_atm# pressuretin_f=300.0# fuel inlet temperaturetin_o=300.0# oxidizer inlet temperaturemdot_o=0.72# kg/m^2/smdot_f=0.24# kg/m^2/scomp_o="O2:0.21, N2:0.78, AR:0.01"# air compositioncomp_f="C2H6:1"# fuel compositionwidth=0.02# Distance between inlets is 2 cmloglevel=1# amount of diagnostic output (0 to 5)gas=ct.Solution("gri30.yaml")
gas.TP=gas.T, pforiinrange(2):
f=ct.CounterflowDiffusionFlame(gas, width=width)
# Set the state of the two inletsf.fuel_inlet.mdot=mdot_ff.fuel_inlet.X=comp_ff.fuel_inlet.T=tin_ff.oxidizer_inlet.mdot=mdot_of.oxidizer_inlet.X=comp_of.oxidizer_inlet.T=tin_o# Set the boundary emissivitiesf.boundary_emissivities=0.0, 0.0# Turn radiation offf.radiation_enabled=Falsef.set_refine_criteria(ratio=4, slope=0.2, curve=0.3, prune=0.04)
# Use the prior solution as an intial guessifi>0:
f.set_initial_guess(data=restart_file_name)
# Solve the problemf.solve(loglevel, auto=True)
# Save the result to .csv to be used as the next initial guessrestart_file_name=Path() /"restart.csv"f.save(
restart_file_name,
overwrite=True,
)
Behavior
The above code fails on the second iteration through the loop with the exception:
Cell In[4], line 41
39# Use the prior solution as an intial guess40if i >0:
---> 41 f.set_initial_guess(data=restart_file_name)
43# Solve the problem44 f.solve(loglevel, auto=True)
File [onedim.py:1253], in CounterflowDiffusionFlame.set_initial_guess(self, data, group)
1246 def set_initial_guess(self, data=None, group=None):
1247 """
1248 Set the initial guess for the solution. By default, the initial guess
1249 is generated by assuming infinitely-fast chemistry. Alternatively, a
1250 previously calculated result can be supplied as an initial guess via
1251 'data' and 'key' inputs (see `FlameBase.set_initial_guess`).
1252 """
-> 1253 super().set_initial_guess(data=data, group=group)
1254 if data:
1255 return
File [onedim.py:163], in FlameBase.set_initial_guess(self, data, group, *args, **kwargs)
159 right =self.domains[2]
161ifisinstance(left, Inlet1D) andisinstance(right, Inlet1D):
162# find stagnation plane
--> 163 i = np.flatnonzero(self.velocity > 0)[-1]
165# adjust temperatures166 grid = arr.grid
IndexError: index -1 is out of bounds for axis 0 with size 0
System information
Cantera version: 3.0.0; also applies to main branch as of 66835e2.
Problem description
The
FlameBase.set_initial_guess
method does not work for counterflow flame configurations (for example,CounterflowDiffusionFlame
.Steps to reproduce
Behavior
The above code fails on the second iteration through the loop with the exception:
System information
main
branch as of 66835e2.Additional context
Originally reported on the Cantera Users' Group
The text was updated successfully, but these errors were encountered: