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

UDF-Simulation of moisture transport in drying

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 13, 2021, 12:04
Default UDF-Simulation of moisture transport in drying
  #1
New Member
 
John
Join Date: Dec 2021
Posts: 3
Rep Power: 4
milankjohn is on a distinguished road
Please help:

I am trying to simulate the drying of particles in a chamber. For this purpose, I am using a UDF for mass and energy source terms. While interpreting the function, no errors are displayed. However, while initializing the solution I get an error "received a fatal signal (Segmentation fault)".


There is also a warning which points out three lines in the UDF functions. Those lines are as follows:


real Tabs, TC, W, w, pe, re, drebydpe, We, Source_w, psat,drying_constant;

real Tabs,TC,physical_dt,W, We, w, pe, re,Wnew,psat;

real pe, re, We, we, dwsebydt, Source_t;

Note: I am using Fluent 18. in serial mode, double precision
milankjohn is offline   Reply With Quote

Old   December 13, 2021, 13:12
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
These lines are not enough info to find the problem.
It's better to give the full code.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   December 14, 2021, 04:15
Default UDF code
  #3
New Member
 
John
Join Date: Dec 2021
Posts: 3
Rep Power: 4
milankjohn is on a distinguished road
Dear Friend, Please see the full code for moisture transport

#include "udf.h"

/* Chung-Pfost constants */
#define ACP 921.69
#define BCP 18.077
#define CCP 112.35
#define RHOB 639.2
#define PATM 101325
/* Define ambient temperature conditions */
#define TMEAN 288.15
#define TAMP 5
/* Define a global variable that acts as a */
/* comparitor in DEFINE_ADJUST */
int last_ts = -1;
DEFINE_INIT(moisure_init,d)
/* The initial solids moisture content, W, is set */
/* and the corresponding humidity, w, of the */
/* intergranular air is calculated */
{
cell_t c;
Thread *t;
real W,Tabs,TC,r,psat,p,w;
/* Loop over all of the cell threads in the bulk of grain */
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,0) = 0.1364;
W = C_UDMI(c,t,0);
Tabs = C_T(c,t);
TC = Tabs-273.15;
/* Calculate relative humidity of intergranular air, Eqn 11. */
r = exp(-ACP/(TC+CCP)*exp(-BCP*W));
/* Ensure the air does not become supersaturated */
if(r>0.99)
{r = 0.99;}
psat = 6.0e25/pow(Tabs,5) *exp(-6800/Tabs);
p = r*psat;
w = 0.622*p/(PATM-p); /* Eqn 12 */
C_UDSI(c,t,0) = w;
}
end_c_loop(c,t);
}
}
DEFINE_SOURCE(mass_source,c,t,dS,eqn)
{
real Tabs, TC, W, w, pe, re, drebydpe, We, Source_w, psat,drying_constant;
Tabs = C_T(c,t);
TC = Tabs-273.15;
psat = 6.0e25/pow(Tabs,5) *exp(-6800/Tabs);
W = C_UDMI(c,t,0);
w = C_UDSI(c,t,0);
/* The post-fix ‘e’ denotes variables that relate to the equilibrium moisture content,
We.
*/
pe = w*PATM/(0.622+w);
re = pe/psat;
We = -1/BCP*log(-(TC+CCP)/ACP*log(re)); /* Eqn 6 */
drying_constant = 2000*exp(-5094/Tabs); /* Eqn 5 */
C_UDMI(c,t,3) = re;
C_UDMI(c,t,2) = We;
/* Eqn3: */
C_UDMI(c,t,1) = -RHOB*drying_constant*(W-We);
Source_w = -C_UDMI(c,t,1);
dS[eqn] = 0.0;
return Source_w;
}
DEFINE_ADJUST(update_mc,d)
{
real Tabs,TC,physical_dt,W, We, w, pe, re,Wnew,psat;
cell_t c;
Thread *t;
/* The integer time step count (accessed using N_TIME) */
/* is useful in DEFINE_ADJUST functions for detecting */

/* whether the current iteration is the first in the */
/* time step. */
int curr_ts;
curr_ts = N_TIME;
if (last_ts != curr_ts)
{
last_ts = curr_ts;
printf ("ADJUST: iteration = %d , = = = =\n", curr_ts);
physical_dt = RP_Get_Real("physical-time-step");
/* Loop over all of the cell threads in the porous region */
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
Tabs = C_T(c,t);
TC = Tabs-273.15;
psat = 6.0e25/pow(Tabs,5) *exp(-6800/Tabs);
W = C_UDMI(c,t,0);
w = C_UDSI(c,t,0);
/* The post-fix ‘e’ denotes variables that relate to the equilibrium moisture content,
We
*/
pe = w*PATM/(0.622+w); /* Eqn 7 */
re = pe/psat;
We = -1/BCP*log(-(TC+CCP)/ACP*log(re)); /* Eqn 6 */
Wnew = W+C_UDMI(c,t,1)*physical_dt/RHOB;/* Eqn 10 */
W = Wnew;
C_UDMI(c,t,0) = W;
}
end_c_loop(c,t)
}
}
}
DEFINE_SOURCE(hygro_source,c,t,dS,eqn)
{
real Tabs, TC, w, psat, dpsatdt, drdt, hsbyhv, hs;
real pe, re, We, we, dwsebydt, Source_t;
/* The post-fix ‘e’ denotes variables that relate to the equilibrium moisture content,
We,
*/
Tabs = C_T(c,t);
TC = Tabs-273.15;
we = C_UDSI(c,t,0);
psat = 6.0e25/pow(Tabs,5) *exp(-6800/Tabs);
pe = we*PATM/(0.622+we);
re = pe/psat;
We = -1/BCP*log(-(TC+CCP)/ACP*log(re));/* Eqn 6 */
dpsatdt = psat/Tabs*(-5+6800/Tabs); /* see Eqn 16 */
drdt = ACP*re/pow((TC+CCP),2)*exp(-BCP*We); /*Eqn 17 */
hsbyhv = 1+psat/re*1/dpsatdt*drdt; /* Eqn 15 */
hs = hsbyhv*(2501.33-2.363*TC)*1.0e3;
C_UDMI(c,t,4) = hs;
Source_t = C_UDMI(c,t,1)*hs;/* Eqn 14 */
dS[eqn] = 0.0;
return Source_t;
}
milankjohn is offline   Reply With Quote

