## lundi 12 novembre 2012

### Fun with OpenFOAM and meandering channel

This post is the result of my TA activities. So this time I've decided to show students how to make curved meshes and how to run free surface simulations with OpenFOAM.

Cause all students are from Civil and Environmental Engineering department typical curved mesh is necessary for meandering channels simulation. Surely there're another types of flumes with curved parts (rising sector weir gate for ex.) but with meandering channels we'll have more fun.

Scheme of the channel are shown on Fig. 1. We've got 270 degree meandering part with centerline radius of 1.5 m which is connected to straight 1 m inlet and outlet channels with two small curved parts of smaller radius.

 Figure 1
Progress on mesh creation is shown on Figs. 2-5. First mesh without curved edges is built, then arc edges are added, then density of mesh increased, and at last upper part (where air is located) of the channel added.

 Figure 2

 Figure 3

 Figure 4

 Figure 5
 Figure 6
Boundary conditions are rather usual for this type of simulations. We have constant discharge at the inlet and outlet (though maybe it'll be better to set zero gradient BC at the outlet). Then it is possible to run simulation. On the video first 200 s from the start are shown.

Most of the time when comparing simulation results with experiment it is necessary to get some more of less steady flow in the flume. Usually it is achieved by running simulation for rather long time (as an estimation we can take the time necessary to refill the channel, i.e. channel length / inlet velocity). With initially still fluid in the channel it'll take rather long time to settle all the oscillations of the free surface. So it's better to get some initial estimation of the velocity distribution in the channel. For the straight channel this first estimation (constant velocity along the channel) can be set with setFields utility, in case of more complex channel shapes we can use pimpleFoam where fluid free surface do not move and actually is wall with slip BC. So in this case I took mesh from Fig. 5, ran pimpleFoam with the same inlet and outlet BCs and then used mapFields for initial flow field setup.

Video of the free surface evolution in this new simulation is shown below.

As in the previous case in the video around 200 seconds from the start of simulation are shown. And this time we get almost steady flow during this time.

OpenFOAM files for the cases can be found at https://bitbucket.org/mrklein/openfoam-course/src/9f9c41fdb851125a6a4bedb56dd3b8fd67c37330/meandering?at=master.