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

Case filename variable

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

Reply
 
LinkBack Thread Tools Display Modes
Old   May 12, 2010, 16:13
Default Case filename variable
  #1
New Member
 
Join Date: Apr 2009
Posts: 6
Rep Power: 9
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
 
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 109
Rep Power: 8
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
 
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 109
Rep Power: 8
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: 6
Rep Power: 9
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: 6
Rep Power: 9
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
 
Ji Junjie
Join Date: Feb 2010
Location: Shanghai, China
Posts: 109
Rep Power: 8
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
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 On
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 41 November 18, 2014 11:05
Problem in installation of OpenFOAM sachin OpenFOAM Installation 7 January 22, 2008 02:40
Problems with additional variable Krishna Premi CFX 1 October 29, 2007 09: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 05:27


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