Open jbrunel59 opened 2 years ago
Hi @jbrunel59 , please could you try this and let me know if this helps?
nmisc = model.operator("mapdl::nmisc")
nmisc.connect(10,186) #item index 186
nmisc.connect(11,3) #3 componenents X, Y, Z
fields = nmisc.outputs.fields_container()
Thanks you for your prompt answer. I will try today.
Can you confirm to me that this will return the values of the contact forces to the nodes?
When I check with Ansys help, index 186 refers to total contact force, not nodal
@jbrunel59 let me check with the solver team, if we can have the contact force directly on the nodes. Otherwise we may be able to compute it with the 1- contact pressure and element areas or 2- averaging the element contact force to the nodes by taking into account the contribution of each node area. We can write a dpf scripting workflow for both, but we need first to check if this is physically true. Regards Ramdane
I have checked and it doesn’t work.
With the python code:
nmisc = model.operator("mapdl::nmisc") nmisc.connect(10,186) #item index 186 nmisc.connect(11,3) # 3 componenents X, Y, Z fields = nmisc.outputs.fields_container()
I have a error: DPFServerException: mapdl::nmisc<-failed to read ESV from rst file
I have succeeded from contact pressure with:
pres=model.operator('ECT_PRES') pres.inputs.requested_location.connect('Nodal') pres.inputs.time_scoping.connect([i]) pression_c = pres.outputs.fields_container()
But I need the nodal contact force (array equivalent to NFORCE,CONT in APDL)
Thanks a lot
Hello, could you please confirm that the contact elements you are considering are CONTA174 elements?
If so, NMISC 186,187,188 will give you access to CNTX, CNTY and CNTZ. These report the total contact element forces due to tangential stress. I'm not sure that this is what you're looking for. Based on description I think retrieving CNFX, CNFY and CNFZ would be more useful, which report the total contact element forces. These can be accessed in NMISC 43,44 and 45.
Retrieving NMISC from the result file supposes that such data has been saved to the result file, with appropriate setting in OUTPUT APDL command.
NFORCE,CONT command sums and prints, in each component direction for each selected contact node, the nodal force of the selected elements attached to the node.
In the end, using NMISC 43,44 and 45 would help getting the summed value, but not get the value per node. @rlagha I'll let you comment on this one.
Hello,
Yes, I use CONTA174 elements.
Perhaps, one solution can be to determine the area around each node because I’ve succeeded in the extraction of the nodal contact pressure. With these 2 datas, the nodal contact force can be determined and compared with the value obtained with nforce,cont apdl command.
Do you agree with that?
For the moment, I have not succeed in the extraction of the area around each contact node.
Thanks a lot.
Jeff
De : pmaroneh @. Envoyé : lundi 27 septembre 2021 12:42 À : pyansys/DPF-Core @.> Cc : jbrunel59 @.>; Mention @.> Objet : Re: [pyansys/DPF-Core] Extract nodal contact force (#72)
Hello, could you please confirm that the contact elements you are considering are CONTA174 elements?
If so, NMISC 186,187,188 will give you access to CNTX, CNTY and CNTZ. These report the total contact element forces due to tangential stress. I'm not sure that this is what you're looking for. Based on description I think retrieving CNFX, CNFY and CNFZ would be more useful, which report the total contact element forces. These can be accessed in NMISC 43,44 and 45.
Retrieving NMISC from the result file supposes that such data has been saved to the result file, with appropriate setting in OUTPUT APDL command.
NFORCE,CONT command sums and prints, in each component direction for each selected contact node, the nodal force of the selected elements attached to the node. https://user-images.githubusercontent.com/76440649/134893272-a051f220-10bb-4423-b5e3-b7e0aa8727f7.png https://user-images.githubusercontent.com/76440649/134893308-87911543-094b-4ba3-bfba-a1ab03a266d6.png
In the end, using NMISC 43,44 and 45 would help getting the summed value, but not get the value per node. @rlagha https://github.com/rlagha I'll let you comment on this one.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pyansys/DPF-Core/issues/72#issuecomment-927742590 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVX25CFXO7LFBUTWECE2QNLUEBC6FANCNFSM5EROZWCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AVX25CBINW7WOR55VVXC473UEBC6FA5CNFSM5EROZWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG5GDU7Q.gif
-- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus
@jbrunel59 for the area around each node did you tried to get nmisc of (59,60,61, 184)? you need to request nmisc to be saved in the result file. nmisc = model.operator("mapdl::nmisc") nmisc.connect(10,59) # and then 60, 61, 184 nmisc.connect(11,1) fields = nmisc.outputs.fields_container()
Thanks Ramdane
Hi @jbrunel59
I did a small test and using the below script, I was able to print contact force Y for each contact element. You just need to provide the necessary APDL commands (OUTRES) when solving the model, so that NMISC results are available in the rst file. I have listed the MAPDL commands I've used for your reference.
esel,s,ename,,174 ! select all contact elements for later inclusion in OUTRES component cm,_AllContacts,elem OUTRES,MISC,ALL,_AllContacts allsel,all
Python Script:
ansys.dpf import core as dpf
data_sources = dpf.DataSources()
data_sources.set_result_file_path(r'C:\Users\rgpatchi\AppData\Local\Temp\WB_rgpatchi_9224_2\wbnew_files\dp0\SYS\MECH\file.rst')
model=dpf.Model(data_sources)
nmisc = model.operator("mapdl::nmisc")
nmisc.connect(10,44) #item index 44 - CNFY
nmisc.connect(11,1) #1 component Y
fields = nmisc.outputs.fields_container()
field = fields[0]
print(field.data)
Hi,
Thanks, it is working.
Now, do you know how to have the nodes attached to each contact elements.
I tried with :
elements = model.metadata.meshed_region.elements
element=elements.element_by_id(i) # i= contact element number
node=element.node_ids
but it don’t work.
The error:
_InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.INTERNAL
details = "node not found"
debug_error_string = ***@***.***","description":"Error received from peer ipv4:127.0.0.1:50055","file":"src/core/lib/surface/call.cc","file_line":1068,"grpc_message":"node not found","grpc_status":13}"
Regards
De : RGPATCHI @. Envoyé : mercredi 29 septembre 2021 15:10 À : pyansys/DPF-Core @.> Cc : jbrunel59 @.>; Mention @.> Objet : Re: [pyansys/DPF-Core] Extract nodal contact force (#72)
Hi @jbrunel59 https://github.com/jbrunel59
I did a small test and using the below script, I was able to print contact force Y for each contact element. You just need to provide the necessary APDL commands (OUTRES) when solving the model, so that NMISC results are available in the rst file. I have listed the MAPDL commands I've used for your reference.
esel,s,ename,,174 ! select all contact elements for later inclusion in OUTRES component cm,_AllContacts,elem OUTRES,MISC,ALL,_AllContacts allsel,all
Python Script: `from ansys.dpf import core as dpf
data_sources = dpf.DataSources() data_sources.set_result_file_path(r'C:\Users\rgpatchi\AppData\Local\Temp\WB_rgpatchi_9224_2\wbnew_files\dp0\SYS\MECH\file.rst') model=dpf.Model(data_sources)
nmisc = model.operator("mapdl::nmisc") nmisc.connect(10,44) #item index 44 - CNFY nmisc.connect(11,1) #1 https://github.com/pyansys/DPF-Core/pull/1 component Y
fields = nmisc.outputs.fields_container() field = fields[0] print(field.data) `
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pyansys/DPF-Core/issues/72#issuecomment-930159971 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVX25CHFTPIYGWIZMF5TRK3UEMFY3ANCNFSM5EROZWCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AVX25CE527NZUZGEQ27KOJ3UEMFY3A5CNFSM5EROZWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG5YR2YY.gif
-- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus
Hi @jbrunel59 , please could you try this:
scopingP = dpf.operators.scoping.on_property()
scopingP.inputs.property_name.connect("mapdl_element_type") #print(scopingP.inputs.property_name) to get different options
scopingP.inputs.property_id.connect(174)
scopingP.inputs.streams_container.connect(model.metadata.streams_provider)
eleScop = scopingP.outputs.mesh_scoping()
element = elements.element_by_id(eleScop.ids[1]) #first contact element
node=element.node_ids
node
What is scopingP ? Is it a package?
Thanks
De : rlagha @. Envoyé : vendredi 1 octobre 2021 13:57 À : pyansys/DPF-Core @.> Cc : jbrunel59 @.>; Mention @.> Objet : Re: [pyansys/DPF-Core] Extract nodal contact force (#72)
Hi @jbrunel59 https://github.com/jbrunel59 , please could you try this:
scopingP.inputs.property_name.connect("mapdl_element_type") #print(scopingP.inputs.property_name) to get different options scopingP.inputs.property_id.connect(174) scopingP.inputs.streams_container.connect(model.metadata.streams_provider) eleScop = scopingP.outputs.mesh_scoping() element = elements.element_by_id(eleScop.ids[1]) #first contact element node=element.node_ids node
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pyansys/DPF-Core/issues/72#issuecomment-932164165 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVX25CEMCNUN3BHMRHZTYMDUEWOZ5ANCNFSM5EROZWCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AVX25CFJVPYFI4KTAB4PO43UEWOZ5A5CNFSM5EROZWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG6H3ERI.gif
-- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus
@jbrunel59
scopingP = dpf.operators.scoping.on_property()
Ok. Thanks. Now I have a problem with the package dpf (module 'ansys.dpf.core' has no attribute 'operators'). I need version 0.3.0? If yes, I have also a problem in reading rst file
De : rlagha @. Envoyé : vendredi 1 octobre 2021 15:12 À : pyansys/DPF-Core @.> Cc : jbrunel59 @.>; Mention @.> Objet : Re: [pyansys/DPF-Core] Extract nodal contact force (#72)
@jbrunel59 https://github.com/jbrunel59 scopingP = dpf.operators.scoping.on_property()
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pyansys/DPF-Core/issues/72#issuecomment-932214791 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVX25CGUF2FJTINRVERZVV3UEWXQRANCNFSM5EROZWCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AVX25CBTJ6JZK772PYWCZBDUEWXQRA5CNFSM5EROZWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG6IHQBY.gif
-- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus
@jbrunel59 yes please install version 0.3.0. Do you use 2021 R2 Ansys unified install?
I use 2021R1 not R2 !
De : rlagha @. Envoyé : vendredi 1 octobre 2021 15:19 À : pyansys/DPF-Core @.> Cc : jbrunel59 @.>; Mention @.> Objet : Re: [pyansys/DPF-Core] Extract nodal contact force (#72)
@jbrunel59 https://github.com/jbrunel59 yes please install version 0.3.0. Do you use 2021 R2 Ansys unified install?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pyansys/DPF-Core/issues/72#issuecomment-932221723 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVX25CFJZEZNJBRC6QCLOYLUEWYNZANCNFSM5EROZWCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AVX25CGPV7W2N5JT7TUKXN3UEWYNZA5CNFSM5EROZWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG6IJGGY.gif
-- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus
With version 0.3.0 and 2021R1, I’ve this error
Traceback (most recent call last):
File "
scopingP = dpf.operators.scoping.on_property()
File "c:\program files\python36\lib\site-packages\ansys\dpf\core\operators\scoping\on_property.py", line 54, in init
super().__init__(name="scoping_provider_by_prop", config = config, server = server)
File "c:\program files\python36\lib\site-packages\ansys\dpf\core\dpf_operator.py", line 64, in init
server = serverlib._global_server()
File "c:\program files\python36\lib\site-packages\ansys\dpf\core\server.py", line 62, in _global_server
start_local_server()
File "c:\program files\python36\lib\site-packages\ansys\dpf\core\server.py", line 177, in start_local_server
server = DpfServer(ansys_path, ip, port,as_global= as_global, load_operators = load_operators)
File "c:\program files\python36\lib\site-packages\ansys\dpf\core\server.py", line 281, in init
launch_dpf(ansys_path, ip, port)
File "c:\program files\python36\lib\site-packages\ansys\dpf\core\server.py", line 475, in launch_dpf
stderr=subprocess.PIPE)
File "c:\program files\python36\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 143, in init
super(SubprocessPopen, self).__init__(*args, **kwargs)
File "c:\program files\python36\lib\subprocess.py", line 709, in init
restore_signals, start_new_session)
File "c:\program files\python36\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] Le fichier spécifié est introuvable
De : rlagha @. Envoyé : vendredi 1 octobre 2021 15:19 À : pyansys/DPF-Core @.> Cc : jbrunel59 @.>; Mention @.> Objet : Re: [pyansys/DPF-Core] Extract nodal contact force (#72)
@jbrunel59 https://github.com/jbrunel59 yes please install version 0.3.0. Do you use 2021 R2 Ansys unified install?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pyansys/DPF-Core/issues/72#issuecomment-932221723 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVX25CFJZEZNJBRC6QCLOYLUEWYNZANCNFSM5EROZWCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AVX25CGPV7W2N5JT7TUKXN3UEWYNZA5CNFSM5EROZWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG6IJGGY.gif
-- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus
With version 0.3.0 you will need 2021R2, do you have access to it? it's much better then 2021R1
I have to download and install it !!
Thanks a lot
De : rlagha @. Envoyé : vendredi 1 octobre 2021 15:32 À : pyansys/DPF-Core @.> Cc : jbrunel59 @.>; Mention @.> Objet : Re: [pyansys/DPF-Core] Extract nodal contact force (#72)
With version 0.3.0 you will need 2021R2, do you have access to it? it's much better then 2021R1
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pyansys/DPF-Core/issues/72#issuecomment-932231103 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVX25CHCVPN3VUIJOSMMWX3UEWZ35ANCNFSM5EROZWCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AVX25CFBACAZQNQT4TYHIYDUEWZ35A5CNFSM5EROZWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG6ILPPY.gif
-- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus
OK. I will try today.
A last question: do you know if it is possible to get the value of area for each node directly (in case of 2D model)?
Regards.
De : rlagha @. Envoyé : vendredi 1 octobre 2021 15:19 À : pyansys/DPF-Core @.> Cc : jbrunel59 @.>; Mention @.> Objet : Re: [pyansys/DPF-Core] Extract nodal contact force (#72)
@jbrunel59 https://github.com/jbrunel59 yes please install version 0.3.0. Do you use 2021 R2 Ansys unified install?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pyansys/DPF-Core/issues/72#issuecomment-932221723 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVX25CFJZEZNJBRC6QCLOYLUEWYNZANCNFSM5EROZWCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AVX25CGPV7W2N5JT7TUKXN3UEWYNZA5CNFSM5EROZWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG6IJGGY.gif
-- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus
@jbrunel59 , did you tried this? https://github.com/pyansys/DPF-Core/issues/72#issuecomment-929934752
Yes but it is for contact element.
I want to extract the area around each node for applying heat flow (sf apdl command) in a thermal analysis
De : rlagha @. Envoyé : lundi 4 octobre 2021 10:30 À : pyansys/DPF-Core @.> Cc : jbrunel59 @.>; Mention @.> Objet : Re: [pyansys/DPF-Core] Extract nodal contact force (#72)
@jbrunel59 https://github.com/jbrunel59 , did you tried this?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pyansys/DPF-Core/issues/72#issuecomment-933262625 , or unsubscribe https://github.com/notifications/unsubscribe-auth/AVX25CFQTC7O6K7KGEK2NGDUFFQYLANCNFSM5EROZWCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub . https://github.com/notifications/beacon/AVX25CCK3OJBB5KYVTA6YXTUFFQYLA5CNFSM5EROZWCKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOG6QHKII.gif
-- L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast. https://www.avast.com/antivirus
Hi there!
I have a simple question regarding a similar topic: I want to retrieve SMISC bending moment for beam elements (ids 2,15
for My and 3,16
for Mz) [BEAM188]
Why do you connect the op to (10, id)
? Why the '10'? I can´t find it on the API nor the code.
In my case, i obtain good expected results using (for example, for i node) op.connect(10, 2)
At first, i thought this would work:
op = dpf.operators.result.smisc(data_sources=my_data_source_2_rst_file)
fields = op.outputs.fields_container()
But this error comes out:
raise DPFServerException(details) from None
DPFServerException: mapdl::smisc<-failed to read ESV from rst file
So... ¿Why the .connect to input pin 10? I only found it here, not in the APIs... but it´s working!
Thanks in advance,
RR
PD: I ran some tests, it seems that only works for the input 10... All the others got the same error message.
API / code:
`
class smisc(Operator):
""" Read SMISC results from the rst file.
available inputs:
- time_scoping (Scoping, list) (optional)
- mesh_scoping (ScopingsContainer, Scoping, list) (optional)
- fields_container (FieldsContainer) (optional)
- streams_container (StreamsContainer, Stream) (optional)
- data_sources (DataSources)
- mesh (MeshedRegion) (optional)
available outputs:
- fields_container (FieldsContainer)
-
- ....`
Is it possible to extract only nodal contact forces by using dpf? I've succeeded for the contact pressure but it seems not possible to extract forces easily?