Concrete branch ready for testing

About the development of the FEM module/workbench.

Moderator: bernd

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

Re: Concrete branch ready for testing

Postby bernd » Tue Mar 26, 2019 10:25 pm

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

Re: Concrete branch ready for testing

Postby bernd » Wed Mar 27, 2019 12:11 am

EDIT:

Attached your example with reinforced material ... you will need my latest branch ... The concrete node search is name independent too ... There is an icon to add a reinforcement material. For the material parameter Python is needed, some is attached ... We will need a task panel, but first it needs to run ...

edit by python:

Code: Select all

matrixprop = {}
matrixprop['Name'] = "Concrete"
matrixprop['YoungsModulus'] = "32000 MPa"
matrixprop['PoissonRatio'] = "0.17"
matrixprop['CompressiveStrength'] = "15.75 MPa"
matrixprop['AngleOfFriction'] = "0.52333"

reinfoprop = {}
reinfoprop['Name'] = "HarrysReinforcement"
reinfoprop['YieldStrength'] = "315 MPa"
reinfoprop['ReinforcementRatio'] = "0.0"  # not an official FreeCAD material property

App.ActiveDocument.ReinforcedMaterial.Material = matrixprop
App.ActiveDocument.ReinforcedMaterial.Reinforcement = reinfoprop


edit by material editor

Code: Select all

import MaterialEditor
# matrix material
props = App.ActiveDocument.ReinforcedMaterial.Material
props = MaterialEditor.editMaterial(props)
if props:
    App.ActiveDocument.MaterialReinforced.Material = props
#

Code: Select all

import MaterialEditor
# reinforcement
props = App.ActiveDocument.ReinforcedMaterial.Reinforcement
props = MaterialEditor.editMaterial(props)
if props:
    App.ActiveDocument.MaterialReinforced.Reinforcement = props


show the material properties:

Code: Select all

App.ActiveDocument.ReinforcedMaterial.Material
App.ActiveDocument.ReinforcedMaterial.Reinforcement
Wall_2D.FCStd
(49.43 KiB) Downloaded 3 times
User avatar
bernd
Posts: 7885
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Concrete branch ready for testing

Postby bernd » Wed Mar 27, 2019 1:59 am

testing is highly appreciated
User avatar
HarryvL
Posts: 1033
Joined: Sat Jan 06, 2018 7:38 pm

Re: Concrete branch ready for testing

Postby HarryvL » Wed Mar 27, 2019 6:37 am

Bernd, your example file has an object MaterialReinforced and your Python script refers to an object ReinforcedMaterial.

When I change your Python scripts to the ones below then the input goes well, but then I get the following error when running CCX:

EDIT: ah this is because I didn't specify a CCX working directory. This was never a problem before?! It would normally default to TMP.

Apart from that everything seems to work.

Code: Select all

Executing solver...
 *ERROR in openfile: input file FEMMeshGmsh.inp                                                                                                                     

 does not exist
 
and

Code: Select all

Exception in thread Thread-11:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/harry/FC_Dev/Build/Mod/Fem/femsolver/task.py", line 115, in protector
    self.run()
  File "/home/harry/FC_Dev/Build/Mod/Fem/femsolver/calculix/tasks.py", line 126, in run
    self.load_results_ccxfrd()
  File "/home/harry/FC_Dev/Build/Mod/Fem/femsolver/calculix/tasks.py", line 138, in load_results_ccxfrd
    self.directory, _inputFileName + '.frd')
  File "/usr/lib/python2.7/posixpath.py", line 70, in join
    elif path == '' or path.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

Code: Select all

matrixprop = {}
matrixprop['Name'] = "Concrete"
matrixprop['YoungsModulus'] = "32000 MPa"
matrixprop['PoissonRatio'] = "0.17"
matrixprop['CompressiveStrength'] = "15.75 MPa"
matrixprop['AngleOfFriction'] = "0.52333"

reinfoprop = {}
reinfoprop['Name'] = "HarrysReinforcement"
reinfoprop['YieldStrength'] = "315 MPa"
reinfoprop['ReinforcementRatio'] = "0.0"  # not an official FreeCAD material property

App.ActiveDocument.MaterialReinforced.Material = matrixprop
App.ActiveDocument.MaterialReinforced.Reinforcement = reinfoprop

Code: Select all

import MaterialEditor
# matrix material
props = App.ActiveDocument.MaterialReinforced.Material
props = MaterialEditor.editMaterial(props)
if props:
    App.ActiveDocument.MaterialReinforced.Material = props
#

Code: Select all

import MaterialEditor
# reinforcement
props = App.ActiveDocument.MaterialReinforced.Reinforcement
props = MaterialEditor.editMaterial(props)
if props:
    App.ActiveDocument.MaterialReinforced.Reinforcement = props

Code: Select all

