|
[Sponsors] |
November 15, 2012, 01:08 |
Access Violation when using F_C0 and F_C1
|
#1 |
New Member
Trent
Join Date: Nov 2012
Posts: 3
Rep Power: 14 |
I am trying to find the cell index of a neighboring cell and found the macros F_C0 and F_C1 that look like they would work for me. However, when I try to run the code I get an Access Violation in Fluent. I read through the user manual and believe I am doing it correctly. The code is as follows:
Code:
#include "udf.h" #include "metric.h" #include "stdio.h" #include "math.h" #include "stdlib.h" float mass_load[3000]; float mass_load_new[3000]; Domain *dz; Thread *t; Thread *t0; Thread *t1; Thread *tz; Thread *tf; cell_t c, ca, cb, cz; face_t f; int j, k; DEFINE_INIT(cell_init, d) {double inlet_ml; inlet_ml = .01; j=0; thread_loop_c(t,d) {} DEFINE_ADJUST(get_data4, d) {begin_c_loop(c,t) {}mass_load[j] = inlet_ml; j++;} end_c_loop(c,t)real vel[2]; real A[2]; real next_centr[2]; double av_prod, cell_ml; double mass_load_sum, mass_out_sum; int i; dz = Get_Domain(1); j=0; thread_loop_c(t,d) {}begin_c_loop(c,t) {} j=0; thread_loop_c(t,d) {mass_load_sum = 0; mass_out_sum = 0; for(i=0; i<4; i++) { f = C_FACE(c,t,i); tf = C_FACE_THREAD(c,t,i); t0 = THREAD_T0(tf); t1 = THREAD_T1(tf); ca = F_C0(f,tf); cb = F_C1(f,tf); if(c1 != NULL) {} end_c_loop(c,t)vel[0] = ((C_U(c0,t0) + C_U(c1,t1))/2); vel[1] = ((C_V(c0,t0) + C_V(c1,t1))/2);} else {vel[0] = 0; vel[1] = 0;} F_AREA(A,f,tf); av_prod = NV_DOT(vel, A); if(av_prod < 0) {C_CENTROID(next_centr, c1, t1); k = 0; thread_loop_c(tz,dz) {} else {begin_c_loop(cz,tz) {} mass_load_sum += cell_ml * fabs(av_prod);if(cz == c) {k++; } end_c_loop(cz,tz)cell_ml = mass_load[k];}mass_out_sum += fabs(av_prod);} } mass_load_new[j] = mass_load_sum/mass_out_sum; j++;begin_c_loop(c,t) {}mass_load[j] = mass_load_new[j]; j++;} end_c_loop(c,t) |
|
Tags |
face connectivity |
|
|