Giter Club home page Giter Club logo

rocketcea's People

Contributors

dfarnainekl avatar eligh-space-machines avatar sonofeft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rocketcea's Issues

contributing additional versions of py_cea.so

Thank you for the time you have put into building this. I've been struggling to incorporate CEA into my projects and this wrapper is awesome. With a little tinkering, I've been able to spit out some really cool little parametric studies. I would love to make some contributions to the project and the first issue I would want to address is the f2py generated py_cea.so files.

In the short term, I have a version for python 2.7 and 3.7 under 64 bit macOS that might be useful to add to the repository. I see you have .so files included in the .gitignore. What would be the best way to add this file to the repository? I am just barely competent enough at git to be able to get by so there is the definite possibility that I just don't get the workflow.

In the slightly longer term, what are your thoughts on somehow including the f2py process into the pip install process so that this file is automatically generated for each users environment at install time?

Transport quantities

I have noticed an inconsistency in the tranport variables (viscosity, conductivity, and thus Pr number) between the rocketcea output and the "vanilla" cea2. We have done a double check with a 2004 cea version and the cearun online. These two versions provide identical results, with rocketcea returning different values for the mentioned quantities (the rest, T,P,rho, etc are identical in all three).
The inconsistency can be seen in the full cea output generated by rocketcea as well (f.out file). This might indicate the problem is in the py_cea.f implementation, but we haven't been able to identify the issue.

"Runtime Error: End of file" Occurring While Calling 'get_Chamber_Transport(...)'

Hey all,

I appreciate the amount of work you guys spent making this wrapper! As an AE student, this project is a godsend.

I'm still in the process of fully learning RocketCEA, but I'm having trouble with a couple of functions that seem to always produce a runtime error. Anytime I call get_Chamber_Transport(...), get_Exit_Transport(...), and get_Throat_Transport(...), the program produces the following error:

At line 5462 of file rocketcea/py_cea.f (unit = 13, file = 'C:\Users\XXX\RocketCEA\temp.dat')
Fortran runtime error: End of file

Process finished with exit code 2

I have no idea what could be causing this because everything else about the module works, just those specific methods seem to result in a runtime error. I see that another issue regarding those methods was posted a couple of years ago, but the solution seemed to be "update RocketCEA" and I believe I have the latest version. I'm using Python 3.9 with Anaconda. Is it something wrong with the way I installed Fortran?

Any help is appreciated! Thank you for your time!

To reproduce the issue I'm having, create a new project and paste the following code:

from rocketcea.cea_obj import CEA_Obj

if __name__ == '__main__':
    cea_obj = CEA_Obj(oxName='LOX', fuelName='Kerosene')
    properties = cea_obj.get_Chamber_Transport(Pc=250, MR=1.8, eps=3)

And got the Fortran runtime error. Let me know if it works for you.

add way to define optional points

in standard CEA there is a way to define subsonic/supersonic points and get multiple EXIT columns, like this:

problem case=test2
rocket equilibrium frozen nfz=1 tcest,k=3000
p,psia=1000,
sub,ae/at=50,
sup,ae/at=50,
react
.....

and get THEORETICAL ROCKET PERFORMANCE section with extra points

CHAMBER THROAT EXIT EXIT
68.947 38.886 68.944 0.09614
3375.23 3066.93 3375.21 1014.20
6.2875 0 3.9026 0 6.2873 0 2.9178-2
-1444.57 -2043.50 -1444.62 -5730.47
-2541.15 -3039.92 -2541.19 -6059.97

is there a way to do so with rocketCEA?

Identical return values on get_Temperatures despite varying fuel combination mass ratios

When I run this code:

from rocketcea.cea_obj_w_units import CEA_Obj
                       
combustor = CEA_Obj(oxName='GOX', fuelName='C3H8', 
                   pressure_units='Pa',
                   cstar_units='m/s',
                   temperature_units='K',
                   sonic_velocity_units='m/s',
                   enthalpy_units='kJ/kg', # Need to be aware that this is kJ
                   density_units='kg/m^3',
                   specific_heat_units='J/kg-K',
                   thermal_cond_units='W/cm-degC') # Need to be aware of cm here

P_comb = 5.31e5 # 5.31 bar
er = 1

print(combustor.get_Temperatures(Pc=P_comb, MR=8.9,eps=er))
print(combustor.get_Temperatures(Pc=P_comb, MR=9.0,eps=er))
print(combustor.get_Temperatures(Pc=P_comb, MR=9.1,eps=er))

print('---')

from rocketcea.cea_obj import CEA_Obj
combustor = CEA_Obj(oxName='GOX', fuelName='C3H8')
print(combustor.get_Temperatures(Pc=P_comb, MR=8.9,eps=er))
print(combustor.get_Temperatures(Pc=P_comb, MR=9.0,eps=er))
print(combustor.get_Temperatures(Pc=P_comb, MR=9.1,eps=er))

I get

