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

I receive "temperature limited to ... " after I Compile and Hook my UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 13, 2016, 10:45
Default I receive "temperature limited to ... " after I Compile and Hook my UDF
  #1
New Member
 
Negar Saeidi
Join Date: Dec 2015
Location: Sudbury, ON, Canada
Posts: 18
Rep Power: 10
nsaeidi is on a distinguished road
Hello everyone!


I am trying to apply a time-varying temperature boundary condition to the inlet boundary of my porous zone geometry by reading the temperature values from a data file (.txt). My C file and the text file that I read from are attached.


After I compile the UDF and Hook the read_data function, this message shows up in Console: “temperature limited to 1.000000e+00 in 141630 cells on zone 4”
Zone 4 is my porous zone. My temperature limit setting is from 1K to 5000K.
I don’t face this problem when I set constant inlet BC or when I don’t have a read_data function in the UDF.

Does anybody have any idea what could be the problem?
Attached Files
File Type: c Temp-env-inlet.c (630 Bytes, 17 views)
File Type: txt Env-Temp.txt (73 Bytes, 9 views)
nsaeidi is offline   Reply With Quote

Old   June 13, 2016, 11:46
Default Additional info ...
  #2
New Member
 
Negar Saeidi
Join Date: Dec 2015
Location: Sudbury, ON, Canada
Posts: 18
Rep Power: 10
nsaeidi is on a distinguished road
I tried to make the meshing finer but I still received the same notice except with larger number of cells on the porous zone ( 192779 instead of 141630, mesh is denser)!

Please share your thinking with me ...
nsaeidi is offline   Reply With Quote

Old   June 14, 2016, 04:18
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Try to print the temperature to see if it is read in the way that you intended:
Code:
DEFINE_PROFILE(Tinlet, thread, position) 
{
  face_t f;
  real t = CURRENT_TIME*pow(1,-1);
  int i = t;

  begin_f_loop(f, thread)
    {   
      F_PROFILE(f, thread, position) = Temp[i];
    }
  end_f_loop(f, thread)
  Message("Temp = %f\n",Temp[i]);
}
Then look at the Text user Interface to see what is shown there. That might give you an idea on what is going on.
pakk is offline   Reply With Quote

Old   June 14, 2016, 09:35
Default
  #4
New Member
 
Negar Saeidi
Join Date: Dec 2015
Location: Sudbury, ON, Canada
Posts: 18
Rep Power: 10
nsaeidi is on a distinguished road
I tried! It doesn't read it correctly. It lists out only Temp = 0.000000 in the TUI.
nsaeidi is offline   Reply With Quote

Old   June 14, 2016, 09:42
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
And the following?
Code:
Message("t=%f, i=%d, Temp = %f\n",t,i,Temp[i]);
Did you hook the read_data function?
pakk is offline   Reply With Quote

Old   June 14, 2016, 09:57
Default
  #6
New Member
 
Negar Saeidi
Join Date: Dec 2015
Location: Sudbury, ON, Canada
Posts: 18
Rep Power: 10
nsaeidi is on a distinguished road
Yes I did Hook the read-data function.
It prints t=0.000000, i=0, Temp = 0.000000
So it doesn't go trough the loop at all! right?
nsaeidi is offline   Reply With Quote

Old   June 14, 2016, 10:03
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
I think the problem is in your read_data.

In the following line:
Code:
fscanf(fp,"%ld", &Temp[i]);
You read a long integer (%ld), but you store it in a double (Temp was previously defined as double).

Maybe:
Code:
fscanf(fp,"%f", &Temp[i]);
Message("Read: %f\n",Temp[i]);
The second line is just to directly show what you read, if everything works you can remove it.
pakk is offline   Reply With Quote

Old   June 14, 2016, 10:25
Default
  #8
New Member
 
Negar Saeidi
Join Date: Dec 2015
Location: Sudbury, ON, Canada
Posts: 18
Rep Power: 10
nsaeidi is on a distinguished road
It is still same as before
it shows Read: 0.000000 for Message("Read: %f\n",Temp[i]);
and t=0.000000, i=0, Temp = 0.000000 for Message("t=%f, i=%d, Temp = %f\n",t,i,Temp[i]);

I don't understand what is the problem ? because my code works if I introduce Temp[i] as a function of time rather than using DEFINE_INIT(read_data, d) application.
nsaeidi is offline   Reply With Quote

Old   June 14, 2016, 10:42
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
The problem is in your read_data.
You are not reading the file properly. So of course it works if you skip this step and put the data directly in the sourcefile...

You see:
Quote:
Read: 0.000000
That means that nothing is read (since 0.00000 is the default value).

You defined TEMP as a double, so you have to read it as a double.

I don't remember exactly the code to do this, google for it. My next guess would be this:
Code:
fscanf(fp,"%lf", &Temp[i]);
But if that also gives 0.0000 as temperature, you need a different format, so google for fscanf to see how to properly read a double.
pakk is offline   Reply With Quote

Old   June 14, 2016, 11:09
Default
  #10
New Member
 
Negar Saeidi
Join Date: Dec 2015
Location: Sudbury, ON, Canada
Posts: 18
Rep Power: 10
nsaeidi is on a distinguished road
You were right!
Problem Solved!
Thank you so much!
nsaeidi is offline   Reply With Quote

Old   June 14, 2016, 11:12
Default
  #11
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27
pakk will become famous soon enough
Nice.
pakk is offline   Reply With Quote

Old   March 15, 2019, 09:59
Default
  #12
Member
 
Join Date: Oct 2017
Posts: 52
Rep Power: 9
gouravjee is on a distinguished road
Quote:
Originally Posted by pakk View Post
Try to print the temperature to see if it is read in the way that you intended:
Code:
DEFINE_PROFILE(Tinlet, thread, position) 
{
  face_t f;
  real t = CURRENT_TIME*pow(1,-1);
  int i = t;

  begin_f_loop(f, thread)
    {   
      F_PROFILE(f, thread, position) = Temp[i];
    }
  end_f_loop(f, thread)
  Message("Temp = %f\n",Temp[i]);
}
Then look at the Text user Interface to see what is shown there. That might give you an idea on what is going on.
Hii All,
I have been working on a heat exchanger problem in which the molten metal kept stationary in outer shell of a concentric tube and a fluid is flowing in the inner tube.
I am using UDS scalars to define temperature and velocity but results do not show any variation in temperature profile of fluid part(even if flow is there) and remains same as the stationary fluid
kindly provide me some hint regarding this problem

Thanks in Advance
gouravjee is offline   Reply With Quote

Reply

Tags
define_init, function hookes, read data, temperature limited


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
ATTN ALL: SOLUTON TO UDF COMPILE PROBLEM Rizwan Fluent UDF and Scheme Programming 40 March 18, 2018 07:05
UDF programming fullmonty FLUENT 5 June 30, 2011 03:40
interpret or compile an UDF (emergency) Lotfi FLUENT 1 August 26, 2007 13:58
Compile the UDF Eric FLUENT 7 August 18, 2006 15:46


All times are GMT -4. The time now is 01:26.