examples.diffusion.variableΒΆ

This example is a 1D steady state diffusion test case as in ./examples/diffusion/variable/mesh2x1/input.py with then number of cells set to nx = 10.

A simple analytical answer can be used to test the result:
>>> DiffusionTerm(coeff = diffCoeff).solve(var)
>>> if __name__ == "__main__":
...     viewer = Viewer(vars = var)
...     viewer.plot()
>>> x = mesh.cellCenters[0]
>>> values = numerix.where(x < 3. * L / 4., 10 * x - 9. * L / 4., x + 18. * L / 4.)
>>> values = numerix.where(x < L / 4., x, values)
>>> print(var.allclose(values, atol = 1e-8, rtol = 1e-8))
1
Last updated on Jun 26, 2024. Created using Sphinx 7.1.2.