why pts() doesn't work?

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

 April 12, 2013, 12:29 why pts() doesn't work? #1 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,210 Rep Power: 20 why does the statement: Code: `"0<=pos().y && pos().y<=.0038 ? vector(0,0,0) : vector(mag(internalField(U).x),0,0)";` does work.but doesn't with pts()? Last edited by immortality; April 15, 2013 at 11:42.

 April 14, 2013, 05:08 #2 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,757 Rep Power: 29 Hi Ehsan, pos gives you the values in the face centres, whereas pts gives you the values in the vertices, hence they differ in size. This is probably the reason, why you only see that one of the methods work. Since your boundary condition is probably for a volume field, then it makes sense that it is pos, which works, since the boundary conditions for volume fields are given in the face centres. More information to be found here: http://openfoamwiki.net/index.php/Co...s_are_defined: Kind regards Niels

 April 14, 2013, 06:33 #3 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,210 Rep Power: 20 hi dear Niels thanks But I used pts in a condition on y,does it have effect on fields?what are volume fields? When can use pts?

 April 14, 2013, 06:47 #4 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,757 Rep Power: 29 I do not understand this Code: `But I used pts in a condition on y,does it have effect on fields?what are volume fields?` Please be a lot more specific on what it is you want to achieve. Especially on what type of field? I suppose you can e.g. use pts, if you are setting the pointDisplacement file for mesh motion. / Niels immortality likes this.

 April 14, 2013, 06:49 #5 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,757 Rep Power: 29 And with respect to your other question: What are volume fields? OpenFoam solves all the equations using the finite volume method. Volume fields are those, where the variables are defined in the cell centres. This is opposed to e.g. surface fields, where the variables are defined on the surface of the computational cells. Examples: Volume fields: pressure, velocity, temperature, scalar transport Surface fields: face fluxes (phi) Kind regards Niels immortality likes this.

 April 14, 2013, 09:38 #6 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,210 Rep Power: 20 thanks.then usage of pts() is restricted for example in moving meshes.right? another question that maybe not related but I value the time to ask about difference between face zones and face sets or such concepts I asked before in another thread without result.and is patch a face zone or face set or is an independent thing? thanks.

 April 14, 2013, 11:04 #7 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,757 Rep Power: 29 Hi, I would not constrain myself with pts() for mesh motion. All I said is that pts() can be used, when you are working with point locations rather than face locations. With respect to faces, faceSet and faceZones, I can tell you the following: 1. Faces on boundary faces are merely faces. The only special thing about them is that they only have an owner cell and not a neighbour cell. 2. A faceSet is a set of faces, which you can construct in many ways. In the more recent versions of OF, the pre-processing utility "topoSet" allows you to create faceSets. faceSets are NOT decomposed. 3. faceZones is a collection of faceSets, which you create by executing "setsToZones" after the sets are created. One major difference is that faceZones (as all the other zones, i.e pointZones and cellZones) are decomposed, when you are using decomposePar. Kind regards Niels immortality likes this.

 April 14, 2013, 12:20 #8 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,210 Rep Power: 20 thank you for explaining faceSets and faceZones clearly. but I have doubt on pts() yet.in contrib groovyBC an example is as so: Code: ``` inlet { type groovyBC; variables "yp=pts().y;minY=min(yp);maxY=max(yp);para=-(maxY-pos().y)*(pos().y-minY)/(0.25*pow(maxY-minY,2))*normal();"; valueExpression "10*(1+0.5*sin(500*time()))*para"; value uniform (10 0 0); }``` and in my code: Code: `"0<=pts().y && pts().y<=.0038 ? vector(0,0,0) : vector(mag(internalField(U).x),0,0)";` I mean if y be between two values U be something... I haven't used pts() in volume fields (here U) then it shouldn't give any error.am I correct?

 April 14, 2013, 15:22 #9 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,757 Rep Power: 29 The example you have from the groovyBC only uses the pts() to find the upper and lower limit of the boundary. When assigning values, it is pos(), which is being used, therefore, the example is consistent in terms of size of the different fields. What you show, however,use the values of pts(), which on a 2-dimensional domain is more than twice as large as the internal field of U. The size of the internal field equals the number of faces on the boundary. Hence the error. An for the record: The velocity (U) is a volume field! / Niels immortality likes this.

 April 14, 2013, 16:30 #10 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,210 Rep Power: 20 thanks.but i didn't figure out what you mean by "its more than twice as large as..." it seems vertices be only one number more than numbers of cell faces. If we imagine a patch consisting of 3 cells it has three cell centers and four vertices.am not correct? And another thing in my code does OF assumes U values on vertices while they are located in cell centers,right?thenif i use toFace(vector(0,0,0)) it would be ok?did i grasp it correctly?

