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

Car fire in an underground park - Simulate a temperature sensor

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 5, 2010, 19:11
Default Car fire in an underground park - Simulate a temperature sensor
  #1
New Member
 
Join Date: Nov 2009
Posts: 8
Rep Power: 7
psc3 is on a distinguished road
Dear All,

I need to simulate a car fire in an underground park and I've got a problem.

I want to simulate a temperature sensor that starts a momentum source when the temperature reaches a specific value.

I think the best way to simulate it is to create a UDF that starts the momentum source when the temperature at the cell x is at a temperature T.

Something like, if C_T(cell,thread)==T we have momentum. Else no.

Is it possible for me to identify a certain cell in order to establish this condition?

If not, does anyone have an alternative for me?

Thanks in advance!!!

Pedro
psc3 is offline   Reply With Quote

Old   March 8, 2010, 03:47
Default
  #2
Senior Member
 
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 106
Rep Power: 7
gearboy is on a distinguished road
Quote:
Originally Posted by pedroscosta View Post
Dear All,

I need to simulate a car fire in an underground park and I've got a problem.

I want to simulate a temperature sensor that starts a momentum source when the temperature reaches a specific value.

I think the best way to simulate it is to create a UDF that starts the momentum source when the temperature at the cell x is at a temperature T.

Something like, if C_T(cell,thread)==T we have momentum. Else no.

Is it possible for me to identify a certain cell in order to establish this condition?

If not, does anyone have an alternative for me?

Thanks in advance!!!

Pedro
Maybe you can use the coordinate to judge which the right cell is.
The simplest scheme is to use the cell whose distance to your specified location is the least. Of course, this is not a very concise scheme if your grid is not fine enough.
gearboy is offline   Reply With Quote

Old   March 8, 2010, 06:54
Default
  #3
New Member
 
Join Date: Nov 2009
Posts: 8
Rep Power: 7
psc3 is on a distinguished road
Quote:
Originally Posted by gearboy View Post
Maybe you can use the coordinate to judge which the right cell is.
The simplest scheme is to use the cell whose distance to your specified location is the least. Of course, this is not a very concise scheme if your grid is not fine enough.
Thanks for your suggestion!

I'll try it.

Pedro
psc3 is offline   Reply With Quote

Old   March 12, 2010, 00:38
Default
  #4
Senior Member
 
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 106
Rep Power: 7
gearboy is on a distinguished road
Quote:
Originally Posted by pedroscosta View Post
Dear All,

I need to simulate a car fire in an underground park and I've got a problem.

I want to simulate a temperature sensor that starts a momentum source when the temperature reaches a specific value.

I think the best way to simulate it is to create a UDF that starts the momentum source when the temperature at the cell x is at a temperature T.

Something like, if C_T(cell,thread)==T we have momentum. Else no.

Is it possible for me to identify a certain cell in order to establish this condition?

If not, does anyone have an alternative for me?

Thanks in advance!!!

Pedro
Here is the example, Note: the location of the specified point must be in the computational domain, otherwise error will occur.

#include "udf.h"
DEFINE_ON_DEMAND(find_cell)
{
cell_t c;
Thread *t;
CX_Cell_Id cx_cell;
real NV_VEC(pt);
real c_centroid[ND_ND];
NV_D(pt, =, 0.5, 0.3, 0.2); //coordinate of your specified location,it must be in the domain coordinate range
CX_Start_ND_Point_Search();
cx_cell=*CX_Find_Cell_With_Point(pt);
CX_End_ND_Point_Search();
c=RP_CELL(&cx_cell); //the right cell number
t = RP_THREAD(&cx_cell); // the thread
C_CENTROID(c_centroid,c,t);
Message0("coordinate of the specified point: x=%g,y=%g,z=%g\n",pt[0],pt[1],pt[2]);
Message0("coordinate of the cell found: x=%g,y=%g,z=%g\n",c_centroid[0],c_centroid[1],c_centroid[2]);
}
gearboy is offline   Reply With Quote

Old   March 12, 2010, 15:48
Default
  #5
New Member
 
Join Date: Nov 2009
Posts: 8
Rep Power: 7
psc3 is on a distinguished road
Quote:
Originally Posted by gearboy View Post
Here is the example, Note: the location of the specified point must be in the computational domain, otherwise error will occur.

