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

Tangent vectors to a surface

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By olesen

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 25, 2024, 05:26
Post Tangent vectors to a surface
  #1
New Member
 
Khoder Alshaar
Join Date: May 2021
Posts: 7
Rep Power: 4
khoder Alshaar is on a distinguished road
Hi,
I know that the normal vector can be defined in OpenFOAM as follows:

Code:
// Face area normal vectors
const surfaceVectorField& Sf = mesh.Sf();

// Face areas
const surfaceScalarField& magSf = mesh.magSf();

// Face normals
const surfaceVectorField& N = Sf/magSf;
My question is, how do we define the tangent vectors to the surface?

........................................
khoder Alshaar is offline   Reply With Quote

Old   February 28, 2024, 07:29
Default
  #2
Senior Member
 
Join Date: Apr 2020
Location: UK
Posts: 668
Rep Power: 14
Tobermory will become famous soon enough
Okay - this is a maths question, rather than an OpenFOAM question, but here goes.

You want to find a vector that is normal to unit vector N - let's call it t. There are of course an inifite number of these, but let's assume that you are not too bothered which one you get. Then:
1. define a vector t1 = (1,0,0)
2. calculate the dot product of t1.N and check whether this equals 1?
3. if it does, then N is pointing in the same direction as t1, and so you can set t=(0,1,0)
3. if it does not, then calculate t2 = t1 x N (cross product) and then divide this through by its norm to get the unit vector t.
Tobermory is offline   Reply With Quote

Old   February 28, 2024, 15:21
Default
  #3
Senior Member
 
Mark Olesen
Join Date: Mar 2009
Location: https://olesenm.github.io/
Posts: 1,684
Rep Power: 40
olesen has a spectacular aura aboutolesen has a spectacular aura about
Quote:
Originally Posted by Tobermory View Post
Okay - this is a maths question, rather than an OpenFOAM question, but here goes.

You want to find a vector that is normal to unit vector N - let's call it t. There are of course an inifite number of these, but let's assume that you are not too bothered which one you get. Then:
1. define a vector t1 = (1,0,0)
2. calculate the dot product of t1.N and check whether this equals 1?
3. if it does, then N is pointing in the same direction as t1, and so you can set t=(0,1,0)
3. if it does not, then calculate t2 = t1 x N (cross product) and then divide this through by its norm to get the unit vector t.

Indeed, this is similar to what is being done in
https://develop.openfoam.com/Develop...ref_type=heads
https://develop.openfoam.com/Develop...ref_type=heads
Code:
// Guess second axis
axes::rotation(axis, Zero, E3_E1)
In those cases, it uses a best guess of some principal axis (x,y,z direction) and goes from there.
findOrthogonal() and then the removeCollinear()
Tobermory likes this.
olesen 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
tangent vectors in directionMixed Martin80 OpenFOAM Programming & Development 1 February 25, 2024 13:13
[snappyHexMesh] snappyHexMesh and CfMesh: Surface is not smooth mortezahdr OpenFOAM Meshing & Mesh Conversion 1 October 11, 2023 03:21
SU2 7.0.7 Built on CentOS 7, parallel computation pyscript mpi exit error? EternalSeekerX SU2 3 October 9, 2020 18:28
How To Create Fowcs William Hawkings Surface in Fluent? marinkobezu FLUENT 7 October 25, 2018 10:51
[Gmsh] Problem with Gmsh nishant_hull OpenFOAM Meshing & Mesh Conversion 23 August 5, 2015 02:09


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