CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   ACCESS_VIOLATION Error (https://www.cfd-online.com/Forums/fluent-udf/67632-access_violation-error.html)

Sourav_Dwaipayan August 21, 2009 05:00

ACCESS_VIOLATION Error
 
Basically we are trying to solve a problem on UF. But the main problem arises with the following UDF code when we interpret it.
In the UDF we are trying to sum up the previous cell value and the next cell value in reference to the current cell.

#include "udf.h"
DEFINE_ADJUST(BSAFlux,domain)
{
int i ,id = 2;
real flux, Cbulk = 1, k = 7.85*pow(10,-6);
real conc_solids, rho;
face_t f;
cell_t c;
Domain *d = Get_Domain(1);
Thread *t = Lookup_Thread(domain, id);
real timestep = RP_Get_Real("physical-time-step");
if (CURRENT_TIME>timestep)
{

begin_c_loop(c,t)
{

rho = ((C_R(F_C0(f,t),THREAD_T0(t)+C_R(F_C1(f,t),THREAD_ T1(t))) / 2.0);

conc_solids = rho * (C_YI(F_C0(f,t),THREAD_T0(t),i)+C_YI(F_C1(f,t),THR EAD_T1(t),i));

flux = k*log(conc_solids/Cbulk);
}
end_c_loop(c,t)
}

printf("Current Time = %g:Flux = %g:Membrane Concentration = %g:density = %g",CURRENT_TIME, flux,conc_solids,rho);
}

We are trying to skip the first iteration with this condition (CURRENT_TIME>timestep).

But when get ACCESS_VIOLATION error when the solver goes for the iteration either with NITA or with Frozen Flux method for the second time step.

Please give us some valuable ideas and solution in this regard at the earliest possible. We are in deep trouble with the UDF.


All times are GMT -4. The time now is 11:37.