Balaje Kalyanaraman

Postdoc at Umeå University, Sweden

9 January 2021

# iceFem - A FreeFem package for wave induced ice-shelf vibrations

Happy New Year everyone! 2020 was definitely a difficult and challenging year for all of us and I hope 2021 will be better. In this quick post, I would like to share an update regarding the new project I was talking about in the last post.

To give a quick summary of the last post, I mentioned that was working on building an open-source package based on FreeFem for modelling ice-shelf vibrations. Finally, a detailed version of the code is available for use on the official repository of the package here. I have written this package for a user who knows basic C++ and a little bit of the FreeFem grammar. The details of the repository are as follows

1. The repository has two branches ParIceFem and PyIceFem which contains routines in MATLAB and Python to perform operations like interpolating in the frequency space and visualizing complex numbers. Routines involving the BEDMAP2 package, however is available only in the MATLAB branch since the dataset is available readily for MATLAB. I am currently working on a Python module for the BEDMAP2 interface.

2. The code along with the paper is submitted to the Journal of Open Source Software and at the time of writing this post is currently under review [Update ahead]. The journal publishes articles about research software where the review of the code takes via the issue tracker of the JOSS repository on Github. You can track the review of the paper here and the pre-review issue (now closed) on Github here. I will update this post as soon as I receive the results from the reviewers.

## How to run the code

First, you need to have the full installation of the FreeFem software (including the MPI interface). Then download the package

wget https://github.com/Balaje/iceFem/archive/refs/tags/v1.0.zip -O icefem.zip
unzip -q icefem.zip


To setup and use the package, cd into the package directory, open up terminal and type

export FF_INCLUDEPATH="\$PWD/include"


This adds the include folder the code directory to the FreeFem include-path. The list of macros that implement the main routines of iceFem is located in iceFem/macros.idp. A few test cases are provided in the repository. In the command prompt, type

./genDir.sh 1_SIMPLE5
mpirun -np 4 FreeFem++-mpi -ne -v 0 iceshelf2d.edp -L 10000 -H 800 -h 200 -N 10 -Tr 200 -Ti 0 -iter 0 -hsize 0.04 -isSplit 1


The first command generates the required working directory structure used by the package to store the visualization and matrix data. The second command runs the example script iceshelf2d.edp with the command line parameters specified by the user. You can find the directory structure of the code here. Similarly another example of an iceberg motion (floating elastic plate) can be run

/genDir.sh 2_ICEBERG
mpirun -np 2 FreeFem++-mpi -v 0 iceberg.edp -N1 20 -N2 30 -Tr 40 -L 3000 -H 2000 -h 200 -nev 8 -iter test


Visualization is performed using ParaView which produces the following outputs for the above examples. More test examples are found in the README.md file in the repository.

Relatively simpler examples than the above two are discussed in the manual in the tutorial section and the associated code can be found on the repo here and here. The former solves an ice–shelf vibration problem using linear elasticity and the latter solves an ice–shelf vibration problem using the thin-plate assumption.

## Other Features

As seen from the previous examples, command line arguments can be specified to the program:

mpirun -np 2 FreeFem++-mpi -ne -v 0 simple5.edp -L [LENGTH] -H [DEPTH OF CAVITY] -h [THICKNESS OF ICE]
-N [MESH PARAM]
-Tr [REAL(period)] -Ti [IMAG(period)]
-iter [SOL. INDEX]
-isUniIce [ON/OFF UNIFORM/NON UNIFORM ICE]
-isUniCav [ON/OFF UNIFORM/NON UNIFORM CAVITY]
-isSplit [ON/OFF DOMAIN SPLITTING]
-notchHeight [HEIGHT_FRAC_THICKNESS]
-notchWidth [HEIGHT_FRAC_THICKNESS]
-notchLoc [LOC_FRAC_LENGTH]
-isUniRef [ON/OFF Uniform Refinement]


which enables the user to run the code from external programs like MATLAB. The -iter flag is used to name the solution files where the string [SOL. INDEX] is appended to the files. This can be useful when we perform batch operations with using an HPC system. The dimension of the problem including the finite element space can be changed easily in the program by specifying the macros

macro dimension 2//EOM" (dim=2)
macro fspace 2//EOM" (fespace=P2)


at the start of a FreeFem program. Adding the above two lines solves a 2D problem using P2 conforming finite elements. The program can also be used to model problems involving complex incident frequencies. The complex incident frequencies are used to study resonances in the vibration.

Have a look at the code repository and the manual and let me know what you think. I’ll update this post as soon as I hear back from the reviewers. Thanks!

## Update (13 April 2021)

The review of the paper is complete and the code is available for download. The paper associated with the code can be found in the JOSS website here. It was a cool and fun experience, submitting a paper along with the code to JOSS. The code is definitely not perfect and there is room for a lot of improvements. I have some ideas regarding the directions on where this project can go from here, and I’ll be talking about it quite soon in the next post. See you then!

tags: freefem - fem