3
$\begingroup$

I am setting up to solve a 2D Poisson equation $\nabla^2u = T$ by the finite difference method.

I am using the multigrid method. On the coarsest mesh, where the grid size is 2x2, I want to set up boundary conditions so that the right hand side, $T$, is constant. I do not want a Dirichlet boundary condition, where $u$ is constant, nor a Neumann boundary where the derivative of $u$ is constant. I do have Dirichlet boundaries. See edit, below.

Here is the base mesh: Four nodes of coarse Poisson mesh

Now I set up boundary "ghost" nodes as so, which will hold the constant values of $T$ and influence the 4 "actual" nodes.

Four nodes with ghost nodes

So now, using the discretized Poisson equation for $u_{0,0}$,
$\frac{1}{h^2}(-4u_{0,0} + u_{0,1} + u_{1,0} + u_{-1,0} + u_{0,-1}) = T_{0,0}$

I think this is straightforward. The question I have is - what equation(s) to use for the boundary nodes?

To further clarify with a physical correlation, I am attempting something similar to convection, where $T$ represents a temperature analogue, and $u$ an analogue of vorticity, which will then be used to calculate velocities, which then calculates temperature changes.

However, I want these boundary nodes to be set at a constant temperature, in essence "heated from below" where $T_{0,2}$ and $T_{1,2}$ are set to $1.0$ and all other boundary nodes to $0.0$.

Obviously when calculating temperature change for the next time step, it is trivial simply not to update the $T$ values on the boundary and leave them constant. But I'm not sure what to do with the boundaries as part of solving the Poisson equation exactly.

Is it necessary to make the boundary nodes influenced by each other, i.e. $\frac{1}{h^2}(-4u_{0,-1} + u_{1,-1} + u_{0,0}) = T_{0,-1} = 0.0$

The left hand side of that equation is probably totally wrong, I could forward difference it I suppose in the y-direction, but then do I need to add a corner boundary node, $u_{-1,-1}$ for the x-direction?

Or does a boundary node, being outside of the "fluid" (base mesh) so to speak, not need to be influenced by other nodes also outside the "fluid"? Could I simply write the equation as a 1D forward difference: $\frac{1}{h^2}(u_{0,-1} - 2u_{0,0} + u_{0,1}) = T_{0,-1} = 0.0$

In summary, although there are plenty of resources describing how to set up Dirichlet and Neumann boundaries, I couldn't find much on how to set up a constant right-hand side boundary. I'm sure it's trivial and I'm missing something obvious, but I appreciate the help, especially since I have no formal training in any scientific computation.

EDIT: In reviewing my question, I realized that I do have an implicit Dirichlet boundary of $u=0$ anywhere outside of the boundary nodes, if I choose a 4x4 mesh, and the equation for the outer nodes is, e.g. $\frac{1}{h^2}(-4u_{0,-1} + u_{-1,-1} + u_{1,-1} + u_{0,0}) = T_{0,-1}$, because $u_{0,-2}$ would be 0 in this case (sorry about the negative indexes, hopefully it's not too confusing).

Which would mean I just stick to central differences. But I still want to define my source term on the outer nodes to get the "heated from below" effect. Should I just redefine $T$ as needed at the beginning of each time step?

$\endgroup$
5
  • $\begingroup$ The r.h.s. of the discretized system follows from the equation and its boundary conditions. You need something for $u$ and $\nabla u$ on the boundaries to define the integration constants. By the way, if $u$ stands for vorticity and $T$ for temperature, your equation doesn't make dimensional sense. $\endgroup$ – chris Mar 31 '15 at 6:46
  • $\begingroup$ Yes, the $u$ is not exactly vorticity, but an analogue that is dimensionally correct. $T$ isn't exactly temperature either, but a simplification. The initial RHS is input as a guess. If it helps, one can ignore that explanation - my question is really more symbolic. $\endgroup$ – PathoNomadic Mar 31 '15 at 8:03
  • 1
    $\begingroup$ How would a constant source term help to uniquely define a solution to a pde. That's not possible. You need either Dirichlet, Neumann or Robin Boundary or similar conditions for u otherwise your problem is not well defined. $\endgroup$ – Bort Mar 31 '15 at 8:48
  • $\begingroup$ Can you clarify if T is defined on the boundary of the domain or on the interior, please. Currently with the set Dirichlet BCs on the nodes with negative indices, the source term T is a line element within the domain and can be treated as such. $\endgroup$ – Bort Apr 1 '15 at 8:37
  • $\begingroup$ $T$ is defined as $0.0$ here: $T_{-1,-1} = T_{0,-1} = T_{1,-1} = T_{2,-1} = T_{-1,0} = T_{-1,1} = T_{2,0} = T_{2,1} = 0$. $T$ is defined as $1.0$ here: $T_{-1,2} = T_{0,2} = T_{1,2} = T_{2,2} = 1$. And then my Dirichlet BC of $u=0$ is on every (imaginary?) cell outside of those cells ($u_{-2,0}$ etc). Again, sorry if the indices and my terminology, etc are confusing. I'm learning as I go! I'm happy to redo the figures if requested with my limited photoshop skills. Thanks a lot. $\endgroup$ – PathoNomadic Apr 1 '15 at 16:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.