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.

Why did I get error with NaN/Inf ?

Please login with a confirmed email address before reporting spam

Hello, I am running a simulation for a solid oxide fuel cell, with three physics interfaces, accounting for fluid flow, mass transport and current distribution. But I can not get it converged, so I started decoupling the system, and start with only solving for fluid flow and current distribution. My model can iterate for several iterations, but will give some error msg like :

Undefined value found.
- Detail: Undefined value found in the equation residual vector.
.There are 52449 degrees of freedom giving NaN/Inf in the vector for the
variable mod1.XX

I wonder if anyone can help explain the reason so that I can correct my model? thanks!

8 Replies Last Post 14 nov 2014, 05:10 GMT-5
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 16 lug 2012, 14:30 GMT-4
Hi

for me this happens mainly when you are doing "multiphysics" and one have forgotten to define enough BC's for ALL dependent variables in ALL physics. COMSOL only finds a solution if i'ts "unique", hence it must be well determined

--
Good luck
Ivar
Hi for me this happens mainly when you are doing "multiphysics" and one have forgotten to define enough BC's for ALL dependent variables in ALL physics. COMSOL only finds a solution if i'ts "unique", hence it must be well determined -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 18 lug 2012, 14:46 GMT-4
Hi, Ivar,

Thanks for your advice. Now I meet with another issue. When I solve the fluid flow with current distribution, the model can converge, however, after I enabling the mass transfer physics interface as well (i.e., solving for the full problem), comsol progress window shows it is always 'assemblying', and can not proceed with any iteration. I feel like it is abnormal. Is there any thing I can do? Thanks again for your support!

Best,
Yeqing
Hi, Ivar, Thanks for your advice. Now I meet with another issue. When I solve the fluid flow with current distribution, the model can converge, however, after I enabling the mass transfer physics interface as well (i.e., solving for the full problem), comsol progress window shows it is always 'assemblying', and can not proceed with any iteration. I feel like it is abnormal. Is there any thing I can do? Thanks again for your support! Best, Yeqing

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 19 lug 2012, 01:45 GMT-4
Hi

could come from several issues, you are doing quite heavy modelling (with COMSOL it seems simple, a few years ago it was hardly possible ;)

It could be related with a mesh density issue, and or still initial conditions too far from the solution. If you are doing time studies one often forget the transients coming from the inertial terms that need not only to be continuous by twice derivable


--
Good luck
Ivar
Hi could come from several issues, you are doing quite heavy modelling (with COMSOL it seems simple, a few years ago it was hardly possible ;) It could be related with a mesh density issue, and or still initial conditions too far from the solution. If you are doing time studies one often forget the transients coming from the inertial terms that need not only to be continuous by twice derivable -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 19 lug 2012, 11:55 GMT-4
Dear Ivar,
Thanks very much for your response here. BUt I am still struggling with the convergence issue. Attached is my comsol file, with two
sequential stationary study steps under the same study node, the 1st study step solves for fluid flow and the current, and the
2nd one solves for the whole problem (fluid flow, current, and mass transport), calling the solution of 1st solver as initial guess. 

Copied at the end is the log when I run it. It seems like the scales for the mass fractions (the last four lines) are far away from the
initial guess I set (they should range from 0 to 1) .

I wonder why this happens since I thought COMSOL picks up the scales depending on the initial values, right? Does that mean the
first solver make these varibles starting to diverge?

Is there any way that I can manually pick up scales for the dependent variables for COMSOL? Will that help improve the speed of
assembly?

Now the model will assembly for more than 1hour without any proceeding. I do not really know what was happening inside, and what
was going wrong. Is there any way I can track it? For example, using some 'probe' to see how the solving process goes? But I assume
this does not help in my case since it has not started to iterate yet, right? Any hints? Really hope you can help me out. I am very
desperate to make it at least converge for me :)  Thanks so much!!!

Best,
Yeqing

