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

Reserving UDM/UDS memory locations

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 30, 2009, 21:18
Default Reserving UDM/UDS memory locations
  #1
New Member
 
Eric Doran
Join Date: Mar 2009
Posts: 3
Rep Power: 17
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, 10:20
Default
  #2
Member
 
Henrik Ström
Join Date: Mar 2009
Posts: 33
Rep Power: 17
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, 19:27
Default
  #3
New Member
 
Eric Doran
Join Date: Mar 2009
Posts: 3
Rep Power: 17
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, 04:13
Default
  #4
Member
 
Henrik Ström
Join Date: Mar 2009
Posts: 33
Rep Power: 17
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, 17:39
Default
  #5
Member
 
Join Date: Mar 2009
Location: Istanbul, Turkiye
Posts: 47
Rep Power: 17
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, 08:41
Default happen History repeat it self.
  #6
New Member
 
Emad
Join Date: Feb 2012
Location: Egypt
Posts: 26
Rep Power: 14
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


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
How to optimize the memory usage when using FEM vasilis Main CFD Forum 11 August 25, 2009 00:57
Memory error? Young CFX 3 September 30, 2008 12: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 18:50
Run-Time memory conifguration Error Graeme CFX 1 February 21, 2006 00:04


All times are GMT -4. The time now is 17:47.