-
-
Save rozgo/be20badd56705986b1d8940fa99de228 to your computer and use it in GitHub Desktop.
BDF2 integrator in HLSL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void BFD2(inout ParticleSimulationDataP1 Particle, float3 Accel) | |
{ | |
float3 x = Particle.Position; | |
float3 v = Particle.Velocity; | |
float3 x1 = Particle.PositionPrev; | |
float3 v1 = Particle.VelocityPrev; | |
Particle.Position = (4.0/3.0) * x - (1.0/3.0) * x1 + 1.0 * ((8.0/9.0) * v - (2.0/9.0) * v1 + (4.0/9.0) * Accel * TimeStep2); | |
Particle.PositionPrev = x; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment