2
$\begingroup$

I am trying to implement a numerical solver and am having troubles dealing with boundary conditions, especially in the corners.

I have a 2D mesh, and on the left I have a Dirichlet condition, on the bottom I have a Neumann condition, and on the top and on the right I have a zero-flux vacuum boundary condition.

That is:

On the left: $u = B$, a constant value

On the bottom: $\frac{du}{dn} = 0$, symmetry of the problem

On the right and top: $\frac{1}{u} \frac{du}{dn} = \frac{-1}{d_n}$, where $d_n$ is an extrapolation length. So we're saying that the flux will be technically zero at that distance from the boundary

I can set up my finite difference equations for those mostly, with my Laplacian depending on $u_{i,k-1}$, $u_{i-1,k}$, $u_{i,k}$, $u_{i+1,k}$ and $u_{i,k+1}$, with my boundary conditions looking like:

Bottom left corner (i=0, k=0):

$u_{i,k} = B$

Bottom right corner (i=0, k=L):

$u_{1,k}$ = $u_{-1,k}$ [ghost point]

$\frac{u_{i,k+1} - u_{i,k-1}}{\Delta z + d} = -\frac{u_{i,k}}{d}$ $\rightarrow$ $u_{i,k} = \frac{d}{d+\Delta z} u_{i,k-1}$

And I replace everything in my Laplacian so that it only depends on $u_{i+1,k}$ and $u_{i,k-1}$

Rest of bottom points (i=0, k between 0 and L):

Use Neumann to replace the ghost point $u_{i-1,k}$ with $u_{i+1,k}$

Top left corner (i=R, k=0)

$u_{i,k} = B$

Top points (i=R, k between 0 and L):

$\frac{u_{i-1,k} - u_{i+1,k}}{\Delta r + d} = -\frac{u_{i,k}}{d}$ $\rightarrow$ $u_{i,k} = \frac{d}{d+\Delta r} u_{i-1,k}$

Right side points (i between 0 and R, k=L):

$\frac{u_{i,k+1} - u_{i,k-1}}{\Delta z + d} = -\frac{u_{i,k}}{d}$ $\rightarrow$ $u_{i,k} = \frac{d}{d+\Delta z} u_{i,k-1}$

And I replace everything in my Laplacian so that it only depends on $u_{i-1,k}$, $u_{i+1,k}$ and $u_{i,k-1}$

And I replace everything in my Laplacian so that it depends on u(i,k-1), $u_{i,k+1}$ and $u_{i-1,k}$

Top right corner (i=R, k=L):

This one has me stuck. Basically, I have two "concurrent" conditions applying there.

$\frac{u_{i-1,k} - u_{i+1,k}}{\Delta r + d} = -\frac{u_{i,k}}{d}$ $\rightarrow$ $u_{i,k} = \frac{d}{d+\Delta r} u_{i-1,k}$

$\frac{u_{i,k+1} - u_{i,k-1}}{\Delta z + d} = -\frac{u_{i,k}}{d}$ $\rightarrow$ $u_{i,k} = \frac{d}{d+\Delta z} u_{i,k-1}$

And I do not know how to apply them.

Any ideas? Or does something look off somehow?

Hopefully this is the right Stack Exchange place, if not please direct me to the correct one!

$\endgroup$
5
  • $\begingroup$ Welcome to SciComp.SE, I think that this is the right site for your question. I think that your question is really close to an old one answered by WolfgangBangerth, but I don't see it right now. $\endgroup$
    – nicoguaro
    Dec 31, 2019 at 19:11
  • $\begingroup$ Regarding your post, would you mind using MathJax for equations? $\endgroup$
    – nicoguaro
    Dec 31, 2019 at 19:11
  • $\begingroup$ I'll improve the way the math is displayed asap. Couldn't figure it out easily while posting, sorry about that $\endgroup$ Dec 31, 2019 at 19:34
  • $\begingroup$ @nicoguaro Is this the answer you're referring to? scicomp.stackexchange.com/a/23676/33528 What I'm seeing from looking around is that "it doesn't matter, just pick one direction" should work, though I'm not certain at all. $\endgroup$ Jan 1, 2020 at 18:23
  • $\begingroup$ Yes, that is the one. $\endgroup$
    – nicoguaro
    Jan 1, 2020 at 18:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.