Sei sulla pagina 1di 8

Advances in Engineering Software 37 (2006) 797–804

www.elsevier.com/locate/advengsoft

EasyFEM—An object-oriented graphics interface finite


element/finite volume software q
S. Phongthanapanich a, P. Dechaumphai b,*

a
Department of Mechanical Engineering, Siam University, Phasi-charoen, Bangkok 10163, Thailand
b
Mechanical Engineering Department, Chulalongkorn University, Patumwan, Bangkok 10330, Thailand

Received 23 May 2005; received in revised form 3 January 2006; accepted 16 May 2006
Available online 28 July 2006

Abstract

An object-oriented finite element/finite volume software, EasyFEM, has been developed. The software, with a fully interactive graph-
ics interface, analyses heat transfer, solid mechanics, and fluids problems by the finite element and the finite volume methods. The Coad
and Yourdon methodology is used to describe the general structure of classes and objects implemented by the software. Details of the
object-oriented classes for both the graphics pre- and post-processors, as well as for the analysis solutions, are described. Several case
studies with graphical representations of numerical solutions are presented to illustrate some functionalities of the software.
 2006 Elsevier Ltd. All rights reserved.

Keywords: Object-oriented programming; Graphics user interface; Finite element/finite volume software

1. Introduction of new developments can also pose additional difficulties


after the software has been used for sometimes.
Need for engineering software to analyze interdisciplin- To normal users of any software, effective graphical
ary problems has increased recently. Fluid/structure interface for both the pre- and post-processors is needed.
interaction problems, in particular, have arisen in manufac- A number of tasks, such as constructing geometries,
turing industries that demand developments of new analy- discretizing domains, applying loads and constraints, per-
sis tools. The finite element method (FEM) has gained its forming analyses, and displaying solutions, must be simple
popularity for solving structural problems in the past dec- and easy for users. Furthermore, because most users have
ades, while the finite volume method (FVM) is being widely good backgrounds or experiences only in one discipline,
employed in computational fluid dynamics for solving fluid e.g., either structures or fluids, supportive human–com-
problems. Even though both methods start from the same puter interaction (HCI) concept should be incorporated
process of domain discretization, but their analyses and in every state of the software analysis and design to
computational procedures are different. Combining both increase the learnability for other disciplines. All of the fac-
methods in single software thus normally creates program- tors described above which include the programming con-
ming difficulty, mainly from different backgrounds of cepts, the different analysis solvers for disciplinary
programmers who have expertise in different fields. In addi- problems, the full graphical interface environment, and
tion, software maintenance including the implementation the human–computer interaction concept for improved
learnability, must be considered prior to developing a soft-
ware for analyzing complex engineering problems
q
nowadays.
This is a freeware, free copy of software could be requested directly
from the corresponding author.
Object-oriented programming (OOP) is a well-suited
*
Corresponding author. Tel./fax: +66 2 218 6621. approach for serious developers and has received the
E-mail address: fmepdc@eng.chula.ac.th (P. Dechaumphai). popularity in the computational engineering community

0965-9978/$ - see front matter  2006 Elsevier Ltd. All rights reserved.
doi:10.1016/j.advengsoft.2006.05.006
798 S. Phongthanapanich, P. Dechaumphai / Advances in Engineering Software 37 (2006) 797–804