============================================================
Parameter V_pol = 0.2.
Stationary Solver 1 in Solver 1 started at 19-Jul-2012 11:14:20.
Nonlinear solver
Number of degrees of freedom solved for: 42546.
Nonsymmetric matrix found.
Scales for dependent variables:
mod1.phil: 0.072
mod1.u: 55
mod1.p: 1e+05
mod1.phis: 0.072
Iter      ErrEst      Newton      Cauchy    Stepsize #Res #Jac #Sol
   1         5.5   1.0000000   0.0000000         4.6    2    1
   1
Scales for dependent variables:
mod1.phil: 0.35
mod1.u: 0.0072
mod1.p: 2.6e+05
mod1.phis: 0.41
   2         1.7   1.0000000   0.0000000        0.58    3    2
   2
   3        0.62   1.0000000   0.0000000        0.42    4    3
   3
   4        0.23   1.0000000   0.0000000        0.35    5    4
   4
   5       0.099   0.6716997   0.2056976        0.35    6    5  
 5
   6       0.036   1.0000000   0.0000000        0.29    7    6  
 6
   7       0.014   0.9380538   0.0000000        0.29    8    7  
 7
   8      0.0062   0.8320414   0.0000000        0.29    9    8  
 8
   9      0.0055   0.1242850   0.3794172        0.29   10    9  
 9
  10      0.0031   0.7337035   0.0000000        0.29   11   10  
10
  11      0.0022   0.3795247   0.0000000        0.29   12   11  
11
  12       0.002   0.0091909   0.9717969        0.12   14   12  
12
  13      0.0014   0.3503565   0.0000000        0.12   15   13  
13
  14     0.00096   0.3752231   0.0000000        0.12   16   14   14
Stationary Solver 1 in Solver 1: Solution time: 27 s.
Stationary Solver 2 in Solver 1 started at 19-Jul-2012 11:14:53.
Nonlinear solver
Number of degrees of freedom solved for: 60608.
Nonsymmetric matrix found.
Scales for dependent variables:
mod1.phil: 3.8
mod1.u: 3.5e+03
mod1.p: 1.3e+05
mod1.phis: 2.4
mod1.w_H2Oc: 8.5e+03
mod1.w_O2: 1.5e+05
mod1.w_H2Oa: 8.6e+03
mod1.w_N2a: 1.8e+04
Dear Ivar, Thanks very much for your response here. BUt I am still struggling with the convergence issue. Attached is my comsol file, with two sequential stationary study steps under the same study node, the 1st study step solves for fluid flow and the current, and the 2nd one solves for the whole problem (fluid flow, current, and mass transport), calling the solution of 1st solver as initial guess.  Copied at the end is the log when I run it. It seems like the scales for the mass fractions (the last four lines) are far away from the initial guess I set (they should range from 0 to 1) . I wonder why this happens since I thought COMSOL picks up the scales depending on the initial values, right? Does that mean the first solver make these varibles starting to diverge? Is there any way that I can manually pick up scales for the dependent variables for COMSOL? Will that help improve the speed of assembly? Now the model will assembly for more than 1hour without any proceeding. I do not really know what was happening inside, and what was going wrong. Is there any way I can track it? For example, using some 'probe' to see how the solving process goes? But I assume this does not help in my case since it has not started to iterate yet, right? Any hints? Really hope you can help me out. I am very desperate to make it at least converge for me :)  Thanks so much!!! Best, Yeqing ============================================================ Parameter V_pol = 0.2. Stationary Solver 1 in Solver 1 started at 19-Jul-2012 11:14:20. Nonlinear solver Number of degrees of freedom solved for: 42546. Nonsymmetric matrix found. Scales for dependent variables: mod1.phil: 0.072 mod1.u: 55 mod1.p: 1e+05 mod1.phis: 0.072 Iter      ErrEst      Newton      Cauchy    Stepsize #Res #Jac #Sol    1         5.5   1.0000000   0.0000000         4.6    2    1    1 Scales for dependent variables: mod1.phil: 0.35 mod1.u: 0.0072 mod1.p: 2.6e+05 mod1.phis: 0.41    2         1.7   1.0000000   0.0000000        0.58    3    2    2    3        0.62   1.0000000   0.0000000        0.42    4    3    3    4        0.23   1.0000000   0.0000000        0.35    5    4    4    5       0.099   0.6716997   0.2056976        0.35    6    5    5    6       0.036   1.0000000   0.0000000        0.29    7    6    6    7       0.014   0.9380538   0.0000000        0.29    8    7    7    8      0.0062   0.8320414   0.0000000        0.29    9    8    8    9      0.0055   0.1242850   0.3794172        0.29   10    9    9   10      0.0031   0.7337035   0.0000000        0.29   11   10   10   11      0.0022   0.3795247   0.0000000        0.29   12   11   11   12       0.002   0.0091909   0.9717969        0.12   14   12   12   13      0.0014   0.3503565   0.0000000        0.12   15   13   13   14     0.00096   0.3752231   0.0000000        0.12   16   14   14 Stationary Solver 1 in Solver 1: Solution time: 27 s. Stationary Solver 2 in Solver 1 started at 19-Jul-2012 11:14:53. Nonlinear solver Number of degrees of freedom solved for: 60608. Nonsymmetric matrix found. Scales for dependent variables: mod1.phil: 3.8 mod1.u: 3.5e+03 mod1.p: 1.3e+05 mod1.phis: 2.4 mod1.w_H2Oc: 8.5e+03 mod1.w_O2: 1.5e+05 mod1.w_H2Oa: 8.6e+03 mod1.w_N2a: 1.8e+04


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 20 lug 2012, 04:30 GMT-4
Hi

Sorry I do not have the battery and Fluel cell module so I cannot open your model, difficult to say more from the rest of your message

--
Good luck
Ivar
Hi Sorry I do not have the battery and Fluel cell module so I cannot open your model, difficult to say more from the rest of your message -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 22 lug 2012, 18:24 GMT-4
Hi Ivar,

I also encountered similar message:

Undefined value found.
- Detail: Undefined value found in the equation residual vector.
There are 1 degrees of freedom giving NaN/Inf in the vector for the variable mod1.emw.S2x
at coordinates: (0,0,0), ...

I have tried to move the entire model away from coordinate (0,0,0), but the error persists.

Could you suggest few ideas on why this is happening and how to fix it?

Thank you for your time.

Regards,
Wiwi
Hi Ivar, I also encountered similar message: Undefined value found. - Detail: Undefined value found in the equation residual vector. There are 1 degrees of freedom giving NaN/Inf in the vector for the variable mod1.emw.S2x at coordinates: (0,0,0), ... I have tried to move the entire model away from coordinate (0,0,0), but the error persists. Could you suggest few ideas on why this is happening and how to fix it? Thank you for your time. Regards, Wiwi

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 25 lug 2012, 00:28 GMT-4
Hi

Undefined values and NaN's are mostly, fdrom my experience, missing BCs, there are not enough, independent BC to give an unique solution of your equations. As you have only one, could it be an ODE variable you have defined ?
the (0,0,0) does not necessarily have to do with the location, as it's also the "default" location for global variables

--
Good luck
Ivar
Hi Undefined values and NaN's are mostly, fdrom my experience, missing BCs, there are not enough, independent BC to give an unique solution of your equations. As you have only one, could it be an ODE variable you have defined ? the (0,0,0) does not necessarily have to do with the location, as it's also the "default" location for global variables -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 14 nov 2014, 05:10 GMT-5
HI,

I am getting this error during simulating a small piece of circular waveguide with radius 10 mm and length 3 mm in 3D. meshing is also normal.so,how can i get this error as my model is not heavy.is there any another problem.
HI, I am getting this error during simulating a small piece of circular waveguide with radius 10 mm and length 3 mm in 3D. meshing is also normal.so,how can i get this error as my model is not heavy.is there any another problem.

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.