|
[Sponsors] |
August 31, 2012, 21:59 |
how to interpolate grad(p)
|
#1 |
New Member
Lun Yu
Join Date: Aug 2012
Posts: 8
Rep Power: 14 |
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! Last edited by victorconan; August 31, 2012 at 22:29. |
|
September 2, 2012, 18:04 |
|
#2 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
You want to have the value of the gradient on the cell faces, right? Have you considered doing this directly with snGrad(p)? (Mind that this is only the gradient in the direction of the surface normal. But that is the only one you're going to get anyway)
|
|
September 3, 2012, 02:56 |
|
#3 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
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.
|
|
September 3, 2012, 06:44 |
|
#4 | |
New Member
Lun Yu
Join Date: Aug 2012
Posts: 8
Rep Power: 14 |
Quote:
What I need is the interpolated pressure gradient. I have no idea whether the snGrad(p) is the interpolated value. Lun |
||
September 3, 2012, 06:46 |
|
#5 | |
New Member
Lun Yu
Join Date: Aug 2012
Posts: 8
Rep Power: 14 |
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 |
||
September 3, 2012, 09:14 |
|
#6 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
It's better. It is the grad on the face between to cell in the direction of the normal of that face. Basically this value was used to calculate the grad in the cell. Have a look in the programmers guide. Unless you want to have the numerical inaccuracies of the roundtrip (1. to cell 2. interpolate back to face)
|
|
September 3, 2012, 09:24 |
|
#7 | |
New Member
Lun Yu
Join Date: Aug 2012
Posts: 8
Rep Power: 14 |
Quote:
Thanks for your reply! |
||
Tags |
interpolate |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Interpolate in some points | ivan_cozza | OpenFOAM Post-Processing | 2 | April 22, 2009 09:58 |
Interpolate a boundary condition | Xabi | OpenFOAM Pre-Processing | 0 | April 9, 2009 05:23 |
overflow when interpolate initial result | richard | CFX | 1 | June 11, 2008 08:36 |
GradP in channeloodles | nikos_fb16 | OpenFOAM Running, Solving & CFD | 1 | September 4, 2007 11:52 |
Interpolate | Stex | CFX | 2 | June 30, 2003 09:04 |