Code Monkey home page Code Monkey logo

article.fluid_rigid_body_ale's Introduction

Benchmarking rigid bodies moving in fluids using Feel++ Supplementary Material

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++"

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

Christophe Prud'homme, Vincent Chabannes, Thibaut Metivet, Romain Hild, Trophime, Abdoulaye SAMAKE, Thomas Saigre, Philippe Ricka, & Luca Berti. (2021). feelpp/feelpp: Feel++ V109 (v0.109.0). Zenodo. https://doi.org/10.5281/zenodo.5718297

The development version v110 can be used as well.

Feel++ Installation

Install Feel++ in Ubuntu 20.04 or 22.04

The installation procedure of Feel++ is described here.

Install Dockler if needed

Pull the docker container

Pull the docker image
docker pull ghcr.io/feelpp/feelpp:focal

Run the benchmarks

First clone the article complementary material

Clone 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

Falling sphere in a Stokes flow
mpirun -np 4 feelpp_toolbox_fluid --case sphere
Falling 3D prolate ellipsoid in a Stokes flow
mpirun -np 4 feelpp_toolbox_fluid --config-files ellipsoid_3d/dev/C1.cfg ellipsoid_3d/dev/pcd.cfg
Falling 2d ellipsoid in a Laminar flow
mpirun -np 4 feelpp_toolbox_fluid --case ellipsoid_2d
Falling 2d cylinder in a Laminar flow
mpirun -np 4 feelpp_toolbox_fluid --case cylinder_2d

Reproduction of paper results

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.

article.fluid_rigid_body_ale's People

Contributors

lberti avatar prudhomm avatar vincentchabannes avatar vlceline avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

article.fluid_rigid_body_ale's Issues

testcase falling ellipsoid 2D

Verify that the results are correct also in docker
add instructions to plot the figures in python
use pandas to load the csv file and make a plot similar to the paper

testcase falling cylinder 2D

Verify that the results are correct also in docker
add instructions to plot the figures in python
use pandas to load the csv file and make a plot similar to the paper

Docker instructions not working

The Docker instructions in the README file are not working.
When trying to download the image with
docker pull ghcr.io/feelpp/feelpp:v0.110.0-alpha.3-focal
I get the error "Error response from daemon: Head ghcr.io/feelpp/feelpp:v0.110.0-alpha.3-focal denied denied".

When downloading another image, like feelpp:latest, and running the commands to launch the python file, it is said that the Python Feelpp module is not found.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.