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/)
-   -   Capillary diffusion (https://www.cfd-online.com/Forums/fluent-udf/215205-capillary-diffusion.html)

wuming February 26, 2019 03:57

Capillary diffusion
 
Hello everyone!
I am try to add Capillary force to porous media ,I made changes on the basis of CSF.https://www.cfd-online.com/Forums/me...re953-fvol.pngMultiply the volume fraction by Fvol,then add into the source term of each phase.The results show an increase in pressure but no change in liquid volume fraction.The capillary dispersion is not happen.I don't know why? Is my udf wrong.if you can tell me something,i will vervy thank you.
part of udf
DEFINE_ADJUST(adjust_gradient1, domain)
{
Thread *t;
cell_t c;
domain = Get_Domain(2);
/* Fill UDS with the variable. */
thread_loop_c(t, domain)
{
begin_c_loop(c, t)
{
C_UDSI(c, t, 0) = C_VOF(c, t);
C_UDMI(c, t, 4) = C_UDSI(c, t, 0);
}
end_c_loop(c, t)
}

}

DEFINE_ON_DEMAND(store_gradient1)
{
Domain *domain;
cell_t c;
Thread *t;
domain = Get_Domain(2);
/* Fill the UDM with magnitude of gradient. */
thread_loop_c(t, domain)
{
begin_c_loop(c, t)
{
C_UDMI(c, t, 5) = NV_MAG(C_UDSI_G(c, t, 0));
}
end_c_loop(c, t)
}
}

DEFINE_SOURCE(gas_phase_xmom_source, cell, t, dS, eqn)
{
real sigma, ttt, dp, a, dmin, Fvol, source;
cell_t c;
dp = 0.0016;
ttt = sqrt(3) / 3.14159 - 0.5;
dmin = sqrt(ttt)*dp;
a=C_UDMI(c, t, 9);
sigma = 0.07275 * 2 * pow(a, 0.33333)*1.108117;
Fvol = C_UDMI(c, t, 4) * sigma*(C_UDMI(c, t, 4)*1.225*dmin*C_UDMI(c, t, 5) + C_UDMI(c, t, 8)*998.2*dp*C_UDMI(c, t, 7)) / 0.5 / (998.2 + 1.225);
source = - Fvol;
dS[eqn] = 0;
return source;

}

annan February 26, 2019 07:16

Dear Wuming,

Did you check if all the UDMs you are using in Fvol are defined and have values that are different from zero ?

Did you define the store_gradient1 deliberately as a DEFINE_ON_DEMAND function ? This means that the gradient of your UDS is going to be store only if you manually run the store_gradient1 function in post-processing.

Best regards,
Annan

wuming February 26, 2019 08:22

Quote:

Originally Posted by annan (Post 726067)
Dear Wuming,

Did you check if all the UDMs you are using in Fvol are defined and have values that are different from zero ?

Did you define the store_gradient1 deliberately as a DEFINE_ON_DEMAND function ? This means that the gradient of your UDS is going to be store only if you manually run the store_gradient1 function in post-processing.

Best regards,
Annan

thank you ,when i calculate, I will let fluent calculate some steps,then use execute on demand load store_gradient1,the UDM are not zero, as i ask,my pressure is increase.

wuming February 27, 2019 20:37

Sorry, I made a mistake, but the reply could not be deleted, so I can only do this.

wuming February 27, 2019 20:39

Quote:

Originally Posted by wuming (Post 726073)
thank you ,when i calculate, I will let fluent calculate some steps,then use execute on demand load store_gradient1,the UDM are not zero, as i ask,my pressure is increase.

I know what you talk,the gradient is not change when case calculation,so how i should modify the udf,can make me get gradient of the Volume fraction,thank you

wuming February 27, 2019 20:42

Quote:

Originally Posted by annan (Post 726067)
Dear Wuming,

Did you check if all the UDMs you are using in Fvol are defined and have values that are different from zero ?

Did you define the store_gradient1 deliberately as a DEFINE_ON_DEMAND function ? This means that the gradient of your UDS is going to be store only if you manually run the store_gradient1 function in post-processing.

Best regards,
Annan

I know what you talk,the gradient is not change when case calculation,so how i should modify the udf,can make me get gradient of the Volume fraction,thank you

AlexanderZ February 27, 2019 21:28

Code:

Fvol = C_UDMI(c, t, 4) * sigma*(C_UDMI(c, t, 4)*1.225*dmin*C_UDMI(c, t, 5) + C_UDMI(c, t, 8)*998.2*dp*C_UDMI(c, t, 7)) / 0.5 / (998.2 + 1.225);
in your code C_UDMI(c, t, 4) is defined, but what about other UDMs?
C_UDMI(c, t, 5)
C_UDMI(c, t, 7)
C_UDMI(c, t, 8)
are they defined? where?

best regards

wuming February 27, 2019 21:44

Quote:

Originally Posted by AlexanderZ (Post 726320)
Code:

Fvol = C_UDMI(c, t, 4) * sigma*(C_UDMI(c, t, 4)*1.225*dmin*C_UDMI(c, t, 5) + C_UDMI(c, t, 8)*998.2*dp*C_UDMI(c, t, 7)) / 0.5 / (998.2 + 1.225);
in your code C_UDMI(c, t, 4) is defined, but what about other UDMs?
C_UDMI(c, t, 5)
C_UDMI(c, t, 7)
C_UDMI(c, t, 8)
are they defined? where?

best regards

in my code C_UDMI(c, t, 4) and C_UDMI(c, t, 5) are defined,and it's gas phase;C_UDMI(c, t, 7) and C_UDMI(c, t, 8) it's liquid phase


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