We’re putting the final touches on our new badges platform. Badge issuance remains temporarily paused, but all completions are being recorded and will be fulfilled once the platform is live. Thank you for your patience.

Ansys Learning Forum Forums Discuss Simulation Fluids source term modification of energy equation in non-equilibrium thermal model Reply To: source term modification of energy equation in non-equilibrium thermal model

yf70512
Subscriber

Hi Rob,

Many thanks for your suggestions. I would like to ask how to link the two cells.

I have tried to link them by the spatial coordinate because a dual cell approach is used in  non-equilibrium thermal model.

But the same errors occured "999999:mpt_accept:error: accept failed: No error" . The code is following:

DEFINE_SOURCE(Fluid_source,c,t,dS,eqn) 
{
 
real xc[ND_ND], xcs[ND_ND];
real Tf, Ts;
real hfs = HFS_CONSTANT;  // Placeholder value for heat transfer coefficient
    real Afs = AFS_CONSTANT;    // Placeholder value for interfacial area density
    real source;
int zone_ID;
Thread *st;
cell_t sc;
Domain *domain;
// Solid_Cell_id *st;
 
// Find  the coordinate position of the centroid
C_CENTROID(xc,c,t);
 
    // Obtain fluid and solid temperatures
    Tf = C_T(c, t);  // Fluid temperature
    // Ts = C_STORAGE_R(c, t, SV_T_S);  // Solid temperature
 
 
zone_ID = THREAD_ID (t);
 
if (zone_ID == 11)
{
domain  = Get_Domain(27);
thread_loop_c(st, domain) // loop over all cell threads in the domain
{
begin_c_loop (sc,st) // loop over all cells 
{
C_CENTROID(xcs,sc,st);
if (fabs(xc[0] - xcs[0]) < 1.0e-6 && fabs(xc[1] - xcs[1]) < 1.0e-6 && fabs(xc[2] - xcs[2]) < 1.0e-6)
Ts = C_T(sc,st);
break;
}
end_c_loop (sc,st)
}
    // DEFINE_PROFILE(Ts, st, xc);
}
if (zone_ID == 14)
{
domain  = Get_Domain(33);
thread_loop_c(st, domain)
{
begin_c_loop (sc,st)
{
C_CENTROID(xcs,sc,st);
if (fabs(xc[0] - xcs[0]) < 1.0e-6 && fabs(xc[1] - xcs[1]) < 1.0e-6 && fabs(xc[2] - xcs[2]) < 1.0e-6)
Ts = C_T(sc,st);
break;
}
end_c_loop (sc,st)
}
 
}
    // DEFINE_PROFILE(Ts, st, xc);
 
    // Calculate the source term based on the modified expression
    source = hfs * Afs * (pow(Ts, 4.0) - pow(Tf, 4.0));
 
    // Set the derivative of the source term with respect to Tf
    dS[eqn] = - 4.0 * hfs * Afs * pow(Tf, 3.0);
 
    return source;
 
}
Besides, the effect (exponent from 1 to 4) in my case  only affect the heat transfer in the interface between the solid and fluid.