# How to extract the normal pressure gradient from the momentum equation

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

 September 18, 2017, 11:52 How to extract the normal pressure gradient from the momentum equation #1 New Member   Join Date: Aug 2016 Posts: 19 Rep Power: 9 I would like to evaluate the normal pressure gradient to a patch by moving all terms (except for the pressure gradient term) to the right side, followed by a dot product with the normal to a patch: [pressure gradient term] . n = ([unsteady term] + [convection term] + [diffusion term]) . n I can get the convection and the diffusion terms using UEqn.H(). How do I then proceed to perform the dot product between UEqn.H() and the normal to a patch? Zhiheng Wang likes this.

September 27, 2017, 02:57
#2
Member

Zhiheng Wang
Join Date: Mar 2016
Posts: 72
Rep Power: 10
Quote:
 Originally Posted by mtgoncalves I would like to evaluate the normal pressure gradient to a patch by moving all terms (except for the pressure gradient term) to the right side, followed by a dot product with the normal to a patch: [pressure gradient term] . n = ([unsteady term] + [convection term] + [diffusion term]) . n I can get the convection and the diffusion terms using UEqn.H(). How do I then proceed to perform the dot product between UEqn.H() and the normal to a patch?
why dont you use scalarField& Pbf = p.boundaryField[patchID].snGrad();
or scalarField& Pbf = p.boundaryField[patchID].Grad().component(normalDirec tion); where normaldirection is x=0, y=1 and z=2

 September 27, 2017, 12:13 #3 New Member   Join Date: Aug 2016 Posts: 19 Rep Power: 9 Maybe my understanding is lacking so please correct me if I'm wrong. But I think the following: My reason is that I am not sure whether computing dp/dn from gradients of p is identical to computing dp/dn as function of U. U and p are not fully coupled due to the segregated solution approach of SIMPLE/PISO/PIMPLE (especially if you use loose tolerances and/or a low number of correctors). So my conjecture is that the difference between p.boundaryField[patchID].snGrad() and -[fvm::ddt(U) + fvm::div(phi, U) - fvm::laplacian(nu, U)] . n is larger than simply round-off errors. Zhiheng Wang likes this.

 September 27, 2017, 16:56 #4 Member   Zhiheng Wang Join Date: Mar 2016 Posts: 72 Rep Power: 10 What solver you are using if you are using some case built for buoyancy and gravity along with heat transfer visit this page http://caefn.com/openfoam/solvers-bu...nesqpimplefoam Else interpolation of U corrects P as both are define at cell center in openFOAM like co-located variables. Coupling is all about to replace one in terms of other. I guess if you will extract dp/dn for incompresible or low mach number flows with out heat transfer and elevation there wont be any physical reason to change gradient of pressure along the flow accept velocity, but with heat transfer or buoyant flows density and elevation are considerable factors too. SO you better name the solver and case you are using that will be helpful to answer that dp/dn extracts thermodynamic pressure or buoyant pressure. Correct me if I am wrong Regards

 September 29, 2017, 10:50 #5 New Member   Join Date: Aug 2016 Posts: 19 Rep Power: 9 I am using pimpleFoam without any source terms (no gravity, buoyancy, etc.) Anyway, I am almost there. I have the approximate code I need. Compiling, unfortunately, yields an error: error: no match for ‘operator&’ (operand types are ‘Foam::tmp, Foam::fvsPatchField, Foam::surfaceMesh> >’ and ‘const Foam::Field >’) I am trying to do this: linearInterpolate(-(fvc::ddt(U) + fvc::div(phi, U) - fvc::laplacian(nu, U))) & mesh.boundaryMesh()[boundary_label("numericalBoundary")].faceNormals() So, in essence, I am trying to interpolate -(ddt(U) + div(phi, U) - laplacian(nu, U)) onto a patch which I named "numericalBoundary", and following this up by a dot product with the face normals of the patch. How should I correctly implement this interpolation followed by a dot product?

 Tags momentum equation, normals, patch, pressure gradient