[2994.1379217115486, 2852.486415593293, 2852.4864153875865]
[2915.777219727355, 2767.0212830485807, 2767.02128304865]
[2915.777219727355, 2767.0212830485807, 2767.02128304865]
---
[6431.538299794149, 5929.8059041449515, 5929.805904145204]
[6065.983851953892, 5566.474112026709, 5566.474112026699]
[6065.983851953892, 5566.474112026709, 5566.474112026699]

The two returns of MR=9.0 and MR=9.1 are identical.
I assume this might have something to do with caching, but I haven't been able to find the error in the source code.

`import imp` removed from Python3.12

the tests can't run on Python3.12

please don't consider zombie-imp a proper solution

 # zombie-imp
 .
 ~~A particularly mischevious act of necromancy. That is,~~
 A copy of the `imp` module that was removed in Python 3.12.
 .
 Don't use this, it'll probably trick and bite you.

get_Enthalpies and get_Chamber_H yield different values

I am trying to read the enthalpies as well as densities and other values from rocketcea using LOX and LH2 using this code:

#from rocketcea.cea_obj_w_units import CEA_Obj
from rocketcea.cea_obj import CEA_Obj

def main():

P1 = 300

# ceaObj = CEA_Obj(oxName='LOX', fuelName='LH2', useFastLookup=0, makeOutput=0,
# 		isp_units='m/sec', cstar_units='m/sec', pressure_units='Bar', temperature_units='K',
# 		sonic_velocity_units='m/sec', enthalpy_units='J/kg', density_units='kg/m^3', specific_heat_units='J/kg-K')
ceaObj = CEA_Obj(oxName='LOX', fuelName='LH2')

#enthalpy in chamber
chamberEnthalpy = ceaObj.get_Chamber_H(P1, 1, eps=40.0)
#get enthalpies of engine
enthalpies = ceaObj.get_Enthalpies(P1, 1, eps=40.0)
#get densities of engine
densities = ceaObj.get_Densities(P1, 1, eps=40.0)
#chamber density
chamberDensity = ceaObj.get_Chamber_Density(P1, 1, eps=40.0)
#sonic velocity in chamber	
chamberSonicVel = ceaObj.get_Chamber_SonicVel(P1, 1, eps=40.0)
#chamber heat cap. viscosity, conductivity and prantl number
chamberTransport = ceaObj.get_Chamber_Transport(P1, 1, eps=40.0, frozen=0)

print("Densities in Engine " + str(densities))
print("Density in Chamber " + str(chamberDensity))
print("Enthalpy in Engine " + str(enthalpies))
print("Enthalpy in Chamber " + str( chamberEnthalpy ))

main()

when executing it the results are:

Densities in Engine [   97456.56086048   154481.69929706 14320654.40302216]
Density in Chamber 0.06405721631134928
Enthalpy in Engine [ -293.23872262  -433.53167713 -1046.7461387 ]
Enthalpy in Chamber -1048.9114065272818

I'm using version 1.1.12

I've looked up the code of get_Enthalpies and get_Chamber_H and they use the same functions in the end.

The weird thing is, when removing get_Chamber_SonicVel and get_Chamber_Transport they the density values are the same, but enthalpy not. When additionally removing the two densities functions, enthalpy is the same for both functions.

I've even tried to create a new CEA_Obj after each of these functions, but that doesn't fix it.

When using cea_obj_w_units none of these above described "fixes" work.

I also ran the basic_cea.py code you provided in the docs, but the results are fine.

Do you have any idea what the issue could be?

Thanks!

temperature setting

Hello, I would like to know what is the temperature set during rocketcea making calculation, can it be changed? Thank you!

0 output on get_isp and other functions

Where I run this example code:

from rocketcea.cea_obj import CEA_Obj
C = CEA_Obj( oxName='LOX', fuelName='LH2')

for mr in range(2,9):
print(mr, C.get_Isp(Pc=100.0, MR=mr, eps=40.0) )

I get this output:

2 0.0
3 0.0
4 0.0
5 0.0
6 0.0
7 0.0
8 0.0

I'm on Win10, and RocketCEA is installed correctly.

make library file more portable

Prebuilt pyd/so library file has dependency on libgfortran. That makes every user to install complete compiling toolchains, which increases cost of using this package. May be you can compile the module with f2py in a "static" way to get a more portable library.

  • run f2py command with --build-dir [build_dir] option, thus you can keep intermediate files.
  • repeat the linking command (get it from stdout of the previous f2py command) , adding " -static " linker option.

I test this in Windows, and it works without libgfortran dependency.

Finally, thanks for the great work of this project,.

Help: Recompile py_cea after installation

