CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   decreasing volume of solid area with time step (https://www.cfd-online.com/Forums/fluent-udf/221117-decreasing-volume-solid-area-time-step.html)

m.farisabadi October 5, 2019 02:21

decreasing volume of solid area with time step
 
hello



I'm new in udf so please help me to learn
i want to reform a solid domain with time step in 2D

which my fluid area is a 16*16 mm Square and my solid domain is 2*2
Square in middle of fluid area.
so i want to reform to decreasing solid area volume with time step.


this is my udf but i think there is some problems, my code doesn't compile in fluent.


i want to read every cell in every time step and decrease voulume of all cells of domain.
thanks for your help.





#include "udf.h"

DEFINE_GEOM(solid,domain,dt,position)
{
real vol,vol2;

Domain *domain;
Thread *c_thread;
thread_loop_c(c_thread, domain) /*loops over all cell threads in domain*/
{

cell_t c;
Thread*t;
vol=C_VOLUME(c,t);
if (vol<=0) vol2=0;
if (vol>0) vol2=vol-0.01*vol;
position[0]=vol2;
}

position[1]=position[0];
}

AlexanderZ October 15, 2019 07:50

Code:

#include "udf.h"

DEFINE_GEOM(solid,domain,dt,position)
{
real vol,vol2;
cell_t c;
Thread *t = DT_THREAD (dt);
thread_loop_c(t, domain) /*loops over all cell threads in domain*/
{
begin_c_loop(c, t)
{
vol=C_VOLUME(c,t);
if (vol<=0) vol2=0;
if (vol>0) vol2=vol-0.01*vol;
position[0]=vol2;
}
end_c_loop(c, t);
}
position[1]=position[0];
}


m.farisabadi October 15, 2019 13:41

Quote:

Originally Posted by AlexanderZ (Post 747088)
Code:

#include "udf.h"

DEFINE_GEOM(solid,domain,dt,position)
{
real vol,vol2;
cell_t c;
Thread *t = DT_THREAD (dt);
thread_loop_c(t, domain) /*loops over all cell threads in domain*/
{
begin_c_loop(c, t)
{
vol=C_VOLUME(c,t);
if (vol<=0) vol2=0;
if (vol>0) vol2=vol-0.01*vol;
position[0]=vol2;
}
end_c_loop(c, t);
}
position[1]=position[0];
 }



Thanks for your reply
i'm wonder how can i change the code for reading all faces area in a cell groups and changing those faces area.


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