Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

If we consider the vector $\left ( A \cdot \nabla \right) \: B$, we have in Cartesian coordinates

$$\left ( A \cdot \nabla \right) \: B = \left ( A \cdot \nabla B_x \right ) e_x + \left ( A \cdot \nabla B_y \right ) e_y + \left ( A \cdot \nabla B_z \right ) e_z,$$ which gives in full writing:

$$\left ( A \cdot \nabla \right) \: B = \left (A_x \frac{\partial \: B_x}{\partial \: x} + A_y \frac{\partial \: B_x}{\partial \: y} + A_z \frac{\partial \: B_x}{\partial \: z} \right )e_x + \left (A_x \frac{\partial \: B_y}{\partial \: x} + A_y \frac{\partial \: B_y}{\partial \: y} + A_z \frac{\partial \: B_y}{\partial \: z} \right )e_y + \left (A_x \frac{\partial \: B_z}{\partial \: x} + A_y \frac{\partial \: B_z}{\partial \: y} + A_z \frac{\partial \: B_z}{\partial \: z} \right )e_z$$

Now, say $B=A$ and $A=\left (10 \: x, \: 20 \, y^3, \: 30 \:z \right )$.

I would like to plot the field of $A$ and of $\left ( A \cdot \nabla \right) \: A$ in Mathematica. How to go about?

(My objective in this exercise is to know which direction the vector $\left ( A \cdot \nabla \right) \: A$ lies with respect to $A$ and also test for different vectors $A$ when the lines of $\left ( A \cdot \nabla \right) \: A$ are straight or are curved.)

Thanks a lot...

share|improve this question
1  
next time, please give a try to your question in Mathematica, if only to save time to people answering them having to type the definitions. –  chris Nov 27 '12 at 10:18

1 Answer 1

up vote 8 down vote accepted

Let us first define the vector field

A = {10 x, 20 y^3, 30 z};

and load the vector analysis package:

<< VectorAnalysis`

SetCoordinates[Cartesian[x, y, z]];

Now let's define $A\cdot \nabla A$

field = (A.Grad[#]) & /@ A

(* ==> {100 x, 1200 y^5, 900 z} *)

and plot both fields:

pl1 = 
  VectorPlot3D[A, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, 
   VectorColorFunction -> "Heat", VectorPoints -> Coarse];

pl2 = 
  VectorPlot3D[field, {x, 0, 1}, {y, 0, 1}, {z, 0, 1}, 
   VectorColorFunction -> "ThermometerColors", VectorPoints -> Coarse];

Show[pl1, pl2]

Mathematica graphics

We could also look at a slice

{VectorPlot[Most[A], {x, 0, 1}, {y, 0, 1}, 
   VectorColorFunction -> "Heat"],
  VectorPlot[Most[field], {x, 0, 1}, {y, 0, 1}, 
   VectorColorFunction -> "ThermometerColors"]} // Show

Mathematica graphics

Or using a different plotting function, StreamPlot:

pl1 = StreamPlot[Most[A], {x, 0, 1}, {y, 0, 1}, 
   StreamColorFunction -> "SolarColors"];
pl2 = StreamPlot[Most[field], {x, 0, 1}, {y, 0, 1}, 
   StreamColorFunction -> "LakeColors"];

Show[pl1, pl2]

Mathematica graphics

Or yet another, LineIntegralConvolutionPlot (takes a bit longer)

pl1 = LineIntegralConvolutionPlot[{Most[A], {"noise", 800, 800}}, {x, 
    0, 1}, {y, 0, 1}, ColorFunction -> "Heat", LightingAngle -> 0, 
   LineIntegralConvolutionScale -> 3, Frame -> False];

pl2 = StreamPlot[Most[field], {x, 0, 1}, {y, 0, 1}, 
   StreamColorFunction -> Function[x, White]];

Show[pl1, pl2]

Mathematica graphics

share|improve this answer
    
Who'll be the first to write a version of your answer using the new Grad? :P –  Rojo Nov 27 '12 at 10:42
    
@Rojo doesn't seem to be that different from the old one ;-) –  chris Nov 27 '12 at 11:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.