English
Source / code snippets

secret vieler Physics-Engines: Velocity Verlet Integrator

 

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  
 



Zum Quelltext


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.951 Views

Untitledvor 0 min.
Jens-Arne Reumschüssel07/08/22
p.specht07/01/22
RudiB.03/07/22
R.Schneider11/20/21
More...

Themeninformationen

this Topic has 1 subscriber:

p.specht (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie