Traction Separation Law in Dolfinx

Entity_maps is required for problems that use submeshes . If you do not need submeshes, you do not need to worry about this.

I do use submeshes: cohesive zone model, in the spirit of Bleyer’s CG + CZM interface tutorial.
I skimmed the SNESSolver class and I am not sure I found entity_maps anywhere, yet being necessary, as far as I understand. I might be wrong and entity_maps has to be used in a different way. Any instructions here would be very useful.

I’ve just pushed a commit that allows you to pass entity_maps to the SNESSolver (as it was an oversight from my end).

Previously, you would have to compute the jacobian yourself, and call dolfinx.fem.form on the residual and Jacobian prior to sending them into the SNESProblem.

Fantastic. I will try it.

Btw. I had to add a few more commits to get the typing/imports right.

I saw you added a line to import assign from dolfinx.fem.petsc, in nls.petsc.
When I try to import this petsc code (dolfinx.nls.petsc) in my main code, I get the error: cannot import name 'assign' from 'dolfinx.fem.petsc'. Could it be that I have an old version of dolfinx.fem.petsc? I am confused here.

To sum up: I downloaded dolfinx.nls.petsc, dolfinx.fem.forms, modified in the former the line to import forms from the second (and not my dolfinx installation), and then imported the former petsc in my main code. I use v0.9.0.

assign is a new function, from dolfinx.fem.petsc, that has been added since the 0.9.0 release to simplify interactions with petsc.

For some reason I do not get the version of dolfinx.fem.petsc that contains the assign function when installing fenics-dolfinx with Conda, i.e., conda install -c conda-forge fenics-dolfinx. I updated the channel. I use Mac. Yet, it seems I get an older version of the file.

Main branch is not on conda. You would have to download the source code and extract the relevant functions .

@bleyerj @cmaurini In case it is useful, I leave here a preprint where we report on the implementation for soft cutting mechanics that I referred to in my previous comment from last year. [2507.13565] Cutting soft materials: how material differences shape the response

Thank you @MorenoMiguelES, looks really interesting!

1 Like