Running CFDDFC with the Azure Console

  1. Launch a Virtual Machine
  2. Connect to a Virtual Machine
  3. Connect with the Remote Desktop
Azure Setup | Launch in the Console ]

Problem with these instructions? Please send a CFDDFC Support Query.

Logging in with SSH

After you launch a VM, you can connect to it securely using SSH as described below.  On connecting through SSH, the user is greeted with a welcome message and presented with the terminal prompt.

For Linux and Mac OS X, open a terminal window and type the following replacing user with the chosen user name and XXX.XXX.XXX.XXX with the IP address of the VM,

ssh user@XXX.XXX.XXX.XXX

MS Windows users can connect using PuTTY. This involves:

Setting the Environment

After logging in, the user should set the environment for running OpenFOAM, as follows.

  • Find the OpenFOAM installation directory by typing
    ls -d /opt/openfoam*
  • This should return a directory name like /opt/openfoam4
  • Add the sourcing of the bashrc file in the OpenFOAM installation to the user’s .bashrc (note the dot “.”) file by
    echo "source /opt/openfoam4/etc/bashrc" >> $HOME/.bashrc
  • Source the .bashrc (note the dot “.”) file
    source .bashrc
  • Make the $FOAM_RUN directory
    mkdir -p $FOAM_RUN

The OpenFOAM Configuration

OpenFOAM is a collection of 200+ applications that can be executed from the terminal prompt.  The applications include: “solvers” that solve equations to simulate fluid flow; and, “utilities” that perform other tasks needed in CFD, e.g. generation of the computational mesh, initialisation of fields, data manipulation, etc.  The applications can be executed from the terminal prompt, reading from and writing to data files of the problem case.  In OpenFOAM, the case files are stored within a directory, whose name reflects the problem being simulated, in which there are typically 3 further directories, named 0system and constant containing the case files.  Users unfamiliar with Linux can consult our OpenFOAM Linux Guide.

In the OpenFOAM configuration, an environment variable named $FOAM_RUN is reserved to represent a default directory to put OpenFOAM case data. The default directory is $HOME/OpenFOAM/USER-VERSION/run, i.e. $HOME/OpenFOAM/ubuntu-3.0.0/run for USER=ubuntu and version number VERSION=3.0.0. There is also an alias named run that changes directory (cd) to the $FOAM_RUN directory.  The OpenFOAM installation can be found in the /opt directory and example cases are stored in a directory named tutorials within the installation. Another environment variable $FOAM_TUTORIALS is set to represent the tutorials directory.

Testing OpenFOAM

Users can test an example simulation of steady, incompressible, turbulent flow over a backward facing step, named the pitzDaily after authors of a report on experimental data to which the case relates. The test involves 5 steps:

  1. changing to the $FOAM_RUN directory with the run alias;
  2. copying the pitzDaily case files from the tutorials directory to the current directory (denoted in Linux as ‘.');
  3. changing to the pitzDaily case directory;
  4. generating a mesh for the backward step geometry with the blockMesh utility;
  5. running the simpleFoam solver for steady, incompressible, turbulent flow

Execution these steps from the terminal prompt is as follows:

cp -r $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily .
cd pitzDaily

For more information about running cases, see:

Configuring OpenFOAM Applications

Solvers and utilities are configured through the data files in a case directory.  The configuration of a case can be modified by opening a file in a text editor, changing settings and saving the file.  3 popular editors which can work through a terminal are:

  • nano: the easiest of the 3 editors for the purpose, see nano basics guide;
  • emacs: powerful editor that uses a more complex set of key commands, emacs basics;
  • vim: another editor with arguably a less familiar set of key commands, see vim quick guide.

It is worth knowing the command to exit the editor you use in case a problem arises:

  • nano exits with C-x (C=Control key)
  • emacs exits with C-x C-c (preceded by C-g, if needed)
  • emacs exits with ESC :q!

The user may, for example, open the fvSolution file in the system directory in one of these editors, e.g. nano by

nano system/fvSolution

The user may edit the residualControls as follows, then exit with C-x, saving the file (Y)

    p    1e-3;
    U    1e-4;
    "(k|epsilon|omega|f|v2)"    1e-4;

The user can then restart simpleFoam from the previous solution. For more information about configuration of case files, see:

Transferring Data to/from the Cloud

The user will likely at some point wish to copy data files to and from Azure.  On Linux and Mac OS X data can be transferred by accessing VMs with Linux secure copy (scp). Copying a file named foo.txt from the home directory on the VM back to the local machine would be:

scp user@XXX.XXX.XXX.XXX:~/foo.txt .

Copying a file from the local machine to the home directory of the VM would be:

scp foo.txt user@XXX.XXX.XXX.XXX:~/

MS Windows users have an equivalent option with PuttY secure copy (pscp)

Next Step → Remote Desktop