cps home works
Java For Scientific And Engineering Computations
Introduction:
Although Java has been extensively used for applets on the Web,there are
two major factors (in my opinion) that indicate it can also play a
significant role in the engineering community:
First, the portability of the language offers a means of reducing the cost
of maintaining algorithms across platforms, freeing developers to create
functionality.
Second, the object orientation and threading interface of Java offers a
means for wider code reuse, currently rare in the numerical
community.
Java offers the benefits of portability, object orientation, graphical
interface components, multithreading, and distributed programming, all in
one concise and small package.
This review reasons the Java platform on the basis of code development
capability and performance by contrasting several implementations of a
TSD (Transonic Small Disturbance) equation solver.
Numerical Model:
This is a part of a project that I worked on a few years ago. It concerned
solution of slender two dimensional airfoil flows at transonic speeds. The
code used for this study solves the TSD (Transonic Small Disturbance)
equation for the simulation of inviscid steady transonic flow over slender
airfoils. Slender airfoils only cause minor perturbations to the incoming
flow and the inviscid two dimensional Euler equations, based on the
latter assumptions, can be simplified to a quasi-linear PDE (partial
differential equation) widely known as the TSD equation.
The code uses the classical Murman and Cole algorithm [1] which utilizes a
second order differencing scheme in subsonic regions of the flow and a
first order upwind-baised differencing in the supersonic regions. A
cartisian grid with equal spacing in the x-direction over the airfoil was
used and a geometrically stretched mesh was also used in the y-direction.
The resulting linear system of algebraic equations is iteratively solved
using a GSLR (Guass-Siedel Line Relaxation) technique which involves
sweeping in the streamwise direction and solution of a tridiagonal system
of equations normal to the airfoil.
As far as the coding is concerned I can not find any reason why Java
could not be used for the computation of the solution.
The coding logic is not different from any other scientific programming
language, except may be for array handling by the different methods
(due to the inherent object orientation of the language) and which should
not be difficult to implement.
However, the speed of the solution compared to other languages such as C
or Fortran is still something to be questioned.
Nevertheless, through my exploring of the Java language I found that there
are
some programming paradigms that may be used for the present application
which are unique for the Java language:
1-Java/C JNI: Java can deal with other languages through the JNI (Java
Native Interface [2]). The JNI is an implementation interface designed to
integrate non-Java codes ( written in languages such as C etc.). The most
common example of such a situation is in the reuse of existing (optimized)
platform-dependent libraries with the Java code.
2- Java RMI: Remote Method Invocation (RMI) is the Java API for enabling
integration of distributed objects in Java code. The object reside in
different Java virtual machines, which could be running either on the same
or different computers. RMI allows the client code to invoke methods on an
object on the server in a straightforward manner.
The RMI for the present implementation can be applied as follows: the
client code accepts the input parameters from user via a user-interface
and marshals them off to the server and invokes the remote GSLR solver
method. After the computation is done the server returns the solution
arrays (mach number, pressure coefficient etc.) back to the client for
further processing and graphical display.
Implementation of distributed capability via RMI is considered
straight-forward, though the AWT lacks the high-level interfaces which
would speed development time.
Graphical Visualization:
In my experience in Java I find that the display of two dimensional
solution results is straight-forward. Java's implementation of the
animated display of a time-sequence of
consecutive datasets is the simplest among all existing standalone
languages. Moreover,the visualization of the results can be used in
parallel to the computations to assess certain crucial parameters such as
convergence , stability, and transition from one flow regime to
another.
Conclusions:
Several trends favor the use of Java in engineering environments:
1- The increasing integration of simulation and product development cycles
favors the separation of compute cycle servers and lightweight client
user front ends. Maintenance of a fewer high-performance compute sites
simplifies system administration, while use of a portable language on both
server and client side may simplify procurement as well, as porting
concerns are mitigated.
2- As the benefits of high-order computational simulation are applied to
less costly products, some designers will not be able to justify the
capital costs of dedicated compute server. For those designers, the
availability of a browser ready solution, with client-end specification of
the problem may be an attractive option.
3- The demand for high-fidelity prediction capability has led to the
development of multi-disciplinary codes. Such codes typically do not
incorporate the best features of, say a finite element structural code and
fluids solver, due to the enormous interface problem.
Encapsulating
the
logic within smaller components via object orientation may offer a means
of easing the interface burden.
[1] E.M. Murman & J.D. Cole, Calculation of Plane-Steady Transonic Flows.
AIAA Journal,vol.9,(1974),p114.
[2] Java Native Interface (JNI), see
www.javasoft.com/products/jdk/1.1/docs/guide/jni