Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8145611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:42:57+00:00 2026-06-06T13:42:57+00:00

User Defined Function (UDFs) are functions that one can program and can be dynamically

  • 0

User Defined Function (UDFs) are functions that one can program and can be dynamically loaded along with the CFD Software Fluent Solver to enhance the standard features. UDFs are written in C programming Language.

Following is a section of my UDF:

/*Memory Allocation only at first call to the subroutine*/
if(CellAroundNodeFirstCallflag==0)
{
    CellAroundNodeFirstCallflag=1;
    Avg_CellAroundNode =(cell_t**)calloc((Nnum+1),sizeof(cell_t));
    for(i=0;i<Nnum;i++)
    {
        Avg_CellAroundNode[i] =(cell_t*)calloc((NCellANode+1),sizeof(cell_t));
    }
}

if (Avg_CellAroundNode!=NULL)
        {
            Message("Check: Not Null.... \n");              
        }


Message("CHECK Enter... \n.");

Message("Check:Array size %d %d \n",Nnum,NCellANode);

/*Initializing the matrix*/
for(i=0;i<Nnum;i++)
{
    for(j=0;j<NCellANode;j++)
    {
        Message("Check:Initalizing cell: %d %d \n",i,j);
        Avg_CellAroundNode[i][j]=-1;
    }
}

Message("CHECK  Exit....");

I have no issues with the above code compiling using VC++ in windows 32 bit. But in Windows 64 bit and Linux 32/64 bit (with GCC).. I get the following error:

   ==============================================================================
   Stack backtrace generated for process id 10801 on signal 1 :
   Please include this information with any bug report you file on this issue!
   ==============================================================================

   Data.In is read...
   Check: Not Null.... 
   CHECK Enter... 
   Check:Array size 10 20

   Check:Initalizing cell: 0 0 
   Check:Initalizing cell: 0 1 
   Check:Initalizing cell: 0 2 
   .
   .
   Check:Initalizing cell: 7 18 
   Check:Initalizing cell: 7 19 
   Check:Initalizing cell: 8 0 
   /opt/Fluent.Inc/fluent6.3.26/lnamd64/2ddp/fluent.6.3.26[0xcc0e0b]
   /opt/Fluent.Inc/fluent6.3.26/lnamd64/2ddp/fluent.6.3.26[0xcc0d61]
   /lib64/libpthread.so.0[0x355aa0de70]
   BubUDF/lnamd64/2ddp/libudf.so(NodeAvg+0x104)[0x2ba2089bc1bd]
   Error: fluent.6.3.26 received a fatal signal (SEGMENTATION VIOLATION).

Can any of you help me over come this issue??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:43:00+00:00Added an answer on June 6, 2026 at 1:43 pm

    Your first allocation needs to allocate a pointer to a cell_t but you are allocating a cell_t. If cell_t is 4 bytes in size then they is why it has worked so far on 32 bit (same size as a pointer) and fails on 64 bit. In the 64 bit case it would be smaller than a pointer, meaning you do not allocate enough memory and eventually overrun the bounds of what has been allocated. Your correct code should be:

    Avg_CellAroundNode =(cell_t**)calloc((Nnum+1),sizeof(cell_t*));
    

    That does not explain why it fails on 32 bit Linux though.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

what the built-in or user-defined function that I can use in Javascript or jQuery
I have a user defined function (e.g. myUDF(a,b) ) that returns an integer. I
I have a user defined function. In that function I declared a variable of
I am looking for a VBA user-defined function that will read in the contents
I'm trying to create a user defined function in Oracle that will return a
I can't understand what causes a syntax error in a user defined function. This
I created a User Defined Function with VB.NET and want to use that function
I wrote a User Defined Function that gets a UtcTimeStamp and a windowstimezoneid as
I have a user defined function in SQLite (an aggregator that calculates the product)
How to create mysql user defined function with PHP, is that straight away passing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.