Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

Define time dependent interpolation function.

Please login with a confirmed email address before reporting spam

Hi, guys

I am a COMSOL newbie and need some help on defining time dependent interpolation function.

I have a pretty simple model, a sphere. I need to define an volumetric force input F( t, r, z )as below, which varies both with time and space:

F( t, r, z ) = I * sin(t) * f( r , z ) %%% I is const, t is time, r & z are space coordinates with unit meter

Basically, F consists of two parts, one is time dependent : sin ( t ) and the other space dependent part is grid point values for defining interpolation function : f(r, z).

Since I was successful before with the static model (only f(r, z)). So, I just defined firstly a interpolation function f (r,z) and then the new time-variant force input as a analytic function with the following expression:

I * sin(t) * f (r[m^-1],z[m^-1]) %%%% arguments: t, r, z

COMSOL complains:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Undefined variable.
- Variable: r
- Function name: F
Error in multiphysics compilation.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Aren't r & z implicitly defined already when I defined the interpolation function and checked "Use space coordinates as arguments"? Do I need to explicitly define them again somewhere else?

So I changed the expression:

I * sin(t) * f %%%%% argument: t

COMSOL complains again:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Undefined variable.
- Variable: f
- Function name: F
Error in multiphysics compilation.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Now, this time COMSOL can not recognize the interpolation function f...

Thank you in advance!

Best,
Xiao




1 Reply Last Post 26 mars 2012, 17:51 UTC−4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 26 mars 2012, 17:51 UTC−4
I think I have solved the problem.

I've found some useful discussion on this thread:

www.uk.comsol.com/community/forums/general/thread/15821/

As suggested by Magnus, it's illegal to use Global variables in in defining an analytic function. Similarly, it would not be legal to incorporate Global interpolation functions either.

So, for my case, I should define analytic function as:

F = a * sin(b) * c %%%% arguments: a, b, c

And call it with: F(I, t, F(x,y))
I think I have solved the problem. I've found some useful discussion on this thread: http://www.uk.comsol.com/community/forums/general/thread/15821/ As suggested by Magnus, it's illegal to use Global variables in in defining an analytic function. Similarly, it would not be legal to incorporate Global interpolation functions either. So, for my case, I should define analytic function as: F = a * sin(b) * c %%%% arguments: a, b, c And call it with: F(I, t, F(x,y))

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.