CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   How to access gradient near the boundary for Navier slip bc? (https://www.cfd-online.com/Forums/openfoam-programming-development/95779-how-access-gradient-near-boundary-navier-slip-bc.html)

 Marc10 January 2, 2012 13:11

How to access gradient near the boundary for Navier slip bc?

Hi!

I am trying to implement a boundary condition based on the Navier slip model, where the velocity at the wall is a function of the velocity gradient at the wall:

U = ls * du/dn

For this, I have to access du/dn (the velocity gradient normal to the wall) in the field. Is there a function for this similar to this->patchInternalField()? As a starting point I use the partialSlip bc from OpenFoam.

Code:

```template<class Type> void Foam::partialSlipFvPatchField<Type>::evaluate (     const Pstream::commsTypes ) {     if (!this->updated())     {         this->updateCoeffs();     }     tmp<vectorField> nHat = this->patch().nf();     Field<Type>::operator=     (         (1.0 - valueFraction_)       *transform(I - sqr(nHat), this->patchInternalField())     );     transformFvPatchField<Type>::evaluate(); }```
Here I guess I just have to replace the operator= argument with the above equation. But how can I access or calculate the gradient at or in the cell next to the wall?

I appreciate any help! Thank you!

marc

 charlotte October 31, 2012 16:15

Hi Marc,

Sorry for giving an answer so late, but I guess other people may be interested by the answer. The easiest to create this BC is to copy the one in:
\$FOAM_SOLVERS/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip

and replace the "valueFraction_" by "1/(1+slipLength_*this->patch().deltaCoeffs())"

To get a better understanding, the distance from the boundary face center to near wall center is D=1/deltaCoeffs. nHat is the normal vector at the boundary.

You want Uwall=l dU/dn = l (Uc-Uwall)/D
So Uwall = (l/D)/(1+l/D)U = (1-1/(1+l/D))U
To make sure that youget only a tangential component, you multiply by transform(I-nHat*nHat)

Note that if you surface is curved, you may need some additional correction and you can check the Maxwell BC in the same folder to get an idea how to do it.

 Sherlock_1812 July 4, 2013 08:12

Quote:
 Originally Posted by charlotte (Post 389564) Hi Marc, Sorry for giving an answer so late, but I guess other people may be interested by the answer. The easiest to create this BC is to copy the one in: \$FOAM_SOLVERS/compressible/rhoCentralFoam/BCs/mixedFixedValueSlip and replace the "valueFraction_" by "1/(1+slipLength_*this->patch().deltaCoeffs())" To get a better understanding, the distance from the boundary face center to near wall center is D=1/deltaCoeffs. nHat is the normal vector at the boundary. You want Uwall=l dU/dn = l (Uc-Uwall)/D So Uwall = (l/D)/(1+l/D)U = (1-1/(1+l/D))U To make sure that youget only a tangential component, you multiply by transform(I-nHat*nHat) Note that if you surface is curved, you may need some additional correction and you can check the Maxwell BC in the same folder to get an idea how to do it.
Hi ,

I am asking this question in this thread because I'm dealing with a curved boundary patch and also require U on that curved patch to be given as a BC.

I've had a look at the maxwell BC, but my C++ isn't that good. So can i confirm if transform(I-nHat*nHat) will give the value of U along the curved patch?

Also with respect to this solver, why are the variables thermalCreep and curvature of the 'true/false' type? and what is accomodation factor?

Kindly excuse the barrage of questions as I'm new to OpenFOAM and C++,

 charlotte August 16, 2013 21:24

Hi Srivaths,

unfortunately, in my case I didn't need for a curved boundary face, so I never looked into the details. Like you, I'm not an expert in C++, but fortunately, Openfoam is written such that you don't really need to be an expert. So I was able to write a slip BC without learning the whole C++ language :p

Anyway, if you look at the maxwell BC, you can see that they make reference to a curvature class and I'm guessing you need to code sth similar to there. Since I was considering flat wall, I never try to understand that part... :o

I don't know much about the Maxwell BC: I think it's a slip BC with a temperature jump at the boundary based on Boltzmann's equation. I googled it and there is plenty of literature about it (http://www4.ncsu.edu/~ces/pdfversions/246.pdf for instance).

Sorry for not being more help, but I pretty much shared all my knowledge in my previous post ...

Charlotte

Quote:
 Originally Posted by Sherlock_1812 (Post 437781) Hi , I am asking this question in this thread because I'm dealing with a curved boundary patch and also require U on that curved patch to be given as a BC. I've had a look at the maxwell BC, but my C++ isn't that good. So can i confirm if transform(I-nHat*nHat) will give the value of U along the curved patch? Also with respect to this solver, why are the variables thermalCreep and curvature of the 'true/false' type? and what is accomodation factor? Kindly excuse the barrage of questions as I'm new to OpenFOAM and C++, Thanks in advance

 Sherlock_1812 February 13, 2014 08:51

Charlotte,

I'm getting back to this thread really late, because I was trying to work around a tangential gradient of velocity (for a curved surface).

My question is this: What happens when I set refValue and valueFraction = 0 in mixedFixedValueSlip? I'm guessing that it will
- return only the tangential gradient in the 'Return gradient at boundary part'
- might also return a value of velocity for the patch in 'Evaluate the field on the patch' section (evaluated from the (1 - valueFraction...) part)

How do I just get the former? a mixedFixedGradientSlip may be?

 All times are GMT -4. The time now is 17:07.