Skip to content

Grid2D doesn't work well with integer dx #672

@guyer

Description

@guyer
import fipy as fp

nx = 20
ny = nx
dx = 1
dy = dx
mesh = fp.Grid2D(dx=dx, dy=dy, nx=nx, ny=ny)

phi = fp.CellVariable(mesh=mesh, value=0.)
eq = fp.TransientTerm() == fp.DiffusionTerm(coeff=1)

eq.solve(var=phi, dt=1.)

raises

  • RuntimeError: Factor is exactly singular
  • StagnatedSolverWarning: The solver stagnated. Iterations: 2. Relative error: nan
  • RuntimeWarning: invalid value encountered in true_divide

depending on solver.

dx = 1. fixes this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions