| |
|
|
p.specht
| the large Dilemma with the numerischen Solution of Feldgleichungen (z.B. Magnetfeldern) is the following: one must either first 2 locations and the verstrichene Time kennen, circa a Durchschnittsgeschwindigkeit to charge to (from the then but z.B. The Induktion and on the lane zurückwirkende magnetic forces take down). or one must, with Kenntnis the Ausgangsortes, the direction and speed, whom next Bahnpunkt to charge - The wirkenden nichtlinearen Reibungskräfte are but z.B. of lane ZWISCHEN Ausgangs- and nächstem Bahnpunkt tributary ... whom one but not yet knows! trouble recognized? Error-Minimierung alone helps there little, It's all right namely yet circa further properties, The a good Simulationsalgorithmus erfüllen must:
the secret vieler Physics-Simulationen is Velocity Verlet Integration, one fast Integrationsverfahren for Newton'sche Bewegungsgleichungen, the even the hochgenaue 'Runge-Kutta-4./5.Order (RKF45)'-take action exceeding, - though NOT on accuracy, separate on energy-Konstanz! Runge-Kutta incline namely in the running the Time moreover, through systematische Error and Rundungsfehler increasingly energy into simulierte system (about one Pendel) To pumps.
the can at here as DEMO OHNE GEWÄHR pictured VELOCITY VERLET-take action (very similar the 'Leapfrog'-take action, To german about 'Bockspringen') not occur, there it one ZEITUMKEHRBARES, SYMPLEKTISCHES take action is, which Error itself except for a small share mutual weitestgehend pick up. Zeitumkehrbar is: through Vorzeichenänderung in the Zeitschritt gelangt one again on The Ausgangsposition! Symplektisch means, that physikalische Erhaltungsgrößen How momentum, energy, Entropie thereby (weitestgehend) receive stay.
enclosed one deliberate utterly simply gehaltenes Verfahrensbeispiel (In Physics-Engines geht's then same in all 3 Freiheitsgraden the Translation and 3 the Rotation to thing):
Window Title "VELOCITY VERLET DEMO on the example Lineares feather-volume-Dämpfungssystem"
'(CL) CopyLeft 2014-08 by P.woodpecker, Wien
'Q: https://en.wikipedia.org/wiki/Verlet_integration#Velocity_Verlet
Window Style 24:Window 0,0-%maxx,%maxy
var xh&=width(%hwnd)\2:var yh&=height(%hwnd)\2
Declare m!,dt!,x1!,x2!,v1!,v15!,v2!,a1!,a2!
proc A :parameters x!,v!
var l!=200' Federlänge m/1000
var fk!=25' Federkonstante n/m 'strength per Auslenkung
var rk!=0.2' Reibungskonstante n*s/m
return (l!-x!)*fk!/m! - v!*rk!
'Beschleunigung = strength / volume - Reibungsdämpfung
endproc
proc DRAW
usepen 0,(xh&-x2!)/30 ,255
cls
line xh&-500,yh& - xh&+x2!-200,yh&
usepen 0,37,rgb(0,0,255)
line xh&+x2!-200,yh& - xh&+x2!-199,yh&
endproc
'Startwerte:
dt!=0.03's
m!=1'kg
'Einfachstes Zeichenmodell (with Cls, without MemCopy)
'Hauptschleife
Repeat :waitinput 33
'VELOCITY VERLET (aka Leapfrog)
v15!= v1!+a1!/2*dt!
x2! = x1!+v15!*dt!
a2! = A(x2!,v15!)
v2! = v15!+dt!*a2!/2
DRAW
a1!=a2!:v1!=v2!:x1!=x2!' Umgreifen for next step
until %key=27
END
|
|
|
| Computer: Gerät, daß es in Mikrosekunden erlaubt, 50.000 Fehler zu machen, zB 'daß' statt 'das'... | 05/14/21 ▲ |
|
|
|