Cells loop
Hi,
I need to perform a "special" loop over all the cells. For a given cell i need to know the value of a variable in the nearby cells (those cells that share one face with the given cell) and then replace the value of this variable in the given cell with an average through the cell and the neighboring cells. The best thing would be to have a 9x9 stencil around each cell, but to start is enough for me to have the value of this variable in the NORTH, SOUTH, EAST, WEST cells. For example if the variable is the pressure P, i would like to do something like this: p[cellI] = (p[cellI]+ p[cell_NORD] + p[cell_SOUTH] +p[cell_EAST] + p[cell_WEST])/5 Now, i know that using mesh.cellCell()[cellI] you can access the neighboring cells of the given cellI. Unfortunatly my c++ skills are not so good, so i do not know how to loop over the indices of neighbors. Any help is appreciated! and also if someone have an idea to incude easily also the diagonal cells in this sum (NE, SE, SW, NW). (of course using an orthogonal mesh) Thanks andrea |
Hi Andrea
Try e.g. this, it has, however, not been test compiled. Code:
Niels |
Hi Niels,
thanks for reply. I did it a little different but it works. something like that: Code:
scalarField pAdj(mesh.nCells(),scalar(0)); Thanks again andrea |
Hi,
is there a way, given a certain list, to add other labels? Something like addToList. If yes, what is the syntax? (Suppose you have two lists, and wanting to put the values of the list 2 into the list 1). Thanks andrea |
Values at east and north cell
Hi FOAMERS
Is there any way (any function) to get the value of a parameter at the east and north of a specific cell? |
mahdiiowa, did you ever figure out how to reference specific cells?
|
All times are GMT -4. The time now is 07:56. |