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.

Variable definition

Please login with a confirmed email address before reporting spam

I need to set a variable iintra to Ihigh in a 2D geometry at (2<x<3),(1.5<y<2.5) for 0<t<0.01s and used the expression below:
iintra=Ihigh*((2<x<3)*(1.5<y<2.5)*(t<.01))

But COMSOL is initializing iintra to Ihigh in the entire 2D space for the time interval 0<t<0.01 and 0 after t>0.01

I will greatly appreciate if anyone can help fix this problem.

My geometry is a very simple rectangle 4cm*5cm

9 Replies Last Post 2011年12月11日 GMT-5 07:36
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 2011年11月16日 GMT-5 15:07
Hi

one danger with your bolean equations there are that they are discontinous, so the solver will have problems along the transition points. In v4 your have the smmotes pulse(), step() and ramp() functins that have smoother transitions. I can only sugest to try with those instead of your "hard" bolean steps

If the spatial limits do not change with time, you could perhaps cut up your domain along the lines, and remove the spatial dependence, and only keep the temporal one

--
Good luck
Ivar
Hi one danger with your bolean equations there are that they are discontinous, so the solver will have problems along the transition points. In v4 your have the smmotes pulse(), step() and ramp() functins that have smoother transitions. I can only sugest to try with those instead of your "hard" bolean steps If the spatial limits do not change with time, you could perhaps cut up your domain along the lines, and remove the spatial dependence, and only keep the temporal one -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年11月16日 GMT-5 16:00
Thanks for your reply.

For the initial conditions of Vm where I needed to assign different initial conditions for different parts of the geometry I split the geometry into subdomains as in attached file but am getting initialization problems now.

Now I want to set the iextra and iintra to 0 in domain 1 and 1 in domain 2 respectively for 0<t<0.1 s and 0 everywhere for the rest of the time. How do I do that?

I sincerely appreciate your help.

Thanks
Deepika
Thanks for your reply. For the initial conditions of Vm where I needed to assign different initial conditions for different parts of the geometry I split the geometry into subdomains as in attached file but am getting initialization problems now. Now I want to set the iextra and iintra to 0 in domain 1 and 1 in domain 2 respectively for 0


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年11月28日 GMT-5 14:11
Dear Ivar,

I have been working on this model for a while now and still having problems with initialization and varying input variables.

I need to:
1. vary the input current with time and space.
2. initialize the input variable Vm to Vfire in some areas in the geometry and Vrest in others.

I tried:
1. multi domains..had success with initialization but results limited at inner boundary. Pls see attached 2D_Bidomain_v1_subdomain
2. piecewise function for Vm and boolean expressions for input current but initialization was not successful. Pls see attached 2D_Bidomain_v1

I sincerely appreciate your help in resolving my problem.

Thanks
Deepika
Dear Ivar, I have been working on this model for a while now and still having problems with initialization and varying input variables. I need to: 1. vary the input current with time and space. 2. initialize the input variable Vm to Vfire in some areas in the geometry and Vrest in others. I tried: 1. multi domains..had success with initialization but results limited at inner boundary. Pls see attached 2D_Bidomain_v1_subdomain 2. piecewise function for Vm and boolean expressions for input current but initialization was not successful. Pls see attached 2D_Bidomain_v1 I sincerely appreciate your help in resolving my problem. Thanks Deepika


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 2011年11月29日 GMT-5 02:07
Hi

I'm not sure qhat is wrong, but when I ask to load the inital values (right click on "Study Solver Config Solver 2 - Dependent variables - Compute to selected") I get mostly "0" and that is unexpected.

If I delete your study and recreate it from scratch I can solve and get values different from "0". But I have v4.2a not sure that is the reason.

Sometimes it is worth to remake a model from scratch, if one has changed it a lot, particularly for the early V4.0 and v4.1 versions

--
Good luck
Ivar
Hi I'm not sure qhat is wrong, but when I ask to load the inital values (right click on "Study Solver Config Solver 2 - Dependent variables - Compute to selected") I get mostly "0" and that is unexpected. If I delete your study and recreate it from scratch I can solve and get values different from "0". But I have v4.2a not sure that is the reason. Sometimes it is worth to remake a model from scratch, if one has changed it a lot, particularly for the early V4.0 and v4.1 versions -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年11月29日 GMT-5 12:30
Dear Ivar,

