2d_stretch_xy

<< Click to Display Table of Contents >>

Navigation:  Sample Problems > Usage > Moving_Mesh >

2d_stretch_xy

Previous pageReturn to chapter overviewNext page

{  2D_STRETCH_XY.PDE

 

 This example demonstrates moving meshes in 2D.

 A Gaussian distribution is defined on a 2D mesh.

 The mesh is  then stretched to twice its initial size,

 while the Gaussian remains fixed in space.

 

 Output plots show that the Gaussian has retained its shape as

 it moves through the mesh.

 

 Mesh motion is imposed by explicit positions of the endpoints.

 

}

 

TITLE "stretching brick"

 

SELECT

 regrid=off

 

VARIABLES

 u

 xm = move(x)

 ym = move(y)

 

DEFINITIONS

 Hl = 1/2

 gwid = 0.15

 u0 = exp(-(x^2+y^2)/gwid^2)

 lmove = Hl + t

 ms = gwid^2/u0

 vx = dt(xm)

 vy = dt(ym)

 

INITIAL VALUES

 u = u0

 dt(xm) = x/Hl

 dt(ym) = y/Hl

 

EULERIAN EQUATIONS

 U:  dt(u)=0

 Xm:  div(grad(vx))=0

 Ym:  div(grad(vy))=0

 

BOUNDARIES

REGION 1

  mesh_spacing = ms

  START(-Hl,-Hl)

  value(u)=0 nobc(xm) value(ym)=-lmove

    line to (Hl,-Hl)

  value(u)=0 value(xm)=lmove nobc(ym)

    line to (Hl,Hl)

  value(u)=0 nobc(xm) value(ym)=lmove

    line to (-Hl,Hl)

  value(u)=0 value(xm)=-lmove nobc(ym)

    line to close

 

TIME 0 TO 0.5 by 0.01! 10

 

MONITORS

for cycle=1

  grid(x,y) zoom(-Hl-1/2,-Hl-1/2, 2*Hl+1,2*Hl+1)

  contour(u)

  elevation(u,u0) from(-10*Hl,0) to (10*Hl,0) range (0,1)

  elevation(u,u0) from(0,-10*Hl) to (0,10*Hl) range (0,1)

 

PLOTS

for time=0.1 by 0.1 to endtime

  grid(x,y) zoom(-Hl-1/2,-Hl-1/2, 2*Hl+1,2*Hl+1)

  contour(u)

  contour(u-u0) as "True Total Error"

  contour(space_error()) as "Estimated Step Error"

  elevation(u,u0)   from(-10*Hl,0) to (10*Hl,0) range (0,1)

  elevation(vx) from(-10*Hl,0) to (10*Hl,0) range (0,1)

  elevation(u,u0)   from(0,-10*Hl) to (0,10*Hl) range (0,1)

  elevation(vy) from(0,-10*Hl) to (0,10*Hl) range (0,1)

 

END