July 6, 2021 at 4:28 pm
Subscriber
if I understood you correclty.. I wrote two codes, both for DEFINE_ADJUST and DEFINE_PROFILE, but I still can't get it, could you help me?
This is the DEFINE_ADJUST code..
#include "udf.h"
DEFINE_ADJUST(outvalve,d)
{
Thread *t;
cell_t c;
real P=0.;
thread_loop_c(t,d)
{
begin_c_loop(c,t)
P = C_P(c,t);
end_c_loop(c,t)
}
printf("Pressure: %g\n", P);
}
.. and this is the DEFINE_PROFILE code
#include "udf.h"
DEFINE_PROFILE(outletvalve,t,i)
{
real P = C_P(c,t); /*pressure*/
real a; /*viscous resistance = 1/permeability*/
begin_c_loop(c,t)
{
if(P > 500000)
a = 1.0;
else
a = 1e12;
F_PROFILE(c,t,i) = a;
}
end_c_loop(c,t)
}
This is the DEFINE_ADJUST code..
#include "udf.h"
DEFINE_ADJUST(outvalve,d)
{
Thread *t;
cell_t c;
real P=0.;
thread_loop_c(t,d)
{
begin_c_loop(c,t)
P = C_P(c,t);
end_c_loop(c,t)
}
printf("Pressure: %g\n", P);
}
.. and this is the DEFINE_PROFILE code
#include "udf.h"
DEFINE_PROFILE(outletvalve,t,i)
{
real P = C_P(c,t); /*pressure*/
real a; /*viscous resistance = 1/permeability*/
begin_c_loop(c,t)
{
if(P > 500000)
a = 1.0;
else
a = 1e12;
F_PROFILE(c,t,i) = a;
}
end_c_loop(c,t)
}