Simulating Low Youngs Modulus <0.5MPa Problem Limitation

About the development of the FEM module/workbench.

Moderator: bernd

meldiwin
Posts: 2
Joined: Tue Jan 05, 2021 10:04 pm

Simulating Low Youngs Modulus <0.5MPa Problem Limitation

Post by meldiwin »

Hello Guys,
I am simulating my materials in Freecad which has a Young's Modulus 100KPa and 30KPa using materials card and it give me the following error, and I tried to see the limit for Young's modulus, if I go below 0.5MPa in the material card, it gives the error below above 0.5MPa is okay... This really made me very confused is that a software limitation? I am using Freecad app image



The numbers below are estimated upper bounds
number of:
nodes: 11865
elements: 10241
one-dimensional elements: 0
two-dimensional elements: 0
integration points per element: 4
degrees of freedom per node: 3
layers per element: 1
distributed facial loads: 0
distributed volumetric loads: 0
concentrated loads: 162
single point constraints: 486
multiple point constraints: 1
terms in all multiple point constraints: 1
tie constraints: 0
dependent nodes tied by cyclic constraints: 0
dependent nodes in pre-tension constraints: 0
sets: 5
terms in all sets: 40653
materials: 1
constants per material and temperature: 2
temperature points per material: 1
plastic data points per material: 0
orientations: 0
amplitudes: 2
data points in all amplitudes: 2
print requests: 1
transformations: 0
property cards: 0
*ERROR reading *ELASTIC: the Young
modulus should exceed 0.0
*ERROR reading *ELASTIC. Card image:
0,0.400
STEP 1
Static analysis was selected
*ERROR in calinput: at least one fatal
error message while reading the
input deck: CalculiX stops.
0.2: CalculiX execute error:
0.2: Loading result sets...
UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: Simulating Low Youngs Modulus <0.5MPa Problem Limitation

Post by UR_ »

I think there is a bug in:

...src\Mod\Fem\femsolver\calculix\writer.py line 1431

Code: Select all

            if mat_obj.Category == "Solid":
                f.write("*ELASTIC\n")
                f.write("{0:.0f}, {1:.3f}\n".format(YM_in_MPa, PR))
{:.0f} means: format float with no decimal places :shock:

This has to be changed.

bernd wrote: :bell:
fandaL
Posts: 440
Joined: Thu Jul 24, 2014 8:29 am

Re: Simulating Low Youngs Modulus <0.5MPa Problem Limitation

Post by fandaL »

Hello,
there is fixed precision when FreeCAD writes modulus in MPa to the CalculiX input file. You can edit it manually before running the analysis:
Click "Edit .inp file"
Find *ELASTIC card close to the end of the file
On the next line, there are elastic modulus in MPa and Poisson number - modify elastic modulus as needed.

We discussed issue like this previously
https://forum.freecadweb.org/viewtopic.php?f=18&t=52599
https://github.com/FreeCAD/FreeCAD/blob ... r.py#L1433
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Simulating Low Youngs Modulus <0.5MPa Problem Limitation

Post by bernd »

since I am refactoring the writer ATM here a save link. https://github.com/FreeCAD/FreeCAD/blob ... r.py#L1433
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Simulating Low Youngs Modulus <0.5MPa Problem Limitation

Post by bernd »

confirmed!

What material has young's modulus lower than 500 kPa?
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Simulating Low Youngs Modulus <0.5MPa Problem Limitation

Post by bernd »

UR_
Veteran
Posts: 1355
Joined: Tue Jan 03, 2017 8:42 pm

Re: Simulating Low Youngs Modulus <0.5MPa Problem Limitation

Post by UR_ »

Sorry but this solution looks a little bit strange.

All floating points fields read from ccx are F20.0 FORTRAN input fields.

So line 91

Code: Select all

f.write("{0:.0f}, {1:.3f}\n".format(YM_in_MPa, PR))
should be changed to:

Code: Select all

f.write("{0:.13G}, {1:.3f}\n".format(YM_in_MPa, PR))
That's all.

Please see a comment by bernd :D

Code: Select all

# Why {:.13G} ...
# ccx uses F20.0 FORTRAN input fields, see in dload.f in ccx's source
# https://forum.freecadweb.org/viewtopic.php?f=18&t=22759&#p176578
# example "{:.13G}".format(math.sqrt(2.)*-1e100) and count chars

All places writing floating points to ccx should be investigated for this bug. :o
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Simulating Low Youngs Modulus <0.5MPa Problem Limitation

Post by bernd »

UR_ wrote: Tue Jul 13, 2021 2:29 pm should be changed to:

Code: Select all

f.write("{0:.13G}, {1:.3f}\n".format(YM_in_MPa, PR))
That's all.
would you go for a PR for this small fast change, will only take a few seconds ... But do not forget to run the unit test ... :roll: I should have been writing a comment in the code ... :oops:
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Simulating Low Youngs Modulus <0.5MPa Problem Limitation

Post by bernd »

:oops: my fault ... I should have run the unit test before go for a change ... git commit 74c3a4f676ca4
User avatar
bernd
Veteran
Posts: 12851
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland
Contact:

Re: Simulating Low Youngs Modulus <0.5MPa Problem Limitation

Post by bernd »

UR_ wrote: Tue Jul 13, 2021 2:29 pm All places writing floating points to ccx should be investigated for this bug. :o
started ... git commit 138144d88e0
Post Reply