Skip to content

[BUG] Cannot change the mesh between 2 runs of the same 1D simulation #1079

@RemDelaporteMathurin

Description

@RemDelaporteMathurin

Describe the bug

Running a 1D sim, then changing the mesh, and running the sim again (after re-initialising) crashes.

To Reproduce

import festim as F
import numpy as np

my_model = F.HydrogenTransportProblem()

my_model.mesh = F.Mesh1D(vertices=np.linspace(0, 1, 100))

mat = F.Material(D_0=1e-4, E_D=0)

vol = F.VolumeSubdomain1D(id=1, material=mat, borders=[0, 1])

left = F.SurfaceSubdomain1D(id=1, x=0)
right = F.SurfaceSubdomain1D(id=2, x=1)

my_model.subdomains = [left, right, vol]

H = F.Species("H")
my_model.species = [H]

my_model.temperature = 400

my_model.boundary_conditions = [
    F.FixedConcentrationBC(subdomain=left, value=1.0, species=H),
    F.FixedConcentrationBC(subdomain=right, value=1.0, species=H),
]

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

my_model.initialise()
my_model.run()

print(my_model.facet_meshtags)

print("First run done")

my_model.volume_meshtags = None
my_model.facet_meshtags = None
my_model.mesh = F.Mesh1D(vertices=np.linspace(0, 1, 1000))


my_model.initialise()
print(my_model.facet_meshtags)

my_model.run()

Not setting the meshtags to None produces another error, setting them to none makes the solver not converge

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfenicsxIssue that is related to the fenicsx support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions