CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Programming & Development

What is cmptMag?

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 5 Post By ngj

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 16, 2013, 17:42
Default What is cmptMag?
  #1
Senior Member
 
Canakkale Dardanelspor
Join Date: Aug 2012
Posts: 135
Rep Power: 13
HakikiCanakkaleli is on a distinguished road
Hi

Could anyone please tell me what cmptMag function is for?

Code:
Form Foam::cmptMag	(	const VectorSpace< Form, Cmpt, nCmpt > & 	vs	) inline
It seems that it returns the absolute value of the argument. Assuming this is true, what is its difference from abs()?

Many thanks in advance.
HakikiCanakkaleli is offline   Reply With Quote

Old   December 18, 2013, 07:23
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hallo,

First of all, abs is not being used as a function in the FOAM namespace, as it is called mag instead.

Consider a vector v(-1, -1, -1), the mag(v) is the square root of 3, i.e. the two norm. If you instead do vector w = Foam::cmptMag(v) you will get w = (1, 1, 1).

Kind regards,

Niels
__________________
Please note that I do not use the Friend-feature, so do not be offended, if I do not accept a request.
ngj is offline   Reply With Quote

Old   March 19, 2019, 08:50
Default abs not working for me
  #3
New Member
 
Join Date: Apr 2018
Posts: 17
Rep Power: 8
dela is on a distinguished road
Quote:
Originally Posted by ngj View Post
Hallo,

First of all, abs is not being used as a function in the FOAM namespace, as it is called mag instead.

Consider a vector v(-1, -1, -1), the mag(v) is the square root of 3, i.e. the two norm. If you instead do vector w = Foam::cmptMag(v) you will get w = (1, 1, 1).

Kind regards,

Niels
I know this is an old thread but I am doing a similar thing without success. I am trying to find the absolute value of velocity U. I have tried all I can to no avail. Please help
I did "volVectorField U1CmptMag = Foam::cmptMag(U1);"

thank you
dela is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On



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