# Angle two vectors.

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

 May 12, 2004, 13:54 Angle two vectors. #1 Guest Guest   Posts: n/a Sponsored Links Good morning, I am looking to calculate the angle between two 3D vectors in my CFD results. I can do this mathematically, but I don't know how to implement it in code for a general coordinate system. Has anyone any ideas were I can learn how to use standard CFD code to calculate such quantities??

 May 13, 2004, 02:28 Re: Angle two vectors. #2 Rami Guest   Posts: n/a This actually is just basic vector analysis

This actually is just basic vector analysis. The scalar product of two vectors, a and b is* a · b = |a| |b| cosf , from which f – the angle between a and b – may be solved.

*

*

 May 13, 2004, 09:33 Re: Angle two vectors. #3 Guest Guest   Posts: n/a I know that, but how do I implement it numerically. How do I implement it numerically? How do I calculate that angle using code?

 May 13, 2004, 10:15 Re: Angle two vectors. #4 Rami Guest   Posts: n/a Fortran implementation: real a(3), b(3) AdotA = a(1)*a(1) + a(2)*a(2) + a(3)*a(3) BdotB = b(1)*b(1) + b(2)*b(2) + b(3)*b(3) den = AdotA*BdotB if(den .gt. 0.) then AdotB = a(1)*b(1) + a(2)*b(2) + a(3)*b(3) cosphi = AdotB / sqrt(den) phi = acos(cosphi) endif

 May 16, 2004, 07:48 Re: Angle two vectors. #5 Guest Guest   Posts: n/a Thank you. If I have two grid lines, which are not orthogonal, how can I find the angle between them? What term do I use to describe their direction? Also, how is this done in a general curvilinear coordinate system? How can I find the angle between a grid line and a velocity field for example.

 May 19, 2004, 13:58 Re: Angle two vectors. #6 zxaar Guest   Posts: n/a give me ur email i will drop u an email how to calculate what u need. (i understood that u want to use that in calculation for CFD, say for angle between the faces etc.)

 May 20, 2004, 05:06 Re: Angle two vectors. #7 Guest Guest   Posts: n/a Hi zxaar, This is my email account address as requested: cfd_user_uk@yahoo.co.uk I would appreciate any help you can give me for this problem. Thank you. "give me ur email i will drop u an email how to calculate what u need. (i understood that u want to use that in calculation for CFD, say for angle between the faces etc.) "

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post JoaoMiranda OpenFOAM Running, Solving & CFD 7 October 20, 2016 06:27 hsieh Open Source Meshers: Gmsh, Netgen, CGNS, ... 32 September 13, 2011 05:50 wateraction FLUENT 0 May 19, 2011 03:01 g_niro Main CFD Forum 0 February 2, 2011 18:24 Bloshchitsyn Vladimir CFX 0 November 26, 2007 08:35