CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM (https://www.cfd-online.com/Forums/openfoam/)
-   -   Near Wall Parallel Derivatives at First Grid Node (https://www.cfd-online.com/Forums/openfoam/95678-near-wall-parallel-derivatives-first-grid-node.html)

 deji December 28, 2011 13:53

Near Wall Parallel Derivatives at First Grid Node

Good day to all here at the forum. I am trying to compute the near wall parallel derivatives for a wall function being implemented for my research. I know that SnGrad() gives the wall normal derivative--> dU/dn_wall, so how would I compute dP/dx at the first grid node? :confused:

Cheers,
Deji

 doubtsincfd December 30, 2011 03:20

have a look for alphaDynamicContact angle. Its somewhere in interfaceProperties.C or some file I cant remember. I has the code for calculating velocity vector parallel to wall. The logic behind the code is:
parallel vector = total vector-normal vector
normal vector you can get from snGrad etc.
Let me know if you dont find the code

 deji December 30, 2011 10:14

I will check it, thanks.

Cheers,
Deji

 deji January 3, 2012 10:49

I am still looking for the code and yet to find it. I saw some things on the web regarding the multi-phase solver, but nothing yet on wall parallel derivatives. Can you point me in the right direction.

Cheers,
Deji

 doubtsincfd January 3, 2012 13:41

look at this:
/opt/openfoam210/src/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/dynamicAlphaContactAngle

and

http://www.cfd-online.com/Forums/ope...tml#post337703

 deji January 3, 2012 16:20

Thanks much for the feedback Omkar. I did take a look at the code and it's not quite what I am hoping to implement. I am in the process of implementing an LES wall function that requires dP/dx and dU/dx, where x is the streamwise direction.

Is there anyone on the forum that might have an idea on this?

 doubtsincfd January 3, 2012 16:30

if you need gradients, then you can implement following in your code:
if (runTime.outputTime())
{

(
IOobject
(
runTime.timeName(),
mesh,
IOobject::AUTO_WRITE
),
);

(
IOobject
(
runTime.timeName(),
mesh,
IOobject::AUTO_WRITE
),
);

(
IOobject
(
runTime.timeName(),
mesh,
IOobject::AUTO_WRITE
),
);
runTime.write();

}
In the same way you can write
reference for the code is "write.H" file in laplacianFoam tutorial. you will have to add these lines in your solver. I suggest you look through laplacianFoam solver code to understand better.

 doubtsincfd January 3, 2012 16:32

sample command will then write the derivatives on wall. But for calculating at first grid point, you will have to access data at the cell center adjacent to wall. If this is what you want then I can show you how to calculate gradients at first grid point near the wall.

 deji January 3, 2012 16:48

Thanks very much. Actually, yes I would like to calculate dP/dX and dU/dX at the first grid node off the wall. I should be able to access the adjacent wall cell using patchInternalField. So can you give me an example? Thanks.

 doubtsincfd January 3, 2012 16:58

Exactly. We will have to calculate gradient throughout the field and then use patchInternalfield(). I will try that and get back to you in a day.

 deji January 3, 2012 17:17

Question, and I think you asked a similar one in the thread you posted:

To get velocity adjacent to the wall:

U is normally taken to be the PatchField volVectorField. So why is U subtracted from U.patchInternalField()?

 doubtsincfd January 3, 2012 17:30

my understanding of the code is that Uadj will give velocity relative to the wall.
It is a little odd since velocity on the wall is zero so U will be zero.
The code for dynamic contact angle might be generalized for moving wall cases in which velocity of adjacent cell center relative to the wall is what is needed in the formula for dynamic contact angle.

This is my understanding of the code. The code developer did not reply further to my post else I was going to raise the same question.

 deji January 4, 2012 10:19

Thank you very much Omkar, you gave me really good feedbacks. Thanks again.

Cheers,
Deji

 doubtsincfd January 5, 2012 14:35

you can write in the following way (tho not the cleanest way)

const fvPatchList& patches = mesh.boundary();
forAll(patches,patchi)
{
const fvPatch& currPatch = patches[patchi];
if(currPatch.name()=="nameOfTheDesiredPatch")
{