1 / 23

CHAPTER 7

CHAPTER 7. SCIENTIFIC VISUALIZATION AND INTRODUCTION TO ARRAYS. Introduction. Visualization is a post-processing technique which allows to display and analyze the results of any problem This chapter partly provides an introductory overview to the field of scientific visualization

jela
Download Presentation

CHAPTER 7

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CHAPTER 7 SCIENTIFIC VISUALIZATION ANDINTRODUCTIONTOARRAYS

  2. Introduction • Visualization is a post-processing technique which allows to display and analyze the results of any problem • This chapter partly provides an introductory overview to the field of scientific visualization • Rather than describe whiz-bang visualization systems which might not be available to you, the following sections will be tailored toward useful information by approaching the subject from a data domain point of view.

  3. Objective • The objective to first part of this chapter is to provide a working knowledge of the concepts, techniques and currently available some basic introductory level tools for scientific visualization. • Application Areas: Almost every engineering discipline, pure and applied science, medical and some areas of social sciences. • Motivations: (1) Increase the understanding of any physical phenomenon,(2) Verification and validation of the results, (3) Reduce the level of difficulty of any problem for outsiders, (4) Model more complex systems using visualization tools.

  4. Some visualization types Some visualization areas related to our engineering field are as follows • visualization of computational fluid dynamics (such as potential flow, compressible or incompressible and turbulent flows) • visualization of structural dynamics and strength • visualization of time domain simulations • animation (real time) and virtual reality • experimental flow visualization

  5. Visualization tools • Thermal and flow field analysis for a space shuttle. • Commercial software

  6. Visualization tools • Interaction of free surface water waves with a vertical cylinder. • Application of a scientific 3-D graphic program

  7. Visualization tools • Interaction of free surface water waves with an advancing ship. • Application of a scientific 3-D graphic program

  8. Some file types used frequently • Binary and ASCII file formats • Text files ( *.txt) • Programming files (*.f, *.f90,*.for, *.c,*.cpp, *.p, *.bas) • Postscript files (*.ps, *.pdf) • Document and TeX or LaTeX files (*.doc and *.tex) • Graphic file formats: (*.gif, *.tif) • mpeg, gpeg and avi movie file formats • Web page *.htm and *.html file format and java files (for web) • Each graphic application program use its own file format and sometimes accepts other file formats

  9. Some graphic programs • Symbolic algebra and graphic programs • MapleV, Mathematica, Matlab, Mathcad, Mupad, Octave • MacSyma, Scientific Notebook, MathView, Derive • Common scientific visualization programs • gnuplot, surfer, tecplot, ensight, 3D, sigmaplot • graphic, statistica, visio, canvas, autoCAD, standford • Computer Graphing Programs • Winplot, Graphmatica, Multigraph

  10. A Portable Scientific Visualization Program: Gnuplot 2-D Plotting plot “file_name” using 1:2 with line or plot “file_name” u 1:2 w l set label “Sin(x) Plotting” set xlabel “x (rad)” set ylabel “sin(x)” replot

  11. A Portable Scientific Visualization Program: Gnuplot 2-D Plotting (cont..) Or we may use some features in a single line like plot “file_name” u 1:2 title “sin(x) Plotting” w l We may set x and y ranges in 2-D graph set xrange xmin xmax set yrange ymin ymax

  12. A Portable Scientific Visualization Program: Gnuplot How to get a postscript file? set term postscript save “filename.ps” set term windows (or x11)

  13. A Portable Scientific Visualization Program: Gnuplot How to generate 3-D graph? splot “file_name” using 1:2:3 with line or splot “file_name” u 1:2:3 w l If you decide to use the other columns in your data file (such as 4th and 6th columns with 1st column) in this case: splot “file_name” u 1:4:6 w l

  14. A Portable Scientific Visualization Program: Gnuplot Further reading • Bil101 Lecture Notes, Chapter 12 • Gnuplot 3.5 user guide • Additional material can be obtained through yahoo search machine using keyword “gnuplot” • Windows version of gnuplot is posted on the ftp site of this course

  15. Application • Program sin-cos.f • Gnuplot (The basic scientific plotting tool which can be accessed by every student)

  16. An introduction to Arrays • Anarray is defined as a variable that is composed of array elements. All members of a particular array have the same data type, type properties, and all other attributes • An array element is designated by the name of the array along with a parenthesized list of subscript expressions. Only one subscript is required to designate a particular element of a one-dimensional array (also called a vector); two are required for a two-dimensional array (or matrix); three are required for a three-dimensional array (or cube). List(17) Vector(I+1) Matrix(I,J) Cube(I,J,K)

  17. Declaration for an Array • The number of subscripts in an array element name is called the rank, or dimensionality, of the array. Array Declaration An array is declared by a dimension attribute specifier that follows the Type name in a type declaration. The dimension attribute is specified by a list of subscript bounds, one for each dimension. dimension (subscript bounds) In the simplest case, the subscript bound for each dimension is an integer constant. For example: integer, parameter :: P=30, R=3 real, dimension(P,R) :: Blood_Pressure, Medication, Correlation real, dimension(20,20) :: Matrix_1, Matrix_2

  18. Declaration for an Array • Names of arrays that share the same type, shape, and all other attributes are listed on the right side, following the double colon. Standard type declaration form is follows: Type name (Type properties), Attributes :: List of names Examples: implicit none integer, parameter :: LOW = Selected_Real_Kind(6) integer, parameter :: BIG = 20, SIZE = 17, SQUARES = 8, FEW = 4, & SHORT = 20, LONG = 144, GAP = 5 integer, dimension (FEW) :: Array integer, dimension(SQUARES, SQUARES) :: Chessboard integer, dimension(FEW, FEW, FEW) :: Cube real, dimension(BIG, BIG) :: Matrix real, dimension(SIZE) :: Able real, dimension(LONG) :: John, Baker, Delta

  19. Declaration for an Array real, dimension(SHORT) :: Sponsor, A real (Kind = LOW), dimension(BIG) :: X real (Kind = LOW), dimension(FEW) :: Y character (len = GAP), dimension(SHORT) :: Sponsor, A Advise:Always use named constants, rather than numerical constants used in subscript bound specifications. UPPER and LOWER Subscript Bounds There may be a Lower bound as well as an Upper bound for subscript values in the range for any of the dimensions in an array. For instance; real, dimension(0 : 4) :: W real, dimension(-3 : 9) :: X real, dimension(1 : 4) :: M real, dimension(6 : 9) :: Title Above, the vector W has 5 elements, numbered from 0 to 4; X has 13 elements, numbered from -3 to 9; M has 4 elements, numbered from 1 to 4; and Title has 4 elements, numbered from 6 to 9 (inclusive).

  20. Bound declaration • If no Lower bound is declared, the default lower subscript bound is 1. • There are two forms of bound declaration: Upper bound Lower bound : Upper bound • The extent (number of elements) for this dimension of the array is Upper bound - Lower bound +1. Let’s check some examples include arrays with ranks 1, 2, and 3: integer, dimension(0 : 4, -1 : 3, 6 : 9) :: Threes integer, dimension(0 : 6) :: A integer, dimension(0 : 6, 0 : 6) :: B integer, dimension(7, 2 : 8) :: C Above array called Threes has rank 3; the first subscript ranges from 0 to 4, the second from -1 to 3, and the third from 3 to 9. Array A has rank 1; its single subscript ranges from 0 to 6. Arrays B and C have rank 2. In array C, the first subscript must be between 1 and 7 and the second between 2 and 8.

  21. Bound declaration • More than one arrays may have the same shape but different subscript bounds. For instance, each of the following arrays has shape (5,5): real, dimension(5, 0 : 4) :: A real, dimension(0 : 4, 5) :: B real, dimension(11 : 15, 11 : 15) :: C The total number of element for each of the above arrays is 25. For the below hyper cube called Fives has 720 elements. real, dimension(3, 4, 5, 6, 2) :: Fives • An array may have fixed size, deferred shape, automatic shape, or assumed shape; the latter two are permitted only in a procedure (see example 5.1, Meissner’s book) • (1) A fixed-size array has dimension bounds that are constant expressions of integer type • (2) A deferred-shape array is an allocatable array or an allocatable pointer target. Only the rank is declared; dimension bounds are specified in the statement that allocates the array. • (3) A local variable in a procedure or a function result may be an automatic-shape array that is the declared bounds may be specification expressions to be evaluated during procedure entry.

  22. Simple examples • (4) Dummy argument arrays in a procedure must be assumed-shape arrays. Only the rank is declared. EXAMPLES: Assume that we would like to read 50 FailureTimes: do I=1, 50 read(unit=10, fmt=*) FailureTime(I) end do above statement is equivalent to the following sequence of 50 read statements, read (10, *) FailureTime(1) read (10, *) FailureTime(2) read (10, *) FailureTime(3) . . . read (10, *) FailureTime(50)

  23. Exercises • Study survey_analysis.f • Read pages between 162 and 176(Ellis’s book). • Study self-test 7.1 on page 176.

More Related