This example demonstrates the use of "IF...THEN" conditionals in arithmetic statements.
We solve a heat equation in which the conductivity is defined by a conditional
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'
a = IF (u<0.5) and (x<100)
THEN IF u < 0.2
u = 1 - (x-1)^2 - (y-1)^2
U: div(a*grad(u)) + 4 = 0;
line to (2,0) to (2,2) to (0,2) to close
contour(a) as "Conditional Conductivity"
elevation(a,u) from (0,1) to (2,1) as "Conductivity and Solution"