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

What does [0][0] in U.boundaryField()[0][0] mean?

Register Blogs Community New Posts Updated Threads Search

Like Tree5Likes
  • 2 Post By alexeym
  • 2 Post By alexeym
  • 1 Post By alexeym

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 15, 2014, 05:05
Default What does [0][0] in U.boundaryField()[0][0] mean?
  #1
New Member
 
Olivia Nalen
Join Date: Apr 2014
Location: Vancouver
Posts: 19
Rep Power: 12
entropie is on a distinguished road
Hello again,

I have a question to notation "U.boundaryField()[0][0]"

What does [0][0] mean? So far I understand, this should be a single point on the mesh, but is there an option to find out, where exactly this point is?
entropie is offline   Reply With Quote

Old   May 15, 2014, 06:11
Default
  #2
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

U.boundaryField() is a list of fvPatchFields, so

Code:
Info << U.boundaryField()[0].typeName << endl;
is

Code:
fvPatchField
(0 is ID of the patch of your mesh)

and finally U.boundaryMesh()[0][0] is a value of U in face 0 of the patch with ID == 0.

You can try to learn the location of the face using:

Code:
const polyPatch& ptch = mesh.boundaryMesh()[0];
Info << ptch.faceCentres()[0] << endl;
alexeym is offline   Reply With Quote

Old   May 15, 2014, 09:31
Default
  #3
New Member
 
Olivia Nalen
Join Date: Apr 2014
Location: Vancouver
Posts: 19
Rep Power: 12
entropie is on a distinguished road
Hello Alexey,

thanks a lot!

But what do you mean by "0 is the ID of the patch of your mesh"? Can I somehow find out, what ID belongs to what patch?

Kind regards, Olivia
entropie is offline   Reply With Quote

Old   May 15, 2014, 09:40
Default
  #4
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

as you've used 0 in the code snippet, I've referenced to this 0

There are two methods of boundaryMesh:

1. patchNames - list of patch names, so you can get a name of patch with ID == 0 using something like mesh.boundaryMesh().patchNames()[0]

2. findPatchID - to lookup patch ID by its name, i.e. mesh.boundaryMesh().findPatchID("wall") will find ID of the patch with a name wall.
entropie and jadidi.cfd like this.
alexeym is offline   Reply With Quote

Old   May 15, 2014, 10:58
Default
  #5
New Member
 
Olivia Nalen
Join Date: Apr 2014
Location: Vancouver
Posts: 19
Rep Power: 12
entropie is on a distinguished road
Hi

finally I've found it out. This
Code:
mesh.boundaryMesh().findPatchID("airfoil")
gave me this ID-number of the patch "airfoil".

I should type there "airfoil" and not "wall" or "patch". I think it is so because I may have more than one patch and more than one wall actually.

Thank you for your help again!
entropie is offline   Reply With Quote

Old   May 15, 2014, 11:13
Default
  #6
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Surely "wall" was just an example of the patch's name. Though my telepathic abilities are improving, I still wasn't able to guess names of the patches in your case
Tobi and entropie like this.
alexeym is offline   Reply With Quote

Old   May 16, 2014, 08:09
Default
  #7
New Member
 
Olivia Nalen
Join Date: Apr 2014
Location: Vancouver
Posts: 19
Rep Power: 12
entropie is on a distinguished road
Well, I hope this is my last question to this matter...

There is a difference between
Code:
U.boundaryField ()[0][1]
and
Code:
U.boundaryMesh ()[0][1]
?
entropie is offline   Reply With Quote

Old   May 16, 2014, 08:24
Default
  #8
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,930
Rep Power: 38
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Well, it's rather easy to check

First of all, U.boundaryMesh()[0][1] won't compile, as volVectorField doesn't have boundaryMesh() method. So it should be U.mesh().boundaryMesh()[0][1] (if you really need the boundary mesh).

Then you can use following snippet to find difference (or read documentation instead):

Code:
    Info<< U.boundaryField ()[0][1].typeName << endl;
    Info<< U.boundaryField ()[0][1] << endl;
    Info<< U.mesh().boundaryMesh ()[0][1].typeName << endl;
    Info<< U.mesh().boundaryMesh ()[0][1] << endl;
the output will be something like

Code:
vector
(0 0 0)
face
4(51 357 408 102)
jadidi.cfd likes this.
alexeym is offline   Reply With Quote

Old   May 16, 2014, 09:03
Default
  #9
New Member
 
Olivia Nalen
Join Date: Apr 2014
Location: Vancouver
Posts: 19
Rep Power: 12
entropie is on a distinguished road
Thank you sooooo much!
entropie 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



All times are GMT -4. The time now is 15:27.