[Contents] [TitleIndex] [WordIndex

GSoC 2017 - OpenFOAM

Student and Mentors

Student Name -

Mentors -

Timeline for GSoC 2017

This timeline is for after the students projects were announced on 4th of May, 2017.

Overview

The main objective of this project is to connect OpenFOAM solver to Scilab. This will give the user a better interface to use computational fluid dynamics(CFD) analysis in Scilab and setup meshes easily. Currently, there are ways to solve a flow equation(using ode) but there is no CFD solver toolbox or module in Scilab. This project will benefit a large fraction of Scilab users as CFD analysis is significant in vast areas like industries, research purpose, etc. The major work will include porting elbow flow demo in OpenFOAM to scilab which will include wrapping the functions in icoFoam solver of OpenFOAM to scilab.

Community Bonding

The community bonding period was from May 5 - 30, 2017.

Tasks

Description

Status

Discussing with mentors the workflow and get a final idea of how to approach the project.

I was advised to concentrate on wrapping an OpenFOAM demo.

Done

Get to know SWIG better

I read the documentations and compiled some examples of SWIG

Done

Understand the code base of OpenFOAM

A good understanding of OpenFOAM is required in order to complete this project.

Done

Coding Period Begins May 30, 2017

My mentor suggested that I should select an already existing OpenFOAM demo to write the wrapper for. I chose the cavity demo solved using icoFoam solver.

Week 1-2 Report (May 31, 2017 - June 14, 2017)

I first started off with wrapping some more complex C++ codes using SWIG (like merge sort, avl tree and so on). After this I tried to formulate a basic implementation of the wrapper for icoFoam. The initial approach I thought :- 1) An interface file will be written for the icoFoam.C code which will have #include directives for all the header files included. I had to include all the header at once as SWIG doesn't read the header files recursively. 2) The interface file will have only the #include directives and an extern command for icoFoam function.

This approach had flaws. First of all there were no source files included. Source files contain the code which describes the classes, struct, etc. which are used in the icoFoam solver. So, then I formulated a different approach in which I tried to compile the source files to get their corresponding object code and then link it with the object code of the wrapper generated using SWIG. But this had its own problems. There is a huge dependency tree in the source files. Hence it is impossible to compile them without using wmake script. To use wmake the dependencies for every class must be stated and hence that is going to take a lot more time than allotted to it. Hence, finally I found an approach that is working. Using the wmake script, every solver can be compiled into an executable which can be called from scilab using unix_w command. This gives the output of the command in the Scilab window. Also using unix_g command the output can be stored in a variable. This will be useful if someone wants to manipulate the output or store it in a logfile. There was a change of plan suggested by my mentor. Now, I won't be wrapping the icoFoam solver. The new set to wrap is:

(1.) Solvers -

(2.) Utilities -

Week 3-4 Report (June 15, 2017 - June 29, 2017)

In the beginning of this period I was stuck with errors in SWIG generated wrapper. But in a conversation with an OpenFOAM user, I was suggested to use the already available bin files in OpenFOAM and compile a statically linked executable which can be run in a Scilab thread. I had to read up about linking of libraries in OpenFOAM. I found that there is still no concrete way to compile a static executable. Hence, I experimented around to get a solution. First, I tried to make changes to wmake script in OpenFOAM but that didn't work. Secondly, I tried compiling the solver with -exe flag but that executable was not working on other systems and hence it was not statically linked. After experimenting more I found a tool named statifier but sadly that didn't work too. At last, Ermine named software helped me generate an executable that runs on any machine. It took a lot of testing to confirm that it works on any linux machine xD In the last days I worked on making scripts that will run the solver on their own.

Current Status

I am currently working on writing a Scilab function with inputs for these solvers. Specifically, working on the feature list of the functions to be implementated

Project repository

Link

CategoryHomepage


2022-09-08 09:27