fluid-set-boundary   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/examples/contrib/fluid_dynamics.xtm

Implementation

(bind-func fluid-set-boundary
  (lambda (b:i64 x:double* N:i64)
    (let ((j 0)
    (i 0)
    (kk 0)
    (ii 0)
    (kkk 0)
    (jjj 0))
    (dotimes (j (- N 2))
      (dotimes (i (- N 2))
  (pset! x (fluid-ix (+ i 1) (+ j 1) 0 N)
         (if (= b 3)
       (- 0.0 (pref x (fluid-ix (+ i 1) (+ j 1) 1 N)))
       (pref x (fluid-ix (+ i 1) (+ j 1) 1 N))))
  (pset! x (fluid-ix (+ i 1) (+ j 1) (- N 1) N)
         (if (= b 3)
       (- 0.0 (pref x (fluid-ix (+ i 1) (+ j 1) (- N 2) N)))
       (pref x (fluid-ix (+ i 1) (+ j 1) (- N 2) N))))))
    (dotimes (kk (- N 2))
      (dotimes (ii (- N 2))
  (pset! x (fluid-ix (+ ii 1) 0 (+ kk 1) N)
         (if (= b 2)
       (- 0.0 (pref x (fluid-ix (+ ii 1) 1 (+ kk 1) N)))
       (pref x (fluid-ix (+ ii 1) 1 (+ kk 1) N))))
  (pset! x (fluid-ix (+ ii 1) (- N 1) (+ kk 1) N)
         (if (= b 2)
       (- 0.0 (pref x (fluid-ix (+ ii 1) (- N 2) (+ kk 1) N)))
       (pref x (fluid-ix (+ ii 1) (- N 2) (+ kk 1) N))))))
    (dotimes (kkk (- N 2))
      (dotimes (jjj (- N 2))
  (pset! x (fluid-ix 0 (+ jjj 1) (+ kkk 1) N)
         (if (= b 1)
       (- 0.0 (pref x (fluid-ix 1 (+ jjj 1) (+ kkk 1) N)))
       (pref x (fluid-ix 1 (+ jjj 1) (+ kkk 1) N))))
  (pset! x (fluid-ix (- N 1) (+ jjj 1) (+ kkk 1) N)
         (if (= b 1)
       (- 0.0 (pref x (fluid-ix (- N 2) (+ jjj 1) (+ kkk 1) N)))
       (pref x (fluid-ix (- N 2) (+ jjj 1) (+ kkk 1) N))))))


Back to Index

Similar Entries

  • fluid-set-boundary    xtlang
  • fluid-set-boundary    xtlang