Message Boards Message Boards


How to find the divergence of a scalar?

Posted 1 month ago
2 Replies
0 Total Likes

Dear Wolfram team:

I am just asking what to do if you take the divergence of a scalar. For example, thermal stresses are the result of changes in temperature, a scalar field.

I am guessing that this "divergence" is actually a gradient, but I am not sure. Now I give the details of my example:

EXAMPLE: Thermal elastic stresses.

Note: before using the equations, the following quantities are defined:

  • coordinates:

    X={x1,x2,x3}; vars=Flatten[{t,X}]; 
  • fields: stress S, displacement U, gravity G, temperature TK;

    S=Apply[s,vars];U=Apply[u,vars]; G=Apply[g,X]; TK=Apply[T,vars];

Then the equations:

  1. Equation of motion:

  2. constitutive equation: c and alpha are constants of elasticity and thermal expansion, respectively, and T0 is the (constant) reference temperature


After plugging definition (2) into equation (1) , I get into trouble as said before, because the temperature is a scalar!

In many references I saw that a symbol called "KroneckerDelta" is used to turn scalars into tensors and vectors, among other things, but I have no idea how to use that symbol in the Wolfram Language... anyway, that symbol should be an array of constants (actually many "1"s and "0"s).

Your help would be greatly appreciated.

Merry Christhmas and keep the hope that 2022 would be better than 2020 and 2021!

2 Replies

Divergence riequires a vector valued function, that is, a list of three functions, as here:

X = {x1, x2, x3}; vars = Flatten[{t, X}];
S = {s1 @@ vars, s2 @@ vars, s3 @@ vars}
Div[S, X]

The brackets do not match in your code


Dear Gianluca Gorni:

Thank you for your answer. I was thinking the same thing (about the meaninglessness of the divergence of a scalar), but it should be a solution, as thermal stresses exist in the real-world (they can even break railways and rocks in extreme cases).

Before continuing I must:

  1. Thank you for pointing to a spelling error in the equation of motion (equation 1). The equation I wanted to post was this (with coordinates and fields defined just as in my previous post).

  2. Perhaps the solution to the puzzle is to multiply the scalar by a (inactive) identity matrix made using the "kronecker delta" symbol. So, the thermal stress contitutive equation (equation 2) becomes:


If so, this other, the following combined equations turn to be equivalent:

  • Alternative 1, using divergence:

  • alternative 2, using gradient:


I tried to do this in a Wolfram Notebook, and it seems to work. I will post it today (the current file is too big, and so I must select the relevant parts before posting it).

I would greatly appreciate your comments and suggestions, maybe there is some subtle error lurking in the calculation...

By the way, let's hope for a decent 2022, a better 2023 and a (finally, one has to be realist) a good 2024!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract