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

using vectorTools

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 17, 2015, 11:52
Default using vectorTools
  #1
New Member
 
F.F.
Join Date: Dec 2011
Posts: 14
Rep Power: 7
Fabf is on a distinguished road
Hi,

little newbie-issue regarding use of class Foam::vectorTools. I want to calculate the angle in deg between two vectors (g and U). Therefore I write

Code:
const volScalarField Phib_=vectorTools::degAngleBetween(g_, U_);
To call this function the beginning of the file reads

Code:
#include "vectorTools.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
using namespace Foam::vectorTools;
    
namespace Foam
{
namespace compressible
{
namespace RASModels
{
There Error says the function can not be called. So I am quit sure I do not use the right namespace. But how should I call the function?

Note: Application is a turbulence model for buoyancy.
Fabf is offline   Reply With Quote

Old   March 17, 2015, 12:05
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,438
Rep Power: 25
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

There is no definition of the function for volVectorFields, it is defined only for Vectors.

So either you implement the function for volVectorFields, or iterate over U_ and call the function with Vector arguments.
alexeym is offline   Reply With Quote

Old   March 17, 2015, 12:53
Default
  #3
New Member
 
F.F.
Join Date: Dec 2011
Posts: 14
Rep Power: 7
Fabf is on a distinguished road
Oh Okay. So I tried


Code:
const volScalarField DegAngle = acos (g.component(0) * U.component(0) + g.component(1) * U.component(1) + g.component(2) * U.component(2) )/ (normalize(g_)*normalize(U_)))*180.0 / PI;
I can not call the normalize function. Also with quaternion::normalize it did not work. Any idea?
Fabf is offline   Reply With Quote

Old   March 17, 2015, 13:03
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,438
Rep Power: 25
alexeym will become famous soon enoughalexeym will become famous soon enough
Hi,

And why do you thinks normalize is defined for vector fields (there is documentation, you know)?

What you are trying to do?
alexeym is offline   Reply With Quote

Old   March 17, 2015, 13:08
Default
  #5
New Member
 
F.F.
Join Date: Dec 2011
Posts: 14
Rep Power: 7
Fabf is on a distinguished road
... I messed it up. Time to go home for today..

Wanted magnitude. So now I calculate the angle between two vectors with
Code:
const volScalarField DegAngle = (acos((g_.component(0) * U_.component(0) + g_.component(1) * U_.component(1) + g_.component(2) * U_.component(2)) / (mag(g_)*mag(U_))))*180.0 / constant::mathematical::pi;
and this works.

Sorry.
Fabf 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



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