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

Problem with implicit equations in UDF

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   March 1, 2013, 16:31
Unhappy Problem with implicit equations in UDF
  #1
New Member
 
Join Date: Sep 2012
Posts: 11
Rep Power: 4
NPat is on a distinguished road
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
NPat is offline   Reply With Quote

Old   March 2, 2013, 05:06
Default
  #2
Senior Member
 
SSL
Join Date: Oct 2012
Posts: 227
Rep Power: 5
msaeedsadeghi is on a distinguished road
delete "_all"
just use "begin_c_loop"
msaeedsadeghi is offline   Reply With Quote

Old   March 2, 2013, 09:17
Default
  #3
New Member
 
Join Date: Sep 2012
Posts: 11
Rep Power: 4
NPat is on a distinguished road
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
NPat is offline   Reply With Quote

Old   March 2, 2013, 09:26
Default
  #4
New Member
 
Join Date: Sep 2012
Posts: 11
Rep Power: 4
NPat is on a distinguished road
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
NPat is offline   Reply With Quote

Old   March 3, 2013, 06:16
Default
  #5
Senior Member
 
SSL
Join Date: Oct 2012
Posts: 227
Rep Power: 5
msaeedsadeghi is on a distinguished road
It should be checked precisely.
msaeedsadeghi is offline   Reply With Quote

Reply

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 32 May 8, 2015 06:05
Maths problem when deriving conservation of energy equations. Demonwolf Main CFD Forum 1 June 15, 2009 14:21
udf compiling problem akr FLUENT 3 August 22, 2007 07:14
a problem about DEFINE_GEOM in dynamic mesh UDF speedcat FLUENT 1 May 16, 2005 03:09
I have problem of UDF with turbulent premx source. Z FLUENT 0 February 16, 2005 04:34


All times are GMT -4. The time now is 15:49.