FoamX-cygwin: Porting FoamX to Cygwin/Windows using the Unofficial OpenFOAM Cygwin Port

Feb. 24, 2007. Takuya OSHIMA

Jul. 8, 2008 update: This page is kept only for archival reason. Please use the third revision of OpenFOAM 1.4 unofficial Cygwin port released from the OpenFOAM extensions project (OpenFOAM-1.4-3.cygwin.src.tar.bz2) instead.

Jan. 8, 2008 update: There's also a precompiled binary of ParaView 3.3-CVS snapshot for Windows here.

Oct. 24, 2007 update: FoamX-cygwin has been integrated into the third revision of OpenFOAM 1.4 unofficial Cygwin port released from the OpenFOAM extensions project (OpenFOAM-1.4-3.cygwin.src.tar.bz2). You can download the distribution from the OpenFOAM extensions project page at SourceForge.net.

Screenshot of FoamX, paraFoam and patchTool working together on Windows.

FoamX is an easy-to-use, extensible and capable GUI case manager for a highly sophiscated open source CFD toolbox, OpenFOAM. This document describes how to port and run FoamX included in the Unofficial OpenFOAM Cygwin Port distribution on a Cygwin/Windows system. Readers are assumed to be familiar with OpenFOAM and basic operations of Cygwin.

Besides, the FoamX-20070224 (Feb. 24, 2007) release contains porting of other tools than FoamX whose porting work has remained to be done:

Currently there are two ways to run FoamX-cygwin; using binary distribution and building from source tree. For most peaple the binary distribution is recommended.

License

This port, like the Unofficial OpenFOAM Cygwin Port and the official version of OpenFOAM, is licensed under the GNU Public License, version 2.0 (or later). See the distribution files of the OpenFOAM for details.

Known issues

Installing the Cygwin port of OpenFOAM, besides FoamX-cygwin itself, under a directory structure which contains whitespace in its pathnames (e. g. "C:\cygwin\home\My Home") is not supported.

For currently known other issues, see Troubleshooting and ToDo sections.


Installation from binary distribution

Dependencies

You don't need the mico-2.3.12 library package since it is statically linked into the binaries.

Instructions

Before you start, be sure to make backup of your current OpenFOAM installation if you already have. Don't forget that this port is in beta state.

  1. Download and install the dependencies listed above except the last two.
  2. Download from The Unofficial OpenFOAM Cygwin Port website and into your Cygwin home directory (typically C:\cygwin\home\logonname where logonname is your logon name to Windows).
  3. Copy-and-paste the followings into your Cygwin terminal session (the commands need to be executed in the following order).
      cd 
      mkdir OpenFOAM 
      cd OpenFOAM 
      tar -xzf ../OpenFOAM-1.3.cygwin-src-0.5.tar.gz 
      tar -xzf ../OpenFOAM-1.3.cygwin-bin-0.5.tar.gz 
      tar -xzf ../OpenFOAM-1.3.Docs.tar.gz 
      tar -jxf ../FoamX-cygwin-20070224.tar.bz2 
      mkdir cygwin 
      cd cygwin 
      tar -xzf ../../gcc-4.1.0.cygwin-OpenFOAM.tar.gz 
      source ~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3/bashrc 
      ~/OpenFOAM/OpenFOAM-1.3/postinstall.sh
    
  4. If you want to start tutorials, go on by typing the followings.
      mkdir -p $FOAM_RUN 
      cp -r $FOAM_TUTORIALS $FOAM_RUN 
      FoamX
    

Building from source tree

Dependencies

Instructions

Before you start, be sure to make backup of your current OpenFOAM installation if you already have. Don't forget that this port is in beta state.

