CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Running, Solving & CFD

why pts() doesn't work?

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

Like Tree5Likes
  • 1 Post By ngj
  • 1 Post By ngj
  • 1 Post By ngj
  • 1 Post By ngj
  • 1 Post By gschaider

Reply
 
LinkBack Thread Tools Display Modes
Old   April 12, 2013, 12:29
Default why pts() doesn't work?
  #1
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
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.
immortality is offline   Reply With Quote

Old   April 14, 2013, 05:08
Default
  #2
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,528
Rep Power: 23
ngj will become famous soon enoughngj will become famous soon enough
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
ngj is offline   Reply With Quote

Old   April 14, 2013, 06:33
Default
  #3
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
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?
immortality is offline   Reply With Quote

Old   April 14, 2013, 06:47
Default
  #4
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,528
Rep Power: 23
ngj will become famous soon enoughngj will become famous soon enough
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.
ngj is offline   Reply With Quote

Old   April 14, 2013, 06:49
Default
  #5
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,528
Rep Power: 23
ngj will become famous soon enoughngj will become famous soon enough
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.
ngj is offline   Reply With Quote

Old   April 14, 2013, 09:38
Default
  #6
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
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.
immortality is offline   Reply With Quote

Old   April 14, 2013, 11:04
Default
  #7
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,528
Rep Power: 23
ngj will become famous soon enoughngj will become famous soon enough
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.
ngj is offline   Reply With Quote

Old   April 14, 2013, 12:20
Default
  #8
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
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?
immortality is offline   Reply With Quote

Old   April 14, 2013, 15:22
Default
  #9
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,528
Rep Power: 23
ngj will become famous soon enoughngj will become famous soon enough
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.
ngj is offline   Reply With Quote

Old   April 14, 2013, 16:30
Default
  #10
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
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?
immortality is offline   Reply With Quote

Old   April 15, 2013, 03:57
Default
  #11
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,528
Rep Power: 23
ngj will become famous soon enoughngj will become famous soon enough
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
ngj is offline   Reply With Quote

Old   April 15, 2013, 04:57
Default
  #12
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
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.
immortality is offline   Reply With Quote

Old   April 15, 2013, 12:52
Default
  #13
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
could you please give me more clarification?
immortality is offline   Reply With Quote

Old   April 15, 2013, 12:57
Default
  #14
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,528
Rep Power: 23
ngj will become famous soon enoughngj will become famous soon enough
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
ngj is offline   Reply With Quote

Old   April 15, 2013, 13:03
Default
  #15
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
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
immortality is offline   Reply With Quote

Old   April 15, 2013, 13:12
Default
  #16
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
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.
immortality is offline   Reply With Quote

Old   April 15, 2013, 13:16
Default
  #17
ngj
Senior Member
 
Niels Gjoel Jacobsen
Join Date: Mar 2009
Location: Rotterdam, The Netherlands
Posts: 1,528
Rep Power: 23
ngj will become famous soon enoughngj will become famous soon enough
Good.

/ Niels
ngj is offline   Reply With Quote

Old   April 16, 2013, 05:04
Default
  #18
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
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.
immortality is offline   Reply With Quote

Old   April 16, 2013, 05:44
Default
  #19
Assistant Moderator
 
Bernhard Gschaider
Join Date: Mar 2009
Posts: 3,780
Rep Power: 37
gschaider will become famous soon enoughgschaider will become famous soon enough
Quote:
Originally Posted by immortality View Post
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
immortality likes this.
__________________
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
gschaider is offline   Reply With Quote

Old   April 16, 2013, 10:41
Default
  #20
Senior Member
 
immortality's Avatar
 
Ehsan
Join Date: Oct 2012
Location: Iran
Posts: 2,173
Rep Power: 15
immortality is on a distinguished road
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?
immortality is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to work with constant pressure? Martin CD-adapco 2 February 25, 2009 13:23
Getting FoamX to work shaun OpenFOAM Installation 12 March 23, 2007 09:55
work related to brake study of a vehical aero CD-adapco 3 November 23, 2006 07:43
Why do the Plant library cases don't work? Alumna Phoenics 6 June 22, 2004 12:08
why my In-Form doesn't work? green Phoenics 2 May 27, 2004 21:03


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