|
[Sponsors] |
June 25, 2019, 15:45 |
Segmentation fault while using udf
|
#1 |
Member
Durgesh
Join Date: Oct 2018
Posts: 34
Rep Power: 8 |
Hello!!
I am solving 3D solidification problem. In my geometry, there is mold which is open to the atmosphere in which liquid is solidifying and in center of the mold there is a solid copper rod. There is heat transfer radially outwards and heat transfer takes from all mold surfaces. In this problem, I am attaching udf with define execute at end macros which is shown below : In boundary conditions: interior fluid zone id is 2 DEFINE_EXECUTE_AT_END(time) { cell_t c; Thread *t; Thread **pt; Domain *dd; dd=Get_Domain(1); t=Lookup_Thread(dd,2); // pt=THREAD_SUB_THREADS(t); thread_loop_c (t,dd) { /* loop over all cells */ begin_c_loop_all(c,t) { // if(C_LIQF(c,t)<1) // { // C_UDMI(c,t,0)=C_UDMI(c,t,0)+RP_Get_Real("physical-time-step"); // if(C_LIQF(c,t)==0) // { // flag++; // if(flag==1) // C_UDMI(c,t,1)=C_UDMI(c,t,0); // else // // } // else // C_UDMI(c,t,0)=0; if((0<C_LIQF(c,t))&&(C_LIQF(c,t)<1)) { C_UDMI(c,t,0)=C_UDMI(c,t,0)+RP_Get_Real("physical-time-step"); } } end_c_loop_all(c,t) } } I am getting a segmentation fault in if condition line. Please help me with this. Regards |
|
June 25, 2019, 22:06 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
did you allocate memory for your UDMI ?
go to user defined -> memory -> numbers of user-defined memories locations -> set 1 Code:
DEFINE_EXECUTE_AT_END(time) { cell_t c; Thread *t; Thread **pt; Domain *dd; real my_timestep; real my_time; dd=Get_Domain(1); t=Lookup_Thread(dd,2); my_timestep =RP_Get_Real("physical-time-step"); my_time = RP_Get_Real("flow-time"); // pt=THREAD_SUB_THREADS(t); thread_loop_c (t,dd) { /* loop over all cells */ begin_c_loop_all(c,t) { if((0<C_LIQF(c,t))&&(C_LIQF(c,t)<1)) { if (my_time > my_timestep) C_UDMI(c,t,0)= C_UDMI(c,t,0)+my_timestep; else C_UDMI(c,t,0)= my_timestep; } } end_c_loop_all(c,t) } } |
|
June 26, 2019, 05:20 |
|
#3 |
Member
Durgesh
Join Date: Oct 2018
Posts: 34
Rep Power: 8 |
Yes, I have allocated user memory for this. Otherwise, it would have given a segmentation error while initialization. I have mentioned the error line, it is in if condition. I think it is related to liquid fraction value and zone id problem.
Regards |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDM segmentation fault. | Tushar_Telmasre | Fluent UDF and Scheme Programming | 1 | March 24, 2017 06:45 |
Segmentation fault in SU2 V5.0 | ygd | SU2 | 2 | March 1, 2017 05:38 |
fatal signal segmentation fault in a UDF | hares | FLUENT | 6 | January 21, 2017 04:26 |
segmentation fault when installing OF-2.1.1 on a cluster | Rebecca513 | OpenFOAM Installation | 9 | July 31, 2012 16:06 |
Segmentation Fault | Shawn_A | OpenFOAM Running, Solving & CFD | 6 | October 31, 2011 15:38 |