Putting It All Together

<< Click to Display Table of Contents >>

Navigation:  User Guide > Basic Usage >

Putting It All Together

Previous pageReturn to chapter overviewNext page

In the previous sections, we have gradually built up a problem specification.

Putting it all together and adding a TITLE, it looks like this:

TITLE 'Heat flow around an Insulating blob'

VARIABLES

Phi                { the temperature }

DEFINITIONS

K = 1                { default conductivity }

R = 0.5                { blob radius }

EQUATIONS

Div(-k*grad(phi)) = 0

 

BOUNDARIES

REGION 1 'box'

START(-1,-1)

VALUE(Phi)=0        LINE TO (1,-1)

NATURAL(Phi)=0        LINE TO (1,1)

VALUE(Phi)=1        LINE TO (-1,1)

NATURAL(Phi)=0        LINE TO CLOSE

REGION 2 'blob'        { the embedded blob }

k = 0.001

START 'ring' (R,0)

ARC(CENTER=0,0) ANGLE=360 TO CLOSE

PLOTS

CONTOUR(Phi)

VECTOR(-k*grad(Phi))

ELEVATION(Phi) FROM (0,-1) to (0,1)

ELEVATION(Normal(-k*grad(Phi))) ON 'ring'

END

 

We have defined a complete and meaningful problem in twenty-three readable lines.

The output from this script looks like this: