next up previous contents
Next: 4.2 Adding tracers Up: 4 Going further Previous: 4 Going further   Contents


4.1 More on boundary conditions

Up to now we have only dealt with ``pre-packaged'' boundary conditions such as GfsBoundaryInflowConstant and GfsBoundaryOutflow. What if you need more specific boundary conditions?

For most practical problems, boundary conditions can be reduced to two main categories: Dirichlet boundary conditions for which the value of the variable is set and Neumann boundary conditions for which the value of the derivative of the variable is set. As we have seen earlier, the default boundary condition in Gerris is Dirichlet (zero) for the normal components of the velocity and Neumann (zero) for all other variables.

Let us say that we want to impose a Poiseuille (parabolic) profile rather than a constant inflow velocity for the half-cylinder problem i.e. we want a Dirichlet boundary condition on the normal component of the velocity (U) with an imposed parabolic profile. This can easily be done in Gerris like this:

...
GfsBox { left = GfsBoundary {
                  GfsBcDirichlet U { return 1. - 4.*y*y; }
                  GfsBcDirichlet V 0
                }
       }
GfsBox {}
GfsBox {}
GfsBox { right = GfsBoundaryOutflow }
...
Similarly a Neumann boundary condition on variable X would use GfsBcNeumann X ...