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

Normal vector issue

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 21, 2013, 03:34
Default Normal vector issue
  #1
Member
 
Tayo
Join Date: Aug 2012
Posts: 94
Rep Power: 14
tayo is on a distinguished road
Hello all, I have two quick questions. I want to implement heat conduction equation in my phaseChange solver.

1.) How to get a normal vector, n in OF?
2.) How to obtain area A, of the cell face?
Here is what I've tried so far:

Code:
volVectorField gradT = fvc::grad(T);
volVectorField n = T.mesh().Sf()/T.mesh().magSf();   ;)
volScalarField A = T.mesh().magSf();  ;)
volScalarField q = A*(gradT & n);
I keep getting errors in the form of: "conversion from GeometricField, fvsPatchField, SurfaceMesh> to non-scalar type requested". I guess I'm not doing something right. Thank you for your help.
tayo is offline   Reply With Quote

Old   October 21, 2013, 07:37
Default
  #2
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
not correct post
Tobi is offline   Reply With Quote

Old   October 21, 2013, 14:11
Default
  #3
Member
 
Tayo
Join Date: Aug 2012
Posts: 94
Rep Power: 14
tayo is on a distinguished road
Quote:
Originally Posted by Tobi View Post
not correct post
Hi Tobi,

I don't understand what you mean; the gradient of a scalar field is a vector field, so grad(T) will give me a volVectorField. The code is actually works up to that point so I dont have a problem with gradT. Here is how I call my "T".

Code:
const volScalarField& T = alpha1_.db().lookupObject<volScalarField>("T");
My question is how do I compute the normal vector and facearea of the cell. Thanks
tayo is offline   Reply With Quote

Old   October 21, 2013, 16:16
Default
  #4
Member
 
Tayo
Join Date: Aug 2012
Posts: 94
Rep Power: 14
tayo is on a distinguished road
Never mind, problem fixed . I simply used the wrong syntax in defining the normal and face area. Here's the correction. Thanks

Code:
volVectorField gradT = fvc::grad(T);
vectorField n = T.mesh().Sf()/T.mesh().magSf();
scalarField A = T.mesh().magSf();
scalarField q = A*(gradT & n);
tayo is offline   Reply With Quote

Old   October 22, 2013, 05:20
Default
  #5
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi,

as I wrote later - I made a mistake because I had mixed up some Information. The Gradient of a scalar is a vector field with it s gradients of the components in x, y, z. So I was wrong in my first post.

And your error was the following signs:
Code:
;)
Regards Tobi
Tobi 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
How to get normal vector to the face? Viatcheslav Kulikov FLUENT 1 August 31, 2017 04:03
Normal vector, slope and aspect angle g_niro Main CFD Forum 0 February 2, 2011 18:24
[CAD formats] my stl surface is seen as just a line rcastilla OpenFOAM Meshing & Mesh Conversion 2 January 6, 2010 02:30
Normal stress?/ bowlderyu Main CFD Forum 1 October 28, 2008 22:57
NACA0012 geometry/design software needed Franny Main CFD Forum 13 July 7, 2007 16:57


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