@@ -213,20 +213,7 @@ export class ThermalBoundaryConditions {
213213 }
214214
215215 const globalNodeIndex = this . nop [ elementIndex ] [ nodeIndex ] - 1 ;
216- debugLog (
217- ` - Applied convection to node ${ globalNodeIndex + 1 } (element ${
218- elementIndex + 1
219- } , local node ${ nodeIndex + 1 } )`
220- ) ;
221- debugLog (
222- ` Adding -h·T∞ = ${
223- - convectionCoeff * extTemp
224- } to residual vector at index ${ globalNodeIndex } `
225- ) ;
226216 residualVector [ globalNodeIndex ] += - convectionCoeff * extTemp ;
227- debugLog (
228- ` Adding heat transfer coefficient h = ${ convectionCoeff } to jacobian diagonal at [${ globalNodeIndex } ][${ globalNodeIndex } ]`
229- ) ;
230217 jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex ] += convectionCoeff ;
231218 } ) ;
232219 }
@@ -240,9 +227,6 @@ export class ThermalBoundaryConditions {
240227 `Boundary ${ boundaryKey } : Applying convection with heat transfer coefficient h=${ convectionCoeff } W/(m²·K) and external temperature T∞=${ extTemp } K`
241228 ) ;
242229 this . boundaryElements [ boundaryKey ] . forEach ( ( [ elementIndex , side ] ) => {
243- debugLog (
244- ` Processing element ${ elementIndex + 1 } , side ${ side } (0=bottom, 1=left, 2=top, 3=right)`
245- ) ;
246230 if ( this . elementOrder === "linear" ) {
247231 let gaussPoint1 , gaussPoint2 , firstNodeIndex , lastNodeIndex , nodeIncrement ;
248232 if ( side === 0 ) {
@@ -252,51 +236,28 @@ export class ThermalBoundaryConditions {
252236 firstNodeIndex = 0 ;
253237 lastNodeIndex = 3 ;
254238 nodeIncrement = 2 ;
255- debugLog (
256- ` - Bottom side: nodes [${ firstNodeIndex } , ${
257- firstNodeIndex + nodeIncrement
258- } ] (increment: ${ nodeIncrement } )`
259- ) ;
260239 } else if ( side === 1 ) {
261240 // Nodes at the left side of the reference element
262241 gaussPoint1 = 0 ;
263242 gaussPoint2 = gaussPoints [ 0 ] ;
264243 firstNodeIndex = 0 ;
265244 lastNodeIndex = 2 ;
266245 nodeIncrement = 1 ;
267- debugLog (
268- ` - Left side: nodes [${ firstNodeIndex } , ${
269- firstNodeIndex + nodeIncrement
270- } ] (increment: ${ nodeIncrement } )`
271- ) ;
272246 } else if ( side === 2 ) {
273247 // Nodes at the top side of the reference element
274248 gaussPoint1 = gaussPoints [ 0 ] ;
275249 gaussPoint2 = 1 ;
276250 firstNodeIndex = 1 ;
277251 lastNodeIndex = 4 ;
278252 nodeIncrement = 2 ;
279- debugLog (
280- ` - Top side: nodes [${ firstNodeIndex } , ${
281- firstNodeIndex + nodeIncrement
282- } ] (increment: ${ nodeIncrement } )`
283- ) ;
284253 } else if ( side === 3 ) {
285254 // Nodes at the right side of the reference element
286255 gaussPoint1 = 1 ;
287256 gaussPoint2 = gaussPoints [ 0 ] ;
288257 firstNodeIndex = 2 ;
289258 lastNodeIndex = 4 ;
290259 nodeIncrement = 1 ;
291- debugLog (
292- ` - Right side: nodes [${ firstNodeIndex } , ${
293- firstNodeIndex + nodeIncrement
294- } ] (increment: ${ nodeIncrement } )`
295- ) ;
296260 }
297- debugLog (
298- ` - Using Gauss point [${ gaussPoint1 } , ${ gaussPoint2 } ] with weight ${ gaussWeights [ 0 ] } for numerical integration`
299- ) ;
300261
301262 let basisFunctionsAndDerivatives = basisFunctionsData . getBasisFunctions (
302263 gaussPoint1 ,
@@ -306,135 +267,62 @@ export class ThermalBoundaryConditions {
306267 let basisFunctionDerivKsi = basisFunctionsAndDerivatives . basisFunctionDerivKsi ;
307268 let basisFunctionDerivEta = basisFunctionsAndDerivatives . basisFunctionDerivEta ;
308269
309- debugLog (
310- ` - Shape function values at Gauss point: [${ basisFunction
311- . map ( ( v ) => v . toFixed ( 4 ) )
312- . join ( ", " ) } ]`
313- ) ;
314- debugLog (
315- ` - Shape function ksi derivatives: [${ basisFunctionDerivKsi
316- . map ( ( v ) => v . toFixed ( 4 ) )
317- . join ( ", " ) } ]`
318- ) ;
319- debugLog (
320- ` - Shape function eta derivatives: [${ basisFunctionDerivEta
321- . map ( ( v ) => v . toFixed ( 4 ) )
322- . join ( ", " ) } ]`
323- ) ;
324-
325270 let xCoordinates = 0 ;
326271 let ksiDerivX = 0 ;
327272 let etaDerivY = 0 ;
328273 const numNodes = this . nop [ elementIndex ] . length ;
329274
330- debugLog (
331- ` - Element ${ elementIndex + 1 } has ${ numNodes } nodes with global indices: [${ this . nop [
332- elementIndex
333- ]
334- . map ( ( nodeNum ) => nodeNum )
335- . join ( ", " ) } ]`
336- ) ;
337-
338275 for ( let nodeIndex = 0 ; nodeIndex < numNodes ; nodeIndex ++ ) {
339276 const globalNodeIndex = this . nop [ elementIndex ] [ nodeIndex ] - 1 ;
340277 xCoordinates += nodesXCoordinates [ globalNodeIndex ] * basisFunction [ nodeIndex ] ;
341278 ksiDerivX += nodesXCoordinates [ globalNodeIndex ] * basisFunctionDerivKsi [ nodeIndex ] ;
342279 etaDerivY += nodesYCoordinates [ globalNodeIndex ] * basisFunctionDerivEta [ nodeIndex ] ;
343280 }
344281
345- debugLog (
346- ` - Calculated geometry values for Jacobian: xCoord=${ xCoordinates . toFixed (
347- 4
348- ) } , ksiDerivX=${ ksiDerivX . toFixed ( 4 ) } , etaDerivY=${ etaDerivY . toFixed ( 4 ) } `
349- ) ;
350-
351282 for (
352283 let localNodeIndex = firstNodeIndex ;
353284 localNodeIndex < lastNodeIndex ;
354285 localNodeIndex += nodeIncrement
355286 ) {
356287 let globalNodeIndex = this . nop [ elementIndex ] [ localNodeIndex ] - 1 ;
357- debugLog (
358- ` - Processing local node ${ localNodeIndex + 1 } -> global node ${ globalNodeIndex + 1 } `
359- ) ;
360- debugLog ( ` Local shape function value: ${ basisFunction [ localNodeIndex ] . toFixed ( 6 ) } ` ) ;
361- debugLog (
362- ` Before: residualVector[${ globalNodeIndex } ] = ${ residualVector [ globalNodeIndex ] } `
363- ) ;
364288
365289 if ( side === 0 || side === 2 ) {
366290 // Horizontal boundaries of the domain (assuming a rectangular domain)
367- const residualContribution =
291+ residualVector [ globalNodeIndex ] + =
368292 - gaussWeights [ 0 ] * ksiDerivX * basisFunction [ localNodeIndex ] * convectionCoeff * extTemp ;
369- debugLog (
370- ` Adding to residual: ${ residualContribution . toFixed ( 6 ) } (= -${
371- gaussWeights [ 0 ]
372- } * ${ ksiDerivX . toFixed ( 4 ) } * ${ basisFunction [ localNodeIndex ] . toFixed (
373- 4
374- ) } * ${ convectionCoeff } * ${ extTemp } )`
375- ) ;
376- residualVector [ globalNodeIndex ] += residualContribution ;
377293
378- debugLog ( ` Updating jacobian for node ${ globalNodeIndex + 1 } :` ) ;
379294 for (
380295 let localNodeIndex2 = firstNodeIndex ;
381296 localNodeIndex2 < lastNodeIndex ;
382297 localNodeIndex2 += nodeIncrement
383298 ) {
384299 let globalNodeIndex2 = this . nop [ elementIndex ] [ localNodeIndex2 ] - 1 ;
385- const oldJacobianValue = jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] ;
386- const jacobianContribution =
300+ jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] +=
387301 - gaussWeights [ 0 ] *
388302 ksiDerivX *
389303 basisFunction [ localNodeIndex ] *
390304 basisFunction [ localNodeIndex2 ] *
391305 convectionCoeff ;
392- debugLog (
393- ` jacobian[${ globalNodeIndex } ][${ globalNodeIndex2 } ]: ${ oldJacobianValue } += ${ jacobianContribution . toFixed (
394- 6
395- ) } `
396- ) ;
397- jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] += jacobianContribution ;
398306 }
399307 } else if ( side === 1 || side === 3 ) {
400308 // Vertical boundaries of the domain (assuming a rectangular domain)
401- const residualContribution =
309+ residualVector [ globalNodeIndex ] + =
402310 - gaussWeights [ 0 ] * etaDerivY * basisFunction [ localNodeIndex ] * convectionCoeff * extTemp ;
403- debugLog (
404- ` Adding to residual: ${ residualContribution . toFixed ( 6 ) } (= -${
405- gaussWeights [ 0 ]
406- } * ${ etaDerivY . toFixed ( 4 ) } * ${ basisFunction [ localNodeIndex ] . toFixed (
407- 4
408- ) } * ${ convectionCoeff } * ${ extTemp } )`
409- ) ;
410- residualVector [ globalNodeIndex ] += residualContribution ;
411311
412- debugLog ( ` Updating jacobian for node ${ globalNodeIndex + 1 } :` ) ;
413312 for (
414313 let localNodeIndex2 = firstNodeIndex ;
415314 localNodeIndex2 < lastNodeIndex ;
416315 localNodeIndex2 += nodeIncrement
417316 ) {
418317 let globalNodeIndex2 = this . nop [ elementIndex ] [ localNodeIndex2 ] - 1 ;
419- const oldJacobianValue = jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] ;
420- const jacobianContribution =
318+ jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] +=
421319 - gaussWeights [ 0 ] *
422320 etaDerivY *
423321 basisFunction [ localNodeIndex ] *
424322 basisFunction [ localNodeIndex2 ] *
425323 convectionCoeff ;
426- debugLog (
427- ` jacobian[${ globalNodeIndex } ][${ globalNodeIndex2 } ]: ${ oldJacobianValue } += ${ jacobianContribution . toFixed (
428- 6
429- ) } `
430- ) ;
431- jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] += jacobianContribution ;
432324 }
433325 }
434-
435- debugLog (
436- ` After modification: residualVector[${ globalNodeIndex } ] = ${ residualVector [ globalNodeIndex ] } `
437- ) ;
438326 }
439327 } else if ( this . elementOrder === "quadratic" ) {
440328 for ( let gaussPointIndex = 0 ; gaussPointIndex < 3 ; gaussPointIndex ++ ) {
0 commit comments