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.

Vary a parameter non-linearly with time

Please login with a confirmed email address before reporting spam

Hello,

I want to vary a parameter (Voltage) polynomially in time.

So i would like to have:

V(t) = a*t^6 + b*t^5 + ... + c*t + d

The problem is that COMSOL keeps the units from the variable t so my expression ends up with inconsistent units and i am not permitted to use it.

Is there anyway i can extract the value of t at each step in the solver and use it numerically without its units?

Kind regards,
Dom.




10 Replies Last Post Apr 6, 2011, 12:14 p.m. EDT

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 4, 2011, 10:54 a.m. EDT
Actually I would be happy if i could manually enter a voltage for each time. It would serve my purpose as there aren't too many time values to enter.

Thanks.
Actually I would be happy if i could manually enter a voltage for each time. It would serve my purpose as there aren't too many time values to enter. Thanks.

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 Apr 4, 2011, 11:08 a.m. EDT
Hi

Unit issues are warnings, COMSOL continues to calculate and it's correct if you use the correct values.

then its "easy" either you define the units of your "constants a*t^6 as a[V/s^6]*t or a*(t[1/s])^6 the latter gives you a unitless result, you you might need to add a *1[V] where you use it.

--
Good luck
Ivar
Hi Unit issues are warnings, COMSOL continues to calculate and it's correct if you use the correct values. then its "easy" either you define the units of your "constants a*t^6 as a[V/s^6]*t or a*(t[1/s])^6 the latter gives you a unitless result, you you might need to add a *1[V] where you use it. -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 4, 2011, 2:22 p.m. EDT
Hi!
I have to vary the radius of a circle with time sinusoidally. When I did it by defining 'radius' as a function of sine in 'Parameters' section, I got an error message 'Unknown model parameter t'. I tried to resolve this issue by explicitly defining a parameter 'T' using range function. But then it shows 'Failed to evaluate expression; Function: Range'..I also tried to define 'radius' as a variable but got an error.

Kindly guide me on how to define time varying radius parameter of a circle or more generally time varying parameters which represent geometrical figure dimensions.

Regards
Ankit Gupta
Hi! I have to vary the radius of a circle with time sinusoidally. When I did it by defining 'radius' as a function of sine in 'Parameters' section, I got an error message 'Unknown model parameter t'. I tried to resolve this issue by explicitly defining a parameter 'T' using range function. But then it shows 'Failed to evaluate expression; Function: Range'..I also tried to define 'radius' as a variable but got an error. Kindly guide me on how to define time varying radius parameter of a circle or more generally time varying parameters which represent geometrical figure dimensions. Regards Ankit Gupta

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 4, 2011, 2:22 p.m. EDT
Hi!
I have to vary the radius of a circle with time sinusoidally. When I did it by defining 'radius' as a function of sine in 'Parameters' section, I got an error message 'Unknown model parameter t'. I tried to resolve this issue by explicitly defining a parameter 'T' using range function. But then it shows 'Failed to evaluate expression; Function: Range'..I also tried to define 'radius' as a variable but got an error.

Kindly guide me on how to define time varying radius parameter of a circle or more generally time varying parameters which represent geometrical figure dimensions.

Regards
Ankit Gupta
Hi! I have to vary the radius of a circle with time sinusoidally. When I did it by defining 'radius' as a function of sine in 'Parameters' section, I got an error message 'Unknown model parameter t'. I tried to resolve this issue by explicitly defining a parameter 'T' using range function. But then it shows 'Failed to evaluate expression; Function: Range'..I also tried to define 'radius' as a variable but got an error. Kindly guide me on how to define time varying radius parameter of a circle or more generally time varying parameters which represent geometrical figure dimensions. Regards Ankit Gupta

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 4, 2011, 2:36 p.m. EDT
Thank Ivar - this has solved my problem.

By the way, I read in another thread that you don't actually work for COMSOL, and you are giving all this help out of the goodness of your heart. If this is true you are a hero. Even if it's not you're still damn helpful.

Kind regards.
Dom.
Thank Ivar - this has solved my problem. By the way, I read in another thread that you don't actually work for COMSOL, and you are giving all this help out of the goodness of your heart. If this is true you are a hero. Even if it's not you're still damn helpful. Kind regards. Dom.

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 Apr 5, 2011, 1:38 a.m. EDT
Hi

indeed I'm not from COMSOL, neither not any hero ;)

but as physicist I would like to see more physics trained people out here, and COMSOL is such a good tool to illustrate physics ...

And anyhow, one always harvest something from "giving out", it's just that one must be prepared to give more than what one receive, but that is always like that, another way of testing entropy ;)

--
Good luck
Ivar
Hi indeed I'm not from COMSOL, neither not any hero ;) but as physicist I would like to see more physics trained people out here, and COMSOL is such a good tool to illustrate physics ... And anyhow, one always harvest something from "giving out", it's just that one must be prepared to give more than what one receive, but that is always like that, another way of testing entropy ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 5, 2011, 2:09 a.m. EDT
R/p Ivar
Need you help..

