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

Case filename variable

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 12, 2010, 16:13
Default Case filename variable
  #1
New Member
 
Join Date: Apr 2009
Posts: 9
Rep Power: 17
eshimshi is on a distinguished road
Is there a variable containing the name and path of the current loaded case?
Can it be retrived by UDF or scheme?

Thanks
eshimshi is offline   Reply With Quote

Old   May 13, 2010, 02:35
Default
  #2
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by eshimshi View Post
Is there a variable containing the name and path of the current loaded case?
Can it be retrived by UDF or scheme?

Thanks
Scheme to get the full-path case name:
(in-package cl-file-package rc-filename)
Scheme to get the case name:
(strip-directory (in-package cl-file-package rc-filename))

If you want to use them in UDF, just use CX_Interpret_String command to let them recognized by UDF. i.e.,
CX_Interpret_String("(in-package cl-file-package rc-filename)");
CX_Interpret_String("(strip-directory (in-package cl-file-package rc-filename))");
gearboy is offline   Reply With Quote

Old   May 13, 2010, 02:45
Default
  #3
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by gearboy View Post
Scheme to get the full-path case name:
(in-package cl-file-package rc-filename)
Scheme to get the case name:
(strip-directory (in-package cl-file-package rc-filename))

If you want to use them in UDF, just use CX_Interpret_String command to let them recognized by UDF. i.e.,
CX_Interpret_String("(in-package cl-file-package rc-filename)");
CX_Interpret_String("(strip-directory (in-package cl-file-package rc-filename))");
scheme just get the path:
(directory (in-package cl-file-package rc-filename))
gearboy is offline   Reply With Quote

Old   May 14, 2010, 07:38
Thumbs up
  #4
New Member
 
Join Date: Apr 2009
Posts: 9
Rep Power: 17
eshimshi is on a distinguished road
Thanks for the help,
eshimshi is offline   Reply With Quote

Old   May 14, 2010, 08:17
Default
  #5
New Member
 
Join Date: Apr 2009
Posts: 9
Rep Power: 17
eshimshi is on a distinguished road
it woks fine for scheme but in the UDF i get an Unbound variable erorr.
Do I have to add some #include file?
eshimshi is offline   Reply With Quote

Old   May 17, 2010, 00:46
Default
  #6
Senior Member
 
Join Date: Feb 2010
Posts: 164
Rep Power: 17
gearboy is on a distinguished road
Quote:
Originally Posted by eshimshi View Post
it woks fine for scheme but in the UDF i get an Unbound variable erorr.
Do I have to add some #include file?
It seems that the CX_Interpret_String can't Interpret in-package command.

Another choice:
write the scheme command in a scm file, e.g. D:\test.scm. Write two commands in it.

(if(not(rp-var-object 'file-name))(rp-var-define 'file-name "" 'string #f) "")
(rpsetvar 'file-name (in-package cl-file-package rc-filename))
Then in your UDF code.

char*FileName;
CX_Interpret_String("(ti-read-scheme \"D:\\test.scm\")");
FileName=RP_Get_String("file-name");
Message0("Current case name is %s\n",FileName);
gearboy is offline   Reply With Quote

Reply

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
journal file with variable in a while loop? Ralf Schmidt FLUENT 50 January 17, 2019 05:24
Problem in installation of OpenFOAM sachin OpenFOAM Installation 7 January 22, 2008 01:40
Problems with additional variable Krishna Premi CFX 1 October 29, 2007 08:19
Free surface boudary conditions with SOLA-VOF Fan Main CFD Forum 10 September 9, 2006 12:24
Env variable not set gruber2 OpenFOAM Installation 5 December 30, 2005 04:27


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