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

C_UDMI - SEGMENTATION VIOLATION

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 27, 2005, 08:49
Default C_UDMI - SEGMENTATION VIOLATION
  #1
CC
Guest
 
Posts: n/a
Hi all,

I have just begun looking at using UDMs for the first time and have hit a fairly major stummbling block. To describe my situation right now, I'm trying to apply one of the simplest UDM examples from the Fluent UDF manual to a pre-solved 3d case.

The script (udmres1.c) is listed below.

I tried to interpret the script, but that failed with syntax errors, so I tried to compile it instead. The script compiles, and, so long as I allocate enough UDMs the ON_LOAD part works fine. I can see the memories, and they are named. However, when I try to execute the ON_DEMAND part, I get a SEGMENTATION VIOLATION. I have no idea what this means.

If I replace the C_UDMI() function with a Message() function everything works as expected, however nothing I do with C_UDMI() in place makes any difference.

I am sufficiently new to all of this that the problem could be anything, so any advice would be greatly appreciated.

Thanks in advance,

Chris

PS If relevant, I'm using Fluent 6.2.16.

--

#include "udf.h"

#define NUM_UDM 3

static int udm_offset = UDM_UNRESERVED;

DEFINE_EXECUTE_ON_LOADING(on_loading, libname)

{

if (udm_offset == UDM_UNRESERVED) udm_offset = Reserve_User_Memory_Vars(NUM_UDM);

if (udm_offset == UDM_UNRESERVED) Message("\nYou need to define up to %d extra UDMs in GUI and then reload current library %s\n", NUM_UDM, libname);

else

{

Message("%d UDMs have been reserved by the current library %s\n",NUM_UDM, libname);

Set_User_Memory_Name(udm_offset,"lib1-UDM-0");

Set_User_Memory_Name(udm_offset+1,"lib1-UDM-1");

Set_User_Memory_Name(udm_offset+2,"lib1-UDM-2");

}

Message("\nUDM Offset for Current Loaded Library = %d",udm_offset);

}

DEFINE_ON_DEMAND(set_udms) {

Domain *d;

Thread *ct;

cell_t c;

int i;

d=Get_Domain(1);

if(udm_offset != UDM_UNRESERVED)

{

Message("Setting UDMs\n");

for (i=0;i<NUM_UDM;i++)

{

thread_loop_c(ct,d)

{

begin_c_loop(c,ct)

{

C_UDMI(c,ct,udm_offset+i)=3.0+i/10.0;

}

end_c_loop(c,ct)

}

}

}

else Message("UDMs have not yet been reserved for library 1\n");

}
  Reply With Quote

Old   June 27, 2005, 12:24
Default Re: C_UDMI - SEGMENTATION VIOLATION
  #2
Alec Eiffel
Guest
 
Posts: n/a
have you run at least one solver iteration before executing the ON_DEMAND macro to initialise the UDM's?
  Reply With Quote

Old   June 28, 2005, 04:48
Default Re: C_UDMI - SEGMENTATION VIOLATION
  #3
CC
Guest
 
Posts: n/a
Hi Alec,

I thought that I had, but to make sure, I tried again. I still get the same failure.

It has been suggested to me that the problem might be that I'm compiling on a 64-bit machine and that I should try on a 32-bit machine.

Does this sound reasonable? I do have capacity to do this - but it requires a bit of effort!

Chris
  Reply With Quote

Old   June 30, 2005, 04:50
Default Re: C_UDMI - SEGMENTATION VIOLATION
  #4
CC
Guest
 
Posts: n/a
Update:

I'm now able to use the UDMs. I have determined that by loading the case file, setting up the UDMs, initialising the case, loading the data file, and then trying to use the UDMs it all works.

Slightly more effort than I might like, but it works.

Thanks Alec for pointing me in this direction.

Chris
  Reply With Quote

Old   July 2, 2005, 04:16
Default Re: C_UDMI - SEGMENTATION VIOLATION
  #5
Martin
Guest
 
Posts: n/a
Hi, I think it also helps this: before executing the on demand function, try to display that udm on any surface (there will be zeros) and then execute your function.

Martin
  Reply With Quote

Reply


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
Segmentation violation louiza FLUENT 16 June 27, 2017 15:41
Segmentation Violation Corentin FLUENT 1 February 13, 2011 01:07
Defining Multiphase by text and by gui = different result and Segmentation Violation RPJones FLUENT 0 June 9, 2009 16:24
segmentation violation wasan FLUENT 0 December 23, 2008 11:37
SEGMENTATION VIOLATION Arif FLUENT 3 May 27, 2003 08:24


All times are GMT -4. The time now is 15:29.