Scientific Software Development (Dam Break Simulation) 

Scientific Software Project

I’ve been working on a scientific software development project for many years. This scientific software development project was inspired by my work in a technology transfer (University-Industry) and my experience in different software development projects in ndustrial simulation applications.

Prototype Physics Algorithm

Project in open channel flow simulation (validate mathematical model on real complex case). One thing that we missed was a tool that could help us to prototype rapidly on a simpler model.Scientific software development impose two important requirements: flexibility and extensibility.  

A key element in numerical simulation is the selection of numerical algorithm for the problem at hand. This is particularly true in an industrial project; it is often necessary to change a model or algorithm for the sake of correction or improvements during the development or execution of a numerical simulation. There are several different reasons for wanting this: (unstable solutions, solutions that are mathematically correct but physically incorrect, or solutions that are not accurate enough).  

Before running extensive 2D simulation, there is a prototyping phase in which we explore different alternatives. The common practice is validating these numerical schemes on one-dimensional problems that we know the solution. The 1D dam break is a very useful benchmark test with a known exact solution. It provides extreme conditions to assess the numerical stability of the model. The numerical treatment of the mathematical terms of the governing equations is of paramount importance to get accurate results. We want to combine different numerical treatment for each of these terms as well as numerical methods.

One of my colleagues had developed a program to be used in simpler cases but it was difficult to modify and to extend to adapt to new uses, models, and solution procedures. Decided to re-factor the code by using an object-oriented approach OOP (Object-Oriented Programming).

Software development

OON (Object-Oriented Numeric) Methodology

OOP is an appropriate tool in the context of numeric (scientific software development). In effect, numerical problems are often well suited for formulation in an object-oriented framework. This is not only true for the design of overall system structures, but also at the algorithmic level concepts from OOP lend themselves naturally to the design.   

Task: to develop a programming environment for the rapid prototyping of physics-based algorithms with emphasis on reusability and extensibility of software component. 

Mathematical Abstraction (Design) 

The design process is often recognized as the most important phase of OOP. In general, this process consists of identifying and grouping local entities, i.e. making useful abstractions of the problem at hand.  In the context of numeric, the logical entities are often readily available in the form of mathematical abstractions. Thus, large parts of the design are already inherent in the underlying mathematical structures.   

The scientific software architecture that I have developed uses OON (Object-Oriented Numeric) in the context of finite-difference and finite volume numerical method.

The code uses inheritance to group similar data structures and procedures into families that share some elements and that are, in appropriate contexts, interchangeable. According to the variety of numerical methods, a large variety of solutions is employed, despite the differences, most algorithmic developments share many common aspects. Polymorphism, key concept of OOP, allows the same operation to behave differently in different classes and thus allows objects of one class to be used in place of those of another related classes, thus implementing the “one interface, multiplied method” philosophy. In rapid prototyping environments this is a desired feature to flexibly combine different numerical (treatment discretization) without disturbing the principal mathematical steps (of the algorithm).

The net result is a scientific code that is extremely flexible and easy to maintain.  

UML Methodology 

Physicists represent the process of diffusion (interaction) of particles by Feynman diagrams. In software development we represent abstractions and their relationship by UML (Unified Modeling Language) diagrams. 

Use Case (Requirements) 

You determine exactly what you want your program to do before you begin developing it. If you don’t have a good grasp of the requirements, your initial software will have only the most basic features and won’t be sufficient to support your simulation. You could add various capabilities to the program while developing your software. Why not get it right from the start? 

Scientific software practice Use case diagram to express user interaction with the system  requirements.

Requirements are represented by the Use Case Diagram. This diagram express user interaction with the system. How it’s going to be used. Impact on the design of the overall system.

Class Diagram 

Mathematical concept (abstraction) can be expressed in the UML language called class diagram. Central to the UML notation is the concept of class data. This modelling technique allows description of a system using the same terminology as the corresponding real-world objects and their associated characteristics.  

This diagram shows the global picture of one component of the application. you don’t have to know the details of it, but how components interact and the effect of change on one could affect others.

Scientific software architecture showing relationship between concepts
Dam Break Class diagram

Read More

Jean Belanger (Senior Physics and Scientific Programmer)

Jean Belanger is a scientific programmer who act as a contractor and consultant in the IT industry for the last 25 years. He is also responsible for the development of the DamBreak++, a programming environment aimed to understand physics via modern modeling techniques and using new software development paradigms.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *