|
[Sponsors] |
Segmentation fault error in User defined memory UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 12, 2018, 05:09 |
Segmentation fault error in User defined memory UDF
|
#1 |
New Member
up
Join Date: Oct 2015
Posts: 10
Rep Power: 11 |
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 |
|
September 13, 2018, 00:16 |
|
#2 |
Senior Member
|
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 |
|
September 13, 2018, 02:58 |
|
#3 |
New Member
up
Join Date: Oct 2015
Posts: 10
Rep Power: 11 |
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? |
|
Tags |
segmentation fault, solidification/melting, udf, udmi |
Thread Tools | Search this Thread |
Display Modes | |
|
|
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 |