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 a Probe Value for a Stop Condition

Please login with a confirmed email address before reporting spam

Hello fellow COMSOL users.

Can someone refer me to a model or tell me how to solve my problem.

In a system undergoing resistive heating I want to use the calculated resistive energy as the stop condition for a resistive heating step. The User Manual talks about using Probes to monitor the development of a scalar quantity and says that a Probe variable can be used as a stop condition.

In order to test the concept I developed the attached simple 2D case. It is easy enough to keep track of the resistive power by volume integrating ec.Qrh and calling it POWER. Next, I tried to keep track of resistive energy by setting up a Global Variable Probe and defining it as the time integral of power (timeint(0,t,POWER)).

When I ran the Study I received the warning that the time integral operator cannot be used in this context. Nevertheless, the resulting table looked OK. It is clear that I need help!

Also, I don’t have to be precise with regard to the stopping point. I can always control my time steps to have them close to each other within my time zone of interest.

So here is my two part question: How should I keep track of resistive energy and how do I use it as a stop condition?

Any help will be greatly appreciated.

Joe Williams


4 Replies Last Post Jan 17, 2013, 4:10 p.m. EST
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 Jan 16, 2013, 3:10 a.m. EST
Hi

first of all timeint() can only be used in Results evaluation, not during solving. It's explicitly written at the end of the help/doc section on timeint(). This applies to several functions, be aware !

Another way is to define a Global variable under the EC (turn on the advanced physics options view) as MyPQ = MyPt - intop1(ec.Qrh) and then access MyP

the MyPt menas that you set the "time derivative of MyP to the intop1() value and that should work. See also the KB at www.comsol.eu/support/knowledgebase/1101/

--
Good luck
Ivar
Hi first of all timeint() can only be used in Results evaluation, not during solving. It's explicitly written at the end of the help/doc section on timeint(). This applies to several functions, be aware ! Another way is to define a Global variable under the EC (turn on the advanced physics options view) as MyPQ = MyPt - intop1(ec.Qrh) and then access MyP the MyPt menas that you set the "time derivative of MyP to the intop1() value and that should work. See also the KB at http://www.comsol.eu/support/knowledgebase/1101/ -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 17, 2013, 2:15 p.m. EST
Ivan,

Thank you for getting back to me with your help. However, I still need a little more.

I generated a Global variable under the ec as you suggested (I think). (I also did it separately under the mathematics interface with the same results).

I defined it as MyE = MyEt – intop1(ec.Qrh) and was able to get nice plot of MyE vs. time with no error messages.
Next I put in 8000 – MyE as a Stop Condition and received the error message that ‘Expression could not be evaluated.’

I still must be doing something wrong. Would you point out where I am making my mistake.

My file is attached.

Thanks in advance,

Joe
Ivan, Thank you for getting back to me with your help. However, I still need a little more. I generated a Global variable under the ec as you suggested (I think). (I also did it separately under the mathematics interface with the same results). I defined it as MyE = MyEt – intop1(ec.Qrh) and was able to get nice plot of MyE vs. time with no error messages. Next I put in 8000 – MyE as a Stop Condition and received the error message that ‘Expression could not be evaluated.’ I still must be doing something wrong. Would you point out where I am making my mistake. My file is attached. Thanks in advance, Joe


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 Jan 17, 2013, 3:28 p.m. EST
Hi

it seems that MyE is not defined before the solver has gone through one iteration, but the stop condition is tested before MyE exits => hence the error message.

The workaround is simple: add a Global Definitions - Parameter
MyE = 0

for the first iteration and off you go ;)

Oups I was a bit too quick there :) correct your stop condition (to really react) to be

8000-mod1.MyE

without the full name "mod1.MyE" it will not stop correctly for me ;)

Even if you dump the global variable myE and mod1.MyE and they give the same results, during solving they are differentiated, probably a casting issue

--
Good luck
Ivar
Hi it seems that MyE is not defined before the solver has gone through one iteration, but the stop condition is tested before MyE exits => hence the error message. The workaround is simple: add a Global Definitions - Parameter MyE = 0 for the first iteration and off you go ;) Oups I was a bit too quick there :) correct your stop condition (to really react) to be 8000-mod1.MyE without the full name "mod1.MyE" it will not stop correctly for me ;) Even if you dump the global variable myE and mod1.MyE and they give the same results, during solving they are differentiated, probably a casting issue -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Jan 17, 2013, 4:10 p.m. EST
Ivar,

Thank you very much!! Your solution to my problem was complete, elegant, and very instructive.

Joe

Ivar, Thank you very much!! Your solution to my problem was complete, elegant, and very instructive. Joe

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.