- **OpenFOAM**
(*https://www.cfd-online.com/Forums/openfoam/*)

- - **Taking the absolute value of a volVectorField or a volTensorField**
(*https://www.cfd-online.com/Forums/openfoam/61021-taking-absolute-value-volvectorfield-voltensorfield.html*)

Hi,
I wish to compute the absHi,
I wish to compute the absolute value of a volVectorField gp componentwise. I have tried to loop over all cells: forAll(centres, celli) { if ( gp[celli].x() < 0.0 ) { gp[celli].x() = -gp[celli].x(); } if ( gp[celli].y() < 0.0 ) { gp[celli].y() = -gp[celli].y(); } if ( gp[celli].z() < 0.0 ) { gp[celli].z() = -gp[celli].z(); } } but when I take min(gp) it shows negative values. How does this work? What should I do instead? best regards |

Should be:
volVectorField gShould be:
volVectorField gpCmptMag = cmptMag(gp); but it is not instantiated because it's not really appropriate for geometric fields. How about: vectorField gpCmptMag = cmptMag(gp.internalField()); This gives you the internal part of the field. Hrv |

All times are GMT -4. The time now is 04:10. |