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

Ansys crashes when running UDF related to moisture content

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 12, 2022, 09:34
Default Ansys crashes when running UDF related to moisture content
  #1
New Member
 
louis
Join Date: Jan 2022
Posts: 1
Rep Power: 0
louis123 is on a distinguished road
We are currently using Ansys student version 19. We can compile and hook the UDF to Ansys but when we try to Initialize or run the calculation the Ansys set up crashes the error states that:

999999 mpt_accept ; error: accept failed: no error
999999 mpt_accept ; error: accept failed: no error
999999 mpt_accept ; error: accept failed: no error
999999 mpt_accept ; error: accept failed: no error
999999 mpt_accept ; error: accept failed: no error

The f1 process could not be started


We got this UDF code from a research paper: "The application of computational fluid dynamics codes to simulate heat and moisture transfer in stored grains"

#include "udf.h"
#define ACP 921.69
#define BCP 18.077
#define CCP 112.35
#define RHOB 639.2
#define PATM 101325
#define TMEAN 288.15
#define TAMP 5
int last_ts = -1;
DEFINE_INIT(initial_humidity, d)
{
real W, Tabs, TC, r, psat, p, w;
Thread *t;
cell_t c;
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;
r = exp(-ACP/(TC+CCP)*exp(-BCP*W));
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);
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);
pe = w*PATM/(0.622+w);
re = pe/psat;
We = -1/BCP*log(-(TC+CCP)/ACP*log(re));
drying_constant = 2000*exp(-5094/Tabs);
C_UDMI(c,t,3) = re;
C_UDMI(c,t,2) = We;
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;
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");

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);
pe = w*PATM/(0.622+w);
re = pe/psat;
We = -1/BCP*log(-(TC+CCP)/ACP*log(re));
Wnew = W+C_UDMI(c,t,1)*physical_dt/RHOB;
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;

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));
dpsatdt = psat/Tabs*(-5+6800/Tabs);
drdt = ACP*re/pow((TC+CCP),2)*exp(-BCP*We);
hsbyhv = 1+psat/re*1/dpsatdt*drdt;
hs = hsbyhv*(2501.33-2.363*TC)*1.0e3;
C_UDMI(c,t,4) = hs;
Source_t = C_UDMI(c,t,1)*hs;
dS[eqn] = 0.0;
return Source_t;
}
louis123 is offline   Reply With Quote

Old   January 13, 2022, 00:21
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 33
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
changes which are not related to your problem:
change physical_dt = RP_Get_Real("physical-time-step");
to
physical_dt = CURRENT_TIMESTEP;
printf to Message0

code must be compiled

did you allocate 5 user defined memory locations and 1 user defined scalar in Fluent GUI?

as the code is complicated I recommend to test your case with very simple UDF to check if everything is correct in your case settings:
Code:
#include "udf.h"
DEFINE_SOURCE(mass_source,c,t,dS,eqn)
{
return 0.01;
}
DEFINE_SOURCE(hygro_source,c,t,dS,eqn)
{
return 0.01;
}
0.01 is just a random value, you do better put something reasonable here.
if this simple code works well, add some parts of code and check if they work
__________________
best regards


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

Reply

Tags
ansys 19, crashing, udf and programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Error in UDF calling parameters from ANSYS WorkBench anand32 Fluent UDF and Scheme Programming 0 April 6, 2018 20:52
A CFX-POST error (ver 14.5.7) wangyflp88 CFX 2 July 22, 2017 01:17
ANSYS Licensing Problem, Processes Running but Showing as Not Running penguinman ANSYS 3 September 27, 2016 14:30
2-way FSI in Ansys CFX 15 LucasGasparino CFX 3 August 6, 2015 04:17
Problem related with UDF for dynamic mesh Ryan FLUENT 6 April 29, 2004 10:29


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