|
[Sponsors] |
March 1, 2013, 16:31 |
Problem with implicit equations in UDF
|
#1 |
New Member
Join Date: Sep 2012
Posts: 11
Rep Power: 14 |
Hi friends,
I am a new user of FLUENT and UDF programming... I need a UDF that calculates a system of implicit equations, like: x1=a+b*(x1+x2+x3) x2=a+b*(x1+x2+x3) x3=a+b*(x1+x2+x3) I am sketching a code that, I think, could do this work. What I have is: DEFINE_ADJUST(my_adjust, domain) { Thread *thread; cell_t cell; thread_loop_c(thread, domain) { begin_c_loop_all(cell, thread) { C_UDMI(cell,thread,0) = 1. + C_UDMI(cell,thread,3); C_UDMI(cell,thread,1) = 2. + C_UDMI(cell,thread,3); C_UDMI(cell,thread,2) = 3. + C_UDMI(cell,thread,3); C_UDMI(cell,thread,3) = C_UDMI(cell,thread,0) + C_UDMI(cell,thread,1) + C_UDMI(cell,thread,2); } end_c_loop_all(cell, thread) } } I am able to compile it in FLUENT and initialize it, but when I run the iterations the program simply crashes... so, I think I am doing something pretty wrong. Could anyone please help me on this? Observation: This code is meant to be used in mass transfer in multiphase simulations. Best Regards, NPat |
|
March 2, 2013, 05:06 |
|
#2 |
Senior Member
SSL
Join Date: Oct 2012
Posts: 226
Rep Power: 15 |
delete "_all"
just use "begin_c_loop" |
|
March 2, 2013, 09:17 |
|
#3 |
New Member
Join Date: Sep 2012
Posts: 11
Rep Power: 14 |
Thank you, Sir.
I was able to get this code working, but it seems to be sensitive of the constants, since large values lead to what seems to be an infinity loop and FLUENT crashes. However, small values for the constants allow for good results. Anyway, if someone else has another suggestion, it would be very approciated! BR NPat |
|
March 2, 2013, 09:26 |
|
#4 |
New Member
Join Date: Sep 2012
Posts: 11
Rep Power: 14 |
Just one more detail... The use of "begin_c_loop_all" or just "begin_c_loop" seems to don't have effect on the results.
BR NPat |
|
March 3, 2013, 06:16 |
|
#5 |
Senior Member
SSL
Join Date: Oct 2012
Posts: 226
Rep Power: 15 |
It should be checked precisely.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM | Rizwan | Fluent UDF and Scheme Programming | 40 | March 18, 2018 07:05 |
Maths problem when deriving conservation of energy equations. | Demonwolf | Main CFD Forum | 1 | June 15, 2009 15:21 |
udf compiling problem | akr | FLUENT | 3 | August 22, 2007 08:14 |
a problem about DEFINE_GEOM in dynamic mesh UDF | speedcat | FLUENT | 1 | May 16, 2005 04:09 |
I have problem of UDF with turbulent premx source. | Z | FLUENT | 0 | February 16, 2005 04:34 |