How to calculate the gradient in the boundary cells
Hi, everyone.
I want to calculate the gradients of a volScalarField parameter F in the boundary cells. Now, I am using fvc::grad(F,gradF) to calculate the gradients in all cells, and then look up the values in the boundary cells. Is there any other more efficient method? I just want to reduce the time used for calculating. Thanks. Yong |
Maybe take a look at the wallGradU utility?
Is that helpful for you? |
Quote:
Thanks. wallGradU is using wallGradU.boundaryField()[patchi] =-U.boundaryField()[patchi].snGrad();. Based on the Programmers Guide, snGrad still calculate all cells in the computational region. Right? I am also reading the code about grad and check if it's helpful. |
because u use:
U.boundaryField()[patchi] only the faces on this patch are calculated |
snGrad in this context only calculates the wall normal gradient. It does so in a completely local and efficient way though. If you want to calculate the cell centred gradient for a subset of cells, I suggest you look at the code in finiteVolume/lnInclude/gaussGrad.C. This will show you the steps to calculate a gradient on a cell-by-cell basis.
|
Quote:
|
Quote:
|
Quote:
|
Hi, everyone. As I want to calculate the gradient at the cells close to the boundaries. I checked the code in the gaussGrad.C:
PHP Code:
However, in the first loop, all internal faces are calculated. So, I changed the code as: PHP Code:
Thanks in advance. Yong |
All times are GMT -4. The time now is 23:14. |