how to interpolate grad(p)
Hi, everyone,
I am new to openfoam. I wanna interpolate the grad(p) but I don't know how to do this. I tried to use fvc::interpolate(fvc::grad(p)), but it does not work. Could anyone do me a favor to teach me how to do this? Thanks! PS:I also tried to build a volScalarField and interpolate it, but it did not work. I tried this: volScalarField surfP ( IOobject ( "surfP", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE ), mesh, dimensionedScalar("zero",dimensionSet(0,1,-2,0,0,0,0),0.0) ); surfP.internalField()=fvc::grad(p); I suppose there is something wrong with the surfP.internalField()=fvc::grad(p), could anyone tell me how to correct it? Thanks! |
Quote:
|
Also, it would help a lot if you gave some compilation errors. "It does not work" does not help us a lot. Are you sure you want your variable surfP to be of type volScalarField? As I understand, you want a vector on the faces, so then it'd be surfaceVectorField... Anyhow, the snGrad(p) is probably already what you need.
|
Quote:
What I need is the interpolated pressure gradient. I have no idea whether the snGrad(p) is the interpolated value. Lun |
Quote:
I found what was wrong. now I use: volScalarField gradp=mag(fvc::grad(p)); now no error occurs during the compiling. Thanks again! Lun |
Quote:
|
Quote:
Thanks for your reply! |
All times are GMT -4. The time now is 18:05. |