A Java GUI and Distributed CORBA Client-Server Interface for a Coastal Ocean Model
Richard Wain and Mike Ashworth, STFC Daresbury Laboratory
The full report on which this page is based is available here.
Introduction
Scientific simulation codes can benefit from a professional Graphical User Interface
(GUI) making the use of the program easier and quicker for both technical and
non-technical users. We report on recent work on a GUI for the POLCOMS coastal ocean
modelling system. In addition to the GUI allowing for parameter setting and the viewing
of input and output data, we have implemented a client-server interface allowing
real-time monitoring (and potentially computational steering) of the
progress of the simulation from a remote workstation. The work utilises Java,
Java Swing, VTK and CORBA. We intend that this work should be a stepping stone
towards further Grid-related developments for this code.
This report covers recent work on a Graphical User Interface (GUI)
for the Proudman Oceanographic Laboratory Coastal-Ocean
Modelling System (POLCOMS). The GUI has been designed to allow the user to view
and interact with input and output datasets, to set model parameters, to run the
POLCOMS code and to monitor output from the model in real-time.
The work on the GUI focused on the addition of visualisation capabilities as well
as the development of a CORBA bridge between the GUI and POLCOMS. This report
provides in-depth information on the design, implementation and testing of these
additions to the GUI as well as evaluating the work that has been done so far and
summarising the possibilities for further work that could be carried out.
A list of useful resources can be found at the end of this report. These resources
include on-line tutorials, FAQs, example code, journal articles and books. Most of
these have been invaluable references throughout the course of this work and should be
used as a first port of call for any information that is not presented here.
In the distributed computing mode of operation, the POLCOMS model runs as a
server on a remote machine and the user interacts with a client running on a local
PC or workstation. The client-server design was already incorporated into the GUI
but had not been fully implemented when this work began. The model can be started
in a server mode. In server mode it accepts its input parameters from a connection
with the client and returns monitor data by the same route.
This was previously implemented by wrapping the Fortran code with a number of C
routines, which communicated via TCP/IP sockets. Now the Fortran is wrapped further
with C++ and performs the client/server communication using CORBA. Figure 1 shows
the structure of the POLCOMS GUI design and the CORBA link to the model.

Figure 1: Structure of the POLCOMS Java GUI and CORBA interface
(Click for full size image)
The visualization part of the GUI needs to display a range of datasets in a
number of different ways. These datasets do not share a common format so it does
not make sense to design a class that encapsulates the methods required to read,
render and interact with all of them. Instead a top-level visualisation class
defines methods for the dataset that requires the broadest set of visualisation
capabilities on the basis that most other datasets would need to inherit some
methods from this class. The dataset in question in this case is the initial
temperature and salinity data for the model.
Initial temperature and salinity data contains one temperature and one salinity
value for every point on a three dimensional grid of size l x m x n. The data
needs to be viewed in several ways; slices through the 3D grid at a given l, m,
or n and X-Y plots of data. The design requires a class to satisfy all of this
functionality in such a way that as many methods as possible can be directly
inherited by classes for the other datasets.

Figure 2: Structure of the POLCOMS Java GUI and CORBA interface
(Click for full size image)
The main window is shown in Figure 2. The user must select a data directory
before loading the input data. A number of options can then be chosen, either
through the options menu or by pressing the options button. Most of the options
are available via a set of tabbed panes, with one pane for each of the modules
referred to above. Many of the options panes contain lists of files that can be
visualized by pressing the Preferences button, followed by the Visualize
button in the file preferences window. For example, pressing the Preferences
button on the Domain pane, followed by the Visualize button in the file
preferences window opens the visualization window for bathymetry data shown in figure 3.

Figure 3: The POLCOMS GUI Visualisation Window, showing ocean depth for a model of the north-west European shelf
(Click for full size image)
When the model is ready to be run, the user presses the Run button,
and is presented with the monitor window (Figure 3). In the monitor window the
user can set the type and frequency of monitoring data. When the Run button
in the monitor window is pressed the GUI communicates the options to the Fortran
model code, the model starts and the requested monitor information is sent back
via CORBA to the GUI for real-time display.

Figure 4: The POLCOMS GUI Monitor Window
(Click for full size image)
The input and output data visualisation system within the GUI was developed
using the Visualisation Toolkit (VTK). VTK is an open source toolkit written in
C with wrappers provided for Java and a number of scripting languages (Python, Tcl/tk).
The toolkit provides a good range of visualisation routines and a relatively
simple interface to a Java GUI using the vtkPanel class which extends the JPanel
JFC Swing class.
The GUI allows a range of data sets to be viewed by the user. Where appropriate the
user can also interact with the data, for example, data presented as a 2D map allows
for zooming and panning. 3D data sets (Initial temp/salinity) are presented in such a
way that the user can choose a 2D slice of the data at a particular latitude,
longitude or depth. As the file format and visualisation requirements varied,
a separate class was defined to read data files, set up and populate the VTK
data structures and layout the GUI for each dataset.
The Polcoms GUI utilises CORBA technology to steer and monitor the progress
of the Polcoms code. The GUI code includes a CORBA client implemented using JacORB,
while the Fortran code has a C wrapper connected to a similar client implemented
using TAO (The Ace ORB).
CORBA servers (implemented using TAO) can then be run on any machine that can be
seen by both the local machine on which the GUI is running and the remote machine
on which the model is running. The configuration used for testing this code had
the servers running on the same machine as the model. This was mainly because the
TAO libraries were already available on that machine. The client and server sides
shown in figure 5 do not correspond to those shown in figure 1. This is because
figure 1 related to the client/server design for Polcoms whereas figure 5 relates
only to the configuration of CORBA clients and servers.

Figure 5: The POLCOMS GUI Monitor Window
(Click for full size image)
The POLCOMS GUI still requires a number of refinements and additions that either
fall outside the requirements for this work or could not be included because of time
constraints. This section summarises the future work that needs to be done as well as
indicating some of the possibilities for expanding the GUI.s capabilities.
Currently there are a number of datasets that cannot be visualised. These include
tidal data, meteorological data and all output datasets. As long
as the format for each of these datasets can be established it should be relatively
straightforward to write classes to visualise them by extending the current visualisation
classes. There is also room for improvement of some of the less developed visualisation
classes such as .vtkMetVisWindow. which currently controls the display of cloud cover
data, but needs to be expanded to cover all meteorological datasets.
The functionality of the monitor window is currently limited to displaying only
temperature data on an xy-plot. In the future the intention is for this to be updated
to allow the user to choose all parameter types and to allow other forms of
visualisation such as slices through the data.
A possible addition to the GUI's visualisation capabilities might be to incorporate
a method of viewing and saving animations made up of images of datasets changing
as the simulation progresses.
CORBA communication can be enhanced by using the server loop built in to
the Fortran to allow scanning for parameter changes while the code is running.
The steerParams IDL interface currently makes no provision for the passing of
input and output filenames from the GUI to the model. This is a relatively simple
operation but was not thought to be vital to this work as the new capabilities of
the GUI can be demonstrated without it.
We intend that the work described here should be extended to allow the model to make
use of current and future developments in Grid computing. This will probably entail
the replacement of the CORBA code by an interface built around Globus or Web Services.
Remote access to input and output datasets could usefully utilise the
Storage Resource Broker (SRB).
|