TAGGED: convection
-
-
March 23, 2021 at 10:11 am
Ramiro MENA
SubscriberDear Ansys Learning Forum Team,
I am writing an Iron Python script on Ansys Mechanical for a thermal problem.
When a convection load is created (A), in order to define the Film coefficient (B), I need to perform a click on the dropdown list and then, I can select the Tabular option (C). (See attached figure).
However, if I want to automatize this task, I can not do it manually. Therefore, my question is how to define a film coefficient table by command line? (i.e. to perform task (C) ).
Any suggestion will be appreciated.
Best regards,
Ramiro M.
Ps: After reading the Ansys ACT manual, it says
Field Convection.FilmCoefficient { get; }
Gets the FilmCoefficient.
Remarks
This property cannot be set. When one wants to change its value, one should operate on the returned Field object, either on its inputs or on its output variables .
March 23, 2021 at 1:12 pmAshish Khemka
Forum ModeratornnPlease refer to the following link for the command used:nnnnRegards,nAshish Khemkann/forum/discussion/3978/how-to-access-the-ansys-online-helpnMarch 23, 2021 at 1:42 pmErik Kostson
Ansys EmployeeNot sure if you want a command snippet or act call to define a convection with time dependent film coefficient.nnFor the later part, say we add a Convection via ACT :nConv=ExtAPI.DataModel.Project.Model.Analyses[0].AddConvection()nnThe field you mentioned in your post (Convection.FilmCoefficient { get; }), we can use to get, but we need to use Inputs and Output to actually set them.nnSo to set them: (you would need to change this as needed in your code, but at least you can see how it can be done)n---nConv.FilmCoefficient.Inputs[0].DiscreteValues=[Quantity('0[s]'),Quantity('0.5[s]'),Quantity('1[s]')]nConv.FilmCoefficient.Output.DiscreteValues=[Quantity('0[W m^-1 m^-1 C^-1]'),Quantity('99[W m^-1 m^-1 C^-1]'),Quantity('999[W m^-1 m^-1 C^-1]')]nn---Hope this helpsErikMarch 23, 2021 at 3:54 pmRamiro MENA
SubscriberDear @akhemka nThank you for your reply. I did not consider (yet) the option of including an APDL command on my script. At the moment I am working with Ansys ACT and its snippets (but I am sure I will need APDL sooner or later).nMarch 23, 2021 at 5:03 pmRamiro MENA
SubscriberDear @ekostson nThank you for your reply. Now I am able to define and populate a table automatically on my script.nHowever, now I have the following questions (just for curiosity):nWhen the Inputs are defined in the line: Conv.FilmCoefficient.Inputs[0].DiscreteValues=[Quantity('0[s]'),Quantity('0.5[s]'),Quantity('1[s]')] you are defining a time dependent FilmCoefficient. So, if you want to define a temperature dependent FilmCoefficient, first I tried to change only the units from time to temperature, but it didn't work, so, I opted to use: Conv.IndependentVariable = LoadVariableVariationType.Temperature, then I proceeded to define the film Coefficient values (that now depend on Temperature): Conv.FilmCoefficient.Output.DiscreteValues=[Quantity('0[W m^-1 m^-1 C^-1]'),Quantity('99[W m^-1 m^-1 C^-1]'),Quantity('999[W m^-1 m^-1 C^-1]')] . So, my question is if there is a way to define in advance the temperature as an indepentent variable?nIf I have a list only with numerical values that will be used to populate my table, first I need to create a new list with the Ansys syntax [Quantity('value[unit]', Quantity('value[unit]',...,Quantity('value[unit]')]. If the table has a few values, you can do it manually, but if you have a big table it starts to be a little bit cumbersome. So, I was able to define a function to populate the table (see the attached code below). However, I would be interested to know if there is a more efficient method to load the data (maybe to import the temperature dependent table in a XML file?)nn#Temperature and FilmCoefficient values for air (data) nT_air = [10,20,30] #Temperature values in [C]nh_air = [5,7.5,10] #Film coefficient values in [W/m2K]nndef Temperature_FilmCoefficient_values(T,h):n#Function to write a list with the Ansys sintax [Quantity('value[unit]', Quantity('value[unit]',...,Quantity('value[unit]')]n#Input: T (list) numerical values of the Temperature in [C]n#      h (list) numerical values of the FilmCoefficient in [W/m2K]n#Output T_list (list) Temperature with the Ansys Syntaxn       h_list (list) FilmCoefficient with the Ansys Syntax n   T_list = []n   h_list = []n   for i in range(len(T)):n       T_list.append(Quantity(str(T[i])+'[s]'))n       h_list.append(Quantity(str(h[i]) + '[W m^-1 m^-1 C^-1]'))n   return T_list, h_listnn#Ansys codenConv = Model.Analyses[0].AddConvection() #Add convection loadnConv.FilmCoefficient.Inputs[0].DiscreteValues = T_list #Populate the table with T_listnConv.IndependentVariable = LoadVariableVariationType.Temperature #Define temperature as the independent variablenConv.FilmCoefficient.Output.DiscreteValues = h_list #Populate the table with h_listnConv.AmbientTemperature.Output.SetDiscreteValue(0, Quantity(26.85, C)) #Set the ambient temperaturennAgain, thank you in advance for your help and guidance.nBest regards,nRamiro M.nApril 17, 2023 at 12:22 ammakinse
SubscriberPlease, can you explain how to define a film coefficient using a function
April 17, 2023 at 1:46 amAlonso Sycorax
SubscriberI cannot clear all. Maybe i need time to practice it.
Thanks for sharing
April 17, 2023 at 1:48 amAlonso Sycorax
Subscriber/forum/forums/topic/how-to-access-the-ansys-online-help/ dino game
Waiting for the answer too
April 17, 2023 at 1:50 ammakinse
SubscriberDo you need help inputting the film coefficient function too?
Viewing 8 reply threads- The topic ‘How to define a film coefficient table by command line in Ansys Mechanical?’ is closed to new replies.
Ansys Innovation SpaceTrending discussionsTop Contributors-
3597
-
1283
-
1107
-
1068
-
978
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-