#include "udf.h"
DEFINE_ON_DEMAND(find_cell)
{
cell_t c;
Thread *t;
CX_Cell_Id cx_cell;
real NV_VEC(pt);
real c_centroid[ND_ND];
NV_D(pt, =, 0.5, 0.3, 0.2); //coordinate of your specified location,it must be in the domain coordinate range
CX_Start_ND_Point_Search();
cx_cell=*CX_Find_Cell_With_Point(pt);
CX_End_ND_Point_Search();
c=RP_CELL(&cx_cell); //the right cell number
t = RP_THREAD(&cx_cell); // the thread
C_CENTROID(c_centroid,c,t);
Message0("coordinate of the specified point: x=%g,y=%g,z=%g\n",pt[0],pt[1],pt[2]);
Message0("coordinate of the cell found: x=%g,y=%g,z=%g\n",c_centroid[0],c_centroid[1],c_centroid[2]);
}
1000 thanks, now I know how to use cx_find_cell_with_point!
psc3 is offline   Reply With Quote

Old   May 15, 2010, 08:34
Default
  #6
New Member
 
Join Date: Nov 2009
Posts: 8
Rep Power: 7
psc3 is on a distinguished road
just replace

real NV_VEC(pt); to float NV_VEC(pt);

Pedro
psc3 is offline   Reply With Quote

Old   January 3, 2011, 22:14
Default
  #7
New Member
 
Gang Gang
Join Date: Dec 2010
Posts: 1
Rep Power: 0
ganggang is on a distinguished road
Quote:
Originally Posted by gearboy View Post
Here is the example, Note: the location of the specified point must be in the computational domain, otherwise error will occur.

#include "udf.h"
DEFINE_ON_DEMAND(find_cell)
{
cell_t c;
Thread *t;
CX_Cell_Id cx_cell;
real NV_VEC(pt);
real c_centroid[ND_ND];
NV_D(pt, =, 0.5, 0.3, 0.2); //coordinate of your specified location,it must be in the domain coordinate range
CX_Start_ND_Point_Search();
cx_cell=*CX_Find_Cell_With_Point(pt);
CX_End_ND_Point_Search();
c=RP_CELL(&cx_cell); //the right cell number
t = RP_THREAD(&cx_cell); // the thread
C_CENTROID(c_centroid,c,t);
Message0("coordinate of the specified point: x=%g,y=%g,z=%g\n",pt[0],pt[1],pt[2]);
Message0("coordinate of the cell found: x=%g,y=%g,z=%g\n",c_centroid[0],c_centroid[1],c_centroid[2]);
}

I have place the above program in UDF and replace with float NV_VEC(pt). But it always remind that there is an assignment error in cx_cell=*CX_Find_Cell_With_Point(pt); I don't konw why and beg your instructions.
ganggang is offline   Reply With Quote

Old   March 12, 2012, 10:48
Default
  #8
New Member
 
JH
Join Date: Jan 2012
Posts: 4
Rep Power: 5
Seppl is on a distinguished road
Hello I get the following error:

Quote:
..\..\src\find.c(14) : error C2100: illegal indirection
..\..\src\find.c(14) : error C2440: '=' : cannot convert from 'int' to 'CX_Cell_Id'
I just copied the code above and line 14 is:

Quote:
cx_cell=*CX_Find_Cell_With_Point(pt);


Can anyone please say what the problem is?
Seppl is offline   Reply With Quote

Old   August 8, 2012, 16:54
Default
  #9
New Member
 
Bradley J
Join Date: Jul 2012
Location: Cincinnati, OH
Posts: 12
Rep Power: 5
Blackhawks84 is on a distinguished road
Quote:
Originally Posted by Seppl View Post
Hello I get the following error:



I just copied the code above and line 14 is:



Can anyone please say what the problem is?
I have the same problem, does anyone know the solution???
Blackhawks84 is offline   Reply With Quote

Old   June 9, 2014, 06:16
Default
  #10
Member
 
Join Date: Jul 2013
Posts: 70
Rep Power: 4
upeksa is on a distinguished road
I know this is an old post, but I have faced the same problem as Blackhawks84 and Seppl.

Can anybody help me?

Cheers
upeksa 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
Car park ventilation and impulse fans guillaume Phoenics 8 February 8, 2013 02:29
Car park ventilation and impulse fans guillaume FLUENT 3 June 27, 2011 11:17
Car park ventilation and impulse fans guillaume Main CFD Forum 12 June 27, 2011 11:16
Car park ventilation and impulse fans guillaume CFX 0 May 11, 2008 19:59


All times are GMT -4. The time now is 12:40.