58 hsink->SpreaderWidth = 0.0;
59 hsink->SpreaderHeight = 0.0;
77void *array_alloc_copy(
const void *src,
size_t size)
79 void *result=malloc(size);
82 assert(result != NULL);
83 memcpy(result,src,size);
93 dst->SinkModel = src->SinkModel ;
94 dst->AmbientHTC = src->AmbientHTC ;
95 dst->AmbientTemperature = src->AmbientTemperature ;
97 dst->SpreaderLength = src->SpreaderLength;
98 dst->SpreaderWidth = src->SpreaderWidth;
99 dst->SpreaderHeight = src->SpreaderHeight;
101 material_copy(&dst->SpreaderMaterial,&src->SpreaderMaterial);
105 dst->CellLength = src->CellLength;
106 dst->CellWidth = src->CellWidth;
107 dst->NRows = src->NRows;
108 dst->NColumns = src->NColumns;
109 dst->NumRowsBorder = src->NumRowsBorder;
110 dst->NumColumnsBorder = src->NumColumnsBorder;
112 dst->PluggableHeatsink = src->PluggableHeatsink;
194 fprintf (stream,
"%stop heat sink :\n", prefix) ;
198 fprintf (stream,
"%sbottom heat sink :\n", prefix) ;
202 fprintf (stream,
"%stop pluggable heat sink :\n", prefix) ;
207 fprintf (stream,
"wrong heat sink model\n") ;
215 "%s heat transfer coefficient %.4e ;\n",
219 "%s temperature %.2f ;\n",
225 "%s spreader length %.0f ;\n",
229 "%s spreader width %.0f ;\n",
230 prefix, hsink->SpreaderWidth) ;
233 "%s spreader height %.0f ;\n",
234 prefix, hsink->SpreaderHeight) ;
243 "%s plugin args %s ;\n",
244 prefix, hsink->
Args) ;
247 "%s cell length %.0f ;\n",
251 "%s cell width %.0f ;\n",
255 "%s num rows %d ;\n",
256 prefix, hsink->
NRows) ;
259 "%s num columns %d ;\n",
263 "%s num rows border %d ;\n",
267 "%s num columns border %d ;\n",
273static void *so = NULL;
275static void close_shared_object()
286 const double maxSlack = 0.1;
291 double numColumnsBorderDouble = borderLength / hsink->
CellLength;
292 if(numColumnsBorderDouble<0.0)
294 fprintf (stderr,
"ERROR: spreader length is smaller than the chip\n") ;
299 fprintf (stderr,
"WARNING: spreader length not a multiple of cell length\n") ;
304 double borderWidth = (hsink->SpreaderWidth - chip->
Chip.
Width) / 2.0;
307 double numRowsBorderDouble = borderWidth / hsink->
CellWidth;
308 if(numRowsBorderDouble<0.0)
310 fprintf (stderr,
"ERROR: spreader width is smaller than the chip\n") ;
315 fprintf (stderr,
"WARNING: spreader length not a multiple of cell length\n") ;
320 memset(path,0,
sizeof(path));
325 if(getcwd(path,
sizeof(path)-1)==NULL)
327 fprintf (stderr,
"ERROR: getcwd() failed\n") ;
330 strncat(path,
"/",
sizeof(path)-1);
333 strncat(path,hsink->
Plugin,
sizeof(path)-1);
334 so = dlopen(path, RTLD_LAZY | RTLD_GLOBAL);
337 fprintf (stderr,
"ERROR: could not load heatsink plugin %s\n", path) ;
340 atexit(close_shared_object);
343 (int (*)(
unsigned int,
unsigned int, double, double, double, double, double,
const char*))
344 dlsym(so,
"heatsink_init");
347 fprintf (stderr,
"ERROR: heatsink plugin reported %s\n", dlerror()) ;
352 (int (*)(
const double*,
double*))
353 dlsym(so,
"heatsink_simulate_step");
356 fprintf (stderr,
"ERROR: heatsink plugin reported %s\n", dlerror()) ;
384 * hsink->SpreaderHeight;
392 * hsink->SpreaderHeight
402 * hsink->SpreaderHeight) / (hsink->
CellWidth / 2.0);
411 * hsink->
CellWidth) / (hsink->SpreaderHeight / 2.0);
420 * area ) / (hsink->SpreaderHeight / 2.0);
CellDimension_t get_cell_length(Dimensions_t *dimensions, CellIndex_t column_index)
CellDimension_t get_cell_width(Dimensions_t *dimensions, CellIndex_t row_index)
CellIndex_t get_number_of_rows(Dimensions_t *dimensions)
CellIndex_t get_number_of_columns(Dimensions_t *dimensions)
void heat_sink_init(HeatSink_t *hsink)
HeatSink_t * heat_sink_clone(HeatSink_t *hsink)
void heat_sink_copy(HeatSink_t *dst, HeatSink_t *src)
Conductance_t get_spreader_conductance_top_bottom(HeatSink_t *hsink)
Conductance_t get_spreader_conductance_north_south(HeatSink_t *hsink)
void heat_sink_free(HeatSink_t *hsink)
Capacity_t get_spreader_capacity(HeatSink_t *hsink)
Error_t initialize_pluggable_heatsink(HeatSink_t *hsink, Analysis_t *analysis)
void heat_sink_print(HeatSink_t *hsink, FILE *stream, String_t prefix)
Error_t initialize_heat_spreader(HeatSink_t *hsink, Dimensions_t *chip)
void heat_sink_destroy(HeatSink_t *hsink)
HeatSink_t * heat_sink_calloc(void)
Conductance_t get_spreader_conductance_east_west(HeatSink_t *hsink)
Conductance_t heat_sink_conductance(HeatSink_t *hsink, Dimensions_t *dimensions, CellIndex_t row_index, CellIndex_t column_index)
Conductance_t get_spreader_conductance_top_bottom_nonuniform(HeatSink_t *hsink, ChipDimension_t area)
void material_copy(Material_t *dst, Material_t *src)
void material_destroy(Material_t *material)
void material_print(Material_t *material, FILE *stream, String_t prefix)
void material_init(Material_t *material)
void string_init(String_t *string)
void string_destroy(String_t *string)
void string_copy(String_t *dst, String_t *src)
Informations about the type of thermal simulation to be run, timing and its initial settings.
Temperature_t InitialTemperature
Collections of all the structures that are needed for the thermal simulation.
Structure used to store data about the heat dissipation through the top or bottom surfaces of the 2D/...
Temperature_t AmbientTemperature
CellDimension_t CellWidth
CellIndex_t NumColumnsBorder
SpreaderDimension_t SpreaderLength
int(* PluggableHeatsinkInit)(unsigned int nrows, unsigned int ncols, double cellwidth, double celllength, double initialtemperature, double spreaderconductance, double timestep, const char *args)
HeatSinkModel_t SinkModel
CellIndex_t NumRowsBorder
CellDimension_t CellLength
int(* PluggableHeatsink)(const double *spreadertemperatures, double *sinkheatflows)
Material_t SpreaderMaterial
SolidVHC_t VolumetricHeatCapacity
SolidTC_t ThermalConductivity
@ TDICE_SUCCESS
The function returns with success.
@ TDICE_FAILURE
The function retuerns with a generic error.
@ TDICE_HEATSINK_BOTTOM
Bottom heat sink (bottom-most layer)
@ TDICE_HEATSINK_TOP
Top heat sink (top-most layer)
@ TDICE_HEATSINK_NONE
Undefined type.
@ TDICE_HEATSINK_TOP_PLUGGABLE
Top pluggable heat sink.