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

heat generation inside battery

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 3 Post By AlexanderZ

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 18, 2021, 08:18
Default heat generation inside battery
  #1
New Member
 
Join Date: Jan 2021
Posts: 2
Rep Power: 0
ramin9512 is on a distinguished road
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
Attached Files
File Type: c new1.c (1.1 KB, 28 views)
ramin9512 is offline   Reply With Quote

Old   January 19, 2021, 00:46
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 33
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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;
}
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Old   January 22, 2021, 07:05
Default
  #3
New Member
 
Join Date: Jan 2021
Posts: 2
Rep Power: 0
ramin9512 is on a distinguished road
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
ramin9512 is offline   Reply With Quote

Old   January 25, 2021, 01:55
Default
  #4
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 33
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
allocate user defined memory location in fluent GUI

user defined -> memory -> set udm locations to 1
__________________
best regards


******************************
press LIKE if this message was helpful
AlexanderZ is offline   Reply With Quote

Reply

Tags
error c2055, heat generation rate, udf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
heat generation problem montazar FLUENT 0 March 11, 2016 14:28
Fluent transient Simulation - varying Internal Heat generation : Help! lamboram FLUENT 0 September 14, 2015 05:37
heat generation rate in the wall boundary conditions, what this? serguei Fluent Multiphase 3 September 10, 2015 17:24
Error finding variable "THERMX" sunilpatil CFX 8 April 26, 2013 08:00
Heating of a solid cylinder with internal heat generation Sriram Popuri Main CFD Forum 6 July 13, 1999 19:09


All times are GMT -4. The time now is 16:40.