Thanks for your reply.

I followed your suggestion and recreated the study but I still get an initial value for Vm as 1V throughout the geometry when I'm actually expecting to see 1V (Vrest) in some areas and -1.2V(Vfire) as defined in piecewise function pw1(x).

Also I have defined I as Io*(x<1)*(y<1) but on initialization I is set to Io throughout the geometry.

Looking forward to your insight....

Thanks
Deepika

PS: the attached model has been solved only till initialization and Vm and I plotted in the results.
Dear Ivar, Thanks for your reply. I followed your suggestion and recreated the study but I still get an initial value for Vm as 1V throughout the geometry when I'm actually expecting to see 1V (Vrest) in some areas and -1.2V(Vfire) as defined in piecewise function pw1(x). Also I have defined I as Io*(x


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 2011年11月30日 GMT-5 12:01
Hi

sorry but your file appear with "0 bytes" I believe the site had a problem the other day, that happened to me too ;) Try to upload it again

--
Good luck
Ivar
Hi sorry but your file appear with "0 bytes" I believe the site had a problem the other day, that happened to me too ;) Try to upload it again -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年11月30日 GMT-5 12:15
Dear Ivar,

File attached again.

Thanks
Deepika
Dear Ivar, File attached again. Thanks Deepika


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 2011年12月5日 GMT-5 15:08
Dear Ivar,

Did you get a chance to look at my file....I sincerely appreciate your help.

Thanks
Deepika
Dear Ivar, Did you get a chance to look at my file....I sincerely appreciate your help. Thanks Deepika

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 2011年12月11日 GMT-5 07:36
Hi

sorry for the late reply, but I'm very busy these days for my job, and the FORUM is just for fun ;)

I have noticed that you do not respect the "units" this is very important in physics, while often in "math mode" one ignores them. But in your case you have a geometry defined in cm and default units SI. this explains why we cannot get any initial values in line with your model, the piecewise function is defined in meters, and you have cm hence no variation.

To observe this load your "initial values": right click the "Study 1 - Sover Configuration Study 1 Dependent variables" and select "Compute to selected". This will load all your matrices with the initial values and then you can compare them with wht you expect. You will see that Vm is all =1

Try to plot only pw1(x) (instead of Vm), then replace the formula by pw1(x[1/cm]) wich applies the correct unit transformation first and you will get a different result.

It's worth to check all orange "unit error" flagged values to clear them as this means your model is consistent, even if "orange" is only a warning, and COMSOL will attempt to sole as is, expecting you to have done your homework

By the way your last model is not solving, once reset it reclaims "data", not sure what this is, but I know that often, when having tweaked a lot on a model it might become corrupt, then its worth to restart from fresh with a new model
What I finally managed, with your model, was to clear solution, mesh reset all, remove the 3 functions in the data set, remove the solver and then regenerate a new run


--
Good luck
Ivar
Hi sorry for the late reply, but I'm very busy these days for my job, and the FORUM is just for fun ;) I have noticed that you do not respect the "units" this is very important in physics, while often in "math mode" one ignores them. But in your case you have a geometry defined in cm and default units SI. this explains why we cannot get any initial values in line with your model, the piecewise function is defined in meters, and you have cm hence no variation. To observe this load your "initial values": right click the "Study 1 - Sover Configuration Study 1 Dependent variables" and select "Compute to selected". This will load all your matrices with the initial values and then you can compare them with wht you expect. You will see that Vm is all =1 Try to plot only pw1(x) (instead of Vm), then replace the formula by pw1(x[1/cm]) wich applies the correct unit transformation first and you will get a different result. It's worth to check all orange "unit error" flagged values to clear them as this means your model is consistent, even if "orange" is only a warning, and COMSOL will attempt to sole as is, expecting you to have done your homework By the way your last model is not solving, once reset it reclaims "data", not sure what this is, but I know that often, when having tweaked a lot on a model it might become corrupt, then its worth to restart from fresh with a new model What I finally managed, with your model, was to clear solution, mesh reset all, remove the 3 functions in the data set, remove the solver and then regenerate a new run -- 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.