IfThen

Top  Previous  Next

{  IFTHEN.PDE 

 

   This problem is a nonlinear test, which solves a modified

   steady-state Burger's equation.

 

   The conductivity is defined by a conditional (IF..THEN) expression.

 

   Caveat:

   IF..THEN can be dangerous if used improperly. 

   Equation coefficients that are discontinuous functions of the system

   variables can cause convergence failure or tiny timesteps and slow

   execution. See SWAGETEST.PDE.

 

}

 

title 'Nonlinear heatflow, conditional conductivity'

 

Variables

    u

 

definitions

    nl = u

    a =        if (u<0.5) and (x<100)

                 then         if u < 0.2

               then 1.4

                         else 1+2*abs(u)

               else 2

 

Initial values

    u = 1 - (x-1)**2 - (y-1)**2

 

equations

    div(a*grad(u)) + nl*dx(u) +4 = 0;

 

boundaries

    Region 1

       start(0,0)

              value(u)=0

       line to (2,0) to (2,2) to (0,2) to close

 

monitors

    contour(u)

plots

    surface(u)

    contour(u)

    contour(a) as "Conductivity"

    elevation(a,u) from (0,1) to (2,1)

 

end