CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

please help!! I need to get velocities at points whish are not at nodes. (2D)

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes
  • 1 Post By AlexanderZ
  • 1 Post By vinerm
  • 1 Post By vinerm

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 26, 2020, 22:20
Default please help!! I need to get velocities at points whish are not at nodes. (2D)
  #1
New Member
 
Rai Shigeta
Join Date: Dec 2019
Posts: 4
Rep Power: 6
raishigeta is on a distinguished road
I need to write a UDF that will read a point coordinate from a table and provide me with Velocity(u and v) at that point. That point might not be at a node, so fluent would have to interpolate.

Is there a UDF line command to get the Velocity at a specific X,Y location?
raishigeta is offline   Reply With Quote

Old   January 27, 2020, 05:49
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
my vision:
you may use loop over cells and get coordinates of centers of these cells,
compare them with data from table, extract velocity and interpolate it yourself
raishigeta likes this.
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   January 28, 2020, 06:56
Default I am still lost...
  #3
New Member
 
Rai Shigeta
Join Date: Dec 2019
Posts: 4
Rep Power: 6
raishigeta is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
my vision:
you may use loop over cells and get coordinates of centers of these cells,
compare them with data from table, extract velocity and interpolate it yourself
Thank you for taking your time to consider my problem. I really appreciate it.
I was working on that way that you suggested.
However, I couldn't find a good way to interpolate it for myself.
I'm afraid to ask that Do you know any good way to interpolate it from the data of centers or nodes, kind of using any free-software or some?
Or Could I ask your vision again?
I'm not majoring this kind of things and I need to graduate soon...
Is it easier to do it myself without using UDF or TUI things?
raishigeta is offline   Reply With Quote

Old   January 28, 2020, 07:20
Default Value from cell center or interpolated value
  #4
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Hi Rai

Do you wish to extract value from the cell in which the point lies or do you wish to interpolate the values from the adjacent cells or nodes to your point and report that? For the later, you have to use some interpolation algorithm. If mesh is fine, I would suggest using 0 order interpolation, i.e., the nearest node value or picking up the value from the center of the cell in which the point exists. There are a couple of macros available within Fluent to find the id of the cell in which a given point lies.

You may use DPM_Locate_Point(x,&a,0.0,0)

where x is the vector containing point coordinates and a is the variable to cell ID. There certainly could be better solutions available depending upon the version of Fluent. Once you have the cell ID, you may loop through all nodes or faces and retrieve interpolated value.

Vinerm
raishigeta likes this.
vinerm is offline   Reply With Quote

Old   January 28, 2020, 23:26
Default first order interpolation
  #5
New Member
 
Rai Shigeta
Join Date: Dec 2019
Posts: 4
Rep Power: 6
raishigeta is on a distinguished road
Quote:
Originally Posted by vinerm View Post
Hi Rai

Do you wish to extract value from the cell in which the point lies or do you wish to interpolate the values from the adjacent cells or nodes to your point and report that? For the later, you have to use some interpolation algorithm. If mesh is fine, I would suggest using 0 order interpolation, i.e., the nearest node value or picking up the value from the center of the cell in which the point exists. There are a couple of macros available within Fluent to find the id of the cell in which a given point lies.

You may use DPM_Locate_Point(x,&a,0.0,0)

where x is the vector containing point coordinates and a is the variable to cell ID. There certainly could be better solutions available depending upon the version of Fluent. Once you have the cell ID, you may loop through all nodes or faces and retrieve interpolated value.

Vinerm
Thank you for your quick reply. I really appreciate it. I feel like I understood better than before now.
But it seems like that what I need is 1 order interpolation (linear interpolation?).
The detail of my circumstances is here: I'm doing 2D air flow analysis in square region(100mm×100mm).
I need the value of the points that are located at (x,y)=(1,1),(1,2)...(99,99).
Now I've got the values of 0 order interpolation which is like the same values as the closest nodes.

But thanks anyway, I really appreciate that you took your time to consider my problem.
raishigeta is offline   Reply With Quote

Old   January 29, 2020, 03:27
Default Justification
  #6
Senior Member
 
vinerm's Avatar
 
Vinerm
Join Date: Jun 2009
Location: Nederland
Posts: 2,946
Blog Entries: 1
Rep Power: 35
vinerm will become famous soon enough
Hi

Linear interpolation would be very expensive since you have to calculate the distance of each node from the point within the cell and then calculate the value. On the other hand, averaging over nodes would not be that expensive. However, it is difficult to justify to go into all this. 0 order interpolation is quite close to 1st order if mesh is fine enough.
raishigeta likes this.
__________________
Regards,
Vinerm

PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority.
vinerm is offline   Reply With Quote

