IOIPSL. The IPSL input/output library

Size: px
Start display at page:

Download "IOIPSL. The IPSL input/output library"

Transcription

1 [IMAGE] IOIPSL The IPSL input/output library [IMAGE] Introduction The aim of this software project is to provide a simple but very flexible user interface for input/output and sampling operations within geophysical models. Flexibility means that for instance it should be very easy to choose the same sampling of data in the model as the one used for any in-situ observations.the final goal is to have most of these managing tasks outside of the model so the users and developers can concentrate on the physics of the model. In the design of this first version we have made a number of choices : FORTRAN 90 is the chosen programing language. The main reason is obviously to make our life simple but also because most of the models we use are in FORTRAN. netcdf is the data format. This choice should at one point only be an option as there is no reason why the interface should not be used for other formats as is done in most PCMDI software packages. The Open Source philosophy seems to us best suited for developing such software. Our main goal will always be to have a general and simple user interface and try to do all the work behind the scenes. For the moment the package contains 4 modules which should fulfill the major data management tasks in a geophysical model. Some of these packages are already well tested while other are still at an alpha level or even lower! A general introduction to the IOIPSL library was given at CERFACS on 23 Octobre The elements of IOIPSL HIST : Writes history files from a running model. It offers to the user a wide choice of sampling of the data and operations on the fly before it is written to the file. Stable version : A stable F90 version. Developments : MPP support and probably a re-write to make it more flexible (without changing the interfaces).

2 GETIN : Reads parameters from a file and configures the model for a given experiment. Stable version : A stable F90 version with a complete data base system. Developments : It should write the parameters of the run also in the restart file. FLIN : Inputs and outputs data sets from the model. Stable version : A rough version is available. Developments : It need to be refined and probably have its taks better defined. REST : Manages restart files. Stable version : A working F90 version Developments : It probably needs to be tested in more situations. Obtaining the source of IOIPSL. Installing IOIPSL. How does IOIPSL interact with the time-stepping of your model?. Examples of files produced by IOIPSL : For the moment the favored data format is netcdf using the GDT convention. Here are a few examples for headers of netcdf files produced by the HIST package : testhist1.cdl, testhist2.cdl, testhist2_bis.cdl. Where is IOIPSL used? The land-surface scheme ORCHIDEE at IPSL The ocean model OPA at IPSL The regional model PROMES at the Universidad the Complutense The GCM of the LMD. Coordination : Jan Polcher (Jan.Polcher@lmd.jussieu.fr) Marie-Alice Foujols (Marie-Alice.Foujols@ipsl.jussieu.fr)

3 Contributions IOIPSL Home Page $Date: 2001/09/24 14:51:30 $ $Revision: 1.2 $

4 HIST Introduction : This package allows to write with only a few commands data from a running model. HIST will do the sampling of the data and perform the operations needed. The storage format used is netcdf. It was designed in such a way that it is easy to use within a complex model and that it is flexible enough to be also used for debugging. The main feature are : Many different operation can be performed on the data before it is written on disk. Frequency of writing and operations can be selected by the user. This frequency can be in seconds or in month. For the last case negative values are used (more details are given in the description of the calendar description). Any number of files can be written in parallel. The software can also be used only within a parameterization of the model. It relies only on the time counter of the model. This software uses the time model of COADS. Only a zoomed part of the fields can be written to the file. HIST uses a calendar which is provided with IOIPSL Arrays which are a gathered set of points from the full 3D data can also be written. How to use HIST Three different things need to be done when implementing HIST : The file, axes and variables need to be declared : histbeg : The file is declared with a horizontal set of axes and a geographical zoom if needed. histhori & histvert : Additional horizontal axes of vertical axes can be added to the file. histdef : The variables which will be written are declared the following information are passed name of variable Title units size of the variable operation to be carried out on the variable before writing it frequency at which the operations need to be done (positive values are in units of seconds and negative values are in units of month.) frequency at which the resulting data need to be written into the file(positive values are in units of seconds and negative values are in units of month.) histend : Closing the definitions The data is given to HIST so that it does the operations or writes to the file : histwrite : the data is passed to HIST with an index table for the indexing operations. This call can come once every time step in the model as HIST will decide what needs to be done.

5 All files must be closed : histclo : to write minima and maxima for each variable and to close files. In case you fear that your program may crash or terminate abnormally you have to possibility to synchronize the buffer and the disk file at will with the function histsync. This means that you keep most of your data even if the histclo command was not executed. Some simple examples are provided in the directory example : testhist1.f90 is a simple example (in f90) which shows how to open a file and write variables. It produces a netcdf file which can then be used as a test for other applications. testhist2.f90 is another simple example (in f90) which open two files and writes some data over a longer time. Good to test the usage of the frequencies of operation and writes. Basic principals - The horizontal size (Two first indices) of the arrays to be passed to the software will be declared in histbeg. This is the size of the lon and lat arrays it is given. The horizontal structure of the zoom of data to be archived is also given to histbeg. The reason is that we want to declare the axes in the netcdf file only over the slab of data. - The vertical coordinate are declared with the subroutine histvert. It allows to include any number of axes. When the variables are defined the vertical to be used can be specified. - histdef will declare the variable, its name and units and the size of the full array in the model. This is the size of the data as it will be provided to the subroutine histwrite (Except in the case where a gathered array and the indices is given). The vertical zoom to be used and the vertical axis (from the ones defined above) that applies to the data are given. The number of bytes to store on is also passed but not yet used. Finally the operation and the frequencies are provided. - histwrite has the simplest call as we wish to keep it flexible to make it easy to move it around in the model. The variable is identified by its name, the time step is given and finally the data. A new feature has been introduced but not yet fully tested. Through a number of indices and the index field HIST write can receive the data as a gathered array. It will then expand it to the full 3D field and do the appropriate zoom if needed. Allowed operations : In histdef the user may specify for each field that is going to be archived a number of operations. 3 types may be distinguished : Vector operations, vector-scalar operations and index operations on the vector. In the description of the operations to be carried out the vector will be represented by x. For instance a gather operation will be written L "gather(x)". It must be noted that the indexing

6 operations will use as index vector the one passed to histwrite. This allows indexing to change through time (does not work yet). On top of this a time operation has to be chosen. There only one is allowed and it should be outer most operator. For instance the time averaging of the gather operation will be written as : "ave(gather(x))" Allowed time operations : ave : time average of the field inst : Instantaneous values of the field is going to be written t_min : The minimum value over the time period is going to be archived t_max : The maximum value over the time period is going to be archived l_min : The minimum value over the entire simulation is going to be archived (without time dimension) l_max : The maximum value over the entire simulation is going to be archived (without time dimension) t_sum : Sums the variable over time. once : The field is written once on the file without any time axis never : The field is never written Allowed vector operations : usage : sin(x) sin : Sinus cos : cosines tan : tangent asin : arc-sinus acos : arc-cosines atan : arc-tangent exp : exponential log : logarithm sqrt : square root chs : change sign abs : absolute value cels : Transforms the field into degrees Celsius kelv : Transforms the field into degrees Kelvin deg : puts field into degrees (from radian for instance) rad : puts field into radians ident : Identity, does nothing! Allowed vector-scalar operations : Usage : scal+x + : addition - : minus * : multiplication / : division

7 ^ : exponential min : (min(x,scal)) Minimum between x and scal max : (max(x,scal)) Maximum between x and scal Allowed indexing operations : Usage : gather(x) gather : gathers from the input data all the points listed in index and puts them onto the file. Other points in the resulting array are going to labeled as missing. This operation could be used to reduce the resolution of the history file. scatter : scatters from the input data onto the points which are listed in the index. Other points are going to be labeled as missing. This is used for instance to put a variable only available over oceans onto a global grid. coll : The same function as gather but the points which are not indexed are not altered. fill : Same function as scatter except that the points which are not indexed are left untouched only : Only the points listed in index have meaningful data and the others are changed to missing. This is useful for masking. undef : The points listed in index are set to undefined The index array has some special feature for the scatter and fill operations. We have added on top of the the standard capability of the these operation the possibility to repeat a given point. This is accomplished by using negative values in the index array. This operation is useful in cases where the model has a value for each pole which needs to be duplicated for the cylindrical projection.the negative values will not have any effect for the other operations. Thus the same index vector can be used for the scatter and the gather. Here is an example : the input vector : The index vector : The resulting vector : The first value was repeated 3 times (the index before 1 is -3) and then a normal scatter is performed. It must be noted that the repetition of the values is done after the scatter and thus if the user is not careful it can overwrite previous values. There is no test to ensure that it does not happen. Examples ave(scatter(cels(x)) : Will average the variables (temperature for instance) in celsius and scatter it onto the grid. This could be used in an ocean model where all grid points are in a vector and cover only ocean points. Thus in the history file you will have the field placed correctly on the map. ave(max(cels(x),0.)) : Average over time only the temperature (if that is the variable in Kelvin) which are above 0. t_max(x) : Computes the maximum over the time between two writes of the variable. Other examples can be tested in a bench program for the syntax analyzer. It will show you how it decomposes the string you provide. The F90 code of the bench testopp.f90 is available in the directory example. Configuration routines for HIST : ioconf_modname( model name ) : This subroutine will change the name of the model name in the netcdf file. The default value is : An IPSL model. Calendar : The calendar can be configured using the functions in the calendar module.

8 To be done : The netcdf files produced should follow the CF convention. Implementation started but some points could still be improved. GDT recommends the use of days since for the units of the time axis. The time axis should then be ot type double. Improve this documentation and write a french one. Allow variables with different grids which have different dimensions in the same file. $Date: 2001/09/24 14:51:30 $ $Revision: 1.2 $

9 GETIN Introduction : This module gives a simple mechanism to read runtime configuration files in the model. It sets up a database which can then be queried from any point within the model. Combined with the Fparser and Tk/Tcl tools a menu base configuration tool can be build automatically for the code. How to use it : The idea is the following: Each parameter in the model is identified by a keyword and provided with a default value in the model. Then a call is made to getin in order to see if this value is changed in the configuration file run.def. If this is the case then the default value is replaced. Then any later call to getin corresponding to this keyword will return exactly the same values, either the default first set or the values from the configuration file. At the end of the model the user can make a call to the subroutine "getin_dump" (it has one optional argument to replace the standard prefix of the files generated) to write out the content of the data base for all the keywords and values encountered in the code. It will signal if the value is a default or read from the configuration file. These dumped files can then be as used as they are as new configuration files. Just before the call to getin a number of comments can be written to describe the keyword. This will first help the user of the code to understand what is need but these comments can also be used by Fparser to generate the menu based configuration tool. Typically the initialization of a changeable parameter in the code would comprise the following code and comments : C Config Key = FORCING_FILE Config Desc = Name of file containing the forcing data Config Def = Cabauw.nc Config Help = This is the name of the file which should be opened Config for reading the forcing data of the dim0 model. Config The format of the file has to be netcdf and COADS Config C C C Compliant. filename= Cabauw.nc CALL getinc( FORCING_FILE,1, filename) In F90 the configuration commands are written like this :!Config Key = FORCING_FILE!Config Desc = Name of file containing the forcing data!config Def = Cabauw.nc

10 This way scalar or vector parameters can be read. It also allows for conditional parameters. This is useful if for instance a set of parameter is only needed when a certain value is set for another parameter. The code for this is taken in great part from the configuration tool of the Linux Kernel. Syntax of the run.def file The syntax of run.def is relatively simple : Empty lines and lines which have as first non blank character are considered to be comments. Each element has to be preceded by a keyword. It should be in capital letters and only the 30 first characters are significant. The value specified for the keyword can either be of type real, integer, character or logical. Arrays can be written in three different ways : 1. One keyword and a line with all elements separated by blanks. 2. The same method can also be used but separating each element by a new line. In this case you can not have an empty or commented line in the list. 3. A subscripts is added to the keyword. It is thus written as KEYWORD n. That is element n of array corresponding to keyword KEYWORD. In this case only one value can be given to the keyword. Strings with spaces can be provided as a value to a keyword if they are enclosed in quotes. You may subdivide the input over many files. Just add anywhere in the run.def (or other definition files) the keyword "INCLUDEDEF" and give as a value the name of the file you which to include. For instance : INCLUDEDEF = toto.def Here is a short example of a run.def file : This file is liked to the following files : INCLUDEDEF = toto.def A logical value DEBUG_INFO = TRUE A single string FORCING_FILE = islscp_for.nc A single real value GRAVIT = A vector of strings WORDS = here there anywhere A vector of real values

11 VECTOR= How to implement the configuration tool into the Makefile : In the main Makefile the configuration in each sub Makefile needs to be executed. Then the parser needs to be applied to all the code present in the main directory. The -source option specifies which sub-directories need to be taken into account. Finally the menus need to be build and the Tk shell executed. config : (cd ioipsl; make config) (cd sechiba; make config)./ioipsl/fparser -main -name SECHIBA_0dim -source ioipsl -source sechiba *.f./ioipsl/build_tkmenus ioipsl sechiba./kconfig.tk In each of the sub-directories the config line in the Makefile is much simpler. config :../ioipsl/fparser -name SECHIBA *.f90 echo Configuration of SECHIBA done $Date: 2001/07/06 14:12:32 $ $Revision: 1.2 $

12 FLIN Introduction In contrast to HIST this set of subroutine are designed to write and read data from netcdf files in one piece. The only slab which is allowed is along the time axis. Thus to use these routines you need to know the size of the domain covered by the data. You can read a portion of data (zooming). On the other hand the routines are made to be as convention independent as possible so that as many net CDF files as possible can be read. Currently this piece of software is still in beta version but it works. For the moment the thing it needs most is a documentation. I hope I will have to time to do it very soon. $Date: 2000/06/05 08:34:07 $ $Revision: $

13 REST Introduction This module manage the restart files and that include the following tasks : Check the presence in the file of the variable needed by the model Check that the date is correct Check that the dimensions are correct. write the variable to the restart file if it is time to do so. The restart files can be in netcdf as the IEEE format is less accurate than the representation used in netcdf for the range of values used in a numerical model. The advantage of netcdf is that the restart file is easy to manipulate and the data included can be well documented. The created files follow a simplified version of the GDT1.2 convention. $Date: 2000/06/05 08:34:08 $ $Revision: $

14 Time stepping in IOIPSL Introduction : The idea we have tried to implement in IOIPSL for the description of time is that the model only needs to know and communicate to IOIPSL the time-step at which it is and the increment between two time steps in seconds. All the rest should be handled by IOIPSL. Obviously this does not exclude the model from having its own calendar but it is not needed. Functions are available to match the IOIPSL calendar with the one of the model. To achieve this three pieces of information need to be exchanged between the model and IOIPSL : The starting date : This is the date in Julian days at which the time step counter was equal to zero. The Julian date is defined according to the calendar chosen. It is very important that this day is the one a which the time step counter was equal to zero and not to one, else all the time axes will be shifted and discontinuities may appear. Time step length : This is the time in seconds which represents the increment of the time-step counter by one. Usually there are a number of time step length and thus time step counters in a model and it does not matter too much which one is chosen but it should always be the same. The fact that the time step length is used may cause problems if one wishes to apply IOIPSL to a model with a variable time-step. Time step counter : This is an integer which is incremented as the model integrates over the period of a time step. It starts with the value zero and then increases until the end of the integration. These three pieces of information are used by the HIST and REST modules. If they are correctly defined all should go well. Example : Here is an example how the time-stepping is done and passed to IOIPSL. First of all we use two distinct time step counters. One for the current time-step (itau_c ) and another for the time-step to which the current calculations are going to lead (itau_n ). Thus the model takes at each iteration the variables from time step itau_c to itau_n which corresponds to an increment of dt in time. dt is thus the time step length. The model begins with : itau_c = 0 itau_n = 1 at the Julian day date0. This information can for instance be obtained from the restart file with a call of the type : CALL restini(..., itau_c, date0, dt,...). When the history files are defined one has to remember that the first iteration of the model starts at itau_c. As we possibly wish to archive the data produced while integrating from itau_c to itau_n the files need to be defined as follows : CALL histbeg(..., itau_c, date0, dt,...)

15 Whatever the value of itau_c, date0 will always be the Julian day at which itau_c=0. When retrieving data from the restart file the starting time step has to be used : itau_c. Thus we would write the call to restget as : CALL restget(..., itau_c,...). On the other hand it has been chosen to label the time step for the history file as the end of the current iteration. This means that all the variables computed between itau_c and itau_n will be included if it was chosen to write on disk at itau_n. Thus the call to a histwrite should have the following structure : CALL histwrite(..., itau_n,...). When the result of the iteration is written to the restart file it is also this last time step which is used. Thus we would write : CALL restput(..., itau_n,...). The time DO loop would end in this configuration with the following instructions : itau_c = itau_n itau_n = itau_n + 1. The sequencing of time-steps is relatively straight forward and should be adaptable to most models. It is just a matter of knowing where the counters start and what they mean. $Date: 2000/06/05 08:34:08 $ $Revision: $

FORTRAN Basis. PROGRAM LAYOUT PROGRAM program name IMPLICIT NONE [declaration statements] [executable statements] END PROGRAM [program name]

FORTRAN Basis. PROGRAM LAYOUT PROGRAM program name IMPLICIT NONE [declaration statements] [executable statements] END PROGRAM [program name] PROGRAM LAYOUT PROGRAM program name IMPLICIT NONE [declaration statements] [executable statements] END PROGRAM [program name] Content in [] is optional. Example:- PROGRAM FIRST_PROGRAM IMPLICIT NONE PRINT*,

More information

Lecture 2 FORTRAN Basics. Lubna Ahmed

Lecture 2 FORTRAN Basics. Lubna Ahmed Lecture 2 FORTRAN Basics Lubna Ahmed 1 Fortran basics Data types Constants Variables Identifiers Arithmetic expression Intrinsic functions Input-output 2 Program layout PROGRAM program name IMPLICIT NONE

More information

C Functions. 5.2 Program Modules in C

C Functions. 5.2 Program Modules in C 1 5 C Functions 5.2 Program Modules in C 2 Functions Modules in C Programs combine user-defined functions with library functions - C standard library has a wide variety of functions Function calls Invoking

More information

A Guide to Using Some Basic MATLAB Functions

A Guide to Using Some Basic MATLAB Functions A Guide to Using Some Basic MATLAB Functions UNC Charlotte Robert W. Cox This document provides a brief overview of some of the essential MATLAB functionality. More thorough descriptions are available

More information

A very brief Matlab introduction

A very brief Matlab introduction A very brief Matlab introduction Siniša Krajnović January 24, 2006 This is a very brief introduction to Matlab and its purpose is only to introduce students of the CFD course into Matlab. After reading

More information

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION

EDIABAS BEST/2 LANGUAGE DESCRIPTION. VERSION 6b. Electronic Diagnostic Basic System EDIABAS - BEST/2 LANGUAGE DESCRIPTION EDIABAS Electronic Diagnostic Basic System BEST/2 LANGUAGE DESCRIPTION VERSION 6b Copyright BMW AG, created by Softing AG BEST2SPC.DOC CONTENTS CONTENTS...2 1. INTRODUCTION TO BEST/2...5 2. TEXT CONVENTIONS...6

More information

Functions. Systems Programming Concepts

Functions. Systems Programming Concepts Functions Systems Programming Concepts Functions Simple Function Example Function Prototype and Declaration Math Library Functions Function Definition Header Files Random Number Generator Call by Value

More information

Creates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window.

Creates a 1 X 1 matrix (scalar) with a value of 1 in the column 1, row 1 position and prints the matrix aaa in the command window. EE 350L: Signals and Transforms Lab Spring 2007 Lab #1 - Introduction to MATLAB Lab Handout Matlab Software: Matlab will be the analytical tool used in the signals lab. The laboratory has network licenses

More information

MATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano

MATLAB Lesson I. Chiara Lelli. October 2, Politecnico di Milano MATLAB Lesson I Chiara Lelli Politecnico di Milano October 2, 2012 MATLAB MATLAB (MATrix LABoratory) is an interactive software system for: scientific computing statistical analysis vector and matrix computations

More information

An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s.

An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s. Using Monte Carlo to Estimate π using Buffon s Needle Problem An interesting related problem is Buffon s Needle which was first proposed in the mid-1700 s. Here s the problem (in a simplified form). Suppose

More information

C++ Programming: From Problem Analysis to Program Design, Third Edition

C++ Programming: From Problem Analysis to Program Design, Third Edition C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 2: Basic Elements of C++ Objectives (continued) Become familiar with the use of increment and decrement operators Examine

More information

Subprograms. FORTRAN 77 Chapter 5. Subprograms. Subprograms. Subprograms. Function Subprograms 1/5/2014. Satish Chandra.

Subprograms. FORTRAN 77 Chapter 5. Subprograms. Subprograms. Subprograms. Function Subprograms 1/5/2014. Satish Chandra. FORTRAN 77 Chapter 5 Satish Chandra satish0402@gmail.com When a programs is more than a few hundred lines long, it gets hard to follow. Fortran codes that solve real research problems often have tens of

More information

Macro Programming Reference Guide. Copyright 2005 Scott Martinez

Macro Programming Reference Guide. Copyright 2005 Scott Martinez Macro Programming Reference Guide Copyright 2005 Scott Martinez Section 1. Section 2. Section 3. Section 4. Section 5. Section 6. Section 7. What is macro programming What are Variables What are Expressions

More information

An Introduction to Stata By Mike Anderson

An Introduction to Stata By Mike Anderson An Introduction to Stata By Mike Anderson Installation and Start Up A 50-user licensed copy of Intercooled Stata 8.0 for Solaris is accessible on any Athena workstation. To use it, simply type add stata

More information

I/A Series Software Spreadsheet

I/A Series Software Spreadsheet I/A Series Software Spreadsheet The I/A Series Spreadsheet is an interactive, easy-to-use tool, that allows process operators, engineers, and managers to manipulate data in a row/column format and graph

More information

GRAPH 4.4. Megha K. Raman APRIL 22, 2015

GRAPH 4.4. Megha K. Raman APRIL 22, 2015 GRAPH 4.4 By Megha K. Raman APRIL 22, 2015 1. Preface... 4 2. Introduction:... 4 3. Plotting a function... 5 Sample funtions:... 9 List of Functions:... 10 Constants:... 10 Operators:... 11 Functions:...

More information

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 4

BIL 104E Introduction to Scientific and Engineering Computing. Lecture 4 BIL 104E Introduction to Scientific and Engineering Computing Lecture 4 Introduction Divide and Conquer Construct a program from smaller pieces or components These smaller pieces are called modules Functions

More information

Scheme Quick Reference

Scheme Quick Reference Scheme Quick Reference COSC 18 Winter 2003 February 10, 2003 1 Introduction This document is a quick reference guide to common features of the Scheme language. It is by no means intended to be a complete

More information

University of Alberta

University of Alberta A Brief Introduction to MATLAB University of Alberta M.G. Lipsett 2008 MATLAB is an interactive program for numerical computation and data visualization, used extensively by engineers for analysis of systems.

More information

AN INTRODUCTION TO MATLAB

AN INTRODUCTION TO MATLAB AN INTRODUCTION TO MATLAB 1 Introduction MATLAB is a powerful mathematical tool used for a number of engineering applications such as communication engineering, digital signal processing, control engineering,

More information

BC An Arbitrary Precision Desk-Calculator Language. Lorinda Cherry Robert Morris Bell Laboratories Murray Hill, New Jersey ABSTRACT

BC An Arbitrary Precision Desk-Calculator Language. Lorinda Cherry Robert Morris Bell Laboratories Murray Hill, New Jersey ABSTRACT BC An Arbitrary Precision Desk-Calculator Language Lorinda Cherry Robert Morris Bell Laboratories Murray Hill, New Jersey 07974 ABSTRACT BC is a language and a compiler for doing arbitrary precision arithmetic

More information

Long (or LONGMATH ) floating-point (or integer) variables (length up to 1 million, limited by machine memory, range: approx. ±10 1,000,000.

Long (or LONGMATH ) floating-point (or integer) variables (length up to 1 million, limited by machine memory, range: approx. ±10 1,000,000. QuickCalc User Guide. Number Representation, Assignment, and Conversion Variables Constants Usage Double (or DOUBLE ) floating-point variables (approx. 16 significant digits, range: approx. ±10 308 The

More information

Downloaded from Chapter 2. Functions

Downloaded from   Chapter 2. Functions Chapter 2 Functions After studying this lesson, students will be able to: Understand and apply the concept of module programming Write functions Identify and invoke appropriate predefined functions Create

More information

LAB 1 General MATLAB Information 1

LAB 1 General MATLAB Information 1 LAB 1 General MATLAB Information 1 General: To enter a matrix: > type the entries between square brackets, [...] > enter it by rows with elements separated by a space or comma > rows are terminated by

More information

What is MATLAB and howtostart it up?

What is MATLAB and howtostart it up? MAT rix LABoratory What is MATLAB and howtostart it up? Object-oriented high-level interactive software package for scientific and engineering numerical computations Enables easy manipulation of matrix

More information

Introduction to C Language

Introduction to C Language Introduction to C Language Instructor: Professor I. Charles Ume ME 6405 Introduction to Mechatronics Fall 2006 Instructor: Professor Charles Ume Introduction to C Language History of C Language In 1972,

More information

Scheme Quick Reference

Scheme Quick Reference Scheme Quick Reference COSC 18 Fall 2003 This document is a quick reference guide to common features of the Scheme language. It is not intended to be a complete language reference, but it gives terse summaries

More information

Industrial Automation course

Industrial Automation course Industrial Automation course Lesson 7 PLC Structured Text Politecnico di Milano Universidad de Monterrey, July 2015, A. L. Cologni 1 Introduction The Structured Text is the higher level IEC 61131 programming

More information

Functions and Graphs. The METRIC Project, Imperial College. Imperial College of Science Technology and Medicine, 1996.

Functions and Graphs. The METRIC Project, Imperial College. Imperial College of Science Technology and Medicine, 1996. Functions and Graphs The METRIC Project, Imperial College. Imperial College of Science Technology and Medicine, 1996. Launch Mathematica. Type

More information

The Graphing Calculator

The Graphing Calculator Chapter 23 The Graphing Calculator To display the calculator, select Graphing Calculator from the Window menu. The calculator is displayed in front of the other windows. Resize or re-position the Graphing

More information

The Very Basics of the R Interpreter

The Very Basics of the R Interpreter Chapter 2 The Very Basics of the R Interpreter OK, the computer is fired up. We have R installed. It is time to get started. 1. Start R by double-clicking on the R desktop icon. 2. Alternatively, open

More information

Numerical Modelling in Fortran: day 2. Paul Tackley, 2017

Numerical Modelling in Fortran: day 2. Paul Tackley, 2017 Numerical Modelling in Fortran: day 2 Paul Tackley, 2017 Goals for today Review main points in online materials you read for homework http://www.cs.mtu.edu/%7eshene/courses/cs201/notes/intro.html More

More information

ME1107 Computing Y Yan.

ME1107 Computing Y Yan. ME1107 Computing 1 2008-2009 Y Yan http://www.staff.city.ac.uk/~ensyy About Fortran Fortran Formula Translation High level computer language Basic, Fortran, C, C++, Java, C#, (Matlab) What do we learn?

More information

10 Using the PCFL Editor In this chapter

10 Using the PCFL Editor In this chapter 10 Using the PCFL Editor In this chapter Introduction to the PCFL editor 260 Editing PCFL registers 261 Customizing the PCFL configuration file 272 ProWORX NxT User s Guide Introduction to the PCFL editor

More information

VBScript: Math Functions

VBScript: Math Functions C h a p t e r 3 VBScript: Math Functions In this chapter, you will learn how to use the following VBScript functions to World Class standards: 1. Writing Math Equations in VBScripts 2. Beginning a New

More information

Documentation for LISP in BASIC

Documentation for LISP in BASIC Documentation for LISP in BASIC The software and the documentation are both Copyright 2008 Arthur Nunes-Harwitt LISP in BASIC is a LISP interpreter for a Scheme-like dialect of LISP, which happens to have

More information

Methods CSC 121 Fall 2014 Howard Rosenthal

Methods CSC 121 Fall 2014 Howard Rosenthal Methods CSC 121 Fall 2014 Howard Rosenthal Lesson Goals Understand what a method is in Java Understand Java s Math Class Learn the syntax of method construction Learn both void methods and methods that

More information

9 Using Equation Networks

9 Using Equation Networks 9 Using Equation Networks In this chapter Introduction to Equation Networks 244 Equation format 247 Using register address lists 254 Setting up an enable contact 255 Equations displayed within the Network

More information

Dr M Kasim A Jalil. Faculty of Mechanical Engineering UTM (source: Deitel Associates & Pearson)

Dr M Kasim A Jalil. Faculty of Mechanical Engineering UTM (source: Deitel Associates & Pearson) Lecture 9 Functions Dr M Kasim A Jalil Faculty of Mechanical Engineering UTM (source: Deitel Associates & Pearson) Objectives In this chapter, you will learn: To understand how to construct programs modularly

More information

Dr Richard Greenaway

Dr Richard Greenaway SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 2 Basic MATLAB Operation Dr Richard Greenaway 2 Basic MATLAB Operation 2.1 Overview 2.1.1 The Command Line In this Workshop you will learn how

More information

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath

UNIT - I. Introduction to C Programming. BY A. Vijay Bharath UNIT - I Introduction to C Programming Introduction to C C was originally developed in the year 1970s by Dennis Ritchie at Bell Laboratories, Inc. C is a general-purpose programming language. It has been

More information

Graphing Calculator Scientific Calculator Version 2.0

Graphing Calculator Scientific Calculator Version 2.0 Graphing Calculator Scientific Calculator Version 2.0 www.infinitysw.com/ets March 14, 2017 1 Table of Contents Table of Contents 1 Overview 3 2 Navigation 4 3 Using the Calculator 5 Display 5 Performing

More information

Dr Richard Greenaway

Dr Richard Greenaway SCHOOL OF PHYSICS, ASTRONOMY & MATHEMATICS 4PAM1008 MATLAB 3 Creating, Organising & Processing Data Dr Richard Greenaway 3 Creating, Organising & Processing Data In this Workshop the matrix type is introduced

More information

Excel R Tips. is used for multiplication. + is used for addition. is used for subtraction. / is used for division

Excel R Tips. is used for multiplication. + is used for addition. is used for subtraction. / is used for division Excel R Tips EXCEL TIP 1: INPUTTING FORMULAS To input a formula in Excel, click on the cell you want to place your formula in, and begin your formula with an equals sign (=). There are several functions

More information

Appendix A. The Preprocessor

Appendix A. The Preprocessor Appendix A The Preprocessor The preprocessor is that part of the compiler that performs various text manipulations on your program prior to the actual translation of your source code into object code.

More information

Software installation

Software installation Table of contents 1 Introduction...4 2 Software installation...4 2.1 Protection...4 2.2 Minimum recommended configuration...4 2.3 Installation...4 3 Uninstall the application...4 4 Software presentation...5

More information

APPENDIX A SOFTWARE INFORMATION

APPENDIX A SOFTWARE INFORMATION APPENDIX A SOFTWARE INFORMATION The Feedback Thermal Control Experiment and Process Simulator are analog systems so a data acquisition board and Matlab s data acquisition toolbox are used to collect data

More information

MATLAB BASICS. < Any system: Enter quit at Matlab prompt < PC/Windows: Close command window < To interrupt execution: Enter Ctrl-c.

MATLAB BASICS. < Any system: Enter quit at Matlab prompt < PC/Windows: Close command window < To interrupt execution: Enter Ctrl-c. MATLAB BASICS Starting Matlab < PC: Desktop icon or Start menu item < UNIX: Enter matlab at operating system prompt < Others: Might need to execute from a menu somewhere Entering Matlab commands < Matlab

More information

Methods CSC 121 Fall 2016 Howard Rosenthal

Methods CSC 121 Fall 2016 Howard Rosenthal Methods CSC 121 Fall 2016 Howard Rosenthal Lesson Goals Understand what a method is in Java Understand Java s Math Class and how to use it Learn the syntax of method construction Learn both void methods

More information

(Refer Slide Time: 00:02:00)

(Refer Slide Time: 00:02:00) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 18 Polyfill - Scan Conversion of a Polygon Today we will discuss the concepts

More information

ANSI C Programming Simple Programs

ANSI C Programming Simple Programs ANSI C Programming Simple Programs /* This program computes the distance between two points */ #include #include #include main() { /* Declare and initialize variables */ double

More information

Chapter 3 - Functions

Chapter 3 - Functions Chapter 3 - Functions 1 Outline 3.1 Introduction 3.2 Program Components in C++ 3.3 Math Library Functions 3.4 Functions 3.5 Function Definitions 3.6 Function Prototypes 3.7 Header Files 3.8 Random Number

More information

Finding, Starting and Using Matlab

Finding, Starting and Using Matlab Variables and Arrays Finding, Starting and Using Matlab CSC March 6 &, 9 Array: A collection of data values organized into rows and columns, and known by a single name. arr(,) Row Row Row Row 4 Col Col

More information

Basic types and definitions. Chapter 3 of Thompson

Basic types and definitions. Chapter 3 of Thompson Basic types and definitions Chapter 3 of Thompson Booleans [named after logician George Boole] Boolean values True and False are the result of tests are two numbers equal is one smaller than the other

More information

Computing Fundamentals

Computing Fundamentals Computing Fundamentals Salvatore Filippone salvatore.filippone@uniroma2.it 2012 2013 (salvatore.filippone@uniroma2.it) Computing Fundamentals 2012 2013 1 / 18 Octave basics Octave/Matlab: f p r i n t f

More information

Chapter 1 INTRODUCTION

Chapter 1 INTRODUCTION Chapter 1 INTRODUCTION A digital computer system consists of hardware and software: The hardware consists of the physical components of the system. The software is the collection of programs that a computer

More information

from Appendix B: Some C Essentials

from Appendix B: Some C Essentials from Appendix B: Some C Essentials tw rev. 22.9.16 If you use or reference these slides or the associated textbook, please cite the original authors work as follows: Toulson, R. & Wilmshurst, T. (2016).

More information

Laboratory 1 Octave Tutorial

Laboratory 1 Octave Tutorial Signals, Spectra and Signal Processing Laboratory 1 Octave Tutorial 1.1 Introduction The purpose of this lab 1 is to become familiar with the GNU Octave 2 software environment. 1.2 Octave Review All laboratory

More information

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur

Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Introduction to Internet of Things Prof. Sudip Misra Department of Computer Science & Engineering Indian Institute of Technology, Kharagpur Lecture - 23 Introduction to Arduino- II Hi. Now, we will continue

More information

1 Introduction to Matlab

1 Introduction to Matlab 1 Introduction to Matlab 1. What is Matlab? Matlab is a computer program designed to do mathematics. You might think of it as a super-calculator. That is, once Matlab has been started, you can enter computations,

More information

CS-201 Introduction to Programming with Java

CS-201 Introduction to Programming with Java CS-201 Introduction to Programming with Java California State University, Los Angeles Computer Science Department Lecture V: Mathematical Functions, Characters, and Strings Introduction How would you estimate

More information

DataMaster for Windows

DataMaster for Windows DataMaster for Windows Version 3.0 April 2004 Mid America Computer Corp. 111 Admiral Drive Blair, NE 68008-0700 (402) 426-6222 Copyright 2003-2004 Mid America Computer Corp. All rights reserved. Table

More information

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4500/8506 Operating Systems Summer 2016 Programming Assignment 1 Introduction The purpose of this

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4500/8506 Operating Systems Summer 2016 Programming Assignment 1 Introduction The purpose of this UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4500/8506 Operating Systems Summer 2016 Programming Assignment 1 Introduction The purpose of this programming assignment is to give you some experience

More information

Pathologically Eclectic Rubbish Lister

Pathologically Eclectic Rubbish Lister Pathologically Eclectic Rubbish Lister 1 Perl Design Philosophy Author: Reuben Francis Cornel perl is an acronym for Practical Extraction and Report Language. But I guess the title is a rough translation

More information

Lab copy. Do not remove! Mathematics 152 Spring 1999 Notes on the course calculator. 1. The calculator VC. The web page

Lab copy. Do not remove! Mathematics 152 Spring 1999 Notes on the course calculator. 1. The calculator VC. The web page Mathematics 152 Spring 1999 Notes on the course calculator 1. The calculator VC The web page http://gamba.math.ubc.ca/coursedoc/math152/docs/ca.html contains a generic version of the calculator VC and

More information

By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program

By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program 1 By the end of this section you should: Understand what the variables are and why they are used. Use C++ built in data types to create program variables. Apply C++ syntax rules to declare variables, initialize

More information

Introduction to MATLAB

Introduction to MATLAB Introduction to MATLAB Basics MATLAB is a high-level interpreted language, and uses a read-evaluate-print loop: it reads your command, evaluates it, then prints the answer. This means it works a lot like

More information

Introduction to Engineering gii

Introduction to Engineering gii 25.108 Introduction to Engineering gii Dr. Jay Weitzen Lecture Notes I: Introduction to Matlab from Gilat Book MATLAB - Lecture # 1 Starting with MATLAB / Chapter 1 Topics Covered: 1. Introduction. 2.

More information

C++ PROGRAMMING SKILLS Part 3 User-Defined Functions

C++ PROGRAMMING SKILLS Part 3 User-Defined Functions C++ PROGRAMMING SKILLS Part 3 User-Defined Functions Introduction Function Definition Void function Global Vs Local variables Random Number Generator Recursion Function Overloading Sample Code 1 Functions

More information

JUN / 04 VERSION 7.0

JUN / 04 VERSION 7.0 JUN / 04 VERSION 7.0 PVI EWEXEME www.smar.com Specifications and information are subject to change without notice. Up-to-date address information is available on our website. web: www.smar.com/contactus.asp

More information

Methods: A Deeper Look

Methods: A Deeper Look 1 2 7 Methods: A Deeper Look OBJECTIVES In this chapter you will learn: How static methods and variables are associated with an entire class rather than specific instances of the class. How to use random-number

More information

MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras

MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras MATLAB Programming for Numerical Computation Dr. Niket Kaisare Department Of Chemical Engineering Indian Institute of Technology, Madras Module No. #01 Lecture No. #1.1 Introduction to MATLAB programming

More information

DCS-100A. Dynamic Data Acquisition Software SOFTWARE. Monitors measurement data with various graphs and numerical windows. Acquires data efficiently.

DCS-100A. Dynamic Data Acquisition Software SOFTWARE. Monitors measurement data with various graphs and numerical windows. Acquires data efficiently. 4-3 DCS-100A Dynamic Data Acquisition Software SOFTWARE Software Monitors measurement data with various graphs and numerical windows. Acquires data efficiently. The basic operation does not depend on the

More information

By the end of this section of the practical, the students should be able to:

By the end of this section of the practical, the students should be able to: By the end of this section of the practical, the students should be able to: Write JavaScript to generate HTML Create simple scripts which include input and output statements, arithmetic, relational and

More information

Content of this short manual:

Content of this short manual: This short manual describes some functions of the 2D dashes, which are not yet described in the general dashboard manual or may differ from the explanations there. You can find the general dashboard manual

More information

Methods CSC 121 Spring 2017 Howard Rosenthal

Methods CSC 121 Spring 2017 Howard Rosenthal Methods CSC 121 Spring 2017 Howard Rosenthal Lesson Goals Understand what a method is in Java Understand Java s Math Class and how to use it Learn the syntax of method construction Learn both void methods

More information

XQ: An XML Query Language Language Reference Manual

XQ: An XML Query Language Language Reference Manual XQ: An XML Query Language Language Reference Manual Kin Ng kn2006@columbia.edu 1. Introduction XQ is a query language for XML documents. This language enables programmers to express queries in a few simple

More information

Polar Coordinates. 2, π and ( )

Polar Coordinates. 2, π and ( ) Polar Coordinates Up to this point we ve dealt exclusively with the Cartesian (or Rectangular, or x-y) coordinate system. However, as we will see, this is not always the easiest coordinate system to work

More information

The SPL Programming Language Reference Manual

The SPL Programming Language Reference Manual The SPL Programming Language Reference Manual Leonidas Fegaras University of Texas at Arlington Arlington, TX 76019 fegaras@cse.uta.edu February 27, 2018 1 Introduction The SPL language is a Small Programming

More information

Summary I Minimum system requirements...2

Summary I Minimum system requirements...2 Logiciel 1 Summary I Minimum system requirements...2 I 1 Minimum configuration required...2 I 2 uninstallation...2 I 3 Launching application...2 II installation...2 III presentation...3 III 1 Home page...3

More information

Introduction to GNU-Octave

Introduction to GNU-Octave Introduction to GNU-Octave Dr. K.R. Chowdhary, Professor & Campus Director, JIETCOE JIET College of Engineering Email: kr.chowdhary@jietjodhpur.ac.in Web-Page: http://www.krchowdhary.com July 11, 2016

More information

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently.

Definition: A data structure is a way of organizing data in a computer so that it can be used efficiently. The Science of Computing I Lesson 4: Introduction to Data Structures Living with Cyber Pillar: Data Structures The need for data structures The algorithms we design to solve problems rarely do so without

More information

8. Control statements

8. Control statements 8. Control statements A simple C++ statement is each of the individual instructions of a program, like the variable declarations and expressions seen in previous sections. They always end with a semicolon

More information

1001ICT Introduction To Programming Lecture Notes

1001ICT Introduction To Programming Lecture Notes 1001ICT Introduction To Programming Lecture Notes School of Information and Communication Technology Griffith University Semester 1, 2015 1 M Environment console M.1 Purpose This environment supports programming

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

Outline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An.

Outline. CSE 1570 Interacting with MATLAB. Starting MATLAB. Outline. MATLAB Windows. MATLAB Desktop Window. Instructor: Aijun An. CSE 170 Interacting with MATLAB Instructor: Aijun An Department of Computer Science and Engineering York University aan@cse.yorku.ca Outline Starting MATLAB MATLAB Windows Using the Command Window Some

More information

IPSL Boot Camp Part 5:

IPSL Boot Camp Part 5: IPSL Boot Camp Part 5: CDO and NCO Sabine Radanovics, Jérôme Servonnat March 24, 2016 1 / 33 Group exercise Suppose... We have Tasks 30 years climate model simulation 1 file per month, 6 hourly data netcdf

More information

CALCA. I/A Series Software Advanced Calculator (CALCA) Block. Product Specifications INTEGRATED CONTROL INTELLIGENT AUTOMATION PSS 21S-3M8 B4

CALCA. I/A Series Software Advanced Calculator (CALCA) Block. Product Specifications INTEGRATED CONTROL INTELLIGENT AUTOMATION PSS 21S-3M8 B4 PSS 21S-3M8 B4 I/A Series Software Advanced Calculator (CALCA) Block REAL INPUTS (8) INTEGER INPUTS (2) LONG INTEGER INPUTS (2) BOOLEAN INPUTS (16) MANUAL/AUTO CALCA REAL OUTPUTS (4) INTEGER OUTPUTS (6)

More information

Scheme of work Cambridge International AS & A Level Computing (9691)

Scheme of work Cambridge International AS & A Level Computing (9691) Scheme of work Cambridge International AS & A Level Computing (9691) Unit 2: Practical programming techniques Recommended prior knowledge Students beginning this course are not expected to have studied

More information

Data Types and Basic Calculation

Data Types and Basic Calculation Data Types and Basic Calculation Intrinsic Data Types Fortran supports five intrinsic data types: 1. INTEGER for exact whole numbers e.g., 1, 100, 534, -18, -654321, etc. 2. REAL for approximate, fractional

More information

Functions. Lecture 6 COP 3014 Spring February 11, 2018

Functions. Lecture 6 COP 3014 Spring February 11, 2018 Functions Lecture 6 COP 3014 Spring 2018 February 11, 2018 Functions A function is a reusable portion of a program, sometimes called a procedure or subroutine. Like a mini-program (or subprogram) in its

More information

The PCAT Programming Language Reference Manual

The PCAT Programming Language Reference Manual The PCAT Programming Language Reference Manual Andrew Tolmach and Jingke Li Dept. of Computer Science Portland State University September 27, 1995 (revised October 15, 2002) 1 Introduction The PCAT language

More information

Computer Programming in MATLAB

Computer Programming in MATLAB Computer Programming in MATLAB Prof. Dr. İrfan KAYMAZ Atatürk University Engineering Faculty Department of Mechanical Engineering What is a computer??? Computer is a device that computes, especially a

More information

Chapter 5. Repetition. Contents. Introduction. Three Types of Program Control. Two Types of Repetition. Three Syntax Structures for Looping in C++

Chapter 5. Repetition. Contents. Introduction. Three Types of Program Control. Two Types of Repetition. Three Syntax Structures for Looping in C++ Repetition Contents 1 Repetition 1.1 Introduction 1.2 Three Types of Program Control Chapter 5 Introduction 1.3 Two Types of Repetition 1.4 Three Structures for Looping in C++ 1.5 The while Control Structure

More information

C Programs: Simple Statements and Expressions

C Programs: Simple Statements and Expressions .. Cal Poly CPE 101: Fundamentals of Computer Science I Alexander Dekhtyar.. C Programs: Simple Statements and Expressions C Program Structure A C program that consists of only one function has the following

More information

FANF. programming language. written by Konstantin Dimitrov. Revision 0.1 February Programming language FANF 1 / 21

FANF. programming language. written by Konstantin Dimitrov. Revision 0.1 February Programming language FANF 1 / 21 programming language FANF written by Konstantin Dimitrov Revision 0.1 February 2014 For comments and suggestions: knivd@me.com Programming language FANF 1 / 21 Table of Contents 1. Introduction...3 2.

More information

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance.

c) Comments do not cause any machine language object code to be generated. d) Lengthy comments can cause poor execution-time performance. 2.1 Introduction (No questions.) 2.2 A Simple Program: Printing a Line of Text 2.1 Which of the following must every C program have? (a) main (b) #include (c) /* (d) 2.2 Every statement in C

More information

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University

Lesson #3. Variables, Operators, and Expressions. 3. Variables, Operators and Expressions - Copyright Denis Hamelin - Ryerson University Lesson #3 Variables, Operators, and Expressions Variables We already know the three main types of variables in C: int, char, and double. There is also the float type which is similar to double with only

More information

IPCoreL. Phillip Duane Douglas, Jr. 11/3/2010

IPCoreL. Phillip Duane Douglas, Jr. 11/3/2010 IPCoreL Programming Language Reference Manual Phillip Duane Douglas, Jr. 11/3/2010 The IPCoreL Programming Language Reference Manual provides concise information about the grammar, syntax, semantics, and

More information

WINTER. Web Development. Template. PHP Variables and Constants. Lecture

WINTER. Web Development. Template. PHP Variables and Constants. Lecture WINTER Template Web Development PHP Variables and Constants Lecture-3 Lecture Content What is Variable? Naming Convention & Scope PHP $ and $$ Variables PHP Constants Constant Definition Magic Constants

More information