Metafor

ULiege - Aerospace & Mechanical Engineering

User Tools

Site Tools


doc:user:tutorials:premiertest

This is an old revision of the document!




Graphical User Interface (GUI)

Introduction

With Metafor, when a new calculation must be started or when an error occurs for some reason, The program must be closed and restarted.

FIXME Comment lancer un test à partir d'un répertoire quelconque.

Running a test with the GUI

Description

To check that all is going well, a first test should be run using the GUI.

Double-click the “Run Metafor” icon on your desktop. The GUI is displayed:

  1. The title bar. It contains the version number of your executable Metafor.
  2. The menu bar. It is useful for managing interface options (File menu / GUI Options) and 3D active display windows (Windows menu).
  3. The toolbar. It gathers the most commonly used commands, such as the “meta ()” button (blue PLAY button) which initiates a Metafor integration.
  4. The python command line : it allows the user to enter Metafor commands by hand or to use Metafor as a simple python interpreter.
  5. The history command window : it allows a quick access to past commands. A contextual menu allows the user to manage the history.
  6. The output python window. It is a contextual menu which allows to print or set different layout options.
  7. The “python path”. It lists all available python modules that can be imported.
  8. The “base”, main Metafor directory. It can be changed to add a new directory to the “python path”. This is very useful to run a test located on a nonstandard path (on another disk for example).
  9. The links. It gathers the last loaded modules for faster access.
  10. The “workspace”. It displays the current directory (workspace). This tab allows, for example, to go search results in a nonstandard location.

Loading a Module

Each Metafor test case corresponds to a python module.

Therefore, the first step usually consists in loading the right module with the “load()” command. This command tells the program that you wish to work with this file, whether for running an integration or viewing results.

To load a module in the GUI, just get it in the “Python Path” tree, right-click on it and choose “Load”.

Alternatively, use the command

load('apps.ale.angleReZoner') 

in the python command line. This command loads the module angleReZoner.py, located in apps/ale.

This command “imports” the module and keeps a pointer to it for subsequent orders. The interface also switches from “Python Path” to “Workspace”. In this view, a working directory (in which the results of the integration are/will be stored) can be chosen. By default, its name is workspace/module_name. If it already exists, this directory is selected by the interface. If not, it will be created at the start of integration. In command line, this is done with the command setDir()

setDir(r'e:\results\angleReZoner')

If the module to load is not in the “Python Path”, a rebase must be performed. To do so, the directory which contains the test case is chosen using the button on the “Base” line of the “Python Path” tab. Doing so, this directory is added to the “Python path”. It is equivalent to starting Metafor from this directory. In command line, this is done with the command rebase()

rebase(r'e:\test_case\test01')

Starting the integration

It is very easy to start an integration, just click on the blue “PLAY” button in the toolbar. You can also type the command :

meta()

This command calls the function getMetafor() from the module previously loaded, and starts the integration. If no working directory was selected, the default name (workspace/test_name) is used. If this directory is not empty, those files are first deleted (a windows will appear to warn you).

Then, the integration opens a 3D graphics window, which will be refreshed during computation. Most display options can be changed using the “Config” button.

It is possible to close the display windows, and reopen them using the “Windows” menu.

When the integration is finished, you MUST restart Metafor to run another test !

Loading results

To load results, the corresponding module must be loaded first, as was done before starting the integration. Then, if the workspace used is the default one, Metafor automatically sets its working directory to it. Otherwise, it must be changed manually, using the workspace window.

Once the right folder is selected, simply locate the FAC files (extension .bfac.gz), choose one and load it with the context menu (“Load Fac”). A viewing window opens and displays the results.

To load other results, repeat the operation with another FAC file. The display window is updated automatically.





Continuing a stopped calculation

For various reasons (power cut, abrupt closure of Metafore…), a simulation may have ended earlier than expected. However, it can be restarted from an intermediate FAC, usually the last one that was written before the breakdown (therefore, several saving points should be planned before running long computations).

This is rather straightforward :

  • load the right module
  • if you do not use the default workspace, set the right working directory.
  • choose the last FAC and restart it with the context menu

The integration starts again from the selected FAC file.







Making a "film" with the results


<html> <center> <embed width=“320” height=“240” src=“http://metafor.ltas.ulg.ac.be/oldsite/flv/flvplayer.swf?file=http://metafor.ltas.ulg.ac.be/oldsite/flv/tuto.flv” quality=“high” type=“application/x-shockwave-flash” /> </center> </html>



To show results in a pleasant way, an “.avi” file, showing the integration over time, can be created.

  • First, increase the number of times that results will be saved on disk. (command setNextTime of TimeStepManager, see Managing Time Steps)
  • Run the test.
  • Load the last FAC file. Set up the scale of displayed scalar values according to their final value. Do the same for vectors, if needed. Then save the graphical options (“Save” button).
  • Restart Metafor, load your module. Click on makeAnimation() in the toolbar. The first time step is displayed, and other display options (such as zoom, camera…) can be adjusted.
  • Press [ENTER] in the python command line. Metafor will then load all FAC files and successively perform screenshots. These are saved in the workspace, format bmp.
  • Finally, use a software like AVIMaker to create the video from screenshots. Ideally, you should use a “lossless codec”, for example Microsoft Video in highest quality.

Metafor in command line

Should you need to run Metafor in command line, open a command line (cmd.exe, or a Unix shell). Then :

  • metafor -help : display help
  • metafor -nogui : start Metafor without the GUI
  • metafor -nogui -run apps.qs.cont2 : run load/meta on apps/qs/cont2.py
  • metafor -nogui myscript.py : execute commands written in myscript.py.

In interactive mode, after metafor -nogui, we find ourselves in a python interpreter where some specific Metafor modules were loaded. To exit Metafor in “text” mode, on Windows, use CTRL-BREAK (a little rough, but that works), or CTRL-Z then Enter on Windows, or finally CTRL-D on Unix.

To run a test :

load('apps.qs.cont2')
meta()

To execute a script (such as postprocessing) :

execfile('myscript.py')

To exit the command line, use CTRL-Z on Windows, CTRL-D on Linux/Unix.


Now, you know how to use the GUI, run a test and display results. We will then learn how to build your own data set :

Python in a nutshell

doc/user/tutorials/premiertest.1420626317.txt.gz · Last modified: 2016/03/30 15:22 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki