Shape optimization with SfePy
Hi
I am looking for a framework for prototyping different stuff regarding shape optimization for development and research purposes related to our commercial optimization software TOSCA (www.fedesign.com). I was looking for a python framework with FEcapabilities and found SfePy which I find really exiting.
Now, I've read most of the documentation, seen the fluidshape optimization example (shapeOptim.py) which I have not debugged yet, but I am still missing some bricks to see the whole picture. I think my main problem is that I am missing the understanding the "objects" in SfePy.
Do you have a classdiagram or the like? Relations between problem, elements, nodes, material and terms is unclear for me. I believe you use many function pointers or something like that which throws me off. I have some experience programming Fortran, C++, Perl and some Python and maybe my Python skills are too bad...
Secondly, when I grasp what you are doing, I would like to implement a more general adjoint solver (the fluid problem is assuming selfadjoint or not?). In very general form I would like to: a) append linear adjoint loads (inheriting BCs from primary problem) with respect to my optimization problem, b) solve the primary and the adjoint loadcases c) save the solutions d) calculate sensitivities e) update nodal positions and goto b)
Any helpful comments are very appreciated. Please excuse me if I use some mathematical expressions imprecise or incorrect  I am a mechanical engineer using mathematical methods to solve mechanical problems. The math is cool and interesting but second priority. :)
Best regards
Peter M. Clausen
Hello Peter,
On 08/21/10 12:48, Peter M Clausen wrote:
Hi
I am looking for a framework for prototyping different stuff regarding shape optimization for development and research purposes related to our commercial optimization software TOSCA (www.fedesign.com). I was looking for a python framework with FEcapabilities and found SfePy which I find really exiting.
I think Python is really good for prototyping, good choice!
Now, I've read most of the documentation, seen the fluidshape optimization example (shapeOptim.py) which I have not debugged yet, but I am still missing some bricks to see the whole picture. I think my main problem is that I am missing the understanding the "objects" in SfePy.
Yes, the "big picture" documentation is lacking. This is partly due to the fact that the sfepy.fem module is undergoing quite significant changes right now, so it's API is far from stable. But for the level of usage that you IMHO need it is already mostly done.
It is possible to generate additional documentation that shows the classes and their relationships, if you have doxygen installed. Just type (assuming Linux)
make htmldocs
in the sfepy directory. Then view 'doc/html/index.html'.
I can send you the doc tarball offlist, if that does not work for you.
As for the shape optimization example, it has been somewhat a gray area recently  the code in sfepy works, but the problem description file is missing. I can make a simple example (optimal shape for heat conduction, just the Poisson equation, or unstabilized NavierStokes  not of much use...) and add it to the sfepy repository, if you are interested.
BTW. it uses a kind of freeform deformation to deform the mesh.
 Do you have a classdiagram or the like? Relations between problem, elements, nodes, material and terms is unclear for me. I believe you use many function pointers or something like that which throws me off. I have some experience programming Fortran, C++, Perl and some Python and maybe my Python skills are too bad...
Yes, the doxygengenerated docs should give you that.
 Secondly, when I grasp what you are doing, I would like to implement a more general adjoint solver (the fluid problem is assuming selfadjoint or not?). In very general form I would like to: a) append linear adjoint loads (inheriting BCs from primary problem) with respect to my optimization problem, b) solve the primary and the adjoint loadcases c) save the solutions d) calculate sensitivities e) update nodal positions and goto b)
All this could be done. Depending whether the terms in PDEs you use and their shape sensitivities are in sfepy or not, it could be "easy" or moderately difficult. (By "easy" I mean easy for me :)).
Any helpful comments are very appreciated. Please excuse me if I use some mathematical expressions imprecise or incorrect  I am a mechanical engineer using mathematical methods to solve mechanical problems. The math is cool and interesting but second priority. :)
No problem. It would be great if you would find sfepy useful for your purposes. We need people helping with the code/documentation/debugging. :)
Feel free to ask!
Best regards, r.
participants (2)

Peter M Clausen

Robert Cimrman