Browse documentation
Docs/Language

Native variational Poisson problems

A VariationalPoisson problem in canonical model JSON selects a supplied mesh, a scalar function space, trial and test symbols, two integrals, and marked boundary data. The FEM domain owns…

Native variational Poisson problems

A VariationalPoisson problem in canonical model JSON selects a supplied mesh, a scalar function space, trial and test symbols, two integrals, and marked boundary data. The FEM domain owns source decoding, mesh budgets and admission. The compiler adapter transports these contracts without owning FEM semantics. Grid lowers the form to its existing native Poisson FEM problem. Resolve produces potential, flux, reactions and a linear solve residual report. Compilation only creates the definition; it does not solve or start a job.

The complete Poisson example solves -Δu = 2 on the unit square, with u = 0 at the left and right and zero normal flux at the top and bottom. Its exact solution is u = x(1-x). The piecewise-linear approximation converges as the mesh is refined.

Authoring contract

Use the existing femRegions array. Each region contains mesh and problem. The mesh accepts an explicit AnalysisMesh, structuredRectangle, or gmshV2Ascii, as described in the FEM specification. The problem has one VariationalPoisson member:

{
  "space": "ScalarP1Triangle",
  "units": "Dimensionless",
  "quadrature": "ExactAffine",
  "trial": "potential",
  "test": "weight",
  "bilinear": {
    "trial": "potential",
    "test": "weight",
    "conductivity_by_region": { "7": 1.0 }
  },
  "linear": {
    "test": "weight",
    "source_by_region": { "7": 2.0 }
  },
  "boundary_conditions": [
    { "Dirichlet": { "marker": 4, "value": { "offset": 0.0, "gradient": [0.0, 0.0, 0.0] } } },
    { "Dirichlet": { "marker": 2, "value": { "offset": 0.0, "gradient": [0.0, 0.0, 0.0] } } }
  ],
  "options": {
    "relative_tolerance": 1e-10,
    "absolute_tolerance": 1e-12,
    "max_iterations": 10000
  }
}

The bilinear integral means ∫Ω k ∇potential · ∇weight and the linear integral means ∫Ω f weight. The equation equates these integrals, adding prescribed Neumann terms on the right. The test space has homogeneous Dirichlet trace; the trial space takes the authored essential values. Symbols are distinct ASCII identifiers of at most 64 bytes and all references must bind to them. These are fixed typed integral records, not arbitrary expression strings. There is no separate textual FEM … END syntax.

ScalarP1Triangle means continuous scalar piecewise-linear functions on straight Triangle3 elements in the z=0 plane. Dimensionless requires the author to supply normalized coordinates, coefficients and field values; it performs no physical-unit conversion or inference. ExactAffine selects the existing analytic P1 element integrals and exact affine edge loads. Conductivity is a positive finite constant per region and must cover exactly the mesh's regions. Sources are finite constants per region; absent entries are zero. Unknown source regions refuse.

Boundary markers select existing mesh facets. Each marker can have one Dirichlet value or one Neumann flux. Values have the affine form offset + gradient[0] x + gradient[1] y, with zero third component. Neumann flux is k ∇u · n; the recovered physical flux field is -k ∇u. Omitted boundary conditions mean zero Neumann flux. Essential values on intersecting marked edges must agree at shared nodes. Every connected mesh component must contain a Dirichlet constraint, including for a zero source. Pure Neumann problems and gauge fixing are outside this profile.

Admission allows at most 4,096 nodes, 8,192 elements and boundary facets, 128 boundary conditions, and 10,000 solver iterations. Generated mesh sizes are checked before allocation; Gmsh input is limited to 1 MiB. Unsupported spaces, units, quadrature, extra form fields, unbound symbols, invalid coefficients, absent markers, conflicting constraints and unanchored components refuse before assembly. Solver nonconvergence remains an explicit native failure, with no weaker fallback.

Resolve, edit and reopen

Submit the canonical model through the existing model deployment API and call POST /api/models/:id/fem/resolve. Reports retain mesh/problem/result handle identities, potential, element flux, nodal reaction, convergence, iteration count, residual norm, sparse nonzero count and constrained DOFs. includeMesh selects the existing bounded geometry projection for Analysis.

Edit the source's boundary values, compile a candidate, and apply it through the existing FEM definition transaction. A prescribed-value edit reuses mesh topology, stiffness and preconditioner. Solving and validation precede durable commit; a failed commit leaves the live definition and result unchanged. Coefficient or topology edits invalidate the appropriate existing preparation.

Saving the canonical JSON retains the exact authored form, including symbol names. Saved LIR retains the exact lowered mesh, coefficients, boundaries and solver options even with debug data stripped. Trial/test names and the fixed profile spelling are authoring metadata, not new runtime physics. Reopening and resolving recomputes the same field and report. A saved LIR definition does not claim to persist an already-resolved result cache or publish a generic artifact. Keep the source when exact authoring spelling is required.

Existing native Poisson, nonlinear reaction ASTs, elasticity, quadratic and 3-D elements, adaptive and transient solvers retain their existing contracts. This first variational profile does not expose all of those capabilities. General integrands, physical-unit algebra, mixed/vector spaces and additional quadrature choices require separately admitted profiles.