homebrew-core/Formula/cantera.rb
Richard West 356b4af0ff New formula: Cantera 1.8
Cantera is a suite of object-oriented software tools for problems involving
chemical kinetics, thermodynamics, and/or transport processes.

This formula gets the 1.8.0-beta source from the google code site,
http://code.google.com/p/cantera/ and builds it the way I want it: 64-bit
architecture with the full python package and numpy.

A simple 'brew install cantera' gives me:
/usr/local/Cellar/cantera/1.8.0b: 668 files, 30M, built in 5.5 minutes

I can then do the following demo (using a homebrew python) which uses the
GRI-Mech 3.0 kinetic model to find the equilibrium composition of a
stoichiometric mixture of methane and air at 1000 Kelvin and 1 atmosphere:

macbookpro:~ rwest$ python
Python 2.7 (r27:82500, Aug 16 2010, 14:45:41)
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Cantera
>>> g=Cantera.GRI30()
>>> g.set(X='CH4:1, O2:2, N2:8', T=1000, P=Cantera.OneAtm)
>>> g.equilibrate('TP')
>>> g

  gri30:

       temperature            1000  K
          pressure          101325  Pa
           density        0.336957  kg/m^3
  mean mol. weight         27.6498  amu

                          1 kg            1 kmol
                       -----------      ------------
          enthalpy    -2.03847e+06       -5.636e+07     J
   internal energy    -2.33917e+06       -6.468e+07     J
           entropy          8643.6         2.39e+05     J/K
    Gibbs function    -1.06821e+07       -2.954e+08     J
 heat capacity c_p         1311.88        3.627e+04     J/K
 heat capacity c_v         1011.18        2.796e+04     J/K

                           X                 Y          Chem. Pot. / RT
                     -------------     ------------     ------------
                H2    7.61286e-08      5.55034e-09         -33.8964
                 H    6.26175e-13      2.28264e-14         -16.9482
                 O    3.28152e-14      1.89883e-14         -21.7574
                O2     4.3563e-08      5.04148e-08         -43.5148
                OH    3.30789e-09      2.03467e-09         -38.7056
               H2O       0.181818         0.118464         -55.6538
               HO2    1.22441e-14      1.46163e-14          -60.463
              H2O2     1.0757e-13      1.32332e-13         -77.4112
                 C    2.27652e-44      9.88915e-45         -34.5822
                CH    5.81653e-44      2.73871e-44         -51.5304
               CH2    8.38153e-40      4.25199e-40         -68.4786
            CH2(S)    4.46855e-42      2.26692e-42         -68.4786
               CH3    3.45038e-34      1.87617e-34         -85.4268
               CH4    2.42853e-30      1.40906e-30         -102.375
                CO     2.6519e-08      2.68649e-08         -56.3396
               CO2      0.0909091         0.144698         -78.0969
               HCO     5.1743e-22       5.4304e-22         -73.2878
              CH2O    1.12139e-21      1.21778e-21         -90.2359
             CH2OH    3.08627e-32      3.46403e-32         -107.184
              CH3O    7.46237e-35      8.37578e-35         -107.184
             CH3OH    4.44146e-30      5.14701e-30         -124.132
               C2H    2.34749e-55      2.12506e-55         -86.1125
              C2H2      1.673e-45      1.57547e-45         -103.061
              C2H3    8.12731e-55      7.94977e-55         -120.009
              C2H4    6.60022e-50      6.69664e-50         -136.957
              C2H5    4.98569e-59      5.24027e-59         -153.905
              C2H6    1.36667e-56      1.48628e-56         -170.854
              HCCO    1.87989e-42      2.78955e-42          -107.87
             CH2CO    4.03465e-38      6.13407e-38         -124.818
             HCCOH     6.9093e-45      1.05045e-44         -124.818
                 N    2.53717e-22      1.28527e-22         -12.5845
                NH    5.98875e-22      3.25207e-22         -29.5327
               NH2    8.37524e-20      4.85331e-20         -46.4809
               NH3    1.04731e-14      6.45078e-15         -63.4291
               NNH    2.69259e-19      2.82616e-19         -42.1172
                NO    1.37659e-08      1.49391e-08         -34.3419
               NO2    3.38433e-13      5.63106e-13         -56.0993
               N2O    1.09383e-12      1.74115e-12         -46.9264
               HNO    5.09799e-16      5.71828e-16         -51.2901
                CN    9.63391e-33      9.06525e-33         -47.1667
               HCN    8.91222e-24      8.71104e-24         -64.1149
              H2CN    6.76004e-36      6.85387e-36          -81.063
              HCNN    1.39332e-43       2.0677e-43         -76.6993
              HCNO    8.54635e-33      1.32987e-32         -85.8722
              HOCN    2.37596e-23      3.69716e-23         -85.8722
              HNCO    7.70146e-18       1.1984e-17         -85.8722
               NCO    3.47359e-24      5.27852e-24          -68.924
                N2       0.727273         0.736838          -25.169
                AR              0                0
              C3H7    9.64128e-85      1.50247e-84         -222.384
              C3H8    2.79983e-82      4.46523e-82         -239.332
            CH2CHO    8.72194e-48      1.35783e-47         -141.766
            CH3CHO    3.16573e-45      5.04381e-45         -158.715
