Skip to content

[forms] Add support for dot(x,y) with non-scalar result

Carsten Gräser requested to merge feature/forms-nonscalar-dot into master

While, normally, dot(x,y) represents an inner product and thus requires compatible types, the notation x \cdot y is frequently used in other contexts.

In this generalized sense x and y may denote tensors of different order and x \dot y denotes the contraction only wrt the outer shared indices. E.g. for a vector x and a matrix y it's defined as \sum_i x[i]y[i]. This is e.g. used in the typical v \dot \grad u notation for material derivatives (e.g. in Navier-Stokes), where grad u is the transposed of D u such that the outer most index of \grad u corresponds to the partial derivative direction.

While this patch only adds support for dot(FieldVector<K,n>, FieldMatrix<K,n,m>) and dot(FieldMatrix<K,n,m>, FieldVector<K,n>) it introduces a pattern that can be extended later to higher order tensors. For later reference here's the outline of the intended approach:

Typical viscoelastic models (e.g. Oldroyd-B or Maxwell) contain time derivatives (e.g. upper convected) of tensors T which are explicit unknowns. These time derivatives again contain a v \dot \grad T term for matrices T. In this context D T is a third order tensor indexed by (D T)_ijk where ij are the component indices of T and k is the partial derivative index. Following the above convention \grad T is the transposed of D T in the sense that it is indexed as (\grad T)_kij. Then v \cdot \grad T is again the contraction wrt the outer index k and thus again a matrix indexed by ij.

While there's no adequate data type for the third order tensor DT so far, we can easily represent \grad T as vector of matrices which in the simplest case could be std::array<FieldMatrix<K,n,n>,m> which then needs to be contracted with FieldVector<K,m>.

Merge request reports

Loading