Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 81c49ac

Browse filesBrowse files
committed
Enhance thermal boundary conditions handling for 1D meshes by implementing convection type
1 parent 3a766fd commit 81c49ac
Copy full SHA for 81c49ac

File tree

Expand file treeCollapse file tree

2 files changed

+32
-8
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+32
-8
lines changed

‎src/solvers/solidHeatTransferScript.js

Copy file name to clipboardExpand all lines: src/solvers/solidHeatTransferScript.js
+2-7Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,7 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
151151
// Computation of Galerkin's residuals and Jacobian matrix
152152
for (let localNodeIndex1 = 0; localNodeIndex1 < numNodes; localNodeIndex1++) {
153153
let globalNodeIndex1 = localNodalNumbers[localNodeIndex1];
154-
residualVector[globalNodeIndex1] +=
155-
gaussWeights[gaussPointIndex1] * detJacobian * basisFunction[localNodeIndex1];
154+
// residualVector is zero for this case
156155

157156
for (let localNodeIndex2 = 0; localNodeIndex2 < numNodes; localNodeIndex2++) {
158157
let globalNodeIndex2 = localNodalNumbers[localNodeIndex2];
@@ -213,11 +212,7 @@ export function assembleSolidHeatTransferMat(meshConfig, boundaryConditions) {
213212
// Computation of Galerkin's residuals and Jacobian matrix
214213
for (let localNodeIndex1 = 0; localNodeIndex1 < numNodes; localNodeIndex1++) {
215214
let globalNodeIndex1 = localNodalNumbers[localNodeIndex1];
216-
residualVector[globalNodeIndex1] +=
217-
gaussWeights[gaussPointIndex1] *
218-
gaussWeights[gaussPointIndex2] *
219-
detJacobian *
220-
basisFunction[localNodeIndex1];
215+
// residualVector is zero for this case
221216

222217
for (let localNodeIndex2 = 0; localNodeIndex2 < numNodes; localNodeIndex2++) {
223218
let globalNodeIndex2 = localNodalNumbers[localNodeIndex2];

‎src/solvers/thermalBoundaryConditionsScript.js

Copy file name to clipboardExpand all lines: src/solvers/thermalBoundaryConditionsScript.js
+30-1Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,36 @@ export class ThermalBoundaryConditions {
154154
});
155155

156156
if (this.meshDimension === "1D") {
157-
// 1D code
157+
Object.keys(this.boundaryConditions).forEach((boundaryKey) => {
158+
if (this.boundaryConditions[boundaryKey][0] === "convection") {
159+
const convectionCoeff = convectionHeatTranfCoeff[boundaryKey];
160+
const extTemp = convectionExtTemp[boundaryKey];
161+
this.boundaryElements[boundaryKey].forEach(([elementIndex, side]) => {
162+
let nodeIndex;
163+
if (this.elementOrder === "linear") {
164+
if (side === 0) {
165+
// Node at the left side of the reference element
166+
nodeIndex = 0;
167+
} else {
168+
// Node at the right side of the reference element
169+
nodeIndex = 1;
170+
}
171+
} else if (this.elementOrder === "quadratic") {
172+
if (side === 0) {
173+
// Node at the left side of the reference element
174+
nodeIndex = 0;
175+
} else {
176+
// Node at the right side of the reference element
177+
nodeIndex = 2;
178+
}
179+
}
180+
181+
const globalNodeIndex = this.nop[elementIndex][nodeIndex] - 1;
182+
residualVector[globalNodeIndex] += -convectionCoeff * extTemp;
183+
jacobianMatrix[globalNodeIndex][globalNodeIndex] += convectionCoeff;
184+
});
185+
}
186+
});
158187
} else if (this.meshDimension === "2D") {
159188
Object.keys(this.boundaryConditions).forEach((boundaryKey) => {
160189
if (this.boundaryConditions[boundaryKey][0] === "convection") {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.