CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Running, Solving & CFD (https://www.cfd-online.com/Forums/openfoam-solving/)
-   -   Manipulation of cellvalue of a geometricField (https://www.cfd-online.com/Forums/openfoam-solving/58521-manipulation-cellvalue-geometricfield.html)

ivan_cozza September 25, 2008 09:39

Hi to everybody! I'm trying t
 
Hi to everybody!
I'm trying to write a postprocessing utility that modify cell-by-cell the values of a volVectorField, like this:

forAll(ut,celli)
{
...operations...

ut[celli] += 2.0*ampU*cos(xdotk + phi)*sig;
}

where ampU, xdotk and phi are dimensionedScalar and sig a dimensionedVector.
When I compile it, wmake told me that it's wrong.
Maybe it's because ut[celli] is not the correct way to access to the cell-value of a volVectorField?
Please, help me!!!

gschaider September 25, 2008 13:20

I don't think that wmake had a
 
I don't think that wmake had a problem. It probably was the compiler. But that's nitpicking.

The problem is that the result on the right hand side is a dimensionedVector while the cell value is a plain vector. So you'll have to use the value() method to get the vector out of the dimensionedVector

Bernhard

ivan_cozza September 25, 2008 13:58

Thanks Bernhard, now it works.
 
Thanks Bernhard, now it works. I'm new in OF and C++, so I'm still having difficulties in thinking in terms of classes and methods, my Fortran background makes me think in terms of vectors and functions!
I really need a paradigm-shift!!!


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