How do I retrieve NMISC results for APDL hydrostatic elements (HSFLD242) with DPF?

Member, Moderator, Employee Posts: 479
100 Answers 250 Likes 100 Comments Second Anniversary
✭✭✭✭
edited June 2023 in Structures

How do I retrieve NMISC results for APDL hydrostatic elements (HSFLD242) with DPF in Mechanical?

enter image description here

Tagged:

Answers

  • Member, Moderator, Employee Posts: 479
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭
    Answer ✓

    You can use the following code.

    Note

    1. This code uses all the HSFLD242 elements in the named selection "HFL". As HSFLD242 are created by the solver, one needs to create APDL component name "HFL" using APDL Snippet (not via Mechanical).

    2. This code uses time-scoping for 4 time-steps, please adjust as per your model.

    1. import mech_dpf
    2.  
    3. mech_dpf.setExtAPI(ExtAPI)
    4. import Ans.DataProcessing as dpf
    5.  
    6. dpf.DataProcessingCore.LoadLibrary("math", r"C:\Program Files\ANSYS Inc\v211\aisol\bin\winx64\Ans.Dpf.Math.dll")
    7. ds = mech_dpf.GetDataSources(0)
    8.  
    9. time_freq = dpf.operators.metadata.time_freq_provider()
    10. time_freq.inputs.data_sources.Connect(ds)
    11.  
    12. hfl_elements = dpf.Operator("scoping_provider_by_ns")
    13. hfl_elements.Connect(0, "Elemental")
    14. hfl_elements.Connect(1, "HFL")
    15. hfl_elements.Connect(4, ds)
    16.  
    17. # Time Scoping
    18. time_scoping = dpf.data.Scoping()
    19. time_scoping.Ids = [1, 2, 3, 4]
    20.  
    21. # Density NMISC1
    22. density = dpf.Operator("mapdl::nmisc")
    23. density.Connect(0, time_scoping)
    24. density.Connect(1, hfl_elements.GetOutputAsScoping(0))
    25. density.Connect(4, ds)
    26. # Please use the NMISC number as a second argument here
    27. density.Connect(10, 1)
    28.  
    29. # TVOL NMISC3
    30. tvol = dpf.Operator("mapdl::nmisc")
    31. tvol.Connect(0, time_scoping)
    32. tvol.Connect(1, hfl_elements.GetOutputAsScoping(0))
    33. tvol.Connect(4, ds)
    34. # Please use the NMISC number as a second argument here
    35. tvol.Connect(10, 3)
    36.  
    37. # Density Results for 1st time step
    38. print density.GetOutputAsFieldsContainer(0)[0].Data
    39.  
    40. # TVOL Results for 4th time step
    41. print tvol.GetOutputAsFieldsContainer(0)[3].Data

Welcome!

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