-
-
July 7, 2025 at 12:18 am
Engineering Soul
SubscriberHi,
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,allI 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.
-
July 7, 2025 at 2:11 pm
dlooman
Ansys EmployeeYou 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.
-
July 7, 2025 at 3:43 pm
Engineering Soul
SubscriberHi 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.
-
-
July 7, 2025 at 4:21 pm
dlooman
Ansys EmployeeCorrect. Sounds like you found the issue then. Good to check the command echo for when creating such a macro.
-
July 7, 2025 at 10:05 pm
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.
Â
-
July 8, 2025 at 2:27 pm
dlooman
Ansys EmployeeThe input is solved for when you do a solve. You can issue BFLIST before or after the solve to confirm the values.
-
July 10, 2025 at 3:23 am
Engineering Soul
SubscriberI 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?
-
July 10, 2025 at 7:48 am
Engineering Soul
SubscriberWell, 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?
-
July 10, 2025 at 2:25 pm
dlooman
Ansys EmployeeYour 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.
-
- You must be logged in to reply to this topic.
-
6545
-
1906
-
1463
-
1311
-
1022
© 2026 Copyright ANSYS, Inc. All rights reserved.