@@ -12,6 +12,9 @@ import { basisFunctions } from "../mesh/basisFunctionsScript.js";
1212import { numericalIntegration } from "../methods/numericalIntegrationScript.js" ;
1313import { meshGeneration } from "../mesh/meshGenerationScript.js" ;
1414import { ThermalBoundaryConditions } from "../methods/thermalBoundaryConditionsScript.js" ;
15+ import loggers from "../utilities/loggerScript.js" ;
16+
17+ const log = loggers . solver ;
1518
1619/**
1720 * Assemble the solid heat transfer matrix
@@ -23,6 +26,8 @@ import { ThermalBoundaryConditions } from "../methods/thermalBoundaryConditionsS
2326 * - nodesCoordinates: Object containing x and y coordinates of nodes
2427 */
2528export function assembleSolidHeatTransferMat ( meshConfig , boundaryConditions ) {
29+ log . info ( "Starting solid heat transfer matrix assembly" ) ;
30+
2631 // Extract mesh details from the configuration object
2732 const {
2833 meshDimension, // The dimension of the mesh
@@ -33,6 +38,8 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
3338 elementOrder, // The order of elements
3439 } = meshConfig ;
3540
41+ log . debug ( `Mesh configuration: ${ meshDimension } , Elements: ${ numElementsX } x${ numElementsY || 1 } , Size: ${ maxX } x${ maxY || 0 } , Order: ${ elementOrder } ` ) ;
42+
3643 // Extract boundary conditions from the configuration object
3744 let convectionHeatTranfCoeff = [ ] ;
3845 let convectionExtTemp = [ ] ;
@@ -41,10 +48,12 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
4148 if ( boundaryCondition [ 0 ] === "convection" ) {
4249 convectionHeatTranfCoeff [ key ] = boundaryCondition [ 1 ] ;
4350 convectionExtTemp [ key ] = boundaryCondition [ 2 ] ;
51+ log . debug ( `Convection boundary condition on boundary ${ key } : h=${ boundaryCondition [ 1 ] } , T=${ boundaryCondition [ 2 ] } ` ) ;
4452 }
4553 } ) ;
4654
4755 // Create a new instance of the meshGeneration class
56+ log . debug ( "Generating mesh..." ) ;
4857 const meshGenerationData = new meshGeneration ( {
4958 numElementsX,
5059 numElementsY,
@@ -56,6 +65,7 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
5665
5766 // Generate the mesh
5867 const nodesCoordinatesAndNumbering = meshGenerationData . generateMesh ( ) ;
68+ log . debug ( "Mesh generated successfully" ) ;
5969
6070 // Extract nodes coordinates and nodal numbering (NOP) from the mesh data
6171 let nodesXCoordinates = nodesCoordinatesAndNumbering . nodesXCoordinates ;
@@ -68,6 +78,9 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
6878 // Initialize variables for matrix assembly
6979 const totalElements = numElementsX * ( meshDimension === "2D" ? numElementsY : 1 ) ; // Total number of elements
7080 const totalNodes = totalNodesX * ( meshDimension === "2D" ? totalNodesY : 1 ) ; // Total number of nodes
81+ log . debug ( `Total elements: ${ totalElements } , Total nodes: ${ totalNodes } ` ) ;
82+
83+ // Initialize variables for matrix assembly
7184 let localNodalNumbers = [ ] ; // Local nodal numbering
7285 let gaussPoints = [ ] ; // Gauss points
7386 let gaussWeights = [ ] ; // Gauss weights
@@ -96,12 +109,14 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
96109 }
97110
98111 // Initialize the basisFunctions class
112+ log . debug ( "Initializing basis functions..." ) ;
99113 const basisFunctionsData = new basisFunctions ( {
100114 meshDimension,
101115 elementOrder,
102116 } ) ;
103117
104118 // Initialize the numericalIntegration class
119+ log . debug ( "Setting up numerical integration..." ) ;
105120 const numIntegrationData = new numericalIntegration ( {
106121 meshDimension,
107122 elementOrder,
@@ -114,6 +129,8 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
114129
115130 // Determine the number of nodes in the reference element based on the first element in the nop array
116131 const numNodes = nop [ 0 ] . length ;
132+
133+ log . info ( `Beginning matrix assembly for ${ totalElements } elements...` ) ;
117134
118135 // Matrix assembly
119136 for ( let elementIndex = 0 ; elementIndex < totalElements ; elementIndex ++ ) {
@@ -236,6 +253,7 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
236253 }
237254
238255 // Create an instance of ThermalBoundaryConditions
256+ log . debug ( "Applying thermal boundary conditions..." ) ;
239257 const thermalBoundaryConditions = new ThermalBoundaryConditions (
240258 boundaryConditions ,
241259 boundaryElements ,
@@ -256,9 +274,13 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
256274 convectionHeatTranfCoeff ,
257275 convectionExtTemp
258276 ) ;
277+ log . debug ( "Convection boundary conditions applied" ) ;
259278
260279 // Impose ConstantTemp boundary conditions
261280 thermalBoundaryConditions . imposeConstantTempBoundaryConditions ( residualVector , jacobianMatrix ) ;
281+ log . debug ( "Constant temperature boundary conditions applied" ) ;
282+
283+ log . info ( "Solid heat transfer matrix assembly completed" ) ;
262284
263285 return {
264286 jacobianMatrix,
0 commit comments