CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Defining local coordinate system

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 14, 2009, 19:22
Default Defining local coordinate system
  #1
Senior Member
 
BastiL
Join Date: Mar 2009
Posts: 530
Rep Power: 20
bastil is on a distinguished road
Hi,

I want to define the directions for porosities based on their position in the mesh. Therefore I need a way to automatically define a local coordinate system that has a axis normal to a boundary patch (I know its name). How could this be realised? Looking forward for some advise.

Thanks.
bastil is offline   Reply With Quote

Old   April 15, 2009, 04:43
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Bastil

First of all, the following assumes that the boundary patch is plane, thus the "x"-axis will be known as "mesh.Sf()[faceNo_1] / mag(mesh.Sf()[faceNo_1])", and as the patch is assumed to be plane, then a vector defined as

vector yaxis(mesh.Cf()[faceNo_2] - mesh.Cf()[faceNo_1]);
yaxis /= mag(yaxis)

will be perpendicular to the face normal. The final axis, i.e. z-axis, is defined by the cross product of the two above.

Here I assume that you know the face indices of two of the boundary faces on the patch.

Best regards,

Niels

P.S. I use mag(mesh.Sf()[faceNo]) in stead of mesh.magSf() as I have had problems with it returning 0. Unfortunately I have not found where the bug is.
ngj is offline   Reply With Quote

Old   April 15, 2009, 06:21
Default
  #3
Senior Member
 
BastiL
Join Date: Mar 2009
Posts: 530
Rep Power: 20
bastil is on a distinguished road
Quote:
Originally Posted by ngj View Post
Hi Bastil

vector yaxis(mesh.Cf()[faceNo_2] - mesh.Cf()[faceNo_1]);
yaxis /= mag(yaxis)

will be perpendicular to the face normal. The final axis, i.e. z-axis, is defined by the cross product of the two above.

Here I assume that you know the face indices of two of the boundary faces on the patch.
Thanks Niels,

I am not really sure how to use this? Can I write this code into a ControlDict? What about dependencies? Might be very helpful to have a little example.
I know the name of the patch but not the indices of two faces - how can I get this?

Thanks once more.
bastil is offline   Reply With Quote

Old   April 15, 2009, 06:58
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Bastil

Now you are talking about controlDict, I thought you simply wanted to make some addition to your solver.
You need to elaborate a bit on what it is you actually want to achieve and especially how.
Further I do not have any examples, as I have never been coding any such thing

Best regards,

Niels
ngj is offline   Reply With Quote

Old   April 15, 2009, 08:57
Default
  #5
Senior Member
 
BastiL
Join Date: Mar 2009
Posts: 530
Rep Power: 20
bastil is on a distinguished road
Well I have a mesh where I want to set some porosites. I know the name of the patches surrounding these porous zones and the cell zones of the porous media itself.

I want to have a way to set the local coordinate system for each porosity so that one vector is normal to porous block. In generall this could be done in a program (maybe write a small preprocessing application?) or maybe another way? I have never done this before so I do not really know what is best.

Regards BastiL
bastil is offline   Reply With Quote

Old   April 15, 2009, 09:35
Default
  #6
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Hi Bastil

Well, it does entirely depend on what you need this local coordinate system for?!?
As you say preprocessing, then a small utility is probably the way forward, and I assume you might get some inspiration from e.g. setFields.

Best regards,

Niels
ngj is offline   Reply With Quote

Old   April 15, 2009, 10:01
Default
  #7
Senior Member
 
BastiL
Join Date: Mar 2009
Posts: 530
Rep Power: 20
bastil is on a distinguished road
Quote:
Originally Posted by ngj View Post
Hi Bastil

Well, it does entirely depend on what you need this local coordinate system for?!?

Sor setting my porosity values. So it is only for preprocessing.

Regards.
bastil is offline   Reply With Quote

Old   April 15, 2009, 12:56
Default
  #8
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Copenhagen, Denmark
Posts: 1,900
Rep Power: 37
ngj will become famous soon enoughngj will become famous soon enough
Well, then you need to get the patch properties. The following might suffice:

const label patchID = mesh.boundaryMesh().findPatchID("patchName"); // Get the patch ID
const vectorField & cc = mesh.boundary()[patchID].Cf(); // Get the centroid of the individual boundary faces on the given patch
const vectorField & NN = mesh.boundary()[patchID].Sf(); // Get the normal vector of the individual boundary faces on the given patch

This information should be sufficient to generate the local coordinate system as the one you have requested.

Best regards,

Niels
ngj is offline   Reply With Quote

Old   February 12, 2010, 12:16
Unhappy Coordinate System Components (v, w, x) ?
  #9
New Member
 
Mdz
Join Date: Feb 2010
Posts: 6
Rep Power: 16
Marcus081 is on a distinguished road
Hi, I have been using the version of ansys 12.1, and the coordinate system appears with these component (v, w, x) , I have not found the form to change it a (x, y, z), since I can do it?
Attached Images
File Type: png coordinates system.png (2.9 KB, 30 views)
Marcus081 is offline   Reply With Quote

Old   February 13, 2010, 07:36
Default
  #10
Senior Member
 
sega's Avatar
 
Sebastian Gatzka
Join Date: Mar 2009
Location: Frankfurt, Germany
Posts: 729
Rep Power: 20
sega is on a distinguished road
Quote:
Originally Posted by Marcus081 View Post
Hi, I have been using the version of ansys 12.1, and the coordinate system appears with these component (v, w, x) , I have not found the form to change it a (x, y, z), since I can do it?
If you refer to the new FLUENT version I suggest you put into the FLUENT-Forum. This is OpenFOAM ... :-)
__________________
Schrödingers wife: "What did you do to the cat? It's half dead!"
sega is offline   Reply With Quote

Old   February 17, 2011, 20:40
Default to define a new axis/coordinate system for porous media
  #11
New Member
 
farahidayu
Join Date: Aug 2010
Posts: 20
Rep Power: 15
farahiam is on a distinguished road
[QUOTE=ngj;213029]Well, then you need to get the patch properties. The following might suffice:

const label patchID = mesh.boundaryMesh().findPatchID("patchName"); // Get the patch ID
const vectorField & cc = mesh.boundary()[patchID].Cf(); // Get the centroid of the individual boundary faces on the given patch
const vectorField & NN = mesh.boundary()[patchID].Sf(); // Get the normal vector of the individual boundary faces on the given patch

This information should be sufficient to generate the local coordinate system as the one you have requested.




Hi, regarding the information given above, may I know where is it applicable? Where should I put the coding as above? In which file? I have same problem where I need to define the porosity of my intercooler but the intercooler does not follow the same axis as the default one. So, I need to define a new axis for the intercooler.

Can anyone help? Thank you!
Best regards.
farahiam is offline   Reply With Quote

Old   August 8, 2011, 09:26
Default
  #12
Senior Member
 
calim_cfd's Avatar
 
mauricio
Join Date: Jun 2011
Posts: 172
Rep Power: 17
calim_cfd is on a distinguished road
Quote:
Originally Posted by bastil View Post
Hi,

I want to define the directions for porosities based on their position in the mesh. Therefore I need a way to automatically define a local coordinate system that has a axis normal to a boundary patch (I know its name). How could this be realised? Looking forward for some advise.

Thanks.
Hello every1!


kinda ressurecting the topic but i got the same issue.. i need to create a local coordinate system, but it is a cylindrical one so that i can indicate it in the porouszone dict and set the resistences??

thx a lot!
calim_cfd is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write k and epsilon before the abnormal end xiuying OpenFOAM Running, Solving & CFD 8 August 27, 2013 16:33
[blockMesh] BlockMeshmergePatchPairs hjasak OpenFOAM Meshing & Mesh Conversion 11 August 15, 2008 08:36
IcoFoam parallel woes msrinath80 OpenFOAM Running, Solving & CFD 9 July 22, 2007 03:58
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07
u,v,w in local Coordinate System martin weghaus CFX 4 March 12, 2004 11:06


All times are GMT -4. The time now is 17:22.