Let's Write a DPD Simulation from Scratch in C! (Part 3)

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ม.ค. 2025

ความคิดเห็น • 2

  • @mubarakalkorbi9463
    @mubarakalkorbi9463 5 หลายเดือนก่อน

    Hi Michael! Thank you for the amazing video! I just wanted to point out that in wr = 1.0/dr - 1.0; it should be wr = 1.0- dr;. Keep up the great work!

    • @mjahore
      @mjahore  5 หลายเดือนก่อน

      @@mubarakalkorbi9463 Thanks very much! What’s actually being computed is wr/dr in the code. The reason for doing this is for efficiency. Since all of the forces need to be projected along unit vectors in the x, y, and z directions… if we divide wr/dr we can save ourselves two operations since we will not need to divide dx/dr, dy/dr, and dz/dr to calculate those unit vectors (i.e., we do it once in wr and just multiply by the dx, dy, and dz we already computed to determine whether dr < rc).