General Mechanical

General Mechanical

Temperature of an element using ANSYS APDL

    • helen.durand
      Subscriber
      Hello,nI have a Transient Thermal simulation where I inserted a command object. As part of my code, I want to select an element and determine its temperature.nThis command always gives a value of zero (selElem is the number of a single element):nTEMP(selElem)nHow to I determine the temperature of an element (say, at the centroid)? nThank you,nKip Niema
    • Erik Kostson
      Ansys Employee
      HinnIn thermal analysis the temp. is the main dof, so that is what we solve for and get on our nodes (so temp is a nodal result).nnTo get nodal temperatures we must use a *get command (see help manual for more info): an example,nn*GET, mytemp, NODE, 1, TEMP, nnThank younnErikn
    • helen.durand
      Subscriber
      Thank you for the reply!nI think I failed to give enough detail in the first post (my apologies).nI have a section of my code (shown below) that is adding elements associated with a material 6 (that I previously defined) to a text file. I want to exclude elements of this material 6 that are above a certain temperature. nALLSELnESEL,S,MAT,,6,6 ! Select all elements that are material type 6n*GET,numOfElem,ELEM,0,COUNT ! Find the number of elements in the selectionn*CFOPEN,elements,txt ! Create a text file called elements.txt nselElem=0n*DO,iter,1,numOfElem,1nselElem=ELNEXT(selElem)  ! Advances to the next highest element in the selectionn! I wanted to find the element temperature at this point, and store this temperature as 'A.' Is there a way to select a single node associated with the element and find its temperature? Or perhaps a way to find the highest temperature among all of the nodes of the element?n*IF,A,LT,1600,THEN n*VWRITE,selElem n(ES20.5) n*ENDIFn*ENDDOn*CFCLOSnALLSELnn
    • Aniket
      Ansys Employee
      https://ansyshelp.ansys.com/account/Secured?returnurl=/Views/Secured/corp/v201/en/ans_cmd/Hlp_C_NSLE.html NSLE command can select all nodes attached to an element.n-AniketnHow to access Ansys help linksnGuidelines for Posting on Ansys Learning Forumn
    • helen.durand
      Subscriber
      Thank you for the reply. I have tried using the NSLE command but I am still having issues. The code I tried is below. I let this run for a couple hours and it was not making any progress (it remained at 1% for solving the mathematical model for nearly the entire time), so I suspect I have done something wrong. The parts I added to the previous code are bolded. I would appreciate any help on fixing this. Thank you very much for your time.nALLSELnESEL,S,MAT,,6,6 ! Select all elements that are material type 6nCM,selectedElements,ELEM ! Creates a named selection of the selected elementsn*GET,numOfElem,ELEM,0,COUNT ! Find the number of elements in the selectionn*CFOPEN,elements,txt ! Create a text file called elements.txt nselElem=0n*DO,iter,1,numOfElem,1 ! Start looping over elements of material 6nselElem=ELNEXT(selElem) ! Advances to the next highest element in the selectionnA = 0 ! A is the maximum temperature among all nodes of the current elementnNSLE,S,ALL ! Selects the nodes associated with the selected elementn*GET,numNodeInEle,NODE,0,COUNT ! Finds the number of nodes in the selected setnselNode = 0n*DO,iter2,1,numNodeInEle,1 ! Start looping over nodes in an elementnselNode=NDNEXT(selNode)nNSEL,S,NODE,,selNode,selNoden*IF,TEMP(selNode),GT,A,THENnA=TEMP(selNode)n*ENDIFn*ENDDO ! End looping over nodes in an elementnCMSEL,S,selectedElements,ELEMn*IF,A,LT,1600,THEN n*VWRITE,selElem n(ES20.5) n*ENDIFn*ENDDO ! End looping over elements of material 6n*CFCLOSnALLSELn
    • Aniket
      Ansys Employee
      I am sorry Ansys employees can not debug user models or commands snippets, but I would recommend following:nThere is an 2 nested do loops in your code so it is going to be computationally intensive depending on the number of elements and nodes. Initially try with smallest model possible, as your code is simple post processing, try with simpler model with least number of elements possible and see if that is working.nAlso, you can check *VGET, *VFUN and *VMASK commands instead of using nested do loops and see if that helps.n-AniketnHow to access Ansys help linksnGuidelines for Posting on Ansys Learning Forumn
Viewing 5 reply threads
  • You must be logged in to reply to this topic.