Any guides to implement a material model with softening with DOLFINx?

Hello, I would like to know if I can get some guidance on how to implement softening on FEniCSx, please. If there is a course that I can take I would be more than glad to enrol. If someone is willing to guide me on updating the code below to FEniCSx (from legacy FEniCS), that is also welcome. If all else fails, any tips are welcome. These are some of the leads that I have found:

  • FEniCS-constitutive (documentation, repo)

    they avoid external tools (e.g. MFront), but I am concerned if it can be used for 2D and 3D, because the status seems to be for 1D

    here modeled as a thin 2D structure

  • Continuing the discussion from (Variational Formulation for Tensile Testing Simulation)

    This was about FEniCS, and relied on MFront, because

    Implementing non-linear constitutive material laws is not straightforward from scratch in FEniCS.

    May be MFront is no longer needed with FEniCSx?

Thanks.

Cc: @srosenbu, @pdiercks, @jackhale, T. Titscher, alatyshev, cmaurini, sarjimalf

1 Like

@bleyerj has a library for advanced material models in DOLFINx: navier-fenics / dolfinx_materials · GitLab

1 Like

Thank you very much, @dokken . I will definitely look at it. I hope other people have more recommendations too : ) .

Hi @edgar,
with regard to fenics-constitutive, the procedure in fenicsx will be the same, i.e. you will still need to fill the global FE vector for the stresses (and algorithmic tangent) manually. This is also explained in more detail in the docs you referenced and the same as in the MFront approach where the idea comes from.

Regarding your concern whether this can be used for 2D and 3D

Shortly, yes, but it may depend on the problem. As far as I know @srosenbu has used this approach for 3D simulations of concrete under blast loading (explicit dynamics) and had no problems regarding memory (if this was your concern).

Fenics-constitutive

As stated on github the project is not maintained anymore for the legacy fenics. We are working on sorting stuff out towards a new version for fenicsx.

Best,
Philipp

1 Like

Thank you very much, @pdiercks . I think that I will try with fenics-constitutive first then. It seemed to me as the easiest way forward. I’ll share if I manage to get a simple geometry to work with FEniCSx.

The following patch allows examples/gradient_damage.py to work with FEniCSx:

---
 examples/gradient_damagex.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/examples/gradient_damagex.py b/examples/gradient_damagex.py
index d5c3c14..5e9e927 100644
--- a/examples/gradient_damagex.py
+++ b/examples/gradient_damagex.py
@@ -17,6 +17,8 @@ from mpi4py import MPI
 import ufl
 import basix
 
+import dolfinx.nls.petsc
+import dolfinx.fem.petsc
 import matplotlib.pyplot as plt
 
 
@@ -65,7 +67,7 @@ class GDMProblemX:
         num_cells = map_c.size_local + map_c.num_ghosts
         self.cells = np.arange(0, num_cells, dtype=np.int32)
 
-        basix_celltype = getattr(basix.CellType, mesh.topology.cell_type.name)
+        basix_celltype = mesh.basix_cell()
         self.q_points, wts = basix.make_quadrature(basix_celltype, q_deg)
         self.strain_expr = df.fem.Expression(eps(self.d), self.q_points)
         self.e_expr = df.fem.Expression(self.e, self.q_points)
@@ -96,8 +98,8 @@ class GDMProblemX:
 
     def evaluate_constitutive_law(self):
         with df.common.Timer("compute strains"):
-            strain = self.strain_expr.eval(self.cells)
-            e = self.e_expr.eval(self.cells)
+            strain = self.strain_expr.eval(self.mesh, self.cells)
+            e = self.e_expr.eval(self.mesh, self.cells)
 
         with df.common.Timer("evaluate constitutive law"):
             self.mat.evaluate(strain.flatten(), e.flatten())
@@ -110,7 +112,7 @@ class GDMProblemX:
             self.q_deeq_deps.x.array[:] = self.mat.deeq.flat
 
     def update(self):
-        e = self.e_expr.eval(self.cells)
+        e = self.e_expr.eval(self.mesh, self.cells)
         self.mat.update(e.flatten())
 
     def form(self, x: PETSc.Vec):

base-commit: 201e25bae4b3a7a77966630d5f4b70a45f41001c
-- 
2.42.0

  • FEniCSx software
    dolfinx: 0.7.0.dev0_r27554.cfeffe0-1
    basix: 0.7.0.dev0_r945.1117a8d-1
    ufl: 2023.2.0.dev0_r3562.77ae57c-1
    ffcx: 0.7.0.dev0_r7077.1d27238-1

  • Dependencies
    python: 3.11.5-2
    python-numpy: 1.26.0-1
    petsc: 3.19.5.1172.g92f94a14170-1
    hdf5-openmpi: 1.14.2-1
    boost: 1.83.0-2
    adios2: 2.8.3-5
    scotch: 7.0.4-1
    pybind11: 2.11.1-1
    python-build: 1.0.1-1
    python-cffi: 1.15.1-4
    python-cppimport: 22.08.02.r6.g0849d17-1
    python-installer: 0.7.0-3
    python-meshio: 5.3.4-2
    python-mpi4py: 3.1.4-3
    python-pytest: 7.4.2-1
    python-scikit-build: 0.17.6-1
    python-setuptools: 1:68.0.0-1
    python-wheel: 0.40.0-3
    xtensor: 0.24.0-2
    xtensor-blas: 0.20.0-1

  • Operating system
    Arch Linux: 6.5.4-arch2-1

1 Like