CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

surface gradient

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree1Likes
  • 1 Post By Martin80

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 14, 2011, 11:11
Default surface gradient
  #1
Member
 
Join Date: Aug 2010
Posts: 31
Rep Power: 15
Martin80 is on a distinguished road
Hi,

in the openFoam programmer's guide on P-40 there is an explanation for the
surface normal gradient:

surfaceScalarField gradnq=fvc::snGrad(q);

which gives (grad(q))_f*n_f.

I want to calculate only grad(q)_f , it should be something like:

surfaceVectorField gradq=????????(q);

Maybe someone has an useful idea,
thanks, M.
Martin80 is offline   Reply With Quote

Old   March 8, 2011, 09:25
Default
  #2
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 18
gwierink is on a distinguished road
Hi Martin,

Isn't that simply fvc::grad()? Or am I missing the point of your question?
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   March 9, 2011, 11:53
Default
  #3
Member
 
Join Date: Aug 2010
Posts: 31
Rep Power: 15
Martin80 is on a distinguished road
Hi Gijs,


Thanks for your reply, fvc::grad is using the Gauss integral theory to calculate the gradient at the cell center – so it's not what I was seeking for.



As I can see now, the gradient at the face center will not be calculated within the snGrad calculation. The surface normal Gradient (for an orthogonal mesh) will be calculated directly by

g[faceI]=(v[neighbour[faceI]]-v[owner[faceI]])/d


(This can be seen in src/finiteVolume/finiteVolume/snGradSchemes/snGradScheme.C on line 142.)


The calculation applies to internal Faces.


For fully understanding I would like to know how the snGrad is calculated on boundary Faces.


Maybe you (or someone else) can tell me where I can find the calculation for snGrad on the boundary faces.


Thanks,
Martin.
Martin80 is offline   Reply With Quote

Old   March 9, 2011, 12:21
Default
  #4
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 18
gwierink is on a distinguished road
Hi Martin,

Right, I see . I am not entirely sure, but from the discussion here I gather that $WM_PROJECT_DIR/applications/utilities/postProcessing/wall/wallGradU.C contains some hints. In particular, this might be interesting:

Code:
forAll(wallGradU.boundaryField(), patchi)
{
    wallGradU.boundaryField()[patchi] =
      - U.boundaryField()[patchi].snGrad();
}
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   March 10, 2011, 05:07
Default
  #5
Member
 
Join Date: Aug 2010
Posts: 31
Rep Power: 15
Martin80 is on a distinguished road
Hi Gijs,

I think in your example snGrad() will also be used as a member function of the boundary field (patchfield). I think I have found the calculation in

src/finiteVolume/fields/fvPatchFields/fvPatchField/fvPatchField.C in line 180:


// Return gradient at boundary
template<class Type>
Foam::tmp<Foam::Field<Type> > Foam::fvPatchField<Type>::snGrad() const
{
return (*this - patchInternalField())*patch_.deltaCoeffs();
}


Now I will try to find out if there is a non-orthogonal mesh correction of the surface normal gradient on the boundary.

M.
fumiya likes this.
Martin80 is offline   Reply With Quote

Old   March 17, 2011, 11:16
Default
  #6
ala
New Member
 
Alicja M
Join Date: Mar 2009
Location: Erlangen, DE
Posts: 26
Rep Power: 17
ala is on a distinguished road
Hi, I have a simple question.

I have volScalarField \alpha.
I calculate fvc::grad(alpha1).
This mean, im simplest case, i do:
(1)
fvc::grad(alpha) = \frac{1}{V} \sum_f \alpha_f \cdot S_f
or (2)
fvc::grad(alpha) =  \sum_f \alpha_f \cdot S_f ?
(1) or (2) is the right one?

And
fvc::snGrad = \frac{\alpha_{neigh} - \alpha_{own}}{|d|}
this is centr. diff. approx., or?

Greetings, Alicja
ala is offline   Reply With Quote

Old   March 17, 2011, 15:13
Default
  #7
Senior Member
 
Gijsbert Wierink
Join Date: Mar 2009
Posts: 383
Rep Power: 18
gwierink is on a distinguished road
Hi Alicja,

