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

Please login with a confirmed email address before reporting spam

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 Feb 8, 2022, 2:14 a.m. EST
Jeff Hiller COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 2 years ago Nov 23, 2021, 8:35 a.m. EST
Updated: 2 years ago Nov 23, 2021, 8:43 a.m. EST

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
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

Gunnar Andersson COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 2 years ago Nov 25, 2021, 2:23 a.m. EST

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.

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.

Please login with a confirmed email address before reporting spam

Posted: 2 years ago Feb 8, 2022, 2:14 a.m. EST

Hi Jeff, hi Gunnar,

thank you both for your reply, I was able to solve the problem.

Best Regards, Aron

Hi Jeff, hi Gunnar, thank you both for your reply, I was able to solve the problem. Best Regards, Aron

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.