Projection of Gradient of Tensor object

Hi all. I am having an issue with projecting the derivative of a tensor on a sphere. This is the term in the weak form. Let P be the projector ( P = I - nxn). How to properly do the projection. Please help

term = ∇(q) ⊙ ∇(tq)

Welcome @Ankan_Man, is this about Julia code? Or is this just about the pure maths? Either way, what have you tried?

You’ll need to give a bit more context, but you should be aware that this isn’t a homework help site.

We are trying to solve Landao ginsberg on the surface of a sphere.
The tensor object used is as follows

const QST = SymTracelessTensorValue{3,Float64,6} # Symmetric traceless tensor with 6 components

model = GmshDiscreteModel("sphere.msh")

Ω = Triangulation(model)

degree = 2

# 2. Create the measure dΩ from the triangulation Ω

dΩ = Measure(Ω, degree)

order = 1

reffe_T = ReferenceFE(lagrangian, QST, order)

VT = FESpace(model, reffe_T, conformity=:H1)

The weak form is given as below

function weak_form(q, q0, tq, dt, D)
  print(2)
  n  = get_normal_vector(Ω)
  I3 = one(TensorValue{3,3,Float64})
  P  = I3 - outer(n,n)          # same as I - n ⊗ n

  # Time derivative: (q - q0)/dt
  time_derivative = (q - q0) / dt

  # Non-linear term: q ⋅ q ⋅ q (Ensure the inner products match the tensor rank)
  # For SymTracelessTensorValue, q⋅q is a dot product.
  q3 = q ⋅ q ⋅ q 
  
  # The Weak Form Terms
  # Term 1: Time derivative dotted with test function
  term1 = time_derivative ⊙ tq
  
  # Term 2: Diffusion term (Laplacian in weak form)
  # Use ⊙ (inner product) for tensors
  #term2 = D * (∇(q) ⊙ ∇(tq)) # without projection
  term2 = D * ((P ⋅ ∇(q)) ⊙ ( P ⋅ ∇(tq)))
  
  # Term 3: Nonlinear potential term
  term3 = q3 ⊙ tq

  # Term 4 : Linear term
  term4 = q ⊙ tq
  print(3)
  return term1 - term2 + term3 - term4 
end

# Initialize the fields for the solver

V = FESpace(model, reffe_T, conformity=:H1)

U = TrialFESpace(V)

resi(V, U) = ∫( weak_form(V, Q0, U, dt, D) )*dΩ

This is how I was trying to project it, but this is not the right way. This is because the projection must also act on the basis. We are suppose to use 3 projection operators.

P \partial_j A P (P e_k) - This is the right way to do it in a eienstein convension. I was wondering how to do proper projection in Julia. And this is not a homework!! :-/