3D_Torus
Previous  Top  Next

3d_torus04
{
3D_TORUS.PDE
}

title '3D Torus'

coordinates
cartesian3

select
errlim = 0.005
ngrid = 20 { get better resolution of curved surfaces }
painted

Variables
u

definitions
Ra = 4 { the radius of the toroid axis }
Rt = 1 { the radius of the toroid tube }
Rad = sqrt(x^2+y^2)
ZTorus = sqrt(Rt^2-(Rad-Ra)^2)

equations
del2(u) + 1 = 0

Extrusion
Surface "Bottom" z = -ZTorus
Surface "Top" z = ZTorus

Boundaries
surface 1 value(u)=0
surface 2 value(u) = 0

Region 1
start(Ra+Rt, 0)
value(u) = 0
arc(center=0,0) angle=360 { the outer boundary }
start(Ra-Rt, 0)
value(u) = 0
arc(center=0,0) angle=360 { the inner boundary }

monitors
grid(x,y,z)
contour(u) on surface z=0
contour(u) on surface y=0

plots
grid(x,y,z)
contour(u) on surface z=0
contour(u) on surface y=0

end