GfsSimulationMoving
From Gerris
GfsSimulationMoving changes the time-integration of a standard GfsSimulation in order to be able to include GfsSolidMoving moving solid boundaries. The motion of the solid boundary can be prescribed using GfsSurfaceBc.
Examples
- Translation of an hexagon in a uniform flow
- B\'enard--von K\'arm\'an vortex street behind a cylinder translating in a fluid at rest
2 1 GfsSimulationMoving GfsBox GfsGEdge {} {
Time { end = .1875 }
Refine 7
SolidMoving hexagon.gts { scale = 0.250001 } { level = 7 }
AdvectionParams {
moving_order = ORDER
# uncommenting the following line leads to instabilities for the
# first-order scheme
# cfl = 0.45
}
ProjectionParams { tolerance = 1e-10 }
ApproxProjectionParams { tolerance = 1e-10 }
AdaptVorticity { istep = 1 } { minlevel = 4 maxlevel = 7 cmax = 1e-2 }
VariableTracer T
SurfaceBc U Dirichlet 1.
Init {} { U = 1 T = 1 }
OutputErrorNorm { istep = 1 } {
awk '{ printf ("%e %e %e %e\n", $3, $5, $7, $9) }' > momentumerror-ORDER
} { v = sqrt((U - 1.)*(U - 1.) + V*V) } { s = 0. }
OutputScalarSum { istep = 1 } {
awk '{ printf ("%e %e\n", $3, $5 - 1.953125) }' > tracersum-ORDER
} { v = T }
OutputSimulation { start = end } end-ORDER.gfs
}
1 0 GfsSimulationMoving GfsBox GfsGEdge {} {
Time { end = 0.8 }
Refine {
if (fabs(y) < 0.02 && x > 0.38 && x < 0.42)
return 11;
if (fabs(y) < 0.35 && x > 0.3 && x < 0.5)
return 8;
return 5;
}
SolidMoving { istep = 1 } cylinder.gts { tx = 0.4 scale = 0.025 } { level = 11 }
# Set the boundary condition on the solid object.
# The velocity is imposed
SurfaceBc U Dirichlet -1.
# Adapt the mesh using the vorticity criterion at every timestep
AdaptVorticity { istep = 1 } { maxlevel = (x > 0.5 - t ? 9 : 10) cmax = 1e-2 }
SourceViscosity 3.125e-5
OutputSimulation { start = end } end.gfs
OutputSolidForce { istep = 1 } forces.dat
EventScript { start = end } {
cat <<EOF | gnuplot 2>&1 | awk '{if ($1 == "400") print $0;}'
f(x)= a*cos(b*(x+c))
a = 0.00525
b = 110.49
c = 0.611
fit [0.5:] f(x) 'forces.dat' u 1:6 via a,b,c
print "400 ", b/(2*pi)*0.0125
EOF
}
}