Finite Element Analysis In Heat Transfer: Basic Formulation & Linear Problems [1 ed.] 9781560323549, 9781315275109, 9781351991490, 9781351994439, 9781482252545

This introductory text presents the applications of the finite element method to the analysis of conduction and convecti

738 161 22MB

Pages [482] Year 1994

Report DMCA / Copyright

DOWNLOAD FILE

Polecaj historie

Finite Element Analysis In Heat Transfer: Basic Formulation & Linear Problems [1 ed.]
 9781560323549, 9781315275109, 9781351991490, 9781351994439, 9781482252545

Table of contents :

Preface Disclaimer 1.Discrete Physical Systems 2.Continuum Problems 3.Finite Element Discretization 4.Numerical Techniques 5.Implementaton of the Finite Element Method 6.Conduction-Type Problems 7.Convection-Type Problems References Problems Appendix A:Automatic Mesh Generation B:Mesh and Contour Plots Nomenclature Index

Citation preview

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

Series in Computational and Physical Processes in Mechanics and Thermal Sciences (Formerly the Series in Computational Methods in Mechanics and Thermal Sciences)

W. J. Minkowycz and E. M. Sparrow, Editors Anderson, Tamehill, and Pletcher, Computational Fluid Mechanics and Heat Transfer Aziz and Na, Perturbation Methods in Heat Transfer Baker, Finite Element Computational Fluid Mechanics Beck, Cole, Haji-Sheikh, andLitkouhi, Heat Conduction Using Green's Functions Chung, Editor, Numerical Modeling in Combustion Comini, Del Guidice, andNonino, Finite Element Analysis in Heat Transfer: Basic Formulation and Linear Problems Jaluria and Torrance, Computational Heat Transfer Patankar, Numerical Heat Transfer and Fluid Flow Pepper and Heinrich, The Finite Element Method: Basic Concepts and Applications Shih, Numerical Heat Transfer PROCEEDINGS Chung, Editor, Finite Elelments in Fluids: Volume 8 Haji-Sheikh, Editor, Integral Methods in Science and Engineering—90 Shih, Editor, Numerical Properties and Methodologies in Heat Transfer: Proceedings of the Second National Symposium

FORTHCOMING TITLES Pepper and Heinrich, The Finite Element Method: Advanced Concepts and Applications Pletcher, Anderson, and Tannehill, Computational Fluid Mechancis and Heat Transfer, Second Edition

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

Basic Formulation and Linear Problems

Gianni Comini, Ph.D. Stefano Del Giudice, Ph.D. Carlo Nonino, Ph.D. /stituto di Fisica Tecnica e di Tecnologie /ndustriali Universia Degli Studi di Udine, Udine, Italy

USA

Publishing Office:

Taylor & Francis 1101 Vermont Avenue, N.W., Suite 200 Washington, OC 20005-3531 Tel: (202) 289-2174 Fax: (202) 289-3665

Distribution Center:

Taylor & Francis 1900 Frost Road, Suite 101 Bristol, PA 19007-1598 Tel: (215) 785-5800 Fax: (215) 785-5515

UK

Taylor & Francis Ltd 4 John Street London WC1N 2ET, UK Tel: 071 405 2237 Fax: 071 831 2035

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER:

Basic Fonnulation and Linear Problems Copyright© 1994 Taylor & Francis. All rights reserved. Printed in the United States of America. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher. Cover design by Michelle Fleitz. A CIP catalog record for this book is available from the British Library.

Library of Congress Cataloging-in-PubHcation Data Comini, Giani. Finite element analysis in heat transfer: basic formulation and linear problems I Gianni Comini, Stefano Del Guidice, Carlo N onino. p. cm.-(Series in computational and physical processes in mechancis and thermal sciences) Includes index. 1. Heat-Transmission-Mathematics. 2. Finite element method. I. Del Giudice, Stefano. II. Nonino, Carlo. III. Title. IV. Series. TJ260.C598 1994 621.402'2-dc20 ISBN 1-56032-354-X ISBN 13: 978-1-56032-354-9 (hbk)

94-15973 CIP

To our families:

Paola and Elisa Carla, Marco, Elena, and Pietro Janet and Elena

CONTENTS

Preface Disclaimer

XV

xvii

1

D ISC R E T E PH Y SIC A L SYSTEM S

1

1.1

History of the Finite Element Method

1

1 .2

Discrete Systems

1

1.3

One-Dimensional Stationary Heat Conduction Example 1 . 1 : One-dimensional stationary heat conduction through a composite wall Example 1 .2 : One-dimensional stationary heat conduction in a homogeneous wall with distributed heat sources Thermal and Fluid Networks Example 1.3: Radiative exchange in an enclosure with black surfaces Example 1.4: Laminar fluid flow in a pipe network

4

1.4

9 12

14 14 16

1.5

Computer Implementation of Matrix Methods for Linear Networks

1 .6

Listing of Program MATRIX Example 1.5: Numerical solution of Example 1.3 Example 1.6: Numerical solution of Example 1.4

30 31

From Discrete Systems to Finite Elements

33

References

34

Problems

34

2

C O N T IN U U M PRO BLEM S

39

2 .1

Statement of Continuum Problems

39

1.7

19 21

2 .2

Governing Equations

40

2.3

Boundary and Initial Conditions

41

2.4

Global Approximations Example 2.1: Polynomial and Fourier approximation of a known mathematical function

43 44 vii

v iii

2.5

F IN IT E ELEM EN T ANALYSIS IN HEAT TRA N SFER

Example 2.2: Approximate solution of a differential equation

46

Piecewise Defined Nodal Approximations Example 2.3: Piecewise constant approximation of a known mathematical function Example 2.4: Piecewise linear approximation of a known mathematical function Example 2.5: Approximation of constant and linear functions with finite elements

47

Weighted Residual Formulations Example 2.6: Weighted residual formulation for the Poisson equation Example 2.7: Global conservation in weighted residual formulations Example 2.8: Equivalence of integral and differential formulations Example 2.9: Green’s formulae Example 2.10: Green’s formulae in weighted residual formulations 2.7 The Galerkin Weighted Residual Method Example 2.11: The Galerkin formulation for the one-dimensional Poisson equation Example 2.12: Worked-out Galerkin solution of a one-dimensional Poisson equation Example 2.13: The Galerkin formulation for the two-dimensional Poisson equation Example 2.14: The Galerkin formulation for the two-dimensional steady-state energy equation Example 2.15: Worked-out Galerkin solution of the one-dimensional steady-state energy equation Space Discretization of Unsteady Problems 2 .8 Example 2.16: Space discretization of two-dimensional transient heat conduction problems Example 2.17: Worked-out space discretization of a one-dimensional transient heat conduction problem Example 2.18: Space discretization of the two-dimensional transient energy equation Example 2.19: Element matrices for the one-dimensional transient energy equation Example 2.20: Space discretization of the two-dimensional transport equation in conservative form 2.9 Space Discretization of Axisymmetric Problems Example 2.21: Integrals over axisymmetric volumes and surfaces 2.10 Dealing with Finite Elements

2 .6

48 50 52 53 55 56 56 56 57 58 59 61 63 66

67 71 71 73 76 76 77 79 82 83

References

83

Problems

84

CONTENTS ix

3

F IN IT E ELE M EN T D ISCRETIZA TIO N

3.1

Element Shape Functions

89

3.2

One-dimensional Elements Example 3.1: Approximation of constant and linear functions with one-dimensional parabolic elements Two-Dimensional Rectangular Elements Example 3.2: Approximation of constant and linear functions with four-node two-dimensional elements

91

3.3

3.4

3.5

Mapped Elements Example 3.3: Isoparametric mapping of a two-node one-dimensional element Example 3.4: Isoparametric mapping of a four-node two-dimensional element Example 3.5: Properties of isoparametric elements Isoparametric Transformations Example 3.6: Isoparametric transformations in a two-node one-dimensional element Example 3.7: Uniqueness of mapping for a one-dimensional parabolic element Example 3.8: Isoparametric transformations in a four-node two-dimensional element Example 3.9: Isoparametric transformations in a four-node rectangular element

3.6

Isoparametric Formulation of Element Matrices and Vectors Example 3.10: Integrands in element matrices and vectors for heat transfer problems Example 3.11: Evaluation of area and side lengths in a four-node two-dimensional element Example 3.12: Calculation of area and side lengths in a four-node rectangular element 3.7 Two-Dimensional Triangular Elements Example 3.13: Analytical evaluation of element matrices and vectors 3.8 Direct Time Integration Example 3.14: Worked-out time discretization of a transient heat conduction problem 3.9 Stability, Accuracy, and Convergence Example 3.15: Assessment of stability and accuracy of finite element approximation 3.10 The Missing Tool

89

93 94 98 99 103 103 104 105 108 109 110

111 112

114 114 115 116 119 120

122

124 126 127

References

127

Problems

127

4

N U M E R IC A L T EC H N IQ U ES

131

4.1

Numerical Integration

131

x

F IN IT E ELEM EN T ANALYSIS IN HEAT TR A N SFER

Example 4.1: Numerical integration of a polynomial Example 4.2: Numerical integration of a two-variable monomial 4.2

4.3

Numerical Calculation of Element Matrices and Vectors Example 4.3: Calculation of the arc length S e Example 4.4: Calculation of the area 0 e Example 4.5: Calculation of the Cartesian derivatives of shape functions Assembly Process Example 4.6: Assembly process for the two-dimensional Poisson equation Example 4.7: Assembly process for the two-dimensional Fourier equation

134 135 137 139 140 141 143 145

4.4

Prescribed Variables Example 4.8: Introduction of boundary conditions

149 151 152

4.5

Solution of Simultaneous Linear Algebraic Equations Example 4.9: Triangularization of a non-symmetric system Example 4.10: Triangularization of a symmetric system Example 4.11: Back-substitution Example 4.12: Prescribed variables in symmetric systems Example 4.13: Recursive formulation of Gaussian elimination

154 156 157 159 159 161

4.6

Re-solution Facility Example 4.14: Re-solution of a non-symmetric system Example 4.15: Re-solution of a symmetric system Example 4.16: Matrix factorization

162 165 166 166

4.7

Improved Algorithms for Equation Solution Example 4.17: Element patterns in stiffness matrices Example 4.18: Banded storage scheme Example 4.19: Skyline storage scheme for symmetric matrices Example 4.20: Skyline factorization of a stiffness matrix

168 172 173

4.8

5 5.1 5.2

174 175

Putting the Pieces Together

176

References

177

Problems

177

IM PL E M E N T A T IO N OF TH E FIN IT E ELEM ENT METHOD

181 181 181

5.3 5.4

Program TRAN_2D Mathematical Model Main Features of the Program

185

Structure of the Computer Code

189

5.5

Vocabulary of Input Variables

197

5.6 5.7

Description of Input and Output Listing of Program TRAN_2D

201

5.8

From Finite Element Codes to Physical Problems

261

204

CONTENTS

xi

6

C O N D U C T IO N -T Y P E PRO BLEM S

263

6 .1

Scalar Field Problems of Conduction Type Example 6.1: Flow through porous media Example 6.2: Potential flow of ideal fluids Example 6.3: Fully developed laminar flow in straight ducts Example 6.4: Laminar forced convection in straight ducts

263 265 266 266 267

6 .2

Finite Element Formulation of Conduction-Type Problems Example 6.5: Analogies among finite element formulations of conduction-type problems

268

6.3

Physical Interpretation of Finite Element Formulations of Conduction-Type Problems Example 6 .6 : Lumping of the capacity matrix Example 6.7: Lumped capacity matrix for one-dimensional linear elements Example 6 .8 : Network representation of finite elements for steady-state conduction Example 6.9: Network representation of finite elements for transient conduction Example 6.10: Rates of heat conduction through internal boundaries Example 6.11: Nodal rates of heat transfer by convection

286 287

Finite Element Solutions of One-Dimensional Conduction-Type Problems Example 6 . 1 2 : Steady-state conduction in a composite wall Example 6.13: Heat generation in a nuclear fuel element Example 6.14: Transient conduction in a plane wall

288 288 291 294

6.4

6.5

Finite Element Solutions of Two-Dimensional Conduction-Type Problems Example 6.15: Two-dimensional steady-state conduction in a homogeneous wall Example 6.16: Axial velocity distribution in a rectangular duct Example 6.17: Transient conduction in cylindrical canned foods

270 272 281 284 285 286

298 298 302 308 315 316

6 .6

Visualization of Heatlines Example 6.18: Heatlines in a homogeneous wall

6.7

Stability Analyses of Time-Integration Algorithms for Transient Heat Conduction Example 6.19: Stability of finite element algorithms for one-dimensional heat conduction Example 6.20: Stability of finite element algorithms with lumped capacity for one-dimensional heat conduction Advanced Conduction-Type Problems

323 324

References

324

Problems

325

6 .8

319 321

x ii

F IN IT E ELEM EN T ANALYSIS IN HEAT T R A N SFER

7

C O N V E C T IO N -T Y P E PRO BLEM S

327

7.1

Scalar Field Problems of Convection Type Example 7.1: Laminar forced convection in the entrance region of ducts Example 7.2: Two-dimensional unsteady viscous flow Example 7.3: Vorticity transport equation

327

7.2

7.3

7.4

7.5

7.6

Boundary Conditions for Convection-Type Problems Example 7.4: Dominating characters and boundary conditions for the energy equation Example 7.5: Dimensionless boundary conditions for heat and mass transfer problems Finite Element Formulation of Convection-Type Problems Example 7.6: Analogies among finite element formulations of convection-type problems Physical Interpretation of Finite Element Formulations of Convection-Type Problems Example 7.7: Conservative and non-conservative formulations Example 7.8: Nodal rates of heat transfer by advection Example 7.9: Wiggles and remedies Finite Element Solutions of Two-Dimensional Convection-Type Problems Example 7.10: Thermally developing flow in a flat duct Example 7.11: Thermally developing flow in a circular duct Example 7.12: Transient laminar forced convection in a circular duct Example 7.13: Dispersion of a pollutant in a seepage flow Stability Analysis of Time-Integration Algorithms for Transient Convection Problems Example 7.14: Stability analysis of finite element algorithms for the one-dimensional energy equation Example 7.15: Lumped capacity algorithms for the one-dimensional energy equation Example 7.16: The mesh Peclet number controversy

329 330 331 332 335 336 337 339 341 353 353 355 359 360 365 368 372 378 380 383 384

Numerical Diffusion and Numerical Dispersion Errors Example 7.17: Diffusion and dispersion errors of finite element algorithms with consistent capacity matrices Example 7.18: Diffusion and dispersion errors of finite element algorithms with lumped capacity matrices Modeling of Heat and Fluid Flow

386

References

394

Problems

395

A P P E N D IX A: AUTO M ATIC M ESH G E N ER A T IO N

397

A.l

Program TRAN-MG

397

A. 2

Vocabulary of Input Variables

399

7.7

7.8

389 393 394

CONTENTS x iii

A.3 Description of Input and Output

401

A.4 Listing of Program TRAN_MG

402

A.5 Examples of Input Files for Mesh Generation

420

B.l

References

424

A P P E N D IX B: M ESH A N D C O N T O U R PLO TS

425

Program TRAN_PL

425

B.2 Vocabulary of Input Variables

427

B.3

Description of Input and Output

428

B.4

Listing of Program TRAN_PL

429

B.5

Example of Input Session for Program TRAN_PL

449

B .6 B.7

Program DRAW-PS

449

Listing of Program DRAW_PS

450

B .8

Example of Input Session for Program DRAW_PS

453

References

453

A P P E N D IX C: N O M E N C L A T U R E

455

IN D E X

457

PREFACE

The book is intended as an introductory text that presents the applications of the finite element method to the analysis of conduction and convection problems. Only linear problems are considered and, consequently, the fluid flow problems related to convection heat transfer are not solved but only outlined. However, all the basic instruments are provided to allow the reader to understand the finite element procedures, described in more advanced texts and in research papers, dealing with the solution of complex laminar and turbulent fluid flow problems. Throughout the text we have given details of each of the techniques employed so as to make the book self sufficient. Thus, only a basic knowledge, at undergraduate engineering level, is assumed for linear algebra, calculus and FORTRAN programming. All important new concepts are illustrated with examples and several applications of the computer code are included both in the text and in the accompanying disk. Homework problems are proposed at the end of each chapter to make the book suitable for classroom or self study. The book is divided into seven chapters and two appendices, it presents four com­ pletely documented computer programs, about one hundred examples and more than one hundred and ten end-of-chapter problems. Chapter 1 gives an introduction to the finite element method through the discussion of the basic techniques involved. The approach is partly historical and partly physical since the most fundamental concepts of the method are derived from the analysis of discrete systems, with which the reader is believed to be already familiar. A simple computer program is also presented to allow, at a very early stage, the implementation of the matrix algebra procedures that can be used directly with linear networks but can be extended easily to finite elements. Chapter 2 deals with continuum problems which must be first discretized and then solved numerically. The subject of piecewise approximation and the Galerkin weighted residuals method are introduced from basic principles in the context of twodimensional formulations. Two-dimensional formulations are then extended to threedimensional axisymmetric problems in a simple and intuitive way. Several examples are provided concerning the space discretization of one- and two-dimensional heat transfer problems. In the examples, the formulations for one-dimensional problems are worked out manually to encourage the reader to accumulate a direct experience in finite element computations. Chapter 3 deals with the fundamental techniques of finite element discretization. The element shape functions, element mapping and isoparametric transformations are presented in detail but with reference only to one-dimensional line elements and to two-dimensional quadrilateral elements, to avoid confusing the reader with too many elements th at perform the same tasks. Three-node triangular elements are also pre­ sented for the sake of completeness, since they allow algebraic integration and are used extensively in finite element applications. The direct time discretization process by means of finite difference formulae is discussed in the last two sections where the concepts of stability, accuracy and convergence are introduced at an elementary level. XV

xvi

FIN IT E ELEM EN T ANALYSIS IN HEAT T RA N SFER

Chapter 4 deals with the numerical techniques that are utilized routinely in finite element programs. The calculation of element matrices and vectors through numerical integration, the assembly of the global matrices and the solution of the resulting systems of algebraic equations are discussed in great detail. Most of the topics concerning the algorithms for the solution of systems of equations are not really necessary to develop new finite element formulations. On the other hand, the reader who is not satisfied with solution routines utilized as black-boxes, will find the explanations and the worked out examples that are necessary to reasonably master the subject of equation solving. Chapter 5 presents a computer program for the analysis of conduction-type and convection-type problems, in two-dimensional plane or three-dimensional axisymmetric geometries. The structure of the code and the subdivision of the program into subrou­ tines are shown, while complete listings and brief descriptions of each subroutine are provided. A vocabulary of input variables and a detailed description of input data and output files are also included. This way the reader can understand the main features of a finite element program but, at the same time, is spared the difficulties of writing such a program. Chapter 6 deals with conduction-type problems which are of interest to the general areas of heat and mass diffusion, potential fluid flow, laminar heat transfer and forced convection in ducts. The finite element formulation for such problems is generalized to three dimensions and a physical interpretation is provided for all the steps involved in the Galerkin, space discretization process. Stability analyses are also given for the time-integration algorithms and several examples of application of the computer code are presented. Chapter 7 deals with convection-type problems which are of interest to the gen­ eral areas of heat and mass convection and laminar and turbulent fluid flow. The flow fields are not computed but the way is paved to the understanding of more ad­ vanced, finite element procedures for the solution of the multidimensional momentum equations. Finite element formulation for convection-type problems are generalized to three dimensions and a physical interpretation is provided for all the steps involved in the Galerkin, space discretization process. Several examples of application of the com­ puter code are presented and stability analyses, together with a discussion of diffusion and dispersion errors, are provided for the time-integration algorithms utilized in the program. Finally, the two Appendices deal with preprocessing of input data, including auto­ matic mesh preparation, and postprocessing of the results, including automatic plotting of the mesh and of the contour lines. A cknow ledgm ent. We are very grateful to Professor W.J. Minkowycz and to Pro­ fessor E.M. Sparrow for suggesting the writing of this work in the first place, and for reviewing the manuscript making many valuable suggestions. We are also indebted to Professor O.C. Zienkiewicz, whose ideas paved the way to most of our work in the field of finite elements, and to Professor R.W. Lewis, whose friendship and constant support have been really treasured. Finally, we express our thanks to Miriam Gonzalez, Lisa G. Honski and Carolyn V. Ormes for their editorial assistance.

Gianni Comini Stefano Del Giudice Carlo Nonino

DISCLAIMER

Considerable time and effort have gone into the development and documentation of programs MATRIX, TRAN-2D, TRAN.M G, TRAN-PL, and DRAW_PS, which have been thoroughly tested. In using the programs, however, the user accepts and under­ stands that no warranty is expressed or implied by the developers or the distributors on the accuracy or the reliability of the programs. Users must clearly understand the basic assumptions of the programs and must verify their own results. All the programs have been developed and tested on DEC VAX/VMSa comput­ ers. However, they have also been successfully compiled on MicroSoft MS/DOSa, Intel 486DXa personal computers, using the Lahey° Fortran compiler, and on Apple Macintosh® LCIII computers, using the Absoft MacFortran IIa compiler.t

aVAX/VMS, MS/DOS, Intel, Lahey, Macintosh and MacFortran II, and all other trademarks and tradenames refer to the entities claiming the marks and the names of their products. tT he disk enclosed at the back of this volume contains a README.TXT file with further information. x v ii

CHAPTER

ONE DISCRETE PHYSICAL SYSTEMS

1.1

H ISTO RY OF T H E FIN IT E ELEM ENT M E T H O D

The basic ideas utilized in finite element procedures date back, at least, to the early 1940’s since, for example, the analysis of discrete systems, such as framed structures, by matrix methods already goes through most of the essential steps of the more general finite element method. However, it is generally agreed that the label “finite element method” first appeared in 1960 with its present meaning, in a paper on plane elasticity, to imply the direct use of a standard methodology applicable to the discretization of continuum systems . 1 In the early 1960’s the development of electronic digital computers allowed the rapid progress from “matrix methods” for the analysis of framed structures to “finite element methods” for the investigation of elasticity problems in continuum solid mechanics. However the finite element method has a wide range of non-structural engineering applications and, in 1965, finite elements were first used in the solution of a field problem . 2 Steady state problems were solved in the context of heat transfer , 2 electrical fields3 and seepage, 4 while the solution of several transient heat conduction problems and a general step-by-step process of time integration followed soon . 5 On the other hand, it was only in the early 1970’s that mathematicians began to significantly contribute to the theoretical understanding of the method by investigating various approaches to derive finite element equations from variational principles , 6 ’7 energy balances 8 and weighted residual procedures . 6 In 1974, the first Symposium on finite element methods in flow problems opened the way to an entirely new range of applications in fluid mechanics and convective heat transfer . 9 Since 1974, several international conferences, various books and a very large number of journal articles have made finite element applications to fluid and heat flow one of the most active areas of interest in the numerical solution of continuum problems. After almost thirty years of uninterrupted development, the finite element method has now reached the stage where no additional dramatic breakthrough can be expected. However, from the user’s point of view, the finite element method must be made easier to understand. Therefore, to suit the needs of most practitioners, finite elements will be presented in this book using as much physical insight and as little advanced mathematics as possible.

1.2

D ISC R E T E SYSTEM S

The first step in the numerical solution of an engineering problem is the choice of a suit­ able computational model, which provides some insight into the physical behavior of the system investigated. It has already been pointed out that many engineering problems 1

2

F IN IT E E LEM EN T ANALYSIS IN HEAT T R A N SFER

Figure

1 .1

Typical discrete systems and their physical interpretation: (a) nodes • and interconnecting elements----- ; (b) frame structure; (c) circuit of electric resis­ tors; (d) pipeline network. (Adapted from Finite Elements and Approximation by Zienkiewicz and Morgan, copyright © 1983 by John Wiley k, Sons, Inc. Reprinted by permission of John Wiley & Sons, Inc.)

can be adequately modeled using a finite number of individual components. Familiar examples of discrete systems are framed structures, such as trusses and bridges, elec­ trical circuits and pipeline networks. In the analysis of discrete systems, the individual components such as bars, electrical resistors and tubes, are identified as “elements” . These elements can be considered to be interconnected at specific points, which are called nodal points or “nodes”. A typical discrete system, where the nodes are at the end points of each element, is shown in Fig. 1 . 1 (a). Such systems might represent, for example, a plane pin-jointed framework as in Fig. 1.1(b), an electric circuit, as in Fig. 1 . 1 (c), or a network of fluid-carrying pipes, as in Fig. 1.1(d). In order to find, in the whole system, the behavior of the unknown variables (dis­ placements, electric potentials, pressures) it is often convenient to start from simple relationships, valid at element level. For example, in the analysis of the discrete sys­ tems shown in Fig. 1 . 1 , we can express the behavior of a single element by such laws as: • Hooke’s law for one-dimensional bar structures (i.i)

in which F is the applied force, A L is the length variation, R is the deflection coefficient, E is the elastic modulus of the material, A is the cross sectional area and L is the length; • Ohm’s law for electric resistors (1.2)

in which i is the current, A V is the difference of nodal potentials, R is the electric resistance, A is the cross sectional area, g is the resistivity and L is the length; • Poiseuille’s law for one-dimensional laminar flows in pipes (1.3)

D ISCRETE PHYSICAL SYSTEM S

3

in which m is the mass flow rate, Ap is the difference of nodal pressures, R is the hydraulic resistance, g is the density, D is the diameter, // is the dynamic viscosity and L is the length. Besides, in the investigation of element behaviors, we must take into account the effects, if any, of additional physical actions like, for example, distributed loads in framed structures, and sources or sinks in resistance networks. The resulting effects of these actions must be split into equivalent nodal quantities, in such a way that a consistent physical representation is obtained. It must be pointed out, however, that the knowledge of element behaviors is of little use unless all the values of nodal variables have been determined. Therefore, to solve this global problem, some principle has to be applied at each node, so as to assemble the sets of algebraic equations which allow the calculation of the complete solution. For the systems of Fig. 1 . 1 , nodal equations can be obtained from such principles as: • static equilibrium for framed structures; • Kirchhoff’s laws for electrical circuits; • mass conservation for fluid networks. Once the resulting set of equations has been assembled, on a node by node basis, the boundary conditions must be inserted to obtain a unique solution. This solution will allow both the evaluation of the unknown nodal variables and the calculation of the unknown boundary quantities where nodal variables have been specified as boundary conditions. For example, with reference to Fig. 1 . 1 , we would solve first for the unknown nodal values of displacements, electric potentials and pressures, and we would find, afterwards, the unknown values of support reactions, currents and flow rates at the nodes where boundary conditions have been imposed. If linear behaviors in the elements are assumed, as in Eqs. ( 1 . 1 ) to (1.3), also the governing equations for the entire system will form a linear set which, usually, can be written as 1 0 - 1 2

(1.4)

In matrix form, Eqs. (1.4) can be expressed as (1.5) by defining the matrix

(1.6)

and the vectors (1.7) ( 1.8 )

4

F IN IT E E LEM EN T ANALYSIS IN HEAT T RA N SFER

r = [ri, r2, ••• rn]T

(1.9)

in which the superscript T indicates the transpose of the corresponding one-row matrix. In structural engineering, the computational procedure outlined in this section is known as the matrix method of structural analysis . 11,12 Accordingly, the matrix K is known as the stiffness matrix, is the vector of nodal displacements, s is the vector of internal nodal forces and r is the vector of external forces which correspond to reactions pertaining, typically, to support points. The construction of the general system (1.4) will be illustrated, in the next section, with reference to a simple heat conduction problem.

1.3

O N E -D IM E N S IO N A L STA T IO N A R Y H E A T C O N D U C T IO N

Consider the homogeneous plane layer of Fig. 1 .2 (a), through which heat is flowing in a direction normal to the external surface. For steady state conduction, with a uniform energy generation per unit volume q, the appropriate form of energy balance for the layer e is

qei+ qe2= (qV)e

(i.io)

in which V is the volume of the layer and the rates of heat transfer q\ and q\ are taken as positive when leaving the layer. In fact, according to Eq. (1.10), the rates at which energy leaves the layer through the external surfaces must be equal to the rate at which energy is generated within the layer. In Fig. 1.2(b) we schematize the layer as an “element” whose “nodes” are the boundary surfaces 1 and 2 . Thus, with reference to Fig. 1 .2 (c), we can write immediately the relationship between the nodal temperatures t\ and t\ and the rates of heat transfer leaving the element e at the nodes 1 and 2 (i.ii)

Figure

1 .2

One-dimensional heat conduction in a homogeneous layer e: (a) heat transfer rates leaving the layer at surfaces 1 and 2 because of internal heat generation qV within the volume V; (b) element of conductance (kA /L )e corresponding to homogeneous layer e; (c) schematic representation of nodal heat transfer rates q\ and q\ resulting from rates of internal heat generation s\ and s\ and from internal conduction fluxes.

D ISC R E TE PHYSICAL SYSTEM S

Figure 1.3

5

Stationary, one-dimensional heat conduction through a composite wall: (a) the m layers of homogeneous materials corresponding to the m elements; (b) the

local node numbering scheme yielding 1 at the left and 2 at the right end of any element e; (c) the global node numbering sequence increasing regularly from 1 to n; (d) correspondence between local ( 1 , 2 ) and global (i,j) node numbers in a typical element e.

( 1 .12) In Eqs. (1.11) and (1.12) R e is the thermal resistance of the layer, k is the thermal conductivity, A is the area normal to the direction of heat transfer, L is the thickness of the layer, and the obvious assumption (1.13) can be made to express the nodal loads resulting from internal heat generation. There­ fore, Eqs. (1.11) and (1.12) simply indicate that the rate of heat transfer leaving the element, at any node, is equal to the sum of the rate of internal heat conduction to the node and of the rate of internal heat generation pertaining to the node. Obviously, in the absence of internal heat generation, Eqs. (1.11) and (1.12) reduce to the same form of Eqs. ( 1 . 1 ) to (1.3). Let’s now assume that the global system is the composite wall, shown in Fig. 1.3(a), through which heat is flowing normally to the m layers of different materials. The problem splits into a series of simpler ones if we consider each layer as an element e whose characteristics can be determined by the basic equations (1.11) to (1.13). Thus, with reference to Fig. 1.3(b), the local subscripts 1 and 2 are used to indicate the first and the second end of any element, numbered from left to right, independently of where the element is situated in the composite wall. For a complete solution we have to consider all the nodes and all the elements and a global numbering scheme is thus needed. In principle, many different schemes might be utilized and, as will be shown later, they would lead to sets of algebraic equations with different distributions of non-zero coefficients. With the present configuration of layers, the coefficients are clustered around the main diagonal if we use node and element numbers which increase sequentially, as shown in Fig. 1 .3 (c). W ith reference to the correspondence illustrated in Fig. 1.3(d), between local (1,2) and global (i,j) node numbers in a typical element e, Eqs. (1.11) and (1.12) can also be written as (1.14)

6

F IN IT E ELEM EN T ANALYSIS IN HEAT T R A N SFER

