title 'Electrostatic Potential and Field Lines' COORDINATES cartesian2 VARIABLES V {volts} D SELECT !contourgrid=2 !overshoot Ngrid =5 ERRLIM=1e-3 !stages=2 quadratic {Quadratic FEM basis => default = order 2} INITIAL VALUES V = 0 D = 0 DEFINITIONS cm = 0.01 Lx=800*cm Ly=1300*cm eps0=8.854e-12 epr eps=epr*eps0 {Equations for Electric Field} E0= 1e-5 {Far Field} Ex = -dx(V) Ey = -dy(V) {components of the gradient} E = -E0*grad(V) {definition of the gradient} D0 = eps*E0 !!!!!!!!!!!!!!!!!!!!!! Dx = dx(D) Dy = dy(D) D_ = D0*grad(D) {D_ = eps*E0*grad(D)} {components of the gradient (x,y)} Em = magnitude(E) Dm = magnitude(D_) !P = (eps - eps0)*E !Pm = magnitude(P) !trunc=.05*errlim !Tenergy = VOL_INTEGRAL ( V, '2' ) EQUATIONS V: div(grad(V)) = 0 { Potential equation } ! D: div(grad(D_)) = 0 D: div(D_) = 0 { adjoint equations } CONSTRAINTS !bintegral(V,"inner") = bintegral(1,"inner") BOUNDARIES REGION 1 ! eps0=8.854e-12 epr=1 ! eps=eps0*epr start (-0.75,-1.3) point value(V)=-12 value(V)=-12 line to (0.75, -1.3) point value(V)=-12 value(V)=-12 line to (0.75,1.3) point value(V)=-12 value(V)=-12 line to (-0.75,1.3) point value(V)=-12 value(V)=-12 line to (-0.75, 1.3) point value(V)=-12 value(V)=-12 line to close region 2 ! eps0 =8.854e-12 epr=80 ! eps=eps0*epr start (-0.25,0) line to (0.25,0) point value(V)=12 !natural(Q)= -normal(grad(v)) value(V) = 12 natural(V)= tangential(grad(D)) line to (0,0.5) point value(V)=12 !natural(Q)= -normal(grad(V)) value(V)=12 natural(D)= tangential(grad(D)) line to (-0.25,0) point value(V)=12 !natural(Q)= -normal(grad(V)) value(V)=12 natural(D)= tangential(grad(D)) line to (0,0) point value(V)=12 value(V)=12 natural(D)= tangential(grad(D)) line to close MONITORS contour(V) as 'Potential' contour(D) as 'Field' PLOTS grid(x,y) contour(V) as 'Potential' surface(V) as 'Potential and Field Lines' vector(-dx(V),-dy(V)) as 'Electric Field' vector(dx(D), dy(D)) !!!!!!!!!!!!!! contour(E) zoom(0.3, 0.3, 0.65,0.5) vector(E) zoom(0.3, 0.3, 0.65,0.5) contour(V) zoom(0.3, 0.3, 0.65,0.5) contour(Dm) zoom(0.3, 0.3, 0.65,0.5) !!!!!!!!!!!!!!!!!!!!!!! contour(D_) vector(D_) !contour(Dex) !contour(Dey) contour(Ex) contour(Ey) contour(Em) !contour(P) zoom(0.3, 0.3, 0.65,0.3) !!!!!!!!!!!!!!!!!!!!!!! contour(E) zoom(0.3, 0.4, 0.72, 0.4) vector(E) zoom(0.3, 0.4, 0.72, 0.4) !contour(P) zoom(0.3, 0.4, 0.72, 0.4) elevation(V) from(0.707, 0.3) to (0.707,0.4) !vector(Dex, Dey) vector(Ex, Ey) as 'V/cm' surface(Ex) surface(Ey) !surface(Dex) !surface(Dey) end