CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Meshing & Mesh Conversion (
-   -   Computing a cellcentered scalarField from a vertexcentered scalarField (

mbeaudoin August 30, 2005 09:30

Hello, I am in the process

I am in the process on finalizing a CGNS to OpenFoam converter.

So far, I was able to convert structured and unstructured meshes, including the Boundary Conditions, from the CGNS file format to OpenFoam.

I am also able to convert a CGNS vertex-centered scalar field as an OpenFoam pointScalarField, save it on disk and visualize the scalar field using paraFoam. So far so good, OpenFoam is really a great package, very well written.

Now, I need to compute a cell-centered scalarField (volScalarField) from the vertex-centered scalar field stored in a pointScalarField, and quite frankly, I am stuck...

Basically, I need to interpolate the pointScalarField at the cell centres, but I am not really sure which OpenFoam API is better suited for doing this.

A quick pointer would really be appreciated.



hjasak August 30, 2005 10:02

Hmm, we haven't got one of tho
Hmm, we haven't got one of those at the moment. I suspect what you are after is something like the volPointInterpolation class:


but going in the oppisite direction. If you feel adventurous, you could have a go at writing one yourself and I'm prepared to give you a hand.

Incidentally, is there a good way of doing point-to-cell interpolation or do you just want inverse distance weighting - there may be issues with conservation.


mbeaudoin August 30, 2005 13:50

Thanks Hrvoje, Right now,
Thanks Hrvoje,

Right now, I would settle for a simple inverse distance weighting interpolation.

Since this feature is not available right now, I will give it a shot myself, and try to come up with something similar to volPointInterpolation.

I will keep you posted.

As a matter of fact, it would be very easy to use the VTK interpolation algorithms for such a task... I have already written some interpolation stuff using the VTK API... Pretty straightforward once you are familiar with the VTK data model..

Have you ever considered using the VTK libraries with OpenFoam for something other than visualization?

Thanks again for your help!


hjasak August 31, 2005 11:29

Hi Martin, I have done the
Hi Martin,

I have done the pointVolInterpolation class you wanted - please send me an E-mail and I'll pass it over. It's quite fun actually, much easier than the other way around because you don't need to worry about the boundary corrections :-)


hani September 6, 2005 06:08

Martin Beaudoin, Would it be p
Martin Beaudoin, Would it be possible to take part of your CGNStoFoam converter? I have a grid with boundary conditions in CGNS format and would just like to convert it to OpenFoam. I don't need any more functionality right now.

deepblue17 January 16, 2006 11:55

Hallo Martin, could you mak
Hallo Martin,

could you make the cgnsToFoam utility available for the public?


deinstein May 29, 2006 17:12

Hello Martin, I am just get
Hello Martin,

I am just getting started with OpenFOAM and wondered what progress you made with your CGNS--> FOAM converter and whether it was publically available?


mbeaudoin June 5, 2006 12:43

Hello Daniel, I am currentl
Hello Daniel,

I am currently in the process of testing a new C++ wrapper over the latest CGNS standard MLL library. That wrapper was developed by a colleague of mine.

I still need to integrate this new code to the two converters we have developed, cgnsToFOAM and foamToCGNS.

I have the go ahead to release the code publicly for both converters, so it is basically just a matter of integrating the new code, testing and cleaning up the source code a little bit (lots of french comments.. ) , and of course, writing a quick doc.

As soon as I can release the source code, I will probably publish it somewhere on the Wiki, and post a message here.

So watch this space...


anne June 14, 2006 11:02

Hello Hrvoje, I can see tha
Hello Hrvoje,

I can see that you wrote a pointVolInterpolation
class tool.
I would be interested to get it, if possible, so that I could read a turbulent
point field issued from
another code and run it with OpenFoam.

Please, let me know if it is possible,

Thanks You,


hjasak June 14, 2006 12:12

Just E-mailed: enjoy. Hrv
Just E-mailed: enjoy.


vivekcfd February 22, 2007 08:43

Hi in the meantime, did you
in the meantime, did you guys relesed cgnstofoam code? I am quite interested in a copy of this conversion tool.



All times are GMT -4. The time now is 03:29.