Discussion Forum

Interpolation function of dependent variables

Topics: no topics

Thread index  |  Previous thread  |  Next thread  |  Start a new discussion

RSS FeedRSS feed   |   Email notificationsTurn on email notifications   |   3 Replies   Last post: July 23, 2010 4:00pm UTC
Shao-Ling Wu

Shao-Ling Wu

March 12, 2010 2:40pm UTC

Interpolation function of dependent variables

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!

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Jie Xiang

Jie Xiang

July 22, 2010 3:22pm UTC in response to Shao-Ling Wu

Re: Interpolation function of dependent variables

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?


Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Ivar Kjelberg

Ivar Kjelberg
Moderator

July 22, 2010 8:35pm UTC in response to Jie Xiang

Re: Interpolation function of dependent variables

Hi

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

--
Good luck
Ivar

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse

Jie Xiang

Jie Xiang

July 23, 2010 4:00pm UTC in response to Ivar Kjelberg

Re: Interpolation function of dependent variables

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

Reply  |  Reply with Quote  |  Send private message  |  Report Abuse


Rules and guidelines