fcFEM - FEA from start to finish

About the development of the FEM module/workbench.

Moderator: bernd

User avatar
PrzemoF
Veteran
Posts: 3389
Joined: Fri Jul 25, 2014 4:52 pm
Contact:

Re: fcFEM - FEA from start to finish

Post by PrzemoF »

OK, if that's the case I'd say do some reading on object oriented programming first. For most guys Fortran is ancient magic. Or
User avatar
johnwang
Veteran
Posts: 1089
Joined: Sun Jan 27, 2019 12:41 am

Re: fcFEM - FEA from start to finish

Post by johnwang »

PrzemoF wrote: Wed May 11, 2022 9:20 pm ccxwriter is self.
In Mod\Fem\femsolver\calculix\writer.py:

Code: Select all

class FemInputWriterCcx(writerbase.FemInputWriter):
    def __init__(
        self,
        analysis_obj,
        solver_obj,
        mesh_obj,
        member,
        dir_name=None,
        mat_geo_sets=None
    ):
	......
    # ********************************************************************************************
    # write calculix input
    def write_solver_input(self):
    	......
        # materials and fem element types
        write_femelement_material.write_femelement_material(inpfile, self)

    

And in Mod\Fem\femsolver\calculix\write_femelement_material.py

Code: Select all

def write_femelement_material(f, ccxwriter):
So self=ccxwriter.
hfc series CAE workbenches for FreeCAD (hfcNastran95, hfcMystran, hfcFrame3DD, hfcSU2 and more)
User avatar
HarryvL
Veteran
Posts: 1175
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

Thanks
User avatar
HarryvL
Veteran
Posts: 1175
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

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

Re: fcFEM - FEA from start to finish

Post by HarryvL »

Just for the records ...

I got it to work again with the new data structures:

Code: Select all

    analysis = doc.getObject("Analysis")
    solver = doc.getObject("SolverCcxTools")
    docmesh = doc.getObject("FEMMeshGmsh")
    member = membertools.AnalysisMember(analysis)

    # get access to material sets: fiwc.material_objects
    fiwc = FemInputWriter(
        analysis,
        solver,
        Fem,
        member
    )

    # get access to element sets: meshdatagetter.mat_geo_sets
    meshdatagetter = meshsetsgetter.MeshSetsGetter(
        analysis,
        solver,
        docmesh,
        membertools.AnalysisMember(analysis),
    )
User avatar
HarryvL
Veteran
Posts: 1175
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

I will go through the test cases in my repo to see if everything works again as before.

Clearly, this one does:

Deformation.png
Deformation.png (178.17 KiB) Viewed 551 times
User avatar
HarryvL
Veteran
Posts: 1175
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

As far as I can see fcFEM works again as before.

Plate_F_u.png
Plate_F_u.png (21.16 KiB) Viewed 388 times
Plate_Failure.png
Plate_Failure.png (196.56 KiB) Viewed 388 times
User avatar
HarryvL
Veteran
Posts: 1175
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

I have spent some time trying to speed up fcFEM. I am using the pit in clay (https://forum.freecadweb.org/viewtopic. ... 00#p296370) with 30 load steps as benchmark.

Without any optimization, the 30 load steps take 117 seconds.

Combining the two heaviest routines (stress update and load calculation) brought this down to 50 seconds.

Numba "Just in Time" compilation of this combined routine reduces it to just over 2 seconds.

As a last step before cleaning up the code and making it available for testing, I want to try Intel's distribution for Python, which (among other things) has optimized routines for NumPy, SciPy, etc.

However, so far I fail to force FC to make use of this Python version at build time. To be honest, this frustrates me no end. Some help would be appreciated (https://forum.freecadweb.org/viewtopic. ... 20#p601576)
User avatar
HarryvL
Veteran
Posts: 1175
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

HarryvL wrote: Mon Jun 13, 2022 10:29 am As far as I can see fcFEM works again as before.

Plate_F_u.png

Plate_Failure.png
CORRECTION: the units in the ParaView picture should be [m] instead of [mm]
User avatar
HarryvL
Veteran
Posts: 1175
Joined: Sat Jan 06, 2018 7:38 pm
Location: Netherlands

Re: fcFEM - FEA from start to finish

Post by HarryvL »

HarryvL wrote: Fri May 06, 2022 9:50 am I am easing back into it, but won't have as much time as before.
I have been "easing back" into this for 43 days now and spent 75% of this time trying to get FC dependencies to work. None of the options I tried give me the combined set of minimum conditions I need, i.e. working mesh generation, external library import (e.g. Numba) and the Intel distribution for Python (3.9). I have come to the conclusion that full integration of fcFEM into FC is a bridge too far for me. I have therefore decided to give up and develop fcFEM as stand-alone, with interaction through CCX input files and output through ParaView.
Post Reply