65 sysmatrix->
SLU_Stat.panel_histo = NULL ;
68 sysmatrix->
SLU_Stat.TinyPivots = (int) 0 ;
69 sysmatrix->
SLU_Stat.RefineSteps = (int) 0 ;
70 sysmatrix->
SLU_Stat.expansions = (int) 0 ;
92 sysmatrix->
Size = size ;
93 sysmatrix->
NNz = nnz ;
111 if (sysmatrix->
Values == NULL)
118 dCreate_CompCol_Matrix
122 SLU_NC, SLU_D, SLU_GE) ;
132 free (sysmatrix->
Values) ;
134 Destroy_SuperMatrix_Store (&sysmatrix->
SLUMatrix_A) ;
145 free (sysmatrix->
Values) ;
147 Destroy_SuperMatrix_Store (&sysmatrix->
SLUMatrix_A) ;
154 sysmatrix->
SLU_Etree = (
int *) malloc (
sizeof(
int) * sysmatrix->
Size) ;
160 free (sysmatrix->
Values) ;
162 Destroy_SuperMatrix_Store (&sysmatrix->
SLUMatrix_A) ;
194 sysmatrix->
SLU_Options.Fact = SamePattern_SameRowPerm ;
198 fprintf (stderr,
"ERROR: wrong factorization status %d\n",
207 sp_ienv(2), sp_ienv(1),
222 fprintf (stderr,
"SuperLu factorization error %d\n", sysmatrix->
SLU_Info) ;
234 free (sysmatrix->
Values) ;
242 Destroy_SuperMatrix_Store (&sysmatrix->
SLUMatrix_A) ;
247 Destroy_SuperNode_Matrix (&sysmatrix->
SLUMatrix_L) ;
257static int compare(
const void* p1,
const void* p2) {
261 if ( (*a)[1] < (*b)[1] )
263 else if ((*a)[1] > (*b)[1])
267 if ( (*a)[0] >= (*b)[0] )
return 1;
291 memset(matrix_tmp, 0,
sizeof matrix_tmp);
293 ConnectionListNode_t* i_cell;
295 for(i_cell = dimensions->
connections_list.First; i_cell!=NULL; i_cell=i_cell->Next)
297 matrix_tmp[matrix_tmp_index][0] = i_cell->Data.node2;
298 matrix_tmp[matrix_tmp_index][1] = i_cell->Data.node1;
299 matrix_tmp[matrix_tmp_index][2] =
get_conductance_non_uniform(thermal_grid, dimensions, i_cell, i_cell->Data.node2, i_cell->Data.node1, &sign_note);
300 #ifdef PRINT_DEBUG_INFO
301 printf(
"r:%d, c:%d, v:%f\n",i_cell->Data.node2,i_cell->Data.node1,matrix_tmp[matrix_tmp_index][2]);
304 matrix_tmp[matrix_tmp_index][0] = i_cell->Data.node1;
305 matrix_tmp[matrix_tmp_index][1] = i_cell->Data.node2;
306 matrix_tmp[matrix_tmp_index][2] = sign_note*matrix_tmp[matrix_tmp_index-1][2];
312 CellIndex_t matrix_tmp_index_3 = matrix_tmp_index_2;
314 for(; matrix_tmp_index_3 < dimensions->
Grid.
NConnections; matrix_tmp_index_3++)
317 matrix_tmp[matrix_tmp_index_3][0] = matrix_tmp_index_3-matrix_tmp_index_2;
318 matrix_tmp[matrix_tmp_index_3][1] = matrix_tmp_index_3-matrix_tmp_index_2;
321 Non_uniform_cellListNode_t* node = dimensions->
Cell_list.First;
322 CellIndex_t node_index = matrix_tmp_index_3-matrix_tmp_index_2;
330 matrix_tmp[matrix_tmp_index_3][2] /= analysis->
StepTime ;
334 if (layer_index < dimensions->Grid.NLayers)
342 matrix_tmp[matrix_tmp_index_3][2] += ( 2.0
361 if (node->Data.isChannel == 1)
363 if (node->Data.left_y+node->Data.width == dimensions->
Chip.
Width)
373 if (node->Data.isChannel == 1)
375 if (node->Data.left_y+node->Data.width == dimensions->
Chip.
Width)
384 matrix_tmp[matrix_tmp_index_3][2] += 0.0;
390 matrix_tmp_index_3 = matrix_tmp_index_2;
391 for(; matrix_tmp_index>0; matrix_tmp_index--)
393 matrix_tmp_index_3 = matrix_tmp_index_2+matrix_tmp[matrix_tmp_index-1][1];
394 matrix_tmp[matrix_tmp_index_3][2] += -matrix_tmp[matrix_tmp_index-1][2];
397 qsort(matrix_tmp, dimensions->
Grid.
NConnections,
sizeof matrix_tmp[0],compare);
407 *sysmatrix.
Values++ = matrix_tmp[i][2];
442 Conductance_t g_bottom, g_top, g_north, g_south, g_east, g_west ;
444#ifdef PRINT_SYSTEM_MATRIX
445 fpos_t diag_fposition, last_fpos ;
448 "add_solid_column l %2d r %4d c %4d [%7d]\n",
449 layer_index, row_index, column_index,
463 (dimensions, layer_index - 1, row_index, column_index) ;
467 (thermal_grid, dimensions, layer_index , row_index, column_index) ;
471 (thermal_grid, dimensions, layer_index - 1, row_index, column_index) ;
475 conductance = g_bottom ;
479 conductance =
PARALLEL (g_bottom, g_top) ;
481 *sysmatrix.
Values++ = -conductance ;
482 diagonal_value += conductance ;
486#ifdef PRINT_SYSTEM_MATRIX
488 " bottom \t%d\t% .4e = % .4e (B) || % .4e (T)\n",
496 if (row_index ==
first_row (dimensions))
goto skip_south ;
500 (dimensions, layer_index, row_index - 1, column_index) ;
504 (thermal_grid, dimensions, layer_index, row_index , column_index) ;
508 (thermal_grid, dimensions, layer_index, row_index - 1, column_index) ;
510 conductance =
PARALLEL (g_south, g_north) ;
512 *sysmatrix.
Values++ = -conductance ;
513 diagonal_value += conductance ;
517#ifdef PRINT_SYSTEM_MATRIX
519 " south \t%d\t% .4e = % .4e (S) || % .4e (N)\n",
527 if (column_index ==
first_column (dimensions))
goto skip_west ;
531 (dimensions, layer_index, row_index, column_index - 1) ;
535 (thermal_grid, dimensions, layer_index, row_index, column_index ) ;
539 (thermal_grid, dimensions, layer_index, row_index, column_index - 1) ;
541 conductance =
PARALLEL (g_west, g_east) ;
543 *sysmatrix.
Values++ = -conductance ;
544 diagonal_value += conductance ;
548#ifdef PRINT_SYSTEM_MATRIX
550 " west \t%d\t% .4e = % .4e (W) || % .4e (E)\n",
560 (dimensions, layer_index, row_index, column_index) ;
568 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
578 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
585 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
588 diagonal_pointer = sysmatrix.
Values++ ;
592#ifdef PRINT_SYSTEM_MATRIX
593 fprintf (stderr,
" diagonal\t%d\t", *(sysmatrix.
RowIndices-1)) ;
594 fgetpos (stderr, &diag_fposition) ;
595 fprintf (stderr,
" ( + % .4e [capacity] )\n", *(sysmatrix.
Values-1)) ;
600 if (column_index ==
last_column (dimensions))
goto skip_east ;
604 (dimensions, layer_index, row_index, column_index + 1) ;
608 (thermal_grid, dimensions, layer_index, row_index, column_index ) ;
612 (thermal_grid, dimensions, layer_index, row_index, column_index + 1) ;
614 conductance =
PARALLEL (g_east, g_west) ;
616 *sysmatrix.
Values++ = -conductance ;
617 diagonal_value += conductance ;
621#ifdef PRINT_SYSTEM_MATRIX
623 " east \t%d\t% .4e = % .4e (E) || % .4e (W)\n",
631 if (row_index ==
last_row (dimensions))
goto skip_north ;
635 (dimensions, layer_index, row_index + 1, column_index) ;
639 (thermal_grid, dimensions, layer_index, row_index , column_index) ;
643 (thermal_grid, dimensions, layer_index, row_index + 1, column_index) ;
645 conductance =
PARALLEL (g_north, g_south) ;
647 *sysmatrix.
Values++ = -conductance ;
648 diagonal_value += conductance ;
652#ifdef PRINT_SYSTEM_MATRIX
654 " north \t%d\t% .4e = % .4e (N) || % .4e (S)\n",
662 if (layer_index ==
last_layer (dimensions))
goto skip_top ;
666 (dimensions, layer_index + 1, row_index, column_index) ;
670 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
674 (thermal_grid, dimensions, layer_index + 1, row_index, column_index) ;
678 conductance = g_top ;
682 conductance =
PARALLEL (g_top, g_bottom) ;
684 *sysmatrix.
Values++ = -conductance ;
685 diagonal_value += conductance ;
689#ifdef PRINT_SYSTEM_MATRIX
691 " top \t%d\t% .4e = % .4e (T) || % .4e (B)\n",
703 (dimensions, thermal_grid->
TopHeatSink, row_index, column_index) ;
705 g_top =
get_conductance_top(thermal_grid, dimensions, layer_index, row_index, column_index) ;
709 conductance =
PARALLEL (g_bottom, g_top) ;
711 *sysmatrix.
Values++ = -conductance ;
712 diagonal_value += conductance ;
716 #ifdef PRINT_SYSTEM_MATRIX
718 " top \t%d\t% .4e = % .4e (T) || % .4e (B)\n",
726 *diagonal_pointer += diagonal_value ;
728#ifdef PRINT_SYSTEM_MATRIX
729 fgetpos (stderr, &last_fpos) ;
730 fsetpos (stderr, &diag_fposition) ;
731 fprintf (stderr,
"% .4e", *diagonal_pointer) ;
732 fsetpos (stderr, &last_fpos) ;
759#ifdef PRINT_SYSTEM_MATRIX
760 fpos_t diag_fposition, last_fpos ;
762 "add_liquid_column_4rm l %2d r %4d c %4d [%7d]\n",
763 layer_index, row_index, column_index,
775 (dimensions, layer_index - 1, row_index, column_index) ;
783 *sysmatrix.
Values++ = -conductance ;
784 diagonal_value += conductance ;
788#ifdef PRINT_SYSTEM_MATRIX
790 " bottom \t%d\t% .4e = % .4e (B) || % .4e (T)\n",
793 get_conductance_top (thermal_grid, dimensions, layer_index - 1, row_index, column_index)) ;
799 if ( row_index !=
first_row (dimensions) )
803 (dimensions, layer_index, row_index - 1, column_index) ;
807 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
811#ifdef PRINT_SYSTEM_MATRIX
813 " south \t%d\t% .4e (N)\n",
824 (dimensions, layer_index, row_index, column_index - 1) ;
832 *sysmatrix.
Values++ = -conductance ;
833 diagonal_value += conductance ;
837#ifdef PRINT_SYSTEM_MATRIX
839 " west \t%d\t% .4e = % .4e (W) || % .4e (E)\n",
850 (dimensions, layer_index, row_index, column_index) ;
858 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
863 diagonal_pointer = sysmatrix.
Values++ ;
867#ifdef PRINT_SYSTEM_MATRIX
868 fprintf (stderr,
" diagonal\t%d\t", *(sysmatrix.
RowIndices-1)) ;
869 fgetpos (stderr, &diag_fposition) ;
870 fprintf (stderr,
" ( + % .4e [capacity] )\n", *(sysmatrix.
Values-1)) ;
879 (dimensions, layer_index, row_index, column_index + 1) ;
887 *sysmatrix.
Values++ = -conductance ;
888 diagonal_value += conductance ;
892#ifdef PRINT_SYSTEM_MATRIX
894 " east \t%d\t% .4e = % .4e (E) || % .4e (W)\n",
903 if ( row_index !=
last_row(dimensions) )
907 (dimensions, layer_index, row_index + 1, column_index) ;
911 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
915#ifdef PRINT_SYSTEM_MATRIX
917 " north \t%d\t% .4e (S)\n",
928 (dimensions, layer_index + 1, row_index, column_index) ;
936 *sysmatrix.
Values++ = -conductance ;
937 diagonal_value += conductance ;
941#ifdef PRINT_SYSTEM_MATRIX
943 " top \t%d\t% .4e = % .4e (T) || % .4e (B)\n",
952 *diagonal_pointer += diagonal_value ;
958 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
960#ifdef PRINT_SYSTEM_MATRIX
961 fgetpos (stderr, &last_fpos) ;
962 fsetpos (stderr, &diag_fposition) ;
963 fprintf (stderr,
"% .4e", *diagonal_pointer) ;
964 fsetpos (stderr, &last_fpos) ;
991#ifdef PRINT_SYSTEM_MATRIX
992 fpos_t diag_fposition, last_fpos ;
994 "add_liquid_column_2rm l %2d r %4d c %4d [%7d]\n",
995 layer_index, row_index, column_index,
1007 (dimensions, layer_index - 2, row_index, column_index) ;
1011 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
1013 *sysmatrix.
Values++ = -conductance ;
1014 diagonal_value += conductance ;
1018#ifdef PRINT_SYSTEM_MATRIX
1020 " bottom \t%d\t% .4e (B)\n",
1027 if ( row_index !=
first_row (dimensions) )
1031 (dimensions, layer_index, row_index - 1, column_index) ;
1035 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
1039#ifdef PRINT_SYSTEM_MATRIX
1041 " south \t%d\t% .4e (N)\n",
1050 (dimensions, layer_index, row_index, column_index) ;
1052 *sysmatrix.
Values = 0.0 ;
1058 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
1063 diagonal_pointer = sysmatrix.
Values++ ;
1067#ifdef PRINT_SYSTEM_MATRIX
1068 fprintf (stderr,
" diagonal\t%d\t", *(sysmatrix.
RowIndices-1)) ;
1069 fgetpos (stderr, &diag_fposition) ;
1070 fprintf (stderr,
" ( + % .4e [capacity] )\n", *(sysmatrix.
Values-1)) ;
1075 if ( row_index !=
last_row(dimensions) )
1079 (dimensions, layer_index, row_index + 1, column_index) ;
1083 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
1087#ifdef PRINT_SYSTEM_MATRIX
1089 " north \t%d\t% .4e (S)\n",
1096 if ( layer_index !=
last_layer (dimensions) )
1100 (dimensions, layer_index + 1, row_index, column_index) ;
1104 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
1106 *sysmatrix.
Values++ = -conductance ;
1107 diagonal_value += conductance ;
1111#ifdef PRINT_SYSTEM_MATRIX
1113 " top \t%d\t% .4e (T)\n",
1120 *diagonal_pointer += diagonal_value ;
1126 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
1128#ifdef PRINT_SYSTEM_MATRIX
1129 fgetpos (stderr, &last_fpos) ;
1130 fsetpos (stderr, &diag_fposition) ;
1131 fprintf (stderr,
"% .4e", *diagonal_pointer) ;
1132 fsetpos (stderr, &last_fpos) ;
1159#ifdef PRINT_SYSTEM_MATRIX
1160 fpos_t diag_fposition, last_fpos ;
1162 "add_bottom_wall_column_2rm l %2d r %4d c %4d [%7d]\n",
1163 layer_index, row_index, column_index,
1175 (dimensions, layer_index - 1, row_index, column_index) ;
1179 (thermal_grid, dimensions, layer_index - 1, row_index, column_index) ;
1181 *sysmatrix.
Values++ = -conductance ;
1182 diagonal_value += conductance ;
1186#ifdef PRINT_SYSTEM_MATRIX
1188 " Bottom connected to Silicon \t%d\t% .4e\n",
1197 (dimensions, layer_index, row_index, column_index) ;
1199 *sysmatrix.
Values = 0.0 ;
1205 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
1210 diagonal_pointer = sysmatrix.
Values++ ;
1214#ifdef PRINT_SYSTEM_MATRIX
1215 fprintf (stderr,
" diagonal\t%d\t", *(sysmatrix.
RowIndices-1)) ;
1216 fgetpos (stderr, &diag_fposition) ;
1217 fprintf (stderr,
" ( + % .4e [capacity] )\n", *(sysmatrix.
Values-1)) ;
1222 if ( layer_index !=
last_layer (dimensions) )
1226 (dimensions, layer_index + 1, row_index, column_index) ;
1230 (thermal_grid, dimensions, layer_index + 1, row_index, column_index) ;
1232 *sysmatrix.
Values++ = -conductance ;
1233 diagonal_value += conductance ;
1237#ifdef PRINT_SYSTEM_MATRIX
1239 " Top connected to Channel \t%d\t% .4e\n",
1246 if ( layer_index !=
last_layer (dimensions) )
1250 (dimensions, layer_index + 2, row_index, column_index) ;
1254 (thermal_grid, dimensions, layer_index + 2, row_index, column_index) ;
1256 *sysmatrix.
Values++ = -conductance ;
1257 diagonal_value += conductance ;
1261#ifdef PRINT_SYSTEM_MATRIX
1263 " Top connceted to Virtual Wall \t%d\t% .4e\n",
1270 *diagonal_pointer += diagonal_value ;
1272#ifdef PRINT_SYSTEM_MATRIX
1273 fgetpos (stderr, &last_fpos) ;
1274 fsetpos (stderr, &diag_fposition) ;
1275 fprintf (stderr,
"% .4e", *diagonal_pointer) ;
1276 fsetpos (stderr, &last_fpos) ;
1303#ifdef PRINT_SYSTEM_MATRIX
1304 fpos_t diag_fposition, last_fpos ;
1306 "add_top_wall_column_2rm l %2d r %4d c %4d [%7d]\n",
1307 layer_index, row_index, column_index,
1319 (dimensions, layer_index - 2, row_index, column_index) ;
1323 (thermal_grid, dimensions, layer_index - 2, row_index, column_index) ;
1325 *sysmatrix.
Values++ = -conductance ;
1326 diagonal_value += conductance ;
1330#ifdef PRINT_SYSTEM_MATRIX
1332 " Bottom connected to Channel \t%d\t% .4e\n",
1343 (dimensions, layer_index - 1, row_index, column_index) ;
1347 (thermal_grid, dimensions, layer_index - 1, row_index, column_index) ;
1349 *sysmatrix.
Values++ = -conductance ;
1350 diagonal_value += conductance ;
1354#ifdef PRINT_SYSTEM_MATRIX
1356 " Bottom connected to Virtual Wall \t%d\t% .4e\n",
1365 (dimensions, layer_index, row_index, column_index) ;
1367 *sysmatrix.
Values = 0.0 ;
1373 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
1378 diagonal_pointer = sysmatrix.
Values++ ;
1382#ifdef PRINT_SYSTEM_MATRIX
1383 fprintf (stderr,
" diagonal\t%d\t", *(sysmatrix.
RowIndices-1)) ;
1384 fgetpos (stderr, &diag_fposition) ;
1385 fprintf (stderr,
" ( + % .4e [capacity] )\n", *(sysmatrix.
Values-1)) ;
1390 if ( layer_index !=
last_layer (dimensions) )
1394 (dimensions, layer_index + 1, row_index, column_index) ;
1398 (thermal_grid, dimensions, layer_index + 1, row_index, column_index) ;
1400 *sysmatrix.
Values++ = -conductance ;
1401 diagonal_value += conductance ;
1405#ifdef PRINT_SYSTEM_MATRIX
1407 " Top connected to Silicon \t%d\t% .4e\n",
1414 *diagonal_pointer += diagonal_value ;
1416#ifdef PRINT_SYSTEM_MATRIX
1417 fgetpos (stderr, &last_fpos) ;
1418 fsetpos (stderr, &diag_fposition) ;
1419 fprintf (stderr,
"% .4e", *diagonal_pointer) ;
1420 fsetpos (stderr, &last_fpos) ;
1449#ifdef PRINT_SYSTEM_MATRIX
1450 fpos_t diag_fposition, last_fpos ;
1452 "add_virtual_wall_column l %2d r %4d c %4d [%7d]\n",
1453 layer_index, row_index, column_index,
1465 (dimensions, layer_index - 1, row_index, column_index) ;
1469 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
1471 *sysmatrix.
Values++ = -conductance ;
1472 diagonal_value += conductance ;
1476#ifdef PRINT_SYSTEM_MATRIX
1478 " bottom \t%d\t% .4e\n",
1490 (dimensions, layer_index, row_index - 1, column_index) ;
1498 *sysmatrix.
Values++ = -conductance ;
1499 diagonal_value += conductance ;
1503#ifdef PRINT_SYSTEM_MATRIX
1505 " south \t%d\t% .4e\n", *(sysmatrix.
RowIndices-1), *(sysmatrix.
Values-1)) ;
1513 (dimensions, layer_index, row_index, column_index) ;
1515 *sysmatrix.
Values = 0.0 ;
1521 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
1526 diagonal_pointer = sysmatrix.
Values++ ;
1530#ifdef PRINT_SYSTEM_MATRIX
1531 fprintf (stderr,
" diagonal\t%d\t", *(sysmatrix.
RowIndices-1)) ;
1532 fgetpos (stderr, &diag_fposition) ;
1533 fprintf (stderr,
" ( + % .4e [capacity] )\n", *(sysmatrix.
Values-1)) ;
1539 && row_index !=
last_row (dimensions))
1543 (dimensions, layer_index, row_index + 1, column_index) ;
1551 *sysmatrix.
Values++ = -conductance ;
1552 diagonal_value += conductance ;
1556#ifdef PRINT_SYSTEM_MATRIX
1558 " north \t%d\t% .4e\n",
1565 if ( layer_index !=
last_layer (dimensions) )
1569 (dimensions, layer_index + 2, row_index, column_index) ;
1573 (thermal_grid, dimensions, layer_index, row_index, column_index) ;
1575 *sysmatrix.
Values++ = -conductance ;
1576 diagonal_value += conductance ;
1580#ifdef PRINT_SYSTEM_MATRIX
1582 " top \t%d\t% .4e\n",
1589 *diagonal_pointer += diagonal_value ;
1591#ifdef PRINT_SYSTEM_MATRIX
1592 fgetpos (stderr, &last_fpos) ;
1593 fsetpos (stderr, &diag_fposition) ;
1594 fprintf (stderr,
"% .4e", *diagonal_pointer) ;
1595 fsetpos (stderr, &last_fpos) ;
1620 Conductance_t g_bottom, g_top, g_north, g_south, g_east, g_west ;
1622#ifdef PRINT_SYSTEM_MATRIX
1623 fpos_t diag_fposition, last_fpos ;
1626 "add_spreader_column r %4d c %4d [%7d]\n",
1627 row_index, column_index,
1641 (dimensions, sink,
last_layer(dimensions), row_index, column_index) ;
1646 (thermal_grid, dimensions,
last_layer(dimensions),
1649 conductance =
PARALLEL (g_bottom, g_top) ;
1651 *sysmatrix.
Values++ = -conductance ;
1652 diagonal_value += conductance ;
1656#ifdef PRINT_SYSTEM_MATRIX
1658 " bottom \t%d\t% .4e = % .4e (B) || % .4e (T)\n",
1666 if (row_index == 0)
goto skip_south ;
1669 (dimensions, sink, row_index - 1, column_index) ;
1673 conductance =
PARALLEL (g_south, g_north) ;
1675 *sysmatrix.
Values++ = -conductance ;
1676 diagonal_value += conductance ;
1680#ifdef PRINT_SYSTEM_MATRIX
1682 " south \t%d\t% .4e = % .4e (S) || % .4e (N)\n",
1690 if (column_index == 0)
goto skip_west ;
1693 (dimensions, sink, row_index, column_index - 1) ;
1697 conductance =
PARALLEL (g_west, g_east) ;
1699 *sysmatrix.
Values++ = -conductance ;
1700 diagonal_value += conductance ;
1704#ifdef PRINT_SYSTEM_MATRIX
1706 " west \t%d\t% .4e = % .4e (W) || % .4e (E)\n",
1715 (dimensions, sink, row_index, column_index) ;
1717 *sysmatrix.
Values = 0.0 ;
1724 diagonal_pointer = sysmatrix.
Values++ ;
1728#ifdef PRINT_SYSTEM_MATRIX
1729 fprintf (stderr,
" diagonal\t%d\t", *(sysmatrix.
RowIndices-1)) ;
1730 fgetpos (stderr, &diag_fposition) ;
1731 fprintf (stderr,
" ( + % .4e [capacity] )\n", *(sysmatrix.
Values-1)) ;
1736 if (column_index == sink->
NColumns - 1)
goto skip_east ;
1739 (dimensions, sink, row_index, column_index + 1) ;
1743 conductance =
PARALLEL (g_east, g_west) ;
1745 *sysmatrix.
Values++ = -conductance ;
1746 diagonal_value += conductance ;
1750#ifdef PRINT_SYSTEM_MATRIX
1752 " east \t%d\t% .4e = % .4e (E) || % .4e (W)\n",
1760 if (row_index == sink->
NRows - 1)
goto skip_north ;
1763 (dimensions, sink, row_index + 1, column_index) ;
1767 conductance =
PARALLEL (g_north, g_south) ;
1769 *sysmatrix.
Values++ = -conductance ;
1770 diagonal_value += conductance ;
1774#ifdef PRINT_SYSTEM_MATRIX
1776 " north \t%d\t% .4e = % .4e (N) || % .4e (S)\n",
1790 *diagonal_pointer += diagonal_value ;
1792#ifdef PRINT_SYSTEM_MATRIX
1793 fgetpos (stderr, &last_fpos) ;
1794 fsetpos (stderr, &diag_fposition) ;
1795 fprintf (stderr,
"% .4e", *diagonal_pointer) ;
1796 fsetpos (stderr, &last_fpos) ;
1817#ifdef PRINT_SYSTEM_MATRIX
1819 "fill_system_matrix ( l %d r %d c %d )\n",
1827 tmp_matrix.
Size = sysmatrix->
Size ;
1828 tmp_matrix.
NNz = sysmatrix->
NNz ;
1840 tmp_matrix = add_solid_column_non_uniform(tmp_matrix, thermal_grid, analysis, dimensions) ;
1846 for (lindex = 0u ; lindex != thermal_grid->
NLayers ; lindex++)
1866 tmp_matrix = add_solid_column
1868 (tmp_matrix, thermal_grid, analysis, dimensions,
1869 lindex, row, column) ;
1887 tmp_matrix = add_liquid_column_4rm
1889 (tmp_matrix, thermal_grid, analysis, dimensions,
1890 lindex, row, column) ;
1894 tmp_matrix = add_solid_column
1896 (tmp_matrix, thermal_grid, analysis, dimensions,
1897 lindex, row, column) ;
1915 tmp_matrix = add_liquid_column_2rm
1917 (tmp_matrix, thermal_grid, analysis, dimensions,
1918 lindex, row, column) ;
1935 tmp_matrix = add_virtual_wall_column_2rm
1937 (tmp_matrix, thermal_grid, analysis, dimensions,
1939 lindex, row, column) ;
1955 tmp_matrix = add_top_wall_column_2rm
1957 (tmp_matrix, thermal_grid, analysis, dimensions,
1958 lindex, row, column) ;
1974 tmp_matrix = add_bottom_wall_column_2rm
1976 (tmp_matrix, thermal_grid, analysis, dimensions,
1977 lindex, row, column) ;
1986 fprintf (stderr,
"ERROR: unset layer type\n") ;
1992 fprintf (stderr,
"ERROR: unknown layer type %d\n", thermal_grid->
LayersTypeProfile [lindex]) ;
2003 tmp_matrix = add_spreader_column
2004 (tmp_matrix, thermal_grid, analysis, dimensions,
2009#ifdef PRINT_DEBUG_INFO
2010 printf(
"system matrix info:\n");
2012 printf(
"%d:\t%f\n", i, *(sysmatrix->
Values+i));
2030 "Error (%d) while solving linear system\n", sysmatrix->
SLU_Info) ;
2042 FILE* file = fopen (file_name,
"w") ;
2046 fprintf(stderr,
"Cannot open file %s\n", file_name) ;
2052 for (column = 0 ; column < sysmatrix.
Size ; column++)
2058 fprintf (file,
"%9d\t%9d\t%32.24f\n",
CellDimension_t get_cell_height(Dimensions_t *dimensions, CellIndex_t layer_index)
CellIndex_t get_number_of_layers(Dimensions_t *dimensions)
CellIndex_t get_layer_cell_offset_from_spreader_coordinates(Dimensions_t *dimensions, struct HeatSink_t *hsink, CellIndex_t layer_index, CellIndex_t row_index, CellIndex_t column_index)
CellIndex_t get_cell_offset_in_stack(Dimensions_t *dimensions, CellIndex_t layer_index, CellIndex_t row_index, CellIndex_t column_index)
CellIndex_t get_spreader_cell_offset(Dimensions_t *dimensions, struct HeatSink_t *hsink, CellIndex_t row_index, CellIndex_t column_index)
CellIndex_t get_spreader_cell_offset_from_layer_coordinates(Dimensions_t *dimensions, struct HeatSink_t *hsink, CellIndex_t row_index, CellIndex_t column_index)
CellIndex_t last_column(Dimensions_t *dimensions)
CellIndex_t last_layer(Dimensions_t *dimensions)
CellIndex_t get_number_of_rows(Dimensions_t *dimensions)
bool has_layer_underneath(Dimensions_t *dimensions, struct HeatSink_t *hsink, CellIndex_t row_index, CellIndex_t column_index)
CellIndex_t first_layer(Dimensions_t *dimensions)
CellIndex_t first_column(Dimensions_t *dimensions)
CellIndex_t get_number_of_columns(Dimensions_t *dimensions)
CellIndex_t first_row(Dimensions_t *dimensions)
CellIndex_t last_row(Dimensions_t *dimensions)
Conductance_t get_spreader_conductance_top_bottom(HeatSink_t *hsink)
Conductance_t get_spreader_conductance_north_south(HeatSink_t *hsink)
Capacity_t get_spreader_capacity(HeatSink_t *hsink)
Conductance_t get_spreader_conductance_east_west(HeatSink_t *hsink)
SolidTC_t get_thermal_conductivity(Layer_t *layer, CellIndex_t row_index, CellIndex_t column_index, Dimensions_t *dimensions)
#define IS_CHANNEL_COLUMN(channel_model, column)
Informations about the type of thermal simulation to be run, timing and its initial settings.
AnalysisType_t AnalysisType
ChannelModel_t ChannelModel
Collections of all the structures that are needed for the thermal simulation.
ConnectionList_t connections_list
Non_uniform_cellList_t Cell_list
Structure used to store data about the heat dissipation through the top or bottom surfaces of the 2D/...
CellIndex_t NumColumnsBorder
HeatSinkModel_t SinkModel
CellIndex_t NumRowsBorder
Structure representing the squared matrix storing the coefficients of the linear system that is solve...
SuperMatrix SLUMatrix_A_Permuted
SystemMatrixCoeff_t * Values
int * SLU_PermutationMatrixR
CellIndex_t * ColumnPointers
superlu_options_t SLU_Options
int * SLU_PermutationMatrixC
Structure used to store data about the thermal cells / RC nodes.
StackLayerType_t * LayersTypeProfile
Error_t system_matrix_build(SystemMatrix_t *sysmatrix, CellIndex_t size, CellIndex_t nnz)
void system_matrix_init(SystemMatrix_t *sysmatrix)
void system_matrix_destroy(SystemMatrix_t *sysmatrix)
Error_t do_factorization(SystemMatrix_t *sysmatrix)
void fill_system_matrix(SystemMatrix_t *sysmatrix, ThermalGrid_t *thermal_grid, Analysis_t *analysis, Dimensions_t *dimensions)
Error_t solve_sparse_linear_system(SystemMatrix_t *sysmatrix, SuperMatrix *b)
void system_matrix_print(SystemMatrix_t sysmatrix, String_t file_name)
Conductance_t get_conductance_non_uniform(ThermalGrid_t *tgrid, Dimensions_t *dimensions, ConnectionListNode_t *i_cell, CellIndex_t node1_index, CellIndex_t node2_index, Conductance_t *sign_note)
Capacity_t get_capacity(ThermalGrid_t *tgrid, Dimensions_t *dimensions, CellIndex_t layer_index, CellIndex_t row_index, CellIndex_t column_index)
Conductance_t get_conductance_south(ThermalGrid_t *tgrid, Dimensions_t *dimensions, CellIndex_t layer_index, CellIndex_t row_index, CellIndex_t column_index)
Conductance_t get_conductance_east(ThermalGrid_t *tgrid, Dimensions_t *dimensions, CellIndex_t layer_index, CellIndex_t row_index, CellIndex_t column_index)
Conductance_t get_conductance_top(ThermalGrid_t *tgrid, Dimensions_t *dimensions, CellIndex_t layer_index, CellIndex_t row_index, CellIndex_t column_index)
Conductance_t get_conductance_non_uniform_y(ThermalGrid_t *tgrid, Dimensions_t *dimensions, ChipDimension_t value, Non_uniform_cellListNode_t *node, Conductance_t direction_note)
Conductance_t get_conductance_north(ThermalGrid_t *tgrid, Dimensions_t *dimensions, CellIndex_t layer_index, CellIndex_t row_index, CellIndex_t column_index)
Capacity_t get_capacity_non_uniform(ThermalGrid_t *tgrid, Dimensions_t *dimensions, Non_uniform_cellListNode_t *i_cell)
Conductance_t get_conductance_bottom(ThermalGrid_t *tgrid, Dimensions_t *dimensions, CellIndex_t layer_index, CellIndex_t row_index, CellIndex_t column_index)
Conductance_t get_conductance_west(ThermalGrid_t *tgrid, Dimensions_t *dimensions, CellIndex_t layer_index, CellIndex_t row_index, CellIndex_t column_index)
double SystemMatrixCoeff_t
@ TDICE_SUCCESS
The function returns with success.
@ TDICE_FAILURE
The function retuerns with a generic error.
@ TDICE_LAYER_CHANNEL_2RM
@ TDICE_LAYER_CHANNEL_4RM
@ TDICE_LAYER_SOURCE_CONNECTED_TO_SPREADER
@ TDICE_LAYER_SOLID_CONNECTED_TO_AMBIENT
@ TDICE_LAYER_SOLID_CONNECTED_TO_SPREADER
@ TDICE_LAYER_SOURCE_CONNECTED_TO_PCB
@ TDICE_LAYER_PINFINS_STAGGERED
@ TDICE_LAYER_SOLID_CONNECTED_TO_PCB
@ TDICE_LAYER_SOURCE_CONNECTED_TO_AMBIENT
@ TDICE_LAYER_PINFINS_INLINE
@ TDICE_LAYER_BOTTOM_WALL
@ TDICE_LAYER_VWALL_CHANNEL
@ TDICE_LAYER_VWALL_PINFINS
@ TDICE_CHANNEL_MODEL_MC_2RM
Microchannel - 2 Resistors model.
@ TDICE_ANALYSIS_TYPE_TRANSIENT
Transient analysis.
@ TDICE_HEATSINK_TOP_PLUGGABLE
Top pluggable heat sink.