Skip to content

Source: examples/diffusion

Diffusion examples

The upstream examples/diffusion folder collects transient scalar diffusion problems built around the "diffusion" element. The cases cover 1D, 2D, and 3D meshes, Dirichlet and Neumann loading, nonlinear diffusion, and different initial-condition generators.

Files in this folder

Representative input

diff-2d-circle.json shows the common transient structure together with an explicit initial condition:

json { "dofs": { "names": ["c"] }, "elements": { "elmt1": { "type": "diffusion", "dofs": ["c"], "material": { "type": "constdiffusion", "parameters": { "D": 1.0 } } } }, "ics": { "seed": { "type": "circle", "dofs": ["c"], "icvalue": 0.0, "domain": ["alldomain"], "parameters": { "x0": 2.5, "y0": 2.5, "radius": 1.0, "inside-value": 1.0, "outside-value": 0.0 } } }, "timestepping": { "type": "be", "dt0": 1.0e-6, "dtmax": 1.0e-1, "dtmin": 1.0e-12, "optimize-iters": 3, "end-time": 1.0e-2, "growth-factor": 1.1, "cutback-factor": 0.85, "adaptive": true }, "job": { "type": "transient", "print": "dep" } }

Notes

  • All diffusion examples use the single DoF name "c" and the "diffusion" element type.
  • The linear cases use constdiffusion; the nonlinear case uses nonlinear-diffusion2d.
  • Initial-condition coverage includes "circle" and "random" in addition to the boundary-driven cases without an explicit "ics" block.
  • Every file in this folder is a transient job with "timestepping":{"type":"be",...}.
  • Several upstream files still include "restart": true inside "job", but the current parser ignores that field.