|
[Sponsors] |
How can i remove floating Error in the following UDF? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 1, 2019, 02:28 |
How can i remove floating Error in the following UDF?
|
#1 |
New Member
Azim Memon
Join Date: Jul 2019
Posts: 12
Rep Power: 6 |
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; } |
|
August 1, 2019, 23:35 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
use small enough time steps to get convergence
best regards |
|
August 1, 2019, 23:44 |
|
#3 |
Senior Member
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 407
Rep Power: 14 |
(Sorry remove this messageplease, posted in a wrong thread)
|
|
August 2, 2019, 05:25 |
|
#4 |
New Member
Azim Memon
Join Date: Jul 2019
Posts: 12
Rep Power: 6 |
@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? |
|
August 2, 2019, 08:14 |
|
#5 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
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; } 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 |
|
August 2, 2019, 08:37 |
|
#6 |
New Member
Azim Memon
Join Date: Jul 2019
Posts: 12
Rep Power: 6 |
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?? |
|
August 4, 2019, 21:50 |
|
#7 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
these are mine recommendations
best regards |
|
August 5, 2019, 03:29 |
|
#8 |
New Member
Azim Memon
Join Date: Jul 2019
Posts: 12
Rep Power: 6 |
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 |
|
August 5, 2019, 19:22 |
|
#9 |
Senior Member
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 407
Rep Power: 14 |
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?
|
|
August 5, 2019, 23:23 |
|
#10 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
go to material properties and use piecewise-linear option for properties you are interested in.
best regards |
|
|
|
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 |