![]() DeclarationsĮvery variable should be defined in a declaration. You may use the syntax REAL*8 to denote 8-byte floating-point variables in Abaqus subroutines. Usually, a real is a 4-byte variable and the double-precision is 8 bytes. Numerical calculations in subroutines usually need very high precision and DOUBLE PRECISION should be used. Fortran has two different types for decimal (floating point) variables, called REAL and DOUBLE PRECISION. When a number is not an integer, it is considered a decimal. They are usually stored as 4 bytes variables. Fortran has only one type for integer variables. IntegersĪn integer is a number that can be written without a fractional component. The most frequently used data types are integer and real (floating point). Variable Typesįortran supports several different data types to make data manipulation easier: Some examples are PROGRAM, REAL, STOP, END, etc. Like many other languages, the words which make up the Fortran language are called reserved words and cannot be used as names of variables. Variable names in Fortran consist of the letters A-Z, the digits 0-9 and underscore ( _). Also, we may use digits (using 2 for the second line, 3 for the third, and so on). Example: C THE NEXT STATEMENT GOES OVER TWO PHYSICAL LINESĪny character can be used instead of the plus sign ( +) as a continuation character. One can then break the statement into two or more lines, and use the continuation mark in position 6 (I mean you put 5 spaces and then type +). Sometimes, a statement does not fit into the 66 available columns (7-72) of a single line. Loops Section (Do Loop) in the second part of this article ( Under Construction) to see a practical use of statement labels. The programmer is responsible for assigning a unique number to each label in each program (or subprogram). Typically, many loops and other statements in a single program require a statement label. Statement labels are used to mark positions in the program. This type of comment can be any place among your piece of code (look at ‘ ! THIS IS RADIUS OF THE CIRCLE’). You may also use the exclamation mark ( !) for comments. The lines that begin with a “ C” here are comments and have no purpose other than to make the program more readable. 6 Continuation of the previous line (optional) The most important rules are the column position rules: Column Position Rulesįortran has very few rules for how to format the source code. However, Fortran is not case-sensitive, so “X” and “x” are the same variable. Originally, all Fortran programs had to be written in all upper-case letters. READ (*,*) R ! THIS IS RADIUS OF THE CIRCLE Take a look at this simple piece of code: PROGRAM CIRCLE REAL R, AREAĬ THIS PROGRAM READS A REAL NUMBER R AND PRINTS C THE AREA OF A CIRCLE WITH RADIUS R. BasicsĪ Fortran program is just a sequence of lines of text. Here is a handy package of almost all the things you will need… 1. Furthermore, you need to know only an even smaller subset of FORTRAN to write a subroutine code in Abaqus. Its syntax is also very similar to MATLAB. Start Writing a Subroutine in Abaqus: Basics and Recommendationsįortran is one of the easiest programming languages to learn because it can do virtually nothing other than basic low-level operations common to all languages. If you are newer to Abaqus subroutine, you should start from here: In Abaqus, user subroutines are primarily written in Fortran, although developing your code in C or C++ is also possible.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |