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 of dependent variables

Please login with a confirmed email address before reporting spam

Hi,

I have been trying to solve a problem which requires interpolation functions or look-up tables. I know we can import data files by adding functions into COMSOL. I have tried that, and it worked. The interpolation functions were dependent on spatial coordinates (r and z).

Now I need to solve a similar problem, but in which case the interpolation functions are dependent on "dependent variables".

For example, I am solving concentration (c) and potential (V) in an electrochemical system. I have a parameter "f" which is a function of concentration and potential, i.e., f=f(c,V). This parameter is used in one of my boundary conditions. I cannot find an explicit expression for "f" in terms of c and V. However, I can make a look-up table for "f".

So this is what I did.
I defined "f" in Options --> Functions, and it is interpolated from an external .txt file. In the text file, the two variables are c and V.
The results do not look correct.

Can COMSOL support an interpolation function dependent on dependent variables?
or Is there any other method to solve it?

Thank you very much!


3 Replies Last Post 2010年7月23日 GMT-4 12:00
COMSOL Moderator

Hello Shao-Ling Wu

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年7月22日 GMT-4 11:22
Hi, Shao-Ling,

I also tried to use interpolation function and met a problem. Can you give me some suggestion?

I am trying to interpolate spatial-varying material data. The interpolation functions were dependent on spatial coordinates (r)

In Comsol Multiphysics user guide, the spatial arguments are x,y,z.

My question is:
How can we use r (r=sqrt(x^2+y^2)) as the spatial arguments?


Hi, Shao-Ling, I also tried to use interpolation function and met a problem. Can you give me some suggestion? I am trying to interpolate spatial-varying material data. The interpolation functions were dependent on spatial coordinates (r) In Comsol Multiphysics user guide, the spatial arguments are x,y,z. My question is: How can we use r (r=sqrt(x^2+y^2)) as the spatial arguments?

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年7月22日 GMT-4 16:35
Hi

define a global variable r = sqrt(x^2+y^2) and use "r" thereafter, check the doc for global variables

--
Good luck
Ivar
Hi define a global variable r = sqrt(x^2+y^2) and use "r" thereafter, check the doc for global variables -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2010年7月23日 GMT-4 12:00
Hi, Ivar,

Thanks very much for your reply. I followed your sugestion,define a global variable r = sqrt(x^2+y^2), and also define a global interpolation ep_r(r). However, it still did not work. It seems that Comsol has not recognized this variable r in the interpolation ep_r(r). Maybe I did not understand your comments " use "r" thereafter ".

Can you explain more about this?

The attached mph file is my model.

Thanks in advance
Hi, Ivar, Thanks very much for your reply. I followed your sugestion,define a global variable r = sqrt(x^2+y^2), and also define a global interpolation ep_r(r). However, it still did not work. It seems that Comsol has not recognized this variable r in the interpolation ep_r(r). Maybe I did not understand your comments " use "r" thereafter ". Can you explain more about this? The attached mph file is my model. Thanks in advance

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.