App.ActiveDocument.MaterialReinforced.Material
App.ActiveDocument.MaterialReinforced.Reinforcement
User avatar
HarryvL
Posts: 1033
Joined: Sat Jan 06, 2018 7:38 pm

Re: Concrete branch ready for testing

Postby HarryvL » Wed Mar 27, 2019 6:41 am

By the way,

it feels more natural to enter angles in degrees than in radians. You can always transform them in the code: angle_in_rad = PI()/180 * angle_in_degree
User avatar
bernd
Posts: 7885
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Concrete branch ready for testing

Postby bernd » Wed Mar 27, 2019 7:25 am

FreeCAD FEM does no longer just create non existing user specified directories. The user has to take care on this. Is this annoying?
User avatar
HarryvL
Posts: 1033
Joined: Sat Jan 06, 2018 7:38 pm

Re: Concrete branch ready for testing

Postby HarryvL » Wed Mar 27, 2019 7:38 am

Nope. It’s ok. But it would be good to stop people when they don’t enter a directory rather than crash in CCX.
User avatar
bernd
Posts: 7885
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Concrete branch ready for testing

Postby bernd » Wed Mar 27, 2019 8:03 am

HarryvL wrote:
Wed Mar 27, 2019 6:41 am
By the way,

it feels more natural to enter angles in degrees than in radians. You can always transform them in the code: angle_in_rad = PI()/180 * angle_in_degree
FreeCAD can do this for us. The unit system is very very cool once one get used to it.

Code: Select all

            matrix_af = float(FreeCAD.Units.Quantity(obj.Material['AngleOfFriction']).getValueAs('rad'))
https://github.com/berndhahnebach/FreeC ... cc4d671354

the new material code ...

Code: Select all

matrixprop = {}
matrixprop['Name'] = "Concrete"
matrixprop['YoungsModulus'] = "32000 MPa"
matrixprop['PoissonRatio'] = "0.17"
matrixprop['CompressiveStrength'] = "15.75 MPa"
matrixprop['AngleOfFriction'] = "30 deg"  # make some hint on the possible angle units in material system

reinfoprop = {}
reinfoprop['Name'] = "HarrysReinforcement"
reinfoprop['YieldStrength'] = "315 MPa"
reinfoprop['ReinforcementRatio'] = "0.0"  # not an official FreeCAD material property

App.ActiveDocument.ReinforcedMaterial.Material = matrixprop
App.ActiveDocument.ReinforcedMaterial.Reinforcement = reinfoprop
User avatar
bernd
Posts: 7885
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: Concrete branch ready for testing

Postby bernd » Wed Mar 27, 2019 8:08 am

HarryvL wrote:
Wed Mar 27, 2019 7:38 am
Nope. It’s ok. But it would be good to stop people when they don’t enter a directory rather than crash in CCX.
Mhh we gone use the new solver because has no pre checks at all. Thus he does not claim about we are not having a material in our analysis (the new reinforced material needs to be implemented in the pre checks.). Thus he does not claim about if we gone miss some other stuff. This is the main reason for not using the new solver frame work for any normal analysis because there are nearly no pre checks at all. One really misses such a comfortable pre check system once it is not available anymore :lol:
User avatar
HarryvL
Posts: 1033
Joined: Sat Jan 06, 2018 7:38 pm

Re: Concrete branch ready for testing

Postby HarryvL » Wed Mar 27, 2019 6:40 pm

Something not right yet:

Code: Select all

Traceback (most recent call last):
  File "/home/harry/FC_Dev/Build/Mod/Fem/femguiobjects/_ViewProviderFemSolverCalculix.py", line 237, in calculixFinished
    self.fea.load_results()
  File "/home/harry/FC_Dev/Build/Mod/Fem/femtools/ccxtools.py", line 830, in load_results
    self.load_results_ccxfrd()
  File "/home/harry/FC_Dev/Build/Mod/Fem/femtools/ccxtools.py", line 840, in load_results_ccxfrd
    importCcxFrdResults.importFrd(frd_result_file, self.analysis, result_name_prefix)
  File "/home/harry/FC_Dev/Build/Mod/Fem/feminout/importCcxFrdResults.py", line 110, in importFrd
    res_obj = restools.add_principal_stress_harry(res_obj)  # fill harrys calculated result values
  File "/home/harry/FC_Dev/Build/Mod/Fem/femresult/resulttools.py", line 385, in add_principal_stress_harry
    print(matrix_af)
UnboundLocalError: local variable 'matrix_af' referenced before assignment
Simple_Block_2.FCStd
(32.11 KiB) Downloaded 3 times

OS: Ubuntu 16.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.16225 (Git)
Build type: Unknown
Branch: femconcrete
Hash: 6b861b1bc7712ba4fa26009cb3d081e7a28ea593
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.1.0
Locale: English/UnitedStates (en_US)