python in opera fea · eugm 2014 cobham technical services python in opera fea introduction •from...
TRANSCRIPT
FEA ANALYSIS
General-purpose multi-physics design and analysis software for a wide range of applications
INTEROPERABILITY
Built-in circuit modelling and interfaces to leading CAD packages
SERVICE
Technical support, training and consultancy services available for software usage and applications
OPTIMIZER
Automatically selects and manages multiple goal-seeking algorithms
Python in Opera FEA Arturas Venskus, Danail Vassilev, Alex Coleman
30th Anniversary Event
Cobham Technical Services EUGM 2014
Python in Opera FEA
Contents
– What is the Python?
• Introduction
• Code snippets
– Python in Opera FEA
• New PYTHON command
• Opera FEA python interface
• COMI & Python
• Client server
• Matplotlib
– 2d rotational motion example
• Problem description
• Steady State Detection
• Wavelet Transform
• Wavelet analysis of simulation data
• Live demo
– Conclusions
1
Cobham Technical Services EUGM 2014
Python in Opera FEA
Introduction
• From www.python.org: Python is a programming language that lets you work quickly and integrate systems more effectively; Python is powerful... and fast; plays well with others; runs everywhere; is friendly & easy to learn; is Open
• Python supports multiple programming paradigms, including object-oriented and procedural programming
• Widely used in mixed programming environment as scripting and gluing tool
• Comes with batteries included – Python Standard Library
• Becomes de facto standard for scientific and engineering computations
• Very large ecosystem of accompanying 3rd party high quality open source and commercial python libraries for scientist and engineers
• CAD/CAM/FEA/PLM software exposes their interfaces to the python
2
Cobham Technical Services EUGM 2014
Python in Opera FEA
Code snippets
3
Python class
Python strings
Python string methods:
• str.capitalize() • str.count • str.find • str.format • str.lower() • str.upper() • …
Python lists (vectors)
File handling
Python dictionaries
Cobham Technical Services EUGM 2014
Python in Opera FEA
New PYTHON command
4
PYTHON command=‘python statement’ PYTHON file=‘python_script_file.py’
Cobham Technical Services EUGM 2014
Python in Opera FEA
Python module interface
5
PYTHON command=‘import OPERAFEA’ PYTHON command=‘ofea = operafea.interface()’ PYTHON command=‘print dir(ofea)’ … 'addConstantUsrVar', 'addEquationUsrVar', 'addModelDimUsrVar', 'addParameterUsrVar', 'command', 'getUsrVar', 'getUsrVarDescr', 'getUsrVarExpr', 'getUsrVarStr', 'output', 'removeUsrVar‘ …
Embedded Opera FEA python module Usage example
rectangle.py
Cobham Technical Services EUGM 2014
Python in Opera FEA
COMI & Python
6
COMI script Python scripting
COMI can call Python, Python can call COMI
Cobham Technical Services EUGM 2014
Python in Opera FEA
Client-server
7
Python and interprocess communication (IPC)
Opera FEA Mutliphysics Suite Framework • numpy/scipy Arrays, Matrices, Complex numbers
• matplotlib Advanced
3D plot
• OpenTURNS, EDF
Sensitivity analysis
• H5PY HDF file handling
• Dacota (Sandia Lab)
Optimisation
• OpenFOAM CFD
• Code_Aster, EDF
Structural and Thermal FEA
• EnSight
• SALOME PRE/POST
Cobham Technical Services EUGM 2014
Python in Opera FEA
Matplotlib
8
• Opera B field
• Maplotlib 3D B field
•Maplotlib samples
Cobham Technical Services EUGM 2014
Python in Opera FEA
2D rotation motion example
– RM Analysis
– Analysis purpose is detection of steady state by using Python wavelet library
Python script (IPC), Wavelet lib
Solver
Control COMI
9
Cobham Technical Services EUGM 2014
Python in Opera FEA
Our analysis requires ability to:
• remove the noise if present
• detect statistical changes (e.g. mean)
• detect periodic event and estimate its parameters (frequency or period)
Need most suitable representation of the simulation data in order to extract useful features.
Steady State Detection
10
Cobham Technical Services EUGM 2014
Python in Opera FEA
Wavelet Transform
• Express signal/data in terms of basis functions with short duration – wavelets.
• Wavelet transform provides both time and scale(frequency) information. Useful for analyzing non-stationary signals, denoising, detects abrupt changes, compresses data.
11
Cobham Technical Services EUGM 2014
Python in Opera FEA
Wavelet power density of two sinusoids with periods 120s and 36s. The algorithm captures accurately the periods and the localisation of the modes.
Wavelet analysis of simulation data
12
Cobham Technical Services EUGM 2014
Python in Opera FEA
Conclusions
13
• Object oriented programming in Opera
• Advanced string handling in Opera scripts
• Arrays, vectors and all python data structures in Opera scripts
• Complex numbers in Opera scripts
• Fast prototyping of ideas
• Easy connection to the 3rd party libraries and software