(1.15) More concisely, both Eqs. (1.11) and (1.12) and Eqs. (1.14) and (1.15) can be written in m atrix form as q e = —K et e + se (1.16) where the matrix (1.17)

is analogous to the element stiffness matrix of structural problems and, therefore, can be called the “element conductance m atrix”, while (1.18)

is analogous to the vector of nodal forces which, in structural problems, arise from internal loads and, therefore, can be called the element internal heat generation vec­ tor. Inspection of Eqs. (1.17) and (1.18) reveals immediately that the same computer routines can be used to evaluate the matrix K e and the vector se for all elements e = 1 , m. In Eq. (1.16), the element vectors of temperature t e and of nodal heat transfer rates q e are defined as (1.19)

(1.20) in terms of local (1,2) and global (z, j) node numbers, respectively. Actually, because of the correspondences between 1 and i and between 2 and j , it might be possible to recast Eq. (1.16) into an equivalent expanded form, in which the matrix K e has dimensions n x n and the vectors have dimension n. If i and j are consecutive node numbers we have

( 1 .2 1 )

where the only non-zero entries are on the z-th and j -th rows and on the 2 -th and j -th columns, since no new information is added to Eq. (1.16). On the other hand, when we have computed K e and se on a local basis, it is very helpful to refer to Eq. (1.21) in order to visualize the behavior of the element e in the global system. Besides, as will be shown later, the element equations ( 1 .2 1 ) can be employed directly in the construction of the global system of n algebraic equations, for the n nodal variables. Obviously, in

D ISC R E TE PHYSICAL SYSTEMS

7

Eq. ( 1 .2 1 ) there will be spaces left between the i and j entries if i and j happen to be non-consecutive in the numbering scheme utilized. In order to list a single set of nodal temperatures for the whole system, we must impose first that the nodal variable at each node i has the same value for all the elements sharing that node. This requirement is called “compatibility” and in the present case, with reference to the global numbering scheme, is expressed as n =u

(i.22)

