|
[Sponsors] |
December 4, 2017, 10:51 |
convert pointScalarField to volScalarField
|
#1 |
New Member
|
Hi All,
I'm new to OpenFOAM and I'm trying to convert a pointScalarField to a volScalarField. How can I do? Thanks a lot for your help. Sara |
|
December 4, 2017, 11:21 |
|
#2 |
Senior Member
|
Hi,
You can iterate over volScalarField and use interpolatePointToCell function ( https://cpp.openfoam.org/v5/namespac...ec0038ef8cdd46). |
|
December 4, 2017, 12:00 |
|
#3 |
New Member
|
Thanks for your answer alexeym!
Sara |
|
December 6, 2017, 10:58 |
|
#4 |
New Member
|
Can I also ask you for a description of a volScalarField 's "structure" ?
About the interpolateToPointCell function, I found it requests the following input : geometric field and a label index, isn't it? To convert the pointScalarField in a volScalarField I'm going to do a "for loop" on the label index....could it be correct? Anyway I can't understand if I'm wrong because I can't find the structure of a volScalarField in the user guide... Thanks Last edited by saralen; December 7, 2017 at 09:33. |
|
December 6, 2017, 13:39 |
|
#5 |
Senior Member
|
Yes, you can (and you actually did ).
If we oversimplify, volScalarField is a list of scalar values one for each cell of a mesh, pointScalarField is a list of scalar values, one for each point of the mesh (and both are specialisation of GeometricField type, see volFieldsFwd.H and pointFields.H). So, yes, you iterate over volume field with for loop or forAll macro, and pass label index and point field into interpolatePointToCell function. Function looks up faces of the cell, then for each face it looks up vertices of the face, takes values at these points and returns average (see https://cpp.openfoam.org/v5/interpol...8C_source.html). You take returned value and assign it to cell with above mentioned index. Yet, depending on the nature of your data, maybe you could select another weighting strategy (rather than number of vertices of a given cell). |
|
Tags |
pointscalarfield, volvectorfield |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Error in compiling new drag model | k.farnagh | OpenFOAM Programming & Development | 13 | May 21, 2016 04:08 |
execFlowFunctionObjects - unknown field problem | Toorop | OpenFOAM Post-Processing | 16 | March 14, 2016 04:25 |
Convert volScalarField to dimensionedScalar to be defined in transportProperties | sabago | OpenFOAM Programming & Development | 8 | June 1, 2015 13:11 |
writing execFlowFunctionObjects | immortality | OpenFOAM Post-Processing | 30 | September 15, 2013 07:16 |
mapping between pointScalarField and volScalarField | liu | OpenFOAM Running, Solving & CFD | 3 | October 22, 2010 11:06 |