Archive for the ‘Uncategorized’ Category

h1

Free ebooks – ebook management

August 30, 2011

I just bought a new Amazon kindle which I am very happy with. I have been stalking the net over the last few days looking for free ebooks. I was going to construct a list of free eBooks sites, however, an awesome list already exists.

Calibre (http://calibre-ebook.com/) provides an excellent option for ebook management on MacOS or windows. There are also plug-ins to Calibre which can strip DRM from many ebooks. Legality of these plug-ins is some what shady depending on where you live!

 

 

h1

Compiling OpenFOAM 1.7.x for OS X 10.6

September 16, 2010

This is a short guide for installing the Developer version of OpenFOAM for Snow Leopard. I have tried to include all details.

What you need:

A mac with OS 10.6 and  approximately 10 GB of HD space.

Preliminary steps:

Install the OS X developer tools

Install GCC 4.3 , 4.4 or 4.5 from either Macports or Fink. (4.5 will only work with 1.7.x) and git. I will presume 4.5

Once this you may start building OpenFOAM. The Mac PS file system is not file sensitive by default. Therefore you need to make a case-sensitive disk image for OpenFOAM.

Open Disk Utility (/Applications/Utilities/Disk Utility)

Menu > File > New > Blank disk image ..

You may save the image wherever you want, however, name the image ‘OpenFOAM’.

Using the drop box change the format to ‘Mac OS Extended (Case sensitive)’

Change the size to at least 5 GB. you may increase this later if required.

Create the image and close Disk Utility.

To keep the installation nice and clean we are going to mount the image at $HOME/OpenFOAM

This is the default OpenFOAM install site which will make your life easier in the long run.

To do this add the following to your .bashrc file (if you don’t have one you will need to create one):

hdiutil attach "/path/to/your/disk_image.dmg" -mountpoint "$HOME/OpenFOAM" > /dev/null

This will mount the image when your first open the terminal from now on.
Also add the following which sources the OpenFOAM bash files. This will create errors until you download OpenFOAM.

. $HOME/OpenFOAM/OpenFOAM-1.7.x/etc/bashrc

After you have saved your .bashrc file open a new window in the terminal. You will get the following error:

-bash: /Users/yourusername/OpenFOAM/OpenFOAM-1.7.x/etc/bashrc: No such file or directory

Download the following files and move them to $Home/OpenFOAM;
The 1.7.1 Third party software pack .
The openFOAM 1.7.x patch by Bernhard Gschaider.

The third party patch Bernhard Gschaider.

Check the thread for any updates.

Move these files to $HOME/OpenFOAM. Now we need to edit OpenFOAM-1.7.x-Mac_v2.patch. Open up the file in a text editor and check that the versions of gcc / g++ match what you have installed.
If you installed from macports you will have gcc-mp-4.5 and g++-mp-4.5 Whereas from fink it is gcc-fsf-4.5 and g++-fsf-4.5. Search through the file for ‘-mp-‘ and make sure the version and distribution strings match what you have installed.

At the terminal execute the following:

cd $HOME/OpenFOAM
git clone git://github.com/OpenCFD/OpenFOAM-1.7.x.git
tar -xfz ThirdParty-1.7.1.gtgz
mv ThirdParty-1.7.1 ThirdParty-1.7.x
cd ./ThirdParty-1.7.x
patch -p1 <../ThirdParty-1.7-Mac.patch
cd ../OpenFOAM.1.7.x
patch -p1 <../OpenFOAM-1.7.x-Mac_v2.patch
. $HOME/OpenFOAM/OpenFOAM-1.7.x/etc/bashrc
./Allwmake

This should give you a working OpenFOAM distributions with a few exceptions:
foamToTec360 does not work
parafoam does not work. To address this do the following:
Download and install the Paraview application.
In your case directories ‘touch’ the foam file.
i.e. in a case called ‘isofoam_case’

touch isofoam_case.foam

Open this file with the binary install of Paraview.

Enjoy

h1

Homebrew package manager for Mac OS

August 15, 2010

Homebrew is a new package manager for mac OS rivalling Fink and Macports.  Based on Git it is extensible and flexible. Critically it focuses on minimising the massive duplication of libraries typically observed within Fink and Macports.

Conceptually the idea is great, however, it is immature when compared with Fink or Macports. Primarily this is due to the limited number of packages available. However, I do want to point out that sometimes it is necessary to have different versions of software to the system default.

An example is gcc. While it is a pain to install (it takes a LOOONG time to compile) I need 4.3 for some software. Snow Leopard comes with 4.2. And another similar issue with open-mpi.

Package duplication is a problem, however, sometimes there is no way to avoid it. Minimization is the key and I think Homebrew has gone one step to far. With a little more sophistication it may work very well.

h1

Failing Bourne/Bash line continuations

April 8, 2010

When writing any code to keep the code width reasonable it is necessary to use line continuations. The unix shell is not my favourite programming environment, however,  I wanted to wrap an extremely long line from a colleagues script.

For example

#!/bin/bash
# Without line continuation
my extremely long code line featuring many long file names and directories
# With line continuation
my extremely long code line featuring\
many long file names and directories

This seems relatively simple, however, I ran into some difficulty. One error was simple, the line continuation sequence is \ followed by a EOL character. It is easy to forget to white spaces between the \ and the EOL character.

The second problem is one many resources fail to mention. The newline character must be a UNIX EOL character (see Newline). Unfortunately the script had been first edited under windows. This resulted in a failure to recognise the combination as a line continuation.

Solution:
Run script through dos2unix or similar tool.

h1

Hello world!

March 24, 2010

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!