I have to vary the radius of a circle with time sinusoidally. When I did it by defining 'radius' as a function of sine in 'Parameters' section, I got an error message 'Unknown model parameter t'. I tried to resolve this issue by explicitly defining a parameter 'T' using range function. But then it shows 'Failed to evaluate expression; Function: Range'..I also tried to define 'radius' as a variable but got an error.

Kindly guide me on how to define time varying radius parameter of a circle or more generally time varying parameters which represent geometrical figure dimensions. I am using Version 4.1..Kindly help me.

Regards
Ankit Gupta
R/p Ivar Need you help.. I have to vary the radius of a circle with time sinusoidally. When I did it by defining 'radius' as a function of sine in 'Parameters' section, I got an error message 'Unknown model parameter t'. I tried to resolve this issue by explicitly defining a parameter 'T' using range function. But then it shows 'Failed to evaluate expression; Function: Range'..I also tried to define 'radius' as a variable but got an error. Kindly guide me on how to define time varying radius parameter of a circle or more generally time varying parameters which represent geometrical figure dimensions. I am using Version 4.1..Kindly help me. Regards Ankit Gupta

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 Apr 5, 2011, 3:16 a.m. EDT
Hi

t the time is only defined if you are using a transient solver, and only once started. I usually add a Parameter t=0[s] even when using a transient solver to avoid error messages during model build up.

Then you must distinguish Parameter and Variable. A Parameter (Constant in v3.5) is read once at programme start, but it can be overwritten by a COMSOL variable later on. A Variable is expected to change as the solver advances (might not but then its better to define it as a Parameter. Global variables are not implicitly depending on x,y,z, (t ? not sure), while model variables might, and might even have different definition per entity.

What follows is writing out my thought, but these ideas needs to be tested as I see I'm stuck, not sure what to propose, would have to test it out :) But I'm sure you could too

So define your R0 and Ra initial radius and amplitude variation of radius as Parameters and then either define a Variable or write directly in the circle radius field

Next issue if you call a transient solver I'm not sure the geometry is updated ? (I would have to test it out too myself)

One way is to use the deformed geometry physics DG

Another way to get the geometry updated is to use explicitly an explicit Parametric sweep. Normally you do not use "t" as parameter, but one could, then one need to call the transient solver with only one time

Next issue this that an external Parametric sweep like that normally restarts from initial conditions default all = "0" not the best approach.

Hope I didn't confuse you fully, but you need to try it out, as I do not have a simple straight answer, not sure what to propose as quickest ;)

--
Good luck
Ivar
Hi t the time is only defined if you are using a transient solver, and only once started. I usually add a Parameter t=0[s] even when using a transient solver to avoid error messages during model build up. Then you must distinguish Parameter and Variable. A Parameter (Constant in v3.5) is read once at programme start, but it can be overwritten by a COMSOL variable later on. A Variable is expected to change as the solver advances (might not but then its better to define it as a Parameter. Global variables are not implicitly depending on x,y,z, (t ? not sure), while model variables might, and might even have different definition per entity. What follows is writing out my thought, but these ideas needs to be tested as I see I'm stuck, not sure what to propose, would have to test it out :) But I'm sure you could too So define your R0 and Ra initial radius and amplitude variation of radius as Parameters and then either define a Variable or write directly in the circle radius field Next issue if you call a transient solver I'm not sure the geometry is updated ? (I would have to test it out too myself) One way is to use the deformed geometry physics DG Another way to get the geometry updated is to use explicitly an explicit Parametric sweep. Normally you do not use "t" as parameter, but one could, then one need to call the transient solver with only one time Next issue this that an external Parametric sweep like that normally restarts from initial conditions default all = "0" not the best approach. Hope I didn't confuse you fully, but you need to try it out, as I do not have a simple straight answer, not sure what to propose as quickest ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 5, 2011, 4:06 a.m. EDT
Thanks a lot Sir.

I'll get back to you after trying these suggestions.
Regards
Ankit Gupta
Thanks a lot Sir. I'll get back to you after trying these suggestions. Regards Ankit Gupta

Ruud Borger COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Apr 6, 2011, 12:14 p.m. EDT

Thank Ivar - this has solved my problem.

By the way, I read in another thread that you don't actually work for COMSOL, and you are giving all this help out of the goodness of your heart. If this is true you are a hero. Even if it's not you're still damn helpful.

Kind regards.
Dom.


Ivar is a living legend to all of us.

[QUOTE] Thank Ivar - this has solved my problem. By the way, I read in another thread that you don't actually work for COMSOL, and you are giving all this help out of the goodness of your heart. If this is true you are a hero. Even if it's not you're still damn helpful. Kind regards. Dom. [/QUOTE] Ivar is a living legend to all of us.

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.