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

Reserving UDM/UDS memory locations

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

Reply
 
LinkBack Thread Tools Display Modes
Old   March 30, 2009, 20:18
Default Reserving UDM/UDS memory locations
  #1
New Member
 
Eric Doran
Join Date: Mar 2009
Posts: 3
Rep Power: 8
emdoran is on a distinguished road
I'm having trouble using the DEFINE_EXECUTE_ON_LOADING functionality to reserve a certain number of UDM/UDS variables for the UDF library that I am using. I'm using the basic code provided in the example from the documentation (below), however on initial loading I always receive the error stating that I need to allocate additional UDM/UDSs and reload, regardless of how many locations are already present and free. Oddly enough, if I simply reload the case at that point it will work fine, but it never works on the initial loading. It doesn't make sense to use this functionality if I have to load my casefiles twice. If anybody else recognises this problem and has found a solution, please let me know.

< begin code >

/* general FLUENT header files */
#include "udf.h"
#include "mem.h"

static int udsOffset = UDS_UNRESERVED;
#define N_TESTLIB_UDS 2

static int udmOffset = UDM_UNRESERVED;
#define N_TESTLIB_UDM 2

DEFINE_EXECUTE_ON_LOADING(testLoad, libname)
{
/* ---- reserve user-defined memory ----- */
if (udmOffset == UDM_UNRESERVED)
udmOffset = Reserve_User_Memory_Vars(N_TESTLIB_UDM);

if (udmOffset == UDM_UNRESERVED)
Message("\nDefine %d extra UDMs in GUI and reload %s\n",
N_TESTLIB_UDM, libname);
else
{
Message("%d UDMs have been reserved by the current library %s\n",
N_TESTLIB_UDM, libname);

/* set names of user defined memory */
Set_User_Memory_Name(udmOffset, "M1");
Set_User_Memory_Name(udmOffset+1, "M2");
Message("UDM offset for current loaded library = %d\n", udmOffset);
}

/* ---- reserve user-defined scalars ----- */
if (udsOffset == UDS_UNRESERVED)
udsOffset = Reserve_User_Scalar_Vars(N_TESTLIB_UDS);

if (udsOffset == UDS_UNRESERVED)
Message("\nDefine %d extra UDS in GUI and reload %s\n",
N_TESTLIB_UDS, libname);
else
{
Message("%d UDS have been reserved by the current library %s\n",
N_TESTLIB_UDS, libname);

/* set names of user defined memory */
Set_User_Scalar_Name(udsOffset, "Var1");
Set_User_Scalar_Name(udsOffset+1, "Var2");
Message("UDS offset for current loaded library = %d\n", udsOffset);
}
}
emdoran is offline   Reply With Quote

Old   March 31, 2009, 09:20
Default
  #2
Member
 
Henrik Ström
Join Date: Mar 2009
Posts: 32
Rep Power: 8
HenrikS is on a distinguished road
I have the same problem. It is enough to unload and reload your UDF library, you don't have to reload the entire case. Anyway, a solution to this issue would be nice of course...
HenrikS is offline   Reply With Quote

Old   March 31, 2009, 18:27
Default
  #3
New Member
 
Eric Doran
Join Date: Mar 2009
Posts: 3
Rep Power: 8
emdoran is on a distinguished road
Right, however that option is a bit too tedious for my taste. Plus, it's not really an option when submitting a batch job. Is there anywhere on Fluent's website to check bug reports to see if anybody else has reported something similar?
emdoran is offline   Reply With Quote

Old   April 1, 2009, 03:13
Default
  #4
Member
 
Henrik Ström
Join Date: Mar 2009
Posts: 32
Rep Power: 8
HenrikS is on a distinguished road
When I run batch jobs with cases that have this issue, I supply a text file with the corresponding commands to do this. It does not really solve the issue, I know, but at least it makes things work for me.

If you run Fluent from the command line with the handle "-i text.txt", then it will do whatever is stated in text.txt. You can for example have

file
read-case-data
myfile.cas
q
define
user-defined
compiled-functions
unload
libudf
compiled-functions
load
libudf
q
q
solve
... etc

Maybe this helps you.

/Henrik
HenrikS is offline   Reply With Quote

Old   May 10, 2009, 16:39
Default
  #5
Member
 
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 45
Rep Power: 8
gemini is on a distinguished road
Hi,

I have same problem too. Every time, I have to load my saved cases two times to successfully rename the uds/udms. The solutions mentiond above here is working but boring However, there should be a solution for this issue.

Why? because fluent pem fuel cell module makes this uds/udm renaming and if you load the previously saved case and data file renaming process works very well. So, there must be a solution and I am currently working on it.
gemini is offline   Reply With Quote

Old   August 7, 2012, 07:41
Default happen History repeat it self.
  #6
New Member
 
Emad
Join Date: Feb 2012
Location: Egypt
Posts: 26
Rep Power: 5
elemad1987 is on a distinguished road
Send a message via Skype™ to elemad1987
guess what happenHistory repeat it self.

I have the same problem as you

I am using the Fluent 14 and I want to simulate a PEM fuel cell.
The only tutorial of PEM fuel cell of Fluent is from 6.3 version.
I use it to Fluent 14 and I follow the steps but the results does not the same, also some data and parameters are different.

Anybody know if the tutorial of 6.3 Fluent is working to Fluent 14 too?
I think now you had finish your thesis peacefully.
Can you help me to overcome my problems.
or send me your cas files.

Thank you
Emad G.
elemad1987@gmail.com
elemad1987 is offline   Reply With Quote

Reply

Tags
reserve, udm, uds

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
How to optimize the memory usage when using FEM vasilis Main CFD Forum 11 August 24, 2009 23:57
Memory error? Young CFX 3 September 30, 2008 11:33
Number of User-Defined Memory Locations to 12. Michael FLUENT 1 February 6, 2008 05:48
CFX CPU time & real time Nick Strantzias CFX 8 July 23, 2006 17:50
Run-Time memory conifguration Error Graeme CFX 1 February 21, 2006 00:04


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