Old   February 12, 2020, 06:00
Default
  #7
Senior Member
 
sbaffini's Avatar
 
Paolo Lampitella
Join Date: Mar 2009
Location: Italy
Posts: 2,151
Blog Entries: 29
Rep Power: 39
sbaffini will become famous soon enoughsbaffini will become famous soon enough
Send a message via Skype™ to sbaffini
Once you get the ID of the cell containing your point, it is as simple as retrieving both the cell value and the gradient of the variable you want to interpolate, then just:

phi_point = phi_cell + SUM(grad_cell(i)*(x_point(i)-x_cell(i)),i=1,ND)

Depending from what you want to do, it might make sense to properly distinguish between pure gradients and reconstruction gradients, both of which are available.

You might need to use the TUI to tell Fluent to avoid freeding the memory for the gradients.
sbaffini is offline   Reply With Quote

Old   March 11, 2020, 05:26
Default Extracting flow data at tabulated points
  #8
New Member
 
han
Join Date: Mar 2020
Posts: 2
Rep Power: 0
han.velthuis@tno.nl is on a distinguished road
Hi, I was looking for the same, thought it would be a straightforward question, however did not find a working example for Fluent 18. I started UDF programming but ran into the problem of undocumented functions, type conflicts nd so on. As a quick workaround I made a script (any language will do) that makes a Fluent journal file "MakeJou.jou". The scripts reads a file ("points.txt") with points (x, y, z), generates the TUI commands to make the point-surfaces, to export the flow data at the point-surfaces to file "DataAtPoints.txt", and to delete the point-surfaces again, as not to leave traces in Fluent.

Code for generation of journal file MakeJou.jou (this case Mathcad 15)
[IMG]C:\tmp\tmp.bmp[/IMG]

Example:
----------

File with points (x,y,z, coordinates) "points.txt":
0.55 -0.04 0.0045
0.3 0.05 0.0001
-0.55 0.05 0.0001

Autogenerated Journal file "MakeJou.jou":

q
/surface
point-surface
Point-1
0.55
-0.04
0.0045
point-surface
Point-2
0.3
0.05
0.0001
point-surface
Point-3
-0.55
0.05
0.0001
/file/export
ascii
DataAtPoints.txt
Point-1
Point-2
Point-3

yes
xvelocity
yvelocity
zvelocity
velocity
pressure
temperature
density
viscosity-lam
q
no
yes
0
q
/surface/delete-surface
Point-1
/surface/delete-surface
Point-2
/surface/delete-surface
Point-3

File with output for each data point "DataAtPoints.txt":
nodenumber, x-coordinate, y-coordinate, z-coordinate, viscosity-lam, density, temperature, pressure,velocity-magnitude, z-velocity, y-velocity, x-velocity
1, 5.500000000E-01,-4.000000000E-02, 4.499999762E-03, 8.906351952E-06, 8.156205730E-06, 2.969481164E+02, 9.988928086E+00, 1.775980586E+01,-8.117933759E-01, 1.176474198E+00, 1.769677456E+01
2, 3.000000104E-01, 5.000000000E-02, 9.999999404E-05, 8.837132723E-06, 1.846997675E-05, 2.935214512E+02, 2.235924084E+01, 9.385820385E+00, 1.460540274E-04, 0.000000000E+00, 9.385820342E+00
3,-5.500000164E-01, 5.000000149E-02, 9.999999404E-05, 8.840741512E-06, 4.097106808E-05, 2.937000280E+02, 4.962854152E+01, 1.299232211E-01,-8.431707945E-05, 0.000000000E+00, 1.299228378E-01
han.velthuis@tno.nl is offline   Reply With Quote

Old   March 11, 2020, 05:33
Default
  #9
New Member
 
han
Join Date: Mar 2020
Posts: 2
Rep Power: 0
han.velthuis@tno.nl is on a distinguished road
https://paste.pics/ad0e64c49e39978173f01302e6f09d08
Attached Images
File Type: jpg tmp.jpg (55.8 KB, 12 views)
han.velthuis@tno.nl 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[snappyHexMesh] .STL: non-closed manifold surface giulio.topazio OpenFOAM Meshing & Mesh Conversion 32 November 25, 2016 03:15
[mesh manipulation] Calculate cross product of mesh points and given vector DE25VT OpenFOAM Meshing & Mesh Conversion 5 January 13, 2016 10:05
[mesh manipulation] Importing Multiple Meshes thomasnwalshiii OpenFOAM Meshing & Mesh Conversion 18 December 19, 2015 18:57
extreme points problem Lipo Wang Main CFD Forum 2 August 18, 2004 03:15
CFX4.3 -build analysis form Chie Min CFX 5 July 12, 2001 23:19


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