<< Click to Display Table of Contents >> fieldmap 

{ FIELDMAP.PDE
This example shows the use of the adjoint equation to display Electric field
lines and to compare these to the vector plot of E.
The problem shows the electrostatic potential and the electric field
in a rectangular domain with an internal region in which the dielectric
constant is five times that of the surrounding material.
The electric field E is grad(V), where V is the electrostatic potential.
The adjoint equation method of generating field lines will only work if there
are no internal sources (charged bodies).
See also DIELECTRIC.PDE
}
title 'Electrostatic Potential and Electric Field'
variables V Q
definitions eps = 1
equations { Potential equation } V: div(eps*grad(V)) = 0 then { adjoint equation } Q: div(grad(Q)/eps) = 0
boundaries region 1 start (0,0) value(V) = 0 natural(Q) = tangential(grad(V)) line to (1,0) natural(V) = 0 natural(Q) = tangential(grad(V)) line to (1,1) label 'V100' value(V) = 100 natural(Q) = tangential(grad(V)) line to (0,1) endlabel 'V100' natural(V) = 0 natural(Q) = tangential(grad(V)) line to close 
region 2
eps = 5
start (0.4,0.4)
line to (0.8,0.4) to (0.8,0.8) to (0.6,0.8)
to (0.6,0.6) to (0.4,0.6) to close
monitors
contour(V) as 'Potential'
contour(Q) as 'Field'
plots
grid(x,y)
contour(V) as 'Potential'
contour(Q) as 'Adjoint Field Lines'
contour(V,Q) as 'Potential and Adjoint Field Lines'
vector(dx(V),dy(V)) as 'Electric Field'
vector(dx(V),dy(V)) norm notips as 'Electric Field'
fieldmap(V) on "V100" fieldlines=24 points=200 as "Field Map"
contour fieldmap(V) on "V100" fieldlines=24 points=200 as "Potential and Field Map"
end