Fenics as Solver
Moderator: bernd
Forum rules
and Helpful information for the FEM forum
and Helpful information for the FEM forum
-
- Posts: 14
- Joined: Thu Dec 01, 2011 10:00 pm
Fenics as Solver
Hi!
from the wiki I have seen two possible solvers, namely Calculix and Code-Aster. I'm not quite sure if there has been any itegration done yet.
So I just wanted to throw in a third one:
Fenics Project - http://fenicsproject.org/
It has a really great python interface with which you can formulate your PDEs as you would do on paper.
from the wiki I have seen two possible solvers, namely Calculix and Code-Aster. I'm not quite sure if there has been any itegration done yet.
So I just wanted to throw in a third one:
Fenics Project - http://fenicsproject.org/
It has a really great python interface with which you can formulate your PDEs as you would do on paper.
Re: Fenics as Solver
So far I go for Calculix, but the it will be later on easy to incorporate any kind of solver.
Stop whining - start coding!
Re: Fenics as Solver
I would like to give this a try. But I need some help to get started. What has to be done to add a new solver.
The fenics solver would be a simple object which has a solver-macro property. The function in the macro gets all the necessary data (mesh, bc, material,...). The computation is then done inside of a function. and the result is returned as a dict (for example).
@Bernd. It would be nice if you can provide some information on the files that have to be written to add a new solver. Also I am interested if such a generic approach would work. At the moment I would like to do this only with 2d fem. But it would be nice if this could work with 3d too.
The fenics solver would be a simple object which has a solver-macro property. The function in the macro gets all the necessary data (mesh, bc, material,...). The computation is then done inside of a function. and the result is returned as a dict (for example).
@Bernd. It would be nice if you can provide some information on the files that have to be written to add a new solver. Also I am interested if such a generic approach would work. At the moment I would like to do this only with 2d fem. But it would be nice if this could work with 3d too.
Re: Fenics as Solver
I think Code-Aster is not supported but instead Z88 is integrated in parallel to calculix.
There was also some discussion about integrating Openfoam and Elmer into FreeCAD. This simply shows that the interface should be as generic as possible. Help there helps all others and future integration attempts.
There was also some discussion about integrating Openfoam and Elmer into FreeCAD. This simply shows that the interface should be as generic as possible. Help there helps all others and future integration attempts.
Re: Fenics as Solver
There are a few different levels of abstraction.... The fenics library is more the mathematical approach. It's nice because it's easy to solve any custom pde. Calculix, code aster ... are on a much higher level. Different abstraction need different interfaces.... But with fenics we could add a really generic interface I think. At least for the use cases I can think of.
I like the idea to simple plug a solver as a python file into freecad. This would need some generic boundary condition as well, but I think the bc allready available will do the job as well.
I like the idea to simple plug a solver as a python file into freecad. This would need some generic boundary condition as well, but I think the bc allready available will do the job as well.
Re: Fenics as Solver
I use fenics a lot and like it very much. But it is gpl, so cant be shipped with freecad. Of course it would be nice to have some way. to autogenerate fenic sscripts in freecad. But most important imho is to Export Dolphin meshes. They can include defined Mesh Domains which than can easily be used in Dolphin by Name for boundary conditions etc. That would be awesome!
Re: Fenics as Solver
https://fenicsproject.org/about/#license
Their https://femtable.org/ is also quite niceLicense
All FEniCS core components are licensed under the GNU LGPL as published by the Free Software Foundation, either version 3 of the license, or (at your option) any later version.
All other FEniCS components are licensed under either the GNU GPL or the GNU LGPL, either version 3 of the license, or (at your option) any later version.
Authors and institutions have given their consent to licensing under these terms.
Re: Fenics as Solver
my idea was to have different solvers as python scripts available via the plugin-manager. In the Fem gui one can select one of these solvers. This way there shouldn't be any license problem and also other pde-solvers could be used in the script.to autogenerate fenic sscripts in freecad.
Re: Fenics as Solver
Hey guys. I just started with Fenics, played around a little with it and I am very impressed about its flexibility. Although I am not very experienced with it, I would be very interested in coding an interface for FreeCAD. As far as I understood the FEM workbench in its actual state has "only" support for linear static analysis, modal frequencies and thermo-mechanical analysis ("only" in "" because you did a great work with it! ). I think with Fenics one should focus on non-linear PDEs like fluid mechanics or non-linear static structural analysis (like large deformations or fully coupled, maybe transient, thermo-analysis).
Is there anything done, yet? If somebody sets up a github project, please inform me.
Kind regards
Johannes
Is there anything done, yet? If somebody sets up a github project, please inform me.
Kind regards
Johannes
Re: Fenics as Solver
Hmm, I didn't think about non linear analyses yet, but I think we could try to implement a generic interface which let us do this too.
Basically, what I am thinking of is an implementation of the solver where pre and postprocessing is made in a way it can be applied to any pde-solver or if more generic any geometry processing which results in field-data (scalar and vector). So in the preprocessing we apply attributes to geometry entitis and generate a mesh. This then gets wrapped to node or element level and passed to the generic solver class. This solver class is pure python class (no freecad object) and by subclassing this solver any pde solver can be provided. The solver-class can be choosen in the generic solver (freecad object) from a list. Registering a solver simply adds the class to this list, that is stored somewhere in the fem module. This way a new solver can be created as a macro, at startup with an Init.py file or any other way.
The solver does any calculation on the data and return cell / node - scalar / vector data which then can be used for postprocessing. I don't know if the postprocessing allready has an interface for any data, but if not we can also use the existing data-fields to display any result. (vectors as displacement for example)
The ideal case would be if the solver has everything there and only the processing of field-attributes (bc, constraints, material) and the mathematical side has to be implemented in there.
Basically, what I am thinking of is an implementation of the solver where pre and postprocessing is made in a way it can be applied to any pde-solver or if more generic any geometry processing which results in field-data (scalar and vector). So in the preprocessing we apply attributes to geometry entitis and generate a mesh. This then gets wrapped to node or element level and passed to the generic solver class. This solver class is pure python class (no freecad object) and by subclassing this solver any pde solver can be provided. The solver-class can be choosen in the generic solver (freecad object) from a list. Registering a solver simply adds the class to this list, that is stored somewhere in the fem module. This way a new solver can be created as a macro, at startup with an Init.py file or any other way.
The solver does any calculation on the data and return cell / node - scalar / vector data which then can be used for postprocessing. I don't know if the postprocessing allready has an interface for any data, but if not we can also use the existing data-fields to display any result. (vectors as displacement for example)
The ideal case would be if the solver has everything there and only the processing of field-attributes (bc, constraints, material) and the mathematical side has to be implemented in there.