Hi there,
I am trying to calculate the determinant of something what should become a matrix. It concerns a FSI simulation, where the strain is calculated according to
# Define strain
def epsilon(u):
return 0.5 * (nabla_grad(u) + nabla_grad(u).T)
Next up, the determinant should be taken of the following
# Deformation gradient
def DF(u):
I = Identity(dim)
F = I + grad(u)
J = det(F)
return F
This seems to fail due to the fact that a symbolic value is returned for grad(u). Therefore, epsilon turns into a symbolic value as well. Despite, although logical, no determinant could be taken from a single value (or a symbolic value in this case).
This is what epsilon looks like in a single iteration
Value of epsilon(u): { A | A_{i_{66}, i_{67}} = 0.5 * (((nabla_grad(Displacement))^T) + (nabla_grad(Displacement)))[i_{66}, i_{67}] }
This is what the complete error message looks like
File "/home/username/solid-fenics/solid.py", line 195, in <module>
DFgrad = compute_deformation_gradient(u_n)
File "/home/username/solid-fenics/solid.py", line 97, in compute_deformation_gradient
J = np.linalg.det(F)
File "<__array_function__ internals>", line 180, in det
File "/home/username/.local/lib/python3.10/site-packages/numpy/linalg/linalg.py", line 2150, in det
_assert_stacked_2d(a)
File "/home/username/.local/lib/python3.10/site-packages/numpy/linalg/linalg.py", line 197, in _assert_stacked_2d
raise LinAlgError('%d-dimensional array given. Array must be '
numpy.linalg.LinAlgError: 0-dimensional array given. Array must be at least two-dimensional
---[precice] Implicitly finalizing in destructor
---[precice] Synchronize participants and close communication channels
Btw, the deformation gradient F itself is defined like
I + (grad(Displacement))
Any suggestions are welcome
Kind regards