Where can I find Canetera.mak for Cantera installation with anaconda2

188 views
Skip to first unread message

Reza Kholghy

unread,
Apr 11, 2018, 7:58:36 AM4/11/18
to Cantera Users' Group
Greetings, 

 I installed Cantera 2.3.0 with a Conda on a LInix system with Ubuntu 16.04 with the following command:

conda install -c cantera cantera

Now the cantera folder is located in the following path and I checked to make sure that this python is the default one used on my machine

/home/username/anaconda2/lib/python2.7/site-packages/cantera

However, there is not "samples" subdirectory here and I cannot find Cantera.mak file needed for MakeFile. 

Am I missing something?

Thanks, 

Reza

Bryan W. Weber

unread,
Apr 11, 2018, 9:02:26 AM4/11/18
to Cantera Users' Group
Hi Reza,

The conda package only installs the Python package and it's included examples (found in /path/to/anaconda/env/lib/pythonX.Y/site-packages/examples). If you want C++ samples and the associated Makefiles, you'll have to build the Cantera interface yourself or install using the Ubuntu packages available from our PPA: http://cantera.org/docs/sphinx/html/install.html#ubuntu

Best,
Bryan

Reza Kholghy

unread,
Apr 11, 2018, 5:40:47 PM4/11/18
to Cantera Users' Group
Hi Bryan, 

 Thanks for the answer. I also installed Cantera with the Ubuntu packages. But when I try to compile a simple code, I get the following error, the source code and Makefile are attached. 

question: If I want to use Cantera in my own C++ codes, should I follow the instructions on your page for compiling Cantera from its source codes?

reza@Office:~/Desktop$ make -f MakeFile1
gcc   combustor.o  -pthread -L/usr/lib -lcantera  -lsundials_cvodes -lsundials_ida -lsundials_nvecserial -llapack -lblas -o combustor
/usr/lib/libcantera.a(ct2ctml.os): In function `Cantera::call_ctml_writer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)':
(.text+0x255c): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/bin/ld: /usr/lib/libcantera.a(RedlichKwongMFTP.os): undefined reference to symbol 'cos@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
<builtin>: recipe for target 'combustor' failed
make: *** [combustor] Error 1
MakeFile.dms
combustor.cpp

Bryan W. Weber

unread,
Apr 11, 2018, 9:27:02 PM4/11/18
to Cantera Users' Group
No, please do not follow the instructions on that webpage, it is at least 4 years out of date. Follow the instructions in the documentation: http://cantera.org/docs/sphinx/html/compiling/index.html

Best,
Bryan

Reza Kholghy

unread,
Apr 17, 2018, 9:56:05 AM4/17/18
to Cantera Users' Group
Bryan, 
 
So I downloaded cantera from git with "git clone --recursive https://github.com/Cantera/cantera.git", now cantera folder is in my home directory "/home/reza/cantera". After installing all the required packages for Ubuntu explained here "http://cantera.org/docs/sphinx/html/compiling/installation-reqs.html#linux" scons build gives me errors related to compiling Cython. "cantera.conf", "config.log" the output of scons build and pip list are attached. Any clue why I get that error when I try scans build?

THanks, 

Reza
cantera.conf
buildlog.txt
piplist.txt
config.log

Nick Curtis

unread,
Apr 17, 2018, 10:40:40 AM4/17/18
to Cantera Users' Group
Reza, this is a bug that occured with the update to Cython 0.26, you can either:

a) downgrade your Cython installation, or
b) checkout a newer version of Cantera -- there hasn't been an official release since then, so you probably just want the latest commit on the master branch

Nick

Reza Kholghy

unread,
Apr 17, 2018, 10:49:22 AM4/17/18
to Cantera Users' Group
Nick, 

 Thanks for the comment. By following Cantera installation instructions at "https://www.cantera.org/docs/sphinx/html/install.html#ubuntu" I could install it, compile and run a simple C++ code "https://www.cantera.org/docs/sphinx/html/cxx-guide/simple-example.html". Is it enough to start developing my code or I should be able to build and install it with scons? I am asking it as I need to expand the  onedim subroutine to include additional transport equations. 

Thanks, 
Reza 

Nick Curtis

unread,
Apr 17, 2018, 10:54:34 AM4/17/18
to Cantera Users' Group
Reza,

If you want to modify Cantera's source-code, which given your goal of implementing new transport equations for 1D-Flames you will likely have to do, you will need to be able to build your modified version with SCons.

Nick

Reza Kholghy

unread,
Apr 17, 2018, 11:15:21 AM4/17/18
to Cantera Users' Group
Nick, 

 I downgraded Cython to 0.23 version and I could install cantera and scone test was successful. But now I am a little bit confused about the best way to develop my code: 

Lets say I need to solve for additional transport equation for a 1D flame (premixed or counterflow diffusion)

1. Should I implement the transport equation in OneDim.h by creating a derived class inheriting from the existing StFlow class, then rebuild and install again with icons?
2. or have a separate C++ code, get the parameters of interest from Cantera and integrate my differential equations. I guess coupling (giving back information to Cantera) would not be possible this way)?

THanks, 

Reza

Nick Curtis

unread,
Apr 17, 2018, 12:19:20 PM4/17/18
to Cantera Users' Group
Reza,

Both options are possible, so let's go over the advantages / disadvantages:

1.  This is the more general option, and if you're of the mind to contribute your code back to Cantera this is the path.  It is also possible that Option 2 will be difficult or annoying to implement in practice, for example imagine you had some minor change in how the the fixed temperature is interpolated in the routine setFixedTemperature.  You could, of course, write your own (largely identical) function, make minor changes and compile it separately / run, but your code might become out of date in future releases (e.g., what if the function signature changed?).  A better way might be to move the current code to some InterpolationObject, and have your code simply override that object.  Note in this case that an scons build / install is necessary for your source code changes to migrate to the installed version of Cantera.

2.  This is also possible, but as you note there are certainly some potential difficulties out there.  Mainly, you are force to work within the bounds of what already exists in Cantera's source code.  As I outlined in the last case, that can often be annoying (and sometimes, make the changes you need very difficult, inefficient or even impossible to work through).  

What I would recommend is a combination of both approaches -- as you build your transport model, you will likely find places where your would be made life easier if only thing X was allowed, or more efficient if you could easily overload how some operation was calculated.  So when you get there, build in your modifications, and finally when you've built your new transport model contributing it back to Cantera will be a much simpler process (if you are inclined to do so that is!)

Best,
Nick

Reza Kholghy

unread,
Apr 17, 2018, 2:59:18 PM4/17/18
to Cantera Users' Group
Nick, 

 Thanks for the detailed advice. I am actually interested to contribute the code to Cantera and I think the first option would be a better one.

I am developing a population balance model to simulate soot formation and after validating particle dynamic equations in MATLAB for some time, now I am ready to implement them in Cantera.

Reza

Bryan W. Weber

unread,
Apr 17, 2018, 4:10:31 PM4/17/18
to Cantera Users' Group
Reza,

If you're going to add new capabilities to Cantera, we would request that you make any changes relative to the most recent commit on the master branch. (I'm a little confused how you got that error if you just cloned Cantera today, since a fix has already been included in the master branch.) Please also see the contributing guide for Cantera: https://github.com/Cantera/cantera/blob/master/CONTRIBUTING.md

Best,
Bryan
Reply all
Reply to author
Forward
0 new messages