recently. The OOP offers many means of avoiding/reducing 2. Object-oriented programming in VB/VC++ and general
difficulties encountered during the software development structure of EasyFEM
life cycle [1,2]. It also helps improving the software code
reusability, modificability, maintainability, with good doc- The OOP is a concept that helps programming easier
umentation. In the past decade, the object-oriented concept and more effective by coding software to deal directly with
has been applied by researchers [3–7] to develop finite ele- objects in the real world. The object-oriented paradigm
ment and finite volume programs by using the OOP lan- consists of the three major components that an OOP lan-
guages, such as the SmallTalk and C++. Recently, the guage should support. The first component, the encapsula-
new trend of software development is the incorporation tion, is the ability to hide detailed implementation of an
of a friendly graphics user interface environment to maxi- object. The inheritance, the second component, is the abil-
mize the user learnability through direct visualization. This ity to reuse the existing objects for creating new specialized
work proposes a procedure to combine such graphical objects. The third component, the polymorphism, is the
interface environment with the finite element/finite volume ability of the code to exhibit multiple behaviors, or to allow
analysis solvers, all with the object-oriented programming the use of identical function names for logical similar meth-
approach. ods in different types [1,8].
EasyFEM is a prototype graphics interface software It is well-known that VB does not fully support the OOP
developed for analyzing two-dimensional heat transfer, solid features, for example, VB handles polymorphism a little
mechanics, and fluid flows problems by the finite element/ differently from the way VC++ does. VB does not use
finite volume methods. The software employs the OOP inheritance to provide polymorphism, but VB allows pro-
approach for both the user graphics interface and the analy- grammers to create an interface, which is a set of related
sis solution modules. The pre- and post-processors, with properties and method definitions, in an abstract class.
friendly graphics user interface environment, allow users This special class is then declared in class modules that
to construct arbitrary geometries, discretize computational implement the interface by using the Implements keyword.
domains automatically, apply loads and constraints, per- Another important feature that VB does not directly sup-
form analyses, and display solutions with ease. port is the pointer implementation. However, the feature
The plain console finite element/finite volume applica- could be added to VB by the help of VC++ and some Win-
tion has been widely developed and used by researchers. dows Application Programming Interface (Win32 API)
Even though such the console application is adequate for functions. On the other hand, the benefits of using VB
solving academic type problems but it is not suitable for for software development can be easily recognized for its
problems with complex geometry. The pre- and post- simplicity, less time consuming with complete tools for user
graphics interface software is needed to increase the model- interface design as compared to VC++.
ing capability and to display solutions effectively. One of The pre/post-processing parts of the EasyFEM software
the objectives of this paper is to present an idea for has been mostly developed using VB for the design of user
designing a pre- and post-graphics interface software that interface objects, such as dialog boxes, menu icons, tool-
can be used with the existing solvers. The idea is simple bar, graphics canvas, etc. In selected parts, VC++ is used
and can be implemented by a programmer with moderate only for graphics implementation and some add-on func-
OOP background. tions for VB via dynamic-link library (DLL). Because the
The primary objective of this paper is to present the software was intended for the analyses of disciplinary prob-
OOP concept used in the development of the EasyFEM lems, the user interface design should maintain the consis-
graphics interface software for solving disciplinary prob- tency, familiarity, observability and responsiveness in order
lems under a friendly graphics user interface environment. to enhance its usability [2]. To illustrate some implementa-
The classes and objects classification idea described in this tion of these ideas on the EasyFEM software, Fig. 1(a)–(b)
paper is uncomplicated for finite element/finite volume shows an example of the two dialog boxes used to apply
software development and can be used with several kinds nodal loads of the heat transfer and solid mechanics prob-
of existing solvers with small modification. To reduce the lems, respectively. These dialog boxes look similar in order
software development effort, the multi-language software to improve the learning curve of newcomers for analyzing
should be implemented. The Visual Basic (VB) is employed problems in different disciplines. The same type of the dia-
herein for the user graphics interface because of its simplic- log box, shared by all disciplinary problems, provides the
ity with convenient debugging feature. The Visual C++ proper load types for each specified problem automatically
(VC++) is used to provide efficient graphics capability, with consistent interface design. So that when a newcomer
while the Visual Fortran (VF) is employed in the develop- learn how to use one dialog box for a disciplinary problem,
ment of the analysis solvers. The data structure organiza- and he/she would grasp the idea for solving different prob-
tion of the software and the object handlings are lems in the other disciplines.
described. Several examples of heat transfer, solid mechan- EasyFEM software is an integrated graphics/analysis
ics, and fluid flows problems are presented to highlight dis- environment that composes of two main parts, the pre/
tinctive numerical solutions and graphics representations post-processors and the solvers. The general structure of
of the software. the pre- and post-processors consists of several classes that
S. Phongthanapanich, P. Dechaumphai / Advances in Engineering Software 37 (2006) 797–804 799

Fig. 1. Shared dialog box concept of nodal load applications: (a) for heat transfer problem and (b) for solid mechanics problem.

could be classified into four categories, which are the Curve class is the abstraction for different geometry shapes
graphics, the finite element, the error handle, and the file such as the lines (Line class), arcs or circles (Arc class) and
I/O handle as shown in Figs. 2 and 3 by the Coad and the splines (Spline class). The Point class stores all informa-
Yourdon diagram [9]. The implemented data structure tion about the points. The Boundary class stores informa-
model follows the idea given in Ref. [10] with modifications tion for the boundary formation by the given curves and
for more convenient coding. The modifications include the also the discretized finite element model that consists of
use of VB to ease data preparation for both the element- elements, nodes, materials, loads, constraints and solu-
based FE and the edge-based FV solvers. tions. The 2DViz class is the abstraction for several classes
The graphics category consists of several classes that performing all the solution presentation by scientific visual-
handle all the graphics presentation. For instance, the base ization such as the fringe plots (Fringe class), contour lines

Boundary
ErrorHandle FileHandle

3,m 0, m

0,2 1

Curve Element

2, 4 1 3 1 0, m 0, m

0, m 0, m 1, m

Point Node Material


1 1 1 1

Load Constraint

1 0, m0, m

1 1

2DViz Solution SolverControl Solver

Fig. 2. General structure of EasyFEM software.


800 S. Phongthanapanich, P. Dechaumphai / Advances in Engineering Software 37 (2006) 797–804

Curve FileHandle

Line Arc Spline ModelFile FEFile TempFile

Load Constraint

NodeL ElementL EdgeL NodeC EdgeC

2DViz

Contour Fringe Vector Deform ParticleTracing

Fig. 3. Generalization-specification structure of classes implemented by EasyFEM software.

or streamlines (Contour class), deformation shapes (Deform in the finite element model. The Solution class stores the
class), vector plots (Vector class) and particle tracing con- numerical solutions that are returned from the solver.
tours (ParticleTracing class). The error control and file I/O manipulations are sepa-
The finite element category consists of six main classes rately designed as ErrorHandle and FileHandle classes.
containing all information of the finite element model. The The ErrorHandle class handles all error events including
Element class stores the information of the three-node trian- inter-processes error which should be introduced by exter-
gular elements while the Node class stores all information of nal solver. The FileHandle class is an abstraction class for
the nodes. The mesh generation of EasyFEM consists of the handling input/output data stream which includes the
Delaunay mesh generation technique [11–13], the automatic ModelFile class for model file management, the FEFile
node creation technique [14], and the mesh quality improve- class for fixed-format text file handling used to communi-
ment by the mesh smoothing technique. The Constraint and cate with external solver and the TempFile class for con-
Load classes are abstractions for storing the information of trolling cached file which is used to speed up the input/
the constraints and loads, the specified initial conditions output data streaming.
and/or the boundary conditions, respectively. The Material The solvers for analyzing disciplinary problems are
class stores the material properties assigned to all elements developed independently by using VF due to its efficiency
S. Phongthanapanich, P. Dechaumphai / Advances in Engineering Software 37 (2006) 797–804 801

for handling mathematical and matrix/vector operations • List existing objects and related information.
with several object-oriented features supported by Fortran • Select existing objects using the mouse. The selections
90/95 [8]. The general structure of the solvers consists of could be for an individual object, several objects, within
several classes implemented in modules, while derived-data a specified box or a circle.
types are encapsulated to provide interface with external • Identify the existing objects by displaying graphically.
objects. The six solvers perform analyses for problems in • Control the properties of object or object entity by using
the different disciplines by the FEM or the FVM such as color and font visibility.
the heat transfer, solid mechanics, thermal stress, potential • Create model database with data compression feature.
flow, low-speed viscous flow, and high-speed compressible • Export all the objects to image files in several formats
flow analyses, respectively. such as .bmp, .gif, .jpg, .png, and .wmf.
The design concept of the EasyFEM software and its • Export neutral files that contain information of the
analysis procedure for solving disciplinary problems are model for other applications.
shown in Fig. 4. The main features of the software are sum- • Create ASCII input files for the solvers.
marized as follows.

2.1. Pre-processor 2.2. Solver

