Accessing SVAR (User State Variable) from UPF in DPF

Member Posts: 1 **

Hi, all community members!

I've been writing some concrete models using ANSYS UPF functions for some time now and am in need of some result post-processing, so I've been figuring out the DPF functionality for some time now.

The question is: I'm not entirely sure how to access User State Variables in Python Result objects. I'm trying to plot one but with no luck so far.

I'm using ANSYS Mechanical 2022R1. State Variables are initialised from Mechanical by APDL script object using the "TB,STATE,matid,,20" string. In default results, they are accessed using SVAR() User Defined Result.

So far I found a result operator named "state variable" (which seem to be what i need), but I was not able to plot it successfully. Below Python Results content is presented.

Spoiler
  1. def post_started(sender, analysis):# Do not edit this line
  2. define_dpf_workflow(analysis)
  3.  
  4.  
  5. def define_dpf_workflow(analysis):
  6. import mech_dpf
  7. import Ans.DataProcessing as dpf
  8. mech_dpf.setExtAPI(ExtAPI)
  9. data_source = dpf.DataSources(analysis.ResultFileName)
  10. upf_result_op = dpf.operators.result.state_variable()
  11. upf_result_op.inputs.data_sources.Connect(data_source)
  12. upf_result_op.inputs.item_index(3)
  13. dpf_workflow = dpf.Workflow()
  14. dpf_workflow.Add(upf_result_op)
  15. dpf_workflow.SetOutputContour(upf_result_op)
  16. dpf_workflow.Record('wf_id', False)
  17. this.WorkflowId = dpf_workflow.GetRecordedId()

As a side note: Is there any way to debug Python Result objects from Mechanical, without using other PyAnsys functionality?

Tagged:

Answers

Welcome!

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