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 counter in comsol

Please login with a confirmed email address before reporting spam

I looked in the documentation and couldn't find any information on how to do this:

m = m + 10

I would like to have accumulate some value to m for each time step.

Please share some light if you know.

3 Replies Last Post Oct 19, 2015, 6:33 a.m. EDT
Frank van Gool COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago May 8, 2014, 8:39 a.m. EDT
Dear Minh,

You can use a Global ODE as a counter in some sort.
Attached you find this example where I defined an m, where the time derivative of m (mt) is equal to 10. In other words, every second, 10 is added to m.
Not exactly every timestep, but I assumed that this was meant.

Note that if you really want to add 10 every timestep, you might be able to rewrite the time derivative of m in a way that it is dependent on "timestep".

Best regards,
Frank
Dear Minh, You can use a Global ODE as a counter in some sort. Attached you find this example where I defined an m, where the time derivative of m (mt) is equal to 10. In other words, every second, 10 is added to m. Not exactly every timestep, but I assumed that this was meant. Note that if you really want to add 10 every timestep, you might be able to rewrite the time derivative of m in a way that it is dependent on "timestep". Best regards, Frank


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Sep 26, 2014, 9:35 a.m. EDT
Dear Frank
I am working on lithium-ion battery module. In this model the current switches from positive to negative and vice-versa. I want to count the cycle number. Could you suggest me that how I can find the cycle number.

Thanks and regards
IIT Delhi
Dear Frank I am working on lithium-ion battery module. In this model the current switches from positive to negative and vice-versa. I want to count the cycle number. Could you suggest me that how I can find the cycle number. Thanks and regards IIT Delhi

Please login with a confirmed email address before reporting spam

Posted: 9 years ago Oct 19, 2015, 6:33 a.m. EDT
Dear Rashid,

I am in the same situation as you.
Did you finally manage to solve the problem?

I am modelling material removal. In each timestep there is a logic value (0 or 1) defining which elements should be eliminated. I would like accumulate these values in a counter variable, so that at the final time, the remaining elements have value 0 and the ones to eliminate >0.

Thank you in advance.

Best regards,

Itxaso



Dear Rashid, I am in the same situation as you. Did you finally manage to solve the problem? I am modelling material removal. In each timestep there is a logic value (0 or 1) defining which elements should be eliminated. I would like accumulate these values in a counter variable, so that at the final time, the remaining elements have value 0 and the ones to eliminate >0. Thank you in advance. Best regards, Itxaso

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.