Welcome to PyFemtet’s documentation!
Abstract
PyFemtet provides extensions for Femtet, a CAE software developed by Murata Software.
PyFemtet is an open-source library and can be used free of charge for both non-commercial and commercial purposes.
This library is provided “as is” and without warranty of any kind.
A license is required to use the Femtet main body. PyFemtet does not alter the license of the Femtet main body in any way.
Please contact Murata Software for a trial version of Femtet for evaluation purposes.
Important
To users of PyFemtet 0.x
In PyFemtet v1, many functions and arguments have been changed to improve user-friendliness and development efficiency. Please refer to the following page for details.
Main Features of PyFemtet
PyFemtet is a library that provides functionality using the Python macro interface of Femtet. Currently, the only feature of PyFemtet is design parameter optimization, which is implemented as a subpackage pyfemtet.opt.
The optimization feature by pyfemtet.opt has the following characteristics:
Single-objective and multi-objective optimization
Real-time progress display with process monitoring
Parallel computation with multiple instances of Femtet
Result output in easy-to-analyze csv format for Excel and other tools
Examples
Tip
There are more examples in the Examples section.
Simple API
Below is an example of multi-objective optimization. You can set up the problem with add_parameter() and add_objective(), and then execute it with optimize(). For everything else, you can use the regular Femtet macro script. For more detailed examples, please check the Usage section.
from pyfemtet.opt import FEMOpt
def max_displacement(Femtet):
dx, dy, dz = Femtet.Gogh.Galileo.GetMaxDisplacement()
return dy
def volume(Femtet):
w = Femtet.GetVariableValue('w')
d = Femtet.GetVariableValue('d')
h = Femtet.GetVariableValue('h')
return w * d * h
if __name__ == '__main__':
femopt = FEMOpt()
femopt.add_parameter('w', 10, 2, 20)
femopt.add_parameter('d', 10, 2, 20)
femopt.add_objective(max_displacement, name='max_displacement', direction=0)
femopt.add_objective(volume, name='volume', direction='minimize')
femopt.optimize(n_trials=20)

