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

momentum source assignement in a domain

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   November 20, 2014, 10:35
Default momentum source assignement in a domain
  #1
New Member
 
Sean
Join Date: Mar 2009
Posts: 15
Rep Power: 17
songpen1985 is on a distinguished road
Hello, I have a question and need help. I have momentum sources at different points, so I want to assign the momentum values in the computational domain.

However, when I write this it seems that it is not OK,
for example, if I want to assign a momentum value to the coordinate (0.5,0.5,0.5), then I will wirte
...
if (x[0]==0.5)&&(x[1]==0.5)&&(x[2]==0.5) source=5;
...
Because in the mesh domain, there is not a point that is exactly equal to 0.5, the aforementioned "if..." would never be true then.

How do you assign source values to different points in the mesh domain? (the data points are not on the mesh nodes!)

Thank you for your help!

Regards,
Ola
songpen1985 is offline   Reply With Quote

Old   November 20, 2014, 11:32
Default
  #2
Senior Member
 
ghost82's Avatar
 
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 26
ghost82 will become famous soon enough
Just set up a small area in which you will apply the momentum source:
define xmin, xmax, ymin, ymax, zmin and zmax and play with if blocks:

Code:
if ((x[0] >= xmin) && (x[0] <= xmax))
{ 
   if ((x[1] >= ymin) && (x[1] <= ymax))
   {
     if ((x[2] >= zmin) && (x[2] <= zmax))
     {
        [apply here your equation]
     }
   }
}
Make sure to setup properly the xmin, xmax, etc. values depending on your grid resolution.

With C_CENTROID x[0], x[1] and x[2] always refer to cell centered value:you cannot apply the source in a point, at least you will apply the source in a cell.
__________________
Google is your friend and the same for the search button!
ghost82 is offline   Reply With Quote

Old   November 20, 2014, 14:25
Default a thousand points
  #3
New Member
 
Sean
Join Date: Mar 2009
Posts: 15
Rep Power: 17
songpen1985 is on a distinguished road
Quote:
Originally Posted by ghost82 View Post
Just set up a small area in which you will apply the momentum source:
define xmin, xmax, ymin, ymax, zmin and zmax and play with if blocks:

Code:
if ((x[0] >= xmin) && (x[0] <= xmax))
{ 
   if ((x[1] >= ymin) && (x[1] <= ymax))
   {
     if ((x[2] >= zmin) && (x[2] <= zmax))
     {
        [apply here your equation]
     }
   }
}
Make sure to setup properly the xmin, xmax, etc. values depending on your grid resolution.

With C_CENTROID x[0], x[1] and x[2] always refer to cell centered value:you cannot apply the source in a point, at least you will apply the source in a cell.
Thank you, ghost82. However, I have many momentum source points (like one thousand). I understand that I cannot assign the source at a point now. But I cannot create the code you suggested for one thousand times, right?

I think it should be solved in some ways. Any other suggestions?
Thank you so much!

/Ola
songpen1985 is offline   Reply With Quote

Old   November 30, 2014, 19:26
Default The same question
  #4
New Member
 
Lei Gao
Join Date: Nov 2014
Posts: 2
Rep Power: 0
Lei Gao is on a distinguished road
Hi songpeng,
I am also looking for the answer of this question. So I add my question here as a supplement of yours. Hope you don't mind.
It's usual to use a formula to present the data change in UDF. Is that posible to write the a formula to present the parameters of the points (for example forces on nodes) are random?

Namely,how to give the force to the right node from extern file?

X Y Z Fx Fy Fz
0.1 0.2 0.1 0.0094 0.02 -0.0035
........................................
.......................................
.......................................

Any one have an idea are wellcome, thank you very much!
Lei Gao 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
[swak4Foam] swak4foam building problem GGerber OpenFOAM Community Contributions 54 April 24, 2015 16:02
[swak4Foam] Swak4FOAM 0.2.3 / OF2.2.x installation error FerdiFuchs OpenFOAM Community Contributions 27 April 16, 2014 15:14
centOS 5.6 : paraFoam not working yossi OpenFOAM Installation 2 October 9, 2013 01:41
Version 15 on Mac OS X gschaider OpenFOAM Installation 113 December 2, 2009 10:23
DxFoam reader update hjasak OpenFOAM Post-Processing 69 April 24, 2008 01:24


All times are GMT -4. The time now is 14:19.