Fluids

Fluids

Topics related to Fluent, CFX, Turbogrid and more.

Help: How to link the primary and auxiliary fluid cell in non-equibrilium model?

    • yf70512
      Subscriber

      Hello all,

      I am writing UDF to modify the energy source term (changing the temperature power index from 1 to 4) of non-equibrilium model in porous media.

       

      The problems are how to link the primary fluid cell and the corresponding auxiliary solid cell, and how to access the auxiliary solid temperature in primary fluid zone when I wirte the UDF to modify the energy source in fluid zone. 

      I checked the file "storage.h". and found the Svar for the dual cell as following. But these Svar index do not specify the temperature, which means the C_STORAGE_R can not be used to access the temperature. Does anyone encounter the same problem? Many thanks.

      "'''

        SV_DC_SOURCE, /*Dual Cell Heat Exchanger source*/
        SV_DC_NBR_ID,/*Dual Cell Hxc connectivity info*/
        SV_DC_NBR_DATA,/*Dual Cell Hxc nbr svar value*/

        SV_DC_NBR,/*Dual Cell id (local)*/
        SV_DC_FLUID_POR,/*Dual Cell Zone porosity profile*/

      "

      Best regards,

      Fan

    • yf70512
      Subscriber

      I found this "#define C_DHX_NBR_T(c,t) ((real *)THREAD_STORAGE(t,SV_DC_NBR_DATA))[9*(c)+sv_t]" in the file "dual_cell.h". I used C_DHX_NBR_T(c,t) to access the temperature of auxiliary cell. But the interpreting said the "sv_t" was undeclared varibles. Could anyone know what the sv_t is and how to assign this varible? 

    • Rob
      Forum Moderator

      We can't comment on undocumented macros. But.... Have you told Fluent to retain all data during the iteration process? There's a TUI command in the documentation. 

      • yf70512
        Subscriber

        Hello Rob,

        The code can not run and the fluent crashed with error "999999: mpt_accept: error: accept failed : No such file or directory". My UDF was following:

        DEFINE_SOURCE(Solid_source,c,t,dS,eqn) 
        {
            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;
            const char sv_t;
         
            // Obtain fluid and solid temperatures
            Ts = C_T(c, t);  // 
            Tf =  C_DHX_NBR_T(c,t); 
         
            // Calculate the source term based on the modified expression
            source = hfs * Afs * (pow(Tf, 4.0) - pow(Ts, 4.0));
         
            // Set the derivative of the source term with respect to Tf
            dS[eqn] = - 4.0 * hfs * Afs * pow(Ts, 3.0);
            return source;
        }
        The maro "C_DHX_NBR_T(c,t)" is in the header file "dual_cell.h". But the fluent also crashed with the same error. I am not sure if it is able to modify the energy source of the non-equibrilium model. The error "999999" always occurred.
Viewing 2 reply threads
  • You must be logged in to reply to this topic.