• Create, modify and delete the model geometry consist- • Perform linear stress analysis [15].
ing of point and curve objects with the help of dialog • Perform heat transfer analysis [16].
boxes. The software supports many types of curves such • Perform thermal stress analysis [15].
as lines, arcs, circles and splines and uses several meth- • Perform potential flow analysis [15].
ods to create both the point and curve objects. • Perform low-speed viscous flow analysis [17].
• Change background color of the graphics window. • Perform high-speed compressible flow analysis [18–20].
• Define multi-boundary domain by selecting curves to • Create ASCII output files for post-processor.
form a simple closed loop, with or without holes, to
define the boundary object.
• Create, modify or delete material types (e.g., steel, 2.3. Post-processor
water, wood, etc.), model properties (e.g., thickness of
elements), and analysis types (e.g., plane stress or plane • Read ASCII output files.
strain case) • Display model deformation shapes.
• Discretize the selected boundary objects into three-node • Display fringe plots or contour lines.
triangular elements. • Display flow vectors or displacement vectors.
• Apply loads and boundary conditions on nodes or edges • Display streamlines.
of elements depending on types of problems. • Generate AVI files or show animation of particle paths
by a particle tracing method.
• Support multi-color or single-color visualization with
Select solver shading up to 1024 levels.
• Report minimum or maximum values of solutions.
Create material

Create geometry 3. Examples

Define boundary Four examples are used to demonstrate some function-


alities and the capability of the EasyFEM software for ana-
Discretize boundary lyzing different disciplinary problems. The first example is a
rectangular plate with a circular hole at the center, sub-
Create loads Create constraints jected to uniform loading along the left and the right edges.
Due to symmetry of the problem, only a quarter of the
Export data plate as shown in Fig. 5 is used for modeling. For a domain
with irregular shape, the EasyFEM software allows users
FE/FV analysis to split the model into multi-boundary domains or objects
as shown in the figure. Each object consists of a closed loop
Read solution
of curves that may include holes if needed. Discretization
into a finite element model can then be performed using
Visualize solution
either the structured or unstructured mesh. Fig. 6(a)–(b)
Fig. 4. Design concept and computational procedure of EasyFEM shows the graphical objects consisting of the boundary
software. objects and the finite element objects, respectively.
802 S. Phongthanapanich, P. Dechaumphai / Advances in Engineering Software 37 (2006) 797–804

Fig. 5. Typical graphics environment of EasyFEM. Fig. 8. Fringe plot of temperature distribution of heat transfer in a multi-
holes plate.

Fig. 7(a) shows a structured finite element mesh with the


applied forces for all the nodes along the right edge, and However, the boundary conditions for this example are
the proper constraints along the problem symmetrical lines. specified as the temperature of 80 C for all nodes along
After the problem is analyzed by the Solid solver, the von the small holes and 30 C along the outer edge of the plate.
Mises stress solution can be displayed in the form of a Fig. 8 shows the fringe plot of the temperature solution
fringe plot on the deformed geometry as shown in obtained from the heat solver.
Fig. 7(b). The third example is a low-speed viscous fluid flow in a
The second example is a heat transfer problem in a cir- square cavity at the Reynolds number of 400 [21]. Again,
cular plate with holes. The processes for constructing the the preparation processes for creating the geometry and
geometry and the discretization to create a finite element the finite element model are the same as the preceding
model are the same as described in the previous example. examples. For the fluid analysis, the boundary conditions

Boundary

Boundary
Curve
(Spline)

Point Curve (Line) Node Element

(a) (b)
Fig. 6. Classes relationship: (a) graphical objects related to the model and (b) finite element objects belong to the boundary objects.

Fig. 7. Rectangular plate with a hole subjected to tensile loading: (a) Finite element model with constraints and loads, (b) fringe plot of von Mises stress
on deformed shape.
S. Phongthanapanich, P. Dechaumphai / Advances in Engineering Software 37 (2006) 797–804 803

Fig. 9. Flow in a cavity: (a) Streamline distribution plot and (b) zoom of velocity vectors of the box in (a).

Fig. 10. Mach 3 flow past NACA 0012 airfoil: (a) unstructured mesh and (b) fringe plot of density distributions.