@sonofeft,
Really like the work you've done here! Just trying to understand and possibly extend its functionality.
If I have this right, RocketCEA will write CEA input files making requests for multiple sub- and supersonic area ratio nozzles in the same CEA run, but querying output results beyond the py_cea.inc INCLUDE variable NCOL value get clipped. For example, if I request more than 6 supersonic nozzle area ratios and the CEA results spill to a second printed grouping, py_cea doesn't know about and isn't able to access those results. By default, it appears the py_cea.inc file uses the CEA default NCOL value of 8, so only the first 8 outputs for a given combustion chamber pressure and mixture ratio are available to the CEA_Obj. If I can edit py_cea.inc NCOL=30, then I'd be able to max out CEA's ability to provide both sub- and supersonic nozzle outputs per run (rather than the hassle of tracking additional printed rows from the normal CEA output file). The trouble I'm having is recompiling py_cea after rocketcea's baseline installation. Do you have a process recommended for recompiling py_cea after an otherwise successful rocketcea installation so that other modifications/updates like this one can be made? Thanks for your help!
Regards

Running of CEA_obj methods changes 'get_full_cea_output'

Some CEA_obj methods change the output given by .get_full_cea_output() if run before it. For example .get_eps_at_Pc0vPe() and .get_Pc0Pe().

In the example below, the full output is as expected without the .get_PcOvPe()-line, but when it is included, the viscosites, conductivies and prandtl numbers are different in the final output

from rocketcea.cea_obj import CEA_Obj

cea = CEA_Obj(oxName='LO2_NASA', fuelName='LH2_NASA')
kwargs = {'Pc': 797.7, 'MR': 5.6, 'eps':22}  
cea.get_Pc0vPe(**kwargs)  # Output changes if this line is included
output = cea.get_full_cea_output(**kwargs)

Ran on windows 10, python 3.9, rocketcea 1.1.26

get_Pinj_over_Pcomb not implemented in cea_obj_w_units

This function is not implemented, meaning I have to import the standard library which uses US conventional units separately from the w_units version.

Proposed fix:
put the following code into cea_obj_w_units.py inside of the CEA_Obj class

   def get_Pinj_over_Pcomb(self, Pc=100.0, MR=1.0, fac_CR=None):
        return self.cea_obj.get_Pinj_over_Pcomb( Pc=Pc, MR=MR, fac_CR=fac_CR)

Which version of python and numpy do I need to install

When I run pip install rocket cea I get the errors/ warnings below. Which numpy version do i need?

SetuptoolsDeprecationWarning: setup.py install is deprecated.

and

      INFO: No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
      INFO: customize MSVCCompiler
      INFO: customize MSVCCompiler using build_ext
      INFO: CCompilerOpt.cc_test_flags[1073] : testing flags (/O2)
      error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      INFO: CCompilerOpt.cache_flush[857] : write cache to path -> C:\Users\sabri\AppData\Local\Temp\pip-install-bxun9xhh\rocketcea_1375851929e9414b90620f95d93a0d5c\build\temp.win-amd64-cpython-311\Release\ccompiler_opt_cache_ext.py
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for rocketcea
  Running setup.py clean for rocketcea
Failed to build rocketcea
ERROR: Could not build wheels for rocketcea, which is required to install pyproject.toml-based projects

get_full_cea_output returns different results from other methods

Hi,

I am currently writing a library for sizing of staged combuston cycles and I noticed some discrepancies in RocketCEA.

The mole fractions from get_full_cea_output and from get_SpeciesMoleFractions are not the same. I also noticed that MW calculations vary a lot between different methods. For the code below, get_full_cea_output gives 15.987 g/mol in the chamber, while get_Chamber_MolWt_gamma gives 17.02 g/mol. When CEA_Obj from cea_obj_w_units is used, get_Chamber_MolWt_gamma gives 17.33 g/mol (so molecular weight from get_full_cea_output as if graphite products had no volume). When I calculate it manually for molar fractions from get_SpeciesMoleFractions I get 15.45 g/mol - a fairly big difference.

Here is the code that compares the values.

import rocketcea.cea_obj as rcea
from rocketcea.cea_obj_w_units import CEA_Obj
# Molar fractions issue
CEA_obj = rcea.CEA_Obj(oxName="LOX", fuelName="CH4")
print(CEA_obj.get_full_cea_output(Pc=800, MR=0.2, pc_units="bar", short_output=1, output="si"))
print(CEA_obj.get_SpeciesMoleFractions(Pc=800, MR=0.2))
# Molar weight issue
print(CEA_obj.get_Chamber_MolWt_gamma(Pc=800, MR=0.2))
CEA_obj = CEA_Obj(oxName="LOX", fuelName="CH4", isp_units='sec', cstar_units='m/s',
                  pressure_units='bar', temperature_units='K', sonic_velocity_units='m/s',
                  enthalpy_units='kJ/kg', density_units='kg/m^3', specific_heat_units='kJ/kg-K',
                  viscosity_units='millipoise', thermal_cond_units='W/cm-degC')
print(CEA_obj.get_Chamber_MolWt_gamma(Pc=800, MR=0.2))

Do you know what may be an issue? Thanks for the help!

With kind regards,
Jan

Can't create monopropellant N2

