Skip to content

[BUG] Cannot use Nitsche interface method with rectangles #1109

@kaelyndunnell

Description

@kaelyndunnell

Describe the bug
Nitsche interface method produces an error with hex-only mesh: "ValueError: Circumradius only makes sense for affine simplex cells."

To Reproduce
MWE to reproduce behavior:

import festim as F
from dolfinx.mesh import create_unit_square, CellType
from mpi4py import MPI
import numpy as np

fenics_mesh = create_unit_square(
    MPI.COMM_WORLD, 10, 10, cell_type=CellType.quadrilateral
)
festim_mesh = F.Mesh(fenics_mesh)

my_model = F.HydrogenTransportProblemDiscontinuous()

material_top = F.Material(D_0=1, E_D=0, K_S_0=2, E_K_S=0)
material_bottom = F.Material(D_0=2, E_D=0, K_S_0=3, E_K_S=0)

top_volume = F.VolumeSubdomain(
    id=3, material=material_top, locator=lambda x: x[1] >= 0.5
)
bottom_volume = F.VolumeSubdomain(
    id=4, material=material_bottom, locator=lambda x: x[1] <= 0.5
)

top_surface = F.SurfaceSubdomain(id=1, locator=lambda x: np.isclose(x[1], 1.0))
bottom_surface = F.SurfaceSubdomain(id=2, locator=lambda x: np.isclose(x[1], 0.0))

my_model.mesh = festim_mesh
my_model.subdomains = [top_surface, bottom_surface, top_volume, bottom_volume]

my_model.surface_to_volume = {
    top_surface: top_volume,
    bottom_surface: bottom_volume,
}

my_model.method_interface = F.InterfaceMethod.nitsche
my_model.interfaces = [F.Interface(5, (bottom_volume, top_volume), penalty_term=1000)]

H = F.Species("H")
my_model.species = [H]
H.subdomains = [top_volume, bottom_volume]

my_model.temperature = 400

my_model.boundary_conditions = [
    F.FixedConcentrationBC(subdomain=top_surface, value=1.0, species=H),
    F.FixedConcentrationBC(subdomain=bottom_surface, value=0.0, species=H),
]

my_model.settings = F.Settings(atol=1e-10, rtol=1e-10, transient=False)

my_model.initialise()
my_model.run()

Expected behavior
Expected the simulation to solve using nitsche interface method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions