Harmonic Fluids

ACM SIGGRAPH 2009

Lib for Fluid Radiation Solve

 

This is a preliminary version of the library for solving the fluid sound radiation problem. The main purpose of it is to demonstrate the implementation of the fluid sound radiation solve described in our paper "Harmonic Fluids" at SIGGRAPH 2009.

The code provided in this page is a cluster-based parallel implementation. It runs as a Remote-Procedure-Call (RPC) service running on a group of clusters. The fluid/bubble simulation running in a separated process generates bubbles at each time step, and invoke this service to compute the transfer function expansion coefficients for each bubble. Please see the paper for detailed algorithm. On each cluster, this code also utilizes multiple-cores to achieve local parallelization.

The code is released under GNU GPL license.

Download

The current version is the 0.1 Beta. You can download the source code from Here

Compile the code

The code is compiled on Linux. I haven't yet tested it on Windows/MacOS.

Required Packages:

    1. SUN RPC (ONC/RPC) libraries and utilities. It should be already included in regular Linux distribution. You can check if the RPC service is running on your system by running the following command in a terminal.
    2. rpcinfo -p localhost
      
    3. Boost Libraries
    4. CBLAS library and LAPACK with a C Header wrapper. Currently on Linux, the code is using Intel MKL. On MacOS, you can also use Apple's BLAS/LAPACK implementation, i.e. Vector Libraries.
    5. OpenMP libraries (Optional). OpenMP is supported by most of the mainstream compilers right now. If there are multiple-core processors on cluster, enable it can get better performance.
    6. CMake is used to compile the code.

Compile it:

After download the package, unzip it. Go into the directory and create a sub-directory for building

cd hfsvcd-0.1beta/

mkdir linux-build && cd linux-build

Then run cmake for configuring the Makefile. There are a couple of options.

If the configuration successes, you can compile it by using make. After compiling it, the executable is ./src/hfscvd based on your current directory.

Use it

In this section, I'm going to describe how to use this computation service, and how to integrate it into your own fluid/bubble simulation. You need to read the details in the paper to understand the code.

Run the computation service:

After compiling the code, the generated executable is called hfsvcd. Run the following command to get help information

./hfsvcd -h

After compiling the code, the generated executable is called hfsvcd. Its arguments accept the following options.

-d Run the service as a daemon process.
-c <buffer length> Specify the local buffer length.
-l <log file> Specify the file name for the log file.

Format of the RPC arguments and returns:

Solving for the fluid sound radiation:

The core part of this code is the implementation of a dual-domain fluid sound radiation solver. Most of them are implemented in the file src/cluster/MultipoleSolver.cpp, where the least-square problems are assembled. The QR-based ridge-regression(Tikhonov regularization) solution is implemented in src/linearalgebra/LeastSquareSolver.hpp.

Scheduler for solving:

When the hfsvcd service are running on a group of clusters, a scheduler is required in fluid simulation to determine that on which cluster the computation service should be invoked. I implemented a basic schedule algorithm in JobDispatcher.hpp JobRunner.hpp and JobScheduler.hpp. It always chooses the cluster with least computing jobs in queue for the next radiation solve, implemented using a producer-consumer mode.