Ansys Assistant will be unavailable on the Learning Forum starting January 30. An upgraded version is coming soon. We apologize for any inconvenience and appreciate your patience. Stay tuned for updates.
General Mechanical

General Mechanical

Topics related to Mechanical Enterprise, Motion, Additive Print and more.

Commands (APDL)

    • Engineering Soul
      Subscriber

      Hi,

      I am running a steady state thermal simulation in Ansys. I have run the simulation once and I have the temperature profile. Now I want to select a part of the model and give heat generation value to it which, for example, depends on the temperature profile of that part. I am new to using Commands (APDL). I wrote a few lines of code and inserted it in Solution branch and cleared the generated data and resolved it. Below is my code:

      allsel,all
      cmsel,s,named_selection
      nsle,s
      *get,numnodes,node,,count
      *dim,nlist,array,numnodes
      *do,i,1,numnodes
          nlist(i)=ndnext(i-1)
      *enddo
      *dim,templ,array,numnodes
      *vget,templ(1),node,nlist(1),temp,numnodes
      *dim,qgen,array,numnodes
      cmsel,s,named_selection
      nsle,s
      bfdele,all,HGEN
      *do,i,1,numnodes
          nodeid = nlist(i)
          xval = NX(nodeid)
          yval = NY(nodeid)
          r = sqrt(xval**2 + yval**2)
          t = templ(i)
          qgen(i) = t/2
          bf,nodeid,HGEN,qgen(i)
      *enddo
      allsel,all

      I am not getting a new temperature profile at all. I would really appreciate if someone could review my code and let me know if any modification is needed in the code.

    • dlooman
      Ansys Employee

      You seem to be a fast learner of APDL!  :)  Did you use AI at all to create that script?  I don't see why your commands didn't create a heat generation load as you wanted, but the parameter r and t don't seem to be used in defining the heat generation.  BFLIST or /PBF,HGEN,,1 followed by EPLOT would confirm your input is correct.  Presumably you did a new solve after creating the heat generation load.  It's possible to make the heat generation a function of location using a table array:  BF,ALL,HGEN,%Table_Name% but your way is a good brute force method.  Perhaps your heat generation rates are too small.  A heat generation rate of temperature divided by 2 is quite small in most unit systems.

      • Engineering Soul
        Subscriber

        Hi dlooman,

        The reason you see other parameters is because I was going to use them originally. Since, I was learning APDL, the heat generation is a test case here (I know it's small), I just wanted to know if my code would run. I also put in those other parametrs to see if I could see those values being calculated in the solution information. I did manage to run the code succesfully after putting /SOLU in the start, because it seems BF and BFDELE commands are not recognized in the post-processor.

    • dlooman
      Ansys Employee

      Correct.  Sounds like you found the issue then.  Good to check the command echo for when creating such a macro.

    • Engineering Soul
      Subscriber

       

      I also want to mention that I did a new solve just after I added the Commands (APDL) in the solution branch and then cleared the generated data and hit solve. I think the heat generation load should be applying during the iterations while the Commands are executing, or is that not the case?

      How do I re-solve after creating the heat generation load? In my understanding, the code would run and apply the heat generation load and then solve since I already clicked on ‘Solve’. Isn’t that not how it works?

      I also want to ask that if Ansys stores the nodeid and heat generation values once the solution is done. Is there a way to extract these values after the code has been executed. Right now, I am seeing only one value of qgen but probably because it is displaying the value of the last iteration.

       

    • dlooman
      Ansys Employee

      The input is solved for when you do a solve.  You can issue BFLIST before or after the solve to confirm the values.

    • Engineering Soul
      Subscriber

      I inserted BFLIST command in the iteration and now I see the same node during the iteration where heat generation is applied, although the value of heat generation is changing. What could possibly be wrong?

    • Engineering Soul
      Subscriber

      Well, I fixed it now. but I am getting a new error now:

      *** ERROR ***                           
       The value of TEMP at node 179666 is 68295002.8.  It is greater than the 
       current limit of 1000000 (which can be reset on the NCNV command).      
       This generally indicates that there are no temperature constraints or   
       convections applied

       

      Why is this happening? I wonder if my code removes the boundary conditions I gave in the GUI?

    • dlooman
      Ansys Employee

      Your code doesn't seem to delete any boundary conditions like convection or temperature constraints.  A debug technique I use is to do a short transient analysis to see where the model is heating up fast.  Also, you could have boundary conditions on one part of the model, put a body might not be attached to the rest of the model.

Viewing 7 reply threads
  • You must be logged in to reply to this topic.
[bingo_chatbox]