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

Segmentation fault while initialization of F_UDMI, why?

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 27, 2016, 11:20
Default Segmentation fault while initialization of F_UDMI, why?
  #1
New Member
 
Deutschland
Join Date: Feb 2013
Posts: 6
Rep Power: 13
Niels W. is on a distinguished road
Hi everyone,

i dont understand why i get an segmentation fault in my code:

#include "udf.h"
#define NUM_UDM 1
static int udm_offset = UDM_UNRESERVED;

DEFINE_ON_DEMAND(on_loading)
{
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 \n", NUM_UDM);
else
{
Message("%d UDMs have been reserved by the current library \n",NUM_UDM);
Set_User_Memory_Name(udm_offset,"Mass");
}
Message("\nUDM Offset for Current Loaded Library = %d \n",udm_offset);
}

DEFINE_ON_DEMAND(Mass_init)
{
Domain *d;
d=Get_Domain(1);
Thread *t;
face_t f;
if(udm_offset != UDM_UNRESERVED)
{
Message("\nSetting Mass. ");
thread_loop_f(t,d)
{
if(BOUNDARY_FACE_THREAD_P(t)){
begin_f_loop(f,t)
{
F_UDMI(f,t,udm_offset)=42;
}
end_f_loop(f,t)
}
}
Message("Done.\n");
}
else
Message("UDM: Mass have not yet been reserved for library\n");
}

When i execute on demand "on_loading" with 1 memory location:

"1 UDMs have been reserved by the current library

UDM Offset for Current Loaded Library = 0"

after that i execute "Mass_init":

"Setting Mass.
Error: received a fatal signal (Segmentation fault).


Error: received a fatal signal (Segmentation fault).
Error Object: #f"

Where is my fault? Thank you very much!

br,
Niels
Niels W. is offline   Reply With Quote

Old   June 28, 2016, 04:57
Default
  #2
Senior Member
 
Bruno Machado
Join Date: May 2014
Posts: 271
Rep Power: 13
Bruno Machado is on a distinguished road
Quote:
Originally Posted by Niels W. View Post
Hi everyone,

i dont understand why i get an segmentation fault in my code:

#include "udf.h"
#define NUM_UDM 1
static int udm_offset = UDM_UNRESERVED;

DEFINE_ON_DEMAND(on_loading)
{
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 \n", NUM_UDM);
else
{
Message("%d UDMs have been reserved by the current library \n",NUM_UDM);
Set_User_Memory_Name(udm_offset,"Mass");
}
Message("\nUDM Offset for Current Loaded Library = %d \n",udm_offset);
}

DEFINE_ON_DEMAND(Mass_init)
{
Domain *d;
d=Get_Domain(1);
Thread *t;
face_t f;
if(udm_offset != UDM_UNRESERVED)
{
Message("\nSetting Mass. ");
thread_loop_f(t,d)
{
if(BOUNDARY_FACE_THREAD_P(t)){
begin_f_loop(f,t)
{
F_UDMI(f,t,udm_offset)=42;
}
end_f_loop(f,t)
}
}
Message("Done.\n");
}
else
Message("UDM: Mass have not yet been reserved for library\n");
}

When i execute on demand "on_loading" with 1 memory location:

"1 UDMs have been reserved by the current library

UDM Offset for Current Loaded Library = 0"

after that i execute "Mass_init":

"Setting Mass.
Error: received a fatal signal (Segmentation fault).


Error: received a fatal signal (Segmentation fault).
Error Object: #f"

Where is my fault? Thank you very much!

br,
Niels
looks like udm_offset is not the name (or number) of your UDM but how many UDMs you have. I think you gotta define your UDM like this

enum /* UDMs */
{
mass, /*whatever the name you want*/
NUM_UDM
};

Then change the following line

F_UDMI(f,t,mass)=42;

And exclude this one
#define NUM_UDM 1
Bruno Machado is offline   Reply With Quote

Reply

Tags
f_udmi, segmentaion fault

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Segmentation fault when running dieselFoam or dieselEngineFoam in parallel francesco OpenFOAM Bugs 4 May 2, 2017 21:59
ABL use of fixed shear stress leads to segmentation fault 11 cristopf OpenFOAM Running, Solving & CFD 1 December 23, 2016 16:57
Segmentation fault when running in parallel Pj. OpenFOAM Running, Solving & CFD 3 April 8, 2015 08:12
Segmentation Fault w/ compiled OF 2.2.0 - motorBike example sudo OpenFOAM Running, Solving & CFD 3 April 2, 2013 17:27
segmentation fault when installing OF-2.1.1 on a cluster Rebecca513 OpenFOAM Installation 9 July 31, 2012 15:06


All times are GMT -4. The time now is 00:52.