Skip to content

[BUG] - Navier Stokes solver hangs in parallel if the domain has negative coordinates #211

Description

@jcgraciosa

Describe the bug

  • What is the bug?
    The Navier-Stokes solver hangs during solve when run in parallel if the domain has negative coordinates. This is the root of Salam's reported issue in Kaiju.
  • What version of the code?
    Latest development branch
  • What system are you running the code on?
    Can be replicated in a local Mac installation or in Kaiju
  • Steps to reproduce?
    This stripped version of Couette flow can be used to replicate the issue:
import sympy
import underworld3 as uw

Re         = 100
resolution = 16
U_wall     = 1.0
rho        = 1.0
nu         = 1.0 / Re
mu         = rho * nu

width       = 4.0
height      = 1.0

# will cause solve() to hang
minX, maxX  = -width/2., width/2.
minY, maxY  = -height/2., height/2.

# will NOT cause solve() to hang
#minX, maxX  = 0., width
#minY, maxY  = 0., height
#minX, maxX  = 1., 1. + width
#minY, maxY  = 0.5, 0.5 + height

uw.pprint(minX, minY)
uw.pprint(maxX, maxY)

mesh = uw.meshing.UnstructuredSimplexBox(
    minCoords=(minX, minY),
    maxCoords=(maxX, maxY),
    cellSize=1. / resolution,
    qdegree=3,
    regular=False,
)
mesh.dm.view()

v = uw.discretisation.MeshVariable("U", mesh, mesh.dim, degree=2)
p = uw.discretisation.MeshVariable("P", mesh, 1, degree=1, continuous=False)

ns = uw.systems.NavierStokesSLCN(
    mesh, velocityField=v, pressureField=p, rho=rho, order=1
)
ns.constitutive_model = uw.constitutive_models.ViscousFlowModel
ns.constitutive_model.Parameters.viscosity = mu
ns.bodyforce = sympy.Matrix([0, 0])

ns.add_dirichlet_bc((U_wall, 0.0), "Top")
ns.add_dirichlet_bc((0.0,   0.0), "Bottom")

ns.tolerance = 1.0e-6

ns.petsc_options["snes_monitor"] = None
ns.petsc_options["snes_converged_reason"] = None
ns.petsc_options["ksp_monitor"] = None

dx = mesh.get_min_radius()
dt_adv = 1.0 * dx / U_wall
dt_diff = 1.0 * dx**2 / nu
dt = min(dt_adv, dt_diff)

uw.pprint(f"dt: {dt}")

ns.solve(timestep=dt, zero_init_guess=True)

The issue appears with at least 3 procs:

pixi run mpirun -n 3 python3 couette-stripped.py

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions