Installing OpenFVM on Darwin (Mac OS X)

Posted on December 16, 2008
Filed Under Informatics |

openfvm-fluidYes. After many, many years I went back to GNU compilers and linkers

Let’s say you want to simulate a fluid, and how it is heated by a hot cylinder.

What do you do? You take a hot cylinder and measure the lost of heat. But if you don’t want to mess around with hot cylinders and water, and you have a Mac (or even better Linux) you can install a simulation software and reproduce your experiment in the computer.

OpenFVM is such an application, and is opensource. It is easy to use, but must be compiled to be installed. That’s pretty easy on Linux, no idea about Windows, and decently easy on Mac. Here are some advices for Mac users.

Developers’ tool

First of all, you must install either Apple developer tools or fink. Apple’s tools have a huge amount of useless stuff (like XCode), where fink is fantastic, because it creates a similar environment of a debian machine. For example, you can search if there is a package ready to be used with:

apt-cache search package_name

and then install it with

apt-get install package_name

NB as root, you have to add the following line to your .profile file:

test -r /sw/bin/init.sh && ./sw/bin/init.sh

Installation of GMSH

You could download the GMSH libraries from http://www.geuz.org/gmsh, but you would not have the possibility to use (easily) the command line. Then, it is much better to build them.

Download the source code. Untar it and go into the directory gmsh-version_number. Run ./configure. You’ll probably get an error:

configure: error: Could not find GSL, aborting.

If so, you have to install the Gnu Scientific Libraries. Then:

apt-get install gsl

If the linker (ld) shows some problem, you probably also have to add the directory where fink put all libraries to the LDFLAFS environment variable. Add in the makefile:

export LDFLAFS=-L/sw/lib/ 

or in your .profile

export DYLD_LIBRARY_PATH=/sw/lib/ 

But this might be not enough. If you receive an error message about a missing libjpeg library you have to create a link in /sw/lib:ln -s /sw/lib/libjpeg.62.dylib /sw/lib/libjpeg.dylib

Compiling OpenFVM

Before following the instruction you find on the OpenFVM page on how to compile all the stuff, go into Flow/serial/laspack and edit eigenval.c. Comment out the line #ifdef __linux__ like that:

//#ifdef __linux__

#define max(x, y) ((x) > (y) ? (x) : (y))

#define min(x, y) ((x) < (y) ? (x) : (y))

//#endif

After having built the laspack libraries, run make in the Flow/serial directory.You will get the following error:

source/main.c:24:20: error: malloc.h: No such file or directory

Here, you have to edit main.c, setup.c, reorder.c and change#include <malloc.h> in#include <sys/malloc.h>.

Now compile. If you get the following error:

Undefined symbols:

"_max", referenced from:_EstimEigenvals in liblaspack.a(eigenval.o)

"_min", referenced from: _EstimEigenvals in liblaspack.a(eigenval.o)

it means you have not edited eigenval.c in the Flow/serial/laspack directory.

Share This

Comments

One Response to “Installing OpenFVM on Darwin (Mac OS X)”

  1. x-flow on February 16th, 2009 10:40 am

    Hi,

    So that it continues to work in Linux and Windows and hopefully on MAC, I have changed the line in the source code from #ifdef __linux__ to #ifndef WIN32.
    If you want, you can download the latest revision from SVN and check if it compiles.

Leave a Reply




Close
E-mail It