BAMresearch / fenics-constitutive

Complex constitutive models beyond the FEniCS UFL.
https://bamresearch.github.io/fenics-constitutive
MIT License
13 stars 2 forks source link

Interface definiton of `Problem` #21

Closed TTitscher closed 5 months ago

TTitscher commented 2 years ago

We currently have only one LinearElasticity problem. With future implementations in mind, it is helpful to clearly define the methods and attributes for other code to rely on. This could mean

eriktamsen commented 2 years ago

I agree, we would need a problem definition. My answer to this has some overlap with #20, as I need to control two (or more) separate fields. I will try to answer some of Thomas questions:

I have a question regarding eg. problem.sigma. In my specialized but for me highly relevant example sigma is not a normal function but includes a quadrature point field. Can we handle this in a consistent way?

joergfunger commented 2 years ago

Isn't sigma (even in the standard case ) defined on the quadrature level?

eriktamsen commented 2 years ago

I thought there was a difference between a pure ufl description and one which includes these quadrature spaces. If this is not the case, then this is great and makes this easier =)

TTitscher commented 2 years ago

Jörg may mean that we also implemented Hookes law "manually" (without UFL) on the quadrature spaces. If possible, I prefer to also allow problem definition with UFL constitutive laws. That would give a much smoother "Getting starting" section in the future tutorial :)

Specifically for the stresses, I'd argue that those are either a UFL form or quadrature space values. Both can and must be projected into suitable visualization spaces. Devil in the detail: In 3D, the UFL form returns a 3x3 tensor, our Voigt-based quadrature implementation a 6x vector... We could define a stress_visu_space to always be a dolfin.TensorFunctionSpace and transform the Voigt values accordingly. Pro: Consistent to UFL, looks better in paraview (individual components are marked xx, xy, xz and so on). Contra: Sigma symmetric and off-diagonals would be stored twice.

No deal breaker, just a matter of definition.

eriktamsen commented 2 years ago

I agree that the possibility of UFL models should be included, as this is one of the strength of Fenics, even though only for "simple" problems.

I could live with "wasting" some memory space, when in turn we can have a more intuitive tensor handling. I have cursed the Voigt notation too many times. It really starts being fun when you go into nonsymetric stress measures, eg. P (first Piola-Kirchhoff stress tensor), for large strains. This would only affect the storing and visualization of the stress, right? As when I remember correctly, Voigt also has performance advantages as this can reduce unneccary computations, due to symmetry.

joergfunger commented 2 years ago

For me, implementing both interfaces is also fine (UFL and quadrature).

pdiercks commented 2 years ago

We could define a stress_visu_space to always be a dolfin.TensorFunctionSpace and transform the Voigt values accordingly. Pro: Consistent to UFL, looks better in paraview (individual components are marked xx, xy, xz and so on). Contra: Sigma symmetric and off-diagonals would be stored twice.

The stress_visu_space could be a dolfin.VectorFunctionSpace each for the diagonal and the off-diagonal entries. In the paraview you would then have mappings according to your Voigt notation used (x --> xx, y --> yy, z --> zz for diagonal and x --> xy, y --> xz, z --> yz for example)

strain and stress forms are accessible via problem.eps and problem.sigma (and not problem.strain, problem.stress)

Just a comment to take into account for the naming: maybe problem.stress is better than sigma. sigma refers to the stress in the current placement and therefore stress would be more general and depending on the problem this could as well be the 1st Piola Kirchhoff stress tensor. the same applies for the strain measures.

ajafarihub commented 2 years ago

Considering discussions in #20 and also what I commented here, I would be more fan of developing individual classes for certain problems (or groups of problems) that look too different; e.g. Elastic, ThermoElastic, MixedProblems, etc. Of course, in this procedure we can still try to define attributes and methods that could possibly be most common among others. So far, Plasticity and Elasticity have been merged, i.e. both are modelled via MechanicsProblem . However, such an adequate level of similarities might not easily exist among other problems.