Old   December 14, 2021, 07:17
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
did you allocate memory for UDMS and UDS?
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   December 14, 2021, 13:33
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
Initialize without this UDF. Your source tries to read temperature, but during initialization it is not set yet.
__________________
"The UDF library you are trying to load (libudf) is not compiled for parallel use on the current platform" is NOT the error after compiling. It is the error after loading. To see compiler errors, look at your screen after you click "build".
pakk is offline   Reply With Quote

Old   December 22, 2021, 06:08
Thumbs up reply
  #6
New Member
 
John
Join Date: Dec 2021
Posts: 3
Rep Power: 4
milankjohn is on a distinguished road
Thank you, Alexander and pakk for your suggestions.
milankjohn is offline   Reply With Quote

Reply


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
UDF species transport qntldoql Fluent Multiphase 1 June 5, 2021 22:25
Moisture diffusion by species transport between air and porous desiccants jas123 FLUENT 1 April 14, 2019 13:51
UDF Parse Error - Initializing VOF for Multiphase Simulation denbjornen Fluent UDF and Scheme Programming 0 April 25, 2018 02:07
Terminate transient simulation with UDF Saman95 Fluent UDF and Scheme Programming 2 April 16, 2018 04:57
URGENT - Simulation setup using Reynolds Tensor Transport (R) - OpenFOAM beluiz93 OpenFOAM 1 December 2, 2016 06:51


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