## fcFEM - FEA from start to finish

**Moderator:** bernd

**Forum rules**

**and Helpful information for the FEM forum**

### Re: fcFEM - FEA from start to finish

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

### Re: fcFEM - FEA from start to finish

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):`

### Re: fcFEM - FEA from start to finish

Just for the records ...

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

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),
)
```

### Re: fcFEM - FEA from start to finish

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

Clearly, this one does:

Clearly, this one does:

### Re: fcFEM - FEA from start to finish

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

### Re: fcFEM - FEA from start to finish

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)

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)

### Re: fcFEM - FEA from start to finish

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.