OpenFoam

Discussion in 'Software' started by StianM, May 15, 2007.

  1. StianM
    Joined: May 2006
    Posts: 593
    Likes: 23, Points: 18, Legacy Rep: 114
    Location: Norway

    StianM Senior Member

    I have dicided to start doing dome work with CFD.
    I want this because off personal interest and also I see it as a posible tool in my work.

    I downloaded OpenFoam and think I got it unziped right, but can not get anny futher. The readme file has som install instuctions, but I just can't make sence out off it, but then I'm not that good managing linux systems. Maybe it's fedora that is not well suited for this purpose.
     
  2. marshmat
    Joined: Apr 2005
    Posts: 4,127
    Likes: 149, Points: 63, Legacy Rep: 2043
    Location: Ontario

    marshmat Senior Member

    OpenFOAM is a powerful solver, but as of yet there hasn't been much work done towards making it user-friendly. I'm afraid I've never tried it on Fedora and so can't help you with your dilemma. But my impression of the software, so far, is that OpenFOAM really does require a certain amount of coding and Linux administration experience to be useful. That will improve with time as developers start to feel confident enough in the program to add more user-friendly features.
     
  3. Tim B
    Joined: Jan 2003
    Posts: 1,438
    Likes: 59, Points: 0, Legacy Rep: 841
    Location: Southern England

    Tim B Senior Member

    OpenFOAM is quite difficult to get set up. It compiles using a tool called wmake (which I think the developers produced themselves). You also need to set up a number of environment variables to get it to work. I re-wrote thier various scripts to produce one script when I did it. This seemed to greatly simplify an otherwise rather painful operation.

    You will need the SUN Java environment for FoamX.

    When you have set the environment variables in my script, run foamInstallationTest and chase any other environment variables you need to. Ignore the error about the /home/timb/.OpenFOAM-1.2/bashrc (in my case) because everything that was in that script is now in SetVars (script below). This should let you build wmake and then OpenFOAM.

    Best of luck, apologies for the long post,

    Tim B.


    >> SetVars Script follows

    #!/bin/bash -f
    #------------------------------------------------------------------------------
    # ========= |
    # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
    # \\ / O peration |
    # \\ / A nd | Copyright (C) 1991-2005 OpenCFD Ltd.
    # \\/ M anipulation |
    #-------------------------------------------------------------------------------
    # License
    # This file is part of OpenFOAM.
    #
    # OpenFOAM is free software; you can redistribute it and/or modify it
    # under the terms of the GNU General Public License as published by the
    # Free Software Foundation; either version 2 of the License, or (at your
    # option) any later version.
    #
    # OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
    # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
    # for more details.
    #
    # You should have received a copy of the GNU General Public License
    # along with OpenFOAM; if not, write to the Free Software Foundation,
    # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
    #
    # Script
    # SetVars
    #
    # Description
    # Startup File for OpenFoam
    # This script has been modified greatly from the origenal OpenFOAM system
    # Hopefully this is a bit easier to edit!
    #
    #------------------------------------------------------------------------------
    echo -n "Setting up Open-FOAM environment..."

    export WM_PROJECT=OpenFOAM
    export WM_PROJECT_VERSION=1.2
    export WM_PROJECT_LANGUAGE=c++
    export WM_PROJECT_INST_DIR=/opt/$WM_PROJECT-$WM_PROJECT_VERSION
    export WM_PROJECT_USER_DIR=$HOME/$WM_PROJECT
    export WM_PROJECT_DIR=$WM_PROJECT_INST_DIR

    # Compiler Setup
    export WM_ARCH="linux"
    export WM_COMPILER="Gcc4"
    export WM_COMPILER_DIR=/usr
    export WM_COMPILER_ARCH=""
    export WM_COMPILER_LIB_ARCH=""
    export WM_COMPILE_OPTION=Opt
    export WM_OPTIONS=$WM_ARCH${WM_COMPILER}$WM_COMPILE_OPTION
    export WM_DIR=$WM_PROJECT_DIR/wmake
    export WM_LINK_LANGUAGE=c++

    # Java Settings
    export JAVA_HOME=/opt/jdk1.5.0_09
    export JAVA_PATH=$JAVA_HOME
    #export JAVA_PATH=/usr/jdk1.5.0_06:/usr/jre1.5.0_06/bin
    export WM_JAVAC_OPTION=Opt

    # FOAM Itself
    FOAM_APP=$WM_PROJECT_DIR/applications
    export FOAM_SRC=$WM_PROJECT_DIR/src
    export FOAM_JOB_DIR=$WM_PROJECT_INST_DIR/jobControl
    export FOAM_APPBIN=$WM_PROJECT_INST_DIR/applications/bin
    export FOAM_USER_APPBIN=$WM_PROJECT_USER_DIR/applications/bin
    export FOAM_RUN=$WM_PROJECT_USER_DIR/run
    export FOAM_UTILITIES=$FOAM_APP/utilities
    export FOAM_DOT_DIR=$WM_PROJECT_INST_DIR/.OpenFOAM-1.2

    # FOAM Libraries
    FOAM_LIB=$WM_PROJECT_DIR/lib
    export FOAM_LIBBIN=$FOAM_LIB/$WM_OPTIONS
    export FOAM_USER_LIBBIN=$WM_PROJECT_USER_DIR/lib/$WM_OPTIONS


    # MICO
    export MICO_VERSION=2.3.11
    export MICO_PATH=$FOAM_SRC/mico-$MICO_VERSION
    export MICO_ARCH_PATH=$MICO_PATH/platforms/$WM_OPTIONS
    export PATH=$MICO_ARCH_PATH/bin:$PATH

    # Use Either LAM OR MPICH
    export MPI_BUFFER_SIZE=20000000
    # LAM
    LAM_VERSION=7.1.1
    export LAMHOME=$FOAM_SRC/lam-$LAM_VERSION
    export LAM_ARCH_PATH=$LAMHOME/platforms/$WM_OPTIONS
    export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/lam-$LAM_VERSION

    # MPICH
    #export MPICH_VERSION=1.2.4
    #export MPICH_PATH=$FOAM_SRC/mpich-$MPICH_VERSION
    #export MPICH_ARCH_PATH=$MPICH_PATH/platforms/$WM_OPTIONS
    #export MPICH_ROOT=$MPICH_ARCH_PATH
    #export FOAM_MPI_LIBBIN=$FOAM_LIBBIN/mpich-$MPICH_VERSION

    # FOAM-X GUI Environment
    export FOAMX_PATH=$FOAM_UTILITIES/preProcessing/FoamX
    export FOAMX_CONFIG=$WM_PROJECT_INST_DIR/.OpenFOAM-1.2/apps/FoamX

    PATH=$PATH:$WM_PROJECT_DIR/bin:$WM_PROJECT_INST_DIR/bin:$FOAM_APPBIN:$FOAM_USER_APPBIN
    PATH=$PATH:$JAVA_PATH/bin:$WM_DIR:$FOAMX_PATH:$LAM_ARCH_PATH:$MPICH_ARCH_PATH
    export PATH

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$WM_COMPILER_LIB:$FOAM_LIB:$FOAM_LIBBIN:$FOAM_USER_LIBBIN:$LAM_ARCH_PATH/lib:$MPICH_ARCH_PATH/lib:$FOAM_MPI_LIBBIN

    echo "...Done :)"
     
  4. StianM
    Joined: May 2006
    Posts: 593
    Likes: 23, Points: 18, Legacy Rep: 114
    Location: Norway

    StianM Senior Member

    What version are you talking about?
    The readme file in the one I have look like this.

    3. Installation
    ~~~~~~~~~~~~~~~
    Download and unpack the files in the $HOME/OpenFOAM directory as
    described in: http://www.openfoam.org/download.html

    The environment variable settings are contained in files in a
    .OpenFOAM-1.4 directory in the OpenFOAM release, i.e. in
    $HOME/OpenFOAM/OpenFOAM-1.4/.OpenFOAM-1.4

    a) EITHER, if running bash or ksh (if in doubt type 'echo $SHELL'),
    source the .OpenFOAM-1.4/bashrc file by adding the following line to
    the end of your $HOME/.bashrc file:

    . $HOME/OpenFOAM/OpenFOAM-1.4/.OpenFOAM-1.4/bashrc

    Then update the environment variables by sourcing the $HOME/.bashrc
    file by typing in the terminal:
    . $HOME/.bashrc

    b) OR, if running tcsh or csh, source the .OpenFOAM-1.4/cshrc file by
    adding the following line to the end of your $HOME/.cshrc file:

    source $HOME/OpenFOAM/OpenFOAM-1.4/.OpenFOAM-1.4/cshrc

    Then update the environment variables by sourcing the $HOME/.cshrc
    file by typing in the terminal:
    source $HOME/.cshrc

    I just don't get this. I hope I some day can get it as RPM file.
     
  5. Mikey
    Joined: Sep 2004
    Posts: 368
    Likes: 7, Points: 0, Legacy Rep: 75
    Location: Bangkok, Thailand

    Mikey Senior Member

    Thanks Tim, I plan to get going with OpenFoam this autumn, your information will be useful :)

    Mikey
     
  6. Tim B
    Joined: Jan 2003
    Posts: 1,438
    Likes: 59, Points: 0, Legacy Rep: 841
    Location: Southern England

    Tim B Senior Member

    StianM,

    my script is for V1.2 but should be common to most versions. All it does is to set all the environment variables OpenFOAM needs, thereby getting rid of the need to put .OpenFOAM in your home directory. .OpenFOAM is only actually needed for FoamX, so I just left it sitting in the install directory.

    Tim B.
     
  7. StianM
    Joined: May 2006
    Posts: 593
    Likes: 23, Points: 18, Legacy Rep: 114
    Location: Norway

    StianM Senior Member

    Sounds ok had I only understod it.
    :confused:
     
  8. Tim B
    Joined: Jan 2003
    Posts: 1,438
    Likes: 59, Points: 0, Legacy Rep: 841
    Location: Southern England

    Tim B Senior Member

    if you do " ls -a " in the OpenFOAM directory you'll see a directory ".OpenFOAM". According to the developers this should go in each user's home directory, so that user-specific environment variables can be set. I have taken a more global view and written a script that sets everything up.

    Google searches give very good results for Linux commands.

    Tim B.
     
  9. Mikey
    Joined: Sep 2004
    Posts: 368
    Likes: 7, Points: 0, Legacy Rep: 75
    Location: Bangkok, Thailand

    Mikey Senior Member

    I don't worry about the Linux stuff, I wrote my first programme even before Bill Gates dropped out of University...

    But CFD, I hear that the learning curve is steep and that 6 months is a reasonable time line to get reasonable results, do you agree?

    Mikey
     

  10. Tim B
    Joined: Jan 2003
    Posts: 1,438
    Likes: 59, Points: 0, Legacy Rep: 841
    Location: Southern England

    Tim B Senior Member

    Yeah, probably about right, this isn't simple stuff.

    Tim B.
     
Loading...
Forum posts represent the experience, opinion, and view of individual users. Boat Design Net does not necessarily endorse nor share the view of each individual post.
When making potentially dangerous or financial decisions, always employ and consult appropriate professionals. Your circumstances or experience may be different.