>>>

Signed-off-by: David Höppner <0xffea@gmail.com>

* use snow_leopard_64?
* remove version
2010-09-01 11:39:33 +02:00

162 lines
6.4 KiB
Ruby

require 'formula'
class Cantera <Formula
url 'http://cantera.googlecode.com/files/cantera-1.8.0-beta.tar.gz'
homepage 'http://code.google.com/p/cantera/'
md5 '53d923922535c64b7e6b9f07bbfcf866'
head 'http://cantera.googlecode.com/svn/cantera18/trunk/'
depends_on 'numpy' => :python
depends_on 'graphviz' # for the reaction flux diagrams
def patches
# fixes the Makefiles in Cantera/cxx/demos/ that have broken install commands
DATA
end
def install
if snow_leopard_64?
# There is probably a better way to do this, but this seems to work for my purposes:
ENV['CFLAGS'] += " -arch x86_64"
ENV['CXX_OPT'] = "-arch x86_64"
ENV['ARCHFLAGS'] = "-arch x86_64"
# Maybe this does all that's needed?
ENV['BITCOMPILE'] = '64'
buildname = "x86_64-apple-darwin"
else
buildname = nil # let autoconf guess
end
# These are the Cantera settings that I want:
ENV['DEBUG_MODE'] = 'y'
ENV['PYTHON_PACKAGE'] = "full"
ENV['USE_NUMPY'] = "y"
ENV['BUILD_MATLAB_TOOLBOX'] = 'n'
ENV['WITH_PRIME'] = 'y'
ENV['WITH_H298MODIFY_CAPABILITY'] = 'y'
ENV['WITH_VCSNONIDEAL'] = 'y'
ENV['ARCHIVE'] = "libtool -static -o"
# I'm not entirely sure that this is required,
# but it doesn't seem to hurt and I used to need something like it:
ENV['NUMPY_INC_DIR'] = `python -c "from numpy import get_include; print get_include()"`.strip
# The Makefile doesn't like to run in parallel
ENV.deparallelize
# Put the manuals in the right place
inreplace 'configure', 'ct_mandir=${prefix}', "ct_mandir=#{man}"
system "./preconfig", "--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--mandir=#{man}",
(buildname ? "--build=#{buildname}" : "")
system "make"
system "make install"
end
def caveats; <<-EOS
The license, demos, tutorials, data, etc. can be found in:
#{prefix}
Try the following in python to find the equilibrium composition of a
stoichiometric methane/air mixture at 1000 K and 1 atm:
>>> import Cantera
>>> g=Cantera.GRI30()
>>> g.set(X='CH4:1, O2:2, N2:8', T=1000, P=Cantera.OneAtm)
>>> g.equilibrate('TP')
>>> g
EOS
end
end
__END__
diff --git a/Cantera/cxx/demos/Makefile.in b/Cantera/cxx/demos/Makefile.in
index acd0a0b..554dd54 100644
--- a/Cantera/cxx/demos/Makefile.in
+++ b/Cantera/cxx/demos/Makefile.in
@@ -19,7 +19,7 @@ test:
install:
@INSTALL@ -d @ct_demodir@/cxx
- @INSTALL@ Makefile -m ug+rw,o+r @ct_demodir@/cxx
+ @INSTALL@ -m ug+rw,o+r Makefile @ct_demodir@/cxx
cd combustor; @MAKE@ install
cd flamespeed; @MAKE@ install
cd kinetics1; @MAKE@ install
diff --git a/Cantera/cxx/demos/NASA_coeffs/Makefile.in b/Cantera/cxx/demos/NASA_coeffs/Makefile.in
index 4038fa2..4ccc46d 100644
--- a/Cantera/cxx/demos/NASA_coeffs/Makefile.in
+++ b/Cantera/cxx/demos/NASA_coeffs/Makefile.in
@@ -89,8 +89,8 @@ install:
@INSTALL@ -d $(INSTALL_DIR)
@INSTALL@ -c -m ug+rw,o+r Makefile.install $(INSTALL_DIR)/Makefile
@(for ihhh in *.cpp *blessed* ; do \
- @INSTALL@ $${ihhh} -m ug+rw,o+r $(INSTALL_DIR) ; \
- echo "@INSTALL@ $${ihhh} -m ug+rw,o+r $(INSTALL_DIR)" ; \
+ @INSTALL@ -m ug+rw,o+r $${ihhh} $(INSTALL_DIR) ; \
+ echo "@INSTALL@ -m ug+rw,o+r $${ihhh} $(INSTALL_DIR)" ; \
done )
@INSTALL@ runtest $(INSTALL_DIR) ;
diff --git a/Cantera/cxx/demos/combustor/Makefile.in b/Cantera/cxx/demos/combustor/Makefile.in
index 1a46070..d603a7f 100644
--- a/Cantera/cxx/demos/combustor/Makefile.in
+++ b/Cantera/cxx/demos/combustor/Makefile.in
@@ -88,8 +88,8 @@ install:
@INSTALL@ -d $(INSTALL_DIR)
@INSTALL@ -c -m ug+rw,o+r Makefile.install $(INSTALL_DIR)/Makefile
@(for ihhh in *.cpp *blessed* ; do \
- @INSTALL@ $${ihhh} -m ug+rw,o+r $(INSTALL_DIR) ; \
- echo "@INSTALL@ $${ihhh} -m ug+rw,o+r $(INSTALL_DIR)" ; \
+ @INSTALL@ -m ug+rw,o+r $${ihhh} $(INSTALL_DIR) ; \
+ echo "@INSTALL@ -m ug+rw,o+r $${ihhh} $(INSTALL_DIR)" ; \
done )
@INSTALL@ runtest $(INSTALL_DIR) ;
diff --git a/Cantera/cxx/demos/flamespeed/Makefile.in b/Cantera/cxx/demos/flamespeed/Makefile.in
index b55941e..10828a4 100644
--- a/Cantera/cxx/demos/flamespeed/Makefile.in
+++ b/Cantera/cxx/demos/flamespeed/Makefile.in
@@ -89,8 +89,8 @@ install:
@INSTALL@ -d $(INSTALL_DIR)
@INSTALL@ -c -m ug+rw,o+r Makefile.install $(INSTALL_DIR)/Makefile
@(for ihhh in *.cpp *blessed* ; do \
- @INSTALL@ $${ihhh} -m ug+rw,o+r $(INSTALL_DIR) ; \
- echo "@INSTALL@ $${ihhh} -m ug+rw,o+r $(INSTALL_DIR)" ; \
+ @INSTALL@ -m ug+rw,o+r $${ihhh} $(INSTALL_DIR) ; \
+ echo "@INSTALL@ -m ug+rw,o+r $${ihhh} $(INSTALL_DIR)" ; \
done )
@INSTALL@ runtest $(INSTALL_DIR) ;
diff --git a/Cantera/cxx/demos/kinetics1/Makefile.in b/Cantera/cxx/demos/kinetics1/Makefile.in
index 336a2eb..ac5c891 100644
--- a/Cantera/cxx/demos/kinetics1/Makefile.in
+++ b/Cantera/cxx/demos/kinetics1/Makefile.in
@@ -89,8 +89,8 @@ install:
@INSTALL@ -d $(INSTALL_DIR)
@INSTALL@ -c -m ug+rw,o+r Makefile.install $(INSTALL_DIR)/Makefile
@(for ihhh in *.cpp *.h *blessed* ; do \
- @INSTALL@ $${ihhh} -m ug+rw,o+r $(INSTALL_DIR) ; \
- echo "@INSTALL@ $${ihhh} -m ug+rw,o+r $(INSTALL_DIR)" ; \
+ @INSTALL@ -m ug+rw,o+r $${ihhh} $(INSTALL_DIR) ; \
+ echo "@INSTALL@ -m ug+rw,o+r $${ihhh} $(INSTALL_DIR)" ; \
done )
@INSTALL@ runtest $(INSTALL_DIR) ;
diff --git a/Cantera/cxx/demos/rankine/Makefile.in b/Cantera/cxx/demos/rankine/Makefile.in
index 05d776a..0892cdc 100644
--- a/Cantera/cxx/demos/rankine/Makefile.in
+++ b/Cantera/cxx/demos/rankine/Makefile.in
@@ -89,8 +89,8 @@ install:
@INSTALL@ -d $(INSTALL_DIR)
@INSTALL@ -c -m ug+rw,o+r Makefile.install $(INSTALL_DIR)/Makefile
@(for ihhh in *.cpp *blessed* ; do \
- @INSTALL@ $${ihhh} -m ug+rw,o+r $(INSTALL_DIR) ; \
- echo "@INSTALL@ $${ihhh} -m ug+rw,o+r $(INSTALL_DIR)" ; \
+ @INSTALL@ -m ug+rw,o+r $${ihhh} $(INSTALL_DIR) ; \
+ echo "@INSTALL@ -m ug+rw,o+r $${ihhh} $(INSTALL_DIR)" ; \
done )
@INSTALL@ runtest $(INSTALL_DIR) ;