Vector Variables

<< Click to Display Table of Contents >>

Navigation:  User Guide >

Vector Variables

Previous pageReturn to chapter overviewNext page

FlexPDE supports the definition of VECTOR variables.  Each VECTOR variable is assumed to have a component in each of the three spatial coordinates implied by the COORDINATES section in the script, regardless of the number of dimensions represented in the computation domain.

For example, you can construct a one-dimensional spherical model of three vector directions.  Values will be assumed to vary only in the radial direction, but they can have components in the polar and azimuthal directions, as well.

The use of VECTOR variables begins by declaring a variable to be a VECTOR, and naming its components:


V = VECTOR(Vx,Vy,Vz)


The component directions are associated by position with the directions implicit in the selected COORDINATES.  In YCYLINDER (R,Z,Phi) coordinates, the vector components will be (Vr,Vz,Vphi).

Components may be omitted from the right, in which case the missing components will be assumed to have zero value.

A component may be explicitly declared to have zero value, by writing a 0 in its component position, as in

V = VECTOR(0,0,Vphi)

This will construct a one-variable model, in which the variable is the azimuthal vector component.

Subsequently, the vector variable V can be referenced by name, or its components can be accessed independently by their names.

In the EQUATIONS section, each vector variable can be given an equation, which will be interpreted as dealing with vector quantities.  The vector equation will be processed by FlexPDE and reduced to as many real component equations as are named in the declaration, by taking the corresponding parts of the resulting vector equation.

For example, the three dimensional cartesian representation of the Navier-Stokes equations can be presented as  


V:  dens*DOT(V,GRAD(V)) + GRAD(p) - visc*DIV(GRAD(V)) = 0


Alternatively, the individual components can be given real equations:


Vx:  dens*(Vx*DX(Vx)+Vy*DY(Vx)+Vz*DZ(Vx)) + DX(p) - visc*DIV(GRAD(Vx)) = 0
Vy:  dens*(Vx*DX(Vy)+Vy*DY(Vy)+Vz*DZ(Vy)) + DY(p) - visc*DIV(GRAD(Vy)) = 0
Vz:  dens*(Vx*DX(Vz)+Vy*DY(Vz)+Vz*DZ(Vz)) + DZ(p) - visc*DIV(GRAD(Vz)) = 0


In a similar way, boundary conditions may be assigned either to the complex equation or to each component equation individually:

VALUE(V) = VECTOR(1,0,0)


VALUE(Vx) = 0   NATURAL(Vy) = 0


Any parameter definition in the DEFINITIONS section may be declared VECTOR as well:


vectorname = VECTOR(xpart,ypart,zpart)


VECTOR quantities can be the arguments of PLOT commands, as well.  Occurrence of a vector quantity in a PLOT statement will be interpreted as if the component parts had been entered separately in the PLOT command.



will produce a plot with as many traces as are active in the COORDINATES definition.        


Samples | Usage | Vector_Variables | Vector_Variables.pde