[Gmsh] Python scripts as onelab solvers

Christophe Geuzaine cgeuzaine at uliege.be
Fri Dec 6 10:18:49 CET 2019



> On 5 Dec 2019, at 23:29, Max Orok <morok at mevex.com> wrote:
> 
> Hello all, 
> 
> I believe you can only use executable files as Gmsh solvers. 
> Would there be any interest in using Python scripts as solvers directly? 
> Perhaps there's a clever workaround used right now. 
> 
> From the GUI, I'd like to be able to:
> 	• add a python solver to the solver list 
> 	• have that solver modify the gui window with onelab parameters, like exec solvers do currently

Sure : see for example https://gitlab.onelab.info/doc/tutorials/wikis/Double-pendulum-model-in-Python


> I know about the custom_gui.py demo, but believe it requires users to start it from the command line. 
> 

No, you can also run it like any other python script.

The two approaches are complementary :

- with the first you can use the binary Gmsh app ; all communications are done through a socket, so you can have a proprietary (python) solver if you wish

- with the second you interact with the Gmsh lib directly in the same memory space: it's more powerful but in effect you create a "new" Gmsh app, bound by the GPL license.

Christophe


> Maybe this could be a more portable option for distributing solvers or reduce the barrier to writing one? 
> 
> Thank you, 
> Max 
> 
> -- 
> Max Orok
> Contractor
> www.mevex.com
> 
> 
> _______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

— 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine






More information about the gmsh mailing list