CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Programming & Development (https://www.cfd-online.com/Forums/openfoam-programming-development/)
-   -   Accessing surface normal gradient (https://www.cfd-online.com/Forums/openfoam-programming-development/127396-accessing-surface-normal-gradient.html)

Jakob1 December 10, 2013 08:54

Accessing surface normal gradient
 
Hello,
I am trying to access the surface normal gradient of a certain variable (i.e. a) (unstructured grid). fvc::snGrad(a) only gives me the absolute value, right? (surfaceScalarField). How do I get the surfaceVectorField version of that?

And on top of that: How does this (hopefully existing) quantity behave on boundary surfaces of a cell? I imagine it being defined as (a(V1)-a(V2))/d. Now if a has a Diriclet condition on the boundary, how would that work? (Can't define a Neumann bc, the change of gradient on the boundary is crucial for my function).

Would be great if someone could give me a hint here :) Thanks in advance.

akidess December 10, 2013 09:02

A surface*Normal*Gradient always only has a magnitude, because the direction is given by the face normal. snGrad(a) * mesh.Sf() I guess will give you the gradient vector.

Jakob1 December 10, 2013 11:11

mesh.Sf() also includes the face area rght? So I guess mesh.Sf()/mesh.magSf() should do it then? Thanks by the way!

Still though, how does it behave at boundaries? Would it use the value on the boundary instead of the neighboring volume?

akidess December 10, 2013 11:23

Right. About the boundary question - why would snGrad neglect your boundary conditions, no matter what you select?

fluidflowsteel January 6, 2017 06:22

Hi ,

I have a variable p for which I want to calculate the gradient normal to the surface in both x and y directions. Can anyone help me ?


With regards

PositronCascade January 9, 2017 08:22

I suggest you write your own tool by modifying gradU utility of OpenFOAM or you can use swak4foam, I guess.


Quote:

Originally Posted by fluidflowsteel (Post 632274)
Hi ,

I have a variable p for which I want to calculate the gradient normal to the surface in both x and y directions. Can anyone help me ?


With regards



All times are GMT -4. The time now is 21:56.