TAGGED: fluent, fluid-dynamics, udf, udf-fluent
-
-
September 3, 2021 at 11:17 am
ritwik
SubscriberI am modelling an adsorption model for a zeolite column. The UDF for mass source term is:
#include "udf.h"
int ads;
int domain_q_ads = 0;
int domain_d_ads = 1;
DEFINE_ADJUST(q_ads, domain)
{
   Thread *t;cell_t c; real dt;
   thread_loop_c(t,domain){
   begin_c_loop(c,t){
      dt = RP_Get_Real("physical-time-step")
      C_UDSI(c,t,0)=C_UDSI_M1(c,t,q_ads)
      +0,15*dt*(C_UDSI_M1(c,t,ads)-C_UDSI_M1(c,t,q_ads));}
   end_c_loop(c,t);}  Â
}
DEFINE_ADJUST(d_ads, domain)
{
   Thread *t; cell_t c;
   thread_loop_c(t,domain){
      begin_c_loop(c,t)
      {
         C_UDSI(c,t,1)=-0,532224*0,15*
         (C_UDSI(c,t,ads)-C_UDSI(c,t,q_ads));}
      end_c_loop(c,t);
   }  Â
}
DEFINE_SOURCE(m_src,c,t,dS,eqn)
{
   dS[eqn] = 0,0;
   return C_UDSI_M1(c,t,d_ads);
}
When i try to compile, the console shows this error and the fluent window stopped working. I am allocating 2 memory location for UDM.
September 3, 2021 at 11:49 amDrAmine
Ansys EmployeeLook carefully into the lines where you want to access the previous time step results..
September 3, 2021 at 11:51 amDrAmine
Ansys EmployeeAnd ensure you are defining two UDS's.
September 3, 2021 at 12:06 pmSeptember 3, 2021 at 12:09 pmritwik
SubscriberI am not understanding. I am new to the fluent and udfs. Can you please elaborate?
Thank you
September 3, 2021 at 12:16 pmDrAmine
Ansys EmployeeSo then please go through the Customization Manual and if possible a couple of Self paced Training on the Ansys Learning Hub.
Another Hint: what is q_ads? Is it defined somewhere?
September 6, 2021 at 7:19 amritwik
Subscriber#include "udf.h"
int i;
/*Adsorption*/
DEFINE_ADJUST(adsorption,d)
{
Thread*t; cell_t c; real E,A,P;
thread_loop_c(t,d)
{
begin_c_loop (c,t)
{
real tem=C_T(c,t);
P=C_P(c,t)+RP_Get_Real("operating-pressure");
E=3080+18,9*tem;
A=8,31429*tem*log(1.47E9/P);
C_UDSI(c,t,i)=71.6*exp(-A*A/(E*E));
}
end_c_loop(c,t)
}
}
DEFINE_ADJUST(q_ads, d)
{
Thread *t;cell_t c; real dt;
thread_loop_c(t,d){ /*q_ads is the UDF name i am defining*/
begin_c_loop(c,t){
dt = RP_Get_Real("physical-time-step")/*int i is number of UDS*/
C_UDSI(c,t,i)=C_UDSI(c,t,i)+0.15.*dt*(C_UDSI(c,t,i)-C_UDSI(c,t,i));}
end_c_loop(c,t)
}
}
I am allocating 2 UDS and 4 UDM
After go through the manual, i modified the UDF. Can you please tell me, where i have gone wrong?
September 6, 2021 at 9:12 amDrAmine
Ansys Employeei is undefined for UDS. It should be 0, 1 2 etc. to refer to the proper UDS.
September 6, 2021 at 9:59 amritwik
Subscriber#include "udf.h"
int i;
DEFINE_ADJUST(adsorption,d)
{
Thread*t; cell_t c; real E,A,P;
thread_loop_c(t,d)
{
begin_c_loop (c,t)
{
real tem=C_T(c,t);
P=C_P(c,t)+RP_Get_Real("operating-pressure");
E=3080+18,9*tem;
A=8,31429*tem*log(1.47E9/P);
C_UDSI(c,t,0)=71.6*exp(-A*A/(E*E));
}
end_c_loop(c,t)
}
}
DEFINE_ADJUST(q_ads, d)
{
Thread *t;cell_t c; real dt;
thread_loop_c(t,d){
begin_c_loop(c,t){
dt = RP_Get_Real("physical-time-step")
C_UDSI(c,t,0)=C_UDSI_M1(c,t,i)
+0.15.*dt*(C_UDSI_M1(c,t,0)-C_UDSI_M1(c,t,1));}
end_c_loop(c,t)
}
}
I have changed it.
But same problem is coming.
September 6, 2021 at 10:14 amRob
Forum ModeratorYou've not defined a few of the variables (REAL, INTEGER etc) and I wonder if using a comma is permitted in C, you might need a full stop for a decimal. As you're using 2021 compile the code with the built in compiler: if nothing else it'll give us a better idea if the code is OK.
September 6, 2021 at 12:03 pmDrAmine
Ansys EmployeeAgain your UDS and index. Check what Fluent reports when compiling.
September 13, 2021 at 1:38 pmritwik
Subscriberwhen i tried to compile the udf
The udf is:
#include "udf.h"
int ads;
real C1;
/*Adsorption*/
DEFINE_ADJUST(adsorption,domain){
Thread*t; cell_t c; real E,A,P;
thread_loop_c(t,domain){
begin_c_loop (c,t){
real tem=C_T(c,t);
P=C_P(c,t)+RP_Get_Real("operating-pressure");
E=3080+18,9*tem;
A=8,31429*tem*log(1.47E9/P);
C_UDSI(c,t,0)=71.6*exp(-A*A/(E*E));
C1 = C_UDSI(c,t,0);}
end_c_loop(c,t)}
}
/*Mass source term*/
DEFINE_ADJUST(q_ads, domain)
{
Thread *t;cell_t c; real dt;
thread_loop_c(t,domain){
begin_c_loop(c,t){
dt = RP_Get_Real("physical-time-step")
C_UDSI(c,t,0)=C_UDSI(c,t,0)
+0,15*dt*(C1-C_UDSI(c,t,0));}
end_c_loop(c,t);}
this error is showing.
Can you please help me? What is this error meant?
March 24, 2022 at 10:39 pmSecorreaz
SubscriberIn the end your udf was able to compile correctly.??
March 28, 2022 at 9:39 amritwik
SubscriberThis udf was not compiled, I have to modified in order to get compiled succesfully
March 28, 2022 at 12:41 pmDrAmine
Ansys Employee.
March 29, 2022 at 2:27 pmSecorreaz
SubscriberAnd did you manage to modify it to run successfully or did you abandon the work?
April 1, 2022 at 7:12 amritwik
SubscriberNo, It is running successfully
April 11, 2023 at 10:36 ammechE
SubscriberRitwik, can you please share how did you resolve the problem?
October 12, 2023 at 11:21 amAmani Chouat
Subscriberi work in the some problem , (adsoptive hydrogen storage using Udf) , how did you resolve the problem please ,
Ps:i don't have much idea about UDFÂ
Viewing 18 reply threads- The topic ‘Regarding UDF’ is closed to new replies.
Ansys Innovation SpaceTrending discussionsTop Contributors-
3492
-
1057
-
1051
-
965
-
942
Top Rated Tags© 2025 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-