How to calculate the gradient in the boundary cells

 Register Blogs Members List Search Today's Posts Mark Forums Read

 August 15, 2011, 17:04 How to calculate the gradient in the boundary cells #1 Member   Yong Wang Join Date: Apr 2009 Posts: 34 Rep Power: 9 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

 August 18, 2011, 14:56 #2 Senior Member   Steven van Haren Join Date: Aug 2010 Location: The Netherlands Posts: 149 Rep Power: 8 Maybe take a look at the wallGradU utility? Is that helpful for you?

August 18, 2011, 16:50
#3
Member

Yong Wang
Join Date: Apr 2009
Posts: 34
Rep Power: 9
Quote:
 Originally Posted by stevenvanharen Maybe take a look at the wallGradU utility? Is that helpful for you?

Thanks.

Based on the Programmers Guide, snGrad still calculate all cells in the computational region. Right?

 August 19, 2011, 01:55 #4 Senior Member   Steven van Haren Join Date: Aug 2010 Location: The Netherlands Posts: 149 Rep Power: 8 because u use: U.boundaryField()[patchi] only the faces on this patch are calculated

 August 19, 2011, 04:27 #5 Senior Member   Eugene de Villiers Join Date: Mar 2009 Posts: 725 Rep Power: 13 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.

August 19, 2011, 04:56
#6
Senior Member

Steven van Haren
Join Date: Aug 2010
Location: The Netherlands
Posts: 149
Rep Power: 8
Quote:
 Originally Posted by eugene 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.
Ah ok, I missed the fact that cell-center gradients were required.

August 19, 2011, 14:27
#7
Member

Yong Wang
Join Date: Apr 2009
Posts: 34
Rep Power: 9
Quote:
 Originally Posted by eugene 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.
Yes, I have read the code of gaussGrad and found there was the very thing I wanted. Thanks.

August 19, 2011, 14:30
#8
Member

Yong Wang
Join Date: Apr 2009
Posts: 34
Rep Power: 9
Quote:
 Originally Posted by stevenvanharen Ah ok, I missed the fact that cell-center gradients were required.
It's ok. I noticed it. Thanks very much .