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

UDF in Fluent

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 12, 2023, 21:17
Default UDF in Fluent
  #1
New Member
 
MB
Join Date: Sep 2022
Posts: 8
Rep Power: 4
Mohamad.Baassiri is on a distinguished road
Dears,

I'm trying to load a simple UDF to mimic ideal gas density in Fluent (2023R1).

Fluent is crashing as soon as I run the simulation (floating point error). I'm using the below udf:

#include <udf.h>
#include <global.h>

/* The variables below need to be set for a particular gas */
/* CO2 */

#define RGASU UNIVERSAL_GAS_CONSTANT
#define MWT 44.01

/* REFERENCE STATE */

#define P_REF 101325
#define T_REF 288.15

DEFINE_PROPERTY(cell_density,c,t)

{
real rho;
real p;
real p_operating;
real T;

p_operating=RP_Get_Real("operating-pressure");
p=C_P(c,t);
T=C_T(c,t);
rho= (p+p_operating)/(RGASU*T/MWT);

return rho;
}

If I replace p and T by constant values, the solver works fine. The issue occurs only when I let p or T to be unknown (i.e. to be calculated by fluent). Anything wrong in the UDF? Any thoughts on this would be appreciated.

Thanks,
Mohamad.Baassiri is offline   Reply With Quote

Old   August 14, 2023, 02:59
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
how to calculate pressure for your UDF if density is unknown for initial step?
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   August 14, 2023, 17:27
Default
  #3
New Member
 
MB
Join Date: Sep 2022
Posts: 8
Rep Power: 4
Mohamad.Baassiri is on a distinguished road
Hi Alexander, thanks for your message.

Looking at the udf again, I have already defined the pressure initially. The problem as it appears to me is that I am not able to call the updated values in the UDF.

Best,

Last edited by Mohamad.Baassiri; August 15, 2023 at 17:40.
Mohamad.Baassiri is offline   Reply With Quote

Reply

Tags
fluent - udf


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
FLUENT UDF for parallelization Cooper24 FLUENT 0 August 27, 2021 12:55
Fluent UDF for moving laser heating of a solid block Cooper24 Fluent UDF and Scheme Programming 7 July 9, 2021 06:56
Problem running fluent with udf on batch tobi b. Fluent UDF and Scheme Programming 3 April 14, 2016 14:54
Running UDF with Supercomputer roi247 FLUENT 4 October 15, 2015 14:41
fluent UDF external library lapack problem Rick FLUENT 0 May 7, 2008 11:16


All times are GMT -4. The time now is 06:23.