rotating_shape

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > Accuracy >

rotating_shape

Previous pageReturn to chapter overviewNext page

{

  ROTATING_SHAPE.PDE

 

  This test rotates a sinusoidal shape around a center at a fixed timestep of one degree per timestep

  to demonstrate the degradation of the shape after one, two and three circuits.  

}

 

title 'One Degree per Timestep'

 

select

fixdt ! use a fixed timestep

errlim=1e-4

 

variables

    u

 

definitions

wide=1

rad=sqrt((x+0.5)^2+y^2)

 

! define the initial shape as one pulse of (cos(ang)+1)

u0 = if(rad < 0.25) then 0.5*(cos(4*rad*pi)+1) else 0

vel = vector(-y,x)

 

initial values

  u = u0

 

equations

  dt(u) + dot(vel,grad(u))  = 0

 

boundaries

  ! define a square region to rotate in

  Region 1

  start(-wide,-wide) value(u)=0

  line to(wide,-wide) to(wide,wide) to(-wide,wide) to close

 

time=0 to 6*pi by pi/180     ! one degree per timestep

 

monitors

  for t=0 by pi/4 to endtime

    grid(x,y)

    contour(u)

 

plots

  for t=0 by 2*pi to endtime

    grid(x,y)

    contour(u)

        report(globalmax(u))    

        report(globalmax_x(u))

    surface(u)

    contour(u-u0)

    contour(dxx(u)) contour(dxy(u)) contour(dyy(u))

   

  for t=2*pi

    elevation(u, u0) from(-1,0) to (1,0)

  for t=4*pi

    elevation(u, u0) from(-1,0) to (1,0)

  for t=6*pi

    elevation(u, u0) from(-1,0) to (1,0)

     

end