Solving a large system of PDEs in Mathematica

Click For Summary

Homework Help Overview

The problem involves modeling the movement of a chain with ##n## links across a river, focusing on the angles between the links and their dynamics under gravity and other forces. The original poster is attempting to find a numerical solution using Mathematica, specifically through the application of Lagrange's equations, but is encountering difficulties when increasing the number of links beyond four.

Discussion Character

  • Exploratory, Problem interpretation, Assumption checking

Approaches and Questions Raised

  • Participants discuss the complexity of the system due to torsional springs and energy dissipation, leading to complicated partial differential equations. There are inquiries about the effectiveness of Mathematica for solving larger systems of PDEs and suggestions for alternative software like MATLAB.

Discussion Status

Some participants have offered insights into potential issues with the NDSolve function in Mathematica, suggesting that the problem may exceed internal limits without providing error messages. Others have noted the possibility of simplifying the equations to improve solvability. The discussion is ongoing, with various methods and tools being considered.

Contextual Notes

There are constraints regarding access to Mathematica among participants, which may limit their ability to directly assess the original poster's code. Additionally, a change in the rules regarding the use of approximations for small angles has been noted, which could impact the approach to solving the problem.

skrat
Messages
740
Reaction score
8

Homework Statement


Imagine a chain with ##n## links across a river. Now imagine, the chain is in a straight horizontal line at time ##t=0##. The problem wants me to calculate the movement of the chain links (center of mass) due to the gravity field. There are other forces in the system but this should give you an idea what I am doing - I am having problems with finding a numerical solution not the physical understanding. My variables are in fact angles between the chain link and horizontal line. Knowing the angles, determines the system completely. Applying equations of motion to each rod should give me a result.

Homework Equations


I am using the Lagrange's approach with Lagrange's equations of the second kind.

The Attempt at a Solution


Sadly the system is a bit more complicated than I described. There are torsional springs between the links and also an external force than leads to energy dissipation.
This leads to.. well... to some very long and rather complicated partial differential equations. Not something one would like to solve on a paper, so I decided to write something in Mathematica. On my dropbox link you will find my code that works really nicely in case of ##n=4##. LINK: https://www.dropbox.com/s/ev2ig6g5bfybbjd/seminar_1_arbitrary.nb?dl=0

The problem is that I don't get a solution for ##n## greater than 4. The differential equations and boundary conditions are correct (I checked 235235 times), but as soon as I increase n to 6 or 8 or 10, NDSolve[] doesn't do what it should anymore.

So my question here is: If there are any Mathematica masters here? - What can I do? And to others: What are the most commonly used methods for solving a rather big system of PDEs? Is Mathematica even the right tool to do this?

According to google, MATLAB is a good tool to, but sadly, I have never worked there and I assume would be a nightmare to start with an example like that.
 
Physics news on Phys.org
skrat said:

Homework Statement


Imagine a chain with ##n## links across a river. Now imagine, the chain is in a straight horizontal line at time ##t=0##. The problem wants me to calculate the movement of the chain links (center of mass) due to the gravity field. There are other forces in the system but this should give you an idea what I am doing - I am having problems with finding a numerical solution not the physical understanding. My variables are in fact angles between the chain link and horizontal line. Knowing the angles, determines the system completely. Applying equations of motion to each rod should give me a result.

Homework Equations


I am using the Lagrange's approach with Lagrange's equations of the second kind.

The Attempt at a Solution


Sadly the system is a bit more complicated than I described. There are torsional springs between the links and also an external force than leads to energy dissipation.
This leads to.. well... to some very long and rather complicated partial differential equations. Not something one would like to solve on a paper, so I decided to write something in Mathematica. On my dropbox link you will find my code that works really nicely in case of ##n=4##. LINK: https://www.dropbox.com/s/ev2ig6g5bfybbjd/seminar_1_arbitrary.nb?dl=0

The problem is that I don't get a solution for ##n## greater than 4. The differential equations and boundary conditions are correct (I checked 235235 times), but as soon as I increase n to 6 or 8 or 10, NDSolve[] doesn't do what it should anymore.

So my question here is: If there are any Mathematica masters here? - What can I do? And to others: What are the most commonly used methods for solving a rather big system of PDEs? Is Mathematica even the right tool to do this?

According to google, MATLAB is a good tool to, but sadly, I have never worked there and I assume would be a nightmare to start with an example like that.

I lack access to Mathematica, so cannot open or read your document, and I suspect many other posters are in the same position.

If you could post something like a pdf version of your problem, I could try to assess if Maple can handle the problem, or look at whether some other, single-purpose DE solving packages are available that might be able to deal with your problem. No promises, though.
 
I usually expect to find one of a handful of common mistakes responsible for things like this. But none of those seem to be present.

If you look at what is returned from NDSolve, for n even and greater than four, it is just echoing back your problem with minor formatting changes. That is Mathematica's way of saying that a function couldn't deal with the problem. I tried using Simplify[Flatten[Rationalize[equations]]] instead of just Rationalize[equations] as the first argument to NDSolve. That gets rid of some nested braces that worry me a little and for your problem makes system substantially simpler. But it still won't solve.

I am assuming your problem has exceeded some internal hidden limits. It is odd that it gives no warning or error message to go along with this.

I would suggest you really really politely see if the folks more closely connected to Wolfram Inc over at http://community.wolfram.com might offer any insight into why there are no warnings and possibly even how to get it to solve.
 
  • Like
Likes   Reactions: skrat
Thank you Bill, for taking a closer look at my code.

My conclusion is that... I don't have a conclusion. I guess it is simply too much for Mathematica or I am missing quite a lot of knowledge - probably the second.

Anyhow, the rules of solving this problem changed a day after I published this problem in this forum. I guess mentor realized that several people with several different methods in different programming languages have problems for some reason. We were than told that we were allowed to use approximation for small angles. This massively reduces the amount of cos and sin terms in the DE, therefore all the problems disappear and the system becomes solvable even in Mathematica.

However at the moment I am working on implementing the idea that Ray Vickson has given me above. I have a strong feeling this approach leads to a lot faster code.

cheers,
mitja
 

Similar threads

  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
3
Views
2K
  • · Replies 12 ·
Replies
12
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K