|
[Sponsors] |
March 30, 2009, 20:18 |
Reserving UDM/UDS memory locations
|
#1 |
New Member
Eric Doran
Join Date: Mar 2009
Posts: 3
Rep Power: 17 |
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); } } |
|
Tags |
reserve, udm, uds |
|
|
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 04:48 |
CFX CPU time & real time | Nick Strantzias | CFX | 8 | July 23, 2006 17:50 |
Run-Time memory conifguration Error | Graeme | CFX | 1 | February 20, 2006 23:04 |