# Discussion Forum

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.

## Internal error in piecewise expression evaluation

Merry Christmas everybody,

I was simulating a laminar flow in a heated circular duct with a non-newtonian Fluid. In order to describe the dynamic viscosity I used the non-newtonian power law with the parameters m and n.
I do simulations with heating powers 500-1500W at mass flows 0.25, 0.5, 0.75 and 1 kg/min. For some reason the following simulations abort:
0,75 kg/min: 750W, 1500W
1 kg/min: 500W, 750W, 1000W, 1500W

The following error is shown:
“Internal error in piecewise expression evaluation.
- Expression: 0.027-0.0050*log(-273.15+T)”

Which is used in the flow consistency index m. As soon as I raise the parameter border to 273.16K (to prevent log(0) become infinity, but it worked fine earlier) I get the error:
“Failed to find a solution.
Singular matrix.

There are 84805 equations giving NaN/Inf in the matrix rows for the variable mod1.T.
at coordinates: (0.0039021,0.001), (0.00386713,0.001), (0.00382797,0.001), (0.00378462,0.001), (0.00373706,0.001), ...

There are 84266 degrees of freedom giving NaN/Inf in the matrix columns for the variable mod1.T.
at coordinates: (0.00382797,0.001), (0.00378462,0.001), (0.00373706,0.001), (0.00368531,0.001), (0.00362937,0.001), ...
There are 42940 degrees of freedom giving NaN/Inf in the matrix columns for the variable mod1.u.
at coordinates: (0.00368531,0.001), (0.00362937,0.001), (0.00382797,0.002), (0.00378462,0.002), (0.00373706,0.002), ...
There are 36019 degrees of freedom giving NaN/Inf in the matrix columns for the variable mod1.w.
at coordinates: (0.00398182,0.035), (0.00395944,0.035), (0.00393287,0.035), (0.00398182,0.036), (0.00395944,0.036), ...
Returned solution is not converged.”

Do you have any idea what the first error indicates for my equation. Everything worked fine in all the earlier simulations. I just changed the parameter for the heating power :(

Sincerely, Fabian Holz

3 Replies Last Post 29 Dec 2013 18:16 GMT-05:00

Posted: 5 years ago
I tried to describe the flow consistency index m by an analytic instead of a piecewise function. Now COMSOL states the following error. Maybe it helps to define the problem.. (boundary 3 is the Outlet of the duct)

"Error in user-defined function.
- Function: m
Failed to evaluate variable.
- Variable: mod1.nitf.m_pow
- Defined as: m((mod1.T/unit_K_cf))
Failed to evaluate variable.
- Variable: mod1.nitf.mu
- Defined as: (mod1.nitf.m_pow*(mod1.nitf.sr^((-1)+mod1.nitf.n_pow)))
Failed to evaluate expression.
- Expression: mod1.nitf.mu
Failed to evaluate operator.
- Operator: mean
- Geometry: 1
- Boundary: 3"

Posted: 5 years ago
Hi,

I tested your model and add few things. First I add "Outflow" for heat transfer. Second I add initial value for fluid flow (0.1 m/s). With these I got your model working.

Best regards

Tero Hietanen