```
;; I don't want to reflect at boundary points
;; so just average everything.
(bind-func fluid-set-boundary
(lambda (b:i64 x:double* Ny:i64 N:i64)
(let ((j 0)
(i 0)
(lastrow (* (- Ny 1) N)))
(dotimes (i 1 (- N 2))
(pset! x i
(* 0.5 (+ (pref x i)
(pref x (+ i N)))))
(pset! x (+ i lastrow)
(* .5 (+ (pref x (+ i lastrow))
(pref x (+ i (- lastrow N)))))))
(dotimes (j 1 (- Ny 2))
(pset! x (* j N)
(* .5 (+ (pref x (* j N))
(pref x (+ 1 (* j N))))))
(pset! x (+ (* j N) (- N 1))
(* .5 (+ (pref x (+ (* j N) (- N 1)))
(pref x (+ (* j N) (- N 2)))))))
```

Back to Index