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

using vectorTools

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 17, 2015, 10:52
Default using vectorTools
  #1
New Member
 
F.F.
Join Date: Dec 2011
Posts: 14
Rep Power: 14
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, 11:05
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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, 11:53
Default
  #3
New Member
 
F.F.
Join Date: Dec 2011
Posts: 14
Rep Power: 14
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, 12:03
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
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, 12:08
Default
  #5
New Member
 
F.F.
Join Date: Dec 2011
Posts: 14
Rep Power: 14
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


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 16:18.