devitocodes / notebooks

BSD 3-Clause "New" or "Revised" License
1 stars 3 forks source link

Boundaries #6

Open mloubout opened 8 years ago

mloubout commented 8 years ago

@navjotk. @mlange05 , @ggorman Gerard told me you wanted some insight on the boundaries for higher order stencils. The way it is currently implemented in the notebook is the easiest possible (even if slightly more expensive than complex ones). The idea is, if you have a stencil of order n (n+1 ponts) you add n/2 ghost nodes after your boundary that you never update, it is just there to let you compute your stencil at the limit of the domain. This is why for my second order implementation, the loops in space go from 1 to nx-2, nodes 0 and nx-1 are just there to make the computation easy.

I hope it helped, let me know if you find it a bit obscure

navjotk commented 8 years ago

Hi @mloubout , could you provide an example for how the code would change for a higher order stencil? This would help clear some of our doubts regarding the boundary conditions and make the code more general.

mloubout commented 8 years ago

Hi @navjotk

For a stencil of ordre 4 ([x-2h x-h x x+h x+2h]) for i in range(1,nx-1)
......

becomes

for i in range(2,nx-2)
......

and same for y

PS : you can change xmin = -1000 - 12*hstep if you want to keep the number of points in the absorbing layer the same