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.

Division by zero error

Please login with a confirmed email address before reporting spam

Hello,
I've got the problem (error) saying that "Error in sweep division by zero" and then it shows the formula below where the error was caused. (capacity fading tutorial model slightly changed the formula there).

Here is the formula I'm trying to use:

CC_CH*(I_ch-i_app / a)/I_ch+CV_CH*(E_cell-E_max)/E_cell+CC_DCH*(I_dch-i_app / a)/I_dch+CV_DCH*(E_cell-E_min)/E_cell+!CC_CH*!CV_CH*!CC_DCH*!CV_DCH*i_app /(a*i_1C)

Basically only E_cell value is variable (division by which seems like causing an error).
But, those values CC_CH CV_CH etc are initially set to zero. So initially it should calculate only this part:
!CC_CH*!CV_CH*!CC_DCH*!CV_DCH*i_app /(a*i_1C)

Where "a" and "i_1C" are non zero constants (set in parameters) and it must never give zero division.
In the table log it doesn't show anything. So I think it stuck in the t=0 (immediately).

E_cell initially is zero actually. But the part of the expression above where there is a division by E_cell initially should never be used.

Is it possible that comsol is evaulating that part of expression even if the first multiplier (such as CC_CH etc) are having zero values?

So basically in other words:

CC_CH * a / b
in such an expression would comsol calculate the "a/b" part of the expression if CC_CH is zero?
If so then if initially b = 0, division by zero happens, how can I avoid it?

0 Replies Last Post 5 ago 2016, 11:43 GMT-4
COMSOL Moderator

Hello Yerzhan Massalin

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

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.