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/)
-   -   heat generation inside battery (https://www.cfd-online.com/Forums/fluent-udf/233209-heat-generation-inside-battery.html)

ramin9512 January 18, 2021 07:18

heat generation inside battery
 
1 Attachment(s)
hi
i need a fluent udf for heat generation inside a battery cell.
i wrote the udf but i get c2055 error
the code is based on cell temperature and time
Can anyone give me a solution or correct the code?
thanks

AlexanderZ January 18, 2021 23:46

Code:

#include "udf.h"
#include "math.h"

DEFINE_ADJUST(cellheatgenerate,d)
{
        real SOC,ds,tm,Ri,tempu,volume,source,temp;
        Thread *t;
        cell_t c;
        tm = CURRENT_TIME;
        thread_loop_c(t,d)
        {       
                begin_c_loop(c,t)
                {               
                        SOC = 1.-((90.*tm)/5400.);

                        if ((SOC >= 0.) && (SOC <= 0.77))
                                ds = (99.88*SOC)-76.67;
                        else if ((SOC > 0.77) && (SOC <= 0.87))
                                ds = -30.;
                        else if ((SOC >0.87) && (SOC <=1.))
                                ds = -20.;

                        volume = C_VOLUME(c,t);
                        tempu = C_T(c,t);
                        if (tm == 0.)
                                temp = 291.15;
                        else if (tm > 0.)
                                temp = tempu;
                       
                        if (temp <= 298.15)
                                Ri = 0.000002258*pow(SOC,-0.3952);
                        else if ((temp > 298.15) && (temp <= 308.15))
                                Ri = 0.000001857*pow(SOC,-0.2787);
                        else if (temp > 308.15)
                                Ri = 0.000001659*pow(SOC,-0.1692);

                        temp = C_T(c,t);
                        source = ((Ri*8100.)-(90.*temp*ds/96.485))/volume;
                        C_UDMI(c,t,0) = source;                       
                }               
                end_c_loop(c,t)               
        }       
}

DEFINE_SOURCE(my_heat_source,c,t,dS,eqn)
{
        real source;
        source =  C_UDMI(c,t,0);       
        dS[eqn] = 0.0;
        return source;
}


ramin9512 January 22, 2021 06:05

hi dear AlexanderZ
i run the code and its compiled with no error but when i run the calculation its give me this error:
"the f1 process could not be started"
i tried parallel and serial and this error appeared
i gave constant source term and its run perfectly so problem isnt the mesh and model
please help to solve problem

AlexanderZ January 25, 2021 00:55

allocate user defined memory location in fluent GUI

user defined -> memory -> set udm locations to 1


All times are GMT -4. The time now is 21:26.