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 error in User defined memory UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 12, 2018, 05:09
Default Segmentation fault error in User defined memory UDF
  #1
New Member
 
up
Join Date: Oct 2015
Posts: 10
Rep Power: 11
abhi12019 is on a distinguished road
Hi,
I want to initialize four variables to fluent memory, but during initialization getting segmentation fault. Below is my UDF:


#include "udf.h"
#define Latent_Heat 397500
DEFINE_INIT(initialize,d)
{ cell_t c;
Thread *t;
d = Get_Domain(2); //domain ID is 2
thread_loop_c(t,d) /* Loop over all cell threads in domain */
{


begin_c_loop(c,t) /* Loop over all cells in a cell thread*/
{

C_UDMI(c,t,0) = Latent_Heat;
C_UDMI(c,t,1) = Latent_Heat;
C_UDMI(c,t,2) = 1.0;
C_UDMI(c,t,3) = 1.0;
C_UDMI(c,t,4) = 1.0; /* Liquid region */
}
end_c_loop(c,t)

}
}

Thanks
abhi12019 is offline   Reply With Quote

Old   September 13, 2018, 00:16
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
You should check the pointer before deference it.

Code:
#include "udf.h"



 #define Latent_Heat 397500
DEFINE_INIT(initialize,d)
{
    cell_t c;
    Thread *t;
    d = Get_Domain(2); //domain ID is 2
    thread_loop_c(t,d) /* Loop over all cell threads in domain */
    {

        if (FLUID_THREAD_P(t) && NNULLP(THREAD_STORAGE(t, SV_UDM_I)))
        {
            begin_c_loop(c,t) /* Loop over all cells in a cell thread*/
            {

                C_UDMI(c,t,0) = Latent_Heat;
                C_UDMI(c,t,1) = Latent_Heat;
                C_UDMI(c,t,2) = 1.0;
                C_UDMI(c,t,3) = 1.0;
                C_UDMI(c,t,4) = 1.0; /* Liquid region */
            }
            end_c_loop(c,t);
        }

    }
}

However, generally people do not use
Code:
DEFINIE_INIT
in the way as you do.
blackmask is offline   Reply With Quote

Old   September 13, 2018, 02:58
Default
  #3
New Member
 
up
Join Date: Oct 2015
Posts: 10
Rep Power: 11
abhi12019 is on a distinguished road
Hi,
Thank you for your response, the macros is define in the UDF manual as the way I defined(Ref. UDF Manual November 2013, ANSYS Release 15, P-26).

I want to save the previous time step values for liquid fraction as C_UDMI, so that I can access those values during the calculation. As you said the way I defined is not the way defined, so What are the other options to define DEFINE_INIT?
abhi12019 is offline   Reply With Quote

Old   September 13, 2018, 04:17
Default
  #4
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
blackmask will become famous soon enough
For your purpose

Code:
DEFINE_EXECUTE_AT_END
is more appropriate.
blackmask is offline   Reply With Quote

Reply

Tags
segmentation fault, solidification/melting, udf, udmi


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
Received a fatal signal (Segmentation fault) with UDF lisa_china Fluent UDF and Scheme Programming 2 June 30, 2017 04:07
Fluent UDF Wall Shear Stress Segmentation Fault a1ananth Fluent UDF and Scheme Programming 3 February 24, 2015 04:23
user defined memory (UDMs) Musa FLUENT 1 October 16, 2012 22:12
User Defined Memory sreekargomatam Fluent UDF and Scheme Programming 7 May 19, 2012 05:56
use of user defined functions (UDF) Vedavyasa M FLUENT 0 June 27, 2007 07:21


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