LispWorks tells me "flux1 assumed special."
Flux1 first appears inside a let statement which, as I understand it,
is supposed to make flux1 local, not special.
This is the only function in which the variable flux1 appears (formerly
flux, I changed the name from flux to flux1 to make sure it was unique)
(defun criticality-refine (flux-solver slab-length
D v-sigma-f
sigma-a albedoL albedoR)
(let ((k 0)
(flux1 (make-array 3 :initial-element 1))
(dx (/ slab-length (1- (length flux1)))))
(do () (nil)
(incf *iteration-count-mesh*)
(setf flux1 (make-array 3 :initial-element 1))
(setf k^ k)
(setf k (criticality-fixed flux-solver flux1
dx D v-sigma-f sigma-a albedoL albedoR))
(when (< (abs (- k k^)) (* k *k-tolerance*))
(return-from criticality-refine k))
(setf flux1 *flux*)
(setf flux1
(expand-flux flux1 (/ dx 2) D v-sigma-f sigma-a k))
(setf dx (/ slab-length (1- (length flux1)))))))
In article <························@z14g2000cwz.googlegroups.com>,
"Eric Lavigne" <············@gmail.com> wrote:
> LispWorks tells me "flux1 assumed special."
> Flux1 first appears inside a let statement which, as I understand it,
> is supposed to make flux1 local, not special.
FLUX1 appears twice, once as a variable that's being bound, and also as
part of the initialization of DX. The binding of a variable in LET
doesn't include the other initialization expressions. Perhaps you meant
to use LET* rather than LET? This allows you to refer to variables
bound earlier in the initialization of later expressions.
> This is the only function in which the variable flux1 appears (formerly
> flux, I changed the name from flux to flux1 to make sure it was unique)
>
> (defun criticality-refine (flux-solver slab-length
> D v-sigma-f
> sigma-a albedoL albedoR)
> (let ((k 0)
> (flux1 (make-array 3 :initial-element 1))
> (dx (/ slab-length (1- (length flux1)))))
> (do () (nil)
> (incf *iteration-count-mesh*)
> (setf flux1 (make-array 3 :initial-element 1))
> (setf k^ k)
> (setf k (criticality-fixed flux-solver flux1
> dx D v-sigma-f sigma-a albedoL albedoR))
> (when (< (abs (- k k^)) (* k *k-tolerance*))
> (return-from criticality-refine k))
> (setf flux1 *flux*)
> (setf flux1
> (expand-flux flux1 (/ dx 2) D v-sigma-f sigma-a k))
> (setf dx (/ slab-length (1- (length flux1)))))))
--
Barry Margolin, ······@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
>FLUX1 appears twice, once as a variable that's being bound, and also
as
>part of the initialization of DX. The binding of a variable in LET
>doesn't include the other initialization expressions. Perhaps you
meant
>to use LET* rather than LET? This allows you to refer to variables
>bound earlier in the initialization of later expressions.
Changing from let to let* fixed it. Thanks.
Eric Lavigne wrote:
> LispWorks tells me "flux1 assumed special."
> Flux1 first appears inside a let statement which, as I understand it,
> is supposed to make flux1 local, not special.
> This is the only function in which the variable flux1 appears (formerly
> flux, I changed the name from flux to flux1 to make sure it was unique)
>
> (defun criticality-refine (flux-solver slab-length
> D v-sigma-f
> sigma-a albedoL albedoR)
> (let ((k 0)
> (flux1 (make-array 3 :initial-element 1))
> (dx (/ slab-length (1- (length flux1)))))
^^^^^
This reference to FLUX1 is not within the LET scope. You need to use
LET* to achieve the effect you want.
Cheers
Marco
PS. The following looks like a Fortran to Lisp translation. You may
want to make several changes in it. In particular you are allocating a
new array at each iteration. Are you sure you want to do that?
> (do () (nil)
> (incf *iteration-count-mesh*)
> (setf flux1 (make-array 3 :initial-element 1))
> (setf k^ k)
> (setf k (criticality-fixed flux-solver flux1
> dx D v-sigma-f sigma-a albedoL albedoR))
> (when (< (abs (- k k^)) (* k *k-tolerance*))
> (return-from criticality-refine k))
> (setf flux1 *flux*)
> (setf flux1
> (expand-flux flux1 (/ dx 2) D v-sigma-f sigma-a k))
> (setf dx (/ slab-length (1- (length flux1)))))))
>