Solving a large system of PDEs in Mathematica

In summary: So, I am at a loss here. I would appreciate any help anyone can offer.In summary, the problem is trying to find a solution to a system of differential equations that are more complicated than what was described. The problem states that if there are more than four links in the chain, then the numerical solution given by NDSolve[] does not work.
  • #1
skrat
748
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
  • #2
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.
 
  • #3
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 skrat
  • #4
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
 

Related to Solving a large system of PDEs in Mathematica

What is a PDE?

A PDE, or partial differential equation, is a type of mathematical equation that describes a relationship between a function and its partial derivatives. It is commonly used in many scientific fields, such as physics, engineering, and finance.

Why is solving a large system of PDEs important?

Solving a large system of PDEs allows scientists to model complex physical systems and predict their behavior. This can provide valuable insights and aid in decision-making processes.

How can Mathematica be used to solve a large system of PDEs?

Mathematica is a powerful software program that has built-in functions and algorithms specifically designed for solving PDEs. It allows for efficient and accurate solutions to be obtained for complex systems.

What are some common challenges when solving a large system of PDEs?

Some common challenges include dealing with high-dimensional systems, finding appropriate boundary and initial conditions, and handling nonlinearity or stiffness in the equations. Additionally, numerical stability and accuracy must be carefully considered.

Are there any tips for optimizing the solution process in Mathematica?

Yes, there are several strategies that can improve the efficiency and accuracy of solving a large system of PDEs in Mathematica. These include using appropriate numerical methods, adjusting parameters such as time and space discretization, and utilizing parallel computing techniques.

Similar threads

  • Differential Equations
Replies
9
Views
1K
  • Differential Equations
Replies
1
Views
935
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
195
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
12
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
317
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • Calculus and Beyond Homework Help
Replies
8
Views
2K
  • Calculus and Beyond Homework Help
Replies
7
Views
385
Back
Top