|
[Sponsors] |
error in calculating grad field. possible bug? |
![]() |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
![]() |
![]() |
#1 |
Senior Member
Join Date: Nov 2009
Location: Michigan
Posts: 135
Rep Power: 17 ![]() |
In the file write.H in laplacianFoam solver, I simply add a line
gradT.write(); recompile and run the tutorial for laplacianFoam. (the flange tutorial) In file gradT: zeroGradient for all patches! In files gradTx,gradTy,gradTz: non-zero values for gradTx, gradTy and gradTz on patches where zeroGradient is specified! and non zero for other patches too, though the gradT file shows zeroGradient. Whats wrong and with whom? (me or OF) |
|
![]() |
![]() |
![]() |
![]() |
#2 |
Senior Member
Nima Samkhaniani
Join Date: Sep 2009
Location: Tehran, Iran
Posts: 1,268
Blog Entries: 1
Rep Power: 25 ![]() |
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
|
|
![]() |
![]() |
![]() |
![]() |
#3 |
Senior Member
Join Date: Nov 2009
Location: Michigan
Posts: 135
Rep Power: 17 ![]() |
what about patches with a fixedValue bc? Why does the gradient come out as zero?
|
|
![]() |
![]() |
![]() |
![]() |
#5 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,907
Rep Power: 34 ![]() |
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<class Type> void gaussGrad<Type>::correctBoundaryConditions ( const GeometricField<Type, fvPatchField, volMesh>& vsf, GeometricField < typename outerProduct<vector, Type>::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 | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
problems after decomposing for running | alessio.nz | OpenFOAM | 7 | March 5, 2021 05:49 |
Moving mesh | Niklas Wikstrom (Wikstrom) | OpenFOAM Running, Solving & CFD | 122 | June 15, 2014 07:20 |
Problem with rhoSimpleFoam | matteo_gautero | OpenFOAM Running, Solving & CFD | 0 | February 28, 2008 07:51 |
Problems calculating field gh with interFoam | cricke | OpenFOAM Running, Solving & CFD | 0 | December 10, 2007 08:17 |
How to update polyPatchbs localPoints | liu | OpenFOAM Running, Solving & CFD | 6 | December 30, 2005 18:27 |