# error in calculating grad field. possible bug?

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

 October 2, 2011, 04:26 #2 Senior Member   Nima Samkhaniani Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,166 Blog Entries: 1 Rep Power: 15 im not sure but i think when you fixed zeroGradient at patch it will consider the patch normal gradient zero so the gradient of the patch in the other directions are non- zero

 October 2, 2011, 13:21 #3 Senior Member   Join Date: Nov 2009 Location: Michigan Posts: 135 Rep Power: 8 what about patches with a fixedValue bc? Why does the gradient come out as zero?

 October 2, 2011, 14:06 #4 Senior Member   Nima Samkhaniani Join Date: Sep 2009 Location: Tehran, Iran Posts: 1,166 Blog Entries: 1 Rep Power: 15 as you said the value on patch is fixed so tangential gradients should be zero but normal gradient can be non zero!

 October 3, 2011, 06:06 #5 Senior Member   Hrvoje Jasak Join Date: Mar 2009 Location: London, England Posts: 1,769 Rep Power: 21 Not sure what your problem is: the gradient of T at a boundary will be a vector and only a surface-normal component of this gradient is specified in the T boundary conditions. The other two components will be non-zero, due to eg. tangential component of the gradient and picked up from the cell inside of the domain next to the patch. The code that does this is: template void gaussGrad::correctBoundaryConditions ( const GeometricField& vsf, GeometricField < typename outerProduct::type, fvPatchField, volMesh >& gGrad ) { forAll(vsf.boundaryField(), patchi) { if (!vsf.boundaryField()[patchi].coupled()) { vectorField n = vsf.mesh().Sf().boundaryField()[patchi] /vsf.mesh().magSf().boundaryField()[patchi]; gGrad.boundaryField()[patchi] += n * ( vsf.boundaryField()[patchi].snGrad() - (n & gGrad.boundaryField()[patchi]) ); } } } All is fine, Hrv __________________ Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post alessio.nz OpenFOAM 6 December 23, 2015 15:27 Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20 matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 07:51 cricke OpenFOAM Running, Solving & CFD 0 December 10, 2007 08:17 liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 18:27

All times are GMT -4. The time now is 18:29.