|
[Sponsors] |
September 23, 2012, 20:58 |
Patch orientation
|
#1 |
Member
Vitor Vasconcelos
Join Date: Jan 2012
Posts: 33
Rep Power: 14 |
Hello all,
I'm implementing a boundary condition. I is basically a cylinder in which I need to set a fixedValue or fixedGradient profile. Better saying, I need to get the faces of this cylinder and define a function for the faces values following the axial direction. I have an idea how to access my patch faces, but I don't know if I can get information among faces to check if they're neighbours in the axial direction. Trying again: from top to bottom, my cylinder must have fixedValues following a cosinoidal function or a x^2 function. Let me know if my point is not clear to try to explain in better words. And thank you very much in advance for any help. Vitor |
|
September 24, 2012, 03:21 |
|
#2 |
Senior Member
Bernhard
Join Date: Sep 2009
Location: Delft
Posts: 790
Rep Power: 22 |
By far the easiest way to obtain the desired result will be to use groovyBC (part of swak4Foam)
http://openfoamwiki.net/index.php/Contrib/swak4Foam contains source code and a bunch of examples that should get you going. |
|
September 27, 2012, 11:56 |
|
#3 |
Member
Vitor Vasconcelos
Join Date: Jan 2012
Posts: 33
Rep Power: 14 |
Thanks Bernhard.
I took a look on the source code but I could not realize how to get the orientation of cells. Reading openFoam documentation, I saw no method in fvPatch which somehow give me faces orientation. A newbie question: there is any orientation (xyz axis) in a mesh file? Or every face are identified by its neighbours? More: how to know if a face is over another one? Maybe these are stupid questions, but I quite new in the CFD field. Thanks. Vitor |
|
September 27, 2012, 18:20 |
|
#4 | |
Senior Member
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 18 |
Quote:
Code:
label patchID = mesh.boundaryMesh().findPatchID("myCylinderPatchName"); const polyPatch& cPatch = mesh.boundaryMesh()[patchID]; vectorList faceNormals(mesh.boundaryField().size(),vector::zero) forAll(cPatch, faceI) { const face& myFace = mesh.boundaryField()[patchID][faceI]; faceNormals[faceI] = myFace.normal(mesh.points()); } Cheers! |
||
October 4, 2012, 16:02 |
|
#5 |
Member
Vitor Vasconcelos
Join Date: Jan 2012
Posts: 33
Rep Power: 14 |
Hello kmooney,
I am studying the code you posted to have a deeper understand of it. Actually, I intend to understand OpenFOAM's classes and structures. Code:
label patchID = mesh.boundaryMesh().findPatchID("myCylinderPatchName"); const polyPatch& cPatch = mesh.boundaryMesh()[patchID]; vectorList faceNormals(mesh.boundaryField().size(),vector::zero); forAll(cPatch, faceI) { const face& myFace = mesh.boundaryField()[patchID][faceI]; faceNormals[faceI] = myFace.normal(mesh.points()); } But in the second line, you directly access a position in the boundaryMesh() method (which give us a boundaryMesh) related to the patchID. I can imagine it works, but I could find no method to access on patch, only the patch() method which gives me a list of patches. I feel like using direct access ([]) to a structure I don't know quite unconfortable. Do you have any pointers about documentation on how can I use these datastructures? I'm frozen in these lines by now. I ask more questions when I arrive to the faceI variable you mentioned in your code. Thank you very much for the code example and all your help. I have to say is almost impossible to start program in OpenFOAM without help like yours. Vitor |
|
October 4, 2012, 16:13 |
|
#6 |
Senior Member
Kyle Mooney
Join Date: Jul 2009
Location: San Francisco, CA USA
Posts: 323
Rep Power: 18 |
A good place to check for 'documentation' would be in the source code headers (.H files).
In the case of the boundaryMesh access, check out OpenFOAM-version/src/OpenFOAM/lnInclude/polyMesh.H You'll see a lot of other useful class documentation in this lnInclude folder as well. |
|
October 4, 2012, 16:27 |
|
#7 |
Member
Vitor Vasconcelos
Join Date: Jan 2012
Posts: 33
Rep Power: 14 |
Sorry, my fault! I realized now that boundaryMesh() gives me a fvBoundaryMesh instead of a boundaryMesh.
Still learning... Thanks, Vitor |
|
Tags |
function in a patch, orientation, patch |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Commercial meshers] Using starToFoam | clo | OpenFOAM Meshing & Mesh Conversion | 33 | September 26, 2012 05:04 |
[Other] StarToFoam error | Kart | OpenFOAM Meshing & Mesh Conversion | 1 | February 4, 2010 05:38 |
CheckMeshbs errors | ivanyao | OpenFOAM Running, Solving & CFD | 2 | March 11, 2009 03:34 |
[Gmsh] Import gmsh msh to Foam | adorean | OpenFOAM Meshing & Mesh Conversion | 24 | April 27, 2005 09:19 |
Multicomponent fluid | Andrea | CFX | 2 | October 11, 2004 06:12 |