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

I'm having problems with my UDF code

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 24, 2022, 16:51
Default I'm having problems with my UDF code
  #1
New Member
 
Sergio Andres Correa Zea
Join Date: Feb 2022
Posts: 2
Rep Power: 0
secorreaz is on a distinguished road
I'm having problems with my UDF code and I'm getting an error saying "non-integer subscript expression: function returning void". The error appears in this line "C_UDMI(c,t,q_ads) = (C_UDSI_M1(c,t,q_ads))+(0.15)dt((C_UDSI_M1(c,t,ads ))-(C_UDSI_M1(c,t,q_ads)));"
Code:
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_UDMI(c,t,q_ads) = (C_UDSI_M1(c,t,q_ads))+(0.15)dt((C_UDSI_M1(c,t,ads))-(C_UDSI_M1(c,t,q_ads))); /*Este seria el LDF que esta de la forma dn/dt=k(n*-n) pero como se necesita para varias iteraciones quedaria Ni= N(i-1) + k(N*_(i-1)-N_(i-1))(t_(i)-t_(i-1)) El valor de K es igual a K= 0.15 (1/s)*/
		                                                                                                          /*El termino 0.9 es el  dato en equilibrio  y el dato de C_UDSI_M1(c,t,q_ads) es el dato que varia en el tiempo averiguar en UDF la concentraciأłn molar!!!*/
		}
		end_c_loop (c,t)
	}
}
secorreaz is offline   Reply With Quote

Old   March 31, 2022, 23:45
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
#include "udf.h"

DEFINE_ADJUST(q_ads2, domain)
{
	Thread *t;
	cell_t c;
	real dt;
dt = RP_Get_Real("physical-time-step");
	thread_loop_c (t,domain)
	{
		begin_c_loop (c,t)
		{
			
			C_UDMI(c,t,0) = (C_UDSI_M1(c,t,0))+(0.15)*dt*((C_UDSI_M1(c,t,1))-(C_UDSI_M1(c,t,0))); /*Este seria el LDF que esta de la forma dn/dt=k(n*-n) pero como se necesita para varias iteraciones quedaria Ni= N(i-1) + k(N*_(i-1)-N_(i-1))(t_(i)-t_(i-1)) El valor de K es igual a K= 0.15 (1/s)*/
		                                                                                                          /*El termino 0.9 es el  dato en equilibrio  y el dato de C_UDSI_M1(c,t,0) es el dato que varia en el tiempo averiguar en UDF la concentraciأłn molar!!!*/
		}
		end_c_loop (c,t)
	}
}
with assumption that q_ads = 0 and ads = 1
q_ads and ads are just names to make it readable, but inside they are integers
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ 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
vibration UDF problems jingguo Fluent UDF and Scheme Programming 3 September 14, 2017 03:27
[FLUENT] Loading UDF function problems Faggio11 FLUENT 0 August 9, 2016 07:33
Problems in the UDF for DPM erosion Messi Fluent UDF and Scheme Programming 0 January 23, 2014 06:29
UDF code for concentration distribution szw_china Fluent UDF and Scheme Programming 0 July 22, 2012 22:35
UDF code yahya_azizi Fluent UDF and Scheme Programming 1 July 16, 2012 11:50


All times are GMT -4. The time now is 17:48.