-
-
February 16, 2023 at 1:10 pm
chakraboa
SubscriberHi, I am fairly new to ANSYS, and was trying to impose a particular temperature on a named selection (surface) through the "COMMANDS" option. However, I am seeing that all the nodes are getting selected instead of the particular named selection. Here's my code snippet:
temp_top = 100 ! C
ALLSEL, ALL
CMSEL,S,y_top_surfaceNSLE,S,ALL
NumNodes=0
COUNT=0
*GET,NumNodes,NODE,0,COUNT
CurNode=0
*DO,i,1,NumNodes
*GET,CurNode,NODE,CurNode,NXTH
BF,CurNode,TEMP,temp_top
*ENDDOALLSEL, ALL
Any help in figuring what I am doing wrong in the snippet would be really helpful!
-
February 16, 2023 at 6:53 pm
Sheldon Imaoka
Ansys EmployeeHi Aritra,
Is “y_top_surface” a nodal component? If so, just use
BF,y_top_surface,TEMP,temp_top
It may not be working because, if y_top_surface is NOT an element component, then NSLE selects all nodes attached to all selected elements. If all elements are still selected, then all nodes get selected, thus negating the effect of your “CMSEL” command you issued earlier.
Try just replacing everything with 2 lines:
temp_top = 100 ! C
BF,y_top_surface,TEMP,temp_topand that should do the trick.
(BTW, why are you using APDL? Are you using Mechanical?)
Regards,
Sheldon -
February 16, 2023 at 7:04 pm
chakraboa
SubscriberHi Sheldon, I will try the above. I am using Mechanical and this is in the "Commands(APDL)" object.
Aritra
-
February 16, 2023 at 7:46 pm
Sheldon Imaoka
Ansys EmployeeHi Aritra,
In a structural analysis, you should be careful since the nodes that do not have temperature assigned will default to having the environment temperature assigned to them. This means that, if you are performing a purely structural analysis and have 100°C applied only to a surface, the rest of the body may be at 22°C. This is unrealistic and can cause artificially high stresses (in addition to wrong results).
If you expect a thermal gradient such that one surface is maintained at 100°C while the rest of the body may have heat dissipated, I strongly suggest that you perform a thermal analysis first. You can link the temperature results to a structural analysis, so the imposed temperatures will be more realistic. Please take a look at this course for more info on performing thermal analyses as well as linking results from a thermal analysis to structural analysis:
Topics in Heat Transfer Analyses - ANSYS Innovation Courses
Regards,
Sheldon -
February 16, 2023 at 7:51 pm
chakraboa
SubscriberHi Sheldon, that is exactly what I am trying now, as in a thermal analysis first, and then I will perform structural analysis on the result. A couple of question, for thermal analysis as well if I create a "named selection" and want to assign the temperature to that selection (outer surface) is the command still
BF, named_selction, TEMP, value?
-
February 16, 2023 at 7:55 pm
Sheldon Imaoka
Ansys EmployeeHi Aritra,
No, in a thermal analysis, you can specify temperature directly on a surface in the GUI. Please review the course videos I suggested for more information on how to perform a thermal analysis. No APDL scripts are required.
(For APDL, in a thermal analysis, "D" command constraints the temperature since it is a DOF constraint; however "BF" specifies the temperature in a structural analysis since it is a 'body force' type of load. However, as noted above, you don't need to use any APDL scripting in Mechanical for what you want to do.)
Regards,
Sheldon
-
-
February 16, 2023 at 7:54 pm
Sheldon Imaoka
Ansys EmployeeHi Aritra,
To clarify my earlier response, if you have one surface at 100°C, you actually expect to have a smooth thermal gradient such that the nodes adjacent to the 100°C surface may be 95°C (as an example), then nodes further away may be 90°C, etc. If you just specify 100°C on the nodes on the surface, the adjacent nodes will have your environment temperature, which is, by default, specified as 22°C. So over a very short span, your temperature drops from 100°C to 22°C!
Since we don't know how the part may cool down away from the 100°C surface (if that surface is really maintained at 100°C), that is why you should perform a heat transfer analysis first - the temperature field outside of the 100°C surface is unknown, so we solve for that first. Once we have determined the temperature field for your entire system/assembly, Mechanical can then automatically map the temperature field in your structural analysis, so you get correct & more realistic thermal strains, stress distribution, etc.
I hope that may clarify my earlier statements on why you probably don't want to just specify 100°C on a surface. This is actually this functionality is not directly in Mechanical, as it typically doesn't make sense to specify a vertex, edge, or surface of a part to have a different temperature than the rest of the body.
Regards,
Sheldon-
February 16, 2023 at 8:07 pm
chakraboa
SubscriberHi Sheldon, thanks a lot for the replies. I want to do via "Commands (APDL)" because the current exercise is part of a larger problem. The final goal is to specify a temperature function instead of a single value which makes applying such via APDL much convenient.
So for a named selection, I will have different temperature for different elements which is based on the coordinates, that's why I was looking for the APDL commands.
-Aritra-
February 16, 2023 at 8:11 pm
Sheldon Imaoka
Ansys EmployeeHi Aritra,
Thanks for your reply. In that case, if the built-in functionality of Mechanical doesn't serve your needs, you can use the "D" command to impose a known temperature value on nodes (or nodal component) in a thermal analysis. (BF command is only for imposing temperatures in a structural analysis.)
Regards,
Sheldon -
February 16, 2023 at 8:16 pm
chakraboa
SubscriberHi Sheldon,
Thanks again, and, yes, I tried "D" for a simple case and that works.
Another quick question, the original mechanical geometry has some blocks that are identified as rigid bodies which probably are not supported by the thermal solver.
In that case, can i solve for the temperature field for part of the geometry and use that solution for the subsequent mechanical simulation with the full geometry (i.e., inlcuding the rigid blocks that I suppressed for the thermal solver) ?
-Aritra
-
February 16, 2023 at 9:36 pm
Sheldon Imaoka
Ansys EmployeeHi Aritra,
Yes, what you noted is possible. You can even have different meshes and only map temperatures from certain bodies from thermal to structural. Lesson 4 in the course link I shared earlier covers this near the 11:00 mark.
Regards,
Sheldon -
February 16, 2023 at 9:46 pm
chakraboa
SubscriberHi Sheldon,
yeah I looked at the leason, and am in the process of implementing such in my model. Let's see how it fares.
Thanks,
Aritra
-
-
-
- The topic ‘assign temperature to a named selection surface using commands in ansys’ is closed to new replies.
-
6535
-
1906
-
1463
-
1311
-
1022
© 2026 Copyright ANSYS, Inc. All rights reserved.