Next: , Previous: , Up: Solving problems   [Contents][Index]

3.2.5 Heat equation

The support for time-dependent problems is still rudimentary. Especially, it is not yet incorporated in the solution strategy using solve. For setting up a Rothe method by hand, you may use code like the following which solves a one-dimensional heat equation with zero right-hand side and some initial values:

(let* ((dim 1) (levels 4) (order 2)
       (problem (cdr-model-problem
                 dim :initial #'(lambda (x) #I(sin(2*pi*x[0]^^2)))
                 :reaction 0.0 :source #m(0.0)))
       (rothe (make-instance
               '<rothe> :model-time 0.0 :time-step 0.01
               :stationary-success-if `(> :nr-levels ,levels)
               :success-if '(>= :step 20)
               :output t :plot t)))
    (iterate rothe (blackboard
                    :problem problem :fe-class (lagrange-fe order)
                    :plot-mesh nil :output t))))

First, the mesh is built up to approximate the initial values until given criteria are met (here the number of levels is prescribed). Then a time-stepping scheme with the implicit Euler method and uniform time-steps is used to approximate the solution in time.