Installation


For full functionality Swift must be installed on Windows 10 (build 1607+ or higher).  This is because Windows 10 includes the ability to run a dedicated Ubuntu 14.04 LTS system within it under a new feature called the "Linux Subsystem for Windows" or sometimes also called "Bash for Windows".   This is a new feature built into Windows 10 and it works very well for interoperability. 

It is faster, easier, more compatible and better supported than running Virtual Machines or specific windows-builds of OpenFOAM like BlueCape etc.  This is now the default platform that I will use to support OpenFOAM on Windows as it is the fastest and most IT-friendly method that I have come across.

Install Bash for Windows

Follow instructions outlined here:

https://msdn.microsoft.com/en-us/commandline/wsl/install_guide

NOTE 1: When you go to Settings -> Update and Security -> For developers and activate "Developer Mode" then you may get an error message that appears below in RED.  You may ignore this error message and the installation proceeds as normal.

NOTE 2: If you have the option to install from a selection of multiple distributions then I suggest that you install Ubuntu 14.04LTS as this supports the most versions of OpenFOAM.  However, some users have reported that new versions of Windows 10 are forcing them to install Ubuntu 16 only.  If this is the case then you can only install OpenFOAM 5 and 4 using the package manager method described below.  As of v0.1.1 Swift now supports multiple versions of OpenFOAM and you should be able to use either OpenFOAM version 2.x or OpenFOAM version 5.x. Therefore using Ubuntu 14.04 or 16.04 should be fine.

When you get to "Enable the Windows Subsystem for Linux Feature" then:

  1. Open "all programs" in the start menu and scroll down to Windows Powershell
  2. Right Click on the Windows Powershell launcher and select "Run as Administrator"
  3. Paste the command "Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux"

Install OpenFOAM on the Linux Subsystem

As of v0.1.1 Swift includes support for multiple versions of OpenFOAM.  However only versions 2.x and 5.x are tested so far.  You may use other versions of OpenFOAM if you like, and swift may work with these versions by default.  However they are not tested. 

To install OpenFOAM Linux Subsystem follow these steps:

  1. Open a command prompt in windows and then type “bash” to get into the Linux subsystem
  2. You can install OpenFOAM using instructions for Ubuntu from here (https://openfoam.org/download/archive/) with these commands:
    • sudo add-apt-repository http://dl.openfoam.org/ubuntu
    • sudo sh -c "wget -O - http://dl.openfoam.org/gpg.key | apt-key add -"
    • sudo apt-get update
    • NOTE: if you dont know your version of Ubuntu that is installed on the Linux Subsystem then you can check it by typing "lsb_release -a" into the bash terminal.
    • If you have installed Ubuntu 14.04 on the Linux subsystem then you can install any version of OpenFOAM using the following commands
      • sudo apt-get install openfoam240
      • OR
      • sudo apt-get install openfoam5
    • If you are installed Ubuntu 16.05 on the Linux subsystem then you can only install OpenFOAM v5 or v4 (version 5 is recommended):
      • sudo apt-get install openfoam5
  3. These extra libraries are useful/needed to run blender etc.
    • sudo apt-get install gcc-multilib
    • sudo apt-get install g++-multilib
    • sudo apt-get install build-essential
    • export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
    • sudo apt-get install --reinstall libsdl1.2debian
    • sudo apt-get install libglu1-mesa
    • sudo apt-get install libxi6 libgconf-2-4
  4. Add the following line to the bottom of your $HOME/.bashrc file so that OpenFOAM is sourced and ready to use every time you start a new terminal window:
    • source /opt/openfoamXXX/etc/bashrc (where XXX is your installed version number above)

Install the ODS OpenFOAM Extensions

  1. Run the following commands in a bash prompt:
    1. cd ~
    2. mkdir git
    3. cd git/
    4. git clone https://github.com/ODSEngineering/foamExtensions.git
    5. cd foamExtensions
    6. git checkout OpenFOAM-v5.x
    7. export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu/
    8. chmod -R 0766 .
    9. ./Allwmake

Install Swift

  1. This assumes you already have Rhino 5 and Grasshopper installed.  If not then install these requirements first.
  2. Download the latest version of Swift from here: https://www.ods-engineering.com/tools/ods-swift/
  3. Start Rhino and Grasshopper and drag-and-drop the .gha file onto the Grasshopper canvas.  You should see the ODS menu appear at the top.

Install a free license key file

  1. From the "Example Files" on the ODS Swift homepage download the file called "Install/Register", or alternatively
    • On a blank Grasshopper panel drag and drop the ODS -> Registration Key component (with an icon of a key)
    • Connect a Panel component to the output called "status", this should give you a message indicating the status of the license and also a copy of the instructions below in case you need to acquire a new license.
    • Connect a Panel component to the output called "local credentials"
  2. Right-click on the panel showing the output from "Local Credentials" and select "Copy Data Only"
  3. Go to "www.ods-engineering.com/tools/ods-swift/license/key" and paste the key into the text-box on that page and press the "Validate" button.
  4. If you have success then select and copy the text key that is returned to you on that page
  5. Return to Grasshopper and paste the text into the panel input on the Registration component called "verifiedKey"
  6. Connect a boolean toggle to the input labeled "system install".  If true this will install the license key to a file at the system level for all users.  If you do not have permission to do this then toggle this to "false" and it will install the key to your local User/AppData folder, however other users on the same machine will need to install the key into their own local folders too.
  7. Connect a button to the input labeled "writeKey" and and press it.  This should write the key file and install it to the relevant location.
  8. Activate the "refreshKey" input to refresh the license key.  The output message should show success.   Restart Rhino/Grasshopper now.