- **OpenFOAM Running, Solving & CFD**
(*http://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Fluid wall shear stress**
(*http://www.cfd-online.com/Forums/openfoam-solving/60647-fluid-wall-shear-stress.html*)

I am trying to calculate the wI am trying to calculate the wall shear stress within a fluid in a cylindrical pipe. I have defined WSS as a volVectorField in a createFields.H file, so that I can look at the wall shear stress in dxFoam. The code I have been using for the wall shear stress is:
label patchA = mesh.boundaryMesh().findPatchID("wall"); fixedValueFvPatchVectorField& wallshearstress = refCast(WSS.boundaryField()[patchA]); forAll(wallshearstress, patchFaceA) { volTensorField gradU = fvc::grad(U); volTensorField shear = mu*(gradU + gradU.T()); shear[patchFaceA].component(tensor::XX) = 0; shear[patchFaceA].component(tensor::YY) = 0; shear[patchFaceA].component(tensor::ZZ) = 0; wallshearstress[patchFaceA].component(vector::X) = shear[patchFaceA].component(tensor::XY) + shear[patchFaceA].component(tensor::XZ)); wallshearstress[patchFaceA].component(vector::Y) = shear[patchFaceA].component(tensor::YX) + shear[patchFaceA].component(tensor::YZ) wallshearstress[patchFaceA].component(vector::Z) = shear[patchFaceA].component(tensor::ZX) + shear[patchFaceA].component(tensor::ZY); } So, I have been able to get the stress tensor and set the 3 normal components to zero. I have then added the 2 X components to get the overall X component of the shear stress, added the 2 Y components etc. However, looking at my results in dxFoam, the WSS vectors are not aligned correctly along the wall of the cylinder. Do I have to project my stress vector onto my surface and does anyone have any idea how to do this? Has anyone written a code to calculate the wall shear stress of a fluid already? Thanks, Sinead |

You might find the applicatio You might find the application
applications/utilities/postProcessing/wall/wallShearStress useful. Simply replace R in the expressions with your shear field and it should do what you want. |

hi henry,
what do you mean by "R" in the expressions where? thanks |

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