You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit merges the PR introducing a general-purpose solver for 1D linear PDEs, supporting equations like d/dx(A du/dx) + B du/dx + C u = D with user-defined coefficients and boundary conditions. The implementation is standalone and functional as a prototype. Further integration is needed to align with FEAScript's existing utilities.
// Coefficient functions for Given equation: d²u/dx² + 10 du/dx = -10 * exp(-200 * (x - 0.5)²), for 0 < x < 1
33
+
constA=x=>1; // Diffusion coefficient
34
+
constB=x=>0; // No first derivative term
35
+
constC=x=>0; // No reaction term
36
+
constD=x=>1; // Source function D(X)
37
+
38
+
39
+
// Dirichlet left boundary conditions: u(0) = 1, and Neumann right boundry conditions: u(1) = 0
40
+
constboundary= {
41
+
left: { type:'dirichlet', value:1 },
42
+
right: { type:'neumann', value:0 }
43
+
};
44
+
45
+
// Solve
46
+
constu=generalFormPDESolver({ A, B, C, D, mesh, boundary });
47
+
48
+
console.log('Mesh nodes:', mesh);
49
+
console.log('Solution u:', u);
50
+
51
+
52
+
## Output
53
+
54
+
The script prints the mesh nodes and the solution $u$ at each node. You can modify the coefficient functions and boundary conditions to solve other problems.
55
+
56
+
---
57
+
58
+
For more details, see the main project README or documentation.
0 commit comments