
The Vector Field model shows a vector field with components (Ax, Ay).
The Vector Field model displays the vector field A=(Ax, Ay). The vector field visualization uses arrows that have the same length but different colors. Using color rather than arrow length to represent a vector field's strength produces a more effective representation of magnitude over a wider range of values.
The Vector Field element uses arrays to store vector components at grid points and binds (connects) these arrays to a Vector Field element. The model evaluates the field at the grid points using a fixed relation code page. Note how we use object notation to access vector field and function methods.
//scalar field is computed at each grid point
for(int i=0; i<m; i++) { // loop over grid x
double xi= _view.vectorField.indexToX(i); // x-coordinate of grid point
for(int j=0; j<m; j++) { // loop over grid y
double yj= _view.vectorField.indexToY(j); // y-coordinate of grid point
xComponentData[i][j]=_view.xFunction.evaluate(xi,yj); // x-component value
yComponentData[i][j]=_view.yFunction.evaluate(xi,yj); // x-component value
} // end of y loop
} // end of x loop
The field components are stored in the xComponentData and yComponentData arrays. The Ax and Ay functions are in the view and are named xFunction and yFunction.
The following EJS models are described in Chapter 10 of the EJS adaptation of An Introduction to Computer Simulation Methods.
Additional models to be written.
The Analytic Vector Field model was created by Wolfgang Christian using the Easy Java Simulations (EJS) modeling tool version 4.2. You can examine and modify the model for this simulation if you have EJS installed by right-clicking within the program and selecting "Open Ejs Model" from the pop-up menu.
Information about EJS is available at: <http://www.um.es/fem/Ejs/> and in the OSP ComPADRE collection <http://www.compadre.org/OSP/>.