CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   FLUENT (https://www.cfd-online.com/Forums/fluent/)
-   -   how to evaluate where UDM is failing (https://www.cfd-online.com/Forums/fluent/228065-how-evaluate-where-udm-failing.html)

tricha122 June 18, 2020 11:49

how to evaluate where UDM is failing
 
Hi,

i have a UDM that loops on all cell threads, checks if that particular thread is a boundary face thread, and if so, does some calculations to store in udm_0

I seem to be having an issue partway through.

i added

Message ("Cell Thread %d \n", t); (within thread_loop_f(t,d))

as sort of a debug and i was surprised to find that i loop through about 26 threads, and then on the 27th i get an issue. Is there any way to identify which thread is associated to those IDs below?

Also, are there particular surfaces that would have difficulty storing UDM information to?

This particular model has 2 static fluid volumes, and 1 rotating fluid volume with 2 interfaces in between.



/define/user-defined/execute-on-demand "on_demand_calc::HsgUDF"Initialized Variables
Cell Thread 92327504
Cell Thread 92166480
Cell Thread 92005456
Cell Thread 91844432
Cell Thread 91683408
Cell Thread 91522384
Cell Thread 91361360
Cell Thread 91200336
Cell Thread 91039312
Cell Thread 90878288
Cell Thread 86871328
Cell Thread 87032352
Cell Thread 87193376
Cell Thread 87354400
Cell Thread 88159520
Cell Thread 88320544
Cell Thread 88481568
Cell Thread 88642592
Cell Thread 88803616
Cell Thread 89286688
Cell Thread 89447712
Cell Thread 87515424
Cell Thread 87676448
Cell Thread 87837472
Cell Thread 87998496
Cell Thread 88964640
Cell Thread 89125664

================================================== ============================

Node 0: Process 93236: Received signal SIGSEGV.

================================================== ============================

vinerm June 18, 2020 12:27

Udf
 
It would be difficult to say without looking at the UDF. The error you are getting is related to UDF trying to access some undefined address or inaccessible one.

tricha122 June 18, 2020 12:37

Quote:

Originally Posted by vinerm (Post 775035)
It would be difficult to say without looking at the UDF. The error you are getting is related to UDF trying to access some undefined address or inaccessible one.


#include "udf.h"
#include "sg.h"


DEFINE_ON_DEMAND(on_demand_calc)
{
/* Initialize Properties*/
real ro,mu,cp,kt,vm;

/* Initialize Dittus Boelter Parameter*/
real lscal,prd,re;

/* Initialize heat Transfer Coefficient*/
real hconv;

real xc[ND_ND], xf[ND_ND];
real yp,kp,ys;

Domain *d;
Thread *t, *t0;
cell_t c0;
face_t f;

Message ("Initialized Variables\n");

d = Get_Domain(1);
/* Loop over all cell threads in the domain */
thread_loop_f(t,d)
{
Message ("Cell Thread %d \n", t);
/* function that returns TRUE if Thread *t is a boundary face thread */
if (BOUNDARY_FACE_THREAD_P(t))
{
/* Loop over all faces */
begin_f_loop(f,t)
{
/* c0 and t0 identify the adjacent cell */
c0 = F_C0(f, t);
Message ("Cell ID %d \n", c0);
t0 = THREAD_T0(t);
Message ("Cell Thread %d \n", t0);

/* Properties */
ro = C_R(c0,t0);
mu = C_MU_L(c0,t0);
cp = C_CP(c0,t0);
kt = C_K_L(c0,t0);

/* Evaluate Length Scale */
lscal = RP_Get_Real("ref/diameter")*.0254;

/* Calculate Yp - Distance from wall to centroid of first cell */

F_CENTROID(xf,f,t);
C_CENTROID(xc,c0,t0);

yp = pow(pow(xf[1]-xc[1],2)+pow(xf[2]-xc[2],2)+pow(xf[3]-xc[3],2),0.5);

/* Retreive Turbulent Kinetic Energy */

kp = C_K(c0,t0);

ys = ro*pow(0.001,0.001)*pow(kp,0.001)*yp/mu;

vm = 0.001*pow(ys/yp,0.001)*(mu/ro)*pow(lscal,0.001);

re = (ro*vm*lscal)/mu;
prd = (cp*mu)/kt;

hconv = kt/lscal*(0.001*pow(re,0.001)*pow(prd,0.001));

C_UDMI(c0,t0,0) = hconv;
F_UDMI(f,t,0) = hconv;

}
end_f_loop(f,t)
}
}
}


basically calculating HTC for each face

vinerm June 18, 2020 12:56

Code
 
thread_loop_f loops over boundary zones and not cell zones (The code is correct but you comments are not). You can use BOUNDARY_FACE_GEOMETRY macro to fetch required details, such as, distance between face and cell center. The most likely reason for the failure is that you have interfaces and those are also boundary threads, but those are not walls. So, instead of using BOUNDARY_FACE_THREAD_P use WALL_THREAD_P.

tricha122 June 18, 2020 13:45

Quote:

Originally Posted by vinerm (Post 775046)
thread_loop_f loops over boundary zones and not cell zones (The code is correct but you comments are not). You can use BOUNDARY_FACE_GEOMETRY macro to fetch required details, such as, distance between face and cell center. The most likely reason for the failure is that you have interfaces and those are also boundary threads, but those are not walls. So, instead of using BOUNDARY_FACE_THREAD_P use WALL_THREAD_P.

This is perfect. Thank you so much.


All times are GMT -4. The time now is 23:45.