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¶
diff-1d.json: 1D transient diffusion with a Dirichlet boundary condition.diff-1d-neumann.json: 1D transient diffusion with a Neumann flux.diff-2d-dirichlet.json: 2Dquad4mesh with constant diffusion and a Dirichlet boundary value.diff-2d-neumann.json: 2Dquad4mesh with a Neumann flux.diff-2d-nl-neumann.json: nonlinear diffusion usingnonlinear-diffusion2don aquad9mesh.diff-2d-circle.json: 2D diffusion with a"circle"initial condition and a higher-orderquad9mesh.diff-2d-random.json: 2D diffusion with a"random"initial condition.diff-3d-neumann.json: 3D transient diffusion with a Neumann flux on a generated 3D mesh.
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 usesnonlinear-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": trueinside"job", but the current parser ignores that field.