April 15, 2013, 03:57
#11
Senior Member

Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Deltares, Delft, The Netherlands
Posts: 1,757
Rep Power: 29
Quote:
 thanks.but i didn't figure out what you mean by "its more than twice as large as..." it seems vertices be only one number more than numbers of cell faces. If we imagine a patch consisting of 3 cells it has three cell centers and four vertices.am not correct?
No, you are wrong. OpenFoam is always running with a finite thickness in the empty direction, hence in your example, we are having 8 vertices. Look carefully on any case in paraFoam, and you should see it immediately!

Quote:
 And another thing in my code does OF assumes U values on vertices while they are located in cell centers,right?thenif i use toFace(vector(0,0,0)) it would be ok?did i grasp it correctly?
Boundary conditions for U are on the faces. NOT the vertices.

I suggest that you carefully read an introductory work to finite volume methods and/or an introduction to the basic principles in OpenFoam. Such a source for the latter could be chapter 3 in

http://powerlab.fsb.hr/ped/kturbo/Op...jeJasakPhD.pdf

Kind regards

Niels

 April 15, 2013, 04:57 #12 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,210 Rep Power: 20 in parafoam we have 3 layers.is the middle main ?you mean 4 vertices in 3 layers?i think we should have 3*4 vertices not 2*4.wrong? Then will it be correct if use toFace function? Thanks.

 April 15, 2013, 12:52 #13 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,210 Rep Power: 20 could you please give me more clarification?

 April 15, 2013, 12:57 #14 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,757 Rep Power: 29 Your post from earlier today is so difficult to read/understand that I have no means of answering it. You have been encouraged to do it before, however, I will do it again: If you do not take your time in formulating your questions, you cannot expect answers. Kind regards, Niels

 April 15, 2013, 13:03 #15 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,210 Rep Power: 20 I don't figure out how do you count vertices ?and also cell centers. how vertex numbers wil be twice cell center numbers? I'm totally mixed up

 April 15, 2013, 13:12 #16 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,210 Rep Power: 20 oh dear Niels I grasped it now.we should imagine cells as a cube not a rectangle.what a mistake! then in the example we have 8 vertices and three cell centers. I always imagine it as rectangles! thank you so much.

 April 15, 2013, 13:16 #17 Senior Member   Niels Gjoel Jacobsen Join Date: Mar 2009 Location: Deltares, Delft, The Netherlands Posts: 1,757 Rep Power: 29 Good. / Niels

 April 16, 2013, 05:04 #18 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,210 Rep Power: 20 a question.when we assign boundary values does it set in boundary cell face or center?it seems U is located in face,right?then what about p and T? And also whats the usge of faceSets and faceZones?when and where we need and use them? Thanks so much.

April 16, 2013, 05:44
#19
Assistant Moderator

Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,017
Rep Power: 43
Quote:
 Originally Posted by immortality a question.when we assign boundary values does it set in boundary cell face or center?it seems U is located in face,right?then what about p and T? And also whats the usge of faceSets and faceZones?when and where we need and use them? Thanks so much.
Boundary values are always enforced on the patch-faces. That is why your internalField-approach to zeroGradient in another thread is problematic.

faceSets and zones are only ways to keep track of "special" faces and are usually not used by the solver but by pre- and postprocessing tools
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request

 April 16, 2013, 10:41 #20 Senior Member     Ehsan Join Date: Oct 2012 Location: Iran Posts: 2,210 Rep Power: 20 thank you dear Bernard. Only a small question about internalField and zeroGradient you mentioned at a good time! In internalField the value in the boundary cell "center" is replaced in the face of the cell that is boundary(not the neighbor cell center),right? And in zeroGradient same happens but implicitly,correct?

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Martin Siemens 2 February 25, 2009 14:23 shaun OpenFOAM Installation 12 March 23, 2007 09:55 aero Siemens 3 November 23, 2006 08:43 Alumna Phoenics 6 June 22, 2004 12:08 green Phoenics 2 May 27, 2004 21:03

All times are GMT -4. The time now is 05:45.