[Fixed]Can not set material: "Not known problem"

About the development of the FEM module/workbench.

Moderator: bernd

reox
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

[Fixed]Can not set material: "Not known problem"

Postby reox » Wed Oct 30, 2019 5:07 pm

I try to set a material for a solid in the FEM workbench (Create a FEM Material for solid -> choose Material card -> click OK), but no matter what material I choose from the list, I get this error message:
2019-10-30-180210_500x109_scrot.png
2019-10-30-180210_500x109_scrot.png (8.24 KiB) Viewed 350 times
In the log I see:

Code: Select all

choose_material in FEM material task panel:
    /usr/share/freecad-daily/Mod/Material/StandardMaterial/Steel-1C22.FCMat
ThermalConductivity not found in material data of: 1C22
SpecificHeat not found in material data of: 1C22

Zero ThermalConductivity value. This parameter is not saved in the material data.
Zero SpecificHeat value. This parameter is not saved in the material data.
<Exception> syntax error
Parameter: ThermalExpansionCoefficient --> value: 0.000011 m/m/K --> Not known problem.
Due to some wrong material quantity units in the changed material data, the task panel changes where not accepted.
What is wrong there? Or is the problem between keyboard and chair?

Code: Select all

OS: Debian GNU/Linux bullseye/sid (i3/i3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18640 (Git)
Build type: Release
Branch: master
Hash: 2251f53eb5af097cbb4b879af89575132660e541
Python version: 3.7.5
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Austria (de_AT)
vocx
Posts: 1842
Joined: Thu Oct 18, 2018 9:18 pm

Re: Can not set material: "Not known problem"

Postby vocx » Thu Oct 31, 2019 6:10 pm

reox wrote:
Wed Oct 30, 2019 5:07 pm
I try to set a material for a solid in the FEM workbench (Create a FEM Material for solid -> choose Material card -> click OK), but no matter what material I choose from the list, I get this error message:
...
You should probably ask in the FEM workbench, as it seems the problem is with how the workbench tries to get the material.
User avatar
Kunda1
Posts: 5909
Joined: Thu Jan 05, 2017 9:03 pm

Re: Can not set material: "Not known problem"

Postby Kunda1 » Thu Oct 31, 2019 7:32 pm

Moved to FEM subforum
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
bernd
Posts: 8468
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Can not set material: "Not known problem"

Postby bernd » Fri Nov 01, 2019 10:07 am

reox wrote:
Wed Oct 30, 2019 5:07 pm
...
<Exception> syntax error
...
[/code]

What is wrong there? Or is the problem between keyboard and chair?
Very strange for me 0.19.18638 works great. There has been no changes in the regard of either materials or FEM material taskpanel lately. The syntax error seams strange to me.

The only difference I am on Buster you on sid. Python verison on Buster is 3.7.3 this should not the problem. Do you find the syntax error or have more information about it.

You may could reduce the material directories to a own directory and only put a few material cards in, just to test.
reox
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Can not set material: "Not known problem"

Postby reox » Fri Nov 01, 2019 12:46 pm

Okay I think I know whats wrong:

I can also reproduce it by using "use Task Panel" and putting any non-zero value into the thermal expansion coeff.
Interestingly, if I put a 1 1/K there, I get this message:

Code: Select all

Parameter: ThermalExpansionCoefficient --> value: 1000000.0 um/m/K --> Not known problem.
Which got me thinking... Actually I use the Unit schema for "Metric small parts & CNC"! Switching this to Standard SI units made everything work.
So it looks like the parser for units gets confused when parsing the units when in CNC mode?!
User avatar
bernd
Posts: 8468
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Can not set material: "Not known problem"

Postby bernd » Fri Nov 01, 2019 12:59 pm

reox wrote:
Fri Nov 01, 2019 12:46 pm
Okay I think I know whats wrong:

I can also reproduce it by using "use Task Panel" and putting any non-zero value into the thermal expansion coeff.
Interestingly, if I put a 1 1/K there, I get this message:

Code: Select all

Parameter: ThermalExpansionCoefficient --> value: 1000000.0 um/m/K --> Not known problem.
Which got me thinking... Actually I use the Unit schema for "Metric small parts & CNC"! Switching this to Standard SI units made everything work.
So it looks like the parser for units gets confused when parsing the units when in CNC mode?!
ok one step further. I changed to this unit system too, still no problems here.
User avatar
bernd
Posts: 8468
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Can not set material: "Not known problem"

Postby bernd » Fri Nov 01, 2019 1:01 pm

What I did:
- start FreeCAD
- change in prefs to unit small parts with cnc
- got to FEM wb
- Add an analysis
- add an material
- change to material Steel-1C22.FCMat

works without any problem
reox
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Can not set material: "Not known problem"

Postby reox » Fri Nov 01, 2019 1:40 pm

I tried it again, restart FC, set CNC units, etc.. did the same as you. And it produces the error.
Right now, I'm at

Code: Select all

OS: Debian GNU/Linux bullseye/sid (i3/i3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.18644 (Git)
Build type: Release
Branch: master
Hash: 481870be2b48ef95b59acf1440b069d42b6fad23
Python version: 3.7.5
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Austria (de_AT)
Maybe I'm missing some build flags? (It is not the offical daily build but my own build)
But I checked the buildlog, there are only warnings (the usual stuff IMO), no errors.

My localization in FC is set to English - maybe this makes a difference?
I even started with a new .FreeCAD folder (which sets my locale by default to German btw) and could reproduce the error there when setting the Units to CNC.
User avatar
bernd
Posts: 8468
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Can not set material: "Not known problem"

Postby bernd » Fri Nov 01, 2019 2:01 pm

how about the other unit systems ...
reox
Posts: 666
Joined: Sat Aug 13, 2016 10:06 am
Contact:

Re: Can not set material: "Not known problem"

Postby reox » Fri Nov 01, 2019 4:36 pm

tested all of them:

Standard ... works
MKS ... works
US customary ... error
Imperial decimal ... error
Building euro ... error
Building US ... error
CNC ... error
Imperial civial ... error

btw you can debug this in the python console it looks like:

Code: Select all

>>> from FreeCAD import Units
>>> Units.ThermalExpansionCoefficient
Unit: 1/K (0,0,0,0,-1,0,0,0) [ThermalExpansionCoefficient]
>>> quantity = Units.Quantity(1, Units.ThermalExpansionCoefficient)
>>> user_prefered_unit = quantity.getUserPreferred()[2]
>>> user_prefered_unit
'm/m/K'
>>> param_value = Units.Quantity('0.0001 m/m/K')


>>> Gui.runCommand('Std_DlgPreferences',0)   # Changed from MKS to CNC


>>> quantity = Units.Quantity(1, Units.ThermalExpansionCoefficient)
>>> user_prefered_unit = quantity.getUserPreferred()[2]
>>> user_prefered_unit
'1/K'
>>> param_value.getValueAs(user_prefered_unit)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
Base.FreeCADError: syntax error
So somehow the meters per meters get replaced by 1, then it fails.
Especially if you do stuff like:

Code: Select all

>>> quantity.getValueAs('m/m/K')
1 
>>> quantity.getValueAs('1/K')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
Base.FreeCADError: syntax error
>>> quantity.getValueAs('kg/kg/K')
1 
So if you use ANY unit which cancels to 1 it works. But if you use 1 instead, it fails.

Interestingly, this works too:

Code: Select all

>>> quantity.getValueAs('K^-1')
1