Ansys Learning Forum Forums Discuss Simulation Fluids SIGSEGV error in hydrogen adsorption-desorption simulation with UDFs Reply To: SIGSEGV error in hydrogen adsorption-desorption simulation with UDFs

u1903003
Subscriber

hi Rob,

Thank you for your reply. I set 4 UDS before compiling the UDF, but I am still encountering the same types of errors. I suspect there might be an issue with how pressure is being calculated.

In my UDF, I am using the following line:  P = C_P(c, t) + RP_Get_Real("operating-pressure") 

The initial and inlet pressure are set at 0.04858 MPa, while the operating pressure is defined as 10 MPa.The pressure is expected to rise quickly, but in my case, it decreases rapidly and even becomes negative. Due to this negative pressure, I am unable to obtain the value of usdi(c, t, 0).

Below is the portion of the UDF that I am currently using

DEFINE_ADJUST(adsorption, domain) {
    Thread *t; 
    cell_t c; 
    real E, A, P;
 
    thread_loop_c (t, domain) {
        begin_c_loop (c, t) {
            real tem = C_T(c, t);
            P = C_P(c, t) + RP_Get_Real("operating-pressure");
            E = 3080 + 18.9 * tem;
            A = 8.31429 * tem * log(1.47E9 / P);
            C_UDSI(c, t, 0) = 71.6 * exp(-A * A / (E * E));
        }
        end_c_loop (c, t)
    }
}
DEFINE_ADJUST(q_ads, domain) {
    Thread *t; 
    cell_t c;
    real dt;
    
    thread_loop_c(t, domain) {
        begin_c_loop(c, t) {
            dt = RP_Get_Real("physical-time-step");
            C_UDSI(c, t, 1) = C_UDSI_M1(c, t, 1) + 0.15 * dt * (C_UDSI_M1(c, t, 0) - C_UDSI_M1(c, t, 1));
        }
        end_c_loop(c, t)
    }
}
Â