With CEA's GUI application, I can easily select to use N2 as a monopropellant. However, RocketCEA does not allow me to create a CEA_Obj instance with propName="N2. Here is the code I used:
from rocketcea.cea_obj import CEA_Obj
CEA_Obj(propName="N2")
which yields the following error:

ERROR... bad propellant name (N2) in cea_obj.py
<rocketcea.cea_obj.CEA_Obj object at 0x7efc86f71fa0>

Is this the expected behavior? Is there any other way of choosing arbitrary substances from thermo.lib?

Differenr output from cea2 and rocketcea.

Dear author,
I used the cea2 program included in rocketcea with same input, but got different output, I don't know where the problem is, so I want to ask you. I don’t know if there are any parameters to be set in some places
### Input:
propellants:
name AP N 1 H 4 CL 1 O 4 wt%=50.0 h,cal=-70666.62000000001 t(k)=298.15 rho.g/cc=1.95
name HMX C 4 H 8 O 8 N 8 wt%=50.0 h,cal=17881.665 t(k)=298.15 rho.g/cc=1.9
name BTTN C 4 H 7 O 9 N 3 wt%=50.0 h,cal=-97232.3 t(k)=298.15 rho.g/cc=1.52
parameters:
Pc = 6.86MPa PcOvPe = 67.703

    ### CEA2 output:

a5c34953ad878eebcb25abf90818a33

    ### ROCKETCEA output:

4da3c0b0a1c1642145f26dfe599fd7e

numpy.distutils deprecated as of python 3.12

Posting this for visibility, obviously a "solution" is to use a python version earlier than 3.12. However, this will also be removed from versions earlier than 3.12 in Oct, 2025, so needs to be addressed at some point.

With the newest python release, numpy now no longer includes distutils, see here. This results in the following error when trying the usual python -m pip install rocketcea:

