All Products
Search
Document Center

Elastic High Performance Computing:Use OpenFOAM to perform a hydrodynamics simulation

Last Updated:May 26, 2023

This topic describes how to run Open Source Field Operation and Manipulation (OpenFOAM) in an Elastic High Performance Computing (E-HPC) cluster to perform a hydrodynamics simulation.

Background information

Open Source Field Operation and Manipulation (OpenFOAM) is a C++ toolbox designed to develop customized numerical solvers. OpenFOAM provides pre-processing and post-processing utilities that resolve continuum mechanics-related problems, including computational fluid dynamics (CFD). For more information, visit the OpenFOAM official website.

In this example, an OpenFOAM solver named simpleFoam is used to calculate the outflow field of a motorcycle. Sample directory: $FOAM_TUTORIALS/incompressible/simpleFoam/motorBike/.

Preparations

  1. Create an E-HPC cluster. For more information, see Create a cluster by using the wizard.

    Configure the following parameters.

    Parameter

    Description

    Hardware settings

    Deploy a standard cluster that consists of two management nodes, one compute node, and one logon node. All nodes use ecs.c7.large Elastic Compute Service (ECS) instances. Each instance has 2 vCPUs, 4 GiB of memory, and one 2.7 GHz third-generation Intel Xeon Scalable (Ice Lake) processor.

    Software settings

    Deploy a CentOS 7.6 public image and the PBS scheduler.

  2. Create a cluster user. For more information, see Create a user.

    The user is used to log on to the cluster, compile LAMMPS, and submit jobs. In this example, the following information is used to create the user:

    • Username: foamtest

    • User group: sudo permission group

  3. Install OpenFOAM. For more information, see Install software.

    Install the following software:

    • openfoam-openmpi V5.0

    • openmpi V1.10.7

Step 1: Connect to the cluster

Connect to the cluster by using one of the following methods: In this example, the username used is "foamtest". After you connect to the cluster, you are logged on to /home/foamtest by default.

  • Use an E-HPC client to log on to a cluster

    The scheduler of the cluster must be PBS. Make sure that you have downloaded and installed an E-HPC client and deployed the environment required for the client. For more information, see Deploy an environment for an E-HPC client.

    1. Start and log on to your E-HPC client.

    2. In the left-side navigation pane, click Session Management.

    3. In the upper-right corner of the Session Management page, click terminal to open the Terminal window.

  • Use the E-HPC console to log on to a cluster

    1. Log on to the E-HPC console.

    2. In the upper-left corner of the top navigation bar, select a region.

    3. In the left-side navigation pane, click Cluster.

    4. On the Cluster page, find the cluster and click Connect.

    5. In the Connect panel, enter a username and a password, and click Connect via SSH.

Step 2: Run the sample file

  1. Configure the environment variables.

    export MODULEPATH=/opt/ehpcmodulefiles/
    module load openfoam-openmpi/5.0
    module load openmpi/1.10.7
  2. Configure the sample file.

    mkdir /home/foamtest/motorBike
    cp -r /opt/OpenFOAM/OpenFOAM-5.0/tutorials/incompressible/simpleFoam/motorBike/* /home/foamtest/motorBike
    Note

    In this example, the OpenFOAM solver named simpleFoam is used to calculate the outflow field of a motorcycle. Sample directory: $FOAM_TUTORIALS/incompressible/simpleFoam/motorBike/.

  3. Run the sample file.

    cd /home/foamtest/motorBike
    source /opt/OpenFOAM/OpenFOAM-5.0/etc/bashrc
    ./Allrun 

Step 3: View the results

Run the following command to view the output file of the job:

cat /home/foamtest/motorBike/log.blockMesh

The following code provides an example of the returned output.

openform结果..png