of the velocity components and the pressure are required at ment was implemented for the ease of constructing geome-
the nodes on the flow inlet, outlet, and along the wall tries, performing analyses, and displaying solutions. The
boundary. Proper initial conditions are also needed for data structures for both the pre- and post-processors,
all the nodes in the entire flow field for the iterative analysis including the solvers were described. Four examples were
method. Fig. 9(a) shows a fringe plot of the streamline dis- used to demonstrate some functionalities and to highlight
tribution. Details of the solutions can be visualized by the performance of the software for analyzing different dis-
using the zoom feature, such as that shown by the velocity ciplinary engineering problems.
vector plot highlighted in Fig. 9(b).
The last example is the high-speed Mach 3 flow past the Acknowledgements
NACA 0012 airfoil configuration. Fig. 10(a) shows an
unstructured finite element mesh with refined elements near The authors are pleased to acknowledge the Thailand
the airfoil surface. Fig. 10(b) shows a typical solution of the Research Fund (TRF) for supporting this research work.
density distribution around the airfoil. These four examples
highlight the benefits of using the object-oriented program- References
ming to develop single software for analyzing disciplinary
engineering problems. [1] Pressman RS. Software engineering: a practitioner’s approach.
second ed. New York: McGraw-Hill; 1997.
[2] Dix A, Finlay J, Abowd GD, Beale R. Human–computer interaction.
4. Conclusion 4th ed. Essex, England: Pearson Education Limited; 2004.
[3] Dubois-Pelerin Y, Zimmermann T, Bomme P. Object-oriented finite
element programming II, a prototype program in Smalltalk. Comput
The object-oriented approach was applied for the devel- Meth Appl Mech Eng 1992;98:361–97.
opment of the graphics interface EasyFEM software. A [4] Liu JL, Lin IJ, Shih MZ, Chen RC, Hsieh MC. Object-oriented
simple idea of classes and objects classification for front- programming of adaptive finite element and finite volume methods.
end graphics interface software design and development Appl Numer Math 1996;21:439–67.
for existing console-based solver is described. The software [5] Duboispelerin Y, Pegon P. Improving modularity in object-oriented
finite element programming. Commun Numer Meth Eng 1997;13:
uses the finite element/finite volume methods for analyzing 193–8.
the solid mechanics, the heat transfer, and the fluid flows [6] Mackie RI. Object-oriented finite element programming the impor-
problems. The interactive graphics user interface environ- tance of data modelling. Adv Eng Software 1999;30:775–82.
804 S. Phongthanapanich, P. Dechaumphai / Advances in Engineering Software 37 (2006) 797–804

[7] Feng ZQ, Joli P, Seguy N. FER/Mech—a software with interactive [15] Zienkiewicz OC, Taylor RL. The finite element method. 5th
graphics for dynamic analysis of multibody system. Adv Eng ed. Butterworth-Heinemann; 2000, volume 1—the basis.
Software 2004;35:1–8. [16] Phongthanapanich S, Dechaumphai P. Evaluation of combined
[8] Akin JE, Singh M. Object-oriented Fortran 90 P-adaptive finite Delaunay triangulation and remeshing for finite element analysis of
element method. Adv Eng Software 2002;33:461–8. conductive heat transfer. Trans CSME 2004;27:319–39.
[9] Coad P, Yourdon E. Object-oriented analysis. 2nd ed. Prentice-Hall; [17] Zienkiewicz OC, Taylor RL. The finite element method. 5th
1991. ed. Butterworth-Heinemann; 2000, volume 3—fluid dynamics.
[10] Mackie RI. An object-oriented approach to fully interactive finite [18] Roe PL. Approximate Riemann solvers, parameter vectors, and
element software. Adv Eng Software 1998;29:139–49. difference schemes. J Comput Phys 1981;43:357–72.
[11] Phongthanapanich S, Dechaumphai P. Adaptive Delaunay triangu- [19] Dechaumphai P, Phongthanapanich S. High-speed compressible flow
lation with object-oriented programming for crack propagation solutions by adaptive cell-centered upwinding algorithm with mod-
analysis. Finite Elements Anal Des 2004;40:1753–71. ified H-correction entropy fix. Adv Eng Software 2003;34:533–8.
[12] Bowyer A. Computing dirichlet tessellations. Comput J [20] Phongthanapanich S, Dechaumphai P. Modified multidimensional
1981;24:162–6. dissipation scheme on unstructured meshes for high-speed compress-
[13] Watson DF. Computing the n-dimensional Delaunay tessellation with ible flow analysis. Int J Comput Fluid Dyn 2004;18:631–40.
application to Voronoi polytopes. Comput J 1981;24:167–72. [21] Ramaswamy B, Jue TC. A segregrated finite element formulation of
[14] Marchant MJ, Weatherill NP. Adaptivity techniques for compressible Navier–Stokes equations under laminar conditions. Finite Elements
inviscid flows. Comput Meth Appl Mech Eng 1993;106:83–106. Anal Des 1991;9:257–70.

Potrebbero piacerti anche