Fenics as Solver

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Fenics as Solver

Post by bernd »

joha2 wrote:Ah I see your point :mrgreen:. Thanks for the file! So in principal I have to check for the second order elements to be sure whether there is a second order mesh or not.
Yes. There is nothing in python AFAIK. If you gone write some def we could add it to FemMeshTools.py right under https://github.com/FreeCAD/FreeCAD/blob ... s.py#L1319
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Fenics as Solver

Post by bernd »

joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: Fenics as Solver

Post by joha2 »

After splitting the import/export code into several files I have the problem of open which was renamed to pyopen. If there is any import/export in the same file, I know that I have to substitute open by pyopen. But now the situation changed. The open is accessed in another name space/module. So it is still necessary to reference to pyopen? I think not, because the open command is only overwritten in the main import/export file.

Best wishes
Johannes
User avatar
bernd
Veteran
Posts: 12849
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Fenics as Solver

Post by bernd »

check OpenSCAD workbench AFAIK they have splitted the import and export too.
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: Fenics as Solver

Post by joha2 »

Thanks for the hint! They just splitted import and export in different files and doubled the open -> pyopen redefinition in every file. My situation is a bit different; I used 4 files to write the code for import/export (xml and xdmf), but the main file which couples this code to FreeCAD stays the same and just imports those 4 files.

https://github.com/joha2/FreeCAD/blob/f ... icsMesh.py

In the other files, there is just the normal open used, see e.g. last lines of

https://github.com/joha2/FreeCAD/blob/f ... icsXDMF.py

Best wishes
Johannes
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: Fenics as Solver

Post by joha2 »

Heyhey bernd,

I opened a brandnew pull request for Fenics XDMF export to your Femdev branch :mrgreen:
I tested the code with several gmsh and netgen created meshes and it worked. (At least after import into Paraview. :-))

Best wishes
Johannes
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Fenics as Solver

Post by Kunda1 »

joha2 wrote:Heyhey bernd,

I opened a brandnew pull request for Fenics XDMF export to your Femdev branch :mrgreen:
I tested the code with several gmsh and netgen created meshes and it worked. (At least after import into Paraview. :-))

Best wishes
Johannes
@bernd was this ever merged in to master ?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Fenics as Solver

Post by Kunda1 »

qingfeng.xia wrote:My current day-work project is using Fenics to solve multiphysics problem, once some one can export FreeCAD fem mesh to Fenics, we can solve more physics problem easily.
Is this possible yet?
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
joha2
Posts: 303
Joined: Tue Oct 11, 2016 9:48 pm

Re: Fenics as Solver

Post by joha2 »

Hey Kunda

thanks for pointing this out! At some point I had the feeling that such a Fenics export is only useful for myself ;-)
The mentioned export functions are merged into the femdev branch of bernd already. Though the merging into the
master branch is not done, yet. I would appreciate any testing of my import/export functions and any suggestions for improving.
It is planned to also implement some geometry based mesh selection which afterwards could be exported into Fenics mesh functions.

Best wishes
Johannes
qingfeng.xia
Posts: 227
Joined: Tue Sep 22, 2015 1:47 pm
Location: Oxford UK/Shenzhen China
Contact:

Re: Fenics as Solver

Post by qingfeng.xia »

as it is my day-time work, paid by project, also part of my project, it would not been open source soon. We need to finish the project first, then think about generalize it and publish it.

it is hard to do domain splitting, and make is more object orient. I have not found a good way to sequence the multiple solvers.
Kunda1 wrote:
qingfeng.xia wrote:My current day-work project is using Fenics to solve multiphysics problem, once some one can export FreeCAD fem mesh to Fenics, we can solve more physics problem easily.
Is this possible yet?
Ubuntu 18.04 LTS 64bit, python3, always work with latest FreeCAD daily build
Working on Cfd module for FreeCAD, FreeCAD_Module_Develop_Guide
https://github.com/ukaea/parallel-preprocessor/
https://github.com/qingfengxia/Cfd
Post Reply