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

How can i remove floating Error in the following UDF?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 1, 2019, 02:28
Default How can i remove floating Error in the following UDF?
  #1
New Member
 
Azim Memon
Join Date: Jul 2019
Posts: 12
Rep Power: 6
Azim07 is on a distinguished road
Hello Guys,

I want to define the specific heat and viscosity of the material by following UDF and it is showing 'Floating Exception Error'. How can i Fix this? And what kind of precautions i should take to avoid any further Error?


#include "udf.h"
DEFINE_SPECIFIC_HEAT(cp_pcm,T)
{
real cp;
if (T<303)
cp=1250;
else if (T>=303 && T<=304)
cp=125000;
else
cp=1250;
return cp;
}

DEFINE_PROPERTY (cell_viscosity1,c,t)
{
real mu;
real temp = C_T(c,t);
if(temp<303)
mu=100000000;
else if (temp>304)
mu=0.008;
else
mu =(15200000000-(50000000*temp));
return mu;
}
Azim07 is offline   Reply With Quote

Old   August 1, 2019, 23:35
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
use small enough time steps to get convergence

best regards
AlexanderZ is offline   Reply With Quote

Old   August 1, 2019, 23:44
Default
  #3
Senior Member
 
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 407
Rep Power: 14
Светлана is on a distinguished road
(Sorry remove this messageplease, posted in a wrong thread)
Светлана is offline   Reply With Quote

Old   August 2, 2019, 05:25
Default
  #4
New Member
 
Azim Memon
Join Date: Jul 2019
Posts: 12
Rep Power: 6
Azim07 is on a distinguished road
@AlexanderZ
i am already using the time step size 0.05... In this When i take initial temp as 303 K then it does not converge and goes not simulating.
but when i take initial temp as 306 and 308 K then it shown floating error.

What What should i check now?
Azim07 is offline   Reply With Quote

Old   August 2, 2019, 08:14
Default
  #5
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
Code:
#include "udf.h"
DEFINE_SPECIFIC_HEAT(cp_pcm,T, Tref, h, yi)
{
real cp;
if (T<303)
cp=1250;
else if (T>=303 && T<=304)
cp=125000;
else 
cp=1250;
*h = cp*(T-Tref);
return cp;
}

DEFINE_PROPERTY(cell_viscosity1,c,t)
{
real mu;
real T = C_T(c,t);
if(T<303)
mu=100000000;
else if (T>=303 && T<=304)
mu =(15200000000-(50000000*T));
else
mu=0.008;
return mu;
}
because you are using abnormal properties your time step should be small
size depends on your heat rate. How fast your system is heated up on 1 K?
divide this time at least 20 times (I recommend more) -> this is your time step

best regards
AlexanderZ is offline   Reply With Quote

Old   August 2, 2019, 08:37
Default
  #6
New Member
 
Azim Memon
Join Date: Jul 2019
Posts: 12
Rep Power: 6
Azim07 is on a distinguished road
So you mean i should use the code sent by you?
and i should use the more less time step size? You mean 0.005 or less??
Azim07 is offline   Reply With Quote

Old   August 4, 2019, 21:50
Default
  #7
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
these are mine recommendations

best regards
AlexanderZ is offline   Reply With Quote

Old   August 5, 2019, 03:29
Default
  #8
New Member
 
Azim Memon
Join Date: Jul 2019
Posts: 12
Rep Power: 6
Azim07 is on a distinguished road
It is still showing floating error... Please suggest me the following criteria i should use.

1. Time Step size
2. Max. Iteration
3. Methods to use for Scheme, Pressure, Momentum, Energy, and Gradient
4. Any other suggestion you like to say

Thanks & Regards
Azim07 is offline   Reply With Quote

Old   August 5, 2019, 19:22
Default
  #9
Senior Member
 
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 407
Rep Power: 14
Светлана is on a distinguished road
You could do a dumb simplification so that your UDF always returns the same constant. For instance, replace "125000" with "1250" so that it always uses 1250. Does it converge then?
Светлана is offline   Reply With Quote

Old   August 5, 2019, 23:23
Default
  #10
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
go to material properties and use piecewise-linear option for properties you are interested in.

best regards
AlexanderZ 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
UDF for vapor pressure anuarun Fluent UDF and Scheme Programming 12 December 24, 2021 10:12
Save output of udf in another udf! JuanJoMex FLUENT 0 February 8, 2018 12:43
Replicating Scalable Wall Function with a UDF yousefaz FLUENT 0 August 4, 2017 02:30
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12
UDF programming fullmonty FLUENT 5 June 30, 2011 02:40


All times are GMT -4. The time now is 08:16.