Any experience here using Tensors.jl to implement the uppper-convective derivative? Thx.
Typically, you will need more than Tensors.jl
to do that, since you will need some description of the velocity field. Assuming that you have that, e.g. you have functions for the flow velocity, v = foo(x::Vec, t::Real)
, and the tensor to be differentiated, A = bar(x::Vec, t::Real)
, where x
are the current coordinates and t
the time, then you can calculate the upper-convected time derivative (based on Upper-convected time derivative - Wikipedia)
\stackrel{\nabla}{\boldsymbol{A}} = \dot{\boldsymbol{A}} - \mathrm{grad}(\boldsymbol{v}) \cdot \boldsymbol{A} - \boldsymbol{A} \cdot \mathrm{grad}(\boldsymbol{v})^\mathrm{T} = \left.\frac{\partial\boldsymbol{A}}{\partial t}\right\vert_\boldsymbol{x} + \boldsymbol{A} \cdot \boldsymbol{v} - \mathrm{grad}(\boldsymbol{v}) \cdot \boldsymbol{A} - \boldsymbol{A} \cdot \mathrm{grad}(\boldsymbol{v})^\mathrm{T}
as
∂A∂t, A = gradient(tt -> bar(x, tt), t, :all)
∇v, v = gradient(xx -> foo(xx, t), x, :all)
Auc = ∂A∂t + A ⋅ v - ∇v ⋅ A - A ⋅ ∇v'
(Tensors use the standard [\mathrm{grad}(\boldsymbol{v})]_{ij} = \partial v_i / \partial x_j notation).
(Edit: flipped foo
and bar
)
I see. Thank you so much.