for any element e = l,m and for any node i = 1 , n. Compatibility of temperatures allows us to drop the superscript e when global node numbers are used and, as a consequence, the vector of unknown nodal variables can be listed as t = [(x) of the function (j>(x) as a linear combination of n known independent functions Pi(x) and n parameters (2.14) The coefficients at are the generalized parameters of the approximation which must be determined from the information available on (x). The parameters a, do not have, necessarily, a direct physical meaning, unless they are the values of the function {x) at n representative points called nodes. In such a case, which is typical of finite element approximations, the functions Pi(x) are interpolating functions. If the parameters a, are nodal values of the function (x), Eq. (2.14) is called a nodal approximation. Otherwise, as happens in Examples 2 . 1 and 2 .2 , Eq. (2.14) is said to represent a nonnodal approximation. The approximating functions Pi(x) in Eq. (2.14) are often grouped into a one-row m atrix 7 (2.15) and, similarly, the coefficients at are considered a vector of generalized parameters (2.16) where the superscript T indicates the transpose of the one-row matrix. Therefore, in matrix notation, Eq. (2.14) can be expressed as (2.17) introducing a most convenient representation which will be utilized repeatedly. A reasonable expectation is that an improvement in the approximation (j){x) occurs with an increase in the number n of approximating functions and parameters. On the other hand, the cost of obtaining an approximation certainly increases with n. Thus it usually pays to invest time and efforts into a preliminary search for approximating functions which lead to good estimates (x) with as few parameters at- as possible. In this section we will show that non-nodal approximations are appropriate only if the function • Thus, if (j) is unknown and the only information we have is that is the solution of a differential equation, nodal approximations are to be preferred, as will be shown in the next section. In engineering practice, many different functions such as polynomials, sines and cosines are often used in the synthesis of non-nodal approximations. The most often encountered functions Pi(x) are monomials (2.18) but sines (2.19) and cosines (2.20)

are also a common choice. In the first example of application the function or in its derivatives may occur. Indeed, some degree of discontinuity is permissible and it will be taken into account in finite element formulations. A general procedure for the construction of shape functions will be proposed in the next chapter. Here, in the examples of ap­ plications, we will illustrate only the fundamental principles involved in finite element discretizations. E xam ple 2.3: P iecew ise constant approxim ation of a known m athem atical function Assume that the dimensionless temperature distribution t(x) is expressed by the func­ tion of the dimensionless coordinate x

in the interval (0,1). Under the condition of obtaining exact nodal values, approximate it by means of three equally spaced, piecewise constant elements. Solution. With reference to Fig. 2.5, the domain is divided into three, equally spaced, elements, and the mid points of the elements are identified as nodes. The function t(x) is known and so are the nodal values ti = 35/36, t 2 = 3/4 and t 3 = 11/36. Since the elements have only one node, there is only one element shape function N f for

CON TINUUM PROBLEM S

49

each element e. Within each element the temperature is approximated by a piecewise constant function

in which the local shape function is defined as

The nodes and the elements are numbered following an orderly sequence which, in this case, goes from left to right, in the positive direction of the coordinate x. The global shape function, associated with node i, corresponds to the function N{ of the approximation (2.21). According to Eqs. (2.23) and (2.24), N{ has a value of unity at node i and a value of zero at any other node j ^ i and, consequently, is zero-valued over the whole domain, except within the elements connected to node i. In the particular case of one node per element, the simplest manner in which the global shape function Ni can be obtained for each node i is by assuming, within each element,

This way, we obtain immediately

Figure 2.5

Approximation of the function t(x) = 1 - x 2 by means of three equally spaced, piecewise constant elements: (a) the function t(x) and its approximation i(z); (b) element shape function N f; (c) global shape functions N{.

50

F IN IT E ELEM EN T ANALYSIS IN HEAT T RA N SFER

since elements do not share nodes. Therefore, N\ coincides with JVj in element 1 and is zero elsewhere, while N 2 and N% coincide, respectively, with N 2 and N \ in elements 2 and and 3 but are zero elsewhere. Besides, TVi, N 2 and N 3 have a value of 1 respectively at nodes 1 , 2 and 3, and a value of zero at the other nodes. As a consequence, the approximation t can be written as

according to the general expansion (2 .2 1 ). From the above expressions it follows that the approximation t(x) does not have inter-element continuity. It must be pointed out that this is not the usual situation, even if piecewise constant elements have found some application in special problems. Therefore, in this book we always require that the approximating functions achieve “compatibility”, i.e., continuity of the approximation on the common boundaries be­ tween adjacent elements. E x am p le 2.4: P iecew ise lin ear a p p ro x im a tio n of a know n m a th e m a tic a l fu n c tio n Assume the dimensionless temperature distribution as in Example 2.3 and, under the condition of obtaining exact nodal values, approximate it by means of three equally spaced piecewise linear elements. S o lu tio n . W ith reference to Fig. 2.6, the domain is divided into three equal elements and the connection points of elements are the numbered nodes. The values of tem per­ ature at the nodes are t\ = 1 , t 2 = 8/9, £3 = 5/9 and t 4 = 0. Within each element the tem perature is expressed as

Figure 2.6

Approximation of the function t(x) = 1 - x 2 by means of three equally spaced, piecewise linear elements: (a) the function t(x) and its approximation i(x); (b) element shape functions N f and iV|; (c) global shape functions N{ (adapted from Reference 10 by permission).

CO N TINUUM PROBLEM S

51

in which N { and TVf are linear interpolating functions defined locally as

where (x\ — x\) is the length L e of the element. Again an orderly numbering sequence, from left to right according to the increasing x coordinate, is followed, both for local and global node numbers. In this example, it is possible and convenient to obtain the global shape function N{ for each node i by assuming

and

in the two contiguous elements e — 1 and e sharing node i. This way we Jiave

in element 1 ,

in element 2 , and

in element 3, while, obviously, it is

According to this construction process, N\ coincides with 7VJ in element 1 while it is zero elsewhere; N 2 coincides with AT] in element 1 and with N f in element 2 while it is zero elsewhere; N 3 coincides with N$ in element 2 and with iV-f in element 3 while it is zero elsewhere; N 4 coincides with in element 3 while it is zero elsewhere. Thus the global shape function N{ has a value of 1 at node i and a value of 0 at all other nodes. A s a ronsftniipnrp. on rp acra.in. t.hp final pvnrpssirvn nf t.Vip A.nnrnvimAt.ion

has the same form as the general equation (2 .2 1 ) and satisfies all the basic criteria (2.22) to (2.24). An improvement of approximation does obviously occur with an increase in the number of elements. However, by comparing Figs. 2.5 and 2.6 we can see that, with the same number of elements used in Example 2.3, we have now produced a better approximation. Therefore, we can also improve the accuracy of an approximation, for a given degree of subdivision of the domain, by utilizing more complex approximating functions. On the other hand, this way we increase the number of nodes, and thus a compromise will have always to be pursued between accuracy of the approximation and increase in the number of nodes.

52

F IN IT E ELEM EN T ANALYSIS IN HEAT T R A N SFER

E x a m p le 2.5: A p p ro x im a tio n of co n sta n t an d lin e a r fu n c tio n s w ith fin ite elem e n ts Show that both the piecewise constant and the piecewise linear elements introduced in previous examples can represent exactly a constant function. Also show that the piecewise linear elements can represent exactly a linear function. S o lu tio n . On each element, the global shape functions are taken to coincide with the local element functions N?. Thus, for the piecewise constant elements we have from Example 2.3

for each element e = Example 2.4

1 , m.

Similarly, for the piecewise linear elements we have, from

for each element e = 1 , m. Therefore, a constant value of always results in the same constant value of

specified at all nodes,

In Chapter 3 it will be shown that the exact representation of constant values is a general property of all the shape functions which are utilized in finite element analyses. For the piecewise linear elements, we obtain from the definition of shape functions given in Example 2.4

for each element e = a linear function

1 , m.

Therefore the piecewise linear elements can represent exactly

since

In Chapter 3 it will be shown that the exact representation of linear functions is a property of the shape functions which are commonly utilized in finite element analyses.

CO N TINUUM PROBLEM S

2.6

53

W E IG H T E D R E SID U A L FO RM ULATIO NS

In finite element analyses we do not know the function , even if we have some infor­ mation on it. The usual information is that satisfies the governing partial differential equation and the prescribed boundary conditions. Consequently, the approximation techniques discussed in the previous section must be considered as discretization pro­ cedures that allow us to express the approximation ^ by a linear combination of known shape functions N{ and unknown nodal values fa. In fact, the nodal values fa must be determined after the discretization process, by imposing that the approximation (j) satisfies, in an average sense, the governing differential equation. A partial differential equation, governing a physical phenomenon in the domain H, can always be cast in the general form 1 (2.26) where is the solution, L is a differential operator and g is a known function. Because of the discretization errors involved in its construction, the function (j) will not be able, in general, to satisfy Eq (2.26) on a point by point basis. Hence, some local error does result which usually yields residuals (2.27) at any point of the domain. On the other hand, Eq. (2.27) can be utilized as a measure of the goodness of fit between and are a known property and the unknown potential which appears in Eq. (2.1), respectively. Thus, from Eq. (2.35) we obtain (2.37) W ith reference to the well known property of derivatives (2.38) we have from Eq. (2.37)

(2.39)

that is, Eq. (2.30). In one dimension, Eq. (2.39) yields the formula of integration by parts

(2.40)

In two dimensions, with reference to a system of Cartesian coordinates, Eq. (2.39) leads to Green’s formula

in which nx, ny are the direction cosines of the outward normal n defined in Eq. (2.13). E x a m p le

2 .1 0

: G re e n ’s fo rm u lae in w eighted re sid u a l fo rm u la tio n s

Apply the weighted residual formulation to the one-dimensional heat conduction equa­ tion

58

F IN IT E ELEM EN T ANALYSIS IN HEAT T R A N SFER

defined in the interval 0 < x < L, performing integration by parts on the resulting integral equations. Solution. We consider first the integral equations

with i =

1 , n.

From Green’s formula (2.40) we have

With reference to an approximation t such that t = t for 0 < x < Z, by substituting we obtain the alternative weak formulation

with i — l,n . On Sq boundaries we have q" = q" and, therefore, we can introduce, in a natural way, boundary conditions of the second and third kind. On St boundaries, where temperatures are prescribed, we can calculate the unknown values of external fluxes which balance the internal distribution of temperatures.

2.7

T H E G A L ER K IN W E IG H T E D R E SID U A L M ETH O D

Because of the broad choice of weighting functions that we can use in weighted residual methods, we have a variety of weighted residual techniques . 3 On the other hand, the error distribution principle, known as the Galerkin method, is the most often used to derive finite element equations. According to the Galerkin method, the weighting functions W{ are chosen to be the same as the approximating functions Ni used to represent the solution (2.42) Therefore, if the unknown function (j) is approximated by the expansion (2.25) (2.43) the Galerkin method requires that n integral forms, derived from Eq. (2.29), are set equal to zero (2.44) with i = 1, n. Expressions (2.44) can be interpreted as a set of n simultaneous equations which allow, in principle, the solution for n values of fc. This choice presents several computational advantages. First of all, we avoid ma­ nipulating two different sets of functions for approximating and for weighting the local errors e. Another advantage, resulting from Examples 2.5 and 2.7, is that the general property of shape functions (2.45)

CO N TINUUM PROBLEM S

59

yields conservative finite element formulations. Besides, the narrow base of definition of functions iV*, which are zero in all elements not sharing i, simplifies the evaluation of integrals in Eq. (2.29). Finally, as will be shown later, the Galerkin method leads to symmetric matrices in most of the systems of algebraic equations which result from Eqs. (2.44). To illustrate the Galerkin method, with reference to the finite element analysis of stationary thermal problems, let us consider five specific examples, described in terms of one- and two-dimensional Cartesian coordinates. E x a m p le 2.11: T h e G a le rk in fo rm u latio n for th e o n e-d im en sio n al P oisson e q u a tio n Apply the Galerkin formulation to the one-dimensional heat conduction equation

defined in the interval 0 < x < L, using three equally spaced piecewise linear elements. Assume adiabatic boundary conditions at x = 0

and prescribed tem perature boundary conditions at x = L

S o lu tio n . As in Example 2.4, expansion

can still be used with reference to shape functions

which are known, and to nodal parameters

which are unknown, except for t 4 = ti. We have thus

Assuming W{ = N{ with i = 1,4 and substituting in the weak formulation of Exam­ ple 2 . 1 0 , we obtain

60

FIN IT E ELEM EN T ANALYSIS IN HEAT TR A N SFER

Obviously, in these equations the boundary term can be different from zero only for boundary nodes i which have N{ = 1 ^ 0. On the other hand, the boundary condition at x = 0 will make

at node 1 while, at node 4, we can define

where r 4 is the unknown boundary flux which corresponds to the temperature distri­ bution in the domain. The system of n = 4 integral equations can be written in m atrix form as

in which

and, in this case, r t- are the boundary fluxes, different from zero only at node 4 on the St boundary where temperature is prescribed and the flux is unknown. Because of the summation rule (2.34), we can compute the above integrals on an element by element basis

and

The contributions made to the global matrix K by any element matrix K e are allocated as shown in Fig. 1.5. For an element spanning between node z, associated to local node 1 , and node j , associated to local node 2 , we have

Similarly, contributions made to the global vector s by any element vector se are allocated according to the rule

CO N TINUUM PROBLEM S

61

W ith the assumption of equally spaced, piecewise linear elements, we have locally, from Example 2.4

and

for e = 1,3. Thus the entries in element matrices and vectors are computed from the formulae

for e = 1,3. E x a m p le e q u a tio n

2 .1 2

: W orked o u t G a le rk in so lu tio n of a o n e-d im en sio n al P oisson

W ith reference to the dimensionless equation

defined in the dimensionless domain 0 < x < 1 and to the boundary conditions d t/d x \x - 0 = 0 and t(l) = 0, specialize the Galerkin formulation of Example 2 . 1 1 and compare the results obtained with the exact solution

S o lu tio n . The above dimensionless equations can be obtained from the Poisson equa­ tion in Example 2.11 by assuming k = 1 , q = 2 and L = 1. Thus we have

62

F IN IT E ELEM EN T ANALYSIS IN HEAT TR A N SFER

for all the elements e = 1,3. With reference to the assembly rules we obtain

This system of algebraic equations can be solved after introducing the boundary con­ dition t 4 = 0

to yield the solution

which is coincident with the exact solution at the nodes. The solution obtained is compared in Fig. 2.8 with the exact solution. From the last equation of the system we have

which yields

It can be easily verified that

and thus it can be inferred that the energy balance is satisfied since at x = an adiabatic boundary condition while at x = 1 we have r 4 = 2 .

0

we have

C O N TINUUM PROBLEM S

Figure

2 .8

63

Exact (------) and approximate (-------) solutions for the Galerkin formulation of Example 2.12.

E x a m p le 2.13: T h e G a le rk in fo rm u latio n for th e tw o -d im en sio n al P oisson eq u a tio n Apply the Galerkin formulation to the two-dimensional, steady state heat conduction equation (2.4), subjected to boundary conditions (2.8), (2.10) and (2.11). S o lu tio n . We consider first the integral equations (2.46) with i = l,n . Using Green’s theorem, we can write the first terms in Eq. (2.46) as

(2.47)

Then, substituting Eq. (2.47) into Eq. (2.46) and taking into account the tem perature approximation (2.48) we obtain the weak form (2.49) with i = l,n . The boundary integral in Eq. (2.49) can be written as (2.50)

64

F IN IT E ELEM EN T ANALYSIS IN HEAT T R A N SFER

in which integrals on Sq = Sqp + Sqc are evaluated from boundary conditions (2 .9 ) to (2.12) related to q". Instead, on the portion of the boundary 5*, where t is specified, these integrals are related to unknown nodal values of the heat transfer rate. It should be noted, however, that at nodes where the value of t is specified as t = tp, there is no unknown associated with the point and, consequently, no equation is needed for the tem perature solution. On the other hand, an equation may still be formed at a node on St boundaries just to compute the integral of the unknown heat flux q". Substituting Eq. (2.50) into Eq. (2.49) we obtain the final weak form

(2.51)

This weak form admits discontinuous conductivity coefficients k and approximate tem ­ perature solutions with discontinuous first derivatives. Thus the derivatives d t/d x and d t/d y can be expressed as (2.52)

(2.53)

Substituting these expansions for £, d t/d x and d t/d y into Eq. (2.51), we obtain

(2.54)

with i = 1 , n. Expression (2.54) represents a system of n equations, in which equations corresponding to nodal points on St, where temperature is prescribed, are not needed for the tem perature solution, but may still be used to evaluate unknown nodal rates of heat transfer (r*)t-, that is, the unknown nodal reactions . 12 From now on, these unknown nodal rates of heat transfer will be denoted with the symbol X{. Thus, with reference to Eq. (2.54), we have (2.55) on St, in addition to the obvious definitions (2.56) on S qp and (2.57)

CON TINUUM PROBLEM S

65

on S qc. Therefore, the n equations (2.54) can be written in matrix form as (2.58) in which the following definitions are used (2.59)

(2.60) and (2.61)

It must be pointed out that in Eq. (2.61) we need not write (r*)t-, or xt, on St boundaries in the explicit form since X{ is an unknown quantity which is never input as an applied load . 12 For practical purposes, the global conductance m atrix K , the vector of internal rates of heat generation s and the vector of prescribed boundary rates of heat transfer p are not directly constructed according to Eqs. (2.59) to (2.61). Instead, advantage is taken of the property (2.34) of integrals to account for the contribution of each element separately, according to the global expressions (2.62)

(2.63)

(2.64) where summations cover contributions of all elements connected with node i and where surface integrals refer only to elements with boundaries on the external surface of ft. The resulting conductance matrix K is symmetric, since Kij = K ji, and it is also banded, since only elements connected with node i will contribute to the summations. The bandwidth will thus be related to the largest difference among node numbers in any element. Finally, it must be pointed out that the term (rc)t, defined by Eq. (2.57), is usu­ ally computed with reference to the convective boundary condition (2 . 1 1 ) and to the expansion (2.48). Substituting Eq. (2.11) into Eq. (2.57) we obtain

for the i-th node. Thus, in m atrix form, we have (2.66)

66

FIN IT E ELEM EN T ANALYSIS IN HEAT T R A N SFER

where B and b are, respectively, the homogeneous and nonhomogeneous contributions arising from convection boundary conditions. 13 From Eqs. (2.65) and (2.66) and from the property of integrals (2.34), we can express the entries in B and b as (2.67) and (2.68)

where summations cover element contributions. Therefore, the system of equations (2.58) can be recast in the most convenient general form (2.69) which will be referred to over and over again in the finite element formulation of thermal and fluid flow problems. In Eqs. (2.69) the stiffness matrix H is defined as the sum of all homogeneous contributions (2.70) which, in this case, are due to conduction and to boundary convection, the load vector f is defined as the sum of all known nonhomogeneous contributions (2.71) and the vector (2.72) contains the unknown nonhomogeneous contributions. E x a m p le 2.14: T h e G a le rk in fo rm u latio n for th e tw o-dim ensional s te a d y -s ta te en e rg y eq u a tio n Apply the Galerkin formulation to the two-dimensional, steady state energy equation (2 .6 ), subjected to boundary conditions (2 .8 ) on the part St of the boundary and to boundary conditions (2 . 1 0 ) on the remaining part Sq = Sqp of the boundary. S o lu tio n . Equation (2.6) differs only in the advective terms from the steady-state heat conduction equation without internal heat generation. Starting from the integral equation

following the same procedure illustrated in Example 2.13 and taking into account the boundary conditions (2 .8 ) and (2 . 1 0 ), we obtain the weak form

(2.74)

CO N TINUUM PROBLEM S

67

with i = l , 7i. The resulting n algebraic equations can be written in standard matrix form (2.69)

by assuming (2.75) and (2.76) while the entries in the advection matrix A are expressed as

and K, p and x are still defined, respectively, by Eqs. (2.59), (2.56) and (2.72). Here, a point of interest concerns the m atrix H which is now non-symmetric. In fact the matrix K , corresponding to heat conduction, yields symmetric contributions while the matrix A, corresponding to advection, yields non-symmetric contributions. Thus the m atrix H , defined by Eq. (2.75), and the resulting system of equations (2.69) are non-symmetric. E x a m p le 2.15: W o rk ed -o u t G a le rk in so lu tio n of th e o n e-d im en sio n al s te a d y -s ta te e n e rg y eq u a tio n From Example 2.14, derive the Galerkin formulation for the one-dimensional energy equation

defined in the interval 0 < x < L, using three equally spaced piecewise linear elements. Assume prescribed tem perature boundary conditions at x = 0

and at x = L

Then, with reference to the dimensionless equation

defined in the dimensionless domain 0 < x < 1 , specialize the Galerkin formulation by assuming

and

Compare the results obtained with the exact solution

68

F IN IT E ELEM EN T ANALYSIS IN HEAT T R A N SFER

S o lu tio n . With reference to the assumed boundary conditions, in one dimension we obtain immediately from Eq. (2.74)

for i = 1,4. Substituting for t the usual expansion

and following the same pattern of Example 2.11, we obtain a system of four algebraic equations which can be written in matrix form as

In the above equations K is the usual conductance matrix of Example 2.11, A is the advection matrix whose elements are

and the unknown conduction fluxes x, at the boundaries, are different from zero only at nodes 1 and 4 where temperatures are prescribed

Both K and A can be computed on an element by element basis. The entries in the element conductance matrices K e are still computed as in Example 2.11, while the entries in the advection matrix are computed as

As in Example 2 . 1 1 , because of the assumption of three equally spaced linear elements we have

and

CO N TINUUM PROBLEM S

69

for e = 1,3. Thus we obtain

for e = 1 ,3. As in Example 2.12, specializing the formulation for k = 1 , gcu = we obtain

1

and L = 1,

while we have

W ith reference to the usual assembly rules, we arrive at the final expression for the non-symmetric system of algebraic equations

This system can be solved for the unknown values of temperatures after introducing the boundary conditions ti — 0 and t 4 = 1

TO

F IN IT E ELEM EN T ANALYSIS IN HEAT T R A N SFER

to yield the solution

The exact solution is

Finally, the unknown conduction fluxes at the boundaries can be computed from the first and the last equations

which yield, respectively

and

i.e., a conduction flux leaving the domain at node 1 and a conduction flux entering the domain at node 4. It is worth noting that the two conduction fluxes are different because they do not represent the global heat fluxes leaving and entering the domain. By taking into account also the advection contributions we have in fact at node 1

and at node 4

Therefore we have a global, conduction/advection flux leaving the domain at node 1 , equal to the global, conduction/advection flux entering the domain at node 4.

C ON TINUUM PROBLEM S

2 .8

71

S PA C E D IS C R E T IZ A T IO N O F U N S T E A D Y P R O B L E M S

In Sections 2.6 and 2.7 we assumed that steady state conditions exist. However, many engineering problems are unsteady and the effects of time have to be considered. Clas­ sical examples include the Fourier equation (2.5), the transient energy equation (2.7) and the general transport equation written in the forms (2 . 1 ) and (2.2). Problems of this type are called initial value problems because the state of the system depends both on initial and on boundary conditions. The most common approach to finite element solutions of transient problems is to assume that shape functions depend, as usual, on space coordinates, while nodal values can be functions of tim e .3 Thus expansions (2.40) and (2.44) can be written as (2.78) in which we have, for example (2.79) in one-dimensional problems, and (2.80) in two-dimensional problems, while nodal values (2.81) are time-dependent. By using expansion (2.78) and following the procedures illustrated in Section 2.7, we can derive the finite element equations. Clearly, the derivatives of nodal values ^ (tf) with respect to time (2.82) and (2.83) will remain in the resulting matrix equation which, therefore, can be considered to be only partially discretized. The result of this process of partial discretization will be a system of n ordinary differential equations, allowing the solution for the n time variables 14 (2.117)

80

F IN IT E ELEM EN T ANALYSIS IN HEAT T R A N SFER

Figure 2.9

Modeling of a three-dimensional axisymmetric problem using cylindrical coor­ dinates (r, z).

where i' and k' = k are the unit vectors of the radial and the axial directions, respec­ tively. In a similar way, for the divergence of a vector q, we obtain 13 (2.118) where the indices r and z denote vector components in the directions of i' and k'. If we define the vector q as (2.119) from Eqs. (2.117) and (2.118) we obtain immediately the general expression of the term V • q in cylindrical coordinates (2.120)

Similarly, from the identity (2 .121)

and from Eqs. (2.117) and (2.118), we can arrive at the general expression in cylin­ drical coordinates of the term which contains the velocity. In fact, with reference to Eq. (2.117) we have (2.122)

while from Eq. (2.118) we have (2.123) Therefore, from Eqs. (2.121) to (2.123) it follows that the term /? V • (v ) can be represented in cylindrical coordinates as (2.124)

CO N TINUUM PROBLEM S

81

Consequently, in cylindrical coordinates, the general transport equation (2.1) can be written in the conservative form

(2.125)

This result allows us to generalize the finite element formulation of two-dimensional transport problems in a way that covers three-dimensional, axisymmetric situations. This generalization is achieved by writing the general transport equations (2.125) and the boundary conditions (2.103) and (2.104) in the equivalent forms

(2.126)

(2.127) and (2.128) where both the left and the right hand sides have been multiplied by r and the partial derivative of r vr with respect to r has been written in the usual expanded form. This way, Eqs. (2.126) to (2.128) have been recast in the same form as the corresponding equations (2.101), (2.103) and (2.104) written for two-dimensional Cartesian prob­ lems. Therefore it is apparent that the equations for three-dimensional axisymmetric problems can be obtained from the equations for two-dimensional Cartesian problems simply by replacing 7 , /?, T, £, q” and h with 7 r, (3r, T r, s r, q”r and hr. Similarly, the finite element formulation of three-dimensional axisymmetric problems can be ob­ tained immediately from the corresponding formulation of two-dimensional Cartesian problems by writing down directly the matrices and vectors with the new values of the properties. For example, with reference to the most general conservative form (2.126) of the transport equation and to the boundary conditions (2.102), (2.127) and (2.128), we obtain immediately from Example 2.20 (2.129)

(2.130)

(2.131)

82

F IN IT E ELEM EN T ANALYSIS IN HEAT T R A N SFER

(2.132)

(2.133)

(2.134)

(2.135)

(2.136) and (2.137) With i , j = l ,n these definitions can be utilized to yield the space discretized finite element representation of the conservative transport equation (2.126), in the usual form (2.114)

where the matrix K is still defined by Eq. (2.115)

and the vector s is still defined by Eq. (2.98)

Expressions (2.129) to (2.137) have been derived by inspection, according to a formal approach. On the other hand the choice of r as a multiplying factor implies that the analysis is limited to a unit radian of the three-dimensional domain as it will be illustrated in Example 2.21. E x am p le

2 .2 1

: In te g ra ls over a x isy m m etric volum es an d surfaces

Give a three-dimensional interpretation of the integrals appearing in Eqs. (2.129) to (2.137). S o lu tio n . The integrals over the two-dimensional domain ft and over the one­ dimensional boundary 5, referred to in Eqs. (2.129) to (2.137), can be interpreted

CO N TINUUM PROBLEM S

83

as corresponding to integrals over the axisymmetric, three-dimensional volume ft' and over the axisymmetric, two-dimensional boundary surface S'. We have in fact for a unit radian (2.138) and (2.139) and, consequently, for any functions F and / we can write (2.140) and (2.141) Thus the formulation (2.129) to (2.137) could have been obtained from Eqs. (2.1), (2.103) and (2.104) by referring to a unit radian and by integrating over the volume ft' and the boundary surfaces S'. This interpretation will be exploited in Chapter 5 to evaluate element matrices and vectors for three-dimensional axisymmetric problems.

2.10

D E A L IN G W IT H FIN IT E ELEM ENTS

In the previous sections we have introduced, from basic principles, the subject of piecewise approximation and the Galerkin weighted residual method. Then, we have illus­ trated the space discretization of continuum problems through simple one-dimensional examples. However, one-dimensional problems worked out manually can only encour­ age the reader to accumulate a direct experience in finite element computations. Prac­ tical problems involving complex geometries require the introduction of special multidi­ mensional elements to achieve an accurate space discretization. Furthermore, practical problems are often time-dependent and the time variable must also be dealt with in a proper way. In the next chapter we will address all these topics, illustrating the fundamental techniques which are routinely used in the finite element discretization of engineering problems. REFERENCES 1. O.C. Zienkiewicz and K. Morgan, Finite Elements and Approximation , Wiley, New York, 1983. 2. O.C. Zienkiewicz and R.L. Taylor, The Finite Element Method, Fourth Edition, Volume 1 , McGraw-Hill, London, 1989. 3. K.H. Huebner and E.A. Thornton, The Finite Element Method for Engineers, 2nd ed., Wiley, New York, 1982. 4. G. Comini and S. Del Giudice, “Parabolic Systems: Finite Element Method”, Chap. 4, in Handbook of Numerical Heat Transfer, W.J. Minkowycz, E.M. Sparrow, G.E. Schneider and R.H. Pletcher, eds., Wiley, New York, 1988. 5. Y. Jaluria and K.E. Torrance, Computational Heat Transfer, Hemisphere, Washington, DC, 1986. 6 . B. Carnahan, H.A. Luter and J.O. Wilkes, Applied Numerical Methods, Wiley, New York, 1969. 7. G. Dhatt and G. Touzot, The Finite Element Method Displayed, Wiley, Chichester, Eng­ land, 1984.

84

F IN IT E ELEM EN T ANALYSIS IN HEAT T RA N SFER

. G. Stephenson, Mathematical Methods for Science Students , Longman, London, 1973. 9. D.W. Pepper and P.A. Watterberg, “Graphics”, Chap. 20, in Handbook of Numerical Heat Transfer, W.J. Minkowycz, E.M. Sparrow, G.E. Schneider and R.H. Pletcher, eds., Wiley, New York, 1988. 10. D.R.J. Owen and E. Hinton, A Simple Guide to Finite Elements , Pineridge Press, Swansea, 1980. 11. E. Kreyszig, Advanced Engineering Mathematics, Wiley, New York, 1972. 12. E. Hinton and D.R.J. Owen, An Introduction to Finite Element Computations, Pineridge Press, Swansea, 1979. 13. A.J. Baker, Finite Element Computational Fluid Mechanics, Hemisphere, Washington, DC, 1983. 14. R.B. Bird, W.E. Stewart and E.N. Lightfoot, Transport Phenomena , Wiley, New York, 1960. 8

PR O BLEM S 2 .1 With reference to the interpolating functions defined in Example 2.4, by using two linear elements, approximate the specific enthalpy of superheated steam at the pressure of 10 MPa. Specific enthalpy is expressed as a function of temperature by the following table.

Temperature

(°C)

400

600

800

Specific enthalpy

(kJ/kg)

3098

3625

4112

2 .2 With reference to Fig. 2.10, verify that a uniform two-dimensional temperature distri­ bution within an element e, whose sides are parallel to the x and y axes, can be expressed as

in which if are nodal temperatures while N f are interpolating functions defined locally as

F ig u re 2.10

A four-node rectangular element whose sides are parallel to the ( x , y ) axes.

CO N TINUUM PROBLEM S

85

2.3 With reference to the interpolating functions defined in Problem 2.2, by using four rect­ angular elements, approximate the specific enthalpy of superheated steam. Specific enthalpy H (kJ/kg) is expressed, as a function of pressure and temperature, by the following table. Pressure

Temperature (°C)

(MPa)

400

600

800

10

3098

3625

4112

30

2157

3444

4018

50

1878

3249

3925

2.4 With reference to Problem 2.3, write a computer program to produce a new interpolating table with the entries 10, 20, 30, 40 and 50 MPa for pressure and 400, 500, 600, 700 and 800 °C for temperature. 2.5 Derive the weighted residual weak formulation for the dimensionless heat conduction equation

defined in the interval

0

21’23 (7.183) where /? is the wave number, u is the propagation velocity and I = is the imag­ inary unit. Therefore, with reference to the time instants t? = n At? and t? + At? = (n -f 1) At?, we can define the analytical amplification factor as (7.184) Thus, for the advection equation, the modulus of the analytical amplification factor is identically equal to 1 . For the numerical solutions the amplification factor Gnum is instead defined by Eq. (7.157) as (7.185) and its modulus is, in general, different from 1. The ratio (7.186) is known as the amplitude ratio and determines the amount of artificial diffusion in the numerical scheme. The amplitude ratio must be as close as possible to 1 for accuracy and it must not exceed 1 to achieve stability. An amplitude ratio which is smaller than 1 indicates that the scheme is stable but is also plagued by numerical diffusion, while an amplitude ratio which is larger than 1 indicates that the scheme is unstable because of a “negative” numerical diffusion. From Eq. (7.184) we can infer that the argument of Gan depends on the wave number /? and on the advection velocity u. We have in fact (7.187) where Coa is the discretized Courant number. Similarly we can define the argument of Gnum as being equal to (7.188) and, from Eqs. (7.187) and (7.188), we have ( 7. 189)

CONVECTION-TYPE PROBLEMS

389

where the product /3 A x can be considered as a dimensionless wave number (7.190) The ratio unum/u , defined by Eqs. (7.189) and (7.190), is called the relative celerity and, for any given wave number, it is equal to the real speed of the numerical wave divided by the advection speed of the analytical wave. Consequently, dispersion errors are introduced in the numerical solution whenever relative celerities are different for different wavelengths. As pointed out in Section 7.6, numerical solutions can be expressed by means of Fourier series. However, in a one-dimensional domain of finite length L , these Fourier series can have only a finite number of harmonics, spanning from the maximum representable wavelength (7.191) to the minimum resolvable wavelength (7.192) Therefore, Eqs. (7.186) and (7.189) need only be analyzed in the finite interval of values (2,2 L ]A x ) assumed by the dimensionless wavelength X/ Ax. In the following examples, this analysis will be carried out for the explicit (a = 0), Crank-Nicolson (a = 1 / 2 ) and fully implicit ( a = 1 ) algorithms, with reference both to consistent and to lumped capacity matrices. E xam ple 7.17: Diffusion and dispersion errors of finite elem ent algorithm s w ith consistent capacity m atrices Using consistent capacity matrices, find the diffusion and dispersion errors of the ex­ plicit (a = 0), Crank-Nicolson (a = 1 / 2 ) and implicit (a = 1 ) algorithms for time integration of the pure advection equation. Solution. Substituting Eqs. (7.149) to (7.152) into Eq. (7.157) and taking into account the definition (7.190) we obtain, for Fo^ = 0 (7.193) Therefore the modulus of the amplitude ratio can be expressed as

(7.194)

while the relative celerity can be written as

( 7. 195)

3 90

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

Finally, from Eqs. (7.194) and (7.195) we obtain for the explicit algorithm (a = 0)

(7.196) and (7.197) for the Crank-Nicolson algorithm (a = 1 / 2 ) (7.198) and (7.199) and for the fully implicit algorithm (a = 1 )

(7.200) and (7.201) These results are illustrated in Figs. 7.22 and 7.23 where we can see that, in the con­ text of pure advection, the explicit algorithm is unconditionally unstable while both the Crank-Nicolson and the fully implicit algorithms are unconditionally stable. However, the Crank-Nicolson algorithm is not affected by numerical diffusion while the fully implicit algorithm shows a numerical diffusion which increases with the discretized Courant number. All the algorithms are affected by dispersion errors which increase with the discretized Courant number and are felt more strongly at the higher frequen­ cies, that is, when they must resolve the smaller wavelengths. These theoretical results explain why, in the numerical experiments, we have dif­ fusion errors with the fully implicit algorithm and we have dispersion errors, at the smaller wavelengths, with the Crank-Nicolson and the fully implicit algorithm. For purely advective problems, no numerical experiments can be carried out with the stan­ dard explicit algorithm which, in the absence of physical diffusion, is unconditionally unstable. However, alternative explicit procedures of discretization have gained wide acceptance in the past few years. These algorithms correspond to the so-called “TaylorGalerkin” methods 13,22 in which the solution is achieved by first approximating the time derivative by means of a Taylor series expansion and then by discretizing the space derivatives by means of a Galerkin procedure. In this context, the partial time discretization precedes the space discretization and allows the direct evaluation of the time derivatives from the original differential equation. This preliminary approxima­ tion provides naturally an “upwinding” diffusion-like term that stems from a more accurate expression of the time derivative. This upwinding term increases with the time increment used and has a strong stabilizing effect which allows the use of explicit

CONVECTION-TYPE PROBLEMS

Figure 7.22

391

Amplitude ratio for different algorithms with consistent capacity matrices: (a) explicit algorithm (a = 0 ); (b) Crank-Nicolson algorithm (a = 1 / 2 ); (c) implicit algorithm (a = 1 ). (Adapted from The Finite Element Method, Fourth Edition, Volume 2, by Zienkiewicz and Taylor, copyright © 1991 by McGraw-Hill Book Company Europe. Used with permission.)

39 2

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

Figure 7.23

Relative celerity for different algorithms with consistent capacity matrices: (a) explicit algorithm (a = 0); (b) Crank-Nicolson algorithm (a = 1 / 2 ); (c) implicit algorithm (a = 1). (Adapted from The Finite Element Method, Fourth Edition, Volume 2, by Zienkiewicz and Taylor, copyright © 1991 by McGraw-Hill Book Company Europe. Used with permission.)

CONVECTION-TYPE PROBLEMS

393

procedures even in the context of purely advective problems. However, standard im­ plicit schemes for time integration are always unconditionally stable and, therefore, we believe that there is no need to introduce advanced explicit schemes, such as TaylorGalerkin procedures, in an elementary textbook. E xam ple 7.18: Diffusion and dispersion errors of finite elem ent algorithm s w ith lum ped capacity m atrices Using lumped capacity matrices, find the diffusion and dispersion errors of the explicit (a = 0), Crank-Nicolson (a = 1/2) and fully implicit (a = 1) algorithms for time integration of the pure advection equation. Solution. Following the same steps illustrated in Example 7.17, we obtain for lumped capacity matrices (7.202) Therefore the modulus of the amplitude ratio can be expressed as (7.203) while the relative celerity can be written as

(7.204)

Thus we obtain also for the explicit algorithm (a = 0) (7.205) and (7.206) for the Crank-Nicolson algorithm (a = 1 / 2 ) (7.207) and (7.208) and for the fully implicit algorithm (a — 1 ) ( 7. 209)

394

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

and ( 7. 210)

As already pointed out in Example 7.15, the same results could have been obtained by referring to finite difference methods with a central difference representation of the advection term.

7.8

M O DELING OF HEAT A N D FLUID FLOW

In the previous sections we have dealt with convection-type problems which are of interest in the general areas of heat and mass transfer. Finite element formulations for convection-type problems have been generalized to three dimensions and a physical interpretation has been provided for all the steps involved in the Galerkin space dis­ cretization process. Several examples of application of the computer code TRAN_2D have been presented. Stability analyses together with a discussion of diffusion and dispersion errors have been provided for the time integration algorithms utilized in the program. The examples presented in this chapter are relatively simple. However, these exam­ ples address all the main principles associated with finite element analyses of energy, mass and momentum transfer. The flow fields have not been computed but the way has been paved for the understanding of more advanced finite element procedures for the solution of multidimensional momentum equations in laminar and turbulent flows. Therefore, this chapter should have provided the basic knowledge and stimulus to pur­ sue further study in these areas.

R E FE R E N C E S 1. R.B. Bird, W.E. Stewart and E.N. Lightfoot, Transport Phenomena, Wiley, New York, 1960. 2. G. Comini and S. Del Giudice, “Parabolic Systems: Finite-Element Method”, Chap. 4, in Handbook of Numerical Heat Transfer, W.J. Minkowycz, E.M. Sparrow, G.E. Schneider and R.H. Pletcher, eds., Wiley, New York, 1988. 3. P.J. Roache, Computational Fluid Dynamics, Hermosa Publishers, Albuquerque, N.M., 1982. 4. S.V. Patankar, Numerical Heat Transfer and Fluid Flow, Hemisphere, Washington, D.C., 1980. 5. G. Comini and S. Del Giudice, “Pressure-Velocity Coupling in Incompressible Fluid Flow”, in Annual Review of Numerical Fluid Mechanics and Heat Transfer, Volume 1, T.C. Chawla, ed., Hemisphere, Washington, D.C., 1987. 6 . R.H. Pletcher, W.J. Minkowycz, E.M. Sparrow and G.E. Schneider, “Overview of Ba­ sic Numerical Methods”, Chap. 1, in Handbook of Numerical Heat Transfer, W.J. Minkowycz, E.M. Sparrow, G.E. Schneider and R.H. Pletcher, eds., Wiley, New York, 1988. 7. C. Hirsch, Numerical Computation of Internal and External Flows, Volume 1: Funda­ mentals of Numerical Discretization, Wiley, Chichester, 1988. 8 . S. Del Giudice, G. Comini and C. Nonino, A physical interpretation of conservative and non-conservative finite element formulations of convection-type problems, Int. J. Numer. Methods Eng., 35, 709-727, 1992. 9. O.C. Zienkiewicz and R.L. Taylor, The Finite Element Method, Volume 1 , Fourth Edition, McGraw-Hill, London, 1989. 10. P.M. Gresho, R.L. Lee, R.L. Sani, M.K. Maslanik and B.E. Eaton, The consistent Galerkin FEM for computing derived boundary quantities in thermal and/or fluids prob­ lems, Int. J. Numer. Methods Fluids, 7, 371-394, 1987. 1 1 . C. Nonino, G. Comini and S. Del Giudice, Comparison of conservative and non­ conservative formulations for advection-diffusion problems, in Numerical Methods in

CONVECTION-TYPE PROBLEMS

12.

13. 14. 15. 16. 17. 18. 19. 20.

21.

22.

23.

395

Laminar and Turbulent Flow, Volume VII, pp. 534-544, C. Taylor, J.H. Chin and G.M. Homsy, eds., Pineridge Press, Swansea, U.K., 1991. J. Banaszek, Comparison of control volume and weighted residual-FEM transient convection-diffusion problems, in Advanced Computational Methods in Heat Transfer, Volume 1 , 251-262, L.C. Wrobel, C.A. Brebbia and A.J. Nowak, eds., Computational Mechanics Publications, Southampton, U.K., 1990. O.C. Zienkiewicz and R.L. Taylor, The Finite Element Method, Volume 2, Fourth Edition, McGraw-Hill, London, 1991. A.J. Baker and D. W. Pepper, Finite Elements 1-2-3, McGraw-Hill, New York, 1991. P.M. Gresho and R.L. Lee, Don’t suppress the wiggles, they’re telling you something, in Finite Element Methods for Convection Dominated Flow, Vol. AMD 41, T.J.R. Hughes, ed., ASME, New York, 1979. S. Kakac, R.K. Shah, and W. Aung, Handbook of Single-Phase Convective Heat Transfer, Wiley, New York, 1987. S.C. Chen, N.K. Anand and D.R. Tree, Analysis of transient laminar convective heat transfer inside a circular duct, J. Heat Transfer, Trans. ASME, Series C, 105, 922-924, 1983. H. Rouse, Fluid Mechanics for Hydraulic Engineers, Dover Publications, New York, 1961. O.C. Zienkiewicz and K. Morgan, Finite Elements and Approximations, Wiley, New York, 1983. A.C. Hindmarsh, P.M. Gresho and D.F. Griffiths, The stability of explicit Euler time-integration algorithms for certain finite difference approximations of the multi­ dimensional advection-diffusion equation, Int. J. Numer. Methods Fluids, 4, 853-897, 1984. D.W. Pepper and A.J. Baker, “Finite Differences Versus Finite Elements”, Chap. 13, in Handbook of Numerical Heat Transfer, W.J. Minkowycz, E.M. Sparrow, G.E. Schneider and R.H. Pletcher, eds., Wiley, New York, 1988. G. Comini, S. Del Giudice and C. Nonino, Taylor-Galerkin algorithms for convectiontype problems, in Advanced Computational Methods in Heat Transfer II, Volume 1, pp. 535-554, L.C. Wrobel, C.A. Brebbia and A.J. Nowak, eds., Computational Mechanics Publications, Southampton, U.K., 1992. B. Cathers and B.A. O’Connor, The group velocity of numerical schemes, Int. J. Numer. Methods Fluids, 5, 201-224, 1985.

PRO BLEM S 7.1 From your own experience find examples of convection-type problems. Hint: Consider, for example, conservation of turbulent kinetic energy and conservation of dissipation rate of turbulent kinetic energy.

Express the finite element formulation for the convection-type problems referred to in Section 7.1.

7.2

7.3 Outline a physical interpretation for the finite element formulations of one of the convection-type problems referred to in Section 7.1. 7.4 Draw the equivalent of Fig. 7.3 for two-dimensional parabolic elements. 7.5 Use the program and two-dimensional linear elements to solve the problem referred to in Example 7.9. Find the limits on the Peclet number for the appearance of wiggles. 7.6 Repeat the solution of Problem 7.5 using two-dimensional parabolic elements. Hint: Now Ax is the distance, in the flow direction, between two adjacent nodes. 7.7 Solve the problem referred to in Example 7.9 by means of a pseudo-transient simulation starting from a linear temperature profile. Use the explicit, the Crank-Nicolson and the implicit algorithms and verify that the limits on the Peclet number for the appearance of the wiggles do not change with respect to the steady state solutions. 7.8

Repeat the solution of Example 7.10 using linear elements and compare the results.

7.9 Repeat the solution of Example 7.11 using linear elements and compare the results. 7.10

Repeat the solution of Example 7.12 using linear elements and compare the results.

39 6

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

7.11

Repeat the solution of Example 7.13 using linear elements and compare the results.

7.12

Repeat the solution of Example 7.12 using the Crank-Nicolson algorithm.

7.13 With reference to the explicit algorithm for time integration and to Problem 7.7 find,

by trial and error, the critical time step. Hint: Use elements with a large width in the direction y, normal to the flow, to ensure that the reference dimension A L is close to Ax. 7.14 Repeat the solution of Example 7.11 assuming a slug flow, that is, a flow in which the velocity is constant across the entire section. 7.15 Repeat the solution of Example 7.12 assuming a slug flow, that is, a flow in which the velocity is constant across the entire section. 7.16 Repeat the solution of Example 7.10 and find the rates of heat transfer by conduction at solid walls. 7.17 Repeat the solution of Example 7.11 and find the rates of heat transfer by conduction at solid walls. 7.18 Repeat the solution of Example 7.12 and find the rates of heat transfer by conduction at solid walls. 7.19 Repeat the solution of Example 7.10 assuming boundary conditions of constant heat flux at the plate walls. 7.20 Repeat the solution of Example 7.10 assuming two different temperatures at the plate

walls.

APPENDIX

A AUTOMATIC MESH GENERATION

A .l PR O G R A M T R A N _M G Program TRAN_MG allows the automatic discretization of simply connected twodimensional domains by preparing the input files containing the geometry and the boundary condition data with the format required by program TRAN_2D, illustrated in Chapter 5 . Program TRAN_MG is based on a simplified version of the mesh generation procedure described in Reference 1 . It produces structured grids of four-node linear or eight-node parabolic elements by the automatic subdivision of a limited number of large zones, or blocks, in which the computational domain has been divided. Each block has the shape of a straight or curved sided quadrilateral, and, accordingly, is represented by a four-node or by an eight-node isoparametric element, called a macro-element. The macro-element node numbering sequence must follow the usual rules, reported in Chapters 3 and 5, and determines the orientation of the local coordinate system (£, 77) of each block, as shown in Fig. A.I. The finite element grid is obtained on the basis of two sets of weighting factors determining, in each direction, the relative size of the elements in the block. The weighting factors are (Wjt)j, with i = l,n^, and (Wn)i, with i = 1 , 71,7, where n$ and nv represent the number of subdivisions of the macro-element in the directions £ and 77, respectively. As a preliminary step of the subdivision process, local coordinates of rows and columns of nodes in the mesh to be generated are calculated from the weighting factors as (A .1)

Figure A .l

Example of an eight-node parabolic macro-element. The counterclockwise node numbering sequence which determines the orientation of the local coor­ dinates f and rj is: 1, 4, 6 , 7, 8 , 5, 3, 2. 397

3 98

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

with j = 1, n^, and (A. 2)

with k = 1,71^. In the above equations we have £0 = —1 and 770 = —1 for j = 1 and k = 1, respectively. Equations (A.l) and (A.2) give the local coordinates of the j-th column and of the &-th row of corner nodes, both of linear and parabolic elements. Local coordinates of mid-side nodes of parabolic elements are determined as the arithmetic mean of the local coordinates of the neighbor corner nodes. The Cartesian coordinates x and y of any nodal point, identified by a set of local coordinates (CjiVk), are calculated as (A. 3)

and ( AA)

where r is the number of nodes in the macro-element, while N and t/; are the macro-element shape functions and nodal coordinates, respectively. When the computational domain is subdivided into more than one block, the fol­ lowing requirements must be met: • all macro-elements must be of the same type (four-node linear macro-elements or eight-node parabolic macro-elements); • adjacent macro-elements must have coincident sides in the rj direction only, that is, the side £ = 1 of a macro-element must coincide with the side £ = —1 of the next macro-element, as shown in Fig. A.2. Since weighting factors must have the same value on coincident sides of different macro­ elements, it is sufficient to specify only one set of weighting factors in the rj direction. This set is then used for all macro-elements, while one different set of weighting factors in the £ direction must be specified for each macro-element. Boundary conditions of the first, second, or third kind can be imposed on macro­ element sides. The corresponding lists of nodes and/or element sides of the generated

F ig u re A .2

Domain subdivided into three four-node linear macro-elements. The node numbering sequences are: 1, 3, 4, 2 for macro-element 1; 3, 5, 6, 4 for macro­ element 2; and 5, 7, 8, 6 for macro-element 3.

APPENDIX A: AUTOMATIC MESH GENERATION

399

mesh, together with the list of the prescribed values, are automatically produced by program TRAN-MG. The computer code has been written in Standard ANSI Fortran 77 with the same extensions and the same programming style adopted for program TRAN_2D. Also in this case, the maximum sizes of the arrays depend on the values of the constants listed below in alphabetical order and defined by PARAMETER statements in the main segment. The values used in this version of the program are reported in parentheses. M D IV S : maximum number of macro-element subdivisions in £ or tj direction (MDIVS=50). M ELEM : maximum number of elements of the generated finite element mesh (MELEM=950). M ELM C : maximum number of macro-elements (MELMC=10). M N O D E : maximum number of nodes in each element (M N0DE=8). M P O IN : maximum number of nodal points in the generated finite element mesh (MPC)IN=1000). M PO M C : maximum number of nodal points in the macro-element subdivision (MPOIN=50). M S C N V : maximum number of sides with convection boundary conditions in each element of the generated mesh (MSCNV=2). M SFLX : maximum number of sides with prescribed fluxes in each element of the generated mesh (MSFLX=2). M SIM C : maximum number of sides with imposed boundary conditions in each macro­ element (MSIMC=4).

A . 2 V O C A B U L A R Y OF IN P U T VARIABLES In the following, names and meanings of all input variables used in program TRAN_MG are reported in alphabetical order. The maximum size of each array is also shown, as it appears in the corresponding DIMENSION statements of the computer code. The values of the variables NGAU 1 and IAXIS do not have any particular meaning in program TRAN_MG, but they are necessary for the preparation of the file containing the geometry data in the format required by program TRAN_2D. COXMC(MPOMC) : vector of ^-coordinates of macro-element nodes (subroutine READMC). COYMC(MPOMC) : vector of ^-coordinates of macro-element nodes (subroutine READMC). DVETA(0:MDIVS) : vector containing the weighting factors in the 7/-direction, start­ ing from rj = —1 (subroutine READBC). The same set of weighting factors is used for all macro-element s. D V E X I( 0 :MDIVS,MELMC): array containing the weighting factors in the ^-direction, starting from £ = —1 (subroutine READBC). One set of weighting factors must be specified for each macro-element. FLXPR(MSIMC,MELMC) : array containing the values of flux prescribed on macro­ element sides (subroutine READBC). HCONV(MSIMC,MELMC) : array containing the convection coefficients on macro­ element sides (subroutine READBC). I AXIS : flag for the solution of axisymmetric problems, as required by program TRAN_2 D (subroutine READMC). ITYM C : type of macro-elements. It determines the number NNOMC of macro­ element nodes (subroutine READMC). ITYMC=1 : linear macro-elements, NN0MC=4; ITYMC=2 : parabolic macro-elements, NN0MC=8.

400

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

IT Y P E : type of elements of the generated mesh. It determines the number NNODE of element nodes (subroutine READMC). ITYPE=1 : linear elements, NN0DE=4; ITYPE = 2 : parabolic elements, NN0DE=8. JN A M E : name of the input file (Main segment). The maximum length of the file name is 40 characters. The extension .MIN is always assumed. JNAME is also the name of all the output files, which have extensions .MOU, .GD, and .BD. LINE : comment line which is read from the input file and immediately echoed in the output file (subroutine RWLINE). The maximum length of the line is 78 characters. LNOMC(MELMC,MNOMC) : array containing the list of nodes of each macro­ element (subroutine READMC). Nodes are listed in a counterclockwise sequence, start­ ing from a corner node. LM : macro-element identification number (subroutine READMC). LP : node identification number (subroutine READMC). LS : identification number of a macro-element side on which boundary conditions of the first, second or third kind are imposed (subroutine READBC). Macro-element sides are numbered in a counterclockwise sequence, starting from the side containing the first and the second node in the list of macro-element nodes LNOMC. For four-node, linear macro-elements: LS= 1 : side containing the first and the second node of the numbering sequence; LS= 2 : side containing the second and the third node of the numbering sequence; LS=3 : side containing the third and the fourth node of the numbering sequence; LS=4 : side containing the fourth and the first node of the numbering sequence. For eight-node, parabolic macro-elements: LS= 1 : side containing the first, second, and third nodes of the numbering sequence; LS= 2 : side containing the third, fourth, and fifth nodes of the numbering sequence; LS=3 : side containing the fifth, sixth, and seventh nodes of the numbering se­ quence; LS=4 : side containing the seventh, eighth, and first nodes of the numbering sequence. N D E T A : number of macro-element subdivisions in the 77-direction (subroutine READMC). NDEXI(MELMC) : number of macro-element subdivisions in the ^-direction (subrou­ tine READMC). NELM C : total number of macro-elements (subroutine READMC). N G A U 1 : number of Gauss integration points in each direction, as required by pro­ gram TRAN_ 2 D (subroutine READMC). N PO M C : total number of macro-element nodal points (subroutine READMC). NSIDl(MELMC) : number of macro-element sides on which boundary conditions of the first kind are imposed (subroutine READBC). N S ID 2 (MELMC) : number of macro-element sides on which boundary conditions of the second kind are imposed (subroutine READBC). NSID3(MELMC) : number of macro-element sides on which boundary conditions of the third kind are imposed (subroutine READBC). PHICV(MSIMC,MELMC): array containing the potential of the surrounding medium corresponding to macro-element sides (subroutine READBC). PHIPR(MSIMC,MELMC) : array containing the values of the potential prescribed on macro-element sides (subroutine READBC). TITLE : title line (main segment). The maximum length of the title line, which is written at the beginning of all output files, is 65 characters. X SCAL : scale factor in the x direction (subroutine READMC). There is no change in x coordinates for XSCAL= 1 . X SH F T : shift factor in the x direction (subroutine READMC). There is no change in x coordinates for XSHFT= 0 . Y SC A L : scale factor in the y direction (subroutine READMC). There is no change in y coordinates for YSCAL= 1 . Y SH F T : shift factor in the y direction (subroutine READMC). There is no change in y coordinates for YSHFT= 0 .

APPENDIX A: AUTOMATIC MESH GENERATION

401

A .3 D E S C R IP T IO N OF IN P U T A N D O U T P U T The values of input variables are read in the order reported below. The input formats are the same as those adopted in program TRAN_2D. • 15 for all integer variables; • E12.4 for all real variables. When a line contains a mixture of real and integer variables, the corresponding mixture of 15 and E12.4 is used. When variables are read using an implied DO-loop, the formats used are 1015 and 5E12.4 for lists of integers and reals, respectively. The input file name JN A M E is read from the default input device (usually the terminal). All other data are read from file JNAME// '.MIN'): T itle line (read in the main segment of the code): TITLE G eom etry data (read in subroutine READMC): < com m ent line > N P O M C , NELM C < com m ent line > IT Y M C , IT Y P E < com m ent line > For IP = 1 to NPOMC LP, COXM C(LP), COYMC(LP) Next IP < com m ent line > X SH F T , Y SH FT XSCAL, YSCAL < comment line > For IM= 1 to NELMC LM, (LNOMC(LM,IN), for IN=1 to NNOMC) Next IM < comment line > For IM=1 to NELMC NDEXI(IM ) (DVEXI(ID,IM), for ID=1 to NDEXI(IM)) Next IM < com m ent line > ND E T A (DVETA(ID), for ID = 1 to NDETA) < comment line > N G A U 1 , IAXIS B oundary condition data (read in subroutine READBC): For IM= 1 to NELMC < com m ent line > < com m ent line >

N SID l(IM ) If NSIDl(IM) > 0 then < com m ent line > For IS=1 to NSIDl(IM)

402

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

LS, PHIPR(IS,IM) Next IS End if < com ment line > N S ID 2 (IM) If NSID2(IM) > 0 then < com m ent line > For IS=1 to NSID2 (IM) LS, FLXPR(IS,IM) Next IS End if < com m ent line > NSID3(IM ) If NSID3(IM) > 0 then < com ment line > For IS=1 to NSID3(IM) LS, HCONV(IS,IM), PHICV(IS,IM) Next IS End if Next IM The output is contained in three files: in the first, with extension .OUT, all the input data are echoed, while in the second, with extension .GD, and in the third, with extension .BD, the geometry data and the boundary condition data are written in the format required by program TRAN_2D. Therefore, these two files are ready to be used, without any further manipulation.

A .4 LISTING OF PR O G R A M T R A N _M G

c ====================================================================== c ====================================================================== c C Program TRAN_MG f o r th e c r e a t i o n o f f i l e s *.GD and *.BD c o n ta in in g C geom etry and b o u ndary c o n d itio n d a ta f o r program TRAN_2DA C V e rs io n : FEM-HT C

C ======================================================================

c ====================================================================== c PROGRAM TRAN.MG

C PARAMETER (MP0MC=50, MELMC=10, MSIMC=4, MDIVS=50) PARAMETER (MP0IN=1000, MELEM=950, MN0DE=8) PARAMETER (MSFLX=2, MSCNV=2) C CHARACTERS CHARACTER*65 CHARACTER*30 ft ft

JNAME TITLE FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, FMTMX, FMTMP

COMMON /IOFMT/ FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, FMTMX, FMTMP

C DIMENSION ft COXMC(MPOMC), ft IEINI(MELMC), ft DVETA(OrMDIVS), ft LNODE(MNODE,MELEM)

COYMC(MPOMC), NDEXI(MELMC), CORDX(MPOIN),

LNOMC( MNODE,MELMC) , DVEXI(0:MDIVS,MELMC), CORDY(MPOIN),

DIMENSION ft NSID1(MELMC), ft NSID2(MELMC), ft NSID3(MELMC), ft PHICV(MSIMC,MELMC)

ISID1(MSIMC,MELMC), ISID2(MSIMC, MELMC), ISID3(MSIMC,MELMC),

PHIPR(MSIMC,MELMC), FLXPR(MSIMC,MELMC), HCONV(MSIMC,MELMC),

DIMENSION ft LPPHI(MPOIN),

PRPHI(MPOIN),

KSFLX(MELEM),

C

C

APPENDIX A: AUTOMATIC MESH GENERATION

k k

LSFLX(MSFLX,MELEM), LSCNV(MSCNV,MELEM),

FLXLS(MSFLX,MELEM), HCVLS(MSCNV,MELEM),

KSCNV(MELEM), PHILS(MSCNV,MELEM)

ELXMC(MNODE),

ELYMC(MNODE),

C k k

DIMENSION SHAP2(MNODE), LSIEL(MELMC)

C DATA LPPHI /MPOIN+O/ DATA KSFLX /MELEM+O/ DATA KSCNV /MELEM*0/ C C -----------------------------------------------------------------------------------------------------------------------C C ---- Read in p u t f i l e name. The same name i s g iv e t o a l l f i l e s c r e a te d C d u rin g t h i s jo b (o n ly e x te n s io n s a r e d i f f e r e n t ) C WRITE(6,FMTCH) >Q>» In p u t f i l e name: ' READ ( 5 , FMTCH) JNAME C C ---- Open in p u t said o u tp u t f i l e s C LL = INDEX( JNAME//* V 0 - 1 OPEN (5 , F IL E ^ N A M E d ^ L )//* .MIN* ,STATUS=’OLD*) OPEN (6 , FILE=JNAME(l:LL)//>.MOU',STATUS=’UNKNOWN') OPEN (1 , FILE=JNAME(1:LL)//'.GD\STATUS=>UNKNOWN1) OPEN (2 , FILE=JNAM E(l:LL)//>.BD’ , STATUS=>UNKNOWN’ ) C C ----- P r i n t th e h e a d in g o f th e o u tp u t f i l e C CALL BANNER C C ----- Read and p r i n t a t i t l e l i n e C READ ( 5 , FMTCH) TITLE WRITE( 6 , FMTCH) TITLE C C ---- P r i n t th e in p u t f i l e name C WRITE( 6 , FMTCH) 'O In p u t f i l e name' WRITE(6,FMTCH) » *//JNAME C C ---- Read and p r i n t in p u t d a ta f o r mesh g e n e r a tio n C CALL READMC (MPOMC, MELMC, MNODE, MDIVS, NELMC, NNOMC, LNOMC, k COXMC, COYMC, NDEXI, NDETA, DVEXI, DVETA, ITYPE, k NNODE, NGAU1, IAXIS) C C ---- Read and p r i n t in p u t d a ta f o r s p e c i f i c a t i o n o f boundary c o n d it i o n s C CALL READBC (MELMC, MSIMC, NELMC, NSID1, ISID 1, PHIPR, NSID2, k ISID 2, FLXPR, NSID3, ISID 3, HCONV, PHICV) C C ---- C a lc u la te t h e l o c a l c o o r d in a te s o f rows and colum ns o f c o r n e r C nodes o f t h e g e n e r a te d mesh C CALL L CORD (MELMC, MDIVS, NELMC, NDEXI, NDETA, DVEXI, DVETA) C C ---- G e n e ra te t h e mesh C IF (NNODE .EQ. 4) THEN C C -------- Mesh o f l i n e a r e le m e n ts C CALL GENERL (MPOMC, MELMC, MPOIN, MELEM, MNODE, MDIVS, NELMC, k NNOMC, NDEXI, NDETA, DVEXI, DVETA, LNOMC, COXMC, k COYMC, SHAP2, ELXMC, ELYMC, IE IN I, NPOIN, NELEM, k CORDX, CORDY, LNODE) C ELSE C C -------- Mesh o f p a r a b o l i c e le m e n ts C CALL GENERP (MPOMC, MELMC, MPOIN, MELEM, MNODE, MDIVS, NELMC, k NNOMC, NDEXI, NDETA, DVEXI, DVETA, LNOMC, COXMC, k COYMC, SHAP2, ELXMC, ELYMC, IE IN I, NPOIN, NELEM, k CORDX, CORDY, LNODE) C ENDIF C C ---- W rite g eo m etry d a t a on f i l e JNAME//*.GD*

403

404

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

C ft

CALL WRGEOM (TITLE, MPOIN, MELEM, MNODE, ITYPE, NGAU1, NPOIN, NELEM, NNODE, LNODE, CORDX, CORDY, IAXIS)

C C ----- S p e c ify b oundary c o n d itio n s o f th e 1 s t ty p e C CALL BCFRST (MPOIN, MELEM, MNODE, MELMC, MSIMC, ft NPOIN, NNODE, LNODE, NSID1, ISID 1, ft NDEXI, NDETA, IE IN I, NPPHI, LPPHI, C C ---- S p e c ify b o u ndary c o n d itio n s o f th e 2nd ty p e C CALL BCSCND (MELEM, MELMC, MSIMC, MSFLX, MDIVS, ft IS ID 2, FLXPR, LSIEL, NDEXI, NDETA, ft NEFLX, KSFLX, LSFLX, FLXLS) C C ----- S p e c if y b o u ndary c o n d itio n s o f t h e 3 rd ty p e C CALL BCTHRD (MELEM, MELMC, MSIMC, MSCNV, MDIVS, ft ISID 3, HCONV, PHICV, LSIEL, NDEXI, ft NELEM, NECNV, KSCNV, LSCNV, HCVLS, C C -----W rite b o u ndary d a ta on f i l e JNAME//*.BD* C CALL WRBOUN (TITLE, MPOIN, MELEM, MSFLX, MSCNV, ft LPPHI, PRPHI, NEFLX, KSFLX, LSFLX, ft KSCNV, LSCNV, HCVLS, PHILS) C CALL STOP ( 'MESH GENERATED#') C END C

MDIVS, NELMC, PHIPR, LSIEL, PRPHI)

NELMC, NSID2, IE IN I, NELEM,

NELMC, NSID3, NDETA, IE IN I, PHILS)

NELEM, NPPHI, FLXLS, NECNV,

C ======================================================================

C S u b ro u tin e READMC r e a d s and p r i n t s d a ta c o n c e rn in g geom etry C o f t h e m a c ro -e le m e n ts C ====================================================================== C SUBROUTINE READMC (MPOMC, MELMC, MNODE, MDIVS, NELMC, NNOMC, ft LNOMC, COXMC, COYMC, NDEXI, NDETA, DVEXI, ft DVETA, ITYPE, NNODE, NGAU1, IAXIS) C CHARACTERS FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, ft FMTMX, FMTMP COMMON /IOFMT/ ft FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, FMTMX, FMTMP C DIMENSION ft COXMC(MPOMC), COYMC(MPOMC), LNOMC(MNODE,MELMC) , ft NDEXI(MELMC), DVEXI( 0 : MDIVS,MELMC),DVETA(0: MDIVS) C C ------------------------------------------------------------------------------------------------------------------------C C ----- Read and p r i n t number o f p o i n ts and number o f m a c ro -e le m e n ts C CALL RVLINE READ ( 5 , FMTIN) NPOMC, NELMC WRITE(6,FMTIN) NPOMC, NELMC C IF ((NPOMC .LE. 0) .OR. (NPOMC .GT. MPOMC)) ft CALL IN_ERR (1 , 1, 0 , 0) IF ((NELMC .LE. 0) .OR. (NELMC .GT. MELMC)) ft CALL IN_ERR ( 1 , 2 , 0 , 0) C C -----Read and p r i n t m ac ro -ele m e n t ty p e and elem en t ty p e C CALL RWLINE READ ( 5 , FMTIN) ITYMC, ITYPE WRITE( 6 , FMTIN) ITYMC, ITYPE C IF ((ITYMC .NE. 1) .AND. (ITYMC .NE. 2 ) ) CALL IN.ERR (1 , 3 , 0 , 0) IF ((ITYPE .NE. 1) .AND. (ITYPE .NE. 2 ) ) CALL INJ3RR (1 , 4 , 0 , 0) C C ----- Number o f nodes i n each m ac ro -ele m e n t and elem en t C IF (ITYMC .EQ. 1) THEN NNOMC = 4 ELSE NNOMC = 8 ENDIF C IF (ITYPE .EQ. 1) THEN

APPENDIX A: AUTOMATIC MESH GENERATION

NNODE = 4 ELSE NNODE = 8 ENDIF C C ---- Read and p r i n t n o d a l c o o r d in a te s o l t h e m a c ro -e le m e n ts C CALL RVLINE DO IP = 1 , NPOMC READ ( 5 , FMTIE) LP, COXMC(LP), COYMC(LP) IF ((L P .LE. 0) .OR. (LP .GT. NPOMC)) CALL IN.ERR (1 , 5 , LP, IP ) ENDDO C DO IP = 1 , NPOMC VRITE(6,FMTIE) IP , COXMC(IP), COYMC(IP) ENDDO C C ---- Read and p r i n t s h i l t said s c a l e l a c t o r s and m od ily c o o r d in a te s C CALL RVLINE READ ( 5 , FMTEX) XSHFT, YSHFT VRITE(6,FMTEX) XSHFT, YSHFT READ ( 5 , FMTEX) XSCAL, YSCAL VRITE(6,FMTEX) XSCAL, YSCAL C IF ((XSHFT .NE. 0 . ) .OR. (YSHFT .NE. 0 . ) .OR. ft (XSCAL .NE. 1 .) .OR. (YSCAL .NE. 1 . ) ) THEN VRITE(6,FMTCH) 'O M o d ilied c o o r d i n a t e s ' DO IP = 1 , NPOMC COXMC(IP) = (COXMC(IP) + XSHFT) * XSCAL COYMC(IP) = (COYMC(IP) + YSHFT) * YSCAL VRITE(6,FMTIE) IP , COXMC(IP), COYMC(IP) ENDDO ENDIF C C ---- Read and p r i n t m ac ro -ele m e n t l i s t o l nodes C CALL RVLINE DO IM = 1 , NELMC READ ( 5 , FMTIN) LM, (LNOMC( IN,LM ), IN=1,NNOMC) C IF ((LM .LE. 0) .OR. (LM .GT. NELMC)) CALL IN.ERR ( 1 , 6 , LM, IM) DO IN = 1 , NNOMC IP = LNOMC( IN,LM) IF ( ( I P .LE. 0) .OR. (IP .GT. NPOMC)) ft CALL IN.ERR ( 1 , 7 , I P , IM) ENDDO C ENDDO C DO IM = 1 , NELMC VRITE(6,FMTIN) IM, (LNOMC(IN.IM), IN=1,NNOMC) ENDDO C C ---- Read and p r i n t mesh s u b d iv is io n s i n EXI d i r e c t i o n l o r eac h C m ac ro -ele m e n t C CALL RVLINE DO IM = 1 , NELMC C READ ( 5 , FMTIN) NDEXI(IM) VRITE(6,FMTIN) NDEXI(IM) NDIVS = NDEXI(IM) READ ( 5 , FMTEX) (DVEXI(ID,IM ), ID=1,NDIVS) VRITE(6,FMTEX) (DVEXI(ID,IM ), ID=1,NDIVS) C ENDDO C C ---- Read and p r i n t mesh s u b d iv is io n s i n ETA d i r e c t i o n common t o C a l l m a c ro -e le m e n ts C CALL RVLINE READ ( 5 , FMTIN) NDETA VRITE(6,FMTIN) NDETA READ ( 5 , FMTEX) (DVETA(ID), ID=1,NDETA) VRITE(6,FMTEX) (DVETA(ID), ID=1,NDETA) C C ----- Read and p r i n t num ber o l G a u ssia n i n t e g r a t i o n p o i n t s i n each C d i r e c t i o n [2 o r 3 ] , and in d ex l o r a x is y m m e tric p ro b lem s C IAXIS = 0 : p la n e problem

405

406

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

C C C

IAXIS = 1 : symmetry w ith r e s p e c t t o th e y - a x is ( v e r t i c a l ) IAXIS = 2 : symmetry w ith r e s p e c t t o th e x - a x is ( h o r i z o n t a l ) CALL RWLINE READ ( 5 , FMTIN) NGAU1, IAXIS WRITE(6,FMTIN) NGAU1, IAXIS

C MGAU1 = 3 NGMIN = ITYPE + 1 IF ((NGAU1 .LT. NGMIN) .OR. (NGAU1 .GT. MGAU1)) ft CALL IN_ERR ( 1 , 8 , 0 , 0) IF ((IA X IS .LT. 0) .OR. (IAXIS .GT. 2 )) ft CALL IN_ERR (1 , 9 , IAXIS, 0) C RETURN END C C ====================================================================== C S u b ro u tin e READBC r e a d s and p r i n t s d a ta c o n c e rn in g boundary C c o n d it i o n s f o r t h e m ac ro -e le m e n ts C ====================================================================== C SUBROUTINE READBC (MELMC, MSIMC, NELMC, NSID1, ISID 1, PHIPR, ft NSID2, ISID 2, FLXPR, NSID3, ISID 3, HCONV, ft PHICV) C CHARACTER*30 FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, ft FMTMX, FMTMP COMMON /IOFMT/ ft FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, FMTMX, FMTMP C DIMENSION ft NSID1(MELMC), ISID1(MSIMC,MELMC), PHIPR(MSIMC,MELMC), ft NSID2(MELMC), ISID2(MSIMC,MELMC), FLXPR(MSIMC,MELMC), ft NSID3(MELMC), ISID3(MSIMC, MELMC), HCONV(MSIMC,MELMC), ft PHICV(MSIMC,MELMC) C

c -----------------------------------------------------------------------------------------

C C ---- Loop o v e r t h e m ac ro -ele m e n ts C DO IM = 1 , NELMC C CALL RWLINE C C -------- Read and p r i n t d a ta c o n c e rn in g 1 s t k in d boundary c o n d itio n s C CALL RWLINE READ ( 5 , FMTIN) NSIDl(IM) WRITE(6,FMTIN) NSIDl(IM) NSIDE = NSIDl(IM) IF (NSIDE .LT. 0 .OR. NSIDE .GT. MSIMC) ft CALL IN.ERR (2 , 1, IM, NSIDE) C IF (NSIDE .GT. 0) THEN C CALL RWLINE C C ------------Loop o v e r m ac ro -ele m e n t s i d e s C DO IS = 1 , NSIDE C C --------------- Read and p r i n t s id e number and p r e s c r i b e d v a lu e o f PHI C READ ( 5 , FMTIE) LS, PH IPR(IS,IM ) WRITE(6,FMTIE) LS, PHIPR(IS,IM ) IF (LS .LT. 1 .OR. LS. GT. 4) CALL IN_ERR (2 , 2, IM, LS) IS ID 1 (IS , IM) = LS C C ------------ End o f lo o p o v e r m ac ro -ele m e n t s id e s C ENDDO C ENDIF C C -------- Read and p r i n t d a ta c o n c e rn in g 2nd k in d boundary c o n d itio n s C CALL RWLINE READ ( 5 , FMTIN) NSID2(IM) WRITE(6,FMTIN) NSID2(IM) NSIDE = NSID2(IM)

APPENDIX A: AUTOMATIC MESH GENERATION

ft

IF (NSIDE .LT. 0 .OR. NSIDE .GT. MSIMC) CALL IN.ERR (2 , 3 , IM, NSIDE)

C IF (NSIDE .GT. 0) THEN C CALL RWLINE C C ------------Loop o v e r m ac ro -ele m e n t s i d e s C DO IS = 1 , NSIDE C C --------------- Read and p r i n t s i d e number and p r e s c r i b e d v a lu e o f f l u x C READ ( 5 , FMTIE) LS, FLXPR(IS,IM) WRITE(6,FMTIE) LS, FLXPR(IS,IM) IF (LS .LT. 1 .OR. LS. GT. 4) CALL IN_ERR (2 , 4 , IM, LS) IS ID 2 (IS ,IM ) = LS C C ------------ End o f lo o p o v e r m ac ro -ele m e n t s i d e s C ENDDO C ENDIF C C -------- Read and p r i n t d a ta c o n c e rn in g 3 rd k in d b o u ndary c o n d itio n s C CALL RWLINE READ ( 5 , FMTIN) NSID3(IM) WRITE(6,FMTIN) NSID3(IM) NSIDE = NSID3(IM) IF (NSIDE .LT. 0 .OR. NSIDE .GT. MSIMC) ft CALL IN_ERR (2 , 5 , IM, NSIDE) C IF (NSIDE .GT. 0) THEN C CALL RWLINE C C ----------- Loop o v e r m ac ro -ele m e n t s i d e s C DO IS = 1 , NSIDE C C --------------- Read and p r i n t s i d e number and p r e s c r i b e d v a lu e o f f l u x C READ ( 5 , FMTIE) LS, HCONV(IS,IM), PHICV(IS,IM) WRITE(6,FMTIE) LS, HCONV(IS,IM), PHICV(IS,IM) IF (LS .LT. 1 .OR. LS. GT. 4) CALL IN.ERR ( 2 , 6 , IM, LS) IS I D 3 ( IS , IM) = LS C C ----------- End o f lo o p o v e r m ac ro -ele m e n t s i d e s C ENDDO C ENDIF C C ---- End o f lo o p o v e r th e m a c ro -e le m e n ts C ENDDO C RETURN END C C ====================================================================== C S u b ro u tin e L_C0RD c a l c u l a t e s th e l o c a l c o o r d in a te s o f row s and C colum ns o f c o r n e r n odes o f th e g e n e r a te d mesh C ====================================================================== C SUBROUTINE L.CORD (MELMC, MDIVS, NELMC, NDEXI, NDETA, DVEXI, ft DVETA) C DIMENSION ft NDEXI(MELMC), DVEXI( 0 : MDIVS,MELMC),DVETA(0:MDIVS) C C ------------------------------------------------------------------------------------------------------------------------C C ---- Loop o v e r t h e m a c ro -e le m e n ts C DO IM = 1 , NELMC C C -------- L o ca l c o o r d in a te s o f t h e s u b d i v i s i o n s i n th e EXI d i r e c t i o n C NDIVS = NDEXI(IM)

407

408

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

SWEXI= 0 . DO ID = 1 , NDIVS SWEXI = SWEXI + DVEXI( ID,IM) ENDDO C DVEXI(0,IM) = - 1 . DO ID = 1 , NDIVS DEEXI = 2 . * DVEXI( ID,IM ) / SWEXI DVEXI(ID,IM) = DVEXI(ID-1,IM) + DEEXI ENDDO C C ----- End o l lo o p o v e r th e m ac ro -e le m e n ts C ENDDO C C ----- L o c a l c o o r d in a te s o f th e s u b d iv is io n s i n t h e ETA d i r e c t i o n C SWETA = 0. DO ID = 1 , NDETA SWETA = SWETA + DVETA(ID) ENDDO C DVETA(0 ) = - 1 . DO ID = 1 , NDETA DEETA = 2 . * DVETA(ID) / SWETA DVETA(ID) = DVETA( ID -1) + DEETA ENDDO C RETURN END C C ====================================================================== C S u b ro u tin e GENERL g e n e r a te s a mesh o f 2-D LINEAR e le m e n ts C ====================================================================== C SUBROUTINE GENERL (MPOMC, MELMC, MPOIN, MELEM, MNODE, MDIVS, & NELMC, NNOMC, NDEXI, NDETA, DVEXI, DVETA, & LNOMC, COXMC, COYMC, SHAP2, ELXMC, ELYMC, & IE IN I, NPOIN, NELEM, CORDX, CORDY, LNODE) C DIMENSION & COXMC(MPOMC), COYMC(MPOMC), LNOMC(MNODE,MELMC) , & IEINI(MELMC), NDEXI(MELMC), DVEXI( 0 : MDIVS,MELMC), & DVETA(0:MDIVS), CORDX(MPOIN), CORDY(MPOIN), & LNODE(MNODE,MELEM) C DIMENSION & SHAP2(MNODE), ELXMC(MNODE), ELYMC(MNODE) C C ------------------------------------------------------------------------------------------------------------------------C IE = 0 C C ---- Loop o v e r t h e m ac ro -e le m e n ts C DO IM = 1 , NELMC C C -------- C a lc u l a t e m ac ro -ele m e n t v e c t o r s o f c o o r d in a te s C CALL ELVECT (MPOMC, MNODE, NNOMC, LNOMC(1,IM), COXMC, ELXMC) CALL ELVECT (MPOMC, MNODE, NNOMC, LN0MC(1,IM), COYMC, ELYMC) C C -------- C a lc u l a t e n o d a l c o o r d in a te s C IF (IM .EQ. 1) THEN IP IN I = 0 ELSE IP IN I = IP - (NDETA + 1) ENDIF C IP = IP IN I NDIVS = NDEXI(IM) DO IS = 0 , NDIVS C EXI = DVEXI( IS,IM ) DO IT = 0 , NDETA C ETA = DVETA(IT) CALL SHAPEF (MNODE, NNOMC, EXI, ETA, SHAP2) IP = IP + 1 CORDX(IP) = CORDIN (MNODE, NNOMC, SHAP2, ELXMC)

APPENDIX A: AUTOMATIC MESH GENERATION

CORDY(IP) = CORDIN (MNODE, NNOMC, SHAP2, ELYMC) C ENDDO C ENDDO C C -------- C a lc u l a t e e le m en t l i s t s o f nodes C IE IN I(IM ) = IE NROWS = NDETA + 1 DO IS = 1 , NDIVS C KROWS = IP IN I + NROWS * ( I S - 1 ) KREND = KROWS + NROWS C DO IT = 1 , NDETA C IE = IE + 1 LNODE( 1 , IE ) = KROWS + IT LNODE( 2 , IE ) = KREND + IT LN0DE(3,IE) = LN0DE(2,IE) + 1 LN0DE(4,IE) = LN0DE(1, IE ) + 1 C ENDDO C ENDDO C C ----- End o f lo o p o v e r th e m a c ro -e le m e n ts C ENDDO C NPOIN = IP NELEM = IE C RETURN END C C ====================================================================== C S u b ro u tin e GENERP g e n e r a te s a mesh o f 2-D PARABOLIC e le m e n ts C ====================================================================== C SUBROUTINE GENERP (MPOMC, MELMC, MPOIN, MELEM, MNODE, MDIVS, ft NELMC, NNOMC, NDEXI, NDETA, DVEXI, DVETA, ft LNOMC, COXMC, COYMC, SHAP2, ELXMC, ELYMC, ft IE IN I, NPOIN, NELEM, CORDX, CORDY, LNODE) C DIMENSION ft COXMC(MPOMC), COYMC(MPOMC), LNOMC(MNODE,MELMC) , ft IEINI(MELMC), NDEXI(MELMC), DVEXI( 0 : MDIVS, MELMC), ft DVETA(0: MDIVS), CORDX(MPOIN), CORDY(MPOIN), ft LNODE(MNODE,MELEM) C DIMENSION ft SHAP2(MNODE), ELXMC(MNODE), ELYMC(MNODE) C C ------------------------------------------------------------------------------------------------------------------------C IE = 0 NROWS = 2 * NDETA + 1 C C ---- Loop o v e r t h e m a c ro -e le m e n ts C DO IM = 1 , NELMC C C -------- C a lc u l a t e m ac ro -e le m e n t v e c t o r s o f c o o r d in a te s C CALL ELVECT (MPOMC, MNODE, NNOMC, LN0MC(1,IM), COXMC, ELXMC) CALL ELVECT (MPOMC, MNODE, NNOMC, LNOMC(1,IM), COYMC, ELYMC) C C -------- C a lc u l a t e n o d a l c o o r d in a te s C IF (IM .EQ. 1) THEN IP IN I = 0 ELSE IP IN I = IP - (2*NDETA + 1) ENDIF C IP = IP IN I NCOLS = 2 * NDEXI(IM) + 1 DO IC = 1 , NCOLS C

4 09

410

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

IS = IC / 2 IF ( (2 * IS ) .HE. IC ) THEN EXI = DVEXI( IS ,IM ) KSTEP = 1 ELSE EXI = 0 .5 * (DVEXI(IS-1,IM ) + DVEXI(IS,IM )) KSTEP = 2 ENDIF C DO IR = 1 , NROWS,KSTEP C IT = IR / 2 IF ( (2 *IT ) .NE. IR) THEN ETA = DVETA(IT) ELSE ETA = 0 .5 * (DVETA( I T - 1) + DVETA(IT)) ENDIF IP = IP + 1 CALL SHAPEF (MNODE, NNOMC, EXI, ETA, SHAP2) CORDX(IP) = CORDIN (MNODE, NNOMC, SHAP2, ELXMC) CORDY(IP) = CORDIN (MNODE, NNOMC, SHAP2, ELYMC) C ENDDO C ENDDO C C -------- C a lc u l a t e e le m en t l i s t s o f nodes C IE IN I(IM ) = IE NDIVS = NDEXI(IM) NRINT = NDETA + 1 DO IS = 1 , NDIVS C KROWS = IP IN I + (NROWS + NRINT) * (I S - 1 ) + 1 KRINT = KROWS + NROWS KREND = KRINT + NRINT C DO IT = 1 , NDETA C IE = IE + 1 LNODE( 1 , IE) = KROWS + 2 * (IT -1 ) LN0DE(2,IE) = KRINT + IT -1 LN0DE(3,IE) = KREND + 2 * (IT -1 ) LN0DE(4,IE) = LN0DE(3,IE) + 1 LNODE( 5 , IE ) = LNODE( 4 , IE ) + 1 LN0DE(6,IE) = LN0DE(2,IE) + 1 LN0DE(8,IE) = LN0DE(1,IE) + 1 LN0DE(7,IE) = LN0DE(8,IE) + 1 C ENDDO C ENDDO C C ----- End o f lo o p o v e r t h e m ac ro -e le m e n ts C ENDDO C NPOIN = IP NELEM = IE C RETURN END C

C ====================================================================== C S u b ro u tin e ELVECT form s a v e c to r ELVAR o f e le m en t v a lu e s from a C g l o b a l v e c t o r GLVAR C ====================================================================== C SUBROUTINE ELVECT (MPOIN, MNODE, NNODE, LNODE, GLVAR, ELVAR) C DIMENSION & LNODE(MNODE), GLVAR(MPOIN), ELVAR(MNODE) C C ------------------------------------------------------------------------------------------------------------------------C C ----- Loop o v e r th e e le m en t nodes C DO IN = 1 , NNODE C C -------- Move a te rm from a g l o b a l v e c t o r t o an e le m en t v e c t o r C

APPENDIX A: AUTOMATIC MESH GENERATION

IP = LNODE(IN) ELVAR(IN) = GLVAR(IP) C C ----- End o l lo o p o v e r th e elem en t nodes C ENDDO C RETURN END C C ====================================================================== C S u b ro u tin e SHAPEF com putes th e v a lu e s o f th e sh ap e f u n c tio n s SHAP2 C f o r 2-D LINEAR and PARABOLIC e le m en ts C ====================================================================== C SUBROUTINE SHAPEF (MNODE, NNOMC, EXI, ETA, SHAP2) C DIMENSION ft SHAP2(MNODE) C C ------------------------------------------------------------------------------------------------------------------------C OMEXI = 1. - EXI OPEXI = 1. + EXI OMETA = 1. - ETA OPETA = 1. + ETA C IF (NNOMC .EQ. 4) THEN C C -------- Compute l i n e a r shape f u n c ti o n s C SHAP2(1) = 0 .2 5 * OMEXI * OMETA SHAP2(2) = 0 .2 5 * OPEXI * OMETA SHAP2(3) = 0 .2 5 * OPEXI * OPETA SHAP2(4) = 0 .2 5 * OMEXI * OPETA C ELSE C C -------- Compute p a r a b o l i c sh ap e f u n c ti o n s C 0MEX2 = 1. - EXI*EXI 0MET2 = 1. - ETA*ETA C SHAP2(2) = 0 .5 0 * 0MEX2 * OMETA SHAP2(4) = 0 .5 0 * 0MET2 * OPEXI SHAP2(6) = 0 .5 0 * 0MEX2 * OPETA SHAP2(8) = 0 .5 0 * 0MET2 * OMEXI C SHAP2(1) = 0 .2 5 * OMEXI * OMETA ft 0 .5 0 * ( SHAP2(8) + SHAP2(2) ) SHAP2(3) = 0 .2 5 * OPEXI * OMETA ft 0 .5 0 * ( SHAP2(2) + SHAP2(4) ) SHAP2(5) = 0 .2 5 * OPEXI * OPETA ft 0 .5 0 * ( SHAP2(4) + SHAP2(6) ) SHAP2(7) = 0 .2 5 * OMEXI * OPETA ft 0 .5 0 * ( SHAP2(6) + SHAP2(8) ) C ENDIF C RETURN END C C ====================================================================== C F u n c tio n CORDIN c a l c u l a t e s a c o o r d in a te o f an i n t e r n a l node C ====================================================================== C FUNCTION CORDIN (MNODE, NNODE, SHAP2, ELCOR) C DIMENSION ft SHAP2(MNODE), ELCOR(MNODE) C C ------------------------------------------------------------------------------------------------------------------------C CORDN = 0. DO IN = 1 , NNODE CORDN = CORDN + SHAP2(IN) * ELCOR(IN) ENDDO C CORDIN = CORDN C RETURN

411

412

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

END C C S u b r o u tin e WRGEGM w r i t e s geom etry d a ta on l i l e JNAME.GD C ====================================================================== C SUBROUTINE WRGEOM (TITLE, MPOIN, MELEM, MNODE, ITYPE, NGAU1, ft NPOIN, NELEM, NNODE, LNODE, CORDX, CORDY, ft IAXIS) C CHARACTERS TITLE CHARACTER+30 FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, ft FMTMX, FMTMP COMMON /IOFMT/ ft FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, FMTMX, FMTMP C DIMENSION ft CORDX(MPOIN), CORDY(MPOIN), LNODE(MNODE,MELEM) C C ------------------------------------------------------------------------------------------------------------------------C C ----- Read and p r i n t a t i t l e l i n e C WRITE( 1 , FMTCH) 'OGEOMETRY DATA: *//T IT L E C C ---- P r i n t number o l p o i n ts and number o l e le m en ts C WRITE(1, FMTCH) ' ONumber o l p o i n t s , number o l e le m e n ts ' WRITE(1,FMTIN) NPOIN, NELEM C C ----- P r i n t e le m en t ty p e and number o l Gauss i n t e g r a t i o n p o i n ts C i n each d i r e c t i o n C WRITE(1, FMTCH) 'OType o l elem . [ 1 - 2 ] , No. o l Gauss p o i n t s [ 2 - 3 ] ' WRITE( 1 , FMTIN) ITYPE, NGAU1 C C ----- P r i n t n o d a l c o o r d in a te s C WRITE(1, FMTCH) 'O N o d eN o ., c o o r d in a te s ' DO IP = 1 , NPOIN WRITE(1,FMTIE) IP , CORDX(IP), CORDY(IP) ENDDO C C ----- P r i n t ele m en t l i s t o l nodes C WRITE(1, FMTCH) 'O Elem ent N o., n o d a l c o n n e c tio n s ' DO IE = 1 , NELEM WRITE(1,FMTIN) IE , (L N 0D E (IN ,IE), IN=1,NNODE) ENDDO C C ---- P r i n t in d e x l o r a x isy m m e tric p roblem s C WRITE(1, FMTCH) 'O F lag l o r a x isy m m e tric p roblem s [ 0 - 2 ] ' WRITE(1,FMTIN) IAXIS C RETURN END C C ====================================================================== C S u b ro u tin e IN_ERR p r i n t s in p u t e r r o r m essages (program TRAN 2D) C ====================================================================== C SUBROUTINE IN.ERR (ISUBR, IERRO, IMSG1, IMSG2) C LOGICAL LERRO CHARACTER*30 FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, ft FMTMX, FMTMP COMMON /IOFMT/ ft FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, FMTMX, FMTMP C

c -----------------------------------------------------------------------------------------

C C ----- E r r o r s i n s u b r o u tin e READMC C IF (ISUBR .EQ. 1) THEN WRITE( 6 , FMTCH) 'O In p u t d a ta e r r o r d e te c t e d i n r o u t i n e READMC:' C IF (IERRO .EQ. 1) THEN LERRO = TRUE WRITE(6,FMTCH) ' NPOMC: th e number o l p o i n ts o l t h e '

APPENDIX A: AUTOMATIC MESH GENERATION

WRITE( 6 , FMTCH) ' m a c ro -e le m e n ts m ust be g r e a t e r th a n z e ro and* WRITE( 6 , FMTCH) ' l e s s th a n o r e q u a l t o MPOMC' C ELSEIF (IERRO .EQ. 2) THEN LERRO = .TRUE. WRITE( 6 , FMTCH) ' NELEM: t h e number o f m a c ro -e le m e n ts m ust b e ' WRITE( 6 , FMTCH) ' g r e a t e r th a n z e ro and l e s s th a n o r e q u a l t o ' WRITE( 6 , FMTCH) *th e maximum number o f m a c ro -e le m e n ts MELEM' C ELSEIF (IERRO .EQ. 3) THEN LERRO = .TRUE. WRITE( 6 , FMTCH) 'ITYMC: m ac ro -ele m e n t ty p e m ust be e q u a l t o 1 ' WRITE( 6 , FMTCH) ' ( l i n e a r m a c ro -e le m e n ts ) o r e q u a l t o 2 ' WRITE( 6 , FMTCH) ' ( p a r a b o l ic m a c ro - e le m e n ts )' C ELSEIF (IERRO .EQ. 4) THEN LERRO — TRUE WRITE( 6 , FMTCH) ' ITYPE: e le m en t ty p e m ust be e q u a l t o 1 ' WRITE( 6 , FMTCH) ' ( l i n e a r e le m e n ts ) o r e q u a l t o 2 ( p a r a b o l i c ' WRITE(6,FMTCH) ' e le m e n t s ) ' C ELSEIF (IERRO .EQ. 5) THEN LERRO = .TRUE. WRITE( 6 , FMTCI) ' LP: ' , IMSG1 WRITE( 6 , FMTCI) ' C o o rd in a te l i s t row num ber: ' , IMSG2 WRITE(6,FMTCH) ' Node number LP m ust be g r e a t e r t h a n ' WRITE(6,FMTCH) ' z e r o said l e s s th a n o r e q u a l t o NPOMC' C ELSEIF (IERRO .EQ. 6) THEN LERRO = .TRUE. WRITE( 6 , FMTCI) ' LM: \ IMSG1 WRITE( 6 , FMTCI) ' M acro-elem ent l i s t row num ber: \ IMSG2 WRITE( 6 , FMTCH) ' M acro-elem ent number LE m ust be g r e a t e r ' WRITE( 6 , FMTCH) ' th a n z e ro and l e s s th a n o r e q u a l t o NELMC' C ELSEIF (IERRO .EQ. LERRO = .TRUE. WRITE( 6 , FMTCI) ' WRITE( 6 , FMTCI) ' WRITE( 6 , FMTCH) ' WRITE(6,FMTCH) '

7) THEN LNOMC(IN.LM): ' , IMSG1 M acro-elem ent number LM: ' , IMSG2 C o n n e ctio n s m a lle r th a n z e ro o r ' g r e a t e r th a n NELMC'

C ELSEIF (IERRO .EQ. 8) THEN LERRO = TRUE. WRITE( 6 , FMTCH) ' NGAU1: th e number o f Gauss i n t e g r a t i o n ' WRITE( 6 , FMTCH) ' p o i n t s m ust be 2 o r 3 f o r l i n e a r e le m e n ts ' WRITE( 6 , FMTCH) ' (ITYPE=1) and 3 f o r p a r a b o l ic e le m e n ts ' WRITE( 6 , FMTCH) ' (ITYPE=2)' C ELSEIF (IERRO .EQ. 9) THEN LERRO = .TRUE. WRITE( 6 , FMTCI) ' IAXIS: ' , IMSG1 WRITE( 6 , FMTCH) ' The v a lu e o f IAXIS m ust be b etw een 0 and 2 ' C ELSE LERRO = .FALSE. ENDIF C READBC C ---- E r r o r s i n s u b r o u tin e C ELSEIF (ISUBR .EQ. 2) THEN WRITE( 6 , FMTCH) 'O In p u t d a ta e r r o r d e te c t e d i n r o u t i n e READBC:' C IF (IERRO .EQ. 1) THEN LERRO = TRUE WRITE( 6 , FMTCI) ' M acro-elem ent No. IM: ' , IMSG1 WRITE( 6 , FMTCI) 'S id e s w ith 1 s t k in d b . c . N SID l(IM ): ' , IMSG2 WRITE( 6 , FMTCH) ' The number o f s i d e s NSIDl(IM) on w h ic h ' WRITE( 6 , FMTCH) ' 1 s t k in d b . c . a r e a p p lie d m ust be g r e a t e r ' WRITE(6,FMTCH) ' th a n 0 and l e s s th a n o r e q u a l t o MSIMC' C ELSEIF (IERRO .EQ. 2) THEN LERRO = TRUE WRITE( 6 , FMTCI) ' M acro-elem ent No. IM: \ IMSG1 WRITE( 6 , FMTCI) ' S id e number LS: ' , IMSG2 WRITE( 6 , FMTCH) ' The i d e n t i f i c a t i o n number LS o f t h e ' WRITE( 6 , FMTCH) ' s i d e on w hich 1 s t k in d b . c . a r e a p p li e d ' WRITE( 6 , FMTCH) ' m ust be g r e a t e r th a n 0 and l e s s th a n ' WRITE( 6 , FMTCH) ' o r equal to 4 '

4 13

414

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

C ELSEIF (IERRO .EQ. LERRO = TRUE. WRITE( 6 , FMTCI) ' WRITE( 6 , FMTCI) 1 WRITE(6,FMTCH) * WRITE( 6 , FMTCH) ' WRITE( 6 , FMTCH) '

3) THEN M acro-elem ent No. IM: ' , IMSG1 S id e s w ith 2nd k in d b . c . NSID2(IM): ' , IMSG2 The number o f s i d e s NSID2(IM) on w h ic h ' 2nd k in d b . c . a r e a p p lie d m ust be g r e a t e r ' th a n 0 and l e s s th a n o r e q u a l t o MSIMC'

C ELSEIF (IERRO .EQ. LERRO = TRUE WRITE( 6 , FMTCI) ' WRITE( 6 , FMTCI) ' WRITE( 6 , FMTCH) ' WRITE( 6 , FMTCH) ' WRITE( 6 , FMTCH) ' WRITE( 6 , FMTCH) ' C

C

C

4) THEN M acro-elem ent No. IM: ' , IMSG1 S id e number LS: ' , IMSG2 The i d e n t i f i c a t i o n number LS o f t h e ' s i d e on w hich 2nd k in d b . c . a r e a p p li e d ' m ust be g r e a t e r th a n 0 and l e s s th a n ' o r eq u al to 4 '

ELSEIF (IERRO .Eq. 5) LERRO = .TRUE. WRITE( 6 , FMTCI) WRITE( 6 , FMTCI) WRITE( 6 , FMTCH) WRITE(6,FMTCH) WRITE(6,FMTCH)

' ' ' ' '

ELSEIF (IERRO .EQ. LERRO = TRUE WRITE( 6 , FMTCI) ' WRITE( 6 , FMTCI) ' WRITE( 6 , FMTCH) ' WRITE( 6 , FMTCH) ' WRITE(6,FMTCH) ' WRITE( 6 , FMTCH) '

THEN

M acro-elem ent No. IM: ' , IMSG1 S id e s w ith 3 rd k in d b . c . NSID3(IM): ' , IMSG2 The number o f s i d e s NSID3(IM) on w h ic h ' 3 rd k in d b . c . a r e a p p lie d m ust be g r e a t e r ' th a n 0 and l e s s th a n o r e q u a l t o MSIMC' 6) THEN M acro-elem ent No. IM: ' , IMSG1 S id e number LS: ' , IMSG2 The i d e n t i f i c a t i o n number LS o f t h e ' s i d e on w hich 3 rd k in d b . c . a r e a p p lie d ' m ust be g r e a t e r th a n 0 and l e s s th a n ' o r equal to 4 '

ELSE LERRO = .FALSE. ENDIF C ELSE WRITE(6,FMTCI) ' ISUBR:' , ISUBR WRITE( 6 , FMTCH) ' S u b ro u tin e code n o t fo u n d i n r o u t i n e IN ERR ! ' ENDIF C IF (.NOT. LERRO) THEN WRITE(6,FMTCI) ' IERRO: ' , IERRO WRITE( 6 , FMTCH) ' E r r o r code n o t fo u n d . U pdate s u b r o u tin e IN ERR' ENDIF C C ----- S to p t h e e x e c u tio n o f th e program C CALL STOP ('JO B ABORTED#') C END C C ====================================================================== C S u b ro u tin e BANNER p r i n t s th e h e a d in g o f th e o u tp u t f i l e C ====================================================================== C SUBROUTINE BANNER C CHARACTERS STARS, BLANK CHARACTERS FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, k FMTMX, FMTMP COMMON /IOFMT/ k FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, FMTMX, FMTMP C C ------------------------------------------------------------------------------------------------------------------------C STARS = ' ************************************************* BLANK = ' * *> C C ----- P r i n t t h e h e a d in g o f th e o u tp u t f i l e WRITE(6,FMTCH) STARS WRITE( 6 , FMTCH) BLANK WRITE( 6 , FMTCH) ' * WRITE( 6 , FMTCH) ' * WRITE( 6 , FMTCH) ' * WRITE(6,FMTCH) ' *

Program TRAN_MG f o r th e c r e a t i o n o f f i l e s *.GD and *.BD r e q u ir e d by program TRAN_2D (V e rs io n : FEM-HT)

*' *' *' *'

APPENDIX A: AUTOMATIC MESH GENERATION

WRITE( 6 , FMTCH) BLANK WRITE( 6 , FMTCH) STARS WRITE(6,FMTCH) ' » C RETURN END C C ======================================================================

C S u b r o u tin e RWLINE r e a d s said p r i n t s a l i n e o f th e in p u t f i l e C ====================================================================== C SUBROUTINE RWLINE C CHARACTERS LINE CHARACTER*30 FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, ft FMTMX, FMTMP COMMON /IOFMT/ ft FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, FMTMX, FMTMP C C ------------------------------------------------------------------------------------------------------------------------C C ----- Read and p r i n t a l i n e C READ ( 5 , FMTCH) LINE WRITE( 6 , FMTCH) LINE C RETURN END C C ======================================================================

C S u b ro u tin e STOP w r i t e s a m essage and s to p s t h e e x e c u tio n C ====================================================================== C SUBROUTINE STOP (MESSG) C CHARACTERS MESSG CHARACTER*30 FMTCH DATA FMTCH / ’ (A )’/ C C ------------------------------------------------------------------------------------------------------------------------C C ---- W rite t h e m essage C LL = INDEX (MESSG,'# 0 - 1 WRITE( 6 , FMTCH) '0==== ' / /MESSG( 1 : LL)/ / ' ====' C C ---- S to p t h e e x e c u tio n o f t h e program C STOP C END C C ====================================================================== C B lock d a ta FORMAT i n i t i a l i z e s th e c h a r a c t e r v a r i a b l e s c o n ta in in g t h e C fo rm a ts f o r in p u t and o u tp u t C ====================================================================== C BLOCK DATA FORMAT C CHARACTERS FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, ft FMTMX, FMTMP COMMON /IOFMT/ ft FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, FMTMX, FMTMP C DATA FMTCH / ' ( A ) ' / DATA FMTCE / ' (5 (A ,E 1 2 .4 ,3 X )) ' / DATA FMTCI / ' ( 5 ( A ,I 5 ,3 X ) ) »/ DATA FMTCM / ' ( 5 ( A ,I 5 ,E 1 2 .4 ,3 X ) ) V DATA FMTEX / ’ ( 5 E 1 2 .4 W DATA FMTIE /> ( I 5 .5 E 1 2 .4 ) V DATA FMTIN / ' ( 1 0 I 5 ) ' / DATA FMTMX / ' ( 5 ( 1 5 , E 1 2 .4 ) ) ' / DATA FMTMP / * ( 5 ( 1 5 ,E 1 5 . 6 ) ) ' / C END C C ====================================================================== C S u b ro u tin e BCFRST s p e c i f i e s bo u n d ary c o n d itio n s o f t h e f i r s t k in d C ====================================================================== C SUBROUTINE BCFRST (M PO IN , MELEM, MNODE, MELMC, M SIM C, M DIV S,

415

416

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

ft ft ft

NELMC, NPOIN, NNODE, LNODE, NSID1, ISID 1, PHIPR, LSIEL, NDEXI, NDETA, IE IN I, NPPHI, LPPHI, PRPHI)

C DIMENSION ft NSID1(MELMC), ft LNODE(MNODE,MELEM), ft LSIEL(MDIVS),

ISID1(MSIMC,MELMC), IEINI(MELMC), LPPHI(MPOIN),

DIMENSION ft L SN 0L (2,4),

LSN0P(3,4)

PHIPR(MSIMC,MELMC), NDEXI(MELMC), PRPHI(MPOIN)

C C DATA LSNOL / l , 2 , 2 , 3 , 4 , 3 , 1, 4 / DATA LSNOP / l , 2 , 3 , 3 , 4 , 5 , 7 , 6 , 5 , 1, 8 , 7 / C

c -----------------------------------------------------------------------------------------

c C ---- Number o f nodes on each s id e C IF (NNODE .EQ .4 ) THEN NSINO = 2 ELSE NSINO = 3 ENDIF C C ---- Loop o v e r th e m ac ro -ele m e n ts C DO IM = 1 , NELMC C C -------- P re p a re th e l i s t o f nodes f o r s p e c i f i c a t i o n o f f i r s t k in d b . c . IF (NSIDl(IM ) .GT. 0) THEN C C ----------- Loop o v e r m ac ro -ele m e n t s i d e s C NSIDE = NSIDl(IM) DO IS = 1 , NSIDE C C --------------- F in d l i s t o f e le m e n ts a d ja c e n t t o th e s id e ISIDE = IS ID 1(IS ,IM ) CALL SIDELS (MDIVS, NDEXI(IM), NDETA, IE IN I(IM ), ISIDE, NSIEL, LSIEL)

& C C --------------- F in d nodes w ith f i r s t k in d b . c . C DO IB = 1 ,NSIEL C IE = LSIEL(IB) DO I I = l.N SIN O -l C IF (NNODE .EQ .4 ) THEN IN = LSNOLCII,ISIDE) ELSE IN = L SN 0P(II,ISID E ) ENDIF C IP = LNODE(IN,IE) LPPH I(IP) = 1 PRPHI(IP) = PH IPR(IS,IM ) C ENDDO C IF (NNODE .EO .4 ) THEN IN = LSN0L(NSIN0,ISIDE) ELSE IN = LSNOP(NSINO,ISIDE) ENDIF IP = LNODE(IN,IE) LPPH I(IP) = 1 PRPHI(IP) = PHIPR(IS,IM ) C ENDDO C C ----------- End o f lo o p o v e r m acro -elem en t s id e s C ENDDO C ENDIF C C ---- End o f lo o p o v e r m a c ro -ele m e n ts

APPENDIX A: AUTOMATIC MESH GENERATION

C ENDDO C C ----- Reduce v e c t o r s l o r t h e s p e c i f i c a t i o n o f f i r s t k in d b . c . C IX = 0 DO IP = 1 , NPOIN C IF (L PPH I(IP) .NE. 0) THEN IX = IX + 1 LPPHI(IX) = IP PRPHI(IX) = PRPHI(IP) ENDIF C ENDDO C NPPHI = IX C RETURN END C C ====================================================================== C S u b ro u tin e BCSCND s p e c i f i e s b oundary c o n d itio n s o f th e seco n d k in d C ====================================================================== C SUBROUTINE BCSCND (MELEM, MELMC, MSIMC, MSFLX, MDIVS, NELMC, ft NSID2, ISID 2, FLXPR, LSIEL, NDEXI, NDETA, ft IE IN I, NELEM, NEFLX, KSFLX, LSFLX, FLXLS) C DIMENSION ft NSID2(MELMC), ISID2(MSIMC, MELMC), FLXPR(MSIMC,MELMC), ft IEINI(MELMC), NDEXI(MELMC), LSIEL(MDIVS), ft KSFLX(MELEM), LSFLX(MSFLX,MELEM), FLXLS(MSFLX,MELEM) C C ------------------------------------------------------------------------------------------------------------------------C C ---- Loop o v e r t h e m a c ro -e le m e n ts C DO IM = 1 , NELMC C C -------- P r e p a re l i s t o f nodes f o r s p e c i f i c a t i o n o f seco n d k in d b . c . C IF (NSID2(IM) .GT. 0) THEN C C ------------Loop o v e r m ac ro -ele m e n t s i d e s C NSIDE = NSID2(IM) DO IS = 1 , NSIDE C C --------------- F in d l i s t o f e le m e n ts a d ja c e n t t o th e s id e C ISIDE = IS ID 2 (IS ,IM ) CALL SIDELS (MDIVS, NDEXI(IM), NDETA, IE IN I(IM ), ISIDE, ft NSIEL, LSIEL) C C --------------- A ssig n p r e s c r i b e d f l u x on th e e le m en t s i d e C DO IB = 1 , NSIEL C IE = LSIEL(IB) KSFLX(IE) = KSFLX(IE) + 1 I I = KSFLX(IE) L SFL X (II, IE ) = ISIDE FL X L S(II, IE ) = FLXPR(IS,IM) C ENDDO C C ----------- End o f lo o p o v e r m ac ro -ele m e n t s i d e s C ENDDO C ENDIF C C ---- End o f lo o p o v e r m a c ro -e le m e n ts C ENDDO C C ---- C o u n t e l e m e n t s w i t h s i d e s o n w h ic h s e c o n d k i n d b o u n d a r y C c o n d itio n s a re s p e c if ie d C IB = 0

417

418

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

DO IE = 1 , NELEM C IF (KSFLX(IE) .NE. 0) IB = IB + 1 C ENDDO C NEFLX = IB C RETURN END C C ======================================================================

C

S u b ro u tin e BCTHRD s p e c i f i e s boundary c o n d itio n s o f th e t h i r d k in d

C ======================================================================

c ft ft ft

SUBROUTINE BCTHRD (MELEM, NSID3, NDETA, HCVLS,

MELMC, MSIMC, MSCNV, MDIVS, NELMC, ISID 3, HCONV, PHICV, LSIEL, NDEXI, IE IN I, NELEM, NECNV, KSCNV, LSCNV, PHILS)

C DIMENSION ft NSID3(MELMC), ft PHICV(MSIMC,MELMC), ft LSIEL(MDIVS), ft HCVLS(MSCNV,MELEM),

ISID3(MSIMC,MELMC), IEINI(MELMC), KSCNV(MELEM), PHILS(MSCNV,MELEM)

HCONV(MSIMC,MELMC), NDEXI(MELMC), LSCNV(MSCNV,MELEM),

C C ------------------------------------------------------------------------------------------------------------------------C C ----- Loop o v e r t h e m ac ro -ele m e n ts C DO IM = 1 , NELMC C C -------- P r e p a re l i s t o f nodes f o r s p e c i f i c a t i o n o f second k in d b . c . C IF (NSID3(IM) .GT. 0) THEN C C ------------Loop o v e r m ac ro -ele m e n t s i d e s C NSIDE = NSID3(IM) DO IS = 1 , NSIDE C C --------------- F in d t h e l i s t o f e le m e n ts a d ja c e n t t o th e s id e o f th e C m ac ro -ele m e n t C ISIDE = IS ID 3 (IS ,IM ) CALL SIDELS (MDIVS, NDEXI(IM), NDETA, IE IN I(IM ), ISIDE, ft NSIEL, LSIEL) C C --------------- A ssig n p r e s c r i b e d f l u x on th e elem en t s id e C DO IB = 1 , NSIEL C IE = LSIEL(IB) KSCNV(IE) = KSCNV(IE) + 1 I I = KSCNV(IE) LSCNV(II, IE ) = ISIDE HCV LS(II,IE) = HCONV(IS,IM) P H IL S (II, IE ) = PHICV(IS,IM) C ENDDO C C ------------End o f lo o p o v e r m ac ro -ele m e n t s id e s C ENDDO C ENDIF C C ----- End o f lo o p o v e r m a c ro -e le m e n ts C ENDDO C C ----- Count e le m e n ts w ith s i d e s on w hich second k in d boundary C c o n d itio n s a r e s p e c i f i e d C IB = 0 DO IE = 1 , NELEM C IF (KSCNV(IE) .NE. 0) IB = IB + 1 C ENDDO C

APPENDIX A: AUTOMATIC MESH GENERATION

NECNV = IB C RETURN END C C ======================================================================

C S u b ro u tin e SIDELS f i n d s a l i s t o f e le m e n ts a d ja c e n t t o one s i d e o f a C m ac ro -ele m e n t C ====================================================================== C SUBROUTINE SIDELS (MDIVS, NDEXI, NDETA, IE IN I, ISID E, NSIEL, ft LSIEL) C DIMENSION ft LSIEL(MDIVS) C C ------------------------------------------------------------------------------------------------------------------------C C ---- L i s t o f e le m e n ts a lo n g s i d e number 1 o f th e m ac ro -ele m e n t C IF (ISID E .EQ. 1) THEN DO ID = 1, NDEXI LSIEL(ID) = IE IN I + (ID-1)*NDETA + 1 ENDDO NSIEL = NDEXI C C ----- L i s t o f e le m e n ts a lo n g s i d e number 2 o f th e m ac ro -ele m e n t C ELSEIF (ISID E .EQ. 2) THEN DO ID = 1, NDETA LSIEL(ID) = IE IN I + ( NDEXI-1)*NDETA + ID ENDDO NSIEL = NDETA C C ---- L i s t o f e le m e n ts a lo n g s i d e number 3 o f th e m ac ro -ele m e n t C ELSEIF (ISID E .EQ. 3) THEN DO ID = 1, NDEXI LSIEL(ID) = IE IN I + ID*NDETA ENDDO NSIEL = NDEXI C C ---- L i s t o f e le m e n ts a lo n g s i d e number 4 o f th e m ac ro -ele m e n t C ur c r

DO ID = 1, NDETA LSIEL(ID) = IE IN I + ID ENDDO NSIEL = NDETA C ENDIF C RETURN END C C ====================================================================== C S u b ro u tin e WRBOUN w r i t e s b oundary c o n d itio n s i n f i l e JNAME.BD C ====================================================================== C SUBROUTINE WRBOUN (TITLE, MPOIN, MELEM, MSFLX, MSCNV, NELEM, ft NPPHI, LPPHI, PRPHI, NEFLX, KSFLX, LSFLX, ft FLXLS, NECNV, KSCNV, LSCNV, HCVLS, PHILS) C CHARACTER*65 TITLE CHARACTERS FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, ft FMTMX, FMTMP COMMON /IOFMT/ ft FMTCH, FMTCI, FMTCE, FMTCM, FMTEX, FMTIE, FMTIN, FMTMX, FMTMP C DIMENSION ft LPPHI(MPOIN), PRPHI(MPOIN), KSFLX(MELEM), ft LSFLX(MSFLX,MELEM), FLXLS(MSFLX,MELEM), KSCNV(MELEM), ft LSCNV(MSCNV,MELEM), HCVLS(MSCNV,MELEM), PHILS(MSCNV,MELEM) C C ------------------------------------------------------------------------------------------------------------------------C WRITE( 2 , FMTCH) ' OBOUNDARY CONDITIONS: '//T IT L E C C ---- W rite f i r s t k in d boundary c o n d itio n s C WRITE(2,FMTCH) 'ONumber o f nodes w ith f i r s t k in d b . c . '

419

420

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

WRITE(2,FMTIN) NPPHI IF (NPPHI .GT. 0) THEN C WRITE(2,FMTCH) 'ONode num bers / p r e s c r i b e d v a l u e s ' WRITE(2,FMTIN) (L P P H I(IX ),IX = 1, NPPHI) WRITE(2,FMTEX) (PR P H I(IX ),IX = 1, NPPHI) C ENDIF C C ----- W rite seco n d k in d b oundary c o n d itio n s C WRITE( 2 , FMTCH) 'ONumber o l e le m e n ts w ith second k in d b . c . ' WRITE(2,FMTIN) NEFLX IF (NEFLX .GT. 0) THEN C TITLE = 'O E l.N o ., number o f f a c e s / f a c e N o., p r e s c r . f l u x ' WRITE(2,FMTCH) TITLE DO IE = 1 , NELEM C IF(KSFLX(IE) .GT. 0) THEN NSFLX = KSFLX(IE) WRITE(2,FMTIN) IE , NSFLX DO I I = 1 ,NSFLX WRITE(2,FMTIE) L SFL X (II, I E ) , F L X L S (II,IE ) ENDDO ENDIF C ENDDO C ENDIF C C ----- W rite t h i r d k in d b oundary c o n d itio n s C WRITE( 2 , FMTCH) 'ONumber o f e le m e n ts w ith t h i r d k in d b . c . ' WRITE(2,FMTIN) NECNV IF (NECNV .GT. 0) THEN C TITLE = 'O E l.N o ., number o f f a c e s / f a c e N o., c v . c o e f . , c v . p o t . ' WRITE(2,FMTCH) TITLE DO IE = 1 , NELEM C IF(KSCNV(IE) .GT. 0) THEN NSCNV= KSCNV(IE) WRITE(2,FMTIN) IE , NSCNV DO I I = 1 , NSCNV WRITE(2,FMTIE) L S C N V (II.IE ), HCVLS(II, I E ) , P H IL S (II.IE ) ENDDO ENDIF C ENDDO C ENDIF C RETURN END

A .5 EX A M PLE S OF IN P U T FILES FOR M ESH G E N ER A T IO N Program TRAN_MG has been used to generate the two-dimensional meshes employed in some of the worked-out examples of this book. The input files, which have extension .MIN, are reported below.

APPENDIX A: AUTOMATIC MESH GENERATION

F ile E X _615.M IN 2-D s t e a d y - s t a t e c o n d u c tio n i n a homogeneous w a ll Number o l m ac ro -ele m e n t p o i n t s , number o f m a c ro -e le m e n ts 4 1 M acro -elem en t t y p e , e le m en t ty p e 1 2 C o o rd in a te s o f th e m ac ro -ele m e n t nodes 1 0.5000E+00 0.0000E+00 2 0.5000E+00 0.5000E+00 3 0 . 1000E+01 0.0000E+00 4 0 . 1000E+01 0 . 1000E+01 S h i f t f a c t o r s / s c a le f a c t o r s t o m odify c o o r d in a te s 0 . 0000E+00 0 . 0000E+00 0 . 1000E+01 0 . 1000E+01 M acro -elem en t l i s t o f nodes 1 1 3 4 2 Number o f mesh s u b d i v i s i o n s i n EXI d i r e c t i o n / w e ig h ts 4 0.4500E+01 0.6000E+01 0.7000E+01 0.7500E+01 Number o f mesh s u b d iv is io n s in ETA d i r e c t i o n / w e ig h ts 4 0 . 1000E+01 0 . 1000E+01 0.1000E+01 0.1000E+01 Number o f G auss p o i n t s [ 2 - 3 ] , in d ex f o r a x isy m m e tric p ro b lem s [0 -2 ] 3 0 0B0UNDARY CONDITIONS FOR MACRO-ELEMENT No. 1 Number o f s i d e s w ith 1 s t k in d b oundary c o n d itio n s 2 S id e in d e x , p r e s c r i b e d v a lu e 2 0 . 6000E+02 4 0 . 6000E+03 Number o f s i d e s w ith 2nd k in d b oundary c o n d itio n s 0 Number o f s i d e s w ith 3 rd k in d b oundary c o n d itio n s 0

File EX—616.M IN A x ia l v e l o c i t y d i s t r i b u t i o n i n a r e c t a n g u l a r d u c t Number o f m ac ro -e le m e n t p o i n t s , number o f m a c ro -e le m e n ts 4 1 M acro -elem en t t y p e , ele m en t ty p e 1 2 C o o rd in a te s o f t h e m ac ro -ele m e n t nodes 1 0.0000E+00 0 . 0000E+00 2 0.0000E+00 0 . 5000E-02 3 0 . 1000E-01 0.0000E+00 4 0 . 1000E-01 0 . 5000E-02 S h i f t f a c t o r s / s c a l e f a c t o r s t o m odify c o o r d in a te s 0 . 0000E+00 0 . 0000E+00 0 . 1000E+01 0 . 1000E+01 M acro-elem ent l i s t o f nodes 1 1 3 4 2 Number o f mesh s u b d i v i s i o n s i n EXI d i r e c t i o n / w e ig h ts 8 0 . 8500E+01 0 . 8500E+01 0.8000E+01 0.7000E+01 0.6000E+01 0 . 5000E+01 0 . 4000E+01 0.3000E+01 Number o f mesh s u b d i v i s i o n s i n ETA d i r e c t i o n / w e ig h ts 5 0.7000E+01 0 . 6000E+01 0.5000E+01 0.4000E+01 0.3000E+01 Number o f Gauss p o i n t s [ 2 - 3 ] , in d e x f o r a x isy m m e tric p ro b lem s [0 -2 ] 3 0 0B0UNDARY CONDITIONS FOR MACRO-ELEMENT No. 1 Number o f s i d e s w ith 1 s t k in d b o u ndary c o n d itio n s 2 S id e in d e x , p r e s c r i b e d v a lu e 2 0 . 0000E+00 3 0 . 0000E+00 Number o f s i d e s w ith 2nd k in d b o u ndary c o n d itio n s 0 N u m b er o f s i d e s w i t h 3 r d k i n d b o u n d a r y c o n d i t i o n s 0

421

42 2

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

File E X _617.M IN T r a n s ie n t c o n d u c tio n i n c y l i n d r i c a l canned fo o d s Number o f m ac ro -ele m e n t p o i n t s , number o f m ac ro -ele m e n ts 4 1 M acro-elem ent t y p e , ele m en t ty p e 1 2 C o o r d in a te s o f th e m ac ro -ele m e n t nodes 1 0 . 0000E+00 0.0000E+00 2 0 . 0000E+00 0.3500E -01 3 0 . 3500E-01 0.0000E+00 4 0 . 3500E-01 0 . 3500E-01 S h i f t f a c t o r s / s c a le f a c t o r s t o m odify c o o r d in a te s 0 . 0000E+00 0 . 0000E+00 0 . 1000E+01 0 . 1000E+01 M acro-elem ent l i s t o f nodes 1 1 3 4 2 Number o f mesh s u b d iv is io n s i n EXI d i r e c t i o n / w e ig h ts 5 0 . 9000E+01 0.8000E+01 0.7000E+01 0.6000E+01 0.5000E+01 Number o f mesh s u b d iv is io n s i n ETA d i r e c t i o n / w e ig h ts 5 0.9000E+01 0 . 8000E+01 0.7000E+01 0.6000E+01 0.5000E+01 Number o f Gauss p o i n t s [ 2 - 3 ] , in d ex f o r a x isy m m e tric pro b lem s [0 -2 ] 3 1 0B0UNDARY CONDITIONS FOR MACRO-ELEMENT No. 1 Number o f s i d e s w ith 1 s t k in d boundary c o n d itio n s 2 S id e in d e x , p r e s c r i b e d v a lu e 2 0 . 1100E+03 3 0 . 1100E+03 Number o f s i d e s w ith 2nd k in d boundary c o n d itio n s 0 Number o f s i d e s w ith 3 rd k in d boundary c o n d itio n s 0

File E X -7 10.M IN T h e rm a lly d e v e lo p in g flo w i n a f l a t d u c t Number o f m ac ro -ele m e n t p o i n t s , number o f m ac ro -ele m e n ts 4 1 M acro-elem ent t y p e , e le m en t ty p e 1 2 C o o rd in a te s o f th e m ac ro -ele m e n t nodes 1 0 . 0000E+00 0 . 0000E+00 2 0 . 0000E+00 0.5000E+00 3 0.4000E+01 0.0000E+00 4 0.4000E+01 0.5000E+00 S h i f t f a c t o r s / s c a l e f a c t o r s t o m odify c o o r d in a te s 0 . 0000E+00 0 . 0000E+00 0 . 1000E+01 0 . 1000E+01 M acro -elem en t l i s t o f nodes 1 1 3 4 2 Number o f mesh s u b d iv is io n s in EXI d i r e c t i o n / w e ig h ts 7 0 . 1200E+01 0.2300E+01 0.4500E+01 0.8000E+01 0.1600E+02 0.3200E+02 0 . 6400E+02 Number o f mesh s u b d iv is io n s i n ETA d i r e c t i o n / w e ig h ts 5 0 . 5000E+01 0.4000E+01 0.3000E+01 0.2000E+01 0.1250E+01 Number o f Gauss p o i n t s [ 2 - 3 ] , in d ex f o r a x isy m m e tric pro b lem s [0 -2 ] 3 0 0B0UNDARY CONDITIONS FOR MACRO-ELEMENT No. 1 Number o f s i d e s w ith 1 s t k in d b oundary c o n d itio n s 2 S id e in d e x , p r e s c r i b e d v a lu e 4 0 . 1000E+01 3 0.0000E+00 Number o f s i d e s w ith 2nd k in d boundary c o n d itio n s 0 N um ber o f s i d e s w ith 3 r d k in d b o u n d a ry c o n d i ti o n s 0

APPENDIX A: AUTOMATIC MESH GENERATION

F ile E X -7 1 3 .M IN D is p e r s io n o f a p o l l u t a n t Number o f m ac ro -ele m e n t p o i n t s , number o f m a c ro -e le m e n ts 23 4 M acro-elem ent t y p e , e le m en t ty p e 2 2 C o o rd in a te s o f t h e m ac ro -ele m e n t nodes 1 -0.5000E + 00 0.0000E+00 2 - 0 . 1000E+01 0 . 0000E+00 3 - 0 . 1500E+01 0.0000E+00 4 -0.4619E + 00 0 . 1913E+00 5 - 0 . 1500E+01 0 . 1000E+01 6 - 0 . 3536E+00 0.3536E+00 7 - 0 . 9268E+00 0.1177E+01 8 - 0 . 1500E+01 0.2000E+01 9 - 0 . 1913E+00 0.4619E+00 10 - 0 . 7500E+00 0 . 2000E+01 11 0.0000E+00 0 . 5000E+00 12 0.0000E+00 0 . 1250E+01 13 0.0000E+00 0 . 2000E+01 14 0 . 1913E+00 0.4619E+00 15 0 . 1250E+01 0 . 2000E+01 16 0 . 3536E+00 0.3536E+00 17 0 . 1427E+01 0 . 1177E+01 18 0 . 2500E+01 0 . 2000E+01 19 0.4619E+00 0 . 1913E+00 20 0.2500E+01 0 . 1000E+01 21 0 . 5000E+00 0 . 0000E+00 22 0 . 1500E+01 0 . 0000E+00 23 0 . 2500E+01 0.0000E+00 S h i f t f a c t o r s / s c a le f a c t o r s t o m odify c o o r d in a te s 0 . 0000E+00 0 . 0000E+00 0 . 1000E+01 0 . 1000E+01 M acro-elem ent l i s t o f nodes 1 1 4 6 7 8 5 3 2 2 6 9 11 12 13 10 8 7 3 11 14 16 17 18 15 13 12 4 16 19 21 22 23 20 18 17 Number o f mesh s u b d i v i s i o n s i n EXI d i r e c t i o n / w e ig h ts 3 0 . 1000E+01 0 . 1000E+01 0.1000E+01 3 0 . 1000E+01 0 . 1000E+01 0.1000E+01 3 0 . 1000E+01 0 . 1000E+01 0.1000E+01 3 0 . 1000E+01 0 . 1000E+01 0.1000E+01 Number o f mesh s u b d i v i s i o n s i n ETA d i r e c t i o n / w e ig h ts 4 0 . 1000E+01 0 . 2000E+01 0.3000E+01 0.4000E+01 Number o f Gauss p o i n t s [ 2 - 3 ] , in d e x f o r a x isy m m e tric p ro b lem s [0 -2 ] 3 0 0B0UNDARY CONDITIONS FOR MACRO-ELEMENT No. 1 Number o f s i d e s w ith 1 s t k in d bo u n d ary c o n d itio n s 2 S id e in d e x , p r e s c r i b e d v a lu e 1 0 . 1000E+01 3 0 . 0000E+00 Number o f s i d e s w ith 2nd k in d b oundary c o n d itio n s 0 Number o f s i d e s w ith 3 rd k in d b o u ndary c o n d itio n s 0 0B0UNDARY CONDITIONS FOR MACRO-ELEMENT No. 2 Number o f s i d e s w ith 1 s t k in d b o u ndary c o n d itio n s 1 S id e in d e x , p r e s c r i b e d v a lu e 1 0 . 1000E+01 Number o f s i d e s w ith 2nd k in d b o u ndary c o n d itio n s 0 Number o f s i d e s w ith 3 rd k in d b o u ndary c o n d itio n s 0 0B0UNDARY CONDITIONS FOR MACRO-ELEMENT No. 3 Number o f s i d e s w ith 1 s t k in d b oundary c o n d itio n s 1 S id e in d e x , p r e s c r i b e d v a lu e 1 0 . 1000E+01 Number o f s i d e s w ith 2nd k in d b oundary c o n d itio n s 0 N u m b er o f s i d e s w i t h 3 r d k i n d b o u n d a r y c o n d i t i o n s 0

4 23

424

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

OBOUNDARY CONDITIONS FOR MACRO-ELEMENT No. 4 Number o f s i d e s v i t h 1 s t k in d boundary c o n d itio n s

1

S id e in d e x , p r e s c r i b e d v a lu e 1 0 . 1000E+01 Number o f s i d e s w ith 2nd k in d boundary c o n d itio n s

0

Number o f s i d e s w ith 3 rd k in d boundary c o n d itio n s 0

R E FE R E N C E S 1. E. Hinton and D.R.J. Owen, An Introduction to Finite Element Computations, Pineridge Press, Swansea, 1979.

APPENDIX

B MESH AND CONTOUR PLOTS

B .l P R O G R A M T R A N _P L Program TRAN_PL is a program for plotting two-dimensional finite element meshes and contour lines. Coordinates of points to be reached by the pen during the plotting procedure and appropriate flags indicating the pen position (up or down) are written to an intermediate file, which is device independent. Then, to obtain the graphic output on different devices, specific programs must be written by the user. The procedure for plotting linear meshes is much simpler than that required for plotting parabolic meshes. With linear meshes, consecutive nodes in the node list of each element are simply connected by straight lines. With parabolic meshes, to account for possible side curvatures, each element side must be subdivided into small segments, whose end points are connected by straight lines. The boundary of the domain must be plotted before the contour lines. All ele­ ment sides belonging to the boundary are first found and then plotted as described above, with reference to mesh plotting. Since sides of parabolic elements are univocally identified by their mid-side node, the list of sides on the boundary can be easily obtained by checking which mid-side nodes belong to one element only. Unfortunately, a similar correspondence cannot be established between nodes and element sides of a linear mesh, since, in this case, a side is identified by a couple of nodes. When dealing with linear meshes, a simple way to find the sides belonging to the boundary is to look for those sides whose nodes are shared by three elements at most. This procedure is not general, since it is guaranteed to work with structured meshes only, but it is consistent with the capabilities of the mesh generator program TRAN_MG described in Appendix A, and thus it is favored here. Contour plots are obtained as suggested in Reference 1 , employing the same inter­ polation and mapping techniques used by the finite element method. Contour points are first found at the parent element level, working in local coordinates £ and 7 7 , and then transformed into the Cartesian space. The curve representing a contour line must satisfy the equation (5.1) where N f are the shape functions, fa are the nodal values of the variable , (j> is the contour value, and r is the number of nodes in an element. If we consider one contour line at a time, the steps to find the contour points in each element can be summarized as follows: 1.

Cover the parent element with an automatically generated subgrid of rectangles whose dimensions are A£ = 2/n^ and A 77 = 2 /n n, where n$ and nv are the number of subdivisions in the £ and rj directions, determined according to the element size. 42 5

426

2

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

. Set rjk = —1 + k Arj with k = 0 ,n v, and calculate coordinates of points belonging to the contour line by solving for linear elements the equation ( 5 . 2)

where ( 5 . 3)

(5.5) and for parabolic elements the equation ( 5 . 6)

where ( 5 . 7) ( 5 .8)

( 5 . 9)

3.

4. 5.

6.

All point coordinates obtained from these solutions are collected in a buffer array B. Note that Eqs. (B.2) to (B.9) are obtained from Eq. (B .l) substituting the expressions of the shape functions and assuming the usual counterclockwise num­ bering sequence for the element nodes. Obviously, Eq. (B.2) yields one solution, while Eq. (B.6 ) has two solutions. Only real solutions in the range —1 < £ < 1 are acceptable. Exchange £ and rj in Eq. (B.2) to (B.9) and assume a clockwise numbering sequence for the element nodes. Then solve the equations for = —1 + k A^ with k = 0, thus finding a new set of contour point coordinates, which are also collected in the array B. Sort the array B by arranging the local coordinates of contour points according to increasing values of £ and, for equal £, according to increasing values of tj. Since, in general, not all contour points thus found belong to the same curve, and there could be at most four different branches of a contour in an element, collect the coordinates of the points belonging to each branch in four arrays, B i to B 4 . Assume that two points belong to the same branch if the distance between them is less than or equal to d0 = >/A £ 2 + Arj2. For each branch, calculate the Cartesian coordinates of the contour points, which must be connected by straight lines.

The computer code has been written in Standard ANSI Fortran 77 with the same extensions and the same programming style adopted for program TRAN_2D. The maximum sizes of the arrays depend on the values of the constants listed below in alphabetical order and defined by PARAMETER statements in the main segment of the program. The values used in this version of the program are reported in parentheses. M B R A N : maximum number of contour branches in an element (MBRAN=4). M B U F F : maximum number of point coordinates which can be collected in the buffer array (MBUFF=4*MPBRN). M C O N T : maximum number of contour values (MCQNT=50).

APPENDIX B: MESH AND CONTOUR PLOTS

427

M D M A X : maximum number of subdivisions in one direction for each element (MDMIN=50). M D M IN : minimum number of subdivisions in one direction for each element (MDMIN=4). M D T O T : maximum value of the total number of domain subdivisions in one direction (MDTC)T=500). MELEM : maximum number of elements (MELEM=950). M LCO R : number of local coordinates (MLC0R=2). M N O D E : maximum number of nodes in each element (M N0DE=8). M P B R N : maximum number of point coordinates in a branch of the contour [MPBRN=2*(NDMAX+1)]. M P O IN : maximum number of nodal points (MP()IN=1000). M SB O U : maximum number of sides on the boundary (MSB0U=MELEM+2). M SID E : maximum number of sides in an element (MSIDE=4). M SIN O : maximum number of nodes on an element side (MSIN0=3). M T Y P 2 : constant (MTYP2=2*MTYPE). M T Y P E : number element types (MTYPE=2).

B .2 V O C A B U L A R Y OF IN P U T VARIABLES In the following, names and meanings of all input variables used in program TRAN_PL are reported in alphabetical order. The maximum size of each array is also shown, as it appears in the corresponding DIMENSION statements of the computer code. CONTV(MCONT) : contour values (subroutine READIN). CORDX(MPOIN) : vector of nodal ^-coordinates (subroutine GEDATA). CORDY(MPOIN) : vector of nodal y-coordinates (subroutine GEDATA). G N A M E : name of the input file containing geometrical data (subroutine READIN). The maximum length of the file name is 40 characters. The extension .GD is always assumed. IM ESH : flag for plotting the finite element mesh or the contour lines. IMESH=0 : plot of contour lines; IMESH=1 : plot of the mesh. IT Y P E : element type, which determines the number NNODE of element nodes (sub­ routine READMC). ITYPE=1 : linear elements, NNODE=4; ITYPE=2 : parabolic elements, NNODE=8. LE : element identification number (subroutine GEDATA). LNODE(MNODE,MELEM) : array containing the list of nodes of each element (sub­ routine GEDATA). Nodes are listed in an counterclockwise sequence, starting from a corner node. LP : node identification number (subroutines GEDATA). N C O N T : number contour lines (subroutine READIN). NELEM : total number of elements (subroutine GEDATA). N P O IN : total number of nodal points (subroutine GEDATA). O N A M E : name of the output file (subroutine READIN). The maximum length of the file name is 40 characters. The extension .INT is always assumed. PHI(MPOIN) : vector containing the nodal values of the function to be plotted (sub­ routine READIN). P N A M E : name of the input file containing the nodal values of the function to be plotted (subroutine READIN). The maximum length of the file name is 40 characters. The extension .PHI is always assumed.

428

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

B .3 D E SC R IP T IO N OF IN P U T A N D O U T P U T The values of input variables are read in the order reported below. To increase ver­ satility, a list directed input (* format in the READ statements) is adopted in this program. All control data are read from the default input device (usually a terminal) in subroutine READIN. The following prompts will appear on the screen to guide the input. For the sake of clarity, the names of the appropriate input variables are reported under each prompt. > > > F i l e co n ta in in g geometry d a ta (*.GD): GNAM E > > > Contour l i n e s [0] , mesh [l] : IM ESH > > > Number of contour v alu es: NCONT > > > Contour v alu es: CONTV(IC) for IC=1 to NCONT > > > F i l e co n ta in in g valu es of PHI (*.PHI): PNAM E > > > Output f i l e (+.INT): ONAM E All data related to the geometry are read in subroutine GEDATA from file G NAM E//’.GD’. This file has the same structure required by program TRAN_2D, and, thus, can be generated using program TRAN.MG. The description of this part of the input is not reported here since it would coincide with that already given in Section 5.6 under the heading “Data concerning the geometry of the problem”. Nodal values of the function to be plotted are read from file PN A M E //’.PHI’ according to the following pattern < comment line > (LP, PHI(LP),

for IP=1 to NPOIN)

The output is contained in file ONAM E//’.INT’, which is an unformatted file, independent of the output device. The first record of the file contains the minimum and maximum values of the x and y Cartesian coordinates of the domain, X C M IN , X C M A X , Y C M IN , X C M A X These values are necessary to allow transformation into the coordinates of the graphic system. All the other records of the file contain a flag for the position of the plotter pen and the x and y Cartesian coordinates of the point to be reached, K D O W N , XPL O T , YPLO T In these records, KDOWN=0 means pen up, KDOWN=l means pen down. User written programs must read this file and produce an output conforming to the standards of the graphic device being employed. One such program, which generates a PostScript® file, is program DRAW_PS described in Section B.6.

“PostScript is a registered trademark of Adobe Systems Incorporated.2

APPENDIX B: MESH AND CONTOUR PLOTS

B .4 L IST IN G OF PR O G R A M T R A N _P L

c ====================================================================== c

c

C C C C C

======================================================================

Program TRAN_PL f o r t h e c r e a t i o n o f i n te r m e d i a t e f i l e s f o r p l o t t i n g f i n i t e e le m en t m eshes and c o n to u r l i n e s V e rs io n : FEM-HT ======================================================================

C ======================================================================

c PROGRAM TRAN_PL C PARAMETER (MP0IN=4500, MELEM=2000, MN0DE=8, MTYPE=2, ft MTYP2=2*MTYPE) PARAMETER (MSIDE=4, MSIN0=3, MSB0U=MELEM+2) C ft

PARAMETER (MDT0T=500, MBRAN=4,

MDMIN=4, MDMAX=40, MLC0R=2, MC0NT=50, MPBRN=2*(MDMAX+1), MBUFF=4*MPBRN)

C LOGICAL LBUFF C DIMENSION ft LNODE(MNODE,MELEM), ft NDIVS(MLCOR,MELEM), ft LSBOU(MSBOU),

CORDX(MPOIN), DIVIS(MLCOR,MELEM), NEBOU(MSBOU)

DIMENSION ft PHI(MPOIN), ft PHMXE(MELEM), ft NPBRN(MBRAN),

CONTV(MCONT), PHMNE(MELEM), BUFFR( MLCOR,MBUFF) , LBUFF(MBUFF), PBRAN(MLCOR,MPBRN,MBRAN)

DIMENSION ft SHAP2(MNODE), ft SHAP1(MSINO), ft ELPHI(MNODE), ft LNPHI(MNODE,MTYP2)

ELCOX(MNODE), ELCOY(MNODE), SICOX(MSINO), SICOY(MSINO), LSNOD(MSINO,MSIDE,MTYPE),

CORDY(MPOIN), NOFRQ(MPOIN),

C

C

C ft

COMMON /TOLER/ TOLOO, TOL1P, TOL1M, TOLRL

C DATA LSNOD / l , 2 , 0 , 2 , 3 , 0 , 4 , 3 , 0 , 1, 4 , 0 , ft 1, 2 , 3 , 3 , 4 , 5 , 7 , 6 , 5 , 1, 8 , 7 / C DATA LNPHI / l , 2 , ft 1, 4 , ft 1, 2 , ft 1, 8 ,

3, 3, 3, 7,

4, 2, 4, 6,

0, 0, 5, 5,

0, 0, 6, 4,

0, 0, 7, 3,

0, 0, 8, 2/

C DATA NOFRQ /MP0IN*0/ C C ------------------------------------------------------------------------------------------------------------------------C C ---- Read in p u t d a t a and open in p u t and o u tp u t f i l e s C CALL READIN (MPOIN, MELEM, MNODE, MCONT, NPOIN, NELEM, NNODE, ft NSINO, ITYPE, LNODE, CORDX, CORDY, PH I, IMESH, ft NCONT, CONTV) C C ---- F in d minimum and maximum c o o r d in a te s C CALL MIMAXY (MPOIN, NPOIN, CORDX, CORDY, DIMAX) C C ----- S e t t o l e r a n c e p a ra m e te r s C TOLOO = 0 .5 E -5 T0L1P = 1. + 0 .0 0 5 T0L1M = 1. - 0 .0 0 5 TOLRL = 0 .5 E -3 * DIMAX C C ---- D e term in e t h e e le m en t s u b g r id C IF(IMESH .EQ. 0 .OR. ITYPE .EQ. 2) ft CALL SBGRID (MPOIN, MELEM, MNODE, MLCOR, NELEM, ITYPE, LNODE, ft CORDX, CORDY, MDTOT, MDMIN, MDMAX, DIMAX, NDIVS, ft DIVIS) C IF (IMESH .EQ. 1) THEN C

4 29

430

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

C -------- P l o t t h e f i n i t e e le m en t mesh C CALL PLMESH (MPOIN, MELEM, MSIDE, MNODE, MSINO, MTYPE, ITYPE, ft NELEM, NSINO, LNODE, CORDX, CORDY, NDIVS, DIVIS, ft LSNOD, SICOX, SICOY, SHAP1) C ELSE C C -------- P l o t th e b oundary o f th e dom ain C CALL PLBOUN (MPOIN, MELEM, MNODE, MLCOR, MSINO, MSBOU, MSIDE, ft MTYPE, NELEM, NNODE, NSINO, ITYPE, LNODE, CORDX, ft CORDY, NDIVS, DIVIS, NOFRQ, LSBOU, NEBOU, LSNOD, ft SICOX, SICOY, SHAP1) C C -------- F in d minimum and maximum v a lu e s o f th e d e p en d e n t v a r i a b l e C i n e ach e le m en t C CALL MIMAPH (MPOIN, MELEM, MNODE, NELEM, NNODE, LNODE, PHI, ft PHMNE, PHMXE) C C -------- P l o t t h e c o n to u r l i n e s C CALL PLCONT (MPOIN, MELEM, MNODE, MTYP2, MLCOR, MBUFF, MPBRN, ft MBRAN, MCONT, MDMAX, NELEM, NNODE, ITYPE, LNODE, ft CORDX, CORDY, LNPHI, NDIVS, DIVIS, PHI, BUFFR, ft LBUFF, NPBRN, PBRAN, NCONT, CONTV, PHMNE, PHMXE, ft SHAP2, ELCOX, ELCOY, ELPHI) C ENDIF C CALL STOP ( 'END OF PLOT#') C END C C ====================================================================== C S u b ro u tin e READIN r e a d s in p u t d a ta and opens a l l i n p u t/ o u t p u t f i l e s C ====================================================================== C SUBROUTINE READIN (MPOIN, MELEM, MNODE, MCONT, NPOIN, NELEM, ft NNODE, NSINO, ITYPE, LNODE, CORDX, CORDY, ft PHI, IMESH, NCONT, CONTV) C CHARACTER*10 FMTCH, FMTEX CHARACTER*40 GNAME, PNAME, ONAME DIMENSION ft LNODE(MNODE,MELEM), CORDX(MPOIN), CORDY(MPOIN), ft PHI(MPOIN), CONTV(MCONT) C DATA FMTCH / ' ( A ) ' / DATA FMTEX / '( 5 E 1 4 . 4 ) '/ C C ------------------------------------------------------------------------------------------------------------------------C C ----- P r i n t t h e h e a d in g on th e s c r e e n C CALL BANNER C C ---- Geom etry d a ta C WRITE( * , FMTCH) '0 » > F i l e c o n ta in in g geom etry d a ta (* .G D ):' READ ( * , FMTCH) GNAME C LL = INDEX(GNAME//' ' , ' ' ) - 1 OPEN ( 4 , FILE=GNAME( 1 : LL)/ / ' . GD' , STATUS=' OLD') C CALL GEDATA (MPOIN, MELEM, MNODE, NPOIN, NELEM , NNODE, NSINO, ft ITYPE, LNODE, CORDX, CORDY) C CLOSE (4 ) C C ----- Read d a ta t o p l o t c o n to u r l i n e s C WRITE( * , FMTCH) '0 » > C ontour l i n e s [ 0 ] , mesh C l ] : ' READ ( * ,* ) IMESH IF (IMESH .LT. 0 .OR. IMESH .GT. 1) ft CALL IN_ERR (1 , 1, IMESH, 0) C IF (IMESH .EQ. 0) THEN C C -------- C o n to u r v a lu e s

APPENDIX B: MESH AND CONTOUR PLOTS

C

ft

WRITE( * , FMTCH) '0 » > Number o f c o n to u r v a l u e s : ' READ ( * ,* ) NCONT IF (NCONT .LE. 0 .OR. NCONT .GT. MCONT) CALL IN_ERR (1 , 2 , NCONT, MCONT)

C WRITE(*,FMTCH) '0 » > C ontour v a l u e s : ' READ ( * ,* ) (C0NTV(IC),IC=1,NCONT) WRITE( * , FMTCH) '0 » > Check c o n to u r v a lu e s ! ! ! ' WRITE(*,FMTEX) (CONTV(IC), IC=1, NCONT) C C -------- Read n o d a l v a lu e s o f PHI C WRITE(*,FMTCH) '0 » > F i l e c o n ta in in g v a lu e s o f PHI ( + .P H I ) :' READ ( * , FMTCH) PNAME C LL = INDEX(PNAME//' ' , ' ' ) - 1 OPEN ( 4 , F IL E = P N A M E (1:L L )//'.P H I', STATUS=' OLD' ) C READ ( 4 ,* ) READ ( 4 ,* ) (L P,PH I(L P),IP=1,N PO IN ) C CLOSE (4) C ENDIF C C ----- O u tp u t f i l e C WRITE(*,FMTCH) '0 » > O utput f i l e ( * .I N T ) : ' READ ( * , FMTCH) ONAME C LL = INDEX(ONAME//' ' , ' ' ) - 1 OPEN (1 , FILE=0NAM E(1:LL)//' .INT',STATUS='UNKNOWN', ft F0RM=' UNFORMATTED') C RETURN END C C ====================================================================== C S u b ro u tin e GEDATA r e a d s a l l geom etry d a ta C ====================================================================== C SUBROUTINE GEDATA (MPOIN, MELEM, MNODE, NPOIN, NELEM , NNODE, ft NSINO, ITYPE, LNODE, CORDX, CORDY) C DIMENSION ft LNODE(MNODE,MELEM), CORDX(MPOIN), CORDY(MPOIN) C C ------------------------------------------------------------------------------------------------------------------------C C ---- S k ip th e t i t l e l i n e C READ ( 4 ,* ) C C ---- Read t h e num ber o f p o i n ts and th e number o f e le m e n ts C READ ( 4 ,* ) READ ( 4 ,* ) NPOIN, NELEM C IF ((NPOIN .LE. 0) .OR. (NPOIN .GT. MPOIN)) ft CALL IN.ERR (2 , 1, NPOIN, MPOIN) IF ((NELEM .LE. 0) .OR. (NELEM .GT. MELEM)) ft CALL IN_ERR ( 2 , 2 , NELEM, MELEM) C C ---- Read e le m e n t ty p e C READ ( 4 ,* ) READ ( 4 ,* ) ITYPE C IF ((ITYPE .NE. 1) .AND. (ITYPE .NE. 2 )) ft CALL IN_ERR ( 2 , 3 , ITYPE, 0) C C ---- Number o f n odes i n each e le m en t C IF (ITYPE .EQ. 1) THEN NNODE = 4 NSINO = 2 ELSE NNODE = 8 NSINO = 3

431

432

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

ENDIF C C ----- Read n o d a l c o o r d in a te s C READ ( 4 ,* ) DO IP = 1 , NPOIN READ ( 4 ,* ) LP, CORDX(LP), CORDY(LP) IF ((LP .LE. 0) .OR. (LP .GT. NPOIN)) ft CALL IN_ERR (2 , 4 , LP, IP ) ENDDO C C ----- Read e le m en t l i s t s o l nodes C READ ( 4 ,* ) DO IE = 1 NELEM READ (4 ^ * ) LE, (LNODE( IN ,L E ), IN=1,NNODE) C IF ((LE .LE. 0) .OR. (LE .GT. NELEM)) ft CALL IN_ERR (2 , 5 , LE, IE ) DO IN = 1 , NNODE IP = LNODE( IN,LE) IF ( ( I P .LE. 0) .OR. (IP .GT. NPOIN)) ft CALL IN.ERR ( 2 , 6 , IP , IE ) ENDDO ENDDO C C ----- C lo se l i l e c o n ta in in g g eom etry d a ta C RETURN END C

C ====================================================================== C

S u b ro u tin e MIMAXY l i n d s minimum and maximum c o o r d in a te s

C ==================== ==================================================

C C

SUBROUTINE MIMAXY (MPOIN, NPOIN, CORDX, CORDY, DIMAX) DIMENSION ft CORDX(MPOIN),

CORDY(MPOIN) C C -----------------------------------------------------------------------------------------------------------------------C C ----- F in d minimum and maximum c o o r d in a te s C XCMIN = CORDX(1) XCMAX = CORDX(1 ) YCMIN = CORDY(1 ) YCMAX = CORDY(1 ) C DO IP = 2 , NPOIN C XCMIN = MIN(XCMIN,CORDX(IP)) XCMAX = MAX( XCMAX, CORDX( I P ) ) YCMIN = MIN(YCMIN, CORDY(IP)) YCMAX = MAX(YCMAX, CORDY(IP)) C ENDDO C WRITE(l) XCMIN, XCMAX, YCMIN, YCMAX C C ----- F in d t h e maximum d im e n sio n C XSIZE = XCMAX-XCMIN YSIZE = YCMAX-YCMIN DIMAX = MAX(XSIZE,YSIZE) C RETURN END C C ============================================== ========================

C S u b ro u tin e SBGRID d e te rm in e s th e elem en t s u b g rid s l o r m esh, b oundary C and c o n to u r p l o t t i n g C ====================================================================== C SUBROUTINE SBGRID (MPOIN, MELEM, MNODE, MLCOR, NELEM, ITYPE, ft LNODE, CORDX, CORDY, MDTOT, MDMIN, MDMAX, ft DIMAX, NDIVS, DIVIS) C DIMENSION ft LN0DE(MN0DE,MELEM), CORDX(MPOIN), CORDY(MPOIN), ft NDIVS(MLCOR,MELEM), DIVIS(MLCOR,MELEM)

APPENDIX B: MESH AND CONTOUR PLOTS

C C ------------------------------------------------------------------------------------------------------------------------C C ----- F in d t h e a p p ro x im a te s i z e o l one s u b d i v i s i o n C TDIVS = DIMAX / FLOAT(MDTOT) C C ----- F in d i n e ach e le m en t t h e number o l s u b d iv is io n s i n EXI and C ETA d i r e c t i o n s C DO IE = 1 , NELEM C C -------- C o o rd in a te s o l t h e s i d e m id -p o in ts C IF (ITYPE .EQ. 1) THEN IA = LN0DE(1,IE) IB = LN0DE(2,IE) IC = LN0DE(3,IE) ID = LN0DE(4,IE) T?T

IA = IB = IC = ID = ENDIF

LN0DE(1,IE) LN0DE(3,IE) LN0DE(5,IE) LN0DE(7,IE)

C XMED1 YMED1 XMED2 YMED2 XMED3 YMED3 XMED4 YMED4

= = = = = = = =

0 .5 0 .5 0 .5 0 .5 0 .5 0 .5 0 .5 0 .5

* * * * * * * *

(CORDX(IA) (CORDY(IA) (CORDX(IB) (CORDY(IB) (CORDX(IC) (CORDY(IC) (CORDX(ID) (CORDY(ID)

+ + + + + + + +

CORDX(IB)) CORDY(IB)) CORDX(IC)) CORDY(IC)) CORDX(ID)) CORDY(ID)) CORDX(IA)) CORDY(IA))

C C -------- S u b d iv is io n s i n EXI d i r e c t i o n C DIEXI = SQRT( (XMED2-XMED4)**2 + (YMED2-YMED4)**2) NDEXI = INT(DIEXI/TDIVS) IF (NDEXI .LT. MDMIN) NDEXI = MDMIN IF (NDEXI .GT. MDMAX) NDEXI = MDMAX D IV IS (1, IE ) = 2. / FLOAT(NDEXI) NDIVS( 1 , IE ) = NDEXI C C -------- S u b d iv is io n s i n ETA d i r e c t i o n C DIETA = SQRT((XMED3-XMED1)**2 + ( YMED3 - YMED1)* *2) NDETA = INT(DIETA/TDIVS) IF (NDETA .LT. MDMIN) NDETA = MDMIN IF (NDETA .GT. MDMAX) NDETA = MDMAX D IV IS (2 ,IE ) = 2. / FLOAT(NDETA) NDIVS( 2 , IE ) = NDETA C ENDDO C RETURN END C C ====================================================================== C S u b ro u tin e PLMESH p l o t s t h e l i n i t e e le m en t mesh C ====================================================================== C SUBROUTINE PLMESH (MPOIN, MELEM, MSIDE, MNODE, MSINO, MTYPE, ft ITYPE, NELEM, NSINO, LNODE, CORDX, CORDY, ft NDIVS, DIVIS, LSNOD, SICOX, SICOY, SHAP1) C DIMENSION ft LNODE(MNODE,MELEM), CORDX(MPOIN), CORDY(MPOIN), ft NDIVS(2,MELEM), DIVIS(2,MELEM) C DIMENSION ft SICOX(MSINO), SICOY(MSINO), SHAPl(MSINO), ft LSNOD(MSINO, MSIDE, MTYPE) C C ------------------------------------------------------------------------------------------------------------------------C C ---- P l o t t h e l i n i t e e le m en t mesh C DO IE = 1 , NELEM C C -------- Loop o v e r e le m en t s i d e s

433

434

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

C DO IS = 1 , MSIDE C C ------------P l o t an e le m en t s id e C ID = 2 - M 0D(IS,2) CALL PLSIDE (MPOIN, MNODE, MSINO, NSINO, LN 0D E(1,IE), k LSNOD( 1 , IS ,IT Y P E ), CORDX, CORDY, SICOX, k SICOY, N D IV S(ID .IE ), D IV IS (ID ,IE ), SHAP1) C C -------- End o f lo o p o v e r e le m en t s i d e s C ENDDO C ENDDO C RETURN END C C S u b ro u tin e PLSIDE p l o t s an elem en t s id e C ====================================================================== C SUBROUTINE PLSIDE (MPOIN, MNODE, MSINO, NSINO, LNODE, LSINO, k CORDX, CORDY, SICOX, SICOY, NDIVS, DIVIS, k SHAP1) C LOGICAL LSTRA, LSTRAI C DIMENSION k LSINO(MSINO), LNODE(MNODE), CORDX(MPOIN), k CORDY(MPOIN), SICOX(MSINO), SICOY(MSINO), k SHAP1(MSINO) C

------------------------------------------------------------------------------------------C C ----- Form v e c t o r s o l s id e c o o r d in a te s C CALL SIVECT (MPOIN, MNODE, MSINO, NSINO, LNODE, LSINO, CORDX, k SICOX) CALL SIVECT (MPOIN, MNODE, MSINO, NSINO, LNODE, LSINO, CORDY, k SICOY) C IF (NSINO .EQ. 2) THEN C C -------- P l o t a s i d e o f a l i n e a r elem en t C CALL PLSIDL (MSINO, NSINO, SICOX, SICOY) C ELSE C C -------- P l o t a s id e o f a p a r a b o l ic elem ent LSTRA = LSTRAI (MSINO, SICOX, SICOY) IF (LSTRA) THEN C C ----------- The s i d e i s s t r a i g h t

CALL PLSIDL (MSINO, NSINO, SICOX, SICOY) ELSE C C ------------The s id e i s c u rv ed C CALL PLSIDP (MSINO, NSINO, NDIVS, DIVIS, SICOX, SICOY, k SHAP1) ENDIF C ENDIF C RETURN END C C ====================================================================== C S u b ro u tin e PLBOUN p l o t s th e boundary o f th e domain C

C

k k k

SUBROUTINE PLBOUN (MPOIN, MSIDE, LNODE, LSBOU,

MELEM, MTYPE, CORDX, NEBOU,

MNODE, NELEM, CORDY, LSNOD,

MLCOR, NNODE, NDIVS, SICOX,

MSINO, NSINO, DIVIS, SICOY,

MSBOU, ITYPE, NOFRQ, SHAP1)

APPENDIX B: MESH AND CONTOUR PLOTS

k k k

DIMENSION LNODE(MNODE,MELEM), NDIVS(MLCOR,MELEM), LSBOU(MSBOU),

k k

DIMENSION SICOX(MSINO), SICOY(MSINO), LSNOD(MSINO, MSIDE, MTYPE)

CORDX(MPOIN), DIVIS(MLCOR,MELEM), NEBOU(MSBOU)

CORDY(MPOIN), NOFRQ(MPOIN),

C SHAP1(MSINO),

C C ------------------------------------------------------------------------------------------------------------------------C C ----- F in d t h e e le m e n ts w ith one o r more s i d e s on t h e b o u ndary C IF (ITYPE .EQ. 1) THEN C CALL EBOUNL (MPOIN, MELEM, MNODE, MSBOU, MSINO, MSIDE, MTYPE, k NELEM, NNODE, LNODE, NOFRQ, NSBOU, LSBOU, NEBOU, k LSNOD) C ELSE C CALL EBOUNP (MPOIN, MELEM, MNODE, MSBOU, NELEM, NNODE, LNODE, k NOFRQ, NSBOU, LSBOU, NEBOU) C ENDIF C C ----- P l o t t h e b oundary C DO IB = 1 , NSBOU C IE = NEBOU(IB) IS = LSBOU(IB) C C -------- P l o t an e le m en t s i d e C ID = 2 - M 0D (IS,2) CALL PLSIDE (MPOIN, MNODE, MSINO, NSINO, LN O D E(l,IE ), k LSNOD( 1 , IS ,IT Y P E ), CORDX, CORDY, SICOX, k SICOY, N D IV S(ID .IE ), D IV IS (ID ,IE ), SHAP1) C ENDDO C RETURN END C C ======================================================================

C S u b ro u tin e EBOUNL f i n d s t h e e le m en t s i d e s on t h e b oundary C (LINEAR e le m e n ts , STRUCTURED m eshes ONLY) C ====================================================================== C SUBROUTINE EBOUNL (MPOIN, MELEM, MNODE, MSBOU, MSINO, MSIDE, k MTYPE, NELEM, NNODE, LNODE, NOFRQ, NSBOU, k LSBOU, NEBOU, LSNOD) C DIMENSION k LNODE(MNODE,MELEM), NOFRQ(MPOIN), LSBOU(MSBOU), k NEBOU(MSBOU), LSNOD(MSINO,MSIDE,MTYPE) C

c ------------------------------------------------------------------------------------------

c

C ---- F in d how many e le m e n ts s h a re each node C DO IE = 1 , NELEM DO IN = 1 , NNODE C IP = LNODE(IN.IE) NOFRQ(IP) = NOFRQ(IP) + 1 C ENDDO ENDDO C C ---- F in d t h e e le m e n ts w ith one o r more s i d e s on t h e b oundary C IB = 0 DO IE = 1 , NELEM DO IS = 1 , MSIDE C 11 = LNODE(LSNOD( 1 , I S , 1 ) , IE) 12 = LN0DE(LSN0D(2, I S , 1 ) , IE) IF (NOFRQ(Il) .LE. 3 .AND. N0FRQ(I2) .LE. 3) THEN IB = IB + 1

435

436

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

NEBOU(IB) = IE LSBOU(IB) = IS ENDIF C ENDDO ENDDO C NSBOU = IB C RETURN END C C ======================================================================

C S u b ro u tin e EBOUNP f i n d s t h e elem en t s i d e s on th e boundary C (PARABOLIC e le m e n ts ) C ====================================================================== C SUBROUTINE EBOUNP (MPOIN, MELEM, MNODE, MSBOU, NELEM, NNODE, k LNODE, NOFRQ, NSBOU, LSBOU, NEBOU) C DIMENSION k LNODE(MNODE,MELEM), NOFRQ(MPOIN), LSBOU(MSBOU), k NEBOU(MSBOU) C C ------------------------------------------------------------------------------------------------------------------------C C ----- F in d how many e le m e n ts s h a re each m id -s id e node C DO IE = 1 , NELEM DO IN = 2 , NNODE,2 C IP = LNODE(IN,IE) NOFRQ(IP) = NOFRQ(IP) + 1 C ENDDO ENDDO C C ----- F in d th e e le m e n ts w ith one o r more s i d e s on th e b oundary C IB = 0 DO IE = 1 , NELEM DO IN = 2 , NNODE,2 C IP = LNODE(IN,IE) IF (NOFRQ(IP) .EQ. 1) THEN IS = IN / 2 IB = IB + 1 NEBOU(IB) = IE LSBOU(IB) = IS ENDIF C ENDDO ENDDO C NSBOU = IB C RETURN END C C ====================================================================== C S u b ro u tin e MIMAPH f i n d s minimum and maximum v a lu e s o f th e d e p en d e n t C v a r i a b l e i n each e le m en t C ====================================================================== C SUBROUTINE MIMAPH (MPOIN, MELEM, MNODE, NELEM, NNODE, LNODE, PHI, k PHMNE, PHMXE) C DIMENSION k PHI(MPOIN), LNODE(MNODE,MELEM), PHMNE(MELEM), k PHMXE(MELEM) C C ------------------------------------------------------------------------------------------------------------------------C C ----- Loop o v e r t h e e le m e n ts C DO IE = 1 , NELEM C C -------- F in d minimum and maximum v a lu e s o f PHI C IP = LNODE( 1 , IE ) PHMIN = P H I(IP )

APPENDIX B: MESH AND CONTOUR PLOTS

PHMAX = P H I(IP ) C DO IN = 2 , NNODE C IP = LNODE(IN,IE) PHMIN = MIN(PHMIN, P H I(IP )) PHMAX = MAX(PHMAX,PHI(IP)) C ENDDO C C -------- F o r p a r a b o l i c e le m e n ts o n l y . . . C IF (NNODE .EQ. MNODE) THEN C PHDIF = PHMAX - PHMIN PHMIN = PHMIN - PHDIF PHMAX = PHMAX + PHDIF C ENDIF C C -------- A ssig n minimum and maximum v a lu e s o f PHI i n t h e e le m en t C PHMNE(IE) = PHMIN PHMXE(IE) = PHMAX C C ----- End o f lo o p o v e r th e e le m e n ts C ENDDO C RETURN END C C ======================================================================

C S u b ro u tin e PLCONT p l o t s th e c o n to u r l i n e s C ====================================================================== C SUBROUTINE PLCONT (MPOIN, MELEM, MNODE, MTYP2, MLCOR, MBUFF, & MPBRN, MBRAN, MCONT, MDMAX, NELEM, NNODE, & ITYPE, LNODE, CORDX, CORDY, LNPHI, NDIVS, & DIVIS, PHI, BUFFR, LBUFF, NPBRN, PBRAN, & NCONT, CONTV, PHMNE, PHMXE, SHAP2, ELCOX, & ELCOY, ELPHI) C LOGICAL LBUFF, LWARN C DIMENSION & LNODE(MNODE,MELEM), CORDX(MPOIN), CORDY(MPOIN), & NDIVS(MLCOR,MELEM), DIVIS(MLCOR,MELEM) C DIMENSION & PHI(MPOIN), CONTV(MCONT), PHMNE(MELEM), & PHMXE(MELEM), BUFFR(MLCOR,MBUFF) , LBUFF(MBUFF), & NPBRN(MBRAN), PBRAN(MLCOR,MPBRN,MBRAN) C DIMENSION & SHAP2(MNODE), ELCOX(MNODE), ELCOY(MNODE), & ELPHI(MNODE), LNPHI(MNODE,MTYP2) C COMMON /TOLER/ & TOLOO, TOL1P, TOL1M, TOLRL C C ------------------------------------------------------------------------------------------------------------------------C C ---- S e t v a lu e s o f in d ic e s w hich depend on e le m en t ty p e C 11 = 2 * ITYPE - 1 12 = 2 * ITYPE C IF (ITYPE .EQ. 2) DIMIN = 2 . / FLOAT(MDMAX) C C ---- Loop o v e r t h e c o n to u r l i n e s C DO IC = 1 , NCONT C PHICO = CONTV(IC) C C -------- Loop o v e r t h e e le m e n ts C DO IE = 1 , NELEM C C ----------- F in d t h e c o n to u r p o i n ts

437

438

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

C IF (PHICO .GE. PHMNE(IE) .AND. PHICO .LE. PHMXE(IE)) THEN C CALL ELVECT (MPOIN, MNODE, NNODE, LN O D E(l,IE), PHI, ELPHI) DIVI1 = D IV IS (1, IE ) DIVI2 = D IV IS (2 ,IE ) C C --------------- S e t v a lu e s o f ETA and f i n d t h e c o rre s p o n d in g v a lu e s o f EXI C NCEXI = 0 CALL FINDPT (MNODE, MLCOR, MBUFF, ITYPE, 1 , 2 , LNPHI( 1 ,1 1 ) , ft NDIVS( 2 , I E ) , DIVIS( 2 , I E ) , ELPHI, PHICO, BUFFR, ft NCEXI, DISOL) C C --------------- I f n e c e s s a r y , r e f i n e t h e s u b d iv is io n i n ETA d i r e c t i o n C IF (ITYPE .EQ. 2 .AND. DISOL .LE. 2 .* D IV IS (2 ,IE )) THEN NCEXI = 0 CALL FINDPT (MNODE, MLCOR, MBUFF, ITYPE, 1, 2 , ft LNPHI( 1 ,1 1 ) , MDMAX, DIMIN, ELPHI, PHICO, ft BUFFR, NCEXI, DISOL) DIVI2 = DIMIN ENDIF C C --------------- S e t v a lu e s o f EXI and f i n d th e c o rre s p o n d in g v a lu e s o f ETA C NCETA = NCEXI CALL FINDPT (MNODE, MLCOR, MBUFF, ITYPE, 2 , 1, L N P H I(1 ,I2 ), ft N D IV S (1,IE ), D IV IS (1, I E ) , ELPHI, PHICO, BUFFR, ft NCETA, DISOL) C C --------------- I f n e c e s s a r y , r e f i n e th e s u b d iv is io n in EXI d i r e c t i o n C IF (ITYPE .EQ. 2 .AND. DISOL .LE. 2 . *D IV IS(1, I E ) ) THEN NCETA = NCEXI CALL FINDPT (MNODE, MLCOR, MBUFF, ITYPE, 2 , 1, ft LNPHI( 1 ,1 2 ) , MDMAX, DIMIN, ELPHI, PHICO, ft BUFFR, NCETA, DISOL) DIVI1 = DIMIN ENDIF NCOPO = NCETA C IF (NCOPO .GT. 0) THEN C C ------------------- S o r t t h e a r r a y c o n ta in in g th e l o c a l c o o r d in a te s o f th e C c o n to u r p o i n ts C CALL SORTBF (MLCOR, MBUFF, NCOPO, BUFFR) C C ------------------- G a th e r t h e c o n to u r p o i n ts b e lo n g in g t o each b ra n c h C DIAGO = T0L1P * SQRT(DIVI1**2 + DIVI2**2) CALL BRANCH (MLCOR, MBUFF, MPBRN, MBRAN, NCOPO, BUFFR, ft LBUFF, DIAGO, NBRAN, NPBRN, PBRAN, LWARN) C C -------------------W rite a WARNING m essage when th e c o n to u r p l o t m ight C n o t be c o r r e c t C IF (LWARN) THEN WRITE(*,*) ' ***** E le m e n t :', IE WRITE(*,* ) ' C ontour v a l u e : ', PHICO WRITE(*,*) ' C ontour p l o t m ight n o t be c o r r e c t ! ! ! ' ENDIF C C ------------------- C a lc u la te th e C a r te s i a n c o o r d in a te s o f t h e c o n to u r p o i n ts C and w r i t e them t o th e e x te r n a l f i l e C CALL ELVECT (MPOIN, MNODE, NNODE, LN 0D E(1,IE), CORDX, ft ELCOX) CALL ELVECT (MPOIN, MNODE, NNODE, LN 0D E(1,IE), CORDY, ft ELCOY) C CALL PLOTBR (MNODE, MLCOR, MPBRN, MBRAN, NNODE, SHAP2, ft ELCOX, ELCOY, NBRAN, NPBRN, PBRAN) C ENDIF C ENDIF C C -------- End o f lo o p o v e r t h e e le m e n ts C

APPENDIX B: MESH AND CONTOUR PLOTS

ENDDO C C ----- End o l lo o p o v e r th e c o n to u r l i n e s C ENDDO C RETURN END C C ====================================================================== C S u b ro u tin e FINDPT f i n d s c o n to u r p o i n t s by s e a rc h in g i n one d i r e c t i o n C ======================================================================

c ft k

SUBROUTINE FINDPT (MNODE, MLCOR, MBUFF, ITYPE, IC , JC, LNPHI, NDIVS, DIVIS, ELPHI, PHICO, BUFFR, NCOPO, DISOL)

C PARAMETER (MS0LU=2) C DIMENSION k ELPHI(MNODE), ft SOLUZ(MSOLU)

LNPHI(MNODE),

BUFFR(MLCOR,MBUFF),

C ft

COMMON /TOLER/ TOLOO, T0L1P, T0L1M, TOLRL

C-

C ---------------------------------------------------------------------------------------------C PHI = ELPHI(LNPHIQ)) PH2 = ELPHI(LNPHI( 2 ) ) PH3 = ELPHI(LNPHI( 3 ) ) PH4 = ELPHI(LNPHI( 4 ) ) IF (ITYPE .EQ. 2) THEN PH5 = ELPHI(LNPHI( 5 )) PH6 = ELPHI(LNPHI( 6 ) ) PH7 = ELPHI(LNPHI( 7 ) ) PH8 = ELPHI(LNPHI(8 ) ) DISOL = 2. ENDIF C C ---- Loop o v e r t h e s u b d iv io n s i n th e g iv e n d i r e c t i o n C IX = NCOPO DO ID = 0 , NDIVS C HCORD = FLOAT(ID)*DIVIS - 1. C C -------- F in d t h e i n t e r s e c t i o n s o f t h e c o n to u r l i n e s w ith t h e l i n e C HCORD = c o n s ta n t C IF (ITYPE .EQ. 1) THEN CALL ROOTSL (HCORD, PHICO, PHI, PH2, PH3, PH4, SOLUZ(l)) ELSE CALL ROOTSP (MSOLU, HCORD, PHICO, PHI, PH2, PH3, PH4, ft PH5, PH6, PH7, PH8, SOLUZ) DISTN = ABS(S0LUZ(l)-S0LUZ(2)) IF (DISTN .GT. TOLOO .AND. DISTN .LT. DISOL) DISOL = DISTN ENDIF C DO I I = 1 , ITYPE IF (ABS(SOLUZ(II)) .LE. T0L1P) THEN IX = IX + 1 BUFFR(IC, IX) = SOLUZ(II) BUFFR(JC,IX) = HCORD ENDIF ENDDO C ENDDO C NCOPO = IX C RETURN END C C ====================================================================== C S u b ro u tin e ROOTSL f i n d s t h e i n t e r s e c t i o n s o f a c o n to u r l i n e w ith C a l i n e HCORD = c o n s t a n t by s o lv in g t h e e q u a tio n b*x - c = 0 C ====================================================================== C SUBROUTINE ROOTSL (HCORD, P H IC O , P H I , P H 2 , P H 3 , P H 4 , SOLUZ) C

43 9

440

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

ft

COMMON /TOLER/ TOLOO, T0L1P, T0L1M, TOLRL

C C ------------------------------------------------------------------------------------------------------------------------C TOLPH = TOLOO * ABS(PHICO) HCOOR = HCORD 10 HC0M1 = HCOOR - 1. HC0P1 = HCOOR + 1. C C ----- C a lc u l a t e t h e c o e f f i c i e n t s o f t h e e q u a tio n b*x - c = 0 C BCOEF = HC0M1 * (PHI - PH2) + HC0P1 * (PH3 - PH4) CCOEF = HC0M1 * (PHI + PH2) - HC0P1 * (PH3 + PH4) + 4.*PHIC0 C C ---- S o lv e t h e e q u a tio n C IF (ABS(BCOEF) .GT. TOLPH) THEN SOLUZ = CCOEF / BCOEF ELSEIF (ABS(CCOEF) .GT. TOLPH .OR. ABS(HCOOR) .LT. T0L1M) THEN SOLUZ = 2 . ELSE HCOOR = T0L1M * HCOOR GOTO 10 ENDIF C RETURN END C C ====================================================================== C S u b ro u tin e ROOTSP f i n d s th e i n t e r s e c t i o n s o f a c o n to u r l i n e w ith C a l i n e HCORD = c o n s ta n t by s o lv in g th e e q u a tio n a*x~2 + b*x - c = 0 C ====================================================================== C SUBROUTINE ROOTSP (MSOLU, HCORD, PHICO, PHI, PH2, PH3, PH4, PH5, ft PH6, PH7, PH8, SOLUZ) C DIMENSION ft SOLUZ(MSOLU) C COMMON /TOLER/ ft TOLOO, T0L1P, T0L1M, TOLRL C C ------------------------------------------------------------------------------------------------------------------------C TOLPH = TOLOO * ABS(PHICO) HCOOR = HCORD 10 OMHCO = 1. - HCOOR OPHCO = 1. + HCOOR OMHSQ = 1. - HCOOR * HCOOR C C ----- C a lc u l a t e th e c o e f f i c i e n t s o f th e e q u a tio n a*x~2 + b*x - c = 0 C ACOEF = OMHCO * (PHI - 2.*PH2 + PH3) ft + OPHCO * (PH5 - 2 . *PH6 + PH7) BCOEF = HCORD * OMHCO * (PHI - PH3) ft + HCORD * OPHCO * (PH5 - PH7) ft + 2 . * OMHSQ * (PH4 - PH8) CCOEF = OMHSQ * (PHI + PH3 + PH5 + PH7 - 2.*(PH 4 + PH8)) ft - 2 . * (0MHC0*PH2 + 0PHC0*PH6) + 4.*PHIC0 C C ----- S o lv e t h e e q u a tio n C IF (ABS(ACOEF) .GT. TOLPH) THEN FIRST = - 0 .5 * BCOEF / ACOEF SECND = FIRST * FIRST + CCOEF / ACOEF IF (SECND .GE. 0 . ) THEN SECND = SQRT(SECND) SOLUZ(l) = FIRST - SECND SOLUZ(2 ) = FIRST + SECND ELSE SOLUZ(1 ) = 2. SOLUZ(2 ) = 2. ENDIF ELSEIF (ABS(BCOEF) .GT. TOLPH) THEN SOLUZ(1 ) = CCOEF / BCOEF SOLUZ(2 ) = 2. ELSEIF (ABS(CCOEF) .GT. TOLPH .OR. ABS(HCOOR) .LT. T0L1M) THEN SOLUZ(1 ) = 2 . SOLUZ(2 ) = 2. ELSE

APPENDIX B: MESH AND CONTOUR PLOTS

HCOOR = T0L1M * HCOOR GOTO 10 ENDIF C RETURN END C C ====================================================================== C S u b r o u tin e SORTBF s o r t s t h e b u f f e r a r r a y by a r ra n g in g i t s e n t r i e s C a c c o rd in g t o i n c r e a s in g EXI a n d , f o r e q u a l EXI, t o i n c r e a s i n g ETA C ====================================================================== C SUBROUTINE SORTBF (MLCOR, MBUFF, NCOPO, BUFFR) C DIMENSION ft BUFFR(MLCOR, MBUFF) C COMMON /TOLER/ ft TOLOO, T0L1P, T0L1M, TOLRL C C -------------------------------------------------------------------------------------------------------------------------C C ----- A rra n g e e n t r i e s a c c o rd in g t o i n c r e a s in g EXI C CALL LNSORT (MLCOR, MBUFF, 1, 2 , 1, NCOPO, BUFFR) C C ----- F o r e q u a l EXI, a r ra n g e e n t r i e s a c c o rd in g t o in g r e a s i n g ETA C NSEQU = 1 DO IX = 2 , NCOPO C IF (ABS(BUFFR(1, IX-1)-BU FFR(1, IX )) .LT. TOLOO) THEN NSEQU = NSEQU + 1 IF (IX .EQ. NCOPO) THEN LIMT1 = IX - NSEQU LIMT2 = IX ENDIF ELSEIF (NSEQU .GT. 1) THEN LIMT1 = IX - NSEQU LIMT2 = IX - 1 CALL LNSORT (MLCOR, MBUFF, 2 , 1, LIMT1, LIMT2, BUFFR) NSEQU = 1 ENDIF C ENDDO C IF (NSEQU .GT. 1) THEN LIMT1 = NCOPO - NSEQU + 1 LIMT2 = NCOPO CALL LNSORT (MLCOR, MBUFF, 2 , 1, LIMT1, LIMT2, BUFFR) ENDIF C RETURN END C C ====================================================================== C S u b ro u tin e LNSORT s o r t s a p a r t o f th e a r r a y ARRAY ( l i n e a r s o r t i n g ) C ====================================================================== C SUBROUTINE LNSORT (MCOMP, MLIMT, ICOMP, JCOMP, LIMT1, LIMT2, ft ARRAY) C DIMENSION ft ARRAY(MCOMP,MLIMT) C

c ------------------------------------------------------------------------------------------

C DO IA = LIMT1,LIMT2-1 C DO JA = IA+1,LIMT2 C

IF (ARRAY(ICOMP, JA) .LT. ARRAY(ICOMP,IA)) THEN TEMPI = ARRAY(ICOMP,IA) TEMPJ = ARRAY(JCOMP,IA) ARRAY(ICOMP,IA) = ARRAY( ICOMP,JA) ARRAY(JCOMP,IA) = ARRAY(JCOMP,JA) ARRAY( ICOMP, JA) = TEMPI ARRAY(JCOMP,JA) = TEMPJ ENDIF

C ENDDO

441

442

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

C ENDDO C RETURN END C C ====================================================================== C S u b ro u tin e BRANCH g a th e r s t h e c o n to u r p o i n ts b e lo n g in g t o each b ra n c h C ====================================================================== C SUBROUTINE BRANCH (MLCOR, MBUFF, MPBRN, MBRAN, NCOPO, BUFFR, ft LBUFF, DIAGO, NBRAN, NPBRN, PBRAN, LWARN) C LOGICAL LWARN, LBUFF C DIMENSION ft BUFFR(MLCOR,MBUFF), LBUFF(MBUFF), NPBRN(MBRAN), ft PBRAN(MLCOR,MPBRN, MBRAN) C COMMON /TOLER/ ft TOLOO, TOL1P, TOL1M, TOLRL C FDISTN (X I, Y l, X2, Y2) = SQRT((X2-X1)**2 + (Y2-Y1)**2) C C ------------------------------------------------------------------------------------------------------------------------C C ----- P r e lim in a r y o p e r a tio n s C NBUFF = 0 IB = 0 DO IX=1,NCOPO LBUFF(IX) = .TRUE. ENDDO C C ---- Loop o v e r b ra n c h e s C 1 IF (NBUFF .LT. NCOPO .AND. IB .LT. MBRAN) THEN C IB = IB + 1 IX = 1 C 2 IF (LBUFF(IX)) THEN PBRAN(1, 1 ,IB ) = BUFFR(1, IX) PBRAN( 2 , 1 , IB) = BUFFR( 2 , IX) LBUFF(IX) = .FALSE. IY = 1 NBUFF = NBUFF + 1 ELSE IX = IX + 1 GOTO 2 ENDIF ISTAR = IX + 1 C C -------- Loop o v e r c o n to u r p o i n ts C DO IX = ISTAR,NCOPO C C ------------ F in d th e p o i n t a t t h e minimum d i s t a n c e from th e c u r r e n t C end p o i n t o l th e b ra n c h C DIMIN = 2. IZ = ISTAR C 3 IF (IZ .LE. NCOPO .AND. ft (BUFFR(1,IZ)-PBRA N (1,IY ,IB)) .LT. DIAGO) THEN C IF ( LBUFF(IZ)) THEN DISTN = FDISTN (PBRAN(1, I Y ,I B ) , PBR A N (2,IY ,IB ), ft B U FFR (1,IZ), BUFFR(2,IZ)) IF (DISTN .LT. DIMIN) THEN DIMIN = DISTN IZMIN = IZ ENDIF ENDIF C IZ = IZ + 1 GOTO 3 C ENDIF DISTN = DIMIN C

APPENDIX B: MESH AND CONTOUR PLOTS

IF (DISTN .LT. DIAGO) THEN C LBUFF(IZMIN) = .FALSE. NBUFF = NBUFF + 1 C C --------------- Make s u r e t h a t th e new p o i n t i s d i f f e r e n t from t h e o ld C one and a s s i g n th e c o o r d in a te s o f th e new p o i n t C IF (DISTN .GT. TOLOO) THEN IY = IY + 1 PBRAN( 1 , IY ,IB ) = BUFFR(1, IZMIN) PBRAN(2,IY,IB) = BUFFR(2,IZMIN) C ENDIF C ENDIF C C -------- End o f lo o p o v e r c o n to u r p o i n ts C ENDDO C C -------- Check i f t h i s i s a c lo s e d b ra n c h C DISTN = FDISTN (PBRAN(1, 1 , I B ) , PBRAN(2, 1 , I B ) , & PBRAN( 1 , I Y ,I B ) , PBRAN(2,IY,IB)) IF (DISTN .LT. DIAGO) THEN IY = IY + 1 PBRAN(1, IY ,IB ) = PBRAN(1, 1 , IB) PBRAN(2,IY,IB) = PBRAN(2, 1 , IB) ENDIF C NPBRN(IB) = IY GOTO 1 C C ---- End o f lo o p o v e r b ra n c h e s C ENDIF C NBRAN = IB IF (NBUFF .LT. NCOPO) THEN LWARN = .TRUE. T7T CT7

LWARN = .FALSE. ENDIF C RETURN END C C ====================================================================== C S u b ro u tin e PLOTBR p l o t s a l l t h e b ra n c h e s i n th e e le m en t C ====================================================================== C SUBROUTINE PLOTBR (MNODE, MLCOR, MPBRN, MBRAN, NNODE, SHAP2, & ELCOX, ELCOY, NBRAN, NPBRN, PBRAN) C DIMENSION & SHAP2(MNODE), ELCOX(MNODE), ELCOY(MNODE), & NPBRN(MBRAN), PBRAN(MLCOR,MPBRN,MBRAN) C C ------------------------------------------------------------------------------------------------------------------------C C ---- Loop o v e r a l l b ra n c h e s o f th e c o n to u r l i n e C DO IB = 1 , NBRAN C C -------- Move t o t h e f i r s t p o i n t o f t h e b ra n c h w ith t h e pen up C EXI = PBRAN(1,1,IB) ETA = PBRAN(2, 1 , IB) CALL SHAPEF (MNODE, NNODE, EXI, ETA, SHAP2) XPLOT = CORDIN (MNODE, NNODE, SHAP2, ELCOX) YPLOT = CORDIN (MNODE, NNODE, SHAP2, ELCOY) CALL PLOTXY ( 0 , XPLOT, YPLOT) C C -------- Move t o a l l o t h e r p o i n t s o f t h e b ra n c h w ith t h e pen down C DO IY = 2 , NPBRN(IB) C EXI = PBRAN(1,IY,IB) ETA = PBRAN(2,IY,IB) CALL SHAPEF (MNODE, NNODE, EXI, ETA, SHAP2)

4 43

444

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

XPLOT = CORDIN (MNODE, NNODE, SHAP2, ELCOX) YPLOT = CORDIN (MNODE, NNODE, SHAP2, ELCOY) CALL PLOTXY ( 1 , XPLOT, YPLOT) C ENDDO C C ----- End o l lo o p o v e r b ra n c h e s o l t h e c o n to u r l i n e C ENDDO C RETURN END C

C ======================================================================

C S u b ro u tin e PLOTXY w r i t e s t h e c o o r d in a te s o l th e d e s t i n a t i o n p o i n t t o C be re a c h e d w ith t h e pen up (KDOVN = 0) o r down (KDOUN = 1 ) . C ====================================================================== C SUBROUTINE PLOTXY (KDOVN, XPLOT, YPLOT) C C ------------------------------------------------------------------------------------------------------------------------C C ----- W rite l l a g l o r pen p o s i t i o n said c o o r d in a te s o l d e s t i n a t i o n p o i n t C WRITE(l) KDOVN, XPLOT, YPLOT C RETURN END C C ====================================================================== C S u b ro u tin e PLSIDL p l o t s a s i d e o l a l i n e a r elem en t C ====================================================================== C SUBROUTINE PLSIDL (MSINO, NSINO, SICOX, SICOY) C DIMENSION & SICOX(MSINO), SICOY(MSINO) C C ------------------------------------------------------------------------------------------------------------------------C C ---- Move t o th e l i r s t p o i n t o l th e b ra n c h w ith th e pen up C XPLOT = SICOX(l) YPLOT = SICOY(l) CALL PLOTXY (0 , XPLOT, YPLOT) C C ----- Move t o t h e end p o i n t o l th e b ra n c h w ith th e pen down C XPLOT = SICOX(NSINO) YPLOT = SICOY(NSINO) CALL PLOTXY (1 , XPLOT, YPLOT) C RETURN END C C ====================================================================== C S u b ro u tin e PLSIDP p l o t s a s i d e o l a p a r a b o l ic elem en t C ======================================================================

c

SUBROUTINE PLSIDP (MSINO, NSINO, NDIVS, DIVIS, SICOX, SICOY, & SHAP1)

C DIMENSION & SICOX(MSINO),

SICOY(MSINO), SHAP1(MSINO) C C ------------------------------------------------------------------------------------------------------------------------C C ---- Move t o t h e l i r s t p o i n t o l th e b ra n c h w ith t h e pen up C XPLOT = SICOX(l) YPLOT = SICOY(l) CALL PLOTXY (0 , XPLOT, YPLOT) C C ----- Move t o a l l o t h e r p o i n ts o l th e b ra n c h w ith th e pen down C DO ID = 1 , NDIVS C EXI = FLOAT(ID) * DIVIS - 1. C C -------- Compute 1-D p a r a b o l ic sh ap e l u n c t i o n s C

APPENDIX B: MESH AND CONTOUR PLOTS

SH A Pl(l) = 0 .5 * EXI * (EXI - 1 .) SHAP1(2) = 1. - EXI * EXI SHAP1(3) = 0 .5 * EXI * (EXI + 1 . ) C XPLOT = CORDIN (MSINO, NSINO, SHAP1, SICOX) YPLOT = CORDIN (MSINO, NSINO, SHAP1, SICOY) CALL PLOTXY ( 1 , XPLOT, YPLOT) C ENDDO C RETURN END C C ====================================================================== C S u b r o u tin e ELVECT form s a v e c t o r ELVAR o f e le m en t v a lu e s from a C g l o b a l v e c t o r GLVAR C ====================================================================== C SUBROUTINE ELVECT (MPOIN, MNODE, NNODE, LNODE, GLVAR, ELVAR) C DIMENSION k LNODE(MNODE), GLVAR(MPOIN), ELVAR(MNODE) C C ------------------------------------------------------------------------------------------------------------------------C C ----- Loop o v e r t h e e le m en t nodes C DO IN = 1 , NNODE C C -------- Move a te rm from a g l o b a l v e c t o r t o an e le m en t v e c t o r C IP = LNODE(IN) ELVAR(IN) = GLVAR(IP) C C ----- End o f lo o p o v e r t h e e le m en t nodes C ENDDO C RETURN END C C ====================================================================== C S u b ro u tin e SIVECT form s a v e c t o r SIVAR o f s i d e v a lu e s from a C g l o b a l v e c t o r GLVAR C ====================================================================== C SUBROUTINE SIVECT (MPOIN, MNODE, MSINO, NSINO, LNODE, LSINO, k GLVAR, SIVAR) C DIMENSION k LSINO(MSINO), LNODE(MNODE), GLVAR(MPOIN), k SIVAR(MSINO) C C ------------------------------------------------------------------------------------------------------------------------C C ---- Loop o v e r t h e s i d e nodes C DO IN = 1 , NSINO C C -------- Move a te rm from a g l o b a l v e c t o r t o an e le m en t v e c t o r

c

IP = LN0DE(LSIN0(IN)) SIVAR(IN) = GLVAR(IP)

C C ---- End o f lo o p o v e r th e e le m en t nodes C ENDDO C RETURN END C C ====================================================================== C S u b ro u tin e SHAPEF com putes t h e v a lu e s o f th e sh ap e f u n c ti o n s SHAP2 C f o r 2-D LINEAR and PARABOLIC e le m e n ts C ====================================================================== C SUBROUTINE SHAPEF (MNODE, NNODE, EXI, ETA, SHAP2) C DIMENSION k SHAP2(MNODE) C

4 45

446

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

C ------------------------------------------------------------------------------------------------------------------------C OMEXI = 1. - EXI OPEXI = 1. + EXI OMETA = 1. - ETA OPETA = 1. + ETA C IF (NNODE .EQ. 4) THEN C C -------- Compute l i n e a r sh ap e f u n c ti o n s C SHAP2C1) = 0 .2 5 * OMEXI * OMETA SHAP2(2) = 0 .2 5 * OPEXI * OMETA SHAP2(3) = 0 .2 5 * OPEXI * OPETA SHAP2(4) = 0 .2 5 * OMEXI * OPETA C ELSE C C -------- Compute p a r a b o l ic sh ap e f u n c ti o n s C 0MEX2 = 1. - EXI+EXI 0MET2 = 1. - ETA*ETA C SHAP2(2) = 0 .5 0 * 0MEX2 * OMETA SHAP2(4) = 0 .5 0 * 0MET2 * OPEXI SHAP2(6) = 0 .5 0 * 0MEX2 * OPETA SHAP2(8) = 0 .5 0 * 0MET2 * OMEXI C SHAP2(1) = 0 .2 5 * OMEXI * OMETA k 0 .5 0 * ( SHAP2(8) + SHAP2(2) ) SHAP2(3) = 0 .2 5 * OPEXI * OMETA k 0 .5 0 * ( SHAP2(2) + SHAP2(4) ) SHAP2(5) = 0 .2 5 * OPEXI * OPETA k 0 .5 0 * ( SHAP2(4) + SHAP2(6) ) SHAP2(7) = 0 .2 5 * OMEXI * OPETA k 0 .5 0 * ( SHAP2(6) + SHAP2(8) ) C ENDIF C RETURN END C C ====================================================================== C F u n c tio n CORDIN c a l c u l a t e s a c o o r d in a te o f sin i n t e r n a l node C ====================================================================== C FUNCTION CORDIN (MNODE, NNODE, SHAP2, ELCOR) C DIMENSION k SHAP2(MNODE), ELCOR(MNODE) C

c ----------------------------------------------------------------------------------------c CORDN = 0. DO IN = 1 , NNODE CORDN = CORDN + SHAP2(IN) * ELCOR(IN) ENDDO

C CORDIN = CORDN C RETURN END C C ======================================================================

C F u n c tio n LSTRAI ch eck s i f a s id e o f a p a r a b o lic elem en t i s s t r a i g h t C ====================================================================== C LOGICAL FUNCTION LSTRAI (MSINO, SICOX, SICOY) C DIMENSION k SICOX(MSINO), SICOY(MSINO) C COMMON /TOLER/ k TOLOO, T0L1P, T0L1M, TOLRL C C ------------------------------------------------------------------------------------------------------------------------C DELX1 = SIC0X(2) - SICOX(l) DELX2 = SIC0X(3) - SICOX(l) C IF (ABS(DELXl) .LT. TOLRL) THEN

APPENDIX B: MESH AND CONTOUR PLOTS

C C -------- Check l o r a lig n m e n t w ith t h e y - a x is C IF (ABS(DELX2) .LT. TOLRL) THEN LSTRAI = .TRUE. FT CJC*

LSTRAI = .FALSE. ENDIF C ELSE C C -------- Check i f th e s i d e i s s t r a i g h t C DELY1 = SIC0Y(2) - SICOY(l) DELY2 = SIC0Y(3) - SICOY(l) DELTY = DELX2 * DELY1 / DELX1 C IF (ABS(DELY2-DELTY) .LT. TOLRL) THEN LSTRAI = .TRUE. T?T QT?

LSTRAI = .FALSE. ENDIF C ENDIF C RETURN END C C ====================================================================== C S u b ro u tin e BANNER p r i n t s t h e h e a d in g o f th e o u tp u t f i l e C ====================================================================== C SUBROUTINE BANNER C CHARACTERS STARS, BLANK CHARACTERS FMTCH DATA FMTCH / ' ( A ) ' / C C ------------------------------------------------------------------------------------------------------------------------C STARS = * ************************************************* BLANK = ' * *' C C ----- P r i n t t h e h e a d in g on th e s c r e e n C WRITE( * , FMTCH) STARS WRITE( * , FMTCH) BLANK WRITE(*,FMTCH) * * Program TRAN_PL f o r t h e c r e a t i o n *» WRITE( * , FMTCH) ' * o f th e i n te r m e d ia te f i l e f o r p l o t t i n g *' WRITE( * , FMTCH) * * FEM m eshes and c o n to u r l i n e s *> WRITE( * , FMTCH) ' * (V e rs io n : FEM-HT) *' WRITE( * , FMTCH) BLANK WRITE( * , FMTCH) STARS WRITE( * , FMTCH) ' * C RETURN END C C ====================================================================== C S u b ro u tin e STOP w r i t e s a m essage and s to p s t h e e x e c u tio n C ====================================================================== C SUBROUTINE STOP (MESSG) C CHARACTER*60 MESSG CHARACTER*3 FMTCH DATA FMTCH / ' (A )V C C ------------------------------------------------------------------------------------------------------------------------C C ---- W rite t h e m essage C LL = INDEX(MESSG,' # ' ) - 1 WRITE( * , FMTCH) '0==== */ /MESSG( 1 : LL)/ / ' ====' C C ---- S to p t h e e x e c u tio n o f th e program C STOP C END

447

448

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

C C ====================================================================== C S u b ro u tin e IN_ERR p r i n t s in p u t e r r o r m essages (program TRAN.2D) C ====================================================================== C SUBROUTINE IN.ERR (ISUBR, IERRO, IMSG1, IMSG2) C LOGICAL LERRO CHARACTER*10 FMTCH, FMTCI DATA FMTCH / ' (A )' / DATA FMTCI / ' (A ,1 5 ) '/ C

c -----------------------------------------------------------------------------------------

c

C ----- E r r o r s i n s u b r o u tin e READIN C IF (ISUBR .EQ. 1) THEN WRITE( * , FMTCH) ’0 In p u t d a ta e r r o r d e te c t e d i n r o u t i n e READIN:' C IF (IERRO .EQ. 1) THEN LERRO = .TRUE. WRITE( * , FMTCI) ' IMESH: \ IMSG1 WRITE( * , FMTCH) ' IMESH can be e q u a l t o 0 o r e q u a l t o 1 o n l y ' C ELSEIF (IERRO .EQ. 2) THEN LERRO = .TRUE. WRITE( * , FMTCI) ' NCONT: ' , IMSG1 WRITE( * , FMTCI) ' MCONT: \ IMSG2 WRITE( * , FMTCH) ' NCONT: The number o f c o n to u r l i n e s m ust b e ' WRITE(*,FMTCH) ' g r e a t e r th a n z e r o and l e s s th a n o r e q u a l t o ' WRITE( * , FMTCH) ' t h e maximum number o f c o n to u r l i n e s MCONT' C ELSE LERRO = .FALSE. ENDIF C C ---- E r r o r s i n s u b r o u tin e GEDATA C ELSEIF (ISUBR .EQ. 2) THEN WRITE( * , FMTCH) 'O In p u t d a ta e r r o r d e te c t e d i n r o u t i n e GEDATA:' C IF (IERRO .EQ. 1) THEN LERRO = .TRUE. WRITE( * , FMTCI) ' NPOIN: ' , IMSG1 WRITE( * , FMTCI) ' MPOIN: ' , IMSG2 WRITE( * , FMTCH) ' NPOIN: t h e number o f p o i n ts m ust be g r e a t e r ' WRITE( * , FMTCH) ' th a n z e r o and l e s s th a n o r e q u a l t o t h e ' WRITE( * , FMTCH) ' maximum number o f p o i n ts MPOIN' C ELSEIF (IERRO .EQ. 2) THEN LERRO = .TRUE. WRITE( * , FMTCI) ' NELEM: ' , IMSG1 WRITE( * , FMTCI) ' MELEM: ' , IMSG2 WRITE( * , FMTCH) ' NELEM: t h e number o f e le m e n ts m ust b e ' WRITE(*, FMTCH) ' g r e a t e r th a n z e ro and l e s s th a n o r e q u a l t o ' WRITE(*, FMTCH) ' th e maximum number o f e le m e n ts MELEM' C ELSEIF (IERRO .EQ. 3) THEN LERRO = .TRUE. WRITE( * , FMTCI) ' ITYPE: ' , IMSG1 WRITE( * , FMTCH) ' E lem ent ty p e m ust be e q u a l t o 1 ' WRITE( * , FMTCH) ' ( l i n e a r e le m e n ts) o r e q u a l t o 2 ( p a r a b o l i c ' WRITE( * , FMTCH) ' e le m e n ts ) ' C ELSEIF (IERRO .EQ. 4) THEN LERRO = .TRUE. WRITE( * , FMTCI) ' LP: ' , IMSG1 WRITE( * , FMTCI) ' C o o rd in a te l i s t row num ber: ' , IMSG2 WRITE( * , FMTCH) ' Node number LP m ust be g r e a t e r th sm ' WRITE( * , FMTCH) ' z e ro and l e s s th a n o r e q u a l t o NPOMC' C ELSEIF (IERRO .EQ. 5) THEN LERRO = .TRUE. WRITE( * , FMTCI) ' LE: ' , IMSG1 WRITE( * , FMTCI) ' E lem ent l i s t row number IE : ' , IMSG2 WRITE( * , FMTCH) ' E lem ent number LE m ust be g r e a t e r ' WRITE(*, FMTCH) ' th a n z e ro and l e s s th a n o r e q u a l t o NELEM' C ELSEIF (IERRO .EQ. 6) THEN LERRO = .TRUE.

APPENDIX B: MESH AND CONTOUR PLOTS

WRITE(*fFMTCI) WRITE( * , FMTCI) WRITE( * , FMTCH) WRITE( * .FMTCH)

' 1 1 '

4 49

LNODE(IN.LE): \ IMSG1 E lem ent number LE: \ IMSG2 C o n n e c tio n l e s s th a n z e ro or* g r e a t e r th a n NELEM *

C ELSE LERRO = .FALSE. ENDIF C ELSE WRITE( * , FMTCI) » ISUBR: MSUBR WRITE( * , FMTCH) * S u b ro u tin e code n o t fo u n d i n r o u t i n e IN_ERR !* ENDIF C IF (.NOT. LERRO) THEN WRITE(*,FMTCI) ' IERRO:* ,IERRO WRITE( * , FMTCH) * E r r o r code n o t fo u n d . U pdate s u b r o u tin e IN_ERR* ENDIF C C ---- S to p t h e e x e c u tio n o f t h e program C CALL STOP ( ’ JOB ABORTED#*) C END C

B .5 E X A M PL E OF IN P U T SESSION FOR P R O G R A M T R A N _P L Program TRAN_PL has been used to produce all the mesh and contour plots included in this book. In the following, the input session to produce the intermediate file (ex­ tension .INT) for the contour plot of Fig. 6.15 is reported as an example. > > > F i l e co n ta in in g geometry d a ta (*.GD): EX_615 > > > Contour l i n e s [0] , mesh [1] : 0 > > > Number of contour v alu es: 10

> > > Contour v a lu e s: 100., 150., 20 0 ., 250 ., 3 0 0 ., 35 0 ., 4 0 0 ., 4 5 0 ., 50 0 ., 550. > > > F i l e c o n ta in in g v alues of PHI (*.PHI): EX_615 > > > Output f i l e (*.INT): EX_615_I File EX-615.GD is reported in Chapter 6, while file EX_615.PHI can be easily obtained from file EX_615.0UT, also reported in Chapter 6.

B .6 P R O G R A M D R A W .P S Program DRAW_PS produces a PostScript® file on the basis of the data contained in the output file generated by program TRAN_PL. The size of the drawing and the page orientation (portrait or landscape) can be chosen by the user. In the following, names and meanings of input variables used by program DRAW-PS are reported in alphabetical order. All of them are read in the main segment of the code. ILA N D : flag for page orientation. ILAND=0 : portrait orientation; ILAND=1 : landscape orientation.

450

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

IN A M E : name of the input file (file produced by program TRAN_PL). The maximum length of the file name is 40 characters. The extension .INT is always assumed. K D O W N : flag for plotter pen position. KDOWN=0 : pen up; KDOWN=l : pen down. O N A M E : name of the output file (PostScript file®). The maximum length of the file name is 40 characters. The extension .PS is always assumed. X C M A X : maximum value of the x Cartesian coordinate X C M IN : minimum value of the x Cartesian coordinate X PL O T : x coordinate of the point to be reached by the plotter pen. XSIZE : size of the drawing in the x direction (mm). Y C M A X : maximum value of the y Cartesian coordinate Y C M IN : minimum value of the y Cartesian coordinate Y PL O T : y coordinate of the point to be reached by the plotter pen. YSIZE : size of the drawing in the y direction (mm). List directed input (* format in the READ statements) is adopted, while suitable prompts guide data introduction from the keyboard. For the sake of clarity, the names of the appropriate input variables are reported under each prompt. > > > Input f i l e name (*.INT): IN A M E > > > Output f i l e name (*.PS): ONAM E > > > Size in x d i r e c t i o n (mm): XSIZE > > > Size in y d i r e c t i o n (mm) : YSIZE > > > P o r t r a i t [0] , landscape [1] : IL A N D All other input data are read from file INAM E//’INT’, which has already been de­ scribed in Section B.3 as the output file of program TRAN_PL.

B .7 LISTING OF PR O G R A M DRAW LPS c c

====================================================================== ======================================================================

cC

.

.

.

Program DRAW_PS l o r m aking a draw ing u s in g P o s tS c r i p t g r a p h ic s C V e rs io n : FEM-HT C ( P o s tS c r i p t i s a r e g i s t e r e d tra d e m a rk o l Adobe System s I n c o r p o r a te d ) C C ======================================================================

c ====================================================================== c PROGRAM DRAW_PS

C

CHARACTER*40 INAME, ONAME CHARACTERS FMTCH

C ft C

PSCONV (SIZEM, DCORD, CSHFT, COORD) = SIZEM * (COORD - CSHFT) / DCORD

DATA FMTCH / ' ( A ) ' /

C

-------------------------------------------------------------------------------------------C C ----- P r i n t t h e h e a d in g on t h e s c r e e n C CALL BANNER C C ----- Read in p u t d a ta C

APPENDIX B: MESH AND CONTOUR PLOTS

WRITE(*,FMTCH) > 0 » > I n p u t f i l e n a m e ( * .I N T ) : ' READ ( * , FMTCH) INAME WRITE( * , FMTCH) , 0 » > O utput f i l e name ( * . P S ) : ' READ ( * , FMTCH) ONAME WRITE( * , FMTCH) , 0 » > S iz e i n x d i r e c t i o n (mm) : * READ ( * ,* ) XSIZE WRITE(*, FMTCH) , 0 » > S iz e i n y d i r e c t i o n (mm) : * READ ( * ,* ) YSIZE WRITE(*,FMTCH) * 0 » > P o r t r a i t [ 0 ] , la n d s c a p e [1] : ' READ ( * ,* ) ILAND C C ----- Open in p u t and o u tp u t f i l e s C L1=INDEX(INAME//' >) - 1 L2=INDEX( ONAME// ' ») - 1 OPEN ( 1 , F IL E = IN A M E (1 :L 1 )//'.IN T \ STATUS=, OLD>, ft F0RM=»UNFORMATTED' ) OPEN (6 , FIL E =0N A M E (l:L 2)//>. PS*, STATUS=' UNKNOWN *) C C ----- I n i t i a l i z e P o s tS c r i p t k e r n e l C CALL PSINIT (ILAND, ONAME) C C ----- Read minimum and maximum c o o r d in a te s C READ (1 ) XCMIN, XCMAX, YCMIN, YCMAX C C ----- C a lc u l a t e p a ra m e te r s t o c e n t e r t h e p i c t u r e on th e p a p e r C DXCOR = XCMAX - XCMIN DYCOR = YCMAX - YCMIN RCORD = DYCOR / DXCOR RSIZE = YSIZE / XSIZE IF (RCORD .LE. RSIZE) THEN DMCOR = DXCOR SIZEM = XSIZE ELSE DMCOR = DYCOR SIZEM = YSIZE ENDIF CXSHF = 0 .5 * (XCMIN + XCMAX) CYSHF = 0 .5 * (YCMIN + YCMAX) C C ---- Make th e d ra w in g C 10 READ ( 1 ,END=20) KDOWN, XPLOT, YPLOT C PXPLT = PSCONV (SIZEM, DMCOR, CXSHF, XPLOT) PYPLT = PSCONV (SIZEM, DMCOR, CYSHF, YPLOT) CALL PSPLOT (KDOWN, PXPLT, PYPLT) C GOTO 10 C C ---- S to p P o s t S c r i p t k e r n e l C 20 CALL PSSTOP C CALL STOP ('END OF DRAWING#*) C END C C ====================================================================== C S u b ro u tin e PSINIT i n i t i a l i z e s P o s tS c r i p t k e r n e l C ====================================================================== C SUBROUTINE PSINIT (ILAND, ONAME) C CHARACTER+40 ONAME C C ---- C o n v e rsio n f a c t o r from p o i n t s t o m il l im e te r s PARAMETER (FACTR = 2 .8 3 5 ) C ---- T h ic k n e s s o f l i n e s PARAMETER (THICK = 0.48/FACTR) C ---- S c a le f a c t o r s i n x said y d i r e c t i o n s PARAMETER (XSCFT = FACTR, YSCFT = FACTR) C ---- O r ig in i n t h e c e n t e r o f t h e p a p e r (A4 f o r m a t ) . Change t h e s e v a lu e s C f o r d i f f e r e n t p a p e r fo rm a ts PARAMETER (XORIG = 1 0 5 ., YORIG = 1 3 1 .) C ----- R o ta tio n a n g le PARAMETER (ANGLE = 9 0 . )

451

45 2

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

C

c ------------------------------------------------------------------------------------------

c WRITE( 6 ,* ) *%!PS -A dobe-2.0 * W RITE(6,*) ’‘/.‘/ .C re a to r: TRAN_PL’ L1=INDEX(ONAME// ’ ’ , ’ ’ ) - 1 W RITE(6,*) ’’/.‘/ .T i t l e : ’ , 0NAME(1 : L 1 ) / / ’ .P S ’ W RITE(6,*) ’*/.‘/ .P ages: 1 ’ W RITE(6,*) ’‘/.‘/.EndComments’ W RITE(6,*) ’'/,'/,B e g in P ro lo g ’ W RITE(6,*) ’/ I { lin e to } d e f ’ W RITE(6,*) Vm {m oveto} d e f ’ W RITE(6,*) ’/ s t r { s tr o k e } d e f ’ W RITE(6,*) ’‘/.V.EndProlog’ W RITE(6,*) THICK, ’ s e tlin e w id th * WRITE( 6 ,* ) * n e w p a th ’ W RITE(6,*) ’*/. u n i t s [mm]’ W RITE(6,*) XSCFT, YSCFT, ’ s c a l e ’ W RITE(6,*) XORIG, YORIG, ’ t r a n s l a t e ’ IF (ILAND .EQ. l ) & WRITE(6,* ) ANGLE, ’ r o t a t e ’ C RETURN END C C ====================================================================== C S u b ro u tin e PSPLOT moves t o th e s p e c i f i e d p o in t w ith pen up o r down C ====================================================================== C SUBROUTINE PSPLOT (KDOWN, PXPLT, PYPLT) C C ------------------------------------------------------------------------------------------------------------------------C IF (KDOWN .EQ. 0) THEN C W RITE(6,*) ’ s t r ’ WRITE(6,*) PXPLT, PYPLT, ’ m’ C ELSEIF (KDOWN .EQ. 1) THEN C WRITE( 6 ,* ) PXPLT, PYPLT, ’ 1 ’ C ELSE C W RITE(*,*) ’OKDOWN: ’ , KDOWN CALL STOP ( ’ JOB ABORTED: i n v a l i d v a lu e f o r v a r i a b l e KDOWN#’ ) C ENDIF C RETURN END C C ======================================================================

C

S u b r o u tin e PSSOTP s to p s P o s tS c r i p t k e r n e l

C ======================================================================

c

SUBROUTINE PSSTOP C C ------------------------------------------------------------------------------------------------------------------------C WRITE( 6 ,* ) ’ s t r ’ WRITE( 6 ,* ) ’ show page’ W RITE(6,*) ' ‘/.‘/ . T r a i l e r ’ WRITE ( 6 ,* ) ’ ‘/.‘/.EOF ’ C RETURN END C C ====================================================================== C S u b r o u tin e BANNER p r i n t s th e h e a d in g on th e s c r e e n C ====================================================================== C SUBROUTINE BANNER C CHARACTER*SO STARS, BLANK CHARACTERS FMTCH DATA FMTCH / ’ (A )’/ C C ------------------------------------------------------------------------------------------------------------------------C

APPENDIX B: MESH AND CONTOUR PLOTS

STARS = ’ **************************»»********************’ BLANK = ' * *’ C C ----- P r i n t t h e h e a d in g on th e s c r e e n C WRITE( * , FMTCH) STARS WRITE( * , FMTCH) BLANK WRITE( * , FMTCH) * * Program DRAW_PS l o r m aking a d ra w in g WRITE( * , FMTCH) * * u s in g P o s tS c r i p t g r a p h ic s WRITE(*,FMTCH) 1 * (V e rs io n : FEM-HT) WRITE(*,FMTCH) 1 * ( P o s tS c r i p t i s a r e g i s t e r e d tra d e m a rk WRITE( * , FMTCH) * * o f Adobe System s I n c o r p o r a te d ) WRITE(*,FMTCH) BLANK WRITE( * , FMTCH) STARS WRITE( * , FMTCH) ' ' C RETURN END C

453

** *' ** **

C ======================================================================

C S u b ro u tin e STOP w r i t e s a m essage and s to p s th e e x e c u tio n C ====================================================================== C SUBROUTINE STOP (MESSG) C CHARACTERS MESSG CHARACTER+3 FMTCH DATA FMTCH / * ( A ) V C C ------------------------------------------------------------------------------------------------------------------------C C ----- W rite t h e m essage C LL = INDEX(MESSG,'# ') - 1 WRITE( * , FMTCH) ' > > Input f i l e name (+.INT): EX_615_I > > > Output f i l e name (*.PS): EX_615_I > > > Size in x d i r e c t i o n (mm) : 140. > > > Size in y d i r e c t i o n (mm) : 140. > > > P o r t r a i t [0] , landscape [1] : 1

Input file EX_615_I.INT is obtained using program TRAN_PL, as described in Sec­ tion B.5. R E FE R E N C E S 1. J.F. Stelzer and R. Welzel, “Plotting of contours in a natural way” , Int. J. Numer. Methods Eng., Vol. 24, 1757-1769, 1987. 2. Adobe Systems Incorporated, PostScript Language Reference Manual, 2nd ed., AddisonWesley Publ. Co., New York, 1990.

APPENDIX

C NOMENCLATURE

Here we list only the principal symbols utilized in the book and, consequently, symbols that appear infrequently are not listed in this Appendix. However, all the symbols are defined in the various Chapters as they are introduced. Therefore, the context should make the intended meaning clear also on the few occasions of minor importance when the same notation has to be used with different meanings. a A

A b

b B

B c

C CoA D e e E f Foa g h

H I hi

i> j, k J k

K I I L

L m n

n

, , Tly

N V

P Pe

TlZ

thermal diffusivity, m2/s area, m2 advection matrix half (semi) bandwidth vector of boundary convection contributions bandwidth matrix of boundary convection contributions specific heat, J/kg K capacity matrix discretized Courant number (= u A $ / A L), dimensionless diagonal matrix element number vector of generalized internal source/sink rates source/sink matrix load vector, sum of all known nonhomogeneous contributions discretized Fourier number (= a A f l/ A L 2), dimensionless modified load vector convection transfer coefficient stiffness matrix, sum of all homogeneous contributions integral node numbers unit vectors in the x, y, and z directions Jacobian matrix thermal conductivity, W /m K conductance matrix curvilinear coordinate, m transformed load vector characteristic length, m unit lower triangular matrix total number of elements total number of nodes outward unit vector normal to the boundary direction cosines of the outward normal one-row matrix of shape functions number of integration points vector of prescribed flow rates at the boundary Peclet number (= u L /a ), dimensionless 4 55

456

FINITE ELEMENT ANALYSIS IN HEAT TRANSFER

PeA q

q