In the following instructions $DIST_DIR stands for the directory where downloaded various distribution files reside. So you can copy-and-paste the command lines below to the shell session if you set DIST_DIR properly, for example

	export DIST_DIR=~/download.

  1. Install the Unofficial OpenFOAM Cygwin Port distribution as usual by following the instructions under the "Current Distributions" section of the page and setup environment variables by sourcing ~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3/bashrc.
  2. Rename $WM_PROJECT_DIR/docs to $WM_PROJECT_DIR/doc. The directory is named doc in original Linux distribution but somehow renamed to docs in the Unofficial Cygwin Port. The name affects functioning of the Help menu in FoamX.
    	mv $WM_PROJECT_DIR/docs $WM_PROJECT_DIR/doc
    
  3. Cd to $FOAM_SRC, unpack mico-2.3.12.tar.gz and rename the $FOAM_SRC/mico directory to $FOAM_SRC/mico-2.3.12.
    	cd $FOAM_SRC
    	tar -zxf $DIST_DIR/mico-2.3.12.tar.gz
    	mv mico mico-2.3.12
    
  4. Rename two DimensionSet.H's (its real entity and a symbolic link) under $FOAMX_PATH to DimensionSet_.H.
    	mv $FOAMX_PATH/C++/FoamXLib/DimensionSet.H \
    		$FOAMX_PATH/C++/FoamXLib/DimensionSet_.H
    	rm $FOAMX_PATH/C++/FoamXLib/lnInclude/DimensionSet.H
    	ln -s $FOAMX_PATH/C++/FoamXLib/DimensionSet_.H \
    		$FOAMX_PATH/C++/FoamXLib/lnInclude/DimensionSet_.H
    
  5. Apply the patch FoamX-cygwin-20070224.diff at $WM_PROJECT_DIR.
    	cd $WM_PROJECT_DIR
    	patch -p1 < $DIST_DIR/FoamX-cygwin-20070224.diff
    
  6. Quit your command line shell session (to renew environment variables), start another one and source ~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3/bashrc.
    	exit
    	(restart bash session)
    	source ~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3/bashrc
    
  7. Build MICO. You will get LOTS of warnings but don't mind unless errors.
    	cd $MICO_PATH
    	./configure --prefix=$MICO_ARCH_PATH --disable-shared --without-x
    	make
    	make install
    	make distclean
    
  8. Build FoamX. You will get LOTS of warnings and infos but don't mind unless errors.
    	cd $FOAMX_PATH
    	./Allwmake
    
  9. Build patchTools. You don't need to rebuild PatchTool.jar (the Java part of patchTool) since it will run as-is.
    	cd $FOAM_APP/utilities/mesh/manipulation/patchTool/C++
    	./Allwmake
    
  10. Build gmshToFoam.
    	cd $FOAM_APP/utilities/mesh/conversion
    	wmake gmshToFoam
    
  11. Build foamDebugSwitches.
    	cd $FOAM_APP/utilities/miscellaneous
    	wmake foamDebugSwitches
    
  12. Hope for a good luck and invoke FoamX.
    	FoamX
    

Troubleshooting

FoamX locks after showing "Starting NameServer with inet:(hostname):1234 ...".

Make sure you installed the openssh package.

I have trouble opening some of the tutorial cases (but not all).

If the error message says ``The Open Case operation failed due to getApplication::Invalid application class name ****'', this seems to be caused by the lack of config files in some of the solver directories. These solvers (boundaryFoam, dieselFoam, etc.) are not set up to run by FoamX and it is not a cygwin-specific behavior. See here for details.

Is there any way to run FoamX under a csh environment?

Csh-alike shell support is still incomplete (it just barely launches FoamX and paraFoam) in this release but there is a simple workaround. First open a bash shell session and run the followings every time you open a csh session.

  $ source ~/OpenFOAM/OpenFOAM-1.3/.OpenFOAM-1.3/bashrc
  $ exec csh -l
  % FoamX

('$' and '%' each denotes the prompt of bash and csh respectively)

Java 3D crashes when launching patchTool.

The current version of Java 3D (1.5.1) requires OpenGL 1.2 or DirectX9 compliant graphics driver. If your driver does not support OpenGL 1.2 but supports DirectX9 (which is quite unlikely though), Try adding a line

  -Dj3d.rend=d3d

to the last part of ~/OpenFOAM/OpenFOAM-1.3/bin/patchTool so that it looks as follows.

"$jdkhome/bin/java" \
    -cp "$jars" \
    -DFoamX.SystemPath="$WM_PROJECT_DIR" \
    -DFoamX.SystemConfigPath="$FOAMX_CONFIG" \
    -DFoamX.UserConfigPath="$FOAMX_CONFIG" \
    -DFoamX.PatchToolPath="$PATCHTOOL_PATH" \
    -Duser.language=en \
    -Dj3d.rend=d3d \
    PatchTool/PatchTool $orbArgs $args

If neither of OpenGL nor DirectX9 works, try downgrading Java 3D to 1.3.2. The version works with either of OpenGL 1.1 or DirectX 8. In my test, under WindowsXP installed as a guest OS of VMware Player the patchTool only worked with OpenGL mode of Java3D 1.3.2.


ToDo


References

The followings were referred to in porting FoamX onto Cygwin.
  1. mico-2.3.12-secfix1.diff
  2. Building mico on Cygwin
  3. Diff files of the Unofficial OpenFOAM Cygwin Port (for porting strategies to case-insensitive filesystems etc.)
  4. FoamX warning (SOLUTION)

Comments are welcome at this thread or this thread of OpenFOAM message board.

Back to OpenFOAM-related resources