Plotting a complicated vector field

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...

-

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

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]
````

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
````

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]
````

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]
````

-

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
lang-mma
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 10, "mathjax_display_tex": 2, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9181565642356873, "perplexity_flag": "middle"}