Read element type and keyopts with ACT Python from RST

Member Posts: 20
10 Comments Name Dropper
**

With Ansys ACT Python you have full access to the data of the RST, such as the stress tensor of an element:

  1. elemId = 14588
  2. analysis = Model.Analyses[0]
  3. reader = analysis.GetResultsData()
  4. reader.CurrentTimeFreq = 1
  5. stress = reader.GetResult('S', MechanicalUnitSystem.StandardNMMton)
  6. S = stress.GetElementValues(elemId)
  7. print S

You can also query the type of the element:

  1. meshData = analysis.MeshData
  2. elem = meshData.ElementById(elemId)
  3. elem_typ = elem.Type
  4. print elem_typ

But what you get here is a string like "kHex8". Is it possible to get the real Ansys element type (like 185 for 8-node solids) and how do I get the set keyopts with ACT Python for a specific element? The calculation within my ACT extension must take the set element options into account...

Thanks for helping.

Welcome!

It looks like you're new here. Sign in or register to get started.

Comments

  • Member Posts: 20
    10 Comments Name Dropper
    **

    I found the element number!!

    1. result = reader.GetResult('PNUM', MechanicalUnitSystem.StandardNMMton)
    2. result.SelectComponents(['ENAM'])
    3. enam = result.GetElementValues(elemId)[0]
    4. print enam # = 185

    But I still need the key options ...

  • Member, Moderator, Employee Posts: 891
    100 Answers 500 Comments 250 Likes Second Anniversary
    ✭✭✭✭
  • Member Posts: 20
    10 Comments Name Dropper
    **

    Sorry, DPF is no option, because with DPF you only have access to selected field variables. For example I can not found the elastic strain energy density with DPF...

    ACT Python:

    1. analysis = Model.Analyses[0]
    2. reader = analysis.GetResultsData()
    3. for name in reader.ResultNames:
    4. print name
    5. # AENE
    6. # BFE
    7. # CDM
    8. # DENE
    9. # ECENT
    10. # EDIR
    11. # EFFNU_ZERO_EPTO
    12. # EFFNU_ZERO_EPTT
    13. # ENERGY
    14. # ENFO
    15. # EPEL
    16. # EPELEQV_RST
    17. # EPPL
    18. # EPPLEQV_RST
    19. # EPTH
    20. # EPTHEQV_RST
    21. # EPTO
    22. # EPTOEQV_RST
    23. # EPTT
    24. # EPTTEQV_RST
    25. # F
    26. # LAYNUMBER
    27. # LOC
    28. # LOC_DEF
    29. # MESH_
    30. # NDIR
    31. # PDMG
    32. # PENERGY
    33. # PFC
    34. # PNUM
    35. # PRIN_S
    36. # S
    37. # SEND
    38. # SENG
    39. # SPSD
    40. # STEN
    41. # U
    42. # UALL
    43. # VOLUME
    44. # WEXT

    DPF:

    1. import mech_dpf
    2. import Ans.DataProcessing as dpf
    3. analysis = ExtAPI.DataModel.Project.Model.Analyses[0]
    4. filepath = analysis.ResultFileName
    5. dataSources = dpf.DataSources()
    6. dataSources.SetResultFilePath(filepath)
    7. print model.ResultInfo
    8. # Available results:
    9. # U Displacement :nodal displacements
    10. # RF Force :nodal reaction forces
    11. # ENF Element nodal Forces :element nodal forces
    12. # S Stress :element nodal component stresses
    13. # ENG_VOL Volume :element volume
    14. # ENG_SE Energy-stiffness matrix :element energy associated with the stiffness matrix
    15. # ENG_AHO Hourglass Energy :artificial hourglass energy
    16. # ENG_TH thermal dissipation energy :thermal dissipation energy
    17. # ENG_KE Kinetic Energy :kinetic energy
    18. # ENG_CO co-energy :co-energy (magnetics)
    19. # ENG_INC incremental energy :incremental energy (magnetics)
    20. # EPEL Strain :element nodal component elastic strains
    21. # ETH Thermal Strains :element nodal component thermal strains
    22. # ETH_EQV Thermal Strains eqv :element nodal equivalent component thermal strains
    23. # ETH_SWL Swelling Strains :element nodal swelling strains
    24. # BFE Temperature :element structural nodal temperatures
  • Member, Moderator, Employee Posts: 891
    100 Answers 500 Comments 250 Likes Second Anniversary
    ✭✭✭✭
    edited March 27

    DPF should be able to give you any result that has been stored in the .rst file. The elastic strain energy density should be available:

    If you need to access the keyoptions without using DPF, I'm afraid the only solution would be to write some Python code to parse the input file (ds.dat which is basically a text file).

  • Member Posts: 20
    10 Comments Name Dropper
    **

    Thanks. At the moment we can not switch the result reading routines in our ACT Exctension. What I need is the integration rule (reduced or full integration, keyopt 2) of 185 / 186 elements:

    185:
    0 -- Uniform reduced integration (default)
    1 -- Full integration
    186:
    0 -- Full integration with method (default)
    1 -- Uniform reduced integration with hourglass control
    2 -- Enhanced strain formulation
    3 -- Simplified enhanced strain formulation

    Perhaps there is a way to query this via the ACT interface...

  • Member Posts: 20
    10 Comments Name Dropper
    **

    I get some element informatio (type, mat, real, elementname) and I get some information about the element type. But none of this points to the integration scheme....

    1. elemId = 123
    2. results = analysis.GetResultsData()
    3. eleminfo = results.GetResult('PNUM', MechanicalUnitSystem.StandardNMMton)
    4. el_type, el_real, el_mat, el_sec, el_esys, el_elem, el_enam = eleminfo.GetElementValues(elemId)
    5. print el_type, el_real, el_mat, el_sec, el_esys, el_elem, el_enam
    6. print results.GetElemTypeProps(el_type)
  • Member Posts: 20
    10 Comments Name Dropper
    **

    For both cases (reduced and full integration) I get 48 stress values per element, 6 components for each of the 8 integration points. The only indication I can see at the moment as to whether reduced integration is present is that the stress vector is the same for each integration point:

  • Member, Moderator, Employee Posts: 891
    100 Answers 500 Comments 250 Likes Second Anniversary
    ✭✭✭✭

    @ThomasDD Indeed the integration type will not be written anywhere else than in the ds.dat. Only solution would be to read it as a text file and extract info from here. Or, as you suggested, identify cases where the stress value is the same for all integration points.

  • Member Posts: 20
    10 Comments Name Dropper
    **

    Thanks!

Welcome!

It looks like you're new here. Sign in or register to get started.