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

How to calculate the gradient along the boundaries from a known volScalarFiled?

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

Like Tree2Likes
  • 2 Post By cliffoi

Reply
 
LinkBack Thread Tools Display Modes
Old   July 18, 2011, 11:48
Default How to calculate the gradient along the boundaries from a known volScalarFiled?
  #1
New Member
 
Join Date: Jul 2011
Posts: 2
Rep Power: 0
shddx1 is on a distinguished road
Hi,

I first obtained a volScalarField in a calculation domain, and then I want to calculate the gradient along the domain boundaries.

Does anyone know how to obtain the gradient along domain boundaries from a known volScalarField?

Thank you very much!
shddx1 is offline   Reply With Quote

Old   October 27, 2011, 09:54
Default
  #2
Member
 
bojiezhang
Join Date: Jan 2010
Posts: 64
Rep Power: 7
bojiezhang is on a distinguished road
hi shddx1:
I have the same problem with you ! I define a volScalrField first and the value is fixed for all the cells, but I want to caculate the gradient. Do you solve the problem, can you tell me? Thank you!
bojiezhang is offline   Reply With Quote

Old   October 28, 2011, 18:04
Default
  #3
Member
 
Ivor Clifford
Join Date: Mar 2009
Location: Switzerland
Posts: 91
Rep Power: 8
cliffoi is on a distinguished road
You can obtain the surface normal gradient at each boundary using snGrad function.

p.boundaryField()[patchI].snGrad();

This will give you the surface normal gradient without any non-orthogonality or skewness corrections. If you need these corrections, use fvc::snGrad().

surfaceScalarField snGradP = fvc::snGrad(p);
Then access the value at the boundary with snGradP.boundaryField()[patchI].

If you are looking for a full gradient vector at the boundary, this is a little tricker. Here you will have to interpolate the field gradient (fvc::grad(p)) to the faces and then replace the surface normal component of this with the value coming from fvc::snGrad(p).

Hope this helps
Ivor
cliffoi is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF-How to calculate gradient of a scalar Tony Tonton Fluent UDF and Scheme Programming 16 February 9, 2015 02:12
how to calculate the temperature gradient of wall houbaolin FLUENT 0 July 28, 2008 02:51
Calculate normal gradient Sunil FLUENT 0 April 30, 2008 16:44
calculate the temperature gradient on a profile arther FLUENT 0 April 19, 2006 23:12
how to calculate the gradient of volume fraction hxhua FLUENT 0 July 1, 2005 08:43


All times are GMT -4. The time now is 23:38.