fcFEM - FEA from start to finish

About the development of the FEM module/workbench.

Moderator: bernd

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

Re: fcFEM - FEA from start to finish

Postby bernd » Sat Mar 30, 2019 6:50 pm

HarryvL wrote:
Sat Mar 30, 2019 5:12 pm
Something else ... I just pulled and built the latest FC source from femconcrete and it broke my fcFEM macro :shock: It looks like an additional parameter was added to the FemInputWriter constructor? I simply put another None at the initiation call of the relevant object and now it works again, but it makes me worry that any call to FC API is vulnerable? Also, it would mean that the macro would either work with 0.17/0.18 or 0.19, but not both. Any suggestions on how to manage this? Thanks, Harry
This is some new problem we gone face in FEM. On one side we still do a lot devellopment, but on the other side people start to use FEM API. I will change it in a way it still runs and you need not to adapt it. But we need to think about this. As soon as a new FEM constraint object arises, we will brake it again. The funny thing is we are compatible with 0.17 just because there was no new object in 0.18 ... But on my repo is PR from quing feng for a new object already.

If you can not wait, just remove the latest commit before the first concrete commit. This one https://github.com/berndhahnebach/FreeC ... b12623dca0
User avatar
bernd
Posts: 9298
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: fcFEM - FEA from start to finish

Postby bernd » Sat Mar 30, 2019 6:56 pm

HarryvL wrote:
Sat Mar 30, 2019 4:56 pm
I moved my fcFEM.FCMacro and femTools.py out of the .FreeCAD/Macro folder to a local clone of my fcFEM repository. However, if I now run this fcFEM.FCMacro from the FreeCAD macro panel it returns an error that it cannot load module femTools. I put an __init__.py in the development directory and also did "export PYTHONPATH="${PYTHONPATH}:/my development path", which correctly show up in sys.path. However, despite all of this I still get: "<type 'exceptions.ImportError'>: No module named femTools". Can anybody help me resolve this? Thanks, Harry
Sure because this folder is not in path. FreeCAD mod directory is. You could add it with sys.path.append see
https://forum.freecadweb.org/viewtopic.php?t=16332
User avatar
HarryvL
Posts: 1071
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Postby HarryvL » Sat Mar 30, 2019 7:39 pm

bernd wrote:
Sat Mar 30, 2019 6:56 pm
HarryvL wrote:
Sat Mar 30, 2019 4:56 pm
I moved my fcFEM.FCMacro and femTools.py out of the .FreeCAD/Macro folder to a local clone of my fcFEM repository. However, if I now run this fcFEM.FCMacro from the FreeCAD macro panel it returns an error that it cannot load module femTools. I put an __init__.py in the development directory and also did "export PYTHONPATH="${PYTHONPATH}:/my development path", which correctly show up in sys.path. However, despite all of this I still get: "<type 'exceptions.ImportError'>: No module named femTools". Can anybody help me resolve this? Thanks, Harry
Sure because this folder is not in path. FreeCAD mod directory is. You could add it with sys.path.append see
https://forum.freecadweb.org/viewtopic.php?t=16332
Thanks, I will give it a try
User avatar
HarryvL
Posts: 1071
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Postby HarryvL » Sun Mar 31, 2019 1:34 am

HarryvL wrote:
Sat Mar 30, 2019 9:37 am
HarryvL wrote:
Sat Mar 30, 2019 6:58 am
I will post the relevant parameter selections that go with the case studies in my repo so you can give them a try.
Excavations in clay:

Code: Select all

gravity = -2.0e-5   # specific gravity acting in z-direction [N/mm3]
sig_yield = 0.01   # yield stress [MPa] for volume elements (von Mises material)
shr_yield = 100  # yield stress [MPa] for interface elements (Coulomb material) - irrelevant, not used yet
kn = 1.0            # interface elastic normal stiffness factor (0.0 < kn <1.0) - not used for the clay examples
ks = 0.0            # interface elastic shear stiffness factor (0.0 < ks <1.0) - not used for the clay examples 
OOPS, typo!

sig_yield = 0.02 and not 0.01.

Note that I made the simplifying assumption that sig_yield = 2 * Su = 2* 0.01 (which I showed here: https://forum.freecadweb.org/viewtopic. ... 90#p296204 introduces an error of up to 15.5%)
User avatar
bernd
Posts: 9298
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: fcFEM - FEA from start to finish

Postby bernd » Sun Mar 31, 2019 9:56 am

a question in the regard of the parameter problem. This code https://github.com/HarryvL/fcFEM/blob/c ... py#L85-L89 is just to get material_objects list used here: https://github.com/HarryvL/fcFEM/blob/c ... ols.py#L95. You do not need the writer instance elsewhere?

bernd
User avatar
HarryvL
Posts: 1071
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Postby HarryvL » Sun Mar 31, 2019 12:23 pm

Yes correct.
User avatar
bernd
Posts: 9298
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: fcFEM - FEA from start to finish

Postby bernd » Sun Mar 31, 2019 1:21 pm

Thanks for the information. This needs to be able much simpler too. All these None ...

In case of the new parameter, this should be fixed at the moment. As stated before, we need something more stable for new objects. I need to think about this ...

FYI: I solved the write_comment inside oofem writer: https://github.com/berndhahnebach/FreeC ... f6e8659090
User avatar
HarryvL
Posts: 1071
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Postby HarryvL » Sun Mar 31, 2019 2:12 pm

Bernd, the code for mapping material to volume elements and for remapping of elements to new interface nodes would be one line if we had an API function for determining what solid a volume element belongs to.
User avatar
HarryvL
Posts: 1071
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Postby HarryvL » Sun Mar 31, 2019 7:51 pm

I am experimenting with Choleski solvers for band matrices in an attempt to speed up the calculations.

I installed scikit-sparse, which provides sparse matrix extensions for SciPy based on the CHOLMOD scientific library.

Installation works well following the guidance here: https://scikit-sparse.readthedocs.io/en/latest/

I ran a test in PyCharm and the imported module (from sksparse.cholmod import cholesky) produces sensible results.

However, when I try this from my macro I get the habitual "module not found”. I added the location to sys.path, both inside and outside FC, but it makes no difference.

Is the only option to set up the whole library in .FreeCAD/macro, as I read in some old posts on other library instllations?
User avatar
bernd
Posts: 9298
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: fcFEM - FEA from start to finish

Postby bernd » Sun Mar 31, 2019 8:01 pm

make a Workbench out of it and track this one with git.