Collecting rocketcea
  Using cached rocketcea-1.1.34.tar.gz (38.5 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [6 lines of output]
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-8wg81_vj/rocketcea_cc4566460e524c06aa5b992ef789e0b7/setup.py", line 21, in <module>
          from numpy.distutils.core import Extension, setup
      ModuleNotFoundError: No module named 'numpy.distutils'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

As for a solution to this problem, it seems that moving to setuptools may be easiest.

It seems that the `cea_obj.i_exit` is not right in some case

Problem:

I cannot get right quantity using cea_obj.i_exit to access py_cea data.

Reproduct

from rocketcea import cea_obj,py_cea
from pint import UnitRegistry
ureg = UnitRegistry()
Q = ureg.Quantity

co = cea_obj.CEA_Obj( oxName='GO2', fuelName='GH2')
co.setupCards(
    Pc=20e6/1e5,
    pc_units="bar",
    MR=16,
    eps=10.3,
    subar=14**2,
    PcOvPe=None,
    frozen=0,
    ERphi=None,
    ERr=None,
    frozenAtThroat=0,
    short_output=1,
    show_transport=1,
    output="trace=1e-4",
    show_mass_frac=True
)

print(f'{"py_cea.cet_inp.inplines":=^79}')
for i,l in enumerate(py_cea.cet_inp.inplines):
    if len(l)>0: print(f'{i=}\t{l.decode()}')

cd = {
    'Ru':Q(float(py_cea.miscr.rr),'J/kmol/K'), # 气体常数
    'Cstar':Q(float(py_cea.rockt.cstr),'ft/s').to('m/s'), # 特征速度 
    'MR':float(py_cea.miscr.oxfl),  # 混合比
}
def get_section_properties(idx):
    return {
        'P':Q(py_cea.prtout.ppp[idx],'bar'),
        'T':Q(py_cea.prtout.ttt[idx],'K'),
        'MW':Q(py_cea.prtout.wm[idx], 'g/mol'),
        'gamma':py_cea.prtout.gammas[idx],
        'c':Q(py_cea.rockt.sonvel[idx],'m/s'),
        'rho':Q(1e5/py_cea.prtout.vlm[idx],'kg/m^3'),
        'Ma':py_cea.rockt.vmoc[idx],
        'vis':Q(py_cea.trpts.vis[ idx ],'millipoise'),
        'kappa_eq':Q(py_cea.trpts.coneql[ idx ],'mW/cm/K'),
        'Cp_eq':Q(py_cea.trpts.cpeql[ idx ],'kJ/kg/K'),
        'Pr_eq':py_cea.trpts.preql[ idx ],
        'kappa_frozen':Q(py_cea.trpts.confro[ idx ],'mW/cm/K'),
        'Cp_frozen':Q(py_cea.trpts.cpfro[ idx ],'kJ/kg/K'),
        'Pr_frozen':py_cea.trpts.prfro[ idx ],
        'AR':py_cea.rockt.aeat[ idx ]
    }

idx_chamber = co.i_chm
cd['chamber']=get_section_properties(idx_chamber)
idx_throat = co.i_thrt
cd['throat']=get_section_properties(idx_throat) 
idx_exit = co.i_exit + 1 # *i_exit* here seems not right
cd['nz_exit']=get_section_properties(idx_exit) 
pprint(cd)

output:

{'Cstar': <Quantity(542.372144, 'meter / second')>,
 'MR': 16.0,
 'Ru': <Quantity(8314.51, 'joule / kelvin / kilomole')>,
 'chamber': {'AR': 0.0,
             'Cp_eq': <Quantity(4.2473391, 'kilojoule / kelvin / kilogram')>,
             'Cp_frozen': <Quantity(2.29096831, 'kilojoule / kelvin / kilogram')>,
             'MW': <Quantity(21.9011275, 'gram / mole')>,
             'Ma': 0.0,
             'P': <Quantity(200.0, 'bar')>,
             'Pr_eq': 0.5397834754415739,
             'Pr_frozen': 0.719913879649891,
             'T': <Quantity(3395.45928, 'kelvin')>,
             'c': <Quantity(1215.79102, 'meter / second')>,
             'gamma': 1.1466982484512354,
             'kappa_eq': <Quantity(8.55210265, 'milliwatt / centimeter / kelvin')>,
             'kappa_frozen': <Quantity(3.45870952, 'milliwatt / centimeter / kelvin')>,
             'rho': <Quantity(15.5153395, 'kilogram / meter ** 3')>,
             'vis': <Quantity(1.08686488, 'millipoise')>},
 'nz_exit': {'AR': 10.3,
             'Cp_eq': <Quantity(2.17983594, 'kilojoule / kelvin / kilogram')>,
             'Cp_frozen': <Quantity(2.04322979, 'kilojoule / kelvin / kilogram')>,
             'MW': <Quantity(22.7060354, 'gram / mole')>,
             'Ma': 3.1827071461113543,
             'P': <Quantity(2.60049731, 'bar')>,
             'Pr_eq': 0.744854713616324,
             'Pr_frozen': 0.7630850153095624,
             'T': <Quantity(1895.06472, 'kelvin')>,
             'c': <Quantity(914.881092, 'meter / second')>,
             'gamma': 1.2061738456097773,
             'kappa_eq': <Quantity(2.07504945, 'milliwatt / centimeter / kelvin')>,
             'kappa_frozen': <Quantity(1.89854327, 'milliwatt / centimeter / kelvin')>,
             'rho': <Quantity(0.374746005, 'kilogram / meter ** 3')>,
             'vis': <Quantity(0.709048942, 'millipoise')>},
 'throat': {'AR': 1.0,
            'Cp_eq': <Quantity(3.98287534, 'kilojoule / kelvin / kilogram')>,
            'Cp_frozen': <Quantity(2.26978989, 'kilojoule / kelvin / kilogram')>,
            'MW': <Quantity(22.0817366, 'gram / mole')>,
            'Ma': 0.9999995886922161,
            'P': <Quantity(114.969023, 'bar')>,
            'Pr_eq': 0.5546528441526261,
            'Pr_frozen': 0.7233029002138603,
            'T': <Quantity(3188.938, 'kelvin')>,
            'c': <Quantity(1173.86034, 'meter / second')>,
            'gamma': 1.1475810072016763,
            'kappa_eq': <Quantity(7.44788324, 'milliwatt / centimeter / kelvin')>,
            'kappa_frozen': <Quantity(3.25478901, 'milliwatt / centimeter / kelvin')>,
            'rho': <Quantity(9.57483568, 'kilogram / meter ** 3')>,
            'vis': <Quantity(1.03718778, 'millipoise')>}}

Fortran runtime error when using "get_transport" even with throat, chamber or exit.

I tried using the example in "Standard examples", both with my setup and with Google Colaboratory.
Other than that Rocketcea is working flawlessly.
This is the code:

from rocketcea.cea_obj import CEA_Obj

ispObj = CEA_Obj( oxName='LOX', fuelName='LH2')
Cp, visc, cond, Pr = ispObj.get_Chamber_Transport(Pc=1000.0, MR=6.0)
Cp, visc, cond, Pr = ispObj.get_Chamber_Transport(Pc=1000.0, MR=6.0, frozen=1)

Cp, visc, cond, Pr = ispObj.get_Throat_Transport(Pc=1000.0, MR=6.0)
Cp, visc, cond, Pr = ispObj.get_Throat_Transport(Pc=1000.0, MR=6.0, frozen=1)

Cp, visc, cond, Pr = ispObj.get_Exit_Transport(Pc=1000.0, MR=6.0, eps=40.0)
Cp, visc, cond, Pr = ispObj.get_Exit_Transport(Pc=1000.0, MR=6.0, eps=40.0, frozen=1)

The error that I get is:

At line 5462 of file rocketcea/py_cea.f (unit = 13, file = '/usr/local/lib/python3.6/dist-packages/rocketcea/temp.scr') Fortran runtime error: End of file

constant temperature and pressure problems.

Dear author, rocketcea can use cea to calculate rocket problems. For problems such as constant temperature and pressure, adiabatic constant volume, is there any related api?

get_Throat_Transport, get_Chamber_Transport, and get_Exit_Transport functions not working

I am trying to use the get_Transport Functions and am getting an error. Not sure what is going wrong here. Here is my code:

`Opt_Rckt = CEA_Obj(oxName='98_H2O2', fuelName='RP1')

th_Cp, th_visc, th_cond, th_Pr = Opt_Rckt.get_Throat_Transport(Pc=300, MR=6)

***Attribute Error: 'CEA_Obj' object has no attribute 'get_Throat_Transport'`

Also for what its worth I am using rocketcea 1.0.9

Regards

Add products

Hello, I want to ask you. If I want to add the product, which file should I add? Thank you!

The "get_Tcomb" function not working

I really appreciate the effort and time you put into the project! This wrapper helps me a lot as I often need to calculate the specific impulse of a rocket motor, by the way, this wrapper is really awesome! Thank you!
However, when I recently calculated the combustion temperature of propellants with different chemical compositions under constant pressure, I found that the combustion temperature output by the getTcomb function does not change after changing the propellant composition, but using getFrozen_IvacCstrTc can correctly output the temperature change I need, so i want to inform you about this issue.
Here is my code:

for p in range(50, 91):
k = 5
for k in range(5, 46):
if p+k > 95:
break
j = round(100-p-k, 1)
p1 = round((p/20)*19, 1)
p2 = round((p / 20), 1)
WT0 = j
WT1 = k
WT2 = p1
WT3 = p2
card_str = """
name pbt C 37.33 H 66.73 N 24.89 O 8.48 wt%={0}
h,cal= 36728.486 t(k)=298.15 rho=1.3
name a3 C 2.4 H 4.1 O 3.1 N 1.3 wt%={1}
h,cal= -46358.545 t(k)=298.15 rho=1.38
name an N 1.0 H 4.0 N 1.0 O 3.0 wt%={2}
h,cal= -87332.284 t(k)=298.15 rho=1.725
name kn K 1.0 N 1.0 O 3.0 wt%={3}
h,cal= -118167.824 t(k)=298.15 rho=2.109
""".format(WT0, WT1, WT2, WT3)
add_new_propellant('Propellant', card_str)
C = CEA_Obj(propName="Propellant", pressure_units='bar', cstar_units='m/s', temperature_units='K', isp_units='N-s/kg')
tem = C.get_Tcomb(Pc=200)

Regards!

[Repeat Issue] Import Issue, getting DLL error.

pip install of rocketcea was successful, I think the MinGW installation was also done, couldn't find a way to verify the installation. I think successful rocketcea installation is good enough proof that MinGW installation was successful. But when i try:
from rocketcea.cea_obj import CEA_Obj
i get the following error message:

Traceback (most recent call last):
File "C:\Users\Peeyush Ramteke\AppData\Local\Programs\Python\Python38\lib\site-packages\rocketcea\cea_obj.py", line 52, in
import rocketcea.py_cea as py_cea
ImportError: DLL load failed while importing py_cea: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Peeyush Ramteke\AppData\Local\Programs\Python\Python38\lib\site-packages\rocketcea\cea_obj.py", line 60, in
import rocketcea.py_cea as py_cea
ImportError: DLL load failed while importing py_cea: The specified module could not be found.

Couldn't find a proper solution for this. Plz halp!

A question on licensing / SUA

Hi,
When I came across this package, a question arose for me: I also have an original copy of CEA, however the user agreement for the copy states that the user may not distribute the software publicly, but only internally and one must make sure to only distribute to persons that meet export control restrictions. This here is a public repository, so I am wondering how this project sticks to the NASA software user agreement. Was this consideration made?

Thanks!

Cannot Add New Propellant With cea_obj_w_units

I` have tried to add a new propellant with SI units using the cea_obj_w_units module. I keep getting an error every time. here is my code:

from rocketcea.cea_obj import CEA_Obj, add_new_propellant
from pylab import *
import numpy as np
import pandas as pd
import pdb

#create propellant card
def SRB_PropCreate(HTPB_MF, AP_MF, AL_MF):
	card_str = f"""
	fuel HTPB C 7.3165 H 10.3360 O 0.1063 wt%={HTPB_MF:.0f}
	h,cal=-295767 t(k)=298.15 rho=0.9920
	fuel Aluminum AL 1.0 wt%={AL_MF:.0f}
	h,cal=0.0	t(k)=298.15	 rho=1.48
	fuel NH4CL04(I) N 1 H 4 CL 1 O 4 	wt%={AP_MF:.0f}
	h,cal=-51880	t(k)=298.15	 rho=.0361273
	"""
	add_new_propellant(f'SRB_Ratio_HTPB{HTPB_MF:.0f}_AP{AP_MF:.0f}_AL{AL_MF:.0f}', card_str)
	name = f'SRB_Ratio_HTPB{HTPB_MF:.0f}_AP{AP_MF:.0f}_AL{AL_MF:.0f}'
	return name

name = SRB_PropCreate(HTPB_i, AP_i, AL_i)
C = CEA_Obj(propName=name, specific_heat_units='kJ/kg-K')

and here is the bug:

Invalid argument for CEA_Obj "specific_heat_units"

Thanks

Change the AP from fuel to oxidizer

I would like to thank you for the wonderful OSS project you have created.
I'm already using it practically and I really appreciate it.
It is so wonderful that I wrote an introduction blog post in my native language, Japanese. (Sorry for the Japanese)
my post: Rocket engine performance calculation with RocketCEA

I found one bug.
Because of this bug, I have to make a new card when calculating solid propellant rockets.
Please change the AP(ammonium perchlorate, NH4CLO4) from fuel to oxidizer.

Import module issue

Hi,

I have been attempting to import and run one of the examples from the rocketcea site. However I receive these errors, I'm not sure if it is a problem from my side or if there is an issue with the DLL file.

Thanks!

py script:

1 ##-----------import modules----------##
2 import numpy as np
3 import scipy
4 from scipy.integrate import odeint
5 import matplotlib.pyplot as plt
6 import CoolProp.CoolProp as clp
7 from CoolProp.CoolProp import PropsSI
8 import cantera as ct
9 import rocketcea as CEA
10 from rocketcea.cea_obj import CEA_Obj
11 ##-----------------------------------##
12
13 C = CEA.cea_obj(oxName='LOX', fuelName='LH2')
14

Output:

ImportError Traceback (most recent call last)
~\anaconda3\envs\Toolbox\lib\site-packages\rocketcea\cea_obj.py in
51 try:
---> 52 import rocketcea.py_cea as py_cea
53 except:

ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

ImportError Traceback (most recent call last)
in
8 import cantera as ct
9 import rocketcea as NASA_CEA
---> 10 from rocketcea.cea_obj_w_units import CEA_Obj
11 ##-----------------------------------##
12

~\anaconda3\envs\Toolbox\lib\site-packages\rocketcea\cea_obj_w_units.py in
4
5
----> 6 from rocketcea.cea_obj import CEA_Obj as CEA_Obj_default
7 from rocketcea.units import get_units_obj
8

~\anaconda3\envs\Toolbox\lib\site-packages\rocketcea\cea_obj.py in
58 else:
59 # go ahead and raise the error.
---> 60 import rocketcea.py_cea as py_cea
61
62

ImportError: DLL load failed: The specified module could not be found.

python setup.py build --compiler=mingw32 run error

when I run command "python setup.py build --compiler=mingw32 " in win32-py39,
error raise

INFO: Building import library (ARCH-x86): "D:\VS_code\ RocketCEA. venv\ libs\ libpython39.a"
error: [ Errno 2] No such file or directory: 'D:\VS code1\ RocketCEA\.venv\ libs\ python39. def'

get_*_Transport() functions fail in Fortran code

I found a pretty simple bug in an otherwise excellent codebase. You might want to fix it :)
Running this code to get some transport properties

import rocketcea.cea_obj

cea = rocketcea.cea_obj.CEA_Obj(propName='C2H5OH', oxName='LO2', makeOutput=0, make_debug_prints=True)
transport = cea.get_Chamber_Transport(Pc=300, MR=1.3)
print(transport)

gives this error

At line 5462 of file rocketcea/py_cea.f (unit = 13, file = '~/RocketCEA/temp.dat')
Fortran runtime error: End of file

I bet this has to do with the debug message

NOTE: transport properties require re-reading data read.

Note that I did find a fix: just write

makeOutput=1

and it will work. If you set this option back to makeOutput=0, it seems to keep using the old output file from previous makeOutput=1 runs.

Function get_eps_at_PcOvPe fails in a frozen condition

I'm getting errors in frozen ivac because the input is only epsilon and get_eps_at_PcOvPe function works only in equilibrium conditions.
I can't also get gamma at the exit because the main input is always epsilon so I'm not able to use it to evaluate by hand the expansion ratio using the isentropic relations.

CEA Returning Zero Values in Example

CEA is returning zero whenever I call a function. For example:

from rocketcea.cea_obj import CEA_Obj
C = CEA_Obj( oxName='LOX', fuelName='LH2')
for mr in range(2,9):
    print(mr, C.get_Isp(Pc=100.0, MR=mr, eps=40.0) )

has been returning me:
2 0.0
3 0.0
4 0.0
5 0.0
6 0.0
7 0.0
8 0.0

Can anyone help? Thank you

get_Entropies doesn't work

get_Entropies doesn't work. And does this library have a function for calculating molecular weight and recording the answer in a table?

Unable to install RocketCEA, Ubuntu

Apologies, it is me again. I've been setting up a new linux computer with RocketCEA and just can't seem to get an install working.
For Ubuntu 22.04.4, 24.04, I tried fresh installs;

sudo apt update && upgrade
sudo apt install gfortran

# now for python:
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python3.11-venv

# make a virtual environment and activate it
python3.11 -m venv .venv
source .venv/bin/activate

I've also tried Python 3.10, 3.12, but get similar errors. Install procedure used:

# with .venv active:
python -m pip install --no-cache-dir numpy
python -m pip install --no-cache-dir scipy
# below line gets rocketcea==1.2.0
python -m pip install --no-cache-dir rocketcea

For RocketCEA 1.2.0 I get a metedata-generation-failed error (same error with and without the --prefer-binary flag):

$ python -m pip install --no-cache-dir --prefer-binary rocketcea==1.2.0
Collecting rocketcea==1.2.0
  Downloading rocketcea-1.2.0.tar.gz (70.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.1/70.1 MB 4.0 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [23 lines of output]
      + meson setup /tmp/pip-install-stqj0oab/rocketcea_306ec733ebc3470ca1e79d5442c7bc6f /tmp/pip-install-stqj0oab/rocketcea_306ec733ebc3470ca1e79d5442c7bc6f/.mesonpy-iom_fzhb -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/tmp/pip-install-stqj0oab/rocketcea_306ec733ebc3470ca1e79d5442c7bc6f/.mesonpy-iom_fzhb/meson-python-native-file.ini
      The Meson build system
      Version: 1.4.1
      Source dir: /tmp/pip-install-stqj0oab/rocketcea_306ec733ebc3470ca1e79d5442c7bc6f
      Build dir: /tmp/pip-install-stqj0oab/rocketcea_306ec733ebc3470ca1e79d5442c7bc6f/.mesonpy-iom_fzhb
      Build type: native build
      Project name: rocketcea
      Project version: undefined
      C compiler for the host machine: cc (gcc 11.4.0 "cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0")
      C linker for the host machine: cc ld.bfd 2.38
      Host machine cpu family: x86_64
      Host machine cpu: x86_64
      ../meson.build:5: WARNING: add_languages is missing native:, assuming languages are wanted for both host and build.
      Fortran compiler for the host machine: gfortran (gcc 11.4.0 "GNU Fortran (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0")
      Fortran linker for the host machine: gfortran ld.bfd 2.38
      Program python found: YES (/home/thruster-testing/code/star_forge/.venv/bin/python)
      Did not find pkg-config by name 'pkg-config'
      Found pkg-config: NO
      Run-time dependency python found: NO (tried pkgconfig, pkgconfig and sysconfig)
      
      ../meson.build:9:12: ERROR: Python dependency not found
      
      A full log can be found at /tmp/pip-install-stqj0oab/rocketcea_306ec733ebc3470ca1e79d5442c7bc6f/.mesonpy-iom_fzhb/meson-logs/meson-log.txt
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

$ python -m pip list
Package    Version
---------- -------
numpy      1.26.4
pip        24.0
pkgconfig  1.5.5
scipy      1.13.1
setuptools 65.5.0

I tried to get the output of the meson-log.txt mentioned above, but got this:

$ cat /tmp/pip-install-ku7_yu5s/rocketcea_58ee29b7b754404faece625638d1edf5/.mesonpy-6kpar0ib/meson-logs/meson-log.txt
cat: /tmp/pip-install-ku7_yu5s/rocketcea_58ee29b7b754404faece625638d1edf5/.mesonpy-6kpar0ib/meson-logs/meson-log.txt: No such file or directory

For RocketCEA 1.1.34 I get a ModuleNotFoundError (same error with and without the --prefer-binary flag):

$ python -m pip install --no-cache-dir --prefer-binary rocketcea==1.1.34
Collecting rocketcea==1.1.34
  Downloading rocketcea-1.1.34.tar.gz (38.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 38.5/38.5 MB 9.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error
  
  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      Traceback (most recent call last):
        File "/home/thruster-testing/code/star_forge/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/thruster-testing/code/star_forge/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/thruster-testing/code/star_forge/.venv/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-xkw9ckog/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-xkw9ckog/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-xkw9ckog/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "/tmp/pip-build-env-xkw9ckog/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 21, in <module>
      ModuleNotFoundError: No module named 'numpy'
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

$ python -m pip list
Package    Version
---------- -------
numpy      1.26.4
pip        24.0
pkgconfig  1.5.5
scipy      1.13.1
setuptools 65.5.0

I am a bit stumped as to how to get around this, as I recently tested the exact above setup, on a different computer, with no issues.
Kind of ran out of time for further testing on this today, but might see if it is something hardware related and test on another laptop.

It seems that rocketcea is having trouble finding dependencies, but I have no issues installing all of my other required packages.

test suite errors

Hi. I maintain a rocketcea package for Debian GNU/Linux, which has been at version 1.1.18 for too long. Updating to 1.1.29, however, is throwing a large number of test errors. I'll attach the build log. Any thoughts you have about what might be going wrong before I start investing debugging time would be greatly appreciated!

rocketcea_1.1.29+dfsg-1_amd64.build.txt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.