CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Post-Processing

snGradCorrection

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

Like Tree2Likes
  • 1 Post By bigphil
  • 1 Post By bigphil

Reply
 
LinkBack Thread Tools Display Modes
Old   September 17, 2012, 08:32
Default snGradCorrection
  #1
New Member
 
Eskil Aursand
Join Date: Sep 2012
Posts: 7
Rep Power: 4
eskila is on a distinguished road
Hello,
I am trying to modify a utility to get the normal gradient of a scalar field at boundaries. I was getting some strange results from using fvc::snGrad, and i read in the Programmers Guide that one might benefit from using fvc::snGradCorrection if the mesh is not orthogonal (which is the case here). I tried this, but when compiling the utility I get the error:

error: ‘snGradCorrection’ is not a member of ‘Foam::fvc’

I'm a beginner with OpenFOAM, and haven't delved too deeply into its code yet, so I'm a little lost on how to find out what I'm doing wrong. Any help will be appreciated.
eskila is offline   Reply With Quote

Old   September 17, 2012, 09:30
Default
  #2
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 570
Rep Power: 19
bigphil will become famous soon enoughbigphil will become famous soon enough
Hi,

there is no fvc::snGradCorrection, but you can use fvc::snGrad and then set snGradSchemes to corrected in your fvSchemes. This will calculate the surface normal gradient with non-orthogonal correction.

As regards snGrad at the boundaries, by default OpenFOAM sets non-orthogonal correction to zero at the boundary (see Jasak Thesis) so the accuracy is only good on orthogonal grids. If you do need correction at the boundaries, you need to implement custom boundary conditions with non-orthogonal correction.

Philip
fumiya likes this.
bigphil is offline   Reply With Quote

Old   September 17, 2012, 10:33
Default
  #3
New Member
 
Eskil Aursand
Join Date: Sep 2012
Posts: 7
Rep Power: 4
eskila is on a distinguished road
Let me see if i've understood you:
fvc::snGrad may be corrected for non-orthogonal meshes, but it will be no use for me if i'm only interested in the boundaries?

snGradSchemes in the system/fvSchemes of my case was already set to "corrected". Is this what is used by my custom utility?
eskila is offline   Reply With Quote

Old   September 17, 2012, 11:07
Default
  #4
Senior Member
 
bigphil's Avatar
 
Philip Cardiff
Join Date: Mar 2009
Location: Dublin,Ireland
Posts: 570
Rep Power: 19
bigphil will become famous soon enoughbigphil will become famous soon enough
Quote:
Originally Posted by eskila View Post
snGradSchemes in the system/fvSchemes of my case was already set to "corrected". Is this what is used by my custom utility?
When you use fvc::snGrad it checks your fvScheme for what method to use. If it finds corrected then it will use non-orthogonal correction.

Quote:
Originally Posted by eskila View Post
Let me see if i've understood you:
fvc::snGrad may be corrected for non-orthogonal meshes, but it will be no use for me if i'm only interested in the boundaries?
Each boundary patch can implement its own method to calculate the boundary snGrad so fvc::snGrad uses the values calculated by the boundary fvPatchField. So if you mesh contains fixedValue patches, then snGrad is given by (code taken from fvPatchField.C):
Code:
00176 // Return gradient at boundary
00177 template<class Type>
00178 Foam::tmp<Foam::Field<Type> > Foam::fvPatchField<Type>::snGrad() const
00179 {
00180     return (*this - patchInternalField())*patch_.deltaCoeffs();
00181 }
As can be seen, this assumes that the cell is orthogonal to the boundary.

Therefore if you are interested in orthogonal correction at the boundaries, you could implement a custom boundary condition where you define the snGrad as (taken from fixedDisplacementFvPatchVectorField.C found here):
Code:
 115     const fvPatchField<tensor>& gradField =
 116         patch().lookupPatchField<volTensorField, tensor>
 117         (
 118             "grad(" +fieldName_ + ")"
 119         );
 120 
 121     vectorField n = this->patch().nf();
 122     vectorField delta = this->patch().delta();
 123 
 124     //- correction vector
 125     vectorField k = delta - n*(n&delta);
 126 
 127     return 
 128     (
 129         *this 
 130       - (patchInternalField() + (k&gradField.patchInternalField()))
 131       )*this->patch().deltaCoeffs();
However, I believe non-orthogonal correction has been set to zero for a reason (for fluids anyway, solids need this correction).

Philip
fumiya likes this.
bigphil is offline   Reply With Quote

Old   August 30, 2013, 06:52
Default corrected snGradient
  #5
Member
 
Join Date: Oct 2012
Posts: 47
Rep Power: 4
sh.d is on a distinguished road
Hi
i want to discrete momentom Eqn and i need formulation of corrected sngradient in OF.
please help me
sh.d is offline   Reply With Quote

Reply

Tags
gradients, openfoam 2.1.x, post-processing

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
snGradCorrection doubtsincfd OpenFOAM 0 September 30, 2011 23:55


All times are GMT -4. The time now is 11:43.