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

Segmentation fault when calling F_T using c_face_loop

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 19, 2018, 10:41
Default Segmentation fault when calling F_T using c_face_loop
  #1
New Member
 
Ben
Join Date: Mar 2013
Posts: 15
Rep Power: 13
bensciens is on a distinguished road
Hello,

I've been trying to write a FLUENT UDF which cycles through all the cells in my FLUENT case. For each cell I want to loop over all the faces and calculate something using the face temperature. However, when the code reaches 'temp=F_T(f,tf)' I get a segmentation fault. I'm fairly new to the UDF stuff so I'm struggling to find the error.

I am trying to make this work on FLUENT 17.2 and the case models the transonic, viscous 2D flow over the NACA0012 aerofoil. Here is a minimal code example which throws the segmentation fault:

Code:
#include "udf.h"
#include "mem.h"
#include "sg.h"
#include "math.h"

DEFINE_ON_DEMAND(shock_viscous3)
{
    Domain *d;
    cell_t c;
    Thread *tf;
    face_t f;
    Thread *t;
    int n;
    
    real A[ND_ND];
    real f_visc, temp;

    d=Get_Domain(1);
    Message("Entering loop\n");

    thread_loop_c(t,d)
    {    // looping over cells 
        begin_c_loop(c,t)
        {                
            f_visc= (C_MU_L(c,t)+C_MU_T(c,t))/C_MU_L(c,t);
            if (f_visc > 15.0)
            {
                c_face_loop(c, t, n)         /* loops over all faces of a cell */
                {
                    f = C_FACE(c,t,n);
                    tf = C_FACE_THREAD(c,t,n);
                    Message("Temp\n");
                    temp=F_T(f,tf);
                    Message("After Temp\n");
                }
            }
        }
        end_c_loop(c,t)
    }
}
Any help would be greatly appreciated.
bensciens is offline   Reply With Quote

Old   July 19, 2018, 15:53
Default
  #2
Senior Member
 
Lucky
Join Date: Apr 2011
Location: Orlando, FL USA
Posts: 5,754
Rep Power: 66
LuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura aboutLuckyTran has a spectacular aura about
Did you declare temp in the UDM beforehand?
LuckyTran is offline   Reply With Quote

Reply

Tags
fluent, fluent - udf


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 22:59
Segmentation fault in SU2 V5.0 ygd SU2 2 March 1, 2017 05:38
Segmentation fault when running in parallel Pj. OpenFOAM Running, Solving & CFD 3 April 8, 2015 09:12
Segmentation Fault w/ compiled OF 2.2.0 - motorBike example sudo OpenFOAM Running, Solving & CFD 3 April 2, 2013 18:27
segmentation fault when installing OF-2.1.1 on a cluster Rebecca513 OpenFOAM Installation 9 July 31, 2012 16:06


All times are GMT -4. The time now is 17:08.