Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
uvahotspot
GitHub Repository: uvahotspot/HotSpot
Path: blob/master/package.h
612 views
1
#ifndef __PACKAGE_H_
2
#define __PACKAGE_H_
3
4
#include "flp.h"
5
#include "util.h"
6
#include "temperature.h"
7
8
/* santity check convection resistance boundary values.
9
if outside this range, most likely some settings of
10
the heat sink or the fan are unreasonable.
11
*/
12
#define R_CONVEC_HIGH 50.0 /* upper-bound value for natural convection without heat sink */
13
#define R_CONVEC_LOW 0.01 /* lower-bound value for best cooling solution, e.g. liquid cooling */
14
15
/* fluid (air) properties */
16
#define AIR_DSTY 1.059 /* density */
17
#define AIR_SPECHT 1007 /* specific heat */
18
#define AIR_COND 0.028 /* thermal conductivity */
19
#define AIR_DIFF 2.6e-5 /* thermal diffusivity */
20
#define AIR_DYNVISC 2.0e-5 /* dynamic viscosity */
21
#define AIR_KINVISC 1.9e-5 /* kinetic viscosity */
22
23
#define PRANTDL_NUM 0.73 /* Prantdl Number of air */
24
#define REY_THRESHOLD 3500 /* laminar/turbulent reynolds threshold */
25
26
/* parameters specific to natural convection and radiation */
27
#define VOL_EXP_COEFF 3.0e-3 /* volume expansion coefficient */
28
#define GRAVITY 9.8 /* gravity acceleration rate */
29
#define STEFAN 5.67e-8 /* Stefan-Boltzmann constant */
30
#define EMISSIVITY 0.95 /* emissivity, typical value for most heatsink materials */
31
#define SMALL_FOR_CONVEC 0.01 /* initial small temperature diff b/w heatsink and ambient, to avoid sigular matrices */
32
#define NATURAL_CONVEC_TOL 0.01 /* r_convec convergence criterion for natural convection calculations */
33
#define MAX_SINK_TEMP 1000 /* max avg sink temperature during iteration for natural convection. if exceeded, report thermal runaway*/
34
35
/* flow resistance constants */
36
#define KC 0.42
37
#define KE 1.0
38
#define PI 3.1416
39
40
/* fan constants */
41
#define FAN_ALPHA 1 /* 1 for laminar flow, >=2 for turbulent flow */
42
#define FAN_BETA 4 /* 4 for laminar flow, 4.6 for turbulent flow */
43
#define FAN_POWER_COEFF 2.8 /* fan_power=b*omega^2.8 */
44
#define RPM_TO_RAD 0.105 /* convert rpm to radians per sec */
45
#define RAD_TO_RPM 9.55 /* convert radians per sec to rpm */
46
47
/* package model configuration */
48
typedef struct package_config_t_st
49
{
50
/* natural convection or not - 0: forced convection, 1: natural convection*/
51
int natural_convec;
52
53
/* airflow type - 0: lateral airflow from sink side, 1: impinging airflow from sink top*/
54
int flow_type;
55
56
/* heatsink type - 0: fin-channel sink, 1: pin-fin sink */
57
int sink_type;
58
59
/* sink specs */
60
/* sink base size is defined in thermal_config */
61
/* 1) fin-channel sink */
62
double fin_height;
63
double fin_width;
64
double channel_width;
65
/* 2) pin-fin sink */
66
double pin_height;
67
double pin_diam;
68
double pin_dist; /* distance between pins */
69
70
/* fan specs */
71
double fan_radius;
72
double motor_radius;
73
int rpm;
74
}package_config_t;
75
76
/* defaults */
77
package_config_t default_package_config(void);
78
/*
79
* parse a table of name-value string pairs and add the configuration
80
* parameters to 'package_config'
81
*/
82
void package_config_add_from_strs(package_config_t *package_config, str_pair *package_table, int size);
83
/*
84
* convert package_config into a table of name-value pairs. returns the no.
85
* of parameters converted
86
*/
87
int package_config_to_strs(package_config_t *package_config, str_pair *package_table, int max_entries);
88
89
/* airflow parameters */
90
typedef struct convection_t_st
91
{
92
double n_fin; /* number of fins */
93
double sur_area_fin; /* total surface area */
94
95
double n_pin; /* number of pins */
96
double sur_area_pin; /* total surface area */
97
98
/* flow charateristics */
99
double reynolds;
100
double nusselt;
101
double h_coeff; /* heat transfer coefficient */
102
double v; /* air velocity */
103
double r_th; /* lumped convection thermal resistance */
104
}convection_t;
105
106
/* airflow parameter routines */
107
void calculate_flow(convection_t *p, package_config_t *package_config, thermal_config_t *thermal_config);
108
109
/* debug print */
110
void debug_print_convection(convection_t *p);
111
112
/* parse thermal config table and update r_conv if needed */
113
int package_model(thermal_config_t *thermal_config, str_pair *table, int size, double sink_temp);
114
115
#endif
116
117