# Discussion Forum

Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

## Interpolation function as thermal initial condition

Good morning,

I am trying to import some external data as .txt file and I want to interpolate this data to apply it as an initial temperature condition to my thermo-mechanical simulation. The data is divided in multiple columns with x, y, z coordintes and the temperature values in °C. I've read some coumentation and some other threads about interpolating external data, but I am still not able to apply the data correctly, namely my function till has a waning and appears yellow. The first question is: how can I correctly import the data? Please find attached some screenshots of the interpolation function and the initial condition. I also attach the .txt data for your reference.

After importing the data I would like to convert it to kelvin, can I just add a +273 when defining the initial temperature value? precisely I would expect something like: int1(x[1/m], y[1/m], z[1/m]) + 273

Thank you

3 Replies Last Post 2022年2月8日 GMT-5 上午2:14

Posted: 9 months ago
Updated: 9 months ago

Hello Aron,

The yellow color is a warning about dimensions. Your function is returning a scalar, and you're calling it in a textfield where a temperature is expected. You can fix that by either defining your function to return a temperature, or by adding a "[K]" after your call. And you'll need to add "273.15[K]" for the same reason, so it would look like "int1(x[1/m], y[1/m], z[1/m])[K] + 273.15[K]".

Best,

Jeff

-------------------
Jeff Hiller

Posted: 9 months ago

I suggest that you change your approach as follows:

• In the Units section (see Capture1.PNG) I think that you should enter "m,m,m" for the Arguments and "degC" for the Function (without quotes).

• Untitled.txt contains five columns: Node, X, Y, Z, Temperature. Interpolation functions in COMSOL assume that the first three columns contain the arguments. If you modify or regenerate Untitled.txt so that it only contains the columns X, Y, Z, Temperature then the columns will be interpreted correctly.

By entering "degC" for the function unit you can use the function without any unit conversions, e.g. int1(x,y,z), in an edit field where a temperature is expected: COMSOL will automatically convert from degC to K.