Authors
-
Luca Berti
-
Vincent Chabannes
-
Laetitia Giraldi
-
Christophe Prud’homme
The directories contain the supplementary material to reproduce the results of the paper "Benchmarking rigid bodies moving in fluids using Feel++", see https://hal.science/hal-03835136
The benchmarks can be run from a Linux Ubuntu 20.04(focal) or 22.04(jammy) system or with a docker container.
We used Feel++ v110 which can be cited as follows
The development version v110 can be used as well.
The installation procedure of Feel++ is described here.
See https://docs.docker.com/engine/install/ for the procedure
First clone the article complementary material
$ git clone https://github.com/feelpp/article.fluid_rigid_body_ale $ cd article.fluid_rigid_body_ale
If you want to use docker, run the following that will mount the current directory of the top level folder of the article
$ docker run --rm -it -v $PWD:/mnt ghcr.io/feelpp/feelpp:focal
You then have a prompt from docker ubuntu focal
feelpp@dda2cfdd6120:/$ ls /mnt README.adoc cylinder_2d ellipsoid_2d ellipsoid_3d fluid.py sphere feelpp@dda2cfdd6120:/$ cd /mnt
To run the benchmarks using 4 mpi processes
mpirun -np 4 feelpp_toolbox_fluid --case sphere
mpirun -np 4 feelpp_toolbox_fluid --config-files ellipsoid_3d/dev/C1.cfg ellipsoid_3d/dev/pcd.cfg
mpirun -np 4 feelpp_toolbox_fluid --case ellipsoid_2d
mpirun -np 4 feelpp_toolbox_fluid --case cylinder_2d
All information of a simulation are stored in a directory whose path is given at the end of the execution. Considering the terminal at the end of the simulation of the cylinder:
+---------------------------------------------------------------------------------------+
| application_fluid |
+---------------------------------------------------------------------------------------+
| +-------------+---------------------------------------------------------------------+ |
| | logs | /home/feelpp/feelppdb/toolboxes/fluid/cylinder_2d/np_4/logs | |
| +-------------+---------------------------------------------------------------------+ |
| | journal | /home/feelpp/feelppdb/toolboxes/fluid/cylinder_2d/np_4/journal.json | |
| +-------------+---------------------------------------------------------------------+ |
| | directories | +--------------------------------------------------------+ | |
| | | | /home/feelpp/feelppdb/toolboxes/fluid/cylinder_2d/np_4 | | |
| | | +--------------------------------------------------------+ | |
| | | | /mnt | | |
| | | +--------------------------------------------------------+ | |
| +-------------+---------------------------------------------------------------------+ |
+---------------------------------------------------------------------------------------+
one can notice that the path of the directory is given by: /home/feelpp/feelppdb/toolboxes/fluid/cylinder_2d/np_4.
The files used to reproduce the paper results are the folder labeled "fluid.exports" allowing to visualize the simulation using Paraview, and the "values.csv" file in the "fluid.measures" folder storing the results of the simulation in form of columns, i.e. each column stores the values of one quantity for each time instant.
To read and store the quantities of the csv files, one uses the library Pandas of Python:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Read and store csv
data = pd.read_csv("values.csv") #Read csv file
data.columns = data.columns.str.strip()
xcm = np.array(data["Quantities_body_p1_mark.mass_center_0"])
ycm = np.array(data["Quantities_body_p1_mark.mass_center_1"])
rot = np.array(data["Quantities_body_p1_mark.rigid_rotation_angle"])
time = np.array(data["time"])
The last four lines store the quantities of interest using the column name. For the graphs shown in the paper, one requires the following quantities:
-
mass_center_0: x-coordinate of the center of mass
-
mass_center_1: y-coordinate of the center of mass in 2d and z-coordinate in 3d
-
rigid_rotation_angle: rotation angle
-
time: time instant
The name of each column is defined by the name of the quantity, followed by the name given to the body. For the previous example, the name given to the body is Quantities_body_p1_mark.
Finally, one can plot the quantities. The following code allows plotting the graphs by defining x, y and the labels:
# Plot results
figure, axis = plt.subplots(figsize=(15,10))
axis.plot(time,ycm,label="Paper results") # Plot y=ycm versus x=time
axis.set_xlabel("Time") # Define x label
axis.set_ylabel("ycm") # Define y label
axis.legend(loc='best')
This example shows the evolution of the y-coordinate of the cylinder center of mass versus time.