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

C_T(c,t) problem while compiling (OK interpreted)

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 27, 2014, 10:35
Default C_T(c,t) problem while compiling (OK interpreted)
  #1
Member
 
Join Date: Oct 2011
Location: Thessaloniki, Greece
Posts: 75
Rep Power: 14
crevoise is on a distinguished road
Hello

I am writting an UDF in order to define the viscosity of my fluid

Code:
#include "udf.h" 
real visc;

DEFINE_PROPERTY(gas_viscosity,c,t)
{
        real temp = C_T(c,t);
	visc = function of temp;
	return visc;
}
This is properly working when I am interpreting the UDF.

However, when I am compiling the UDF, I am getting, while doing the initialization, the followin error:
Code:
Error: 
FLUENT received fatal signal (ACCESS_VIOLATION)
1. Note exact events leading to error.
2. Save case/data under new name.
3. Exit program and restart to continue.
4. Report error to your distributor.
Error Object: #f
I have put some pointer, and found out that C_T(c,t) is returning 0.
So that's might explain the error message.

The questions are:
1/ Why C_T(c,t) is giving 0?
2/ Why while interpreting, this is working?

Does anyone has some idea about this problem?
I've seen a similar post on the forum, but without answer on how to solve this.
http://www.cfd-online.com/Forums/flu...violation.html

Thanks for any help
crevoise is offline   Reply With Quote

Old   January 28, 2014, 02:59
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 21
blackmask will become famous soon enough
Code:
#include "udf.h" 
real visc;

DEFINE_PROPERTY(gas_viscosity,c,t)
{
        real temp = NNULLP(THREAD_STORAGE(t, SV_T)) ? C_T(c,t) : 300 ;
    visc = function of temp;
    return visc;
}
blackmask is offline   Reply With Quote

Old   January 28, 2014, 03:58
Default
  #3
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
One more remark, that has nothing to do with your current problem, but might otherwise cause problems later on: define your variables local, not global:
Code:
#include "udf.h" 

DEFINE_PROPERTY(gas_viscosity,c,t)
{
    real visc;
    real temp = NNULLP(THREAD_STORAGE(t, SV_T)) ? C_T(c,t) : 300 ;
    visc = function of temp;
    return visc;
}
The difference is where you define "real visc".
pakk is offline   Reply With Quote

Old   February 4, 2014, 06:10
Default
  #4
Member
 
Join Date: Oct 2011
Location: Thessaloniki, Greece
Posts: 75
Rep Power: 14
crevoise is on a distinguished road
Thank you a lot for your answers.
I came to solve my problem, which was I was not compiling my udf with the proper header... a bit silly mistake

Thanks again anyway
crevoise is offline   Reply With Quote

Old   February 4, 2014, 06:29
Default
  #5
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
It is good that you solved the problem.
But now I am curious: what was the wrong header that you used?
Here, you show that you used #include "udf.h", which is I think what it should be. Or are you referring to a different kind of header?

I ask it because your answer might help somebody else in the future who has the same problem.
pakk is offline   Reply With Quote

Old   February 4, 2014, 06:48
Default
  #6
Member
 
Join Date: Oct 2011
Location: Thessaloniki, Greece
Posts: 75
Rep Power: 14
crevoise is on a distinguished road
Hello Pakk

I was referring to another kind of header. (Maybe I am not using the proper terminology)
While compiling, you have to refer to the proper library 'fl1400.lib'

At first, my compilation was referring to the library found in the folder
'../fluent14.0.0/win64/3ddp' while I was not in a double precision
When I pointed the '../fluent14.0.0/win64/3d' , everything work well.

I don't know if it sounds clear, if not just ask and I'll try to be more precise.
crevoise is offline   Reply With Quote

Old   February 4, 2014, 07:16
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
I think I understand what you mean now. I think you add it in the box called 'header file', but I could be wrong about that.

One thing: in the 'Compiled UDFs' box I never use anything in the 'Header Files' box, I only add 'Source Files'. And udfs compile without problem. (And I would expect that the files you add in 'Header Files' should end in ".h", not in ".lib".)

I would think that in a proper installation, Fluent should find the file 'fl1400.lib' automatically. It might mean that some setting in your computer is not what it should be.

If it is not a problem for you that you have to add this filename manually every time, it is of course ok.
pakk is offline   Reply With Quote

Reply

Tags
compiled udf, c_t, interpreted udf, udf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
A Problem of Fluent Interpreted UDF: parse error knight Fluent UDF and Scheme Programming 25 August 16, 2018 10:26
problem with compiling the source code michel1988 OpenFOAM Installation 1 April 17, 2013 17:19
Compiling OpenFoam from git : problem with ld mborgraeve OpenFOAM Installation 33 November 19, 2012 18:08
Compiling problem, sofc module karim.s.ansari Fluent UDF and Scheme Programming 0 June 19, 2012 12:33
[swak4Foam] Problem with compiling funkySetFields Victor OpenFOAM Community Contributions 4 July 19, 2011 16:34


All times are GMT -4. The time now is 20:05.