# How to find the divergence of a scalar?

Posted 5 months ago
1110 Views
|
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: Equation of motion: D[Div[S,X]+rho*D[U,{t,2}]==rho*G  constitutive equation: c and alpha are constants of elasticity and thermal expansion, respectively, and T0 is the (constant) reference temperature S=c*alpha*(TK-T0)  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
Sort By:
Posted 5 months ago
 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 D[Div[S,X]+rho*D[U,{t,2}]==rho*G 
Posted 5 months ago
 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: 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). Div[S,X]+rho*D[U,{t,2}]==rho*G  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: S=c*alpha*(TK-T0)*Inactive[Table][KroneckerDelta[i1,i2],{i1,3},{i2,3}]  If so, this other, the following combined equations turn to be equivalent: Alternative 1, using divergence: c*alpha*Div[(TK*Inactive[Table][KroneckerDelta[i1,i2],{i1,3},{i2,3}]),X]+rho*D[U,{t,2}]==rho*G  alternative 2, using gradient: c*alpha*Grad[TK,X]+rho*D[U,{t,2}]==rho*G  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!