File tree 3 files changed +25
-22
lines changed
Filter options
3 files changed +25
-22
lines changed
Original file line number Diff line number Diff line change @@ -36,18 +36,11 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
36
36
elementOrder, // The order of elements
37
37
} = meshConfig ;
38
38
39
- debugLog ( `Mesh configuration: ${ meshDimension } , Elements: ${ numElementsX } x${ numElementsY || 1 } , Size: ${ maxX } x${ maxY || 0 } , Order: ${ elementOrder } ` ) ;
40
-
41
- // Extract boundary conditions from the configuration object
42
- let convectionHeatTranfCoeff = [ ] ;
43
- let convectionExtTemp = [ ] ;
44
- Object . keys ( boundaryConditions ) . forEach ( ( key ) => {
45
- const boundaryCondition = boundaryConditions [ key ] ;
46
- if ( boundaryCondition [ 0 ] === "convection" ) {
47
- convectionHeatTranfCoeff [ key ] = boundaryCondition [ 1 ] ;
48
- convectionExtTemp [ key ] = boundaryCondition [ 2 ] ;
49
- }
50
- } ) ;
39
+ debugLog (
40
+ `Mesh configuration: ${ meshDimension } , Elements: ${ numElementsX } x${ numElementsY || 1 } , Size: ${ maxX } x${
41
+ maxY || 0
42
+ } , Order: ${ elementOrder } `
43
+ ) ;
51
44
52
45
// Create a new instance of the meshGeneration class
53
46
debugLog ( "Generating mesh..." ) ;
@@ -259,9 +252,7 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
259
252
gaussWeights ,
260
253
nodesXCoordinates ,
261
254
nodesYCoordinates ,
262
- basisFunctionsData ,
263
- convectionHeatTranfCoeff ,
264
- convectionExtTemp
255
+ basisFunctionsData
265
256
) ;
266
257
debugLog ( "Convection boundary conditions applied" ) ;
267
258
Original file line number Diff line number Diff line change @@ -132,8 +132,6 @@ export class ThermalBoundaryConditions {
132
132
* @param {array } nodesXCoordinates - Array of x-coordinates of nodes
133
133
* @param {array } nodesYCoordinates - Array of y-coordinates of nodes
134
134
* @param {object } basisFunctionsData - Object containing basis functions and their derivatives
135
- * @param {array } convectionHeatTranfCoeff - Array of convection heat transfer coefficients
136
- * @param {array } convectionExtTemp - Array of external temperatures for convection
137
135
*/
138
136
imposeConvectionBoundaryConditions (
139
137
residualVector ,
@@ -142,10 +140,19 @@ export class ThermalBoundaryConditions {
142
140
gaussWeights ,
143
141
nodesXCoordinates ,
144
142
nodesYCoordinates ,
145
- basisFunctionsData ,
146
- convectionHeatTranfCoeff ,
147
- convectionExtTemp
143
+ basisFunctionsData
148
144
) {
145
+ // Extract convection parameters from boundary conditions
146
+ let convectionHeatTranfCoeff = [ ] ;
147
+ let convectionExtTemp = [ ] ;
148
+ Object . keys ( this . boundaryConditions ) . forEach ( ( key ) => {
149
+ const boundaryCondition = this . boundaryConditions [ key ] ;
150
+ if ( boundaryCondition [ 0 ] === "convection" ) {
151
+ convectionHeatTranfCoeff [ key ] = boundaryCondition [ 1 ] ;
152
+ convectionExtTemp [ key ] = boundaryCondition [ 2 ] ;
153
+ }
154
+ } ) ;
155
+
149
156
if ( this . meshDimension === "1D" ) {
150
157
// 1D code
151
158
} else if ( this . meshDimension === "2D" ) {
Original file line number Diff line number Diff line change @@ -30,8 +30,13 @@ export function plotSolution(
30
30
const { nodesXCoordinates, nodesYCoordinates } = nodesCoordinates ;
31
31
32
32
if ( meshDimension === "1D" && plotType === "line" ) {
33
- // Flatten solutionVector
34
- let yData = solutionVector . map ( arr => arr [ 0 ] ) ;
33
+ // Check if solutionVector is a nested array
34
+ let yData ;
35
+ if ( solutionVector . length > 0 && Array . isArray ( solutionVector [ 0 ] ) ) {
36
+ yData = solutionVector . map ( arr => arr [ 0 ] ) ;
37
+ } else {
38
+ yData = solutionVector ;
39
+ }
35
40
let xData = Array . from ( nodesXCoordinates ) ;
36
41
37
42
let lineData = {
You can’t perform that action at this time.
0 commit comments