CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM (
-   -   Operate on volScalarField as whole v access elements (

adhiraj January 14, 2012 09:19

Operate on volScalarField as whole v access elements
Hi all,
If I have a volScalarField that is formed by doing something (adding, dividing, taking square roots etc) of some other volScalarFields, should I do those operations element by element, or on the whole thing at one go?
I have the element by element version implemented, and was wondering if I could get a speedup by using the other option.

owayz November 29, 2012 09:25

Hi adhiraj,
Yes you can do it as a whole. For some example you can see the yPlus utility and check how yPlus is being calculated.
Can you kindly share how did you do all the operations element wise.

adhiraj November 29, 2012 13:35

Yes, I found that I can operate on the whole thing at once, too.
I did that and I don't know if it is more efficient or anything--the code is certainly cleaner and easier to read.
I did something like

or similar.

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