Solving algebraic equations with Comsol

On the website, I have added a link to a pdf document that shows how to set up a simple problem of transient heat transfer in a sphere. A reader asked me details about doing this in 1D (where you have to add the (2/r)(dT/dr) term to the equation) and in 3D.

At the Comsol Multiphysics meeting in Boston in October, I heard a talk for a Minicourse entitled “Equation Based Modeling”. It described, among other things, how to solve algebraic equations in Comsol. The way the problem was stated was to solve a problem in the context of another simulation of a 2D transport problem, even though the 2D transport problem was not used. The example solved for the specific volume of a gas using the cubic equation that comes from various methods: Redlich-Kwong, Peng-Robinson, etc. I got to thinking: Could I solve all the algebraic problems in my book using Comsol? I would want to solve them by themselves, not inside a transport problem: Why solve a PDE if you only want to solve a nonlinear algebraic equations?

So I tried it and it works using the 0D option and Global ODEs. When I first did it, though, it got a funny solution. Eventually I realized that the problem I was solving had two solutions, one of which was physically meaningless, and for the initial guess I had chosen the method converged to the wrong solution. I had never seen that solution before so I thought Comsol was not working correctly for a single nonlinear algebraic equation. Upon further reflection I realized my mistake, which again emphasizes the point of the book: check your work carefully. In this case, the program worked, but it gave a solution that I didn’t want and I had to figure out how to prevent that.

Thus, you do have to be careful. I will be posting a pdf file of that problem soon (http://www.ChemEComp.com) and show how to examine the results to get the correct solution. As time permits, I will prepare the Comsol instructions to solve a typical problem from Chapters 2, 3, 4, 5, and 6. It already solves problems in Chapters 8-11. Chapter 7 (Aspen process simulation) involves so much thermodynamic data and specialized methods that it isn’t practical to use Comsol there. But, being able to solve most of the problems in chapters 2-6, 8-11 is a pretty good percentage!  So, take a look at them as they are added to the book website: http://www.ChemEComp.com.

Advertisements

About chemecomp

Bruce A. Finlayson, retired Rehnberg Professor of Chemical Engineering, University of Washington
This entry was posted in Chemical engineering computing. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s