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.

RE: Division by zero

Please login with a confirmed email address before reporting spam

Hello Everyone,

I have started learning comsol 4.1, but when I run my problem, I am getting error

"Feature: compile equation: stationary (sol1/st1), error: division by zero"

any idea how to solve this..

thanks
MM

6 Replies Last Post Mar 2, 2011, 6:13 a.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 Mar 1, 2011, 12:56 a.m. EST
Hi

Yes an no ;) Yes because it means that in some of your BC's or equations one or several values are "zero" (typically at the start for the initial values) and you do a normalisation or a division by one of these values, somewhere in your model

No, because I cannot tell like that where it is, but its 99% chance that it is in one of the entries you have done on a domain or a boundary.

Sometimes, if a "zero" value can appear by adding a small value such as .../(myvar+eps) can avoid a dicision by zero if "myvar" has a value of "zero". You might also use an "if(,,) to normalise by something else, typically used for parameter sweeps, when you start at zero

--
Good luck
Ivar
Hi Yes an no ;) Yes because it means that in some of your BC's or equations one or several values are "zero" (typically at the start for the initial values) and you do a normalisation or a division by one of these values, somewhere in your model No, because I cannot tell like that where it is, but its 99% chance that it is in one of the entries you have done on a domain or a boundary. Sometimes, if a "zero" value can appear by adding a small value such as .../(myvar+eps) can avoid a dicision by zero if "myvar" has a value of "zero". You might also use an "if(,,) to normalise by something else, typically used for parameter sweeps, when you start at zero -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 1, 2011, 1:10 a.m. EST
Hi
thanks for your response Ivar.
I have run my problem in 4.0 and i got the solution without any error and now the same problem I am trying to run in 4.1..as i want to make all runs uniform in one version of comsol..so this error is specific to 4.1. don't know why..!
MM


.
Hi thanks for your response Ivar. I have run my problem in 4.0 and i got the solution without any error and now the same problem I am trying to run in 4.1..as i want to make all runs uniform in one version of comsol..so this error is specific to 4.1. don't know why..! MM .

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 Mar 1, 2011, 1:55 a.m. EST
Hi

v4.0 was an early version, not really ironed out. The newer 4.1 + patch 2 is nice and stable. But I have noticed that often there are small errors when you import a model from 4.0 or 4.0a. So personally I reconstruct my models in the new version systematically. It's rather rapid, you can save your parameters and variables as txt files, you can save your geometry as a mphbin, and then quickly reload these in the new version. Then you open the two models side by side in v4.1 and you reconstruct from scratch. For me it takes only a few minutes to an hour, even on complex models and it allows you to check your set up and the new features.

My experience with all software tools so far is to never do serious work with a first release (and I have 30 years of software experience, things are not improving, rather the contrary ;), always wait to the second or third release.

But, I'm currently very happy with v4.1 Patch 2. No known errors, still some weaknesses and missings, but I expect that to be seriously improved again in the soon to come (I have heard) v4.2.

I'm really impressed what COMSOL has achieved with their v4 transition, it's really a great tool (if only I had had it for my studies ...).

--
Good luck
Ivar
Hi v4.0 was an early version, not really ironed out. The newer 4.1 + patch 2 is nice and stable. But I have noticed that often there are small errors when you import a model from 4.0 or 4.0a. So personally I reconstruct my models in the new version systematically. It's rather rapid, you can save your parameters and variables as txt files, you can save your geometry as a mphbin, and then quickly reload these in the new version. Then you open the two models side by side in v4.1 and you reconstruct from scratch. For me it takes only a few minutes to an hour, even on complex models and it allows you to check your set up and the new features. My experience with all software tools so far is to never do serious work with a first release (and I have 30 years of software experience, things are not improving, rather the contrary ;), always wait to the second or third release. But, I'm currently very happy with v4.1 Patch 2. No known errors, still some weaknesses and missings, but I expect that to be seriously improved again in the soon to come (I have heard) v4.2. I'm really impressed what COMSOL has achieved with their v4 transition, it's really a great tool (if only I had had it for my studies ...). -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 1, 2011, 1:53 p.m. EST
Hi,
I have redone the problem in 4.1 but the problem remain as it is..total waste of time..anyway thanks for your suggestions
MM
Hi, I have redone the problem in 4.1 but the problem remain as it is..total waste of time..anyway thanks for your suggestions MM

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 Mar 1, 2011, 3:40 p.m. EST
Hi

sorry to hear that, I often struggle somewhat too, but to now I have always found out what was wrong for me, often its something simple and trivial.

One thing worth to check is if you can load your initial conditions. In v3.5 it was the "solve for initial conditions". In V4 it's less explicit, but it's still there: Right click on the Dependent Variables node in the solver sequence and do a "Compute to Selected". this will solve for the initial conditions and you might be able to observe the results, sometimes it becomes evident that these are not coherent. But you might not even get there, lets hope ;)

--
Good luck
Ivar
Hi sorry to hear that, I often struggle somewhat too, but to now I have always found out what was wrong for me, often its something simple and trivial. One thing worth to check is if you can load your initial conditions. In v3.5 it was the "solve for initial conditions". In V4 it's less explicit, but it's still there: Right click on the Dependent Variables node in the solver sequence and do a "Compute to Selected". this will solve for the initial conditions and you might be able to observe the results, sometimes it becomes evident that these are not coherent. But you might not even get there, lets hope ;) -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago Mar 2, 2011, 6:13 a.m. EST
Hi,
got success from the error "division by zero", but now facing convergence issue, so in this regard Ivar do you know which solver is better, I don't know much about MUMPS and PARDISO, it would be great if you can provide me some insight about these solvers..
MM
Hi, got success from the error "division by zero", but now facing convergence issue, so in this regard Ivar do you know which solver is better, I don't know much about MUMPS and PARDISO, it would be great if you can provide me some insight about these solvers.. MM

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.