ehsan.sadeghi
Subscriber

 

I did as you said, but for some reason I get error:

999999: mpt_accept: error: accept failed: No such file or directory

 

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

= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES

= RANK 0 PID 1228 RUNNING AT PC-ANSYS-157

= EXIT STATUS: -1 (ffffffff)

 

My code is:

#include”udf.h”
#define e 1.6e-19
#define epsilon0 8.854e-12
#define mu_p 1.35e-4
#define Dp 3.5e-6
DEFINE_EXECUTE_ON_LOADING(on_loading, libname)
{
    Set_User_Memory_Name(0,”Potential Source”);
    Set_User_Memory_Name(1,”Potential”);
    Set_User_Memory_Name(2,”Ex”);
    Set_User_Memory_Name(3,”Ey”);
    Set_User_Memory_Name(4,”Ez”);
    Set_User_Memory_Name(5,”Electric Field”);
    Set_User_Memory_Name(7,”x-Momentum Source”);
    Set_User_Memory_Name(8,”y-Momentum Source”);
    Set_User_Memory_Name(9,”z-Momentum Source”);
    Set_User_Scalar_Name(0,”Potential”);
    Set_User_Scalar_Name(1,”ion concentration”);
}

DEFINE_ADJUST(E_xyz,d)
{
Thread *t;
cell_t c;
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_UDMI(c,t,1) = C_UDSI(c,t,0) ;
C_UDMI(c,t,2) = -C_UDSI_G(c,t,0)[0] ;
C_UDMI(c,t,3) = -C_UDSI_G(c,t,0)[1] ;
C_UDMI(c,t,4) = -C_UDSI_G(c,t,0)[2] ;
C_UDMI(c,t,5) = NV_MAG(C_UDSI_G(c,t,0)) ;
C_UDMI(c,t,6) = C_UDSI(c,t,1) ;
}
end_c_loop(c,t)
}
}

/* Sets the gradient of phi (UDS-0) to equal E_x (UDS-1) and E_y (UDS-2), and sets face values */
DEFINE_SOURCE(phi_source,c,t,dS,eqn)
{    
real phi_source;
dS[eqn] = 0.0;
phi_source = -(e/epsilon0)*C_UDSI(c,t,1);
C_UDMI(c,t,0) = phi_source;
return phi_source;
}

DEFINE_SOURCE(momentum_x, c, t, dS, eqn)
{
real source;
dS[eqn] = 0.0;
source = e*C_UDMI(c,t,2)*C_UDSI(c,t,1);
C_UDMI(c,t,7) = source;
return source;
}

DEFINE_SOURCE(momentum_y, c, t, dS, eqn)
{
real source;
dS[eqn] = 0.0;
source = e*C_UDMI(c,t,3)*C_UDSI(c,t,1);
C_UDMI(c,t,8) = source;
return source;
}

DEFINE_SOURCE(momentum_z, c, t, dS, eqn)
{
real source;
dS[eqn] = 0.0;
source = e*C_UDMI(c,t,4)*C_UDSI(c,t,1);
C_UDMI(c,t,9) = source;
return source;
}


DEFINE_UDS_FLUX(flux_ions,f,t,i)
{
    cell_t c;
    cell_t c0, c1= -1;
    Thread *t0, *t1 = NULL;
    real NV_VEC(A), NV_VEC(E_vec), E_flux = 0.;
    real rho = C_R(c0,t0)+C_R(c1,t1);
    c0 = F_C0(f,t);
    t0 = F_C0_THREAD(f,t);
    F_AREA(A,f,t);
    if (BOUNDARY_FACE_THREAD_P(t))
    {
        E_flux = 0.0;
    }
    else
    {
        begin_c_loop(c,t)
        {
            F_UDMI(c,t,2) = C_UDMI(c,t,2) ;
            F_UDMI(c,t,3) = C_UDMI(c,t,2) ;
            F_UDMI(c,t,4) = C_UDMI(c,t,2) ;
        }
        end_c_loop(c,t)
    
    c1 = F_C1(f,t);
    t1 = F_C1_THREAD(f,t);
    NV_DS(E_vec, =, F_UDMI(c0, t0, 2), F_UDMI(c0, t0, 3), F_UDMI(c0, t0, 4), *, Dp);
    NV_DS(E_vec, +=, F_UDMI(c1, t1, 2), F_UDMI(c1, t1, 3), F_UDMI(c1, t1, 4), *, Dp);
    E_flux = NV_DOT(E_vec,A)/2.0;
    }

    if (i==1)
    {
        return (F_FLUX(f,t)/rho+E_flux);
    }
    else
        return (0.);
}