Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^10: [OT] Forces.

by bitingduck (Chaplain)
on Feb 16, 2016 at 05:40 UTC ( [id://1155326]=note: print w/replies, xml ) Need Help??


in reply to Re^9: [OT] Forces.
in thread [OT] Forces.

Unless it's already in motion, which it will be if the F_perp is non-zero at some prior time and you haven't by luck gotten to a spot where v=0 and a=0 at the same time.

You need to clarify exactly what you're trying to solve for

At first it sounded like you were looking for the static solution where the forces all add up to zero. If that's the goal, then you can calculate F vs. theta at small intervals all the way around the circle and then pick (or interpolate) the solution where F_perp=0. You can ignore F_parallel-- it will always be balanced by the stiffness of the material (until you break it). If you pick small enough intervals, you shouldn't have to worry about pathological cases of interpolating magnetic fields. They can do goofy things on you, but that will show up as big variations over a small angle in the area you're interpolating. If it's smooth around that region, it's fair to assume it's smooth in the interpolated region.

If you're trying to solve for the dynamic motion of the system by running a static force solver in a loop and integrating (what I described above), then you can write the loop, have it call the magnetic force solver at the prescribed place, decompose it into F_perp and F_parallel, and integrate. If the linkage is already in motion at the point where F_perp=0, then it will drift through that point and start experiencing forces again at some other location. The only time you'll get zero motion is if you get to a time & position where v=0 and F=0. The loop I gave you won't give you a random adjustment at a place where F_perp=0. It will adjust it by the velocity at that time.

As I write this, the heart of the matter seems to be initial conditions-- if you're going to integrate force over time to get position (a perfectly valid thing to do that I do on a regular basis), you have to have some initial position and velocity (zero is a valid choice for both). If you do one time integral of acceleration you get a constant left over, which is the initial velocity. If you do a second time integral, you get another constant, which is the intial position. You haven't been given them, but you have to pick something or you can't do the dynamic solution.

The problem itself is pretty straighforward: you're trying to solve the motion of a rotating system with one degree of freedom (the angle theta), and a variable force (F_perp(theta)), and you're using an external system to calculate the force F(x,y) that you have to convert into F_perp(theta), which I did in my first post. You can ignore everything else, as long as there are no torques on the disk.

EDIT: Here's a revised version of the code that explicitly includes the time interval

$m_inverse=1 /* this could be chosen as arbitrarily small, like 0.000 +01 to get effectively smaller time steps) */ $v=0 $theta=0 $dt=1 /* the time interval, you can also make this of arbitrary size +*/ while(!$done){ ($F_x,$F_y)=ForceCalculator($theta) /* call your magnetics librar +y */ $F_perp=$F_x*sin(theta)+$F_y*cos($theta) $theta=$theta+$v*$dt $v=$v+$F_perp*$scale*dt }

I also swapped the order of the position and time calculation, so that it's using the current velocity v(t_now) to get theta(t_now+dt)=t_now+dt instead of using the velocity(t_now+dt), which shouldn't make much difference if things aren't changing much with position

Replies are listed 'Best First'.
Re^11: [OT] Forces.
by BrowserUk (Patriarch) on Feb 16, 2016 at 06:46 UTC
    Unless it's already in motion

    Okay. You've got me back with that bit. It makes sense (to me).

    This bit worries me a little:

    and you haven't by luck gotten to a spot where v=0 and a=0 at the same time

    But I can suspend/defer that worry.

    you have to have some initial position and velocity (zero is a valid choice for both)

    I do have to have an initial position, and can pretty much pick one arbitrarily. So, A aligned with B aligned East (0°) is as good as any and better than most.

    I do not have (from the simulation's perspective, do not need) an initial velocity. The forces acting at any given position are the same regardless of how quickly it arrived there. An assumption of zero velocity is perfectly valid as the model simply has no provision for knowing it.

    I if make the initial position 0 ° and 0 rads/s; and the calculated forces have a 0 Y component and a massive (pos or neg) X component, nothing will move and there will be no acceleration. Your code will get F(perp) = 0, times scale still 0; v remains 0; theta remains 0. Nothing moves. Perfect!

    Same initial position; X=0, Y= some big value. F(perp) = F(y); v = 0 + F(perp) * scale; Theta = 0 + v.

    So in order to make things useful, I need to set scale such that v adjusts theta by a small amount rather than causing it spin around like a whirling dervish.

    For that I need a rough approximation of the maximum value F(perp) might attain, and then chose scale to adjust that to produce my desired ~1 degree of rotation per step.

    The maximum values I'm seeing from the sim (X or Y) are ~330, which if both components reached that simultaneously (not sure that's possible) gives an F(perp) of 466. If it results in too small a steps, tweak it later.

    Adjust the position of A with respect to B in the model by the change in theta. Adjust the position of the body with respect to A by that same delta theta * 90/360 to account for my known rate of precession. And iterate.

    Hm. It should become obvious after 5 or 10 iterations of the loop whether I've chosen an appropriate scaling factor. 5 or 10 hours to see what happens. (Hmmm :)

    There are various design factors that influence the forces involved. I've seen pairings (for the 0 ° starting point) as high a x=300+ y:<-1; and as low as x=62 y=-69. So if I start with a scale factor of 1/200 it should ensure that I start to see some movement fairly quickly and be able to get a feel for how to adjust it from there.

    I guess I'll give it a go and get back to you with the results.

    Sorry for forcing you to lead me by the hand(nose) through this, but whilst I familiar with using integration to reduce one variable to an effective 0; I've never (knowingly) seen it used to effectively discard all but one variable. I've written software to perform integrations -- basically just implement the formula and stick the values in -- but never used it in this way.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice.

      Sorry for forcing you to lead me by the hand(nose) through this...

      I'm much better at this stuff than I am at Perl- and I've benefited plenty from your posts over many years. One recommendation while you're doing your trial runs-- since they're so expensive, save all your F(thetas) and hash them later. Unless your fields are really pathological they're likely to come in handy later (unless the problem setup is such that you're always getting a new field geometry)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1155326]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-20 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found