|
[Sponsors] |
November 20, 2014, 11:35 |
momentum source assignement in a domain
|
#1 |
New Member
Sean
Join Date: Mar 2009
Posts: 15
Rep Power: 17 |
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 |
|
November 20, 2014, 12:32 |
|
#2 |
Senior Member
Rick
Join Date: Oct 2010
Posts: 1,016
Rep Power: 27 |
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] } } } 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! |
|
November 20, 2014, 15:25 |
a thousand points
|
#3 | |
New Member
Sean
Join Date: Mar 2009
Posts: 15
Rep Power: 17 |
Quote:
I think it should be solved in some ways. Any other suggestions? Thank you so much! /Ola |
||
November 30, 2014, 20:26 |
The same question
|
#4 |
New Member
Lei Gao
Join Date: Nov 2014
Posts: 2
Rep Power: 0 |
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! |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[swak4Foam] swak4foam building problem | GGerber | OpenFOAM Community Contributions | 54 | April 24, 2015 17:02 |
[swak4Foam] Swak4FOAM 0.2.3 / OF2.2.x installation error | FerdiFuchs | OpenFOAM Community Contributions | 27 | April 16, 2014 16:14 |
centOS 5.6 : paraFoam not working | yossi | OpenFOAM Installation | 2 | October 9, 2013 02:41 |
Version 15 on Mac OS X | gschaider | OpenFOAM Installation | 113 | December 2, 2009 11:23 |
DxFoam reader update | hjasak | OpenFOAM Post-Processing | 69 | April 24, 2008 02:24 |