Elmer Integration (GSoC) - Activity Log

About the development of the FEM module/workbench.

Moderator: bernd

m42kus
Posts: 159
Joined: Tue Sep 02, 2014 9:41 am

Elmer Integration (GSoC) - Activity Log

Postby m42kus » Sun May 21, 2017 5:13 pm

Hi everyone,
in this topic I will post regular (at least weekly) updates about progress and news on the elmer integration gsoc project. My proposal for this project is avaliable on google docs: https://docs.google.com/document/d/1mX3 ... sp=sharing.

Currently I'm trying to find similar projects that could help me out as well as making contatct with the elmer community. Also I'm reading lot's of source code and experiment with differnt ways of exporting/importing the mesh scene for elmer. The first post will follow soon, so stay tuned ;)
My GSoC Devlog: ceeli.github.io/gsoc
keithsloan52
Posts: 1009
Joined: Mon Feb 27, 2012 5:31 pm

Re: Elmer Integration (GSoC) - Activity Log

Postby keithsloan52 » Sat May 27, 2017 10:06 am

Not being very familiar with FEM I was wondering what a multiphysics workbench with Elmer would bring to the table so I took the opportunity to attend a COMSOL webinar. COMSOL being a commercial product and I am now looking forward to Elmer integration.

If you are interested in what commercial multiphysics software has to offer COMSOL offer some interesting Webinars at https://www.comsol.com/events/webinars. Might be worth checking some for ideas for the Elmer workbench.
m42kus
Posts: 159
Joined: Tue Sep 02, 2014 9:41 am

Re: Elmer Integration (GSoC) - Activity Log

Postby m42kus » Fri Jun 02, 2017 3:07 pm

Hi everyone,

The first "week" of coding is over and my first activity log overdue.

So what have I been up to? Yesterday I already ran my first simulation from within FreeCAD. Today I did a little polishing work, improved error handling and so on. I also created a small demo video for you guys to show off what I accomplished till now:

phpBB [video]


Most of whats happend in the video should be quite straight foreword. One new thing I created is the free text input because phase 1 of the elmer integration project doesn't include support for FreeCADs constraint objects. Right now the free text input (for the SIF file) is prepolulated with a SIF text that replicates the CalculiX fem demo (showen in the video) but the .Text property can be changed to hold every arbitrary string. Whats missing is a editor inside FreeCAD but that shouldn't be difficult to implement and I plan to do so on tuesday next week. On monday I plan to implement futher tests and fix a few known (to me xD) bugs.

As soon as the code is "ready" I will "publish" it on https://github.com/drhooves/FreeCAD.git elmer_integration. I expect this to happen on wednesday next week (including the GUI).
My GSoC Devlog: ceeli.github.io/gsoc
User avatar
sgrogan
Posts: 5330
Joined: Wed Oct 22, 2014 5:02 pm

Re: Elmer Integration (GSoC) - Activity Log

Postby sgrogan » Fri Jun 02, 2017 7:03 pm

m42kus wrote:
Fri Jun 02, 2017 3:07 pm
Whats missing is a editor inside FreeCAD
There is one but I don't know where it's implemented. In the FEM prefs under the Calculix tab there is an option to use the internal one or specify an external one.
Cool video.
User avatar
yorik
Site Admin
Posts: 11514
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Elmer Integration (GSoC) - Activity Log

Postby yorik » Fri Jun 02, 2017 7:35 pm

Great video! Please keep producing more of those! ;)
Have a look at the macro editor of freecad, it might be usable/modificable to edit your sif file...
joha2
Posts: 236
Joined: Tue Oct 11, 2016 9:48 pm

Re: Elmer Integration (GSoC) - Activity Log

Postby joha2 » Mon Jun 05, 2017 8:14 am

yorik wrote:
Fri Jun 02, 2017 7:35 pm
Have a look at the macro editor of freecad, it might be usable/modificable to edit your sif file...
Sorry for asking off-topic: Is there a straightforward way to use the macro editor within python?
I once had a similar problem and after some trying I just used the stringlist property editor, but this is obviously not optimal.

@m42kus: nice video! :-)

Best wishes
Johannes
m42kus
Posts: 159
Joined: Tue Sep 02, 2014 9:41 am

Re: Elmer Integration (GSoC) - Activity Log

Postby m42kus » Tue Jun 06, 2017 3:35 pm

Hey,
Unfortunately I was sick the last few days and didn't get as much done as I planned. Because of this the GUI (for FreeText) will take me one or two days longer than expected. Today I added a new test and also improved the handling of external calls to ElmerGrid and ElmerSolver.

There are a few different examples of editors, but none fits my usecase. The macro and calculix editor both operate directly on files and not document objecs. The spreadsheet editor may be a better example because it operates on document objects. As far as I can tell right now I have to subclass MDIView and embed a QPlainTextEdit into it. If there is an easier way please let me know ;)
My GSoC Devlog: ceeli.github.io/gsoc
User avatar
yorik
Site Admin
Posts: 11514
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Elmer Integration (GSoC) - Activity Log

Postby yorik » Tue Jun 06, 2017 10:58 pm

Indeed there is currently no python way to open a macro editor.

However the code that opens it is fairly simple (src/Gui/DlgMacroExecuteImp.cpp, L289), one could easily add some FreeCADGui.openMacroEditor(filepath) function. @ma42kus if that is useful to you, tell me and I'll add it. But that would add maybe a lot of hassle, you'll need to save your text to a temp file, then watch that file for changes... It might be easier to stick to your current way.

BTW, in Path there is a quick-and-dirty text editor too, that even does syntax highlighting. Might be useful to you... src/Mod/Path/PathScripts/PathInspect.py
joha2
Posts: 236
Joined: Tue Oct 11, 2016 9:48 pm

Re: Elmer Integration (GSoC) - Activity Log

Postby joha2 » Wed Jun 07, 2017 6:02 am

I'm really sorry, my question is off-topic again :mrgreen:
Is it possible to add for these type of tasks a new property (e.g. PropertySourceCode) which has a property editor with syntax highlighting? I think such a property could at least be useful for all the FEM guys who implement their own solver since they have to prepare a script file at some point in the solution process for communication with the solver.
wmayer
Site Admin
Posts: 14782
Joined: Thu Feb 19, 2009 10:32 am

Re: Elmer Integration (GSoC) - Activity Log

Postby wmayer » Wed Jun 07, 2017 12:11 pm

However the code that opens it is fairly simple (src/Gui/DlgMacroExecuteImp.cpp, L289), one could easily add some FreeCADGui.openMacroEditor(filepath) function. @ma42kus if that is useful to you, tell me and I'll add it. But that would add maybe a lot of hassle, you'll need to save your text to a temp file, then watch that file for changes... It might be easier to stick to your current way.
I don't know if you need more but there is already a generic open function that will open a Python editor when opening a py file or script.

Code: Select all

FreeCADGui.open("file.fcmacro")
The file formats that open the Python editor are .py, .fcscript, .fcmacro