CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Programming & Development (
-   -   simple doubt grad function (

mmkr825 September 14, 2012 12:53

simple doubt grad function
Hi Foamers,
my doubt is very simple. I am writing derived boundary condition for a scalar T. My project is related to flow of suspensions through channels. In my case for a scalar T at upper and bottom boundaries i need to apply zero surface normal flux boundary condition. When i applied this zero flux in my governing equation i got an expression for the dT/dy.

For scalarField T the governing equation is
fvm::div(phi, T)
+ fvm::laplacian(0.62*1.82*pow(a,2)*g*pow(T,2)*pow(0 .68-T,-1), T)
+ fvm::laplacian(0.41*pow(a,2)*g*T, T)
- fvc::laplacian(0.41*pow(a,2)*T*T, g)

where g=local Strain rate

After applying zero surface normal flux, i got
dT/dy=pow(T, 2)*gm/(T*mag(symm(fvc::grad(U))*(1+T*2.75*pow(0.68-T, -1)))

To write this i have chosen tractionDisplacement boundary in solidDisplacementFoam. Based on that i written my code. Every thing is ok but in my derived boundary condition i used grad(U). When i compiled this derived BC the error like "no matching function for call to ‘grad(const Foam::vectorField&)" is coming.

Which header file i need to include please suggest me. Or any other easy way to write this BC.


kmooney September 28, 2012 14:25

I believe the fvc::grad operator only works on geometricFields. If you're operating on a boundary you might have to manually calculate your zeroGradient condition which would be a function of the patch internal values and the deltaX from the patch face to the internal cell center. I'll see if I can dig up another BC that does something similar. Posting your BC code where the compiler threw the bug would also be more helpful than posting the code that compiled ok.

kmooney September 28, 2012 14:28

Wouldn't the 'slip' boundary condition give you the zero normal flux condition you're looking for?

If you you don't need to write any new code.

mmkr825 September 28, 2012 14:39

Hi Kmoony,
Thanks for reply. I want to know what slip BC is able to do. Please suggest me any tutorial useful to understand the slip BC.


kmooney September 28, 2012 14:49

I believe, physically, slip means there is no shear stress at the wall. It creates a no penentration, zero-tangential gradient condition. Just google around, you'll be able to figure it out in detail.

mmkr825 September 28, 2012 15:04

Hi kmoony,
Thanks for your advice i will go according to your suggestion.

I have one more doubt, not relevant to the present title of the thread. I am doing my PG project on flow of suspended particles through wavy channel (sinusoidal wave), of infinite length. First i created one full cycle, i need to extend this geometry (one full cycle) into infinite number depending on length of the channel. I studied periodic BC is suitable for it. Please give me some information about periodic BC, what actually it do.


kmooney September 28, 2012 15:14

I'm not very experienced with period BC's in foam. Sorry I can't help.

All times are GMT -4. The time now is 14:51.