Pressure setting problem

31 views
Skip to first unread message

Nikolay Lazarov

unread,
Oct 24, 2026, 5:56:27 AMOct 24
to Cantera Users' Group
Hello everyone!

I installed 3.2.0 on python 3.14 and currently looking into the tutorials. Well, i can't set proper pressure - i supply 100,000 Pa but get 6300

import cantera as ct
import numpy as np

mixture = ct.Solution('gri30.yaml')

mixture.TP = 350, 100_000
mixture.X = { "O2":3 }

mixture()



==================================
  gri30:

       temperature   350 K
          pressure   6300.4 Pa
           density   0.069277 kg/m^3
  mean mol. weight   31.998 kg/kmol
   phase of matter   gas
===================================

Any idea why this happens?

Leonardo Giordo

unread,
Nov 5, 2026, 8:23:54 AM (12 days ago) Nov 5
to Cantera Users' Group
import cantera as ct
import numpy as np
print('Cantera Version:' + ct.__version__)

mixture = ct.Solution('gri30.yaml')
mixture.TP = 350, 100_000
print("Before changing X")
print(mixture.T, mixture.P, mixture.density)
mixture.X = { "O2":3 }
print("After changing X")
print(mixture.T, mixture.P, mixture.density)
mixture.TPX = 350, 100_000,{ "O2":3 }
print("Correct Way")
print(mixture.T, mixture.P, mixture.density)


Cantera Version:3.1.0
Before changing X
350.0 100000.0 0.0692768765046102
After changing X
350.0 6300.393774610913 0.0692768765046102
Correct Way
350.0 100000.0 1.0995642333306137

Seems that if you set .TP you are actually fixing Temperature and Density. The pressure adapts at the density when you set the new composition.
Reply all
Reply to author
Forward
0 new messages