Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.2K Views
|
3 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How to use/ evaluate symbolic vector calculus identities?

3 Replies
POSTED BY: Gianluca Gorni

Dear professor Gianluca Gorni:

Thank you very much for your help, now my problem is almost solved!

I slightly modified the code received to allow for the following options:

1) non-numeric scalar symbols like "s0" or "s1[t,x]":

scalarQ[S_] := TrueQ[TensorRank[S] === 0];

2) Identities for Dot and TensorProduct combinations, taken from Lebedev (2003):

myDot[T_, S_] /; scalarQ[S] :> T*S

myDot[TensorProduct[T1_, T2_], T3_] :> 
 TensorProduct[T1, myDot[T2, T3]]

myDot[T1_, TensorProduct[T2_, T3_]] :> 
 TensorProduct[myDot[T1, T2], T3],

3) Divergence of a Tensor product. For this, I applied the product rule:

myDiv[TensorProduct[T1_, T2_], x_] :> 
 TensorProduct[myDiv[T1, x], T2] + myDot[T1, myGrad[T2, x]],

4) Finally, to allow for constant functions, I added the conditions:

yDiv[T_, x_] /; FreeQ[T, x] :> 0

myGrad[T_, x_] /; FreeQ[T, x] :> 0

My main doubt is the item nÂș3, as I cannot find an explicit published reference. The best I could find was this entry in a physics forum (coincidentally, the fluid mechanics problem involved is the same I have):

Fluid dynamics - divergence of a tensor product

The derivation offered there seems right, but maybe I am wrong.

Finally, I am attaching the full notebook (with the continuum mechanics problem included). Please tell me if there is some mistake there.

References:

Lebedev, Leonid P, and Michael J Cloud. Tensor Analysis, World Scientific Publishing Company, 2003

Attachments:

I am not aware of built-in facilities for vector calculus at this level of abstraction. There may be ready-made packages around. However, we can roll out a version using pattern replacement rules:

scalarQ[_?NumberQ] := True;
divRules = {myDiv[(s_ /; scalarQ[s])*v_, x_] /; FreeQ[s, x] :> 
    s*myDiv[v, x],
   myDiv[v1_ + v2_, x_] :> myDiv[v1, x] + myDiv[v2, x],
   myDiv[(s_ /; scalarQ[s])*v_, x_] :> 
    s*myDiv[v, x] + myDot[myGrad[s, x], v],
   myDiv[myCross[v1_, v2_], x_] :> 
    myDot[v2, myCurl[v1, x]] - myDot[v1, myCurl[v2, x]]};
renderRules = {myDiv -> Inactive[Div], myDot -> Inactive[Dot], 
   myGrad -> Inactive[Grad], myCross -> Inactive[Cross],
   myCurl -> Inactive[Curl]};
scalarQ[s1] = True;
scalarQ[s2[__]] = True;
expr = s1*v[t, x] + v2[t, x] + s2[t, x]*v3[t, x] + 
   myCross[v4[t, x], v5[t, x]];
expr /. renderRules
myDiv[expr, x] //. divRules /. renderRules
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard