﻿ Sample Problems > Usage > Moving_Mesh > 2d_stretch_x

# 2d_stretch_x

Navigation:  Sample Problems > Usage > Moving_Mesh >

# 2d_stretch_x   {  2D_STRETCH_X.PDE

This example demonstrates moving meshes in 2D.

A 1D Gaussian distribution is defined on a 2D mesh.

The mesh is then stretched to twice its initial X size,

while the Gaussian remains fixed in space.

Elevation displays show that the Gaussian retains its correct

shape as it moves through the mesh.

Mesh motion is imposed by explicit positions of the endpoints.

}

TITLE "2D brick stretching in x"

VARIABLES

u

xm = move(x)

DEFINITIONS

Hl = 1/2

wid = 0.01

gwid = 0.15

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

lmove = Hl + t

vx = dt(xm)

INITIAL VALUES

u = u0

dt(xm) = x/Hl

EULERIAN EQUATIONS

U:   dt(u)=0

BOUNDARIES

REGION 1

START(-Hl,0)                               line to (Hl,0)

value(u)=0 value(xm)=lmove     line to (Hl,wid)

natural(u)=0 nobc(xm)             line to (-Hl,wid)

value(u)=0 value(xm)=-lmove   line to close

TIME 0 TO 0.5 by 0.01

MONITORS

for time=0

grid(x,10*y) as "Initial mesh"

contour(vx)

for cycle=1

grid(x,10*y)

contour(u)     zoom(-2*Hl,0, 4*Hl,2*wid)

contour(vx)     zoom(-2*Hl,0, 4*Hl,2*wid)

contour(dt(xm)) zoom(-2*Hl,0, 4*Hl,2*wid)

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

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

elevation(dt(xm)) from(-10*Hl,wid/2) to (10*Hl,wid/2) range (0,1)

PLOTS

for time=0.1 by 0.1 to endtime

grid(x,10*y)

contour(u) zoom(-2*Hl,0, 4*Hl,2*wid)

contour(vx) zoom(-2*Hl,0, 4*Hl,2*wid)

contour(dt(xm)) zoom(-2*Hl,0, 4*Hl,2*wid)

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

END