CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM

interpolate field to sampledPlane

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

Like Tree2Likes
  • 2 Post By nikwin

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 2, 2009, 10:29
Default interpolate field to sampledPlane
  #1
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Dear All,

I'm trying to average a field, e.g. p, over a plane as,

plane xPl(x, n);
sampledPlane smpPl("smpPl", mesh, xPl,word::null,false);
const scalarField pPl(smpPl.sample(p));
av_p = smpPl.average(pPl);

The problem is that the sampled value is directly taken as the cell center value and not interpolated from cell centers to the plane. Any ideas how to interpolate onto the plane and then average?

I've tried .interpolate(pInt) instead of .sample(p) where pInt is constructed as a volPointInterpolation class. It compiles but gives me the following error when trying to average,

size mismatch: field (384) != surface (377)

Thanks
/NW
nikwin is offline   Reply With Quote

Old   December 9, 2009, 11:35
Default
  #2
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
From the forum I've understood that there is a bug in OF-1.5 which should be fixed for OF-1.6. So, I've installed version 1.6 and now trying my code but without success when trying to compile.

I'm getting an error when trying
#include "sampledPlane.H" as follows,

OpenFOAM-1.6/src/sampling/lnInclude/cuttingPlane.H:49:27: error: MeshedSurface.H: No such file or directory
In file included from /scratch/nwinkler/OpenFOAM/OpenFOAM-1.6/src/sampling/lnInclude/sampledPlane.H:40,

And I can not understand from doxygen which other classes to use to obtain a sampledPlane with interpolated values, anyone?

All the Best
/NW
nikwin is offline   Reply With Quote

Old   December 10, 2009, 07:49
Default
  #3
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Ok. I got it to compile after including surfMesh as an EXE_INC = \ in /Make/options and constructing a sampledPlane with 4 arguments, not 5 as in OF-1.5.

The problem is now that my sampledPlane is empty, which it's not in OF-1.5. Is there possibly a bug in the new version of sampledPlane, with a simple fix?

/NW
nikwin is offline   Reply With Quote

Old   January 5, 2010, 09:34
Default
  #4
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Any new ideas of how to obtain averaged data over a plane from interpolated values, OF-1.5 or 1.6?

Thanks
/NW
nikwin is offline   Reply With Quote

Old   January 29, 2010, 06:18
Default
  #5
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
Thanks to Mattijs I got it to work!

Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
interpolationCellPoint<scalar> pInterp(p);

plane pl(point(0.0,2.5e-4,0.0), vector(0,1,0));
sampledPlane spl("planeY", mesh, pl);
spl.update();

scalarField pInterpPl(spl.interpolate(pInterp));

SubList<face> splFaces(spl.faces(), spl.faces().size());
primitivePatch primitivePtch(splFaces, spl.points());

primitivePatchInterpolation primPatchInterp(primitivePtch);

scalarField pInterpPlFaces(primPatchInterp.pointToFaceInterpol ate(pInterpPl));
Info << "spl.average(pInterpPlFaces) = " << spl.average(pInterpPlFaces) << endl;
mm.abdollahzadeh and Pagoda like this.
nikwin is offline   Reply With Quote

Old   October 13, 2011, 08:31
Default
  #6
New Member
 
Ali Q Raeini
Join Date: Feb 2010
Posts: 24
Rep Power: 16
aliqasemi is on a distinguished road
Quote:
Originally Posted by nikwin View Post
Thanks to Mattijs I got it to work!

Info<< "Reading field p\n" << endl;
volScalarField p
(
IOobject
(
"p",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
interpolationCellPoint<scalar> pInterp(p);

plane pl(point(0.0,2.5e-4,0.0), vector(0,1,0));
sampledPlane spl("planeY", mesh, pl);
spl.update();

scalarField pInterpPl(spl.interpolate(pInterp));

SubList<face> splFaces(spl.faces(), spl.faces().size());
primitivePatch primitivePtch(splFaces, spl.points());

primitivePatchInterpolation primPatchInterp(primitivePtch);

scalarField pInterpPlFaces(primPatchInterp.pointToFaceInterpol ate(pInterpPl));
Info << "spl.average(pInterpPlFaces) = " << spl.average(pInterpPlFaces) << endl;
This method didn't work for me, complaining that the field pInterpPl does not correspond to the patch primitivePtch at run time. Apparently after the patch is created the points are reordered/reassigned and are not identical to the points provided in the patch constructor. Any workarounds?
aliqasemi is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Phase Field modeling in OpenFOAM adona058 OpenFOAM Running, Solving & CFD 35 November 16, 2021 00:16
Adding Temperature field to IcoFoam yapalparvi OpenFOAM Programming & Development 14 November 19, 2015 04:57
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 06:20
Porosity field in Fluent wojciech FLUENT 1 September 20, 2010 11:19
Problem with rhoSimpleFoam matteo_gautero OpenFOAM Running, Solving & CFD 0 February 28, 2008 06:51


All times are GMT -4. The time now is 20:16.