OOFem

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
HarryvL
Posts: 1033
Joined: Sat Jan 06, 2018 7:38 pm

Re: OOFem

Postby HarryvL » Wed Oct 10, 2018 10:55 am

bernd wrote:
Wed Oct 10, 2018 9:36 am
@HarryvL: this may bei helpful too in the regbard of adding new command to FreeCAD FEM git commit 7d7a02e
Thanks. I am gradually getting in the swing of things.
User avatar
HarryvL
Posts: 1033
Joined: Sat Jan 06, 2018 7:38 pm

Re: OOFem

Postby HarryvL » Wed Oct 10, 2018 6:56 pm

bernd wrote:
Mon Oct 08, 2018 8:19 pm
branch assess looks good to me. To get it first started I would go for the following.

- in module src/Mod/Fem/femsolver/oofem/writer.py define a string testinputfile = ''' an simple complete oofem input file '''
- in method def write_OOFEM_input(self): ( https://github.com/HarryvL/FreeCAD/blob ... py#L64-L81 ) you gone write the string testinputfile
- means no matter what FreeCAD analysis for objects has, if it has an oofem solver object in any case your testinputfile will be written.
- With this you can test if the new solver object works at all.
- if it works you can start to step by step implement the writer for oofem which does write the real FreeCAD object data to the oofem input file.

Hope you got my point. It is just an idea, how I did it when I mplemented the Z88.
OK this all works now for a dummy file. So far so good. Next the task of writing FC data in OOFEM input format :D
User avatar
bernd
Posts: 7885
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: OOFem

Postby bernd » Wed Oct 10, 2018 7:27 pm

:D
User avatar
bernd
Posts: 7885
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: OOFem

Postby bernd » Wed Oct 10, 2018 7:29 pm

calculix cantilever is a good example and we will need it anyway as a official example for the new solver. see startwb, we have it for all three solvers in new solver frame work example.
User avatar
bernd
Posts: 7885
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: OOFem

Postby bernd » Thu Oct 11, 2018 5:41 am

There is another one you should keep in mind. All FEM python code is pep8 compatible. You can check easily by running the following command in your FreeCAD source tree.

Code: Select all

find src/Mod/Fem/ -name "*\.py" | grep -v convert2TetGen.py | grep -v InitGui.py | grep -v TestFem.py | xargs -I [] flake8 --ignore=E501,E265,E266,E402 []
User avatar
HarryvL
Posts: 1033
Joined: Sat Jan 06, 2018 7:38 pm

Re: OOFem

Postby HarryvL » Thu Oct 11, 2018 7:32 am

Thanks. Are there any good references about the architecture of FreeCAD? I mean the philosophy and implementation of C++ and Python class structure. It feel it would help speed up understanding of where and how methods and attributes are defined and perhaps more importantly when NOT to worry about this and just apply a method or data structure in a confident and predictable manner.
User avatar
PrzemoF
Posts: 2533
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: OOFem

Postby PrzemoF » Thu Oct 11, 2018 7:52 am

As far as I can tell the best way is to read the source and just do your thing, make a pull request (as small as possible) and the gurus will tell you if that's OK or not. "git grep" + basic understanding how C++ works (headers, definitions, inheritance) is really a powerful tool. I know sometimes it would be better to read a doc i.e. "How to add a new command to a workbench", but instead you can check git log for commit that added a new command and you'll see all required changes in one place.
I also recommend using text editor that can run flake8/pep8 tests on file save - you get immediate feedback if your code formatting is OK.
User avatar
HarryvL
Posts: 1033
Joined: Sat Jan 06, 2018 7:38 pm

Re: OOFem

Postby HarryvL » Thu Oct 11, 2018 8:08 am

PrzemoF wrote:
Thu Oct 11, 2018 7:52 am
As far as I can tell the best way is to read the source and just do your thing, make a pull request (as small as possible) and the gurus will tell you if that's OK or not. "git grep" + basic understanding how C++ works (headers, definitions, inheritance) is really a powerful tool. I know sometimes it would be better to read a doc i.e. "How to add a new command to a workbench", but instead you can check git log for commit that added a new command and you'll see all required changes in one place.
I also recommend using text editor that can run flake8/pep8 tests on file save - you get immediate feedback if your code formatting is OK.
Thanks !
User avatar
bernd
Posts: 7885
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: OOFem

Postby bernd » Thu Oct 11, 2018 10:33 am

there is no coding standard in FreeCAD. I know just one, which is used in any workbench. Use spaces and no tabs.

As I wrote, in FEM we use pep8 compliant code. Since I have done most Python development in the last two years I check this on any new code. Means if you would like to have your code merged into FreeCAD FEM it is highly possible it has to pass my eyes before it gets merged and I will for sure check if it is pep8 compliant. :mrgreen:

Thus runing flake8 from time to time while you are developing makes sence.

BTW: since I'm highly interested in this integrateion I will for sure try your new solver and have a look at the code before you are ready for a PR :ugeek:

bernd
User avatar
HarryvL
Posts: 1033
Joined: Sat Jan 06, 2018 7:38 pm

Re: OOFem

Postby HarryvL » Thu Oct 11, 2018 4:14 pm

bernd wrote:
Thu Oct 11, 2018 10:33 am
there is no coding standard in FreeCAD. I know just one, which is used in any workbench. Use spaces and no tabs.

As I wrote, in FEM we use pep8 compliant code. Since I have done most Python development in the last two years I check this on any new code. Means if you would like to have your code merged into FreeCAD FEM it is highly possible it has to pass my eyes before it gets merged and I will for sure check if it is pep8 compliant. :mrgreen:

Thus runing flake8 from time to time while you are developing makes sence.

BTW: since I'm highly interested in this integrateion I will for sure try your new solver and have a look at the code before you are ready for a PR :ugeek:

bernd
:shock: no pressure Harry :o