|
[Sponsors] |
March 17, 2015, 10:52 |
using vectorTools
|
#1 |
New Member
F.F.
Join Date: Dec 2011
Posts: 14
Rep Power: 14 |
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_); Code:
#include "vectorTools.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // using namespace Foam::vectorTools; namespace Foam { namespace compressible { namespace RASModels { Note: Application is a turbulence model for buoyancy. |
|
March 17, 2015, 11:05 |
|
#2 |
Senior Member
|
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. |
|
March 17, 2015, 11:53 |
|
#3 |
New Member
F.F.
Join Date: Dec 2011
Posts: 14
Rep Power: 14 |
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; |
|
March 17, 2015, 12:03 |
|
#4 |
Senior Member
|
Hi,
And why do you thinks normalize is defined for vector fields (there is documentation, you know)? What you are trying to do? |
|
March 17, 2015, 12:08 |
|
#5 |
New Member
F.F.
Join Date: Dec 2011
Posts: 14
Rep Power: 14 |
... 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; Sorry. |
|
|
|