CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   FLUENT (http://www.cfd-online.com/Forums/fluent/)
-   -   Passing point data to UDF using C_UDMI (http://www.cfd-online.com/Forums/fluent/38649-passing-point-data-udf-using-c_udmi.html)

Sam Bennett November 17, 2005 06:55

Passing point data to UDF using C_UDMI
 
Dear all,

I have written the following code to load the temperature from a point (zone ID = 15) into the user defined memory.The point was created in Fluent using surace/point. When it's run as interpreted I get a segmentation violation. Yes I have turned on user memory. I have also tried looping over the face and using F_UDMI, same problem. The zone ID is from surface/manage, as a point isn't listed as a boundry. Is this where my problem comes from?

Thanks for your help in advance,

Sam

DEFINE_ADJUST(sensor_temp, domain)

{

cell_t c;

int ID = 15;

Thread *thread = Lookup_Thread(domain, ID);

begin_c_loop(c, thread)

{ C_UDMI(c,thread,0) = C_T(c,thread); }

end_c_loop(c, thread)

}

RoM November 17, 2005 07:49

Re: Passing point data to UDF using C_UDMI
 
You cant acces values from postprocessing surfaces in udf. Where did you get that thread id from? To get a list of all surfaces/cell zones you can access by udf type //define/bc/lz in tui.

RoM

Sam Bennett November 22, 2005 06:59

Re: Passing point data to UDF using C_UDMI
 
Dear RoM,

I got the zone ID from the manage surfaces panel, it doesn't show up on the list you get when you type in //define/bc/lz.So I probably can't use a "point" from Fluent.

Is there any other way of accesing temperature from a position not on a boundry condition?

Thanks, Sam

RoM November 22, 2005 08:12

Re: Passing point data to UDF using C_UDMI
 
One possible way is to create a new fluid zone which holds only the cells you want to access. First you will need to mark these cells with the adapt->region panel. After you have marked your cells you can create a new fluid zone with grid->seperate->cells (save before). The new fluid zone is a boundary and will show up when you type //define/bc/lz. You can get its ID from there and use it in your udf. If you dont need the additional fluid zone anymore you can use grid->merge to merge it with your original fluid zone.

Good Luck, RoM

Sam Bennett November 23, 2005 11:50

Re: Passing point data to UDF using C_UDMI
 
Hi RoM, thanks for your suggestion. I tried doing that but got a (SEGMENTATION VIOLATION), the same as when I tried using a point ID. Any more suggestions?

RoM November 28, 2005 02:50

Re: Passing point data to UDF using C_UDMI
 
You can get the cell center corrdinates with the C_CENTROID macro and use it to pick the cells you want.

DEFINE_ADJUST(sensor_temp, domain)
{
cell_t c;
real c_cen[ND_ND]; /* cell center coordinates */
int ID = 15; /* fluid zone id */
Thread *thread = Lookup_Thread(domain, ID);

begin_c_loop(c, thread)
{
C_CENTROID(c_cen,c,thread); /* c_cen[0]=x, c_cen[1]=y, c_cen[2]=z */
if( /* pick cell, dependend on c_cen coords */ )
C_UDMI(c,thread,0) = C_T(c,thread);
else
C_UDMI(c,thread,0) = 0.;
}
end_c_loop(c, thread)
}

RoM

Sam Bennett December 1, 2005 09:46

Re: Passing point data to UDF using C_UDMI
 
Thanks RoM, I've sorted it out using a the cell centroid firdt to find th cell, and then later just using the number directly.Thanks again.

Sam


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