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

Gradient Calculation on cell vertices

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 1, 2018, 10:05
Default Gradient Calculation on cell vertices
  #1
Member
 
Join Date: Mar 2015
Posts: 35
Rep Power: 11
K.C. is on a distinguished road
Hello OpenFoam-community,

I have found many publications using the least-square-method to calculate the gradient of a scalarField at cell vertices (and not at cell centers).
Now I need to do this as well for my code, but can not find the Header-File or the function to do this. The User-Manual and the Programmer-Manual mention gradient at cell centers only.

Is there an already written Header-file in OpenFoam to calculate gradient at cell vertices?

Thanks a lot,
K.C.
K.C. is offline   Reply With Quote

Old   October 2, 2018, 07:22
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Dear K.C.,

do you mean cell vertices or face centers? Out of the box I just have the following in mind:

- calculate the gradient at face centers
- interpolate the gradients at face centers to cell vertices
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 2, 2018, 08:29
Default
  #3
Member
 
Join Date: Mar 2015
Posts: 35
Rep Power: 11
K.C. is on a distinguished road
Hello Tobi,


thanks for your reply.


I mean the cell vertices (e.g. 8 for a cube). A cell consists of faces. A face consists of edges and the edge connects two vertices/points. So I want to calculate a pointVectorField and not a surfaceVectorField.


Furthermore I dont know how you would calculate the vector gradient on faces (except by interpolation). The surface normal Gradient can't be interpolated into a vector on vertices in my opinion. Can you explain a bit more detailed?


Greets,
K.C.
K.C. is offline   Reply With Quote

Old   October 2, 2018, 09:06
Default
  #4
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Quote:
Originally Posted by K.C. View Post
A cell consists of faces. A face consists of edges and the edge connects two vertices/points.
Thanks for the clarification. I did not know that.

[quote]
... calculate the vector gradient on faces (except by interpolation).
[/code]

Out of the box, I donīt think that this is possible. However, you could check the least square schemes available in OpenFOAM to get a better feeling how they do it here (also available for point and edge limiting stuff or something like that). Maybe this is what you are searching for.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   October 4, 2018, 11:28
Default
  #5
Member
 
Join Date: Mar 2015
Posts: 35
Rep Power: 11
K.C. is on a distinguished road
Quote:
- calculate the gradient at face centers
Hello Tobi,
it was your idea of calculating gradient on faces. I hoped you had an idea of calculating gradient in vector form on faces. But maybe I missunderstood you.
Quote:
.... least square schemes available in OpenFOAM to get a better feeling how they do it here (also available for point and edge limiting stuff or something like that)....
What do you mean with "available"? Do you mean that least square method is already implemented for edges and points? I can not find it in my OF-version, which indeed is very old.
K.C. is offline   Reply With Quote

Old   October 4, 2018, 14:01
Default
  #6
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Tussenhausen
Posts: 2,708
Blog Entries: 6
Rep Power: 51
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Quote:
Originally Posted by K.C. View Post
Hello Tobi,
What do you mean with "available"? Do you mean that least square method is already implemented for edges and points? I can not find it in my OF-version, which indeed is very old.

Just see:
Code:
Unknown grad scheme linear

Valid grad schemes are :

11
(
Gauss
cellLimited
cellLimited<Venkatakrishnan>
cellLimited<cubic>
cellMDLimited
edgeCellsLeastSquares
faceLimited
faceMDLimited
fourth
leastSquares
pointCellsLeastSquares
)

Quote:
Description
Gradient calculated using weighted least-squares on an arbitrary stencil.
The stencil type is provided via a template argument and any cell-based
stencil is supported:

\table
Stencil | Connections | Scheme name
centredCFCCellToCellStencil | cell-face-cell | Not Instantiated
centredCPCCellToCellStencil | cell-point-cell | pointCellsLeastSquares
centredCECCellToCellStencil | cell-edge-cell | edgeCellsLeastSquares
\endtable

The first of these is not instantiated by default as the standard
leastSquaresGrad is equivalent and more efficient.

The gradient calculation I meant was gradient calculation at cell center, interpolate to face center and interpolate to edges. However, this is not what you were searching for.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Reply


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
Periodic flow using Cyclic - comparison with Fluent nusivares OpenFOAM Running, Solving & CFD 30 December 12, 2017 05:35
[General] Wrong Calculation of Cell Volume olli191 ParaView 1 August 3, 2016 04:09
Difference between cell gradient and cell derivative macros mohammadx90 Fluent UDF and Scheme Programming 2 February 7, 2015 19:40
Journal file error magicalmarshmallow FLUENT 3 April 4, 2014 12:25
Prediction of gradient at the cell center for cell-centered finite volume method openfoammaofnepo Main CFD Forum 4 March 23, 2014 15:07


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