JacquesCarette / Drasil

Generate all the things (focusing on research software)
https://jacquescarette.github.io/Drasil
BSD 2-Clause "Simplified" License
142 stars 26 forks source link

Review the Physics of the Double Pendulum Example #2807

Open cd155 opened 3 years ago

cd155 commented 3 years ago

The purpose of this ticket is to make sure the physical knowledge in the current double pendulum example is accurate.

After completing #2618, the double pendulum example is one step further close to the actual double pendulum example. Previously, it was a single pendulum example. I mainly referenced the manual version of the double pendulum example which is provided in the following link

There are some issues I already noticed.

1. I introduced the term "object" to replace "mass" because I feel we use the term "mass" to represent two meanings.

In the end, I use the term "the mass of the first object".

2. I use both (x, y) and (1, 2) in the subscript. x means horizontal, y means vertical, 1 means the first object, 2 means the second object.

3. The final form of system ODE is α₁, α₂ in terms of θ₁, θ₂, w₁, w₂. There is a gap in how I finally get the final form. For now, the SRS just mentioned using a computer algebra program to solve given equations.

smiths commented 3 years ago

Thank you @cd155. I'll aim to get to this issue next week.

cd155 commented 2 years ago

@smiths after reviewing the double pendulum example, I have a few questions.

  1. unit of θ: the SRS says the unit of the θ is a degree, for example, 30 degrees, 60 degrees. However, in all programming languages, it uses radius as the unit for θ. I think there could be two ways to make this work.
    • we can change SRS, to let the unit be a radius
    • we can add the conversion part in code, so the ODE solver can get the right numbers
  2. How to show a system of ODE equations in one Instance model. The instance model of the double pendulum has multiple equations in one instance model. I wasn't aware of any good technique to combine two equations into one equation, then show it parallel (top and bottom). One hacky way is to use && to add two equations together, but it just adds a huge AND between two equations. Currently, I use two instance models to separate two equations θ₁'' and θ₂''.
  3. naming variables: the θ is the displacement of a pendulum. I named the θ' as the angular velocity of the pendulum. Then, I introduce a v symbol to replace θ'. Should I use v or θ'? The same thing happens in θ''. I use a as the angular acceleration of the pendulum, should I use θ'' instead?
smiths commented 2 years ago
  1. I prefer theta to be in radians, so the solution of changing the SRS to use radians is fine with me.
  2. Don't other instance models show multiple equations? You should be able to do it the same way it is done for other case studies.
  3. I'm fine with theta' and theta'', or you can use \omega and \alpha, respectively. You shouldn't use v and a, since those are generally used for rectilinear velocity and acceleration.
cd155 commented 2 years ago

By looking at the example, we don't have any example giving multiple equations in one instance model. A similar layout is ThoeryModel, in the theory model, we can give multiple ModelExpr. The equivalent constructor seems not available in Instance Model. https://github.com/JacquesCarette/Drasil/blob/af49fba74aecb1593dc5b91cb42d92a0121fb506/code/drasil-example/ssp/lib/Drasil/SSP/TMods.hs#L49-L52 Screenshot from 2022-05-26 10-49-50

cd155 commented 2 years ago

Ideally, we would like to have those two equations in one instance model Screenshot from 2022-05-26 12-37-53

I checked we have a similar display, but this is not ideal for the double pendulum example.

Screenshot from 2022-05-26 12-39-41

smiths commented 2 years ago

Thank you for searching through the examples @cd155. If it is too difficult to display, let's just go with a separate IM for each ODE. We shouldn't let display issues distract you from your main purpose.

smiths commented 1 year ago

We can use this issue for the review of double pendulum mentioned in the last comment for #2275. I don't have time right now, but some quick observations: