Next: Heat equation, Previous: Elasticity problem, Up: Solving problems [Contents][Index]
The following sequence is a short excerpt from the Driven cavity demo in femlisp/src/applications/navier-stokes/driven-cavity.lisp. It solves the two-dimensional driven cavity problem with Reynolds number 10. During the approximation the velocity components at the midpoint (0.5,0.5) are printed.
(storing (solve (blackboard :problem (driven-cavity 2 :reynolds 10.0) :base-level 0 :success-if '(> :time 40.0) :output t :observe (append *stationary-fe-strategy-observe* (list (list (format nil "~{ u~1D~}" '(1 2)) "~{~19,10,2E~}" #'(lambda (blackboard) (let ((val (fe-value (getbb blackboard :solution) #d(0.5 0.5)))) (loop for i below 2 collect (vref (aref val i) 0))))))))))
(plot (^ :solution))
now plots the x-component of the solution, whereas
(plot (^ :solution) :component 1)
plots the y-component.
A vector plot can be achieved using
(plot (^ :solution) :component 'fl.navier-stokes::u :rank 1 :shape 2)