rasg
07-03-2004, 10:08 PM
I modified mgfas and its friends to so that I can use Neumann boundary conditions and/or imhomogenous boundary conditions. The test problem I'm trying is
del^2 u = rho
with u = sin(pi*x) * sin(1.5*pi*y) as the trial solution.
So there can either be a Neumann condition at y=1 or I can use the inhomogenous Dirichlet condition u(x,1)=-sin(pi*x)
In both cases a single FMG cycle converges to the level of truncation error, as measured by the rms error with the known solution. (Additional V-cycles do not improve the rms error and it goes down as h^2 as I change the finest grid size.) However, the residual after the FMG cycle is huge (compared with the residual of the known solution using the fine grid residual operator) and does not go down as h^2. Further V-cycles only improve the residual by about a factor of 3 each time for the Neumann case (the inhomogenous Dirichlet gets about a factor of 30 each V-cycle).
The automatic termination condition is also being thwarted because the estimated truncation error is even bigger than the residual, so the routine always terminates after one cycle.
I'm wondering if I am handling the boundary conditions incorrectly. What is the right way to do that? In particular, restriction seems problematic. Currently, for the Neumann condition I am just ignoring the parts of the stencil that would reach outside the array. However, that means that at the edges the stencil does not sum to 1, which seems a bit odd. Should I renormalize it? How? Divide by the sum of the entries? Or should I double the interior entries (i.e. pretend there is a false boundary such at u(N+1, j) = u(N-1,j) and derive the stencil using that condition). What about the inhomogenous Dirichlet conditions? Right now I am imposing the condition at all levels. Would it be better to get the boundary conditions on the coarse grids by restricting the fine grid condition? If so, then the issue of normalization of the restriction stencil comes up again... (Also, presumably one does not apply the correction to the boundary.) Are there other subtleties as well?
del^2 u = rho
with u = sin(pi*x) * sin(1.5*pi*y) as the trial solution.
So there can either be a Neumann condition at y=1 or I can use the inhomogenous Dirichlet condition u(x,1)=-sin(pi*x)
In both cases a single FMG cycle converges to the level of truncation error, as measured by the rms error with the known solution. (Additional V-cycles do not improve the rms error and it goes down as h^2 as I change the finest grid size.) However, the residual after the FMG cycle is huge (compared with the residual of the known solution using the fine grid residual operator) and does not go down as h^2. Further V-cycles only improve the residual by about a factor of 3 each time for the Neumann case (the inhomogenous Dirichlet gets about a factor of 30 each V-cycle).
The automatic termination condition is also being thwarted because the estimated truncation error is even bigger than the residual, so the routine always terminates after one cycle.
I'm wondering if I am handling the boundary conditions incorrectly. What is the right way to do that? In particular, restriction seems problematic. Currently, for the Neumann condition I am just ignoring the parts of the stencil that would reach outside the array. However, that means that at the edges the stencil does not sum to 1, which seems a bit odd. Should I renormalize it? How? Divide by the sum of the entries? Or should I double the interior entries (i.e. pretend there is a false boundary such at u(N+1, j) = u(N-1,j) and derive the stencil using that condition). What about the inhomogenous Dirichlet conditions? Right now I am imposing the condition at all levels. Would it be better to get the boundary conditions on the coarse grids by restricting the fine grid condition? If so, then the issue of normalization of the restriction stencil comes up again... (Also, presumably one does not apply the correction to the boundary.) Are there other subtleties as well?