TITLE "Piston"
COORDINATES
Ycylinder
SELECT
regrid=off
painted
DEFINITIONS
my_ngrid = 30
stroke = 8
rad = 4
zraise = 1
rraise = 3*rad/4
gap = 2
gamma = 1.4
rho0 = 0.001
P0 = 100
visc = 0.15
rpm = 1000
period = 60/rpm
vpeak = (pi*stroke/period)
vprofile =vpeak*sin(2*pi*t/period)
zpiston = if r<rraise then zraise else zraise*(rad-r)/(rad-rraise)
zprofile = zpiston+0.5*stroke*(1-cos(2*pi*t/period))
ztop = stroke+gap+zraise
VARIABLES
rho(threshold = rho0/10) u(threshold = vpeak/10)
v(threshold = vpeak/10)
P(threshold = P0/10)
vm(threshold = vpeak/10)
zm=move(z)
DEFINITIONS
cspeed = sqrt(gamma*P/rho)
cspeed0 = sqrt(gamma*P0/rho0)
smoother = cspeed0*(rad/my_ngrid)
evisc = max(visc,smoother)
SELECT
ngrid= my_ngrid
INITIAL VALUES
rho = rho0
u = 0
v = 0
P = P0
EULERIAN EQUATIONS
rho: dt(rho) + dr(rho*u*r)/r + dz(rho*v) = smoother*div(grad(rho))
u: dt(u) + u*dr(u)+v*dz(u) + dr(P)/rho = evisc*div(grad(u))-evisc*u/r^2
v: dt(v) + u*dr(v)+v*dz(v) + dz(P)/rho = evisc*div(grad(v))
P: dt(P) + u*dr(P)+v*dz(P) + gamma*P*(dr(r*u)/r+dz(v)) = smoother*div(grad(P))
vm: dzz(vm)=0
zm: dt(zm)=vm
BOUNDARIES
REGION 1
START(0,zraise)
value(u)=0 value(v)=vprofile value(vm)=vprofile dt(zm)=vprofile
line to (rraise,zraise) to (rad,0)
value(u)=0 nobc(v) nobc(vm) nobc(zm)
line to (rad,stroke+gap)
value(u)=0 value(v)=0 value(vm)=0 dt(zm)=0
line to (rraise,ztop) to (0,ztop)
value(u)=0 nobc(v) nobc(vm) nobc(zm)
line to close
FEATURE start(rraise,zraise) line to (rad,stroke+gap)
TIME 0 TO 2*period by 1e-6
PLOTS
for t=0 by period/120 to endtime
grid(r,z) frame(0,0, rad,ztop)
contour(rho) frame(0,0, rad,ztop) fixed range(0,0.01) contours=50 nominmax
contour(u) frame(0,0, rad,ztop) fixed range(-500,500) contours=50
contour(v) frame(0,0, rad,ztop) fixed range(-550,550) contours=50
contour(P) frame(0,0, rad,ztop) fixed range(0,2600) contours=50 nominmax
vector(u,v) frame(0,0, rad,ztop) fixed range(0,550)
contour(cspeed) frame(0,0, rad,ztop) fixed range(0,610)
contour(magnitude(u,v)/cspeed) frame(0,0, rad,ztop) fixed range(0,1.5)
history(vprofile/vpeak,zprofile/stroke) range(-1,1)
report(vpeak) report(stroke)
history(globalmax(P), globalmin(P))
history(integral(P))
history(globalmax(rho), globalmin(rho))
history(integral(rho))
history(deltat)
END