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.

Using analytical functions

Please login with a confirmed email address before reporting spam

Hello,

I have a simple question. I am trying to use analytical functions in COMSOL. However, after I define my function in the model, I can't seem to access it if I put in a variable as the argument.

For instance, suppose that I define a function Cb = t. When I try to input Cb(t) as a term in the boundary conditions, it doesn't seem to work. However, if I say Cb(100), it seems to work, but it's not what I want. I want to be able to use Cb as a function of time.

Thanks,
Henry

3 Replies Last Post 6 feb 2011, 02:52 GMT-5
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 5 feb 2011, 03:26 GMT-5
Hi

how is your variable "t" defined ? Normally for COMSOL "t" is time and if you have no transient solver then t=0 by default.

Try to avoid single lettr variable names for private variables, most of these are already used internally by COMSOL

Unfortunately there is no build-in "variable name conflict help or "detector" " today

--
Good luck
Ivar
Hi how is your variable "t" defined ? Normally for COMSOL "t" is time and if you have no transient solver then t=0 by default. Try to avoid single lettr variable names for private variables, most of these are already used internally by COMSOL Unfortunately there is no build-in "variable name conflict help or "detector" " today -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 5 feb 2011, 16:55 GMT-5
Hi Ivar,

Yes, I'm trying to run a transient analysis, so "t" is referring to time in my problem. It's just that if I define a function and then try to to evaulate that function at time "t", it doesn't work.

For instance, suppose my function is Cb = t. If I try to access that function as "Cb(t)" in the boundary settings, it doesn't work. If I type in "Cb(100)" or something like that, it works. It I directly put in "t" in the boundary setting, it also works.

Do you have any idea why this is the case?

Thanks,
Henry
Hi Ivar, Yes, I'm trying to run a transient analysis, so "t" is referring to time in my problem. It's just that if I define a function and then try to to evaulate that function at time "t", it doesn't work. For instance, suppose my function is Cb = t. If I try to access that function as "Cb(t)" in the boundary settings, it doesn't work. If I type in "Cb(100)" or something like that, it works. It I directly put in "t" in the boundary setting, it also works. Do you have any idea why this is the case? Thanks, Henry

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 6 feb 2011, 02:52 GMT-5
Hi

what do you mean by not working ?

normally you should write Cb(t[1/s]) to avoid the "orange" unit errors, as operands are to be "unitless", but if "t" is defined = you are running a transient analysis it should work. Strange

--
Good luck
Ivar
Hi what do you mean by not working ? normally you should write Cb(t[1/s]) to avoid the "orange" unit errors, as operands are to be "unitless", but if "t" is defined = you are running a transient analysis it should work. Strange -- Good luck Ivar

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.