CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

UDF for Heat source of 18650 Li-ion battery

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 9, 2022, 08:12
Default UDF for Heat source of 18650 Li-ion battery
  #1
New Member
 
Tan Dinh
Join Date: Jan 2022
Posts: 5
Rep Power: 4
nhattan121 is on a distinguished road
Hi there,
I got a problem

I try to simulating the change of temperature of 1 cell 18650, change with SOC (state of charge) and current discharge (i choose 1C). Battery cell is convection only.

I followed the one paper, and try to write a code to solve this equation:
Screenshot 2022-01-09 185918.png

Here is result i have: contour of temperature
269878958_458679472553530_7054665062281506130_n.png

Here is a link of paper which i followed.
https://www.researchgate.net/publica...-ion_batteries

This below is my code. i used in source term of battery material.


Code:
#include "udf.h"
#include "math.h"
#define I 1.0 /* this is discharge current, is constant*/ 
DEFINE_SOURCE(heat_gen_rate, cell, thread, dS, eqn)
{
    real temp = C_T(cell, thread);
    real real_time = CURRENT_TIME;
    real soc = 1-(real_time*1.897533e-4); /* i assumed total time from SOC 1 to SOC 0 is 5270 second, like a paper. */
    real q;
    real u;
    real a[5][5] = {{174.87,-4.2857,0.063921,0.00056216,2.2924e-6},
                    {-421.73,-11.846,0.65394,0.0074809,0.00002289},
                    {710.11,58.26,-1.8389,-0.007132,0.00007878},
                    {-483.23,-84.388,2.0758,-0.0029176,-0.0002021},
                    {130.58,37.67,-0.83495,0.003493,0.00010523}};
                    
    real b[6][6] = {{218.49,-6.7907,-0.026023,0.0042377,-0.0000666,3.2778e-7},
                    {-2064.3,53.454,0.53007,-0.029377,0.0002498,-1.9726e-7},
                    {7960.5,-181.44,-2.1533,0.064345,0.0003483,-8.6883e-6},
                    {-14556.0,306.86,3.5406,-0.036523,-0.0026742,0.00003051},
                    {12619.0,-251.06,-2.6282,-0.028271,0.0038013,-0.0000372},
                    {-4166.1,78.657,0.75196,0.025085,0.0016507,0.0000152}};
    real c[6] = {4.8,-13.93,2.042,32.81,-38.54,13.02};
    
    int i;
    int j;
    for (j=0;j<5;j++)
    {
        for (i=0;i<5;i++)
        {
            q=(a[i][j]*pow(soc,(i-1))*pow(temp,(j-1)));
        }
    }

    
    for (j=0;j<6;j++)
    {
        for (i=0;i<6;i++)
        {
            q=q+(a[i][j]*pow(soc,(i-1))*pow(temp,(j-1)));
        }
    }
    q=q*pow(I,2);
    
    
    for (i=0;i<6;i++)
    {
        u=(c[i]*pow(soc,(i-1)));
    }
    u=u*I*temp;
    
    q=q+u;
    dS[eqn]=0;
    return q;
}
i confused too about " dS[eqn] ". I dont know what it means, i just mimic from other user on google.
nhattan121 is offline   Reply With Quote

Old   January 9, 2022, 08:14
Default
  #2
New Member
 
Tan Dinh
Join Date: Jan 2022
Posts: 5
Rep Power: 4
nhattan121 is on a distinguished road
From temperature contour, i think the UDF code is wrong. I dont know where is error

If you see a reference paper, all matrix and equation are include in Part 2 of paper, specifically in part 2.2, 2.3, and 2.4.

Please help me.
nhattan121 is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Other] Tabulated thermophysicalProperties library chriss85 OpenFOAM Community Contributions 62 October 2, 2022 04:50
[swak4Foam] funkyDoCalc with OF2.3 massflow NiFl OpenFOAM Community Contributions 14 November 25, 2020 04:30
polynomial BC srv537 OpenFOAM Pre-Processing 4 December 3, 2016 10:07
[foam-extend.org] problem when installing foam-extend-1.6 Thomas pan OpenFOAM Installation 7 September 9, 2015 22:53
[swak4Foam] funkySetFields compilation error tayo OpenFOAM Community Contributions 39 December 3, 2012 06:18


All times are GMT -4. The time now is 20:51.