CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM

Taking the absolute value of a volVectorField or a volTensorField

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   September 16, 2005, 05:24
Default Hi, I wish to compute the abs
  #1
Member
 
Marco Kupiainen
Join Date: Mar 2009
Posts: 31
Rep Power: 8
kupiainen is on a distinguished road
Hi,
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
kupiainen is offline   Reply With Quote

Old   September 16, 2005, 07:22
Default Should be: volVectorField g
  #2
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,758
Rep Power: 21
hjasak will become famous soon enough
Should 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
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the Diagonal elements of volTensorField su_junwei OpenFOAM Running, Solving & CFD 0 December 1, 2008 11:29
VolVectorField of complex numbers quba OpenFOAM 0 December 17, 2007 09:06
VolTensorField Gamma in laplacian haibinli OpenFOAM Running, Solving & CFD 0 May 17, 2007 01:45
To get the magnitude of volVectorField susana OpenFOAM Pre-Processing 5 November 16, 2006 07:53
VolTensorField evgenii OpenFOAM Pre-Processing 1 February 22, 2006 06:50


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