9 point laplacian
I'm trying to solve a PDE (ex: dT/dt=Lapl(T)) and I would try to access the 8 points close to a cell "i" in order to calculate a 9 point laplacian.
The idea it's to solve it in a esplicit way using a forAll loop on the internal mesh points of the domain.
The mesh is regular and the domain is a square (nothing complicated).
Can you please tell me, once that I start the farAll loop how to find the neighboors of (exemple) alpha[i]? and how they are ordered (N,S,E,W,NE,NW,SW and SE)?
Hello and good morning to you
1. You can get all of the neighbours including the cell, cellI, itself by using the following:
Thank you very much i try it (infact i solve a more complicated equation than the heat transfer one but I needed the 9 points stencil so your answer is really what I need)
Good. BTW: Note that the outlined code also works in 3D, which would give you the entire 27 cell stencil.
I typically use the std::sort and std::unique to truncate the list of cell labels.
|All times are GMT -4. The time now is 15:03.|