Hi Bernd, thank you for this nice example. I've used embedded Python 10 years ago. My code was much less elegant and so I thought that one has to do this nowadays with Pybind11. However, looking into your example it looks like the Python/C API does also the job. For me it helps a lot to see how the Python interpreter is initialized and finalized in problem.hh and how data is converted.
Actually I need a simple Python function for the source term so there are just a few parameters which have to be passed between C++ and Python. Best regards, Leo > Flemisch, Bernd <[email protected]> hat am 09.09.2021 > 12:27 geschrieben: > > > > Hi Leo, > > > we're doing this here: > > > https://git.iws.uni-stuttgart.de/dumux-appl/dumux-turing/-/tree/master/test/stochastic > > I needed the python3-dev package and had to run the executable with > > PYTHONPATH=. ./test_stochastic > > > > Kind regards > > Bernd > > https://git.iws.uni-stuttgart.de/dumux-appl/dumux-turing/-/tree/master/test/stochastic > > > > -- > _________________________________________________________________ > > Bernd Flemisch > IWS, Universität Stuttgart phone: +49 711 685 69162 > Pfaffenwaldring 61 email: [email protected] > D-70569 Stuttgart url: www.iws.uni-stuttgart.de/en/lh2/ > http://www.iws.uni-stuttgart.de/en/lh2/ > _________________________________________________________________ > > --------------------------------------------- > Von: DuMux <[email protected]> im Auftrag von > [email protected] <[email protected]> > Gesendet: Donnerstag, 9. September 2021 11:58:04 > An: [email protected] > Betreff: [DuMux] Using Embedded Python in DuMux > > Dear DuMux developers and users, > > I'm interested to call Python from a DuMux application (embedded Python). > Has anyone tried this before with DuMux? I'm also interested to use embedded > Python in a parallel application in combination with MPI4py. > > Maybe it is a good idea if I open an issue in gitlab and try to add a > small test (dumux/test/python) to check if/how embedded Python works. > > Best regards, > > Leo > > > Im Auftrag > > Dr.-Ing. Leopold Stadler > > -- > Referat Numerische Verfahren im Wasserbau > Abteilung Wasserbau im Binnenbereich > > Bundesanstalt für Wasserbau > Federal Waterways Engineering and Research Institute > Kußmaulstraße 17 | 76187 Karlsruhe > > https://www.baw.de > > > _______________________________________________ > DuMux mailing list > [email protected] > https://listserv.uni-stuttgart.de/mailman/listinfo/dumux > Im Auftrag Dr.-Ing. Leopold Stadler -- Referat Numerische Verfahren im Wasserbau Abteilung Wasserbau im Binnenbereich Bundesanstalt für Wasserbau Federal Waterways Engineering and Research Institute Kußmaulstraße 17 | 76187 Karlsruhe https://www.baw.de
_______________________________________________ DuMux mailing list [email protected] https://listserv.uni-stuttgart.de/mailman/listinfo/dumux
