@@ -213,20 +213,7 @@ export class ThermalBoundaryConditions {
213
213
}
214
214
215
215
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
- ) ;
226
216
residualVector [ globalNodeIndex ] += - convectionCoeff * extTemp ;
227
- debugLog (
228
- ` Adding heat transfer coefficient h = ${ convectionCoeff } to jacobian diagonal at [${ globalNodeIndex } ][${ globalNodeIndex } ]`
229
- ) ;
230
217
jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex ] += convectionCoeff ;
231
218
} ) ;
232
219
}
@@ -240,9 +227,6 @@ export class ThermalBoundaryConditions {
240
227
`Boundary ${ boundaryKey } : Applying convection with heat transfer coefficient h=${ convectionCoeff } W/(m²·K) and external temperature T∞=${ extTemp } K`
241
228
) ;
242
229
this . boundaryElements [ boundaryKey ] . forEach ( ( [ elementIndex , side ] ) => {
243
- debugLog (
244
- ` Processing element ${ elementIndex + 1 } , side ${ side } (0=bottom, 1=left, 2=top, 3=right)`
245
- ) ;
246
230
if ( this . elementOrder === "linear" ) {
247
231
let gaussPoint1 , gaussPoint2 , firstNodeIndex , lastNodeIndex , nodeIncrement ;
248
232
if ( side === 0 ) {
@@ -252,51 +236,28 @@ export class ThermalBoundaryConditions {
252
236
firstNodeIndex = 0 ;
253
237
lastNodeIndex = 3 ;
254
238
nodeIncrement = 2 ;
255
- debugLog (
256
- ` - Bottom side: nodes [${ firstNodeIndex } , ${
257
- firstNodeIndex + nodeIncrement
258
- } ] (increment: ${ nodeIncrement } )`
259
- ) ;
260
239
} else if ( side === 1 ) {
261
240
// Nodes at the left side of the reference element
262
241
gaussPoint1 = 0 ;
263
242
gaussPoint2 = gaussPoints [ 0 ] ;
264
243
firstNodeIndex = 0 ;
265
244
lastNodeIndex = 2 ;
266
245
nodeIncrement = 1 ;
267
- debugLog (
268
- ` - Left side: nodes [${ firstNodeIndex } , ${
269
- firstNodeIndex + nodeIncrement
270
- } ] (increment: ${ nodeIncrement } )`
271
- ) ;
272
246
} else if ( side === 2 ) {
273
247
// Nodes at the top side of the reference element
274
248
gaussPoint1 = gaussPoints [ 0 ] ;
275
249
gaussPoint2 = 1 ;
276
250
firstNodeIndex = 1 ;
277
251
lastNodeIndex = 4 ;
278
252
nodeIncrement = 2 ;
279
- debugLog (
280
- ` - Top side: nodes [${ firstNodeIndex } , ${
281
- firstNodeIndex + nodeIncrement
282
- } ] (increment: ${ nodeIncrement } )`
283
- ) ;
284
253
} else if ( side === 3 ) {
285
254
// Nodes at the right side of the reference element
286
255
gaussPoint1 = 1 ;
287
256
gaussPoint2 = gaussPoints [ 0 ] ;
288
257
firstNodeIndex = 2 ;
289
258
lastNodeIndex = 4 ;
290
259
nodeIncrement = 1 ;
291
- debugLog (
292
- ` - Right side: nodes [${ firstNodeIndex } , ${
293
- firstNodeIndex + nodeIncrement
294
- } ] (increment: ${ nodeIncrement } )`
295
- ) ;
296
260
}
297
- debugLog (
298
- ` - Using Gauss point [${ gaussPoint1 } , ${ gaussPoint2 } ] with weight ${ gaussWeights [ 0 ] } for numerical integration`
299
- ) ;
300
261
301
262
let basisFunctionsAndDerivatives = basisFunctionsData . getBasisFunctions (
302
263
gaussPoint1 ,
@@ -306,135 +267,62 @@ export class ThermalBoundaryConditions {
306
267
let basisFunctionDerivKsi = basisFunctionsAndDerivatives . basisFunctionDerivKsi ;
307
268
let basisFunctionDerivEta = basisFunctionsAndDerivatives . basisFunctionDerivEta ;
308
269
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
-
325
270
let xCoordinates = 0 ;
326
271
let ksiDerivX = 0 ;
327
272
let etaDerivY = 0 ;
328
273
const numNodes = this . nop [ elementIndex ] . length ;
329
274
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
-
338
275
for ( let nodeIndex = 0 ; nodeIndex < numNodes ; nodeIndex ++ ) {
339
276
const globalNodeIndex = this . nop [ elementIndex ] [ nodeIndex ] - 1 ;
340
277
xCoordinates += nodesXCoordinates [ globalNodeIndex ] * basisFunction [ nodeIndex ] ;
341
278
ksiDerivX += nodesXCoordinates [ globalNodeIndex ] * basisFunctionDerivKsi [ nodeIndex ] ;
342
279
etaDerivY += nodesYCoordinates [ globalNodeIndex ] * basisFunctionDerivEta [ nodeIndex ] ;
343
280
}
344
281
345
- debugLog (
346
- ` - Calculated geometry values for Jacobian: xCoord=${ xCoordinates . toFixed (
347
- 4
348
- ) } , ksiDerivX=${ ksiDerivX . toFixed ( 4 ) } , etaDerivY=${ etaDerivY . toFixed ( 4 ) } `
349
- ) ;
350
-
351
282
for (
352
283
let localNodeIndex = firstNodeIndex ;
353
284
localNodeIndex < lastNodeIndex ;
354
285
localNodeIndex += nodeIncrement
355
286
) {
356
287
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
- ) ;
364
288
365
289
if ( side === 0 || side === 2 ) {
366
290
// Horizontal boundaries of the domain (assuming a rectangular domain)
367
- const residualContribution =
291
+ residualVector [ globalNodeIndex ] + =
368
292
- 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 ;
377
293
378
- debugLog ( ` Updating jacobian for node ${ globalNodeIndex + 1 } :` ) ;
379
294
for (
380
295
let localNodeIndex2 = firstNodeIndex ;
381
296
localNodeIndex2 < lastNodeIndex ;
382
297
localNodeIndex2 += nodeIncrement
383
298
) {
384
299
let globalNodeIndex2 = this . nop [ elementIndex ] [ localNodeIndex2 ] - 1 ;
385
- const oldJacobianValue = jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] ;
386
- const jacobianContribution =
300
+ jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] +=
387
301
- gaussWeights [ 0 ] *
388
302
ksiDerivX *
389
303
basisFunction [ localNodeIndex ] *
390
304
basisFunction [ localNodeIndex2 ] *
391
305
convectionCoeff ;
392
- debugLog (
393
- ` jacobian[${ globalNodeIndex } ][${ globalNodeIndex2 } ]: ${ oldJacobianValue } += ${ jacobianContribution . toFixed (
394
- 6
395
- ) } `
396
- ) ;
397
- jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] += jacobianContribution ;
398
306
}
399
307
} else if ( side === 1 || side === 3 ) {
400
308
// Vertical boundaries of the domain (assuming a rectangular domain)
401
- const residualContribution =
309
+ residualVector [ globalNodeIndex ] + =
402
310
- 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 ;
411
311
412
- debugLog ( ` Updating jacobian for node ${ globalNodeIndex + 1 } :` ) ;
413
312
for (
414
313
let localNodeIndex2 = firstNodeIndex ;
415
314
localNodeIndex2 < lastNodeIndex ;
416
315
localNodeIndex2 += nodeIncrement
417
316
) {
418
317
let globalNodeIndex2 = this . nop [ elementIndex ] [ localNodeIndex2 ] - 1 ;
419
- const oldJacobianValue = jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] ;
420
- const jacobianContribution =
318
+ jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] +=
421
319
- gaussWeights [ 0 ] *
422
320
etaDerivY *
423
321
basisFunction [ localNodeIndex ] *
424
322
basisFunction [ localNodeIndex2 ] *
425
323
convectionCoeff ;
426
- debugLog (
427
- ` jacobian[${ globalNodeIndex } ][${ globalNodeIndex2 } ]: ${ oldJacobianValue } += ${ jacobianContribution . toFixed (
428
- 6
429
- ) } `
430
- ) ;
431
- jacobianMatrix [ globalNodeIndex ] [ globalNodeIndex2 ] += jacobianContribution ;
432
324
}
433
325
}
434
-
435
- debugLog (
436
- ` After modification: residualVector[${ globalNodeIndex } ] = ${ residualVector [ globalNodeIndex ] } `
437
- ) ;
438
326
}
439
327
} else if ( this . elementOrder === "quadratic" ) {
440
328
for ( let gaussPointIndex = 0 ; gaussPointIndex < 3 ; gaussPointIndex ++ ) {
0 commit comments