OpenFOAM is one component of a free, open source system for engineering/science simulation that includes the Linux/UNIX operating system (OS). Windows is a non-free OS so cannot contribute to an open source system. Nevertheless, there are users wishing to run OpenFOAM who only have access to a computer running Windows. For those users, one option is to install virtual machine (VM) software within the host Windows OS. A VM can then be created running the Linux OS as a guest in which OpenFOAM can be installed.
The following quick start guide describes how to install VM software in Windows and create a VM in which Ubuntu Linux and OpenFOAM can be installed. The guide describes the use of Oracle® VirtualBox VM software since it is open source and has a good level of functionality. The method has been tested for both the Windows XP and Windows 7 OSes on 32 bit systems.
The first step is to download and install Oracle VirtualBox. The user should go to the VirtualBox download page and, under VirtualBox binaries, select the download for Windows hosts and install the software.
Once the software is installed, the user should launch VirtualBox and select New (top left corner) to create a new VM. In the New Virtual Machine Wizard screen, click Next.
On the next screen the user needs to name the VM and select the guest OS. In this example, we name the VM OpenFOAM and select Linux and Ubuntu for the OS specification, as shown below. Click Next.
The next screen allows the user to select the memory (RAM) that your host system (Windows) will allow the guest system (Ubuntu) to use. It is not critical to select the optimal value now, because it can be modified later, but the user should try to choose something that balances the demands of both the host and guest system. Ideally, a value of 1.5 GB or above is recommended for the VM otherwise it may run too slowly. In the next Virtual Hard Disk menu, the user should use the default options (Boot Hard Disk and Create new hard disk). Click Next.
The following screen is the welcome screen of the Create New Virtual Disk Wizard. Click Next then, when prompted, select the default hard disk — Dynamically Expanded Storage — which will cause the disk space taken by the VM to be scaled dynamically as required.
The following screen asks for the location and size of the VM. Leave the location as it is but change the size from the fairly low default 8 GB to something larger, e.g. 25 GB. In the final screen, check the summary and, if it is OK, click Finish to complete the installation.
The next step is to install Ubuntu Linux. The user must first download an ISO image of the Ubuntu distribution by going to the Ubuntu download page. The user can choose the current version or the long term support (LTS) 10.04 version.
After the ISO file, e.g. ubuntu-10.04.3-desktop-i386.iso, has been downloaded, start the OpenFOAM VM by clicking the green Start arrow at the top of the VM window. This opens the First Run Wizard, where the user should click Next to begin installation of the guest OS. The next screen allows the user to select the install media. i.e. the ISO image. Click the small folder icon on the right of screen, navigate to and select the Ubuntu ISO file, and click Open. Once the ISO file has been selected in the Media Type as shown below, click Next.
The Ubuntu installer will start and the Ubuntu install wizard guides the user through the installation. The user can consult Ubuntu Documentation for further help, but of particular importance, is that the user will be given the option to use the entire disk or a user specified setup. Choose to use the entire disk, since this is only the space we assigned the VM. After the installation script of Ubuntu has finished, the system asks to reboot the VM. Once the system has rebooted, the user can log in to Ubuntu.
It is worth installing Guest Additions which provides additional functionality, particularly file-sharing between the host and guest OSes.
With the VM running, click Devices at the top of the VM window and select Install Guest Additions. This will mount media containing the Guest Additions as a virtual CD named VBOXADDITIONS…, in the Ubuntu desktop. The user will then either be prompted directly to Open Autorun Prompt or will need to click on the virtual CD icon to be prompted. The user should Accept which will launch a script in a terminal which requires their user password to run. Once run, the user must press the return (enter) key as instructed.
Finally, from the drop down menu, select System->Administration->Update Manager to update the Ubuntu OS. Once completed, shutdown the VM and reboot the HOST machine to enable the Guest Additions installation to take effect.
To install OpenFOAM in the Ubuntu Linux Virtual Machine, the user should follow the instructions on the Ubuntu Deb Pack Installation page.
Once the user starts to use the Ubuntu VM, it is likely that he/she would like to save or move files from the Ubuntu VM to the Windows host filing system. For example, the user may wish to have the an OpenFOAM directory on Windows that can be directly accessed from the Ubuntu VM. Below we describe how to set that up by enabling file sharing between the host and guest OSes.
Step 1: Create a new OpenFOAM directory (folder) on Windows, e.g. in C:\. Once created, set the permissions to Read/Write access by hovering the cursor over it, clicking the right mouse button and modifying the settings as necessary.
Step 2: Enable file sharing on the new C:\OpenFOAM directory by selecting Shared Folders… from the Devices drop-down menu on the top-left of the VM. The Shared Folders dialog box appears in which the user should click the add folder button (blue folder with green plus). The user should then select the C:\OpenFOAM directory on the Windows host system. The Auto-mount and Make Permanent boxes should be checked but Read-only should not be checked as shown below. Click OK in the Add Share and Shared Folders dialog boxes.
Step 3: In the Ubuntu VM, create a new OpenFOAM directory, e.g. by opening a terminal window (Applications->Accessories->Terminal) and typing:
Step 4: From the VM, mount the C:\OpenFOAM directory on Windows by typing in the terminal
Step 5: Finally, in order to exchange files freely, the user should be a member of the VirtualBox group, named vboxsf, in the Ubuntu VM. This can be done either through the interface from the Administration->Users and Groups menu, or simply by opening the /etc/group file in an editor by typing
For more information about shared folder access, see the following How-To page.