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

Density UDF Divergence

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 11, 2017, 16:25
Default Density UDF Divergence
  #1
Member
 
Join Date: Jun 2016
Posts: 64
Rep Power: 10
Baden is on a distinguished road
Hello all.

I am attempting to use a UDF to define a density that changes every iteration. However, the code I am using results in a x-momentum divergence error upon the first iteration. I created a fresh Fluent setup with the only changes from default being using the transient solver and the following UDFs for initialization and material density (hooked correctly of course):

Code:
#include "udf.h"

#define thread_ID 2 /* thread ID of the fluid cell zone */
#define rho_water 997 /* density of water */

DEFINE_INIT(initialize, d) 
{
    Thread *t = Lookup_Thread(d, thread_ID);
    cell_t c;
    
    begin_c_loop(c, t)
    {
        C_UDMI(c, t, 0) = 1;
    }
    end_c_loop(c, t)
}

DEFINE_PROPERTY(density, c, t)
{
    real Y_water = C_UDMI(c, t, 0);
    real rho_f = rho_water * Y_water;
    return rho_f;
}
Obviously, the code is simplified from what I am actually using, but the above code is adequate to replicate my problem. What is odd is that the code works if I change the first line of the DEFINE_PROPERTY() macro to:
Code:
real Y_water = 1.0;
I honestly have no idea what the problem is. Any help would be appreciated.
Baden 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
Divergence detected in AMG solver: k when udf loaded google9002 Fluent UDF and Scheme Programming 3 November 8, 2019 00:34
Interpret-Real Gas UDF ndabir Fluent UDF and Scheme Programming 3 November 18, 2015 08:29
Error using UDF to modify density NRD FLUENT 1 July 13, 2011 08:35
density UDF problem wanghuiru FLUENT 0 August 18, 2008 08:35
UDF: Density Cell Gradient Vector Macros matteo FLUENT 0 December 1, 2007 13:14


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