|
[Sponsors] |
July 1, 2018, 14:36 |
Error in UDF
|
#1 |
Member
Anomymous
Join Date: May 2018
Posts: 31
Rep Power: 8 |
Hi all,
I have written a udf to calculate the current in a MFC but I am getting some error: Error: / (devide) invalid argument (wrong type): not a number. Error Object: nan I think the error is in udf (attached with this thread). Can anyone please check report error if any. Thank you |
|
July 2, 2018, 16:08 |
|
#2 |
Member
zobekenobe
Join Date: Mar 2009
Location: Dublin, Ireland
Posts: 72
Rep Power: 17 |
Error 1:
begine_thread_loop(t,d) should read begin_thread_loop(t,d) Error 2: begine_c_loop(c,t) should read begin_c_loop(c,t) The 'e' after the begin |
|
July 2, 2018, 16:35 |
|
#3 |
Member
Anomymous
Join Date: May 2018
Posts: 31
Rep Power: 8 |
||
July 3, 2018, 01:47 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Try this code
Code:
#include "udf.h" real Voc = 0.92; real Rext = 100.0; real k2 = 9.13e-9; real k1 = 5.57e-5; real r1 = 1.62e-6; real r2 = 4.32e-6; real F = 96485; real A = 0.6; real B = 0.4; real Kac = 0.592; real Kox = 0.004; real R = 8.314; real T = 300.0; real den = 998.0; DEFINE_ADJUST(current, d) { Thread *t; cell_t c; face_t f; real Vac, Vox, I, Cac, Cox, YI_AC, YI_OX, mw[6], V; thread_loop_c (t,d) { begin_c_loop (c,t) { YI_AC = C_YI(c,t,0); YI_OX = C_YI(c,t,1); Cac = YI_AC*den/60.0; Cox = YI_OX*den/32.0; Vac = R*T*log(r1*(Kac+Cac)/(Cac*k1))/(A*F); Vox = R*T*log(r2*(Kox+Cox)/(Cox*k2))/((B-1)*F); V = Voc - Vac - Vox; I = V/Rext; C_UDMI(c,t,0) = Cac; C_UDMI(c,t,1) = Cox; C_UDMI(c,t,2) = Vac; C_UDMI(c,t,3) = Vox; C_UDMI(c,t,4) = V; C_UDMI(c,t,5) = I; } end_c_loop(c,t); } } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
udf for one dimensional linear motion based on force | maccheese | Fluent UDF and Scheme Programming | 2 | September 1, 2019 03:18 |
Save output of udf in another udf! | JuanJoMex | FLUENT | 0 | February 8, 2018 13:43 |
UDF Compilation Error - Loading Library - COMMON Problem! Help! | robtheslob | Fluent UDF and Scheme Programming | 8 | July 24, 2015 01:53 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |