Skip to content

Commit

Permalink
Fix case for one material
Browse files Browse the repository at this point in the history
  • Loading branch information
srosenbu committed Dec 7, 2024
1 parent 702d205 commit 484b780
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions python/comfe/cdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,16 +679,16 @@ def __init__(
nonlocal_initial_config: bool = True,
cells: list[np.ndarray[np.int32]] | None = None,
) -> None:
if mass_mechanics is not None:
if mass_mechanics is None:
rho_space = df.fem.FunctionSpace(velocity_space.mesh, ("DG", 0))
rho = df.fem.Function(rho_space)
cells = cells if cells is not None else [np.arange(rho.x.array.size, dtype=np.int32)]
cells_ = cells if cells is not None else [np.arange(rho.x.array.size, dtype=np.int32)]
rho_list = (
[model.parameters()["RHO"] for model in rust_model] if cells is not None else [parameters["rho"]]
)
assert len(cells) == len(rho_list)
assert len(cells_) == len(rho_list)

for cells_i, rho_i in zip(cells, rho_list):
for cells_i, rho_i in zip(cells_, rho_list):
rho.x.array[cells_i] = rho_i
rho.x.scatter_forward()

Expand Down

0 comments on commit 484b780

Please sign in to comment.