Quote:
fvc::grad(alpha) ?
This is, in most cases, the right one (although it's sum_f Sf alpha_f. I say "most cases", because it can change a bit with the difference scheme used. What fvc::grad in the case above does, is use the values for alpha interpolated on the faces (alpha_f), multiply it with the relevant face vector (which is proportional to the face area), and then sum all of that up over the selection of faces (usually all, but not necessarily).

Quote:
fvc::snGrad
this is centr. diff. approx., or?
In a way yes, but normally used for boundary faces, snGrad is the surface normal gradient. Another important difference is that grad() is a vector field, while sngrad() is not ...
__________________
Regards, Gijs
gwierink is offline   Reply With Quote

Old   March 17, 2011, 16:21
Default
  #8
ala
New Member
 
Alicja M
Join Date: Mar 2009
Location: Erlangen, DE
Posts: 26
Rep Power: 17
ala is on a distinguished road
Hi Gijs!

Thx for your Answer!

I have a further question about fvc:: (alpha). I use the most simple discretisation scheme, 'Gauss linear'.

I took a look at interFoam solver.
I want to know, how is the curvature calculated.
I have this to discretise:
\int_V \nabla \alpha \sigma \kappa   \: dV = \int_V \nabla \alpha \sigma \nabla \cdot n \: dV
See interfaceProperties.C
To calculate \kappa:
firstly i calculate fvc::grad(alpha).
So i 've run debug modus and i was in this class,
gaussGrad.C
firstly at line 134 and then at line 55. You see at the line 113 multiplikation with \frac{1}{V}.
Which term is the correct one, (1) or (2)?

(1)
fvc::grad(alpha)
or (2)
fvc::grad(alpha) ?

I think the term (1) is the correct one. Perhaps later when i build the matrix or equation system i do multiply with V.
See fvMatrix.C at the line 1448. But i'm not sure.

Greetings, Alicja

Last edited by ala; March 18, 2011 at 03:26.
ala is offline   Reply With Quote

Old   May 27, 2013, 07:30
Default
  #9
Member
 
Emad Tandis
Join Date: Sep 2010
Posts: 77
Rep Power: 15
EmadTandis is on a distinguished road
Quote:
Originally Posted by ala View Post
Hi Gijs!

Thx for your Answer!

I have a further question about fvc:: (alpha). I use the most simple discretisation scheme, 'Gauss linear'.

I took a look at interFoam solver.
I want to know, how is the curvature calculated.
I have this to discretise:
\int_V \nabla \alpha \sigma \kappa \: dV = \int_V \nabla \alpha \sigma \nabla \cdot n \: dV
See interfaceProperties.C
To calculate \kappa:
firstly i calculate fvc::grad(alpha).
So i 've run debug modus and i was in this class,
gaussGrad.C
firstly at line 134 and then at line 55. You see at the line 113 multiplikation with \frac{1}{V}.
Which term is the correct one, (1) or (2)?

(1)
fvc::grad(alpha)
or (2)
fvc::grad(alpha) ?

I think the term (1) is the correct one. Perhaps later when i build the matrix or equation system i do multiply with V.
See fvMatrix.C at the line 1448. But i'm not sure.

Greetings, Alicja
Hello
the first one is true but not with dot product(.) . because it's for divergence not grad.
EmadTandis is offline   Reply With Quote

Old   August 30, 2013, 15:57
Default snGradient
  #10
Member
 
Join Date: Oct 2012
Posts: 47
Rep Power: 13
sh.d is on a distinguished road
hi
i need the formulation of crrected snGradien scheme for laplacian(Q)
can help me?
sh.d is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Gmsh] Error : Self intersecting surface mesh, computing intersections & Error : Impossible velan OpenFOAM Meshing & Mesh Conversion 3 October 22, 2015 12:05
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 03:09
[Gmsh] boundaries with gmshToFoam‏ ouafa OpenFOAM Meshing & Mesh Conversion 7 May 21, 2010 13:43
surface tension gradient on a free surface Abrem FLUENT 1 April 30, 2006 04:41
CFX4.3 -build analysis form Chie Min CFX 5 July 13, 2001 00:19


All times are GMT -4. The time now is 13:54.