CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   Change cell zone index/thread during simulation (https://www.cfd-online.com/Forums/fluent/83982-change-cell-zone-index-thread-during-simulation.html)

neilduffy1024 January 17, 2011 09:40

Change cell zone index/thread during simulation
 
Hi,

I am modelling a shrinking porous zone within a fluid zone. The porous zone will be shrinking as the simulation proceeds. The porosity change is both time and space dependent and will change from 0 to 1 during the simulation. Cells nearest the fluid-porous interface will reach 1 the quickest.

Basically, when the porosity in a cell reaches 1 I want to change the cell zone index to that of the fluid zone. This will effectively cause the porous zone to shrink. I realise I could just change the momentum sinks to 0 which would basically do the same thing but this approach is necessary as I want to be able to distinguish between the porous and fluid threads in order to implement a reaction on the surface of the porous zone. I have tried the following but it hasn't worked:


static int porous_zone_ID = 6; /*points to the porous thread*/
static int fluid_zone_ID = 5; /*points to the fluid thread*/

DEFINE_ADJUST(adjust_thread, domain)
{
cell_t c;
Thread *tp; /*pointer to porous zone thread*/
Thread *tf; /*pointer to fluid zone thread*/
int zone_ID;
real x[ND_ND];

tp = Lookup_Thread(domain, porous_zone_ID);
tf = Lookup_Thread(domain, fluid_zone_ID);

begin_c_loop_int (c, tp)
{
if (C_UDMI(c,tp,0) = 1.0) /*the porosity in each cell has been stored in UDM 0 from a different UDF*/
{
zone_ID = THREAD_ID(tf); /*should change the cell zone to that of the fluid zone*/
/*Note: the macro above is the opposite to the lookup thread macro*/
}
}
end_c_loop_int (c,tp)
}



I have also tried hardcoding the zone_ID (i.e. zone_ID = 5), but this hasn't worked either. It appears that the zone_ID macro doesn't change the index in the solver but can only call it.

Has anyone got any ideas? It'd be much appreciated.

Thanks,

Neil


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