Is it possible to retrieve nodal moments for shells using Mechanical Scripting with dpf?

RvdH
RvdH Member Posts: 8
First Comment
**
edited January 2 in Structures

With Mechanical Scripting it is possible to get nodal forces using the command dpf.operators.result.element_nodal_forces()
I would like to retrieve the nodal moments (so not forces) for nodes of shell181 elements. When the operator dpf.operators.result.nodal_moment() is used an error is received:
Source operator "mapdl::rst::M" not found>
Trying to get the desired result by using the User Defined Result in Mechanical results in the error:
The result data for SMISC5 is not contained in the result file.
when the Expression is smisc5.
When the expression is ENMOZ a result is returned.
Is the operator dpf.operators.result.nodal_moment() equal to the UDR with Expression = SMISC5 and is this result not available using dpf in Mechanical? If so: how can the result for Expression ENMOZ be reproduced using dpf?

My current code is:

import mech_dpf
import Ans.DataProcessing as dpf
mech_dpf.setExtAPI(ExtAPI)

an1=ExtAPI.DataModel.AnalysisByName(ExtAPI.DataModel.AnalysisNames[0])
rstFile=an1.WorkingDir+'file.rst'
model = dpf.Model(rstFile)
N_time = model.TimeFreqSupport.NumberSets
print('Nr of time steps: '+N_time.ToString()+'\n')

dataSource = dpf.DataSources(rstFile)

#Retrieve all time steps
timeProv= dpf.operators.metadata.time_freq_provider()
timeProv.inputs.data_sources.Connect(dataSource)
allTimeFreq=timeProv.outputs.time_freq_support.GetData()

#List available named selections
print(model.AvailableNamedSelections)

#Create scoping for specific Named Selection
op=dpf.operators.scoping.on_named_selection(named_selection_name='WELD_NODES',data_sources=dataSource)
my_scoping1=op.outputs.getmesh_scoping()

#Retrieve nodal forces
nf_op=dpf.operators.result.element_nodal_forces()
nf_op.inputs.time_scoping.Connect(list(allTimeFreq.TimeFreqs.Data))
nf_op.inputs.mesh_scoping.Connect(my_scoping1)
nf_op.inputs.data_sources.Connect(dataSource)
a=nf_op.outputs.fields_container.GetData()
print(a[0].Data)

#retrieve nodal moments
#
# Returns: M:466<-Source operator "mapdl::rst::M" not found
#
# Note: a User Defined Result in Mechanical with SMISC4 returns: The result data for SMISC4 is not contained in the result file.
#       a User Defined Result in Mechanical with MX or MVECTORS does return values
#
nm_op=dpf.operators.result.nodal_moment()
nm_op.inputs.time_scoping.Connect(list(allTimeFreq.TimeFreqs.Data))
nm_op.inputs.mesh_scoping.Connect(my_scoping1)
nm_op.inputs.data_sources.Connect(dataSource)
b=nm_op.outputs.fields_container.GetData()

print(b[0].Data)

Answers

  • Chris Harrold
    Chris Harrold Member, Administrator, Employee Posts: 183
    100 Comments 5 Answers First Anniversary Ansys Employee
    admin

    @Ramdane - a DPF question that could use your expert eye!

  • jichuchen
    jichuchen Member Posts: 1
    First Comment
    **

    I met the same problem, have you find any solution ? if don't, i think pymapdl with "FSUM" APDL command is a better choice.