CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Near Wall Parallel Derivatives at First Grid Node (http://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())
{
volVectorField gradp(fvc::grad(p));

volScalarField gradpx
(
IOobject
(
"gradPx",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
gradp.component(vector::X)
);

volScalarField gradpy
(
IOobject
(
"gradpy",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
gradp.component(vector::Y)
);

volScalarField gradpz
(
IOobject
(
"gradpz",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
gradp.component(vector::Z)
);
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:


vectorField Uadj= U.patchInternalField() - U
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)
volVectorField gradP(fvc::grad(P));

const fvPatchList& patches = mesh.boundary();
forAll(patches,patchi)
{
const fvPatch& currPatch = patches[patchi];
if(currPatch.name()=="nameOfTheDesiredPatch")
{
Info<<gradP.boundaryField()[patchi].patchInternalField()<<endl;
}
}

you can use OFstream class of OF to write to a file instead of Info. Please let me know if this works

In my previous post I had explained way to write the components in three different files. I would like to know whether you are getting any difference between:(only on boundaries)

gradP written in the single file (it will be a vector with three components)
gradPx, gradPy and gradPz written in individual files
For some cases I am simulating, I observed difference in these values except for cases where the mesh is orthogonal everywhere.


All times are GMT -4. The time now is 22:08.