CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Main CFD Forum

Angle two vectors.

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 12, 2004, 13:54
Default Angle two vectors.
  #1
Guest
Guest
 
Posts: n/a
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??
  Reply With Quote

Old   May 13, 2004, 02:28
Default Re: Angle two vectors.
  #2
Rami
Guest
 
Posts: n/a
<html xmlns="urn:schemas-microsoft-comfficeffice" xmlns:w="urn:schemas-microsoft-comffice:word" xmlns="http://www.w3.org/TR/REC-html40">

<head> <meta http-equiv=Content-Type content="text/html; charset=windows-1255"> <meta name=ProgId content=Word.Document> <meta name=Generator content="Microsoft Word 10"> <meta name=Originator content="Microsoft Word 10"> <link rel=File-List href="dot_files/filelist.xml"> <title>This actually is just basic vector analysis</title> <!--[if gte mso 9]><xml> <w:WordDocument> <w:SpellingState>Clean</w:SpellingState> <w:GrammarState>Clean</w:GrammarState> <w:Compatibility>

<w:BreakWrappedTables/>

<w:SnapToGridInCell/>

<w:WrapTextWithPunct/>

<w:UseAsianBreakRules/> </w:Compatibility> <w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel> </w:WordDocument> </xml><![endif]--> <style>

</style> <!--[if gte mso 10]> <style> /* Style Definitions */ table.MsoNormalTable

{mso-style-name:"Table Normal";

mso-tstyle-rowband-size:0;

mso-tstyle-colband-size:0;

mso-style-noshow:yes;

mso-style-parent:"";

mso-padding-alt:0in 5.4pt 0in 5.4pt;

mso-para-margin:0in;

mso-para-margin-bottom:.0001pt;

mso-pagination:widow-orphan;

font-size:10.0pt;

font-family:"Times New Roman";} </style> <![endif]--> </head>

<body lang=EN-US style='tab-interval:.5in'>

<div class=Section1>

<p class=MsoNormal>This actually is just basic vector analysis. The scalar product of two vectors, a and b <span class=GramE>is<span style='mso-spacerun:yes'>* </span>a</span> b = |a| |b| <span class=SpellE>cos<span style='font-family:Symbol'>f , </span>from</span> which <span style='font-family:Symbol'>f</span> the angle between a and b may be solved.


<p class=MsoNormal><o>*</o>


<p class=MsoNormal><o>*</o>


</div>

</body>

</html>
  Reply With Quote

Old   May 13, 2004, 09:33
Default 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?
  Reply With Quote

Old   May 13, 2004, 10:15
Default 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

  Reply With Quote

Old   May 16, 2004, 07:48
Default 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.
  Reply With Quote

Old   May 19, 2004, 13:58
Default 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.)

  Reply With Quote

Old   May 20, 2004, 05:06
Default 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.) "
  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


Similar Threads
Thread Thread Starter Forum Replies Last Post
InterFoam contact angle JoaoMiranda OpenFOAM Running, Solving & CFD 3 August 26, 2014 11:29
Import netgen mesh to OpenFOAM hsieh Open Source Meshers: Gmsh, Netgen, CGNS, ... 32 September 13, 2011 05:50
What does velocity angle mean? wateraction FLUENT 0 May 19, 2011 03:01
Normal vector, slope and aspect angle g_niro Main CFD Forum 0 February 2, 2011 18:24
Integration Points and normal area vectors Bloshchitsyn Vladimir CFX 0 November 26, 2007 08:35


All times are GMT -4. The time now is 18:33.