ramiromena
Subscriber
Dear @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.n