@@ -13,13 +13,40 @@ import { GenericBoundaryConditions } from "./genericBoundaryConditions.js";
1313import { basicLog , debugLog , errorLog } from "../utilities/logging.js" ;
1414
1515/**
16- * Function to assemble the Jacobian matrix and residuals vector for the general form PDE model
17- * @param {object } meshData - Object containing prepared mesh data
18- * @param {object } boundaryConditions - Object containing boundary conditions
19- * @param {object } coefficientFunctions - Functions A(x), B(x), C(x), D(x) for the PDE
20- * @returns {object } An object containing:
21- * - jacobianMatrix: The assembled Jacobian matrix
22- * - residualVector: The assembled residual vector
16+ * Assembles the discrete weak form of a general 1D scalar linear PDE of the form
17+ *
18+ * -d/dx (A(x) du/dx) + B(x) du/dx + C(x) u = D(x)
19+ *
20+ * where:
21+ * - u(x) is the scalar unknown field being solved for,
22+ * - A(x) is the diffusion or stiffness coefficient,
23+ * - B(x) is the advection or transport coefficient,
24+ * - C(x) is the reaction or damping coefficient,
25+ * - D(x) is the source or forcing term.
26+ *
27+ * This is a general-purpose finite-element model rather than a fluid-only
28+ * formulation. In practice, the same structure can represent diffusion,
29+ * transport, reaction, damping, or stiffness-dominated scalar field problems.
30+ *
31+ * In the finite-element implementation, the residual and Jacobian are assembled
32+ * from the Galerkin weak form at each Gauss point. The code evaluates the
33+ * coefficient functions A(x), B(x), C(x), and D(x) at the mapped physical
34+ * coordinate x and accumulates the corresponding diffusion, advection,
35+ * reaction, and source terms into the global system.
36+ *
37+ * The resulting algebraic system is:
38+ *
39+ * K(u) = F
40+ *
41+ * where K is the assembled Jacobian matrix and F is the residual forcing term.
42+ *
43+ * @param {object } meshData - Prepared mesh data containing nodal coordinates,
44+ * element connectivity, element order, and dimension.
45+ * @param {object } boundaryConditions - Boundary condition definition object.
46+ * @param {object } coefficientFunctions - Functions A(x), B(x), C(x), D(x)
47+ * describing the PDE coefficients.
48+ * @returns {{ jacobianMatrix: number[][], residualVector: number[] } }
49+ * The assembled global Jacobian matrix and residual vector.
2350 */
2451export function assembleGeneralFormPDEMat ( meshData , boundaryConditions , coefficientFunctions ) {
2552 basicLog ( "Starting general form PDE matrix assembly..." ) ;
@@ -153,9 +180,25 @@ export function assembleGeneralFormPDEMat(meshData, boundaryConditions, coeffici
153180}
154181
155182/**
156- * Function to assemble the frontal solver matrix for the general form PDE model
157- * @param {object } data - Object containing element data for the frontal solver
158- * @returns {object } An object containing local Jacobian matrix and residual vector
183+ * Assembles the local element contribution for the same general 1D PDE model
184+ * used by the frontal solver. The element residual and local Jacobian are
185+ * formed by evaluating the same diffusion, advection, and reaction terms at
186+ * each Gauss point, but only for the current element rather than the full mesh.
187+ *
188+ * The returned local operators are later assembled into the global system by
189+ * the frontal solver. This allows the same PDE structure to be used in both
190+ * the full global assembly path and the element-by-element frontal assembly path.
191+ *
192+ * @param {object } data - Element assembly input for the frontal solver, containing:
193+ * - elementIndex: index of the current element in the mesh,
194+ * - nop: element connectivity array,
195+ * - meshData: mesh coordinates and dimensionality metadata,
196+ * - basisFunctions: interpolation and derivative providers for the element,
197+ * - FEAData: numerical integration data such as Gauss points, weights,
198+ * and nodes-per-element,
199+ * - coefficientFunctions: callback functions A(x), B(x), C(x), and D(x).
200+ * @returns {{ localJacobianMatrix: number[][], localResidualVector: number[], ngl: number[] } }
201+ * Local Jacobian matrix, local residual vector, and global node list.
159202 */
160203export function assembleGeneralFormPDEFront ( {
161204 elementIndex,
0 commit comments