CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Paraview & paraFoam

ParaView/ParaFoam in OpenFoam 1.5 dev

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   February 5, 2010, 14:12
Default ParaView/ParaFoam in OpenFoam 1.5 dev
  #1
Senior Member
 
Antonio Martins
Join Date: Mar 2009
Location: Porto, Porto, Portugal
Posts: 112
Rep Power: 8
titio is on a distinguished road
Send a message via MSN to titio Send a message via Skype™ to titio
Hi foamers,

I am having difficulties in using paraview/parafoam in OpenFoam 1.5 - dev in Ubuntu 8.1. Until now, I tried to recompile paraview and the PV3FoamReader utility following the instructions available in the OpenFoam main site and other information available at the forum

However, I was unable of installing paraview, and consequently parafoam. What should I do? I am planing to download paraview, install it, and then change the configuration files of PV3FoamReader to be able to use paraFoam.
Can I do this? Is there a better option?

Regards,

António Martins
titio is offline   Reply With Quote

Old   February 25, 2010, 12:06
Default
  #2
Senior Member
 
Pavan
Join Date: May 2009
Location: Melbourne
Posts: 101
Rep Power: 8
rieuk is on a distinguished road
Hey Antonio, did you end up getting paraFoam to work? I'm interested in the solution too...the buildParaView3.3-svc doesn't work in OF-1.5-dev which is very annoying.
rieuk is offline   Reply With Quote

Old   February 27, 2010, 15:02
Default
  #3
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 9
gwierink is on a distinguished road
Hi James,

I got it to work too with OpenFoam-1.5-dev (Ubuntu 9.10 x86_64). It turned out, at least in my case, that buildParaViewFunctions in $HOME/OpenFOAM/OpenFOAM-1.5-dev/bin/tools/ contained some error(s). I replaced it with buildParaViewFunctions from OpenFOAM-1.5 and it worked . The working buildParaViewFunctions looks like:

Code:
#---------------------------------*- sh -*-------------------------------------
# =========                 |
# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
#  \\    /   O peration     |
#   \\  /    A nd           | Copyright (C) 1991-2008 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
#     buildParaViewFunctions
#
# Description
#     ParaView build/install helper functions
#
#------------------------------------------------------------------------------

addCMakeVariable ()
{
    while [ -n "$1" ]
    do
        CMAKE_VARIABLES="$CMAKE_VARIABLES -D$1"
        shift
    done
}


initialiseVariables ()
{
    unset CMAKE_VARIABLES OBJ_ADD

    if [ "$VERBOSE" = ON ]; then
        addCMakeVariable "CMAKE_VERBOSE_MAKEFILE=TRUE"
    fi
    addCMakeVariable "VTK_USE_TK=FALSE"
}


addMpiSupport ()
{
    [ "$INCLUDE_MPI" = ON ] || return

    MPI_LIBRARY=$MPI_ARCH_PATH/lib/libmpi.so
    MPI_INCLUDE_PATH=$MPI_ARCH_PATH/include
    MPI_RUN=$MPI_ARCH_PATH/bin/mpirun

    OBJ_ADD="$OBJ_ADD-mpi"
    addCMakeVariable "VTK_USE_MPI=ON"
    addCMakeVariable "PARAVIEW_USE_MPI=ON"
    addCMakeVariable "MPI_INCLUDE_PATH=$MPI_INCLUDE_PATH"
    addCMakeVariable "MPI_LIBRARY=$MPI_LIBRARY"
    addCMakeVariable "VTK_MPIRUN_EXE=$MPI_RUN"
    addCMakeVariable "VTK_MPI_MAX_NUMPROCS=$MPI_MAX_PROCS"
}


addPythonSupport ()
{
    [ "$INCLUDE_PYTHON" = ON ] || return

    WHICH_PYTHON=`which python`
    if [ -n "$WHICH_PYTHON" ]; then
        OBJ_ADD="$OBJ_ADD-py"

        if [ -n "$PYTHON_LIBRARY" ]; then
            # check $PYTHON_LIBRARY if it has been set
            if [ ! -e "$PYTHON_LIBRARY" ]; then
                echo "*** Error: libpython not found at location specified " \
                     "by PYTHON_LIBRARY: $PYTHON_LIBRARY"
                echo "    Please set the variable PYTHON_LIBRARY to the full"
                echo "    path to (and including) libpython, or deactivate"
                echo "    python support by setting INCLUDE_PYTHON=OFF"
                exit 1
            fi
        else
            # Try to obtain $PYTHON_LIBRARY if not set
            # - assumes dynamically linked
            PYTHON_LIBRARY=`ldd $WHICH_PYTHON | \
                sed -ne '/libpython/s/.* => \(.*\) (.*/\1/p'`
        fi

        if [ ! -n "$PYTHON_LIBRARY" ]; then
            echo "*** Error: Unable to determine path to python library."
            echo "    Please set the variable PYTHON_LIBRARY to the full"
            echo "    path to (and including) libpython, or deactivate"
            echo "    python support by setting INCLUDE_PYTHON=OFF"
            exit 1
        fi
        PYTHON_MAJOR_VERSION=`echo $PYTHON_LIBRARY | \
            sed 's/.*libpython\(.*\)\.so.*/\1/'`
        PYTHON_INCLUDE_DIR=/usr/include/python$PYTHON_MAJOR_VERSION

        addCMakeVariable "PARAVIEW_ENABLE_PYTHON=ON"
        addCMakeVariable "PYTHON_INCLUDE_PATH=$PYTHON_INCLUDE_DIR"
        addCMakeVariable "PYTHON_LIBRARY=$PYTHON_LIBRARY"
    else
        echo "*** Error: python not installed"
        echo "***        De-activate python support by setting " \
             "INCLUDE_PYTHON=OFF"
        exit 1
    fi
}


addMesaSupport ()
{
    [ "$INCLUDE_MESA" = ON ] || return

    MESA_INCLUDE_DIR=/usr/include/GL
    MESA_LIBRARY=/usr/lib$WM_COMPILER_LIB_ARCH/libOSMesa.so

    if [ -d "$MESA_INCLUDE_DIR" -a -f "$MESA_LIBRARY" ]; then
        OBJ_ADD="$OBJ_ADD-mesa"
        addCMakeVariable "VTK_OPENGL_HAS_OSMESA=ON"
        addCMakeVariable "OSMESA_INCLUDE_DIR=$MESA_INCLUDE_DIR"
        addCMakeVariable "OSMESA_LIBRARY=$MESA_LIBRARY"
    else
        echo "*** Error: no MESA information found"
        exit 1
    fi
}


buildParaView ()
{
    # set general options
    addCMakeVariable "BUILD_SHARED_LIBS:BOOL=ON"
    addCMakeVariable "CMAKE_BUILD_TYPE:STRING=Release"

    # set paraview environment
    unset PARAVIEW_SRC_DIR
    for i in $PWD $WM_THIRD_PARTY_DIR
    do
       if [ -d $i/$PARAVIEW_SRC ]
       then
          PARAVIEW_SRC_DIR=$i/$PARAVIEW_SRC
          break
       fi
    done

    [ -d "$PARAVIEW_SRC_DIR" ] || {
       echo "did not find $PARAVIEW_SRC in these directories:"
       echo "  PWD=$PWD"
       echo "  WM_THIRD_PARTY_DIR=$WM_THIRD_PARTY_DIR"
       echo "abort build"
       exit 1
    }

    # PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_OPTIONS/obj$OBJ_ADD
    PARAVIEW_OBJ_DIR=$PARAVIEW_SRC_DIR/platforms/$WM_ARCH$WM_COMPILER

    # provide a shortcut for repeated builds - use with caution
    if [ "$CMAKE_SKIP" = YES ]
    then

       # change to build folder
       cd $PARAVIEW_OBJ_DIR || exit 1

    else

       # remove existing build folder if present
       if [ -e "$PARAVIEW_OBJ_DIR" ]; then
           rm -rf $PARAVIEW_OBJ_DIR
       fi

       # create paraview build folder
       mkdir -p $PARAVIEW_OBJ_DIR
       cd $PARAVIEW_OBJ_DIR

       echo "Building $PARAVIEW_SRC"
       echo "    MPI support    : $INCLUDE_MPI"
       echo "    Python support : $INCLUDE_PYTHON"
       echo "    MESA support   : $INCLUDE_MESA"
       echo "    Source         : $PARAVIEW_SRC_DIR"
       echo "    Target         : $PARAVIEW_OBJ_DIR"

       # make paraview
       cmake \
           -DCMAKE_INSTALL_PREFIX=$PARAVIEW_APP_DIR \
           $CMAKE_VARIABLES \
           $PARAVIEW_SRC_DIR
    fi

    if [ -r /proc/cpuinfo ]; then
        WM_NCOMPPROCS=`egrep "^processor" /proc/cpuinfo | wc -l`

        if [ $WM_NCOMPPROCS -gt 8 ]; then
            WM_NCOMPPROCS=8
        fi

        make -j $WM_NCOMPPROCS
    else
        make
    fi
}


