Welcome to Bender’s UI documentation!

How Bender’s User Interface works:

Let’s try to solve a simple problem - Couette flow of Navier-Stokes fluid. Actually only two files need to be created - a settings file and a problem file.

  • problem: See examples/NS_Couette.py. This file contains formulation of equations in the weak form.
  • settings: See examples/NS_Couette_settings.py. This file contains many settings like solver parameters or material parameters.

When these two files are prepared, preprocessing can be executed with a script called configure. This script does following:

  1. It imports the settings file.
  2. Transfers data from the file into the pool module.
  3. It imports the problem file. The problem is stored inside the core module, e.g. equations in core.Equation.items.
  4. Configuration file for C code is created. Usually it is called test.in. This file is generated from the settings file. The C configuration file is used when executing compiled C code.
  5. C code is generated. Several files in src and include directories begin with word template and UI generates C code from these files. For example, src/eq.c is generated from template_eq.c. When generating the file, UI steps through lines of appropriate template and replaces special sequences according to a special class derived from the Blob class. See blobs module for details.
  6. There is an optional part in the configure file, which visualizes the used grid using the grids module.

Later, when you want to edit some parameter defined in the settings file, change the corresponding settings in the configuration file, which is usually called test.in. If you edit the configuration file, it is not necessary to recompile the C code nor need you to call python if you don’t change time step scheme.

Remember that if you add a parameter in the settings file or a new variable or a function in the problem file, you need to call make clean because of C header files. Then you can build C code with make and then execute as usually. See documentation in the configure script.

The easiest way to learn how to use Bender is probably going through example files in the examples directory.

The only module which is really necessary for using the user interface is the ui module. However, if you want, for example, to visualize grids, a good choice would be to have a look at documentation of the grids module. If you want to express explicitely time level of some variable in a time-discretized equation, you will need to have a look at the utils module. Although you won’t probably use it, there are also some settings in the pool module.

Note that when formulating problems, you can use any functionality of sympy, which is a python computer algebra system incorporated in the ui.

List of modules:

Indices and tables

Table Of Contents

Next topic

ui

This Page