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.

Highly nonlinear model with many ODE interface?

Please login with a confirmed email address before reporting spam

Dear all,

I developed a coupled HM model for porous media with many ODE interfaces. I found the model ran very slow. I am wondering whether these ODE interfaces contribute to the Jacobian matrix. Is it possible to neglect these contributions while keeping the accuracy of the coupled model. Do you have any ideas to deal with such a situation?

Thank you so much for your help.

-------------------
Yu Zhang

6 Replies Last Post 26 set 2019, 01:55 GMT-4
Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 28 ago 2019, 08:06 GMT-4

Hi,

you may need to use the nojac() operator in your equations.

Cheers Edgar

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
Hi, you may need to use the nojac() operator in your equations. Cheers Edgar

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 28 ago 2019, 08:45 GMT-4

Hi, Edgar:

Thank you for your reply. I am actually not familar with this operator. Will it influence the accuracy too much?

Thanks

-------------------
Yu Zhang
Hi, Edgar: Thank you for your reply. I am actually not familar with this operator. Will it influence the accuracy too much? Thanks

Edgar J. Kaiser Certified Consultant

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 28 ago 2019, 13:13 GMT-4

I guess that depends on your equations.

-------------------
Edgar J. Kaiser
emPhys Physical Technology
www.emphys.com
I guess that depends on your equations.

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 28 ago 2019, 19:39 GMT-4
Updated: 5 years ago 28 ago 2019, 19:41 GMT-4

Hi Yu, As Edgar said you can put inside nojac() the terms you do not want to contribute to the Jacobian matrix.

Theoretically it is possible that the use of nojac() can lead to non-convergence if not including the Jacobian contributions from those terms ends up giving you a poor Newton update. In most cases you just get slower convergence as measured by number of iterations but each iteration will take less time to compute. It is a tradeoff between these.

If it converges, it convergence to the right solution since the nojac() does not exclude the terms from the residual. It just excludes them from the Jacobian. Search nojac in the COMSOL Multiphysics Reference Manual.

Another item to be careful about when using your own ODEs is the scaling. For the built-in physics interfaces the software has default scales that work fine in the majority of cases. But if you are adding your own equations the default scales picked can be poor and sometimes this can be the bottleneck. See here for more on that. https://www.comsol.com/support/knowledgebase/1240/

Cheers,

T. M. Kindo

-------------------
We all have opinions. But the COMSOL support team has the truth. I don't know if my opinion is still the truth. Check with that team before you try this at home!
Hi Yu, As Edgar said you can put inside nojac() the terms you do not want to contribute to the Jacobian matrix. Theoretically it is possible that the use of nojac() can lead to non-convergence if not including the Jacobian contributions from those terms ends up giving you a poor Newton update. In most cases you just get slower convergence as measured by number of iterations but each iteration will take less time to compute. It is a tradeoff between these. If it converges, it convergence to the right solution since the nojac() does not exclude the terms from the residual. It just excludes them from the Jacobian. Search nojac in the COMSOL Multiphysics Reference Manual. Another item to be careful about when using your own ODEs is the scaling. For the built-in physics interfaces the software has default scales that work fine in the majority of cases. But if you are adding your own equations the default scales picked can be poor and sometimes this can be the bottleneck. See here for more on that. https://www.comsol.com/support/knowledgebase/1240/ Cheers, T. M. Kindo

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 29 ago 2019, 21:36 GMT-4

Hi, Kindo,

Thanks a lot for the detailed reply and suggestions. I will try it!

-------------------
Yu Zhang
Hi, Kindo, Thanks a lot for the detailed reply and suggestions. I will try it!

Please login with a confirmed email address before reporting spam

Posted: 5 years ago 26 set 2019, 01:55 GMT-4
Updated: 5 years ago 26 set 2019, 01:56 GMT-4

Great Post

Great Post

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.