installParaView ()
{
    if [ -e "$PARAVIEW_OBJ_DIR/bin/paraview" ]; then
        echo "    Build complete"

        cd $PARAVIEW_OBJ_DIR

        # Replace PARAVIEW_SRC_DIR path with ParaView_INST_DIR
        # environment variables
        echo "    Replacing path hard links"
        find . -iname \*.cmake -execdir sed -i \
            "s,$PARAVIEW_SRC_DIR,\$ENV{ParaView_INST_DIR},g" {} ';' \
            -print

        # Replace local MPI_ARCH_PATH path with MPI_ARCH_PATH
        # environment variables
        if [ "$INCLUDE_MPI" = ON ]; then
            find . -iname \*.cmake -execdir sed -i \
                "s,$MPI_ARCH_PATH,\$ENV{MPI_ARCH_PATH},g" {} ';' \
                -print
        fi

        # Replace local CMAKE_HOME path with CMAKE_HOME
        # environment variables
        find . -iname '*cmake*' -execdir sed -i \
            "s,$CMAKE_HOME,\$ENV{CMAKE_HOME},g" {} ';' \
            -print

        # Replace local WM_COMPILER_DIR path with WM_COMPILER_DIR
        # environment variables
        find . -iname '*cmake*' -execdir sed -i \
            "s,$WM_COMPILER_DIR,\$ENV{WM_COMPILER_DIR},g" {} ';' \
            -print

        # create a softlink to the $PARAVIEW_OBJ_DIR/bin folder
        # - workaround for chosen install location
        echo "    Creating paraview $PARAVIEW_MAJOR_VERSION soft link to /bin"
        (  mkdir lib && cd lib && ln -s ../bin \
            paraview-$PARAVIEW_MAJOR_VERSION  )

        # info on symlinks to screen
        echo ""
        echo "    ---"
        echo "    Installation complete"
        echo "    Set environment variables:"
        echo "    - ParaView_INST_DIR to $PARAVIEW_SRC_DIR"
        echo "    - ParaView_DIR to $PARAVIEW_OBJ_DIR"
        echo "    - PV_PLUGIN_PATH to $FOAM_LIBBIN"
        echo "    Add $PARAVIEW_OBJ_DIR/bin to PATH"
        # echo "   Add $ParaView_INST_DIR/lib to LD_LIBRARY_PATH"
        echo "    ---"
    fi
}


# for good measure - clear a few variables before using any of the functions

unset VERBOSE INCLUDE_MPI INCLUDE_PYTHON INCLUDE_MESA PYTHON_LIBRARY
unset CMAKE_VARIABLES OBJ_ADD
unset CMAKE_SKIP


# ----------------------------------------------------------------- end-of-file
__________________
Regards, Gijs

Last edited by gwierink; February 27, 2010 at 15:03. Reason: typo
gwierink is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OpenFOAM 1.5 dev LVDH OpenFOAM 98 May 5, 2010 17:01
Paraview/Parafoam in OpenFoam 1.5 dev titio OpenFOAM Post-Processing 0 December 9, 2009 13:13
Paraview/Parafoam in OpenFoam 1.5 dev titio OpenFOAM Paraview & paraFoam 0 December 9, 2009 13:12
Problem installing OpenFOAM 1.5 installation on RHEL 4. vwsj84 OpenFOAM Installation 4 April 23, 2009 04:48
OpenFOAM Version 1.5 Released OpenFOAM discussion board administrator OpenFOAM Announcements from ESI-OpenCFD 0 July 14, 2008 18:22


All times are GMT -4. The time now is 20:14.