
[Sponsors] 
May 15, 2019, 09:01 
student need your help

#1 
New Member
James Thor
Join Date: May 2019
Posts: 13
Rep Power: 6 
Can anyone help me? This program can't run on my model. There are no errors in the program.
/*ErosionTabakoff.C*/ #include "udf.h" #include "dpm.h" #define bv 2.41 Domain *domain; enum{ NUM_OF_HITS,AVG_DIAMETER,AVG_ALPHA,AVG_VMAG,AVG_MD OT, MAX_ALPHA, MIN_ALPHA, NUM_OF_USED_UDM }; int UDM_checked=0; void reset_UDM_s(void); int check_for_UDM(void) { Thread *t; if(UDM_checked) return UDM_checked; thread_loop_c(t,domain) { if(FLUID_THREAD_P(t)) if(NULLP(THREAD_STORAGE(t,SV_UDM_I))) return 0; } UDM_checked=1; reset_UDM_s(); return UDM_checked; } void reset_UDM_s(void) { Thread *t;cell_t c; face_t f; int i; if (!check_for_UDM()) return; Message ("Resetting User Defined Memory...\n"); thread_loop_f(t,domain) { if(NNULLP(THREAD_STORAGE(t,SV_UDM_I))) { begin_f_loop(f,t) { for(i=0;i<NUM_OF_USED_UDM;i++) F_UDMI(f,t,i)=0.; } end_f_loop(f,t) } else { Message("Skipping FACE thread no. %d..\n",THREAD_ID(t)); } } thread_loop_c(t,domain) { if(NNULLP(THREAD_STORAGE(t,SV_UDM_I))) { begin_c_loop(c,t) { for(i=0;i<NUM_OF_USED_UDM;i++)C_UDMI(c,t,i)=0.; } end_c_loop(c,t) } else { Message("Skipping CELL thread no. %d..\n",THREAD_ID(t)); } } Message("Done.\n"); } DEFINE_DPM_SCALAR_UPDATE(dpm_scalup,c,t,if_init,p) { if(if_init) P_USER_REAL(p,0)=0; } DEFINE_DPM_EROSION(dpm_erosion,p,t,f,normal,alpha, Vmag,Mdot) { real A[ND_ND],area; int num_in_data; Thread *t0;cell_t c0; real R; if(!UDM_checked) if(!check_for_UDM()) return;c0=F_C0(f,t); t0=THREAD_T0(t); num_in_data=F_UDMI(f,t,NUM_OF_HITS); if(num_in_data==0) { F_UDMI(f,t,MAX_ALPHA)=alpha;C_UDMI(c0,t0,MAX_ALPHA )=F_UDMI(f,t,MAX_ALPHA); F_UDMI(f,t,MIN_ALPHA)=alpha;C_UDMI(c0,t0,MIN_ALPHA )=F_UDMI(f,t,MIN_ALPHA); } if(num_in_data>0) { if(alpha>F_UDMI(f,t,MAX_ALPHA)) { F_UDMI(f,t,MAX_ALPHA)=alpha;C_UDMI(c0,t0,MAX_ALPHA )=F_UDMI(f,t,MAX_ALPHA); } if(alpha<F_UDMI(f,t,MIN_ALPHA)) { F_UDMI(f,t,MIN_ALPHA)=alpha;C_UDMI(c0,t0,MIN_ALPHA )=F_UDMI(f,t,MIN_ALPHA); } } F_UDMI(f,t,AVG_DIAMETER)=(P_DIAM(p)+num_in_data*F_ UDMI(f,t,AVG_DIAMETER))/(num_in_data+1);C_UDMI(c0,t0,AVG_DIAMETER)=F_UDMI( f,t,AVG_DIAMETER); F_UDMI(f,t,AVG_ALPHA)=(alpha+num_in_data*F_UDMI(f, t,AVG_ALPHA))/(num_in_data+1);C_UDMI(c0,t0,AVG_ALPHA)=F_UDMI(f,t ,AVG_ALPHA); F_UDMI(f,t,AVG_VMAG)=(Vmag+num_in_data*F_UDMI(f,t, AVG_VMAG))/(num_in_data+1);C_UDMI(c0,t0,AVG_VMAG)=F_UDMI(f,t, AVG_VMAG); F_UDMI(f,t,AVG_MDOT)=(Mdot+num_in_data*F_UDMI(f,t, AVG_MDOT))/(num_in_data+1);C_UDMI(c0,t0,AVG_MDOT)=F_UDMI(f,t, AVG_MDOT); F_UDMI(f,t,NUM_OF_HITS)=num_in_data+1;C_UDMI(c0,t0 ,NUM_OF_HITS)=num_in_data+1; R=10.0016* Vmag*sin(alpha); if(alpha<=60) F_STORAGE_R(f,t,SV_DPMS_EROSION)+=1.505*pow(10,6)*pow((1+0.296*sin(4.5*alpha)),2)*pow(Vmag,2)*cos (1R*R)+5.0*pow(10,12)*pow(Vmag,4)*pow(sin(alpha),4); else F_STORAGE_R(f,t,SV_DPMS_EROSION)+=1.505*pow(10,6)*pow(Vmag,2)*cos(1R*R)+5.0*pow(10,12)*pow(Vmag,4)*pow(sin(alpha),4); P_USER_REAL(p,0)=1.; } DEFINE_DPM_LAW(stop_dpm_law,p,if_cpld) { if(0.<P_USER_REAL(p,0)) P_MASS(p)=0.; } DEFINE_ON_DEMAND(reset_UDM) { domain=Get_Domain(1); reset_UDM_s(); } 

May 15, 2019, 22:42 

#2  
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,259
Rep Power: 33 
Quote:
best regards 

May 16, 2019, 00:23 
Thank you for your reply. There's a problem here.

#3  
New Member
James Thor
Join Date: May 2019
Posts: 13
Rep Power: 6 
Quote:
https://www.cfdonline.com/Forums/at...1&d=1557980543[IMG] 

May 16, 2019, 00:45 

#4 
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,259
Rep Power: 33 
Did you allocate memory for userdefined memories (UDMs)?
This error may come from our code as well as in model settings, I recommend you to perform simulation without UDF first using default erosion model Also you may try to use code from manual (Ansys Fluent Customization manual) best regards 

May 16, 2019, 01:22 

#5  
New Member
James Thor
Join Date: May 2019
Posts: 13
Rep Power: 6 
Quote:


May 16, 2019, 02:06 

#6 
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,259
Rep Power: 33 
in Fluent GUI go to UserDefined > Memories > set number of userdefined memory location to 8.
It seems in your UDF you are using 8, so 8 is enough. best regards 

May 16, 2019, 06:09 

#7  
New Member
James Thor
Join Date: May 2019
Posts: 13
Rep Power: 6 
Quote:
https://www.cfdonline.com/Forums/at...1&d=1558001348 

May 16, 2019, 10:51 

#8  
New Member
James Thor
Join Date: May 2019
Posts: 13
Rep Power: 6 
Quote:
I used a new program that allowed me to calculate, but the result of the erosion rate was 0. The procedure is as follows #include "udf.h" #define MIN_IMPACT_VELO 1000. /* Minimum particle velocity normal to wall (m/s) to allow Accretion.*/ Domain *domain; /* Get the domain pointer and assign it later to domain*/ enum /* Enumeration of used UserDefined Memory Locations. */ { NUM_OF_HITS, /* Number of particle hits into wall face considered.*/ AVG_DIAMETER, /* Average diameter of particles that hit the wall. */ AVG_RADI_VELO, /* Average radial velocity of "" ""  */ NUM_OF_USED_UDM }; void reset_UDM_s(void) { Thread *t; cell_t c; face_t f; int i; Message("Resetting User Defined Memory...\n"); thread_loop_f(t, domain) { if (NNULLP(THREAD_STORAGE(t,SV_UDM_I))) { begin_f_loop(f,t) { for (i = 0; i < NUM_OF_USED_UDM; i++) F_UDMI(f,t,i) = 0.; } end_f_loop(f, t) } else { Message("Skipping FACE thread no. %d..\n", THREAD_ID(t)); } } thread_loop_c(t,domain) { if (NNULLP(THREAD_STORAGE(t,SV_UDM_I))) { begin_c_loop(c,t) { for (i = 0; i < NUM_OF_USED_UDM; i++) C_UDMI(c,t,i) = 0.; } end_c_loop(c,t) } else { Message(" Skipping CELL thread no. %d..\n", THREAD_ID(t)); } } /* Skipping Cell Threads can happen if the user */ /* uses reset_UDM prior to initializing. */ Message("  Done.\n"); } DEFINE_DPM_EROSION(dpm_erosion,tp,t,f,normal,alpha ,Vmag,Mdot) { real A[ND_ND],area; Thread *t0;cell_t c0; real R; real Vmag; real alpha; real mdot; c0=F_C0(f,t); t0=THREAD_T0(t); R=10.0016* Vmag*sin(alpha); if(alpha<=60) F_STORAGE_R (f,t,SV_DPMS_ACCRETION)+=1.505*pow(10,6)*pow((1+0.296*sin(4.5*alpha)),2)*pow(Vmag,2)*cos (1R*R)+5.0*pow(10,12)*pow(Vmag,4)*pow(sin(alpha),4); else F_STORAGE_R (f,t,SV_DPMS_ACCRETION)+=1.505*pow(10,6)*pow(Vmag,2)*cos(1R*R)+5.0*pow(10,12)*pow(Vmag,4)*pow(sin(alpha),4); } DEFINE_ON_DEMAND(reset_UDM) { domain=Get_Domain(1); reset_UDM_s(); } 

May 17, 2019, 00:13 

#9 
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,259
Rep Power: 33 
remove floowing lines
real Vmag; real alpha; real mdot; read your code best regards 

May 17, 2019, 02:13 

#10 
New Member
James Thor
Join Date: May 2019
Posts: 13
Rep Power: 6 

May 17, 2019, 03:05 

#12 
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,259
Rep Power: 33 
as I told you:
as a first step I recommend you to perform simulation without UDF, using default erosion model. This will show if the problem comes from UDF or just from model settings As a next step you may try to use code from manual (Ansys Fluent Customization manual) And finally use your code best regards 

June 29, 2021, 22:50 

#13 
New Member
WEIZHENJIANG
Join Date: Jun 2021
Posts: 1
Rep Power: 0 
Is the problem solved?


Tags 
code, erosion, program, udf 
Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Importing Solid Edge files into ANSYS student  dbh0006  ANSYS  0  March 22, 2019 16:05 
Student license?  federernadal  CFX  3  February 14, 2019 10:26 
Need some information about ANSYS student version license approval  Rajaero  Main CFD Forum  2  August 5, 2018 23:49 
help for a simple student  harika  FLUENT  6  January 10, 2006 00:18 
Student looking for CFD software  Chris  Main CFD Forum  6  January 21, 2005 03:20 