TAGGED: heat-generation-rate, nhattan, udf
-
-
January 10, 2022 at 5:40 am
tandinhtamky
SubscriberHi there,
I have a problem when i try to create a udf code. The temperature is too high (about 5000 K compare to ~320 K of reference paper)
I want to simulate the thermal of 1 battery cell: 18650 3400 mah panasonic.
About a condition, a cell is convection only, and no inlet/outlet in my fluent.
Here is a equation i followed and udf code upon it.
January 10, 2022 at 5:44 amtandinhtamky
Subscriberah i forgot,
in
real soc = 1-(real_time*3.20513e-4);
in reference paper, i get the total time of 1C discharge is 3120 second. And i calculate SOC linear with time.
January 10, 2022 at 11:44 amRob
Forum ModeratorI'll not try and untangle the matrix maths. In the CFD model you're adding W/m3 into a cell zone. If you check the maths have you accounted for that? What are the external boundary conditions of the cell? Default is adiabatic, so the heat has nowhere to go. Are you using any of the battery models?
January 10, 2022 at 12:19 pmtandinhtamky
SubscriberThanks for replying me.
Actually, i dont use any battery models, just a normal model.
Boundary condition, wall condition, ... i had. I only nervous in UDF heat source, about syntax, how code work.
On the other hand, i so nervous about thermal conductivity. Because it's orthotropic, i use cyl-orthotropic. It have 3 direction of thermal cond: radial, axial, tangential. The value of thermal conductivity in radial direction is 0.05.
I tried this case: (to know do my simulation work fine without udf.
Set heat generation rate to constant value. Every other condition is not change. Result show that it's divergence !
If i still set heat generation rate to constant value, but value of thermal conductivity in radial direction is 5 (100 times compare to true value), result show that it's convergence completely !
I think if value of thermal conductivity is too small, it will be affect on result. Please tell me why ?
January 10, 2022 at 2:15 pmRob
Forum ModeratorWhat's the external wall bc set as? By default it's adiabatic so adding heat will just mean you have an infinite temperature, well 5000K as that's the default limiter.
The divergence could just be down to the solver trying to create the temperature gradients, hard to judge without seeing some images and knowing what you've set up.
January 10, 2022 at 2:36 pmJanuary 10, 2022 at 4:09 pmDrAmine
Ansys EmployeeSo you have only one cell zone which is solid and using constant source term and it is diverging? Is it a summary of your problem? If you set the heat conductivity to planar / constant in all direction: will it work? Does the axial direction corresponds to (0,0,1) in your cell zone: is it a correct axis of rotation?
January 10, 2022 at 4:10 pmRob
Forum ModeratorOK, so that should stabilise at a set temperature based on the heat input and external heat transfer. How big is the domain?
January 10, 2022 at 4:37 pmtandinhtamky
SubscriberDomain is just a battery cell: 18mm diameter and 65 height. That's all.
January 10, 2022 at 4:41 pmtandinhtamky
SubscriberThanks for reply me !
i have some confused about it. i dont understand what axis origin/direction is? But, the axial direction in my model is z direction.
So you have only one cell zone which is solid and using constant source term and it is diverging? Is it a summary of your problem?
yes.
If you set the heat conductivity to planar / constant in all direction: will it work
yes it work !!
January 10, 2022 at 4:55 pmRob
Forum ModeratorIf you go to the Scale option can you check the dimensions? I want to eliminate you having an 18m diameter battery that's 65m long. Please post an image of the mesh, and temperature contour for one of the working models.
January 10, 2022 at 5:13 pmJanuary 10, 2022 at 5:34 pmRob
Forum ModeratorRemesh with a pave mesh rather than trying to force a map mesh on the face. The problem is likely caused by the squashed cells at the "corners". If you REALLY want a block mesh use an O-grid.
January 10, 2022 at 5:58 pmtandinhtamky
SubscriberThanks for your instruction. I will try tomorrow, because now is 1:00 AM in my country. Next morning i will reply. Sorry about that sir :(
January 11, 2022 at 2:34 amJanuary 11, 2022 at 9:37 amRob
Forum ModeratorOK, so mesh has been eliminated. If you do a hand calc using the external wall boundary, you know Q, A and free stream T, what temperature will the cell reach?
January 11, 2022 at 9:45 amtandinhtamky
SubscriberTemperature about 320K ~ 330K. But, can very low value of thermal conductivity induce bad-effect to result, sir?
Actually now i dont care what is exact value, just have a reasonable temperature is enough.
January 11, 2022 at 10:38 amRob
Forum ModeratorIt's more whether you're getting silly gradients. Looking at the conductivity values, a conductivity of 0.05 shouldn't cause a problem in itself, but combine that with the conductivity of 850 in the other directions and heat load you may need more mesh to pick up the temperature gradients.
January 11, 2022 at 1:27 pmDrAmine
Ansys EmployeeThe combination is doing this odd job. I also can obtain similar odd results but a finer grid resolution will correct the behavior and counter work the biasing of heat conductivity.
Better to allocate the cells in the regions where a change is there. Cylinder is bit difficult to have a better grid distribution but I recommend to rely on O-Grid and hex map mesh.
There is another method dealing with noise in the energy equation but it might be insufficient here.
January 11, 2022 at 4:50 pmJanuary 11, 2022 at 4:52 pmtandinhtamky
SubscriberHere is my udf code
include "udf.h"
#include "math.h"
#define I 3.4
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*3.20513e-4);
real q=0;
real u=0;
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=q+(a[i][j]*pow(soc,i)*pow(temp,j));
}
}
for (j=0;j<6;j++)
{
for (i=0;i<6;i++)
{
q=q+(b[i][j]*pow(soc,i)*pow(temp,j));
}
}
q=pow(I,2)*q;
for (i=0;i<6;i++)
{
u=u+(c[i]*pow(soc,i));
}
u=u*I*temp;
q=q+u;
dS[eqn]=0;
return q;
}
January 12, 2022 at 5:21 amViewing 21 reply threads- The topic ‘Write UDF code of Heat Generation rate q for 18650 Li-ion battery cell.’ is closed to new replies.
Innovation SpaceTrending discussionsTop Contributors-
6395
-
1906
-
1457
-
1308
-
1022
Top Rated Tags© 2026 Copyright ANSYS, Inc. All rights reserved.
Ansys does not support the usage of unauthorized Ansys software. Please visit www.ansys.com to obtain an official distribution.
-
The Ansys Learning Forum is a public forum. You are prohibited from providing (i) information that is confidential to You, your employer, or any third party, (ii) Personal Data or individually identifiable health information, (iii) any information that is U.S. Government Classified, Controlled Unclassified Information, International Traffic in Arms Regulators (ITAR) or Export Administration Regulators (EAR) controlled or otherwise have been determined by the United States Government or by a foreign government to require protection against unauthorized disclosure for reasons of national security, or (iv) topics or information restricted by the People's Republic of China data protection and privacy laws.















