CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Fluent UDF and Scheme Programming (
-   -   Reserving UDM/UDS memory locations (

emdoran March 30, 2009 20:18

Reserving UDM/UDS memory locations
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

/* ---- 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);
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);
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);

HenrikS March 31, 2009 09:20

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...

emdoran March 31, 2009 18:27

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?

HenrikS April 1, 2009 03:13

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

... etc

Maybe this helps you.


gemini May 10, 2009 16:39


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 :mad: However, there should be a solution for this issue. :confused:

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.:eek: So, there must be a solution and I am currently working on it.:rolleyes:

elemad1987 August 7, 2012 07:41

happen History repeat it self.
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.

All times are GMT -4. The time now is 12:06.