Fortran 90

367 views
Skip to first unread message

Felipe Abrão

unread,
Nov 22, 2009, 7:40:20 AM11/22/09
to Cantera User's Group
Hello!

I downloaded Cantera, but I don't know how to link it with Fortran 90.
I must set the path, in order to Fortran "see" it. Can anybody help
me, please? Thank you!

ann

unread,
Nov 24, 2009, 9:21:59 AM11/24/09
to Cantera User's Group
Hi,

I manage somehow to install cantera and run the examples - in the
last month.

In order to use a specific fortran compiler you need:

1 To have the compiler installed somewhere on your computer
2 In preconfig (open it with a text editor; gedit kate) you need to
set
the path to your fortran compiler

afterwards run
./preconfig
make
make install

in peconfig file you can switch on/off several options for cantera
and also you can set the installation path

Best regards
ann

ann

unread,
Nov 24, 2009, 9:36:44 AM11/24/09
to Cantera User's Group
To set the path:

if you are in linux:

with "which gfortran" you can find out the path of your compiler, but
the best way is to set the command:

in my preconfig it looks like this:

# The Fortran 90/95 compiler. If set to "default", the script will
# look for a Fortran 90/95 compiler on your system by the name of
# "f95", "gfortran", or "g95".
F90=${F90:="gfortran"}

Felipe Abrão

unread,
Nov 28, 2009, 8:07:09 AM11/28/09
to Cantera User's Group
Hi, Ann!

Thank you for your help. Unfortunately I am not very good with
computers, so I could not do what you suggested. I opened the file
"preconfig" with Word, and could read many informations about Fortran.
Should I switch the options in the Word document?! For example, it is
written in the original file:

"BUILD_F90_INTERFACE=${BUILD_F90_INTERFACE:="no"}"

If I change "no" by "y", and then save the Word document, is it going
to make any difference? I am sorry, but I really do not know much
about computing! Thank you very much!

Best regards,

Felipe

Felipe Abrão

unread,
Nov 28, 2009, 8:14:35 AM11/28/09
to Cantera User's Group
Hi, Ann!

Thank you for your help. Unfortunately I am not very good with
computers, so I could not do what you suggested. I opened the file
"preconfig" with Word, and could read many informations about Fortran.
Should I switch the options in the Word document?! For example, it is
written in the original file:

"BUILD_F90_INTERFACE=${BUILD_F90_INTERFACE:="no"}"

If I change "no" by "y", and then save the Word document, is it going
to make any difference? I am sorry, but I really do not know much
about computing! Thank you very much!

Best regards,

Felipe

On 24 nov, 12:36, ann <annelieju...@yahoo.de> wrote:

emil

unread,
Nov 29, 2009, 1:45:43 PM11/29/09
to Cantera User's Group
Hello Felipe,

It would be useful to have more information:
Computer (PC, processors)
Operating System (Windows, Linux) which version
Do you have a Fortan Compiler installed? If yes which one and where?

I think ann is talking about a Linux install, you are talking about a
Windows install.
Sincerly,
emil

Felipe Abrão

unread,
Dec 3, 2009, 5:16:49 AM12/3/09
to Cantera User's Group
Hello, Emil,

here are some informations about my computer and operating system:
Microsoft Windows XP Professional, version 2002, service pack 3; AMD
Athlon (tm) Dual Core, processor 5400B, 2.81 GHz, 1.93 GB RAM. I have
a Fortran compiler installed (Visual Fortran 6.0): C:\Documents and
Settings\All Users\Menu Iniciar\Programas\Visual Fortran 6.0. If you
need more information, please tell me. Thank you very much!

Sincerely,

Felipe

manoj kumar

unread,
Dec 4, 2009, 12:16:15 AM12/4/09
to canter...@googlegroups.com
is it possible to create a reduced reaction mechanism from a parent
reaction mechanism using cantera
manu

emil

unread,
Dec 4, 2009, 7:45:12 AM12/4/09
to Cantera User's Group
Hello Felipe,

I guess you had Cantera installed from the msi installer file from
sourceforge.
I did the same on my win-XP machine and found that there are some
files missing which are in the Linux tarball, at least I didn't find
them.

I tried to follow the documentation in the f77.pdf from Dr. Goodwin.
Do you have the files demo_ftnlib.cpp, demo.f demo.mak ?

If not I suggest the following:

Download the 1.7.1 Sourcecode from here:
http://sourceforge.net/projects/cantera/files/cantera/1.7/Cantera-1.7.0-src.zip/download

Unzip it and then look for the directory
\cantera-1.7.0\tools\templates\f77

there is also a README_WIN32.txt in this directory with more detailed
instructions how to compile and run the demo. It says the demo should
work with your Compiler.

I have not used Cantera with Fortran myself and I do not have a copy
of Visual Fortran 6.0. However I
downloaded the GNU compiler gfortran, maybe I can get that to work for
me too. Please report back on your experience.

Regards
Emil

emil

unread,
Dec 4, 2009, 7:29:15 AM12/4/09
to Cantera User's Group
Hi Manu,

I don't know
Have you looked at the old yahoo cantera Usergroup?
If you find out how it is done would you post it here?
regards
Emil

Richard West

unread,
Dec 4, 2009, 11:27:32 AM12/4/09
to canter...@googlegroups.com
I think this is not a built-in feature, but Cantera could certainly be
a useful tool.
One simple way to approach this using Cantera may be something like
the following:

1) Create a simulation at the conditions you are interested in, using
the full mechanism. Save the results. (Specifically, save T, P and
Mass Fractions in a comma separated text file, which can be imported
to MixMaster)

2) Use MixMaster to visualise flux diagrams showing you the important
pathways at the conditions of your simulation.

3) Remove from the mechanism file the reactions and species that seem
unimportant.

4) Repeat the simulation with the reduced mechanism and check the
results are similar.

5) Compare the reduced and full mechanisms at different simulation
conditions to see how robust the reduced mechanism is.


This is a rather naive and laborious way to do it - you'd be better
off using sensitivity analysis etc., but it's a start. Has anyone out
there written a script built on Cantera to do it automatically?

francisco posada

unread,
Dec 4, 2009, 12:28:38 PM12/4/09
to canter...@googlegroups.com
Sorry to interrupt, but what is Mixmaster? is a cantera based software? freeware?

 Thanks!


--

You received this message because you are subscribed to the Google Groups "Cantera User's Group" group.
To post to this group, send email to canter...@googlegroups.com.
To unsubscribe from this group, send email to cantera-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cantera-users?hl=en.



Richard West

unread,
Dec 4, 2009, 1:19:14 PM12/4/09
to canter...@googlegroups.com
MixMaster is a standalone application, written in python, that comes
free with Cantera.

If you can't find the right thing to double-click, try this in a
python shell (i.e. having typed "python" on a command line):

from MixMaster import MixMaster
MixMaster()


There appears to be an introduction / instructions at
http://www.aresinstitute.org/Cantera/mixmaster.pdf

Rodolfo Rodrigues

unread,
Dec 4, 2009, 12:44:23 PM12/4/09
to canter...@googlegroups.com

Hi Francisco,

MixMaster is a python GUI to cantera's calculations. It's very practical for fast/simple problems.

[]'s
Rodolfo

Felipe Abrão

unread,
Dec 5, 2009, 7:26:26 AM12/5/09
to Cantera User's Group
Hello, Emil,

thank you very much for you help. I checked Cantera, and I could see
that I do have the files you mentioned. I use Fortran 90, and simply
can not run any example program that comes with Cantera that I
downloaded. The first message that appears, after I compile any
program (demo.f90, for example) is: "Could not find the file
cantera.mod.". I do not know what else I can do. Anyway, thank you
once more.

Sincerely,

Felipe

On 4 dez, 10:45, emil <emil.widm...@gmail.com> wrote:
> Hello Felipe,
>
> I guess you had Cantera installed from the msi installer file from
> sourceforge.
> I did the same on my win-XP machine and found that there are some
> files missing which are in the Linux tarball, at least I didn't find
> them.
>
> I tried to follow the documentation in the f77.pdf from Dr. Goodwin.
> Do you have the files demo_ftnlib.cpp, demo.f demo.mak ?
>
> If not I suggest the following:
>
> Download the 1.7.1 Sourcecode from here:http://sourceforge.net/projects/cantera/files/cantera/1.7/Cantera-1.7...

emil

unread,
Dec 5, 2009, 11:52:58 AM12/5/09
to Cantera User's Group
Hi Felipe,

OK I have the same error as you, missing cantera.mod in my Windows
Installation.
In the Linux installation cantera.mod is in the include/cantera
directory, and it is possible to compile.

My guess is, that the cantera.mod is not included in the Windows msi
installer.
You could compile Cantera for Windows from source, there is a
presentation about it on sourceforge.
Maybe you could get somebody to help from your local computer dep to
help you?

Regards
Emil

emil

unread,
Dec 5, 2009, 7:58:07 AM12/5/09
to Cantera User's Group
Hello Felipe,

Did you follow the instructions in the README_win32.txt for compiling
the
demo?
it should be in the cantera-1.7.0/tools/templates/f77 folder. It
reads:

-------
CVF/VC++ 6.0 Build Procedure
============================

This demo program can be built on a PC using Compaq Visual Fortran 6.0
and Microsoft Visual C++ 6.0, which share a common development
environment (Visual Studio). To build it, open project file
f77demo.dsp in Visual Studio by double-clicking its icon. Build the
project, and then run it.

To modify this project file to build your own Fortran 77 application,
make a copy with a different name, open the copy in Visual Studio,
delete file demo.f and replace it with your Fortran program. If you
need to change demo_ftnlib.cpp, then also replace it with your
modified version.

Note that the include and library directories are specified relative
to the location of the project file. If you move it to another
directory, you will need to update these locations under 'Settings'.
----

So if you open the Project file, Visual Fortran should open and it
should set the correct paths.

Hope the helps,
if it is succesfull you could study the flags and paths that are set
in the compiler. You should then be able to figure out how to set them
to compile from other directories.
Emil

Felipe Abrão

unread,
Dec 6, 2009, 7:35:05 AM12/6/09
to Cantera User's Group
Hi, Emil!

Thank you again for your help.

Best wishes,

Felipe

emil

unread,
Dec 6, 2009, 3:21:09 PM12/6/09
to Cantera User's Group
Hello Felipe,

I looked into the Cantera - Fortran Interface and I frankly have to
admit I had a hard time there. Until now I have not completly resolved
everything.
First I thought it is a bit over my head and I am just to dumb to make
it work.
Actually now I think the code is buggy and documentation is scarce,
confusing, outdated and consequently mis-leading and even plainly
wrong in some cases (no offense intended in any direction).

In your case I saw that you tried to get this to work for quite some
time now, you had also some rather old posts on the
fortran usergroup about this!

What I understood so far is, that you have installed the cantera.msi,
but also have the cantera source code.
You have Compaq Visual Fortran 6.0.
I am sorry that there is just NOBODY with a clue about Cantera/Windows/
Fortran
responding on this Forum to you, but I noticed this Forum/Project is
very quiet in general.

I didn't find the Cantera.mod file in the installation with the
Windows msi installer. This would make sense, because this interface
should be created by the actual compilers on the actual machine where
Cantera is running. You said you have the source files - one of those
is Cantera.h in the /Cantera/fortran/scr directory. Then it should be
possible to compile your own mod files plus the all necessary object
files in this directory. To get an idea how this is done, look at the
make files in this directory (Makefile and Makefile.in). The
Makefile.in is the template, from which the actual Makefile is
generated. So if you cannot run the whole Project you would have to
create your Makefile from the template manually - experience is needed
but it is not impossible.
Probably it is even easier to do the recompilation and rebuilding of
the whole project from source.

Additionally I will send you my mod files by private email (Beside
Cantera.mod there are others). However, there is only a tiny chance
that this will work, and I DO NOT take any responsibility if you use
them. I don't know how they work and there is a chance that there are
severe incompatibilities or even a system crash. In addition to the
mod files you will need the compiled object files of this directory.

I think you should make some principal decisions before you proceed:
--------------------------------------------------------------------------------------

1) Do you need to work with windows or is it possible to change to a
Linux Installation?
There are easy possibilities to do this, if you have a normal
internet access. In
the academic world it is more likely to find support if you
are working on Unix/Linux.

2) Do you need to use Fortran, or can you also use MATLAB or Python.
Those are scripting languages, they can be used
interactively , no need to compile stuff.
There is even the possibility to use free Octave instead of
Matlab for most cases.

3) Do you need specifically Cantera, or could you also use some other
software tool (e.g. commercial Chemkin which has License and Support).
There are a lot of software packages out there, and a
commercial package should offer you the necessary support to get
started.

4) Can you arrange that some local computer-geek helps you with the
first steps in installation and compiling?
Anything you do will be easier if somebody supports you who
is comfortable with compiling stuff, Makefiles, configurescripts
etc. As soon you have the first project running, its almost
piece of cake (I said almost).


Outlook for an additional option:
----------------------------------------
I want to produce an easy to install Cantera-package for some linux
distributions.
I am currently working on Puppy Linux which is very small and fast.

So far I have all the demos in Python working.
I linked Cantera to Octave (All but 2 demos work - some compatibility
issue Octave/Matlab).
Currently I try to get the fortran interface to work for me
At last - hopefully soon - I will try the C interface, this should be
the least hassle.

Maybe if you have enough patience I might publish a complete Linux
Distribution with GUI, office tools, internet & email, lightweight IDE
for C, Fortran, Python & Octave and working CANTERA PREINSTALLED AND
TESTED during the next weeks - This should be below 200 MB Download
and should run on most PC systems. It can be run and installed from CD
or even from USB stick (of course also conventional HD install
possible, also in addition to a Windows or other Linux OS). So you can
take your Cantera simulation out for a walk to discuss it with a
fellow scientist right on HIS Computer.

What did I do to solve your problem? - (without success I must admit)
--------------------------------------------------------------------------------------
I reinstalled cantera via the msi installer (on my XP installation), I
then got the GNU gfortran and gcc compilers and installed them.
I could compile the demo, but got the missing "Cantera.mod" error like
you. I realised that there is not much source code in the msi
installation and specifically the file necessary files of the fortran
interface were missing. So they have to come from the source code.

I then downloaded the older Cantera 1.55, there is a Visual C project
included. I got Visual C++ Express and I tried to recompile Cantera,
but it failed (had some errors). Since I did such a windows install 2
years ago I stopped at that point, because it took me so much time and
nerves to make the windows build work.

After that I went back to the Linux installation to try the demo.f90
there. It compiled but failed with a Cantera Error at runtime.
I think I found a bug in the Cantera source code concerning the
Fortran 90 interface, but I hope I ironed it out now. (Will post my
suggested fix in a separate thread).

Well it sounds like a lot of work, but it was not completely useless:
I learned that there are 2 different sets of Fortran example files.
The demo.f90 should work via the current Cantera / Fortran interface,
this is exactly the infamous Cantera.mod file (well its at least a
substantial part of the interface).
In the other set there are somewhat older Fortran 77 examples with a
saperate linking file. Those are the examples where there exists the
rather cryptic f77.pdf documentation file (10 pages). A separat
linking C file is supplied with those examples. I couldn't make those
examples work by now, but I won't invest to much time neither. The
reason: Cantera should concentrate on the newer system, the demo.f90.
All the older examples should be reworked and rewritten for the new
interface IMHO! There is already enough confusion around.
Thinking Twice I understand that there are maybe lots of old chemkin/
fortran scripts. Maybe someone who has those running could enlighten
us how this works.
But newer examples and tutorials should be in f90 - again IMHO!

