Niemeyer-Research-Group / pyMARS

Python-based (chemical kinetic) Model Automatic Reduction Software
https://niemeyer-research-group.github.io/pyMARS/
MIT License
61 stars 46 forks source link

RuntimeError: Maximum number of steps reached before convergence for ignition case 0 #66

Closed shenghuiqin closed 5 years ago

shenghuiqin commented 5 years ago

Hi, I was trying to reduce a big model

model: 9.2blend2.cti
targets:
  - C7H10(705)
  - C7H16(37)
  - O2(2)(38)
retained-species:
  - N2(35)
method: DRGEP
error: 10.0
sensitivity-analysis: False
autoignition-conditions:
  - kind: constant volume
    pressure: 1.0
    temperature: 1000.0
    fuel:
      C7H10(705): 1.0
      C7H16(37): 1.0
    oxidizer:
      O2(2)(38): 1.0
      N2(35): 8
    equivalence-ratio: 1.0

  - kind: constant volume
    pressure: 1.0
    temperature: 1200.0
    fuel:
      C7H10(705): 1.0
      C7H16(37): 1.0
    oxidizer:
      O2(2)(38): 1.0
      N2(35): 8
    equivalence-ratio: 0.5

and got the Runtime error:

Traceback (most recent call last):
  File "/home/shenghuiqin/anaconda2/envs/spam/bin/pymars", line 12, in <module>
    sys.exit(main())
  File "/home/shenghuiqin/anaconda2/envs/spam/lib/python3.7/site-packages/pymars/__main__.py", line 10, in main
    pymars(args)
  File "/home/shenghuiqin/anaconda2/envs/spam/lib/python3.7/site-packages/pymars/pymars.py", line 319, in pymars
    path=args.path, num_threads=args.num_threads
  File "/home/shenghuiqin/anaconda2/envs/spam/lib/python3.7/site-packages/pymars/pymars.py", line 186, in main
    threshold_upper=upper_threshold, num_threads=num_threads, path=path
  File "/home/shenghuiqin/anaconda2/envs/spam/lib/python3.7/site-packages/pymars/drgep.py", line 387, in run_drgep
    model_file, ignition_conditions, phase_name=phase_name, num_threads=num_threads, path=path
  File "/home/shenghuiqin/anaconda2/envs/spam/lib/python3.7/site-packages/pymars/sampling.py", line 305, in sample
    results.append(simulation_worker(job))
  File "/home/shenghuiqin/anaconda2/envs/spam/lib/python3.7/site-packages/pymars/sampling.py", line 64, in simulation_worker
    sim.run_case(stop_at_ignition)
  File "/home/shenghuiqin/anaconda2/envs/spam/lib/python3.7/site-packages/pymars/simulation.py", line 216, in run_case
    'Maximum number of steps reached before '
RuntimeError: Maximum number of steps reached before convergence for ignition case 0

need help.

xMestas commented 5 years ago

Hello,

Thank you for using the software and reporting your issues to us!

kyleniemeyer commented 5 years ago

@shenghuiqin to clarify about the mole fraction/equivalence ratio, the values in the fuel and oxidizer fields are the mole fractions in the fuel/oxidizer mixture. (So, in the example given, the oxidizer is the typical representation for air of 1.0 O2 + 3.76 N2.) Then, as @xMestas mentioned, the equivalence ratio specified will be used to find the appropriate ratio of fuel and oxidizer.

Alternatively, you can leave out equivalence-ratio, fuel, and oxidizer and specify the molar amounts of each reactant:

reactants:
  CH4: 1.0
  O2: 2.0
  N2: 7.52
shenghuiqin commented 5 years ago

thank you both!

I changed the simulation condition which I can get IDT using cantera,

model: 9.2blend2.cti
targets:
  - C7H10(705)
  - C7H16(37)
  - O2(2)(38)
retained-species:
  - N2(35)
method: DRGEP
error: 10.0
sensitivity-analysis: False
autoignition-conditions:
  - kind: constant volume
    pressure: 20.0
    temperature: 800.0
    reactants:
      C7H10(705): 1
      C7H16(37): 1
      O2(2)(38): 21
      N2(35): 60

but on pyMARS I still get the RuntimeError, I tried on several T and P, still did not work. what else could be the reason to have this error?

kyleniemeyer commented 5 years ago

@shenghuiqin is the ignition delay time you got with Cantera quite long? It may be that the low temperature and extremely lean mixture takes too long to ignite for the default pyMARS parameters.

As mentioned in the Usage docs, you can override these defaults with either a maximum integration time (using an end-time: field) or a larger number of steps (max-steps:, beyond the default of 10000). This would be needed for each autoignition condition with this issue.

shenghuiqin commented 5 years ago

yeah, really loong on cantera, that's why I want to reduce it. my cantera takes 16000 steps to get the IDT thank you, I will try that again

shenghuiqin commented 5 years ago

It works! setting max-steps: 18000

AH9316 commented 4 years ago

Hi, @shenghuiqin. I am also reducing a big mechanism right now and I meet the same situation as you. Where did you put max-steps? We should specify the max-steps at each of -kind block or we can set it at the beginning of the input file? Thank you!

shenghuiqin commented 4 years ago

Hi, @shenghuiqin. I am also reducing a big mechanism right now and I meet the same situation as you. Where did you put max-steps? We should specify the max-steps at each of -kind block or we can set it at the beginning of the input file? Thank you! hi, AH. Attached is my reduction_input.yaml file, at bottom of each kind set, you can specify max-steps. hope this helps.


model: 9.22blend4_toluene.cti
targets:
- Toluene(1)
- C7H16(37)
- O2(2)(38)
retained-species:
- N2(35)
method: DRGEP
error: 10.0
sensitivity-analysis: False
autoignition-conditions:
- kind: constant volume
pressure: 20.0
temperature: 700.0
reactants:
C7H10(705): 1
C7H16(37): 1
O2(2)(38): 21
max-steps: 25000
AH9316 commented 4 years ago

Thank you so much!! @shenghuiqin