2

I want to write Navier-Stokes equations in generalised orthogonal frame of reference in Mathematica. I therefore want to expand gradient and other vector calculus operations using metric factors such that Grad[ϕ[x1, x2, x3], {x1, x2, x3}] expands as

$$\nabla \phi = \frac{1}{h_1} \frac{\partial \phi}{\partial x_1} \mathbf i_1 + \frac{1}{h_2} \frac{\partial \phi}{\partial x_2} \mathbf i_2 + \frac{1}{h_3} \frac{\partial \phi}{\partial x_3} \mathbf i_3,$$

where h1, h2 and h3 are maintained in the Mathematica's output so I can express the equations, after simplifying the expansions, in a desired reference frame. I do not really know how to make Mathematica use the metrics h.

Could you provide me with some methodology for this?

Domen
  • 23,608
  • 1
  • 27
  • 45
dylewiczk
  • 55
  • 4

1 Answers1

2

It is possible to define your own coordinate chart according to Is there a way to add my own coordinate chart? In your case

patch = SymbolicTensors`ScaleFactorGeometryPatch[{h1, h2, h3}, {x1, x2, x3}];
Grad[f[x1, x2, x3], {x1, x2, x3}, patch]

It is important to note that h1, h2, h3 will be treated as constants unless you define them as functions of coordinates. Also, you may need to specify $Assumptions = h1 > 0 && h2 > 0 && h3 > 0 to avoid expressions like $\sqrt{h_i^2}$. You can compute Div and Curl the same way by substituting patch in place of chart.

Ian
  • 41
  • 3