sorry for this long post,
Emil
SO IF ANYONE WITH WORKING INTERFACE READ UNTIL HERE - PLEASE SHARE
YOUR KNOWLEDGE - YOU ALREADY INVESTED QUITE SOME TIME READING THIS

Felipe Abrão

unread,
Dec 13, 2009, 4:59:16 AM12/13/09
to Cantera User's Group
Hello, Emil!

I am sorry for the big work you had to help me! Thank you very very
much! I hope someday I could also help you anyway!

Best wishes,

Felipe Abrão

On 6 dez, 18:21, emil <emil.widm...@gmail.com> wrote:
> Hello Felipe,
>
> I looked into the Cantera -FortranInterface and I frankly have to
> admit I had a hard time there. Until now I have not completly resolved
> everything.
> First I thought it is a bit over my head and I am just to dumb to make
> it work.
> Actually now I think the code is buggy and documentation is scarce,
> confusing, outdated and consequently mis-leading and even plainly
> wrong in some cases (no offense intended in any direction).
>
> In your case I saw that you tried to get this to work for quite some
> time now, you had also some rather old posts on thefortranusergroup about this!
> 2) Do you need to useFortran, or can you also use MATLAB or Python.
>          Those are scripting languages, they can be used
> interactively , no need to compile stuff.
>          There is even the possibility to use free Octave instead of
> Matlab for most cases.
>
> 3) Do you need specifically Cantera, or could you also use some other
> software tool (e.g. commercial Chemkin which has License and Support).
>           There are a lot of software packages out there, and a
> commercial package should offer you the necessary support to get
> started.
>
> 4) Can you arrange that some local computer-geek helps you with the
> first steps in installation and compiling?
>           Anything you do  will be easier if somebody supports you who
> is comfortable with compiling stuff, Makefiles, configurescripts
>           etc. As soon you have the first project running, its almost
> piece of cake (I said almost).
>
> Outlook for an additional option:
> ----------------------------------------
> I want to produce an easy to install Cantera-package for some linux
> distributions.
> I am currently working on Puppy Linux which is very small and fast.
>
> So far I have all the demos in Python working.
> I linked Cantera to Octave (All but 2 demos work - some compatibility
> issue Octave/Matlab).
> Currently I try to get thefortraninterface to work for me
> At last - hopefully soon - I will try the C interface, this should be
> the least hassle.
>
> Maybe if you have enough patience I might publish a complete Linux
> Distribution with GUI, office tools, internet & email, lightweight IDE
> for C,Fortran, Python & Octave and working CANTERA PREINSTALLED AND
> TESTED during the next weeks - This should be below 200 MB Download
> and should run on most PC systems. It can be run and installed from CD
> or even from USB stick (of course also conventional HD install
> possible, also in addition to a Windows or other Linux OS). So you can
> take your Cantera simulation out for a walk to discuss it with a
> fellow scientist right on HIS Computer.
>
> What did I do to solve your problem? - (without success I must admit)
> --------------------------------------------------------------------------- -----------
> I reinstalled cantera via the msi installer (on my XP installation), I
> then got the GNU gfortran and gcc compilers and installed them.
> I could compile the demo, but got the missing "Cantera.mod" error like
> you. I realised that there is not much source code in the msi
> installation and specifically the file necessary files of thefortran
> interface were missing. So they have to come from the source code.
>
> I then downloaded the older Cantera 1.55, there is a Visual C project
> included. I got Visual C++ Express and I tried to recompile Cantera,
> but it failed (had some errors). Since I did such a windows install 2
> years ago I stopped at that point, because it took me so much time and
> nerves to make the windows build work.
>
> After that I went back to the Linux installation to try the demo.f90
> there. It compiled but failed with a Cantera Error at runtime.
> I think I found a bug in the Cantera source code concerning theFortran90 interface, but I hope I ironed it out now. (Will post my
> suggested fix in a separate thread).
>
> Well it sounds like a lot of work, but it was not completely useless:
> I learned that there are 2 different sets ofFortranexample files.
> The demo.f90 should work via the current Cantera /Fortraninterface,
> this is exactly the infamous Cantera.mod file (well its at least a
> substantial part of the interface).
> In the other set there are somewhat olderFortran77 examples with a
> saperate linking file. Those are the examples where there exists the
> rather cryptic f77.pdf documentation file (10 pages). A separat
> linking C file is supplied with those examples. I couldn't make those
> examples work by now, but I won't invest to much time neither. The
> reason: Cantera should concentrate on the newer system, the demo.f90.
> All the older examples should be reworked and rewritten for the new
> interface IMHO! There is already enough confusion around.
> Thinking Twice I understand that there are maybe lots of old chemkin/fortranscripts. Maybe someone who has those running could enlighten
> > > To modify this project file to build your ownFortran77 application,
> > > make a copy with a different name, open the copy in Visual Studio,
> > > delete file demo.f and replace it with yourFortranprogram. If you
> > > need to change demo_ftnlib.cpp, then also replace it with your
> > > modified version.
>
> > > Note that the include and library directories are specified relative
> > > to the location of the project file. If you move it to another
> > > directory, you will need to update these locations under 'Settings'.
> > > ----
>
> > > So if you open the Project file, VisualFortranshould open and it
> > > should set the correct paths.
>
> > > Hope the helps,
> > > if it is succesfull you could study the flags and paths that are set
> > > in the compiler. You should then be able to figure out how to set them
> > > to compile from other directories.
> > > Emil
>
> > > On Dec 5, 1:26 pm, Felipe Abrão <felipeab...@gmail.com> wrote:
>
> > > > Hello, Emil,
>
> > > > thank you very much for you help.  I checked Cantera, and I could see
> > > > that I do have the files you mentioned. I useFortran90, and simply
> > > > can not run any example program that comes with Cantera that I
> > > > downloaded. The first message that appears,  after I compile any
> > > > program (demo.f90, for example) is: "Could not find the file
> > > > cantera.mod.". I do not know what else I can do. Anyway, thank you
> > > > once more.
>
> > > > Sincerely,
>
> > > > Felipe
>
> > > > On 4 dez, 10:45, emil <emil.widm...@gmail.com> wrote:
>
> > > > > Hello Felipe,
>
> > > > > I guess you had Cantera installed from the msi installer file from
> > > > > sourceforge.
> > > > > I did the same on my win-XP machine and found that there are some
> > > > > files missing which are in the Linux tarball, at least I didn't find
> > > > > them.
>
> > > > > I tried to follow the documentation in the f77.pdf from Dr. Goodwin.
> > > > > Do you have the files demo_ftnlib.cpp, demo.f demo.mak ?
>
> > > > > If not I suggest the
>
> ...
>
> mais »

manoj kumar

unread,
May 25, 2010, 5:25:46 AM5/25/10
to canter...@googlegroups.com
Is it possible to reduce the large reaction mechanism using cantera
manoj

Magda

unread,
Jun 4, 2010, 12:59:16 PM6/4/10
to Cantera User's Group
Hi everybody,

I would like to reduce a kinetic mechanism for a solid-gaseous system,
equilibrium approach.
I have tried to use sundials. The sensitivity.py example provided with
cantera is for a reactor/kinetics and right now I am unsure if
sensitivity analysis can be done for eq or not, in this case. I have
tried to play and modify the script as I thought but I havent been
able to make it run.
Also, if I understand correctly mixmaster that it can be used only for
a gaseous system.
What other options are left?

Best regards,
Magda

Magda

unread,
Jun 9, 2010, 1:38:06 PM6/9/10
to Cantera User's Group

Hi everbody again,

I started to work work with kinetics and tried to understand how to
perform a sensitivity analysis.
The only example I found in this regard was sensitvity.py.
I am not sure if I understood this right, but when performing a
sensitivity analysis for all my reactions and all my species I will
get at the end the reduced mechanism.

I would like to know if there is a way to sort of reduce a mechanism
with cantera/sandials in a more efficient way.
Something like this: http://firebrand.me.berkeley.edu/griredu.html#sets

Regards,
Magda
Reply all
Reply to author
Forward
0 new messages