You are on page 1of 51

A introduction to nite elements based on examples with Cast3m


Laboratoire de Mcanique des Solides CNRS UMR 7649 Dpartement de Mcanique, Ecole Polytechnique 91120 Palaiseau, France


Introduction 1.1 Historical remarks . . . . 1.2 Linux Installation . . . . 1.3 Windows Installation . . 1.4 Running castem . . . . 1.5 Structure of the program

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

4 4 4 5 6 7 12 12 12 13 16 17 17 17 18 19 19 19 19 20 20 24 25 26 26 28 29 29 29 30 31 34 34 34 37

Meshing Outline . . . . . . . . . . . . . . . . . . . . 2.1 General settings . . . . . . . . . . . . . . . . . 2.2 Examples of 2D mesh creation . . . . . . . . . 2.3 Example of a 3D mesh creation . . . . . . . . . 2.4 Deformation of meshes . . . . . . . . . . . . . 2.5 Import and export of meshes, format exchange . 2.6 Numbers and mesures for meshes . . . . . . . Exercises . . . . . . . . . . . . . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

Elliptic problems: elasticity and heat transfer Outline . . . . . . . . . . . . . . . . . . . . . 3.1 Variational formulation of the elastic equilibrium 3.2 General settings . . . . . . . . . . . . . . . . . . 3.3 Elasticity - castem problem setting . . . . . . . 3.3.1 Boundary conditions and solution method 3.3.2 Other applied forces: pressure, weight, . . . 3.3.3 Surface traction and applied pressure . . 3.3.4 Body forces . . . . . . . . . . . . . . . . 3.3.5 Spatially varying material coefcients . . 3.4 Thermal equilibrium - castem problem setting . 3.5 Exercices . . . . . . . . . . . . . . . . . . . . . Exercices . . . . . . . . . . . . . . . . . . . 3.6 Material coefcients varying with temperature . .

. . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

. . . . . . . . . . . . .

Parabolic problems: transient heat transfer 4.1 Exemple en analyse dynamique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Elastoplasticity Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1 Plasticity - programming of a incremental algorithm . . . . . . . . . . . . . . . . . . . . . . . 5.2 Plasticity - computation using pasapas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2

Input and output Outline . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1 Cast3m objects . . . . . . . . . . . . . . . . . . . . . . . 6.2 Graphics and plots . . . . . . . . . . . . . . . . . . . . . 6.3 exte[ieur] calling an exterior program . . . . . . . . . . 6.4 chau[ssette] dynamic link with another program, server 6.5 Reading and writing data . . . . . . . . . . . . . . . . . . 6.6 util: reading subroutines . . . . . . . . . . . . . . . . . 6.7 Meshes and le format exchange . . . . . . . . . . . . . . Exercices . . . . . . . . . . . . . . . . . . . . . . . . How to and other questions

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

. . . . . . . . .

41 41 41 42 43 43 43 44 45 46 47



Historical remarks

The CEA - Commisariat lnrgie atomique, Saclay, France ( is a french governmentfunded technological research organisation, which has developped in the past twenty years a dedicated toolbox for nite element computations Cast3M. The toolbox contains the essential elements in order to perform a nite element computation. Its main application area is mechanics including elasticity, elasto-visco-plasticity material behaviour and analysis adapted for equilibrium, buckling, vibration or dynamics problems. Other application areas include thermak, hydraulic or elactromagnetic analysis. Its modular character permits program new application in an easy and confortable manner, which make the tool adapted for coupled multiphysics problems. Cast3M is based on family of objets, i.e. data structures and a lexicon of operators, i.e. elementary operations acting on the given objects. ogether they form specic programming language called gibiane:. The code itself is written in an extended Fortran called esope which permit a direct handling of the specic data structure. The website: contains a general presentation of the code, example les, online and downloadable documentations. Downloadable versions for Linux and Windows of the computer code are available for a non-commercial usage of the program. The source code can also be recovered after a previous acceptance by the CEA. For Mac OS users there is no ofcial release. However Pierre Alain Boucard from the LMT laboratory at ENS-Cachan has complied a version with the adapted libraries and provides kindly dowloadable versions on his website: (G4/G5) (Intel et 10.4)


Linux Installation

We start from the assumption that the code is already installed in the directory cast3m_dir. Some of the subdirectories are: bin - containing the binary les and the bash-script: castem launching the binaries. data - contains a series of les which will be linked with the binary at each execution. They contain informations about errors, procedures, documentation. dgibi - a large collection of batch-tests of the operators which can be used a basis for examples docs - contains the documentation in both pdf and html formating. It is pratical to link the favorite webbrowser to the pages containing the lists of operators: 4

cast3m_dir/doc/html/doc-ang.html cast3m_dir/doc/html/doc-fra.html

help les in english help les in french

docs/pdf In this directory we can retrieve a series of explanatory documents written about the example les or as short introductory lectures. Let us point the introduction to Cast3m written in english by Fichoux [2]: cast3m_dir/doc/pdf/beginning.pdf are interesting documents are the structured list of operators, the annotated examples les, etc.

All documents and examples are also in free access on the Cast3m website, were the example les and the help information can equally been found using a search engine.

Help and example les

cast3m_dir/dgibi cast3m_dir/doc/html/doc-ang.html cast3m_dir/doc/html/doc-fra.html noti gibi; info operator_name;

example les help les in english help les in french

Help commands prints general help in the shell (in french) prints the help-le in the shell (in french) Documents document les in english and french documents and technical reports



Windows Installation

The le structure of the Windows installation is equivalent with the Linux installation, the difference relies only in the denitions of paths in Windows versus Linux, where becomes /. When installing the program, its is important to pay attention to several details specied in the README (resp. LISEZMOI) les: the creation of the C:\tmp directory for swapping data during the computation, and the creation of the environmental variable CASTEM=cast3m_dir. If the home directory lies in the C:\Program Files\cast3m directory the variable should become: CASTEM=C:\Progra1\cast3m 5


Running castem


In the Linux environment, the castem program is launched usually in a shell terminal (xterm, ...):

The castem command launches the program on the shell command line initiated by the $ character, and creates a new shell environment where again each line initiates with the $ character. The program will send its information in the shell directly or within lines starting with . As in the denition of the paramter a. The -m XL option denes the size of the static memory allocated by the computer to the program and one should understand that castem will afterwards dynamically place its structure is this memory space.

[andrei@rhea Test] $ castem -m XL Le fichier de debordement se trouve dans : /local/tmp .............. &&&&&&&&&&&&&&&&&&&&&&&&&& $ FIN DE FICHIER SUR L'UNITE 3 LES DONNEES SONT MAINTENANT LUES SUR LE CLAVIER $ * $ a = 3; * a = 3; $

If a swap space will be needed the swap le (chier de debordement) will be dened in the /local/tmp directory. The comment regarding the logic unit UNITE 3 corresponds to the case explained in the following example.

This command launches castem and executes in a rst step the commands found in the le pressure.dgibi. Technically the program copies the le myfile.dgibi into fort.3 (called logic unit UNITE 3) and reads this le. In a second step the program waits for the commands to be types in the castemshell as in the example before. Technically the program will copy the commands typied in the shell into the fort.98 (called logic unit UNITE 98) and reads this le line by line.

[andrei@rhea Test] $ castem -m XL myfile.dgibi Le fichier de debordement se trouve dans : /local/tmp .............. &&&&&&&&&&&&&&&&&&&&&&&&&& $ * * myfiles content $ * is read here $ * ........ $ * end of myfile; $ * $

It is important to remember this information for the case of a program crash, as the fort.98 will keep a track of all typed commands. The le will keep the information up to the next program start when all its contents is removed and the le is iniatialized as blank. Both fort.3 and fort.98 are to be found in the working directory, therefore one should avoid to launch simulatneously two castem processes in the same directory, as they would be confused in using these les.

Once the program is started as in the examples before with several command should be remembered: typing the command fin; stops the program typing the command opti donn 5; in myfile.dgibi stops its reading and returns the hand to the user in the castem-shell. typing the command opti donn 3; in the castem-shell returns the hand from the user to the reading unit 3, i.e. the myfile.dgibi le.


Structure of the program

From the programming point of view Cast3M differentiats two levels of programming: a compiled low level language : ESOPE. This language will be invisible for the normal user, its the language of the creators of Cast3M. As explained earlier its just a derivation of the classical F ORTRAN language enriched with operations for the manipulation of specic objects (creation, copy, removal, . . . of data structure). 7

a high level interpreted language : gibiane:, formed by a lexicon of operation which permits an easy usage of the code and which is the language of the normal user as examplifyed in this text. From this point of view, Cast3M is comparable with codes like Mathematica, Matlab, Scilab, Octave, Mapple, ..., ESOPE beeing the langauge of the creator and gibiane: the language of the user. The essence of gibiane: 1 can be resumed in the following way: objet_2 = operator objet_1 ; The sign ";" denes the end of the command and obliges the system to execute the operator having objet_1 as its argument and to create a new resulting object object_2. Let us start by dening some basic syntax rules of gibiane:: name of operators are dened by their rst 4 characters. As a consequence vibr denes the vibr[ation] operator, however specifying the complete name does is still permitted. Names of objects should not be longer than 8 characters. Moreover one should avoid that the rst 4 characters coincide with the name of an operator, as this would erase the operator. As in old versions of the fortran language lines should not be longer than 72 characters. However the code can accept that a command is typed on up to 9 consecutive lines. No special character is needed to announce the continuation of a command on the next line. Brackets (,) can be used, for example they permit to insert one command into another without creating at each step an additional object. They should be used within algebraic operations. castem does not automatically recognize the order of algebraic operations and execute operations in order of apereance. That means for example that:

a + b * c = (a + b) * c
and the excepted equality does not hold:

a + b * c =!= a + (b * c)
The program is not able to distinguish between upper and lower case characters, as an example we note that vibr is equivalent to Vibr or VIBR. Tabbing spaces TAB and special invisible charcters in editors should be avoided as they might create error in the le reading. Files containing commands in the gibiane language are simple ASCII text les as created by most of the common editors like: nedit, xemacs, . . . under the Linux operating system or notepad under Windows. Downloading and installation instructions for conguration les for enableling the syntax highlightning of the editors for crimson (Windows) or emacs, nedit (Linux) are found at the follwoing webpage:

Most of the names of operators derive from the french common word dening it.

Objects are numerical or logical values organised in different data structures describing mathematical and physical elds. We nd classical objects dening numbers: entier is an integer number, the should be described without the . character; flottant is real number which can be described for example either under the 123.4 or the 1.234e2 = 1.234 102 form; logique are logical objects used in boolean operations with two values: VRAI meaning true and FAUX meaning false. Numbers and strings can be organized in lists: listenti[er] is a list of integers, which can be assembled using the lect[ure] operator:

mylist = lect 1 6 89;

listreel is a list of real numbers, which can be assembled using the prog[ramer] operator:

mylist = prog 1. 6.e3 8.9;

listmots (mots, en. words) is a list of strings, which can be assembled using the mots operator:

mylist = mots 'TITI' 'Toto' 'tete';

Creating Lists of Objects

lect prog mots

lists of integers lists of reals lists of strings

Another class of objects are typical for describing a nite element computation, for example : the maillage (mesh) is described by an element type SEG2, TRI3, QUA4, ..., a list of nodes (geometrical points) and their connectivity; a chpoint, i.e. "champ par point" (eld dened on points) is a scalar, vector or tensor eld dened on a domain described by its values at the nodal points of a mesh. Typical examples are the temperature, the displacement, . . . ; le mchaml, i.e. "champs par lment" (elds dened on elements) is a scalar, vector or tensor eld dened on a domain described by its values at specic points of each element of the mesh. Specic points are fore example the Gauss integration points, where the values of stresses, strains or temperature gradients are denied in nite elements proframs. 9

la rigidit (stiffness) is a stiffness matrix containing eventually a series of preconditioners. Elementary operators are developped to perform a large class of actions: +, *, / , - , ** , are algebraic operators and apply equally on numbers elds dened at the nodal points, the chpoint, or the spec points of the elements the mchaml; droi[te],cerc[le] surf[ace], dall[er], i.e. ligne, cercle, surface and tilling respectively construct lignes, circles and surfaces starting from given points or contours. the plus (plus) operation performs a translation of a given vector and applies both to a mchaml type object and a geometry type object; reso[ut] (solve) solves the algebraic equation KX = Y , with K a simetric positive denite matrix of the rigidit (stiffness) type and X et Y elds dened at the nodes (chpoint). vibr[ation] solves the eigenvalue problem KX M X = 0, with K , M simetric positive denite matrix of the rigidit (stiffness) type representing the stiffness and the mass matrixes. masq[uer] performs a selection of the values of a eld dened on nodes, chpoint, or on the elements mchaml with respect to user dened criterion. Other operators are purely algorythmic : si, sino[n], finsi (if, else, endif) dene the classical control statements and are completely equivalent to the if, else, endif operators in the classical programming languages as C,F ORTRAN ,. . . ; repe[ter], fin (repeat, end) dene a loop and correspond to the do, enddo statements of C,F ORTRAN ,. . . ; debpr[ocedure] (debut procdure) and finp[roc] (n procedure) dene a the "procdure" in gibiane which is the equivalemnt of subroutine end or function end in classical C,F ORTRAN ,. . . ; They are two basic graphical operators: dess[iner] (draw) which plots a curve strating from the lists of the abcissa and ordinate numbers. trac[er] (plot) displays a mesh or isolines or isocolours of elds dened on a mesh. A series of the existing operators are complex manipulations of the existing data structure and are themselves writen in gibiane. For example: pasapas (step-by-step) solves incrementally nonlinear problems under the small and large strain assumption like contact, elastoplasticity, etc. . The buckling problem is the eigenvalue problem KX K G X = 0 with K and K G the stiffness and the geometrical stiffness matrixes. The flambage (buckling) operator is only a gibiane subroutine which passes the needed information to the basic vibr[ation] operator which solves the eigenvalue problem. 10

In the next chapters, we shall present a series of programming examples illustrating on the one hand side the usage of the castem environnement and on the other hand side the programming of some classical algorithms of the nite element theory. However, from the practical point of view, one should not forgot that most of the classical problem settings in mechanics have dedicated operators already programmed in castem.



This chapter is devoted the the discussion of mesh creation. We review the basic commands and show a series of examples one two or three dimensional bodies embedded in a two or three dimensional space.


General settings

The rst setting denes the dimensions of the working space and the coordinate system. These general settings are dened through the opti operator.
This command denes a two dimensional working space and quadrangular elements as the basic bricks for the mesh. However simpler elements like points, segments or triangular will also be created by the called operators.

opti dime 2 elem QUA4;

The nite element theory uses elds dening their values at nodal at specic points of elements. Elements are simple geometrical gures, i.e. triangles, quadrangles, . . . , cubes, pyramides, . . . . The set of elements will represent the continous body and the associated data structures are given by the (i) nodal coordinates and (ii) the list of connectivities dening the set of nodes for each element. Depending on the type of the object we can dene different types of associated meshes: points, lines, surfaces or volumes.

Mesh Options

opti ...; dime elem

command for dening general settings dimension of the working space basic element type for the mesh 12


Examples of 2D mesh creation

Quadrangular plate with a hole

The operator opti does not creat objets, but denies the general settings of the computation by using a series of key-words. Here we dene a two dime[nsion]-al space and by default a plane strain situation. The basic element is chosen by elem QUA4 to be the linear isoparametric quadrangle. The corners of the mesh are dened using their coordinates values as functions of the size ldom of the domain and of the radius r of the hole (see gure ??)

opti dime 2 echo 1 elem QUA4; ldom = 1.; r = 0.1; p1 p2 p3 p4 = = = = 0. 0.; ldom 0.; ldom ldom; 0. ldom;

a2 = r 0.; a4 = 0. r; a3 = (r/1.4142) (r/1.4142);

Les oprateurs droit[e] et cerc[le] permettent de construire les segments des droite du contour du maillage. Le nombre dlements sur diffrents segments et donn par les paramtres nel et nel_bis ainsi que la dimension du prmier et du dernier lment prcis aprs le mots clefs dini et dfin. Le maillage dom et construit en utilisant loprateur dall[er] initialement en deux parties qui vont tre regroups en utilisant et ensuite. Lutilisation dinve[rser] change le ordre de parcours des noeuds dans le contour pour obtenir le maillage correct. Et nalment le maillage et visualis en utilisant la commande trac[er]

nel = 10; nel_bis = -20; d12 = droite nel_bis a2 p2 dini 0.002 dfin 0.15 ; d23 = droite nelem p2 p3; d34 = droite nelem p3 p4; d41 = droite nel_bis p4 a4 dini 0.15 dfin 0.002 ; bis = droite nel_bis a3 p3 dini 0.003 dfin 0.22 ; arc23 = cerc nelem a2 p1 a3; arc34 = cerc nelem a3 p1 a4; dom1 = dall d12 d23 (inve bis) (inve arc23); dom2 = dall (inve d41) (inve d34) (inve bis) arc34; dom = dom1 et dom2; trac dom;


Operators for 2D mesh creation

droi[te] cerc[le] cer3 para[bolic] cubp, cubt dall[er] pav[er] surf[ace] tran[slation] rota[tion]

creates a straight line creates circle dened by the center and two of its points creates circle dened by three of its points creates a parablic arc create cubic 2D tilling of a curved quadrangular 3D tilling a curved cubic enveloppe creates a surface by lling its closed boundary creates a surface by translation of a ligne along a given vector creates a surface by rotation of a ligne around a point or a line

In order to illustrate another technique to construct a surface. We rst recover the boundary of the domain using the cont[our] operator and we then proceed by relling the closed boundary using the surf[ace] command. One can remark the that new domain is irregular and that triangles have been used in its creation in spite of the QUA4 element setting at the beginning of the le.

domcon = contour dom; dombis = surf domcon; trace dombis;

A domain can also be created by tranlation of a line along a vector. The example translates the arc arc23 along the (0. r) vector. The vector is not only used to dene a direction but also the length of the translation. The four sides of the new domain can be recovered applying the face (side) command on the domain. Clicking the Qualification button in the tracewindow we can remark that the name arc23b is already associated with the corresponding side.

dom23 = arc23 tran nel (0. r); arc23b = dom23 face 3; trace dom23;


P 4

P 3

A4 P 1 A 2 P 2


Figure 2.1: Le quart dune plaque troue en traction

Operators for 2D mesh creation

cont[our] syme[trique] tour[ner] plus elim[iner] dedo[ublement] poin[t] elem[ent] face

recovers the boundary of a domain creates the symetric of a given mesh creates a new rotated mesh from of a given one creates a new mesh by adding a displacement to a given mesh eliminates nodes with close coordinates doubles existing nodes (the opposite of elim[iner]) selects a set nodes of a given mesh selects elements of a given mesh selects the n-th face of a mesh in 2D or 3D

A difculty with the new geometry plate is that its points, border lines and nodes, do not have a distinct name. Surely, one can apply theses objects by their node or element number, but this will not provide an intrinsic solution as is might change with a new parametrization of the geometry or simply a new run of the 15

The complete geometry of the quadrangular plate with the hole in the center can simply be created by completing the geometry through symetry (operator syme[trie]). A series of geometrical points are now represented through different nodes, which can be shrinked into one unique node using the elim[iner] operator. The real number at the end of the last command is the tolerance, dening the neighborhood for which nodes are reduced to one single node. It is worth noticing that an inverse command equally exists dedo[ubler] which creates additional nodes (doubles) for existing nodes. An example of application is the creation of cracks.

quart2 = dom syme 'DROIT' p1 p4; half = (dom et quart2) syme 'DROIT' p1 p2; plate = elim (dom et quart1 et half) 0.001;

program. The problem is solved by the poin[t] and elemen[t] operators as illustrated in the next lines.

The poin[t] command will select the points of the contour of the plate, cont plate, lying within 0.001 of the line (fr. 'DROITE' ) dened by the points (0., ldom) and (1., ldom). Next in a similar way, the elem[ent] command will select the elements of contour of the plate, cont plate, lying (fr. 'APPUYE' ) strictly (fr. 'STRICTEMENT' ) on the set points poi_line. The result is nally plotted using trac[er]. One can remark that the colour of the points has been changed into green (fr. vert) for a better display.

poi_line = (cont plate) poin 'DROITE' (0. (-1. * l_dom)) (1. (-1. * l_dom)) 0.001; ele_line = (cont plate) elem 'APPUYE' 'STRICTEMENT' poi_line; trace (( cont plate) et (poi_line coul vert));


Example of a 3D mesh creation

Most of the commands presented in the preceding section will equally fonction in a three dimanesional environment, creating the embedded points, lines or surfaces. We shall briey illustrate one of the construction commands.

The passage from two to three dimension can be done in the middle of a program, if so the third coordinate of all existing objects will automatically be set to 0.. This can readily be observed by plotting the third coordinate of the plate. The two dimensional surface: plate, can be extruded using the volu[me] command into a three dimensional cube. The enve[loppe] command recovers the boundary of the mesh exactly as cont[our] in the two dimensional case. Parts the extremal sections of the extruded volume can be recoved as the 1 and 2 face of the cube, while the cylindrical surface of the extrusion will form the 3 face.

opti dime 3 elem cub8; trace plate (plate coor 3); cube = plate volu tran nelem (0. 0. ldom); trace cach cube; trace cach (enve cube); trace cach (cube face 1); trace cach (cube face 2); trace cach (cube face 3);



Deformation of meshes

A mesh can be deformed to create a new mesh just by adding a desired displacement eld as illustrated in the next example.
We rst extract the three coordinate elds of the plate, and create the eld: uuz = x2 + y 2 . The eld will be labelled as the z component of an displaceent eld after changing the name of its component from 'SCAL' to 'UZ'. The new mesh is simply creating by adding the displacement to the initial mesh using the plus command. Finally results are plotted using trace after the colouring of the new mesh in red (fr. rouge) using coul[eur]

xx yy zz = coor plate; uuz = (xx * xx) + (yy * yy); uuz = exco uuz 'SCAL' 'UZ'; pshell = plate plus uuz; trace cach (plate et (pshell coul rouge));


Import and export of meshes, format exchange

The import and export of meshes from and towards Cast3M is of importance for a series of practical applications. This topic is discussed in chapter 6.


Numbers and mesures for meshes

The number of nodes and the number of elements of a mesh are simply recovered by applying the nbno[euds] nbel[ements] operators. noeud permit to recover the geometrical point corresponding to the node of a mesh. The area of the created meshes is computed by the mesu[rer] operator and the surf[ace] option. Other option, long[eur] (fr. length) and volu[me] enable the computation of a length and a volume for one and respectively three dimensional objects.

list (nbno pshell); list (nbel pshell); pp = pshell noeud 347; list (mesu pshell 'SURF');


Other operators for mesh manipulation

nbel[ements] nb[noeuds] noeu[d] mesu[rer]

computes the number of elemnts of a mesh computes the number of nodes of a mesh denes a point using its nodal number mesures the length, surface or volume of a mesh

In this chapter we presented the creation of points, lines, surface and volumes in a twodimensional and three dimensional space. The operators used in the chapter cover a large variety of manipulations. However they do not represent the complet set of mesh manipulation possibilities included in castem, which can be obtained through examples, manual pages and existing reports and documents.

1. Hyperbolic paraboloid The hyperbolic parabolid is a ruled surface (fr. surface regle) generated by a line thqt pertains to two circles. This type of structures is used as a refrigaration tower for eletricity generating plants.
Hint use the regl[er] operator


Elliptic problems: elasticity and heat transfer

Outline 3.1 3.2 Variational formulation of the elastic equilibrium General settings

The construction of the nite elemnt solutions start with the denition of the main assumptions of the modeling: dimension of the space, coordinate systems, plane strain or plane stress, Fourier representation of the functions, etc.
The dimension of the working space and the fundamental assumptions of the computations are choosen using the opti command. The two option illustrated here correspond to plane strain, i.e. defo[rmation] plan[e] in cartesian coordinates and axial symetry i.e. axis in cylindrical coordinates.

opti mode defo plan; opti mode axis;

The chosen spatial conguration will then automatically assign the standard names of the components of different elds, we have for example: plane strain (defo[rmation] plan[e]). We recall that displacement elds are dened in a cartesian coordinate system (x, y, z ) under the following: u(x, y, z ) = ux (x, y )ex + uy (x, y )ey In this case automatically the names of the components of the elds are dened in the following way: eld component name displacement UX,UY forces FX,FY strain EPXX, EPXY, EPYY SMXX, SMXY, SMYY, SMZZ stress axial symetry (axis). We recall that displacement elds are dened in a cylindrical coordinate system (r, , z ) under the following: u(r, , z ) = ur (r, z )er + uz (r, z )ez 19

In a similar way to plane strain, the names of the compoenents of the elds are dened in the following component name eld displacement UR,UZ way: forces FR,FZ strain EPRR, EPRZ, EPZZ stress SMRR, SMRZ, SMZZ, SMTT ...

An extended list containing this information can be found in [?].

General settings

opti[on] opti[on] opti[on] opti[on] opti[on] opti[on]

dime n plan defo plan cont axis four[ier] n trid[imensional]

space dimension n = 1,2,3 cartesian coordinates, plain strain cartesian coordinates, plain stress cylindrtical coordinates, axisymetric cylindrtical coordinates, Fourier series expansion up to n harmonics cartesian coordinates, tridimensional


Elasticity - castem problem setting

Boundary conditions and solution method


The method of solution used by Cast3M is based on the Lagrangian relaxation of the boundary condition in displacements as explained for example in [?]. The variational principal of the preceding section transforms into:

ici eq 3.29 p. 53


Applying the On rappelle que cette mthode conduit la rsolution du systme linaire suivant:

ici eq 3.29 p. 53


dans lequel la matrice de rigidit [K] est dnie par rapport tous les dplacements nodaux sans distinction entre les valeurs imposes ou non par les conditions limites. Les dplacements imposs apparaissent ici en utilisant le matrice de projection [A] et les valeurs imposes [UD ]. Les conditions aux limites en traction ainsi 20

que les forces volumiques dnissent le vecteur [F].

The mode[le] operator associates to a given mesh a nite element, i.e. a specic form function in the variational principle (here linear functions by default, the QUA4 elements) and a mechanical problem setting mecanique and an linear isotropic elastic constitutive law. Other problem settings are uid, thermal, etc. The denition of the material behaviour will dene the number and names of the parameters to be dened next using the mate[riaux] operator, as well as the structure of the internal variables of the model in consideration. The stiffness matrix [K], is computed using rigi[dit] from the elasticity information provided before. In order to construct the projection matrixes [A] which reduce the displacement vector to the sole part of the boundary where the [UD ] displacement is applied we use the bloq[uer] opertaor. The correspond force is then constructed from [A] and [UD ] using depi (fr. dplacement impos). It is important to notice that the operators bloq[uer] and depi are not only constructing the matrix [A] and the vector [UD ], but will equally creat new degrees of freedom corresponding to the Lagrange multipliers of the system. From a mechanical point of view the Lagrange multipliers will equal the tractions [T] on this boundary part, which are unknown before the resolution of the system. These informations can be obtained by listing the objects [A], for example: list Ad34; . The system is nally solved by calling the reso[lution] operator. As one can remark only non zero components of the right hand side of the system have to be specied, here only ud34. The system is nally solved by calling the reso[lution] operator. As one can remark only non zero components of the right hand side of the system have to be specied, here only ud34.

mod mat

= dom mode mecanique elastique isotrope; = mod mate 'YOUN' 2.e11 'NU' 0.3;

KK = rigi mod mat;

Ad12 = bloq uy d12; Ad41 = bloq ux d41; Ad34 = bloq uy d34; ud34 = depi Ad34 0.1; AA = Ad12 et Ad41 et Ad34;

u = reso (KK et AA) ud34;


Listing the components of the displacement eld

list (extraire u 'COMP');

shows that we obtain the attended components of the displacement led UX and UY, and as well a new component LX, the Lagrange multiplier which contains [T]. To obtain the underlying traction vector, we use the reac[tion] operator as in the next command:

td34 = reac u Ad34; .


trac[er] trac[er] model field trac[er] geometry field trac[er] geometry dess[iner] evolution evolution evol[ution] 'CHPO' ...

plots different objects plots a eld dened on elements plots a eld dened at nodes plots a mesh plots the graph of a function graph of a function dened by lists of numbers extracts the evolution of a eld along a path 22

The results can be postprocessed in a series of different forms as shown in the next examples.
For plotting the norm of the displacement vector: ||u|| =
2 u2 x + uy

uux = exco 'UX' u 'SCAL'; uuy = exco 'UY' u 'SCAL'; trace ux dom; trace (((ux*ux) + (uy*uy))**0.5) dom;

we extract the components using exco (fr. extraire composante), the algebraic operations and trace for the plot. As the displacements elds are dened by their nodal values, we equally specify the underlying mesh for the plot. Strains and stresses are computed using epsi[lon] and sigma and the operations correspond to the following matrix computations: = [B][U] = [A][B][U] (3.3) (3.4)

eps = epsi mod u: sig = sigma mod mat u; list (extraire eps 'COMP'); list (extraire sig 'COMP');

The name of their components elds can be extracted suing the extr[aire] command. Another command, corresponds to [BT ] and enables the computation of the nodal forces from a given stress eld: [F] = [BT ] = [A][B][U] (3.5)

f = bsigma mod sig; trace dom (exco fx f); trace dom (exco fy f);

which corresponds to the computation of div in a continuum formulation. As a consequence we can for example easily verify that the nodal forces vanish with the exception of the reactions at the boundary.

Strains and stresse

epsi[lon] sigm[a] bsigm[a] tres[ca] vmis[es] prin[cipales] @plotpri[ncipales]

computes the strain tensor computes the stress tensor computes the nodal foirces correspnding to a stress tensor computes the Tresca norm of the stress tensor computes the von Mises norm of the stress tensor: 3 vmis = dev : dev 2 computes the principal values of stress tensor plots the principal values of stress tensor (user dened subroutine) 23

To plot the components of the strain or the stress tensor, we directly apply the trac[e] and adjoin the model in order to specify the position of the Gauss points, where the values or dened. Different additional values related to stress tensor can easily be computed: the Tresca and the von Mises norm using tres[ca] and respectively vmis[es]; or the principal values and the their directions using prin[cipales]. @plotpri is a user dened subroutine which permits to plot interactively the principal stresses. It is equally interesting to display the evolution of the stress components along a given path. In the present computation we chose to display yy along the border of the circular hole. We start by listing the components of the stress eld. Then interpolate the yy component, denoted as 'SMYY' in Cast3m, from Gauss points to nodes using the chan[ger] operation with the 'CHPO' option. Finally evol[ution] with the 'CHPO' option extracts the values over the path (arc23 et arc34) and dess[iner] performs the plot.

trace mod sig;

sigvm = vmises sig mod; sigtr = tresca sig mod; sigpr = prin sig mod; @plotpri sig mod;

list (extr sig comp); sigyy = changer 'CHPO' mod (exco sig 'SMYY'); dess (evol 'CHPO' sigyy (arc23 et arc34));


Other applied forces: pressure, weight, . . .

The load of the previous example was only dened by an imposed displacement, as a consequence the exterieur load vector: [F] = [0] and its zero values have been automatically been completed by the program. The next examples will show how surface traction and body forces can be imposed.

Applied Forces

forc[e] pres[sion] coor[donnees] mass[e] manu 'CHPO'

equally distrutes a given force on a set of nodes computes the nodal force distribution for a given pressure distribution computes the coordinate elds of a given mesh computes the mass matrix constructs a nodal eld 24

Creation of stiffness matrixes

rigi[dite] mass[e] cond[uctivite] capa[cite] conv[ection]

creates stiffness matrix creates mass matrix creates conductivity matrix creates capacity matrix creates stiffness coresponding to convection boundary condition


Surface traction and applied pressure

The main operators for the construction of applied forces are forc[e] and pres[sion] (fr. pressure).
The coor operators constructs for a given mesh the elds of coordinates. In the example presented here we recover the coordinates x and y in each point of the line d23. The operator press computes nodal force eld corresponding to the pressure distribution dened by: p(x, y ) = 3x2 . The model mod is necessary for this operation as the computation takes into account the form function of the underlying element (oir [?]). Finally we can change the orientation of the normal pressure fnor distribution into a tangential traction distribution ftan, only be exchanging the components of the vector eld.

xx yy = coor d23; fnor = pres mass mod (3* (xx * xx));

If one wants to impose

ftan = (exco 'FY' fnorm 'FX') et (-1. * (exco 'FX' fnorm 'FY')) ;

a Hertzian pressure distribution, for example dened as a parabola centered around the origin:
2 pmax (a2 px ) 0

p(x) =

if if

||x|| < ap ||x|| ap

we proceed as dened before.

Let us only remark the differences. manu[el] constructs constant nodal eld which enable the computation of the formula of the pressure distribution. masq[uer] constructs the characteristic function dened by the condition ||x|| < ap . The nal nodal distribution correspondig to the pressure is assembled after multiplication of the two preceding elds.

xx = coor 1 d34; ap = ldom / 3.; pmax = 1.e8; one = manu 'CHPO' d34 1 'SCAL' 1.; px = pmax * ((( ap * one) ** 2) - (xx ** 2)); ppx = exco (xx masq inferieur ap) 'SCAL' 'FY'; fp = press mass mod px; fp = ((exco fp 'FY') * ppx) et ((exco fp 'FY') * ppx);



Body forces

In order to construct a body force, which will take into account the distribution of density of the body: RHO we adjoin this information to the model mod and compute the mass matrix of the body by using mass[e]. If the gravitational acceleration is dened as g, the simple multiplication of the mass matrix and of the acceleration will provide the body force fvol.


= mod mate 'YOUN' 2.e11 'NU' 0.3 'RHO' 2000.;

MM = mass mod mat; g = manu chpo dom 1 'UY' -9.81; fvol = MM * g;


Spatially varying material coefcients

In the poreceding subsections we have mentioned that spatially varying boundary tractions can be easily dened using the coor[donnes] and masq[er] commands. A similar setting will permit to dene varying material parameters as illustrated in the next lines of programming for an elastic problem. The rst example illustrates an square inclusion in a domain, while the second example illustrates a continously varying distribu26

The rst command denes the model mod which is associated with the mesh plaq. We then dene the coordinates of the lower-left and the upper-right corner of the square inclusion, X_min, Y_min and X_max, Y_max respectively. The nodal elds xx,yy will now help to dene the characteristic eld of the inclusion: D_CAR, which takes the value 1 inside the square and 0 outside, and the complemenatry eld: M_CAR, which takes the value 0 inside the square and 1 outside. The unit eld over the mesh was manually dened by the command manu[al]. The distribution of Young modulus and of the Poisson ratio are now created from the D_CAR and M_CAR elds using the values of the two materials of the matrix and the inclusion. The next step is to interpolate the values from the nodes to the Gauss points of the elments, where materials parameters elds are practically dened within nite element computations. This is reached using the chan[ger] command with the keywords 'CHAM', from the french champs meaning eld and 'RIGIDITE' meaning stiffness. The words will dene the usage and the header of the new eld. On can remark that the name of the component of the eld was changed in the process from SCAL[AIRE], i.e. scalar to 'YOUNG' respectively 'NU' using the nomc operator. The material and stiffness matrix are then created using the standard command settings.

mod = mode plaq mecanique elastique isotrope; X_min = 0.2; Y_min = 0.2; xx yy = coor = = = = plaq; xx masq D_CAR * D_CAR * D_CAR * 'SUPERIEUR' X_min; (xx masq 'INFERIEUR' X_max); (yy masq 'SUPERIEUR' Y_min); (yy masq 'INFERIEUR' Y_max); X_max = Y_max = 0.8; 0.8;


M_CAR = (manu 'CHPO' plaq 1 scal 1.) - D_CAR; * material coefficients - Aluminium and Copper YG_al = 33.e9; YG_co = 33.e9; NU_al = 0.32; NU_co = 0.32;

YG_reel = (YG_co * M_CAR) + (YG_al * D_CAR); NU_reel = (NU_co * M_CAR) + (NU_al * D_CAR); yg_comp = changer 'CHAM' (nomc 'YOUNG' YG_reel) mod 'RIGIDITE'; nu_comp = changer 'CHAM' (nomc 'NU' NU_reel) mod 'RIGIDITE'; trace mod yg_comp; mat = mate mod young yg_comp nu nu_comp; rig = rigi mod mat;

Manipulation of elds

chan[ger] manu[el] nomc

changes eld type by interpolation creates new objects changes name of component 27


Thermal equilibrium - castem problem setting

The nite element model and the material properties are declared in a similar way as in the elastic equilibrium using the mode[le] and mate[riaux] commands. The resolution of the thermal equilibrium problem (??) depands only of the conductivity K of the material. However if thermal capacity and density RHO and C are equally given, then we can compute both the conductivity matrix KK and the capacity matrix CC, which are similar to the stiffness and the mass matrix in elasticity. thermique, heat conduction heat conduction, thermique conductivite, conductivity matrix capacite, capacity matrix An imposed temperture on the boundary is realised using the same Langrange multiplier technique as in elasticity. Therefore we create the projection matrix Ad34 using the bloq[uer] command. The name of the degree of freedom is 'T' denig equally the component of the temperature eld. Afterwards depi will create the force vector associated to the imposed temperature value on the boundary under consideration. The nodal forces, equivalent to a boundary heat ux are obtained by applying the flux operator. The model mod is necessary as the underlying nite element are needed to compute the distribution over the nodes and elements. The convection boundary condition: = h( ) n is of a special mathematical type. Therefore it will introduce a new conductivity matrix KK_hole dened by the material parameter h and a corresponding nodal force Fhole dened by the same h and the environmental temperature h. Forced convection conditions of the type: = h( )4 n are nonlinear and can not be solved in this problem setting. A rst approximation can be obtained by a applying temperature varying exchange coefencient: h = h().

mod mat

= dom mode thermique isotrope; = mod mate 'RHO' 1. 'K' 1. 'C' 1.;

KK = conductivite mod mat; CC = capacite mod mat;

Ad23 = bloq 'T' d23; AA = Ad23; Fd23 = depi Ad23 4.;

Fd34 = flux mod 2. d34;

mod_hole = mode (arc23 et arc34) convection; mat_hole = mod_hole mate 'H' 1.; KK_hole = conductivite mat_hole mod_hole; Fhole = convection mod_hole mat_hole 'T' 200. ;


Varying boundary temperatures, uxes or convections, and volume heat sources can be imposed using similar commands as in the elastic case when imposing a varying pressure. This problem will be left to the reader as an exercice.



1. Stresses and strains in a plate with a hole Runs the program presented in the text of chapter. Perform the following operations check the stress distribution for all types of applied forces, i.e. body force, applied pressure applied surface pressure and tangential traction compute the solution applying a given linear momentum (resultant force) on the upper face of the plate using both forc[e] and the pres[sion] operators. Explain the difference !
See le traction_trou.dgibi

2. Elastic and thermal analysis example les Run the elasticity example les for an elastic analysis: elas*.dgibi and for the thermal analysis ther*.dgibi from castem_dir/dgibi directory and read the notes in castem_dir/dgibi/annotated_testing_files_98.pdf


Material coefcients varying with temperature

Suppose now that we dispose of a law correlating a material property P with temperature (for example consider the young modulus E () or the dilation coefcient ()). The question we would like to answer next is: how to compute the spatial distrubution of of P in the presence of an inhomogenous temperature distribution (x), i.e. P (x) = P ((x))


Parabolic problems: transient heat transfer

Dans cette section on reprend les quations de la conduction thermique en rgime instationnare discuts en chapitre ?? et on va tudier un exemple dchauffement de la plaqu troue.

Ce type de problme peut tre rsolu numriquement en utilisant loprateur pasapas de Cast3M comme prsent dans les chiers exemple du code. Dans la suite on va partir de la formulation discritise en espace en en temps (voir ??) et montrer les pas de programmation de lalgorithme en utlisant le langage GIBIANE.

On rappele que la famille dalgorithmes prsente prcedement repose sur lquation:

eq. 8.31 p. 159 30


qui permet de dterminer Tn+1 connaissant Tn+1 . [0, 1] est un paramtre.

Avant de demarrer on dni le pas de temps. Le choix = 1 est justi par un algorithm implicit et donc stable. Dans une premire tape on contruit les matrices de conductivit et de capacit, qui sont des objets de type matrice de rigidit. Ensuite on calcule les matrices intervenant dans lalgorithme, i.e. dans lquation (??). La matrice A correspondant la temperature impos sur la frontire exterieure et la temprature exterieure maximale est impos. On initialise la table des champs de temperature et des temperatures imposes.

dt = 0.1; theta = 1.; KK = conductivite mod mat; MM = capacite mod mat;

Matnpun = ((1./dt) * MM) et (theta * KK); Matn = ((-1./dt) * MM) et ((1 - theta) * KK); Td = 1.; Ad23 = bloq 'T' d23; AA = Ad23; T = table; T . 0 = manu chpo dom F = table; F . 0 = depi Ad23 0.; ndt = 20; repeter boucle ndt; n = &boucle - 1; F . (n + 1) = depi Ad23 ((n*Td/ndt)); T . (n + 1) = reso (Matnpun et AA) ((Matn * (T . n)) et ((theta * F . (n + 1)) + ((1 - theta) * F . n))); fin boucle;

1 'T' 0.;

Le calcule consiste maintenant en la rsolution de lquation pour chaque pas de temps.


Exemple en analyse dynamique

Comme example danalyse dynamique, on reprend ici les quations de llasticit linaire en rgime dynamique et on va prsenter la programmation de lalgorithme de Newmark (voir ??) en langage GIBIANE. Comme pour le problme thermique instationnaire, ce type de problme peut tre rsolu numriquement en utilisant loprateur pasapas de Cast3M. Une variante qui utilise un algorithme fond sur une projection du champ des dplacements sur une base modale est galement disponible avec loprateur dyne. 31

On rappele que la famille dalgorithmes prsente prcedement repose sur lquation:

eq. 8.31 p. 159 32


qui permet de dterminer Tn+1 connaissant Tn+1 . [0, 1] est un paramtre.

La construction dune barre de longeur ldom et de largeur hdom se fait en partant de la droite denissant la frontire gauche dgauche et gnrant le maillage avec loprateur tran[slation].

ldom = 50.; hdom = 1.; p1 = 0. 0.; p2 = 0. hdom; nlelem = 100; nhelem = 2; dgauche = droite nhelem p1 p2; dom = dgauche tran nlelem (ldom 0.); ddroite = dom face 3; mod mat = dom mode mecanique elastique isotrope; = mod mate 'RHO' 1. 'YOUNG' 1. 'NU' 0.3;

Ensuite on cre le modle et le matriau. Les paramtre du calcul: pas de temps dt et les paramtres de lalgoritme et sont choisies pour assurer la convergence et la stabilit du calcul ??. On dni les conditions aux limites: extremit gauche: barre encastr extremit droite: un crneau temporel de force pendant quelques instants On assemble les matrice de rigidit [K] et de masse [K] et on calcule la matrice [S] la seule qui va tre inverse pendant lalgorithme. et de masse On initialis les dplacements [U] les ] et les acceleration [U ]. vitesses [U

ndt = 200; dt = 1.; beta = 0.25; gamma = 0.5; AA = bloq depla dgauche; F F F F = . . . table; 0 = force ddroite (0. 0.); 1 = force ddroite (-1. 0.); 2 = force ddroite (-1. 0.);

KK = rigi mod mat; MM = mass mod mat; SS = MM et (( beta * (dt ** 2.)) * KK ); U = table; dU = table; ddU = table; U . 0 = manu chpo dom 2 'UX' 0. 'UY' 0.; dU . 0 = manu chpo dom 2 'UX' 0. 'UY' 0.; ddU . 0 = reso (SS et AA) (F . 0);

Et enn on calcule la boucle dincrmentation temporelle forme des trois tapes: (a) prdiction (b) calcul de laccleration (c) correction et actualisation

repeter boucle ndt; n = &boucle - 1; * ** prediction Upred = (U . n) + ( dt * (dU . n)) + ((0.5 * dt * dt * (1 - (2*beta))) * (ddU . n)); dUpred = (dU . n) + ((dt * (1 - gamma)) * (ddU . n)); * ** calcul de l'acceleration ddU . (n + 1) = reso (SS et AA) ((F.(n+1)) - (KK * Upred)); 33 * ** correction et actualisation U . (n + 1) = Upred + ((dt * dt * beta) * (ddU . (n + 1))); dU . (n + 1) = dUpred + ((dt * gamma) * (ddU . (n + 1)));




Plasticity - programming of a incremental algorithm

Lexemple prsent ensuite se restreint volontirement un calcul lastoplastqiue avec une matrice de rigidit constante avec similaire lalgorithme de la section ??. Dans cette version on utilise loprateur ecou[lement] pour le calcul de lincrmnt des contraintes et des variables internes. Pour linstant on ne 34

calcule donc pas explicement en langage gibiane le retour radial.

On demarre dun domain dom carre sur lesquel on dni le chargement suivant: dplacement impos: uy |d34 = tu1 ux |d12 = tu2 conditions de symtrie sur ... surfaces libres ailleurs t [0, 1] dsigne le parametre du temps ctif. Le chargement est impos en ndt pas de longeurs gales. Les matrices de rigidit associes aux blocages sont AA1, AA2, AA3 et AA et les forces imposes sont stockes pour chaque pas de temps n dans un vecteur force FF . n appartenant la table FF. On dni premirement les paramtres du comportement: le module de Young EE et le coefcient de Poisson nu la limite lastique sigy et le module dcrouissage H Et ensuite on va associ un comportement lastoplastique cinmatique crouissage isotrope par loprateur mode au maillage dom. Les paramtres du modle sont associs aux modle mod par lintermdiare de loprateur mate. La rigidit KK associ la partie lastique du comportement est calcul en utilisant loprateur rigi comme dans le cas lastique, donc associ EE et nu.


= dall d12 d23 d34 d41;

u1 = 0.; u2 = 0.01; ndt = 8; AA1 = (bloq uy d34 ); AA2 = (bloq ux d23); AA3 = (bloq uy d12) et (bloq ux d41); AA = AA1 et AA2 et AA3; FF1 = depi AA1 u1; FF2 = depi AA2 u2; FF = table; repeter boucle (ndt + 1); n = &boucle - 1; FF . n = ((flot n) / ndt ) * (FF1 et FF2); fin boucle;

EE = 2.e11; nu = 0.3; sigy = 600.e6; H = 2000.e6; mod = mode dom mecanique elastique plastique cinematique; mat = mate mod'YOUNG' EE 'NU' nu 'H' H 'SIGY' sigy; KK = rigi mod mat;

tol_res est la tolrance accpt pour lquation dquilibre et est actuellemnt le seul paramtre du calcul. Les tables des dformations plastiques des variables internes des dplacement sont intialises en uitilisant les oprateurs table pour la structure de liste gnralise et par zero pour la valeur initiale t = 0.
La boucle qui calcule les incrments du chargement est nomm it_char et demarre avec linitialisation des valeur des champs litration n avec la valeur calcul litration prcedente n 1.

tol_res = 1.e-3; UU = table; sig = table; epsp = table; alpha = table; UU . 0 = manu chpo dom 2 ux 0. uy 0.; epsp . 0 = zero mod 'DEFINELA'; alpha . 0 = zero mod 'VARINTER'; sig . 0 = zero mod 'CONTRAIN'; repeter it_char ndt; n = &it_char; mess 'increment charge ' n; UU . n = UU . (n - 1); epsp . n = epsp . (n - 1); sig . n =35 sig . (n - 1); alpha . n = alpha . (n - 1); du = reso (KK et AA) (FF . n - FF . (n - 1 )); UU . n = UU . n + du; deps = epsi mod du;

A lintrieur de la boucle it_char des incrments du chargement on construit une nouvelle boucle it_equi. A lintrieur de celle-ci on trouve le calcul dce lincrmnt des variables internes si ncessaire, ceci est ralis par lintermdiaire de loprateur ecou[lement] et puis la vrication de lquilibre. La vrication de lquilibre dmarre avec le calcul du rsidu RR, dni comme diffrence entre les efforts extrieures imposes FF . n et la "divergence" des contraintes, i.e. les forces nodales: [BT ] , calcule en utilisant loprateur bsigma. Le dernire terme permet denlever la contribution des dplacements imposes dans les forces nodales. Entre si et findi on teste si la norme max du rsidu des forces nodales est plus petite que la tolrance et alors on va quit[ter] la boucle it_equi. Si la condition nest pas vrie alors on calcule un nouveau incrmnt des dplacements du pour quilibrer le rsidu et on revien au commencement de it_equi pour une nouvelle itration: mis jour des variables internes et des contraintes, etc. Les deux commandes ferment la boucle de vrication de lquilibre it_equi et celle des incrments de chargement it_char. Les commandes debp[rocedure] et finp[rocedure] marquent le commencement et la n de la procdure n_force. Par extraction des composantes fx,fy du champs des forces ff et des opration algbriques on calcule la norme dnie comme le champ: ||f || =
2 + f2 fx y

repeter it_equi max_ip; nsig nalpha ndepsp = ECOU mod (sig . n) (alpha . n) deps sig . n = nsig; alpha . n = nalpha; epsp . n = ndepsp; mat;

RR =

((FF . n)

- (bsigma mod sig . n) - (AA * (uu . n)) );

no_res = n_force RR; no_for = n_force ((FF . n) + (reac AA uu . n)); si ((maxi no_res) < (tol_res * (maxi no_for))); quit it_equi; finsi; du = reso (KK et AA) RR; UU . n = UU . n + du; deps = epsi mod du;

fin it_equi; fin it_char;

debproc n_force ff*chpoint; lanorme = (((exco fx ff scal)*(exco fx ff scal)) + ((exco fy ff scal)*(exco fy ff scal)) )**0.5; finproc lanorme;

f = fx ex +fy ey



Plasticity - computation using pasapas

In this section we shall illustrate the usage of the standard castem command pasapas (fr. step-to-step) command, which enable to compute the solution of an nonlinear problem. The case discussed next will be that of an elastoplastic problem. In the example we shall refer to the already dened geometry of the plate with a circular hole (see chapter ?? and ?? ) and will directly start with the denition of the material, the boundary conditions.

Model and laoding history

The mode[l] and the mate[riaux] operators are used as in the elastic case to dene the material behaviour and its parameters. In this case the model is a elastoplastic model with kinematic hardening.

mod_p mat_p

= mode dom mecanique elastique isotrope plastique cinematique; = matr mod_p 'YOUN' 2.e11 'NU' 0.3 'SIGY' 200.e6 'H' 2.e9;

As in the rst version of the elastic computation in chapter ??, we shall dene an imposed displacement on the line d34 of the plate. However if the value of the displacement was xed in the elastic case, we shall dene here a varying amplitude. The introduction of the imposed displacements will again be performed using a Lagrange multiplier technique. If the imposed displacement can be written as: u(x, t) = u(x, t) = a(t)u0 (x) x d

Then the projection matrix [A] will be the same with the one dened in the elastic case and will not vary in time. We shall just have to introduce the displacement amplitude in the program a(t).
We start again by deng the projection matrixes and assembles them into only one element: [A]. Next we dene the associated nodal force vector [UD 0 ] of the imposed displacement distribution u0 , denoted as ud34 in the program. The amplitude a(t) is dened by its graph. In castem this corresponds to a evolution object assembled from the list of time instants tt and the coresponding amplitudes a_ud34. The association of the amplitude ev_ud34 with the correspoding nodal force vector ud34 is done using the char[gement] (fr. laoding) operator. The string 'DIMP' annonces that the loading is an imposed displacement. The keywords for different loading types is specied in the help of the char[gement] and the pasapas operators.

Ad12 = bloq uy d12; Ad41 = bloq ux d41; Ad34 = bloq uy d34; ud34 = depi Ad34 0.001; AA = Ad12 et Ad41 et Ad34; tt = prog 0. 5. 10. 15. 20.; a_ud34 = prog 0. 1. 0. -1. 0.; ev_ud34 = evol manu 'TEMPS' tt 'DIMP' a_ud34; dess ev_ud34; ch_ud34 = char 'DIMP' ud34 ev_ud34;


The computation using pasapas

The nonlinear computation is performed using the pasapas operator. Its input variables are oragnized in a large table, that means a generalized list, where the different indexes specify the objects: 'MODELE' - the model 'CARACTERISTIQUES' - the material parameters 'BLOCAGES_MECANIQUES' - the projection matrixes for imposed displacement or temperature 'CHARGEMENT' - the loads, expressed as histories of nodal forces, constructed with the char[gement] operator 'TEMPS_CALCULES' - the list of time instant where equilibrium has to be checked

tabexp = table; tabexp . 'MODELE' = mod_p; tabexp . 'CARACTERISTIQUES' = mat_p;

tabexp . 'BLOCAGES_MECANIQUES' = AA; tabexp . 'CHARGEMENT' = ch_ud34; tabexp . 'TEMPS_CALCULES' pasapas tabexp; = prog 0. pas 1. 20.;

If the information proivided for pasapas is consistent then the computation starts and during the performance a series of parameters are displayed for its monitoring. The output of the example will be discussed next. The inforlations provides for each the step number ( Numero du pas) or the coresponding time instant (Indice d evolution) a series of information about the inner iterations to reach plastic admissibility and global equilibrium: Nplas Critere Deps.max Eps.max Crit.flex

------------------ DEBUT DE LA PROCEDURE PASAPAS -----------------Calcul MECANIQUE *** PLASTICITE *** *** CONVERGENCE FORCEE Numero du pas : Iter Nplas


1 Indice d evolution : 3.0000 Critere Deps.max Eps.max



Pas d incr\uffffment de charge, initialisation calcul\uffffe avec le temps Initialisation \uffff partir de la solution precedente Coeff 0.0000 1 35 0.50000 8.40624E-06 2.14937E-03 0.50000 2 34 1.17475E-04 8.79403E-06 2.15165E-03 1.17475E-04 3 34 8.47313E-05 1.14535E-05 2.15337E-03 8.47313E-05 ****** CONVERGENCE A L ITERATION 3 Numero du pas : 2 Indice d evolution : 4.0000 Eps.max Crit.flex 2.72116E-03 0.11013 2.92268E-03 1.42363E-03 3.05815E-03 9.79151E-04 3.33740E-03 3.36376E-03 3.43636E-03 3.44703E-03 1.22652E-03 2.00070E-04 2.03488E-04 9.73268E-05

Iter Nplas Critere Deps.max 1 248 0.11013 5.67786E-04 2 255 1.42363E-03 7.69312E-04 3 253 9.79151E-04 9.04782E-04 act3 : reduction at 3 dimensions 4 250 1.22652E-03 1.18403E-03 5 251 2.00070E-04 1.21039E-03 6 243 2.03488E-04 1.28299E-03 7 240 9.73268E-05 1.29365E-03 ****** CONVERGENCE A L ITERATION 7 ....

------------------- FIN DE LA PROCEDURE PASAPAS -------------------


Analysis of the results

After the completetion of the pasapas computation a series of results can be analysed.
list-ing the contents of tabexp presents the complete list of the entries of the table, ranging from computational options and settings to the elds of the solution. Some of the important entries are:
deplacements - the displacement elds contraintes - the stress elds variables_internes - the elds of the internal variables of the constitutive model, its component elds are described in the manuel pages of mode[le] and mate[riaux], as well as in documents like [?] deformations_inelastiques - the elds of the inelastic strains All these entries are themselfs tables indexed after the number the computed step. The correspondence between steps an time instants can easily be recored by listing the table of time tabexp . temps. The global strain eld is not saved in the procedure, but can easily been computed with epsi[lon]. The computed elds can be displayed using trac[er], in the usual way, that means appending the mesh for the nodal elds, chpoint, and the model for the elds on elements (chamelem, dened for examplet at the Gauss points). If one wants to track the history of a eld at a certain point, one can easily construct the coresponding evolution object. The prog[amer] command initiates and then constructs by appending the list of values for the time and eld evolutions. The repe[ter], fin command permits to construct the loop over all time steps. The user dened string loop is only a ag indicating the start and the end of the loop. This functionnality is of importance for intricate loops. &loop is the iterator of the loop loop and varies from 1 to (dime tabexp . deplacements). However as the lists in tabexp start with the initial step set at 0 we insert the new iterator ii. The use of dime[ension] permits to extract automatically the number of time

list tabexp; list tabexp . deplacements ; list tabexp . contraintes ; list tabexp . variables_internes ; list tabexp . temps ; trace mod tabexp . contraintes . 15 ; trace dom tabexp . deplacements . 4 ; list (extr tabexp . variables_internes . 5 'COMP' ) ;

thetime = prog; uuy = prog; sigyy = prog; sigxy = prog; repeter loop (dime tabexp . deplacements); ii = &loop - 1; thetime = thetime et (prog tabexp . temps . ii); uuy = uuy et (prog (extr tabexp . deplacements . ii 'UX' a3)); sigyy = sigyy et 40 (extr tabexp . contraintes . ii 'SMYY' 1 30 2)); (prog sigxy = sigxy et (prog (extr tabexp . contraintes . ii 'SMXY' 1 30 2)); fin loop;

Input and output

Outline 6.1 Cast3m objects

Saving in an exterieur le castem objects can be realized through the sauv[er] (fr. save) command. The option denes rst the output le my_file.dat in the working directory. The string format ensures, dened by the , ensures that lower and upperscale letters are respected and the lename is therefore correctly dened. A directory path can also be given here. The sauv command is followed by e number of objects which should be savec, the mesh plate and the displacement u in the current example. The output information gives a detailed list of the saved objects. The program will equall save the underlying objects forming the objects to be saved. The data saved with the sauv[er] procedure can be recovered uisng the rest[ituer] command. The option set the lename to be recovered, and the second command imports the complete contents of the le, and the castem output keeps a track of the operation. All objects will be imported with their previous names.

$ $

* *

opti sauv 'my_file.dat'; sauv plate u;



Fin normale de la restitution


The presented version of the sauv[er] command realises an export le in a binary format. The output can equally be written in a txt format if the option format is called. For more information see the help le of the sauv[er] command.


Graphics and plots

Graphics created with the trac[er] or the dess[iner] command can be saved in a P OSTSCRIPT format in an external le. The steps are the following: click succesively the following quadrangles in the castem graphics window:(i)Softcopy (ii) choose one of the formats Framemaker, Postscript couleur (colour), Postscript NB (black and white). all succesive graphic outputs will be saved in a single le temporary le in the working directory called fort.24. This le will be copied after the end of the castem run in one of the following les: .ps if the run command is: castem if the run command is: castem my_file.dgibi

How to read P OSTSCRIPT les

Saved displayed les, are written in Postscipt. We recall that Postscript is a programming language specialised in displaying graphical information, created by A DOBE. It is based on a vectorial command description and and the objects are constructed from base objects. There are several programs for reading this format: the classical drawing and image processing softwares like: A DOBE P HOTOSHOP, A DOBE I LLUSTRA TOR , C OREL D RAW , G IMP (free), I MAGE M AGICK (free), etc. the free software family of ghostscript programs

How to change the gray level in the saved

The P OSTSCRIPT commands can be read from the les using standard text editors. In the header we can nd a series of settings and denitions. In the case of the castem generated graphics the commands for the graylevel denitions look as displayed next.
The graylevels are dened by their names /eA, /eB, ... and the associated graylevel value 1.0000, 0.9841, ... respectively. def stands for the end of the denition.

/eA /eB ... /e& /e@

{ 1.0000 setgray } def { 0.9841 setgray } def { 0.0159 setgray } def { 0.0 setgray } def

In order to change the graylevel scales in a graphic it is therefore necessary to change the values in the denitions, the only restriction to respect is to chose values in the [0, 1] interval. 42

6.3 exte[ieur] calling an exterior program 6.4 chau[ssette] dynamic link with another program, server 6.5 Reading and writing data
acqu: reading data from a le
The standard operator used to get data from a le is acqu[erir] (fr. to get), we shall simply illustrate its functioning on an example.
Let us rst present the strucure of the le mesure.dat, which we would like to import in castem The le contains measurements organized in four columns of real numbers over 786 lines. Under the Linux operating system its structure can be displayed using the head command. wc will count lines, words and characters in the le.

[constant@rhea-lms]$ head mesures.dat 0. 25.58 24.8297 0.7503 0.1 42.4199 24.9874 17.4325 0.2 125.599 24.998 100.601 0.3 247.493 25.0107 222.4823 0.4 368.41 25.0788 343.3312 0.5 479.224 25.1354 454.0886 ... [constant@rhea-lms EssaisEMP]$ wc mesures.dat 786 3136 27653 mesures.dat [ opti acquerir 'mesure.dat'; mes_t = prog; mes_text = prog; mes_tint = prog; mes_del = prog; repeter myloop 780; acquerir t*flottant text*flottant tint*flottant delta*flottant; mes_t = mes_t et (prog t); mes_text = mes_text et (prog text); mes_tint = mes_tint et (prog tint); mes_del = mes_del et (prog delta); fin myloop; ev_text = evol manu 'temps' mes_t 'mesures t_ext' mes_text; ev_tint = evol manu 'temps' mes_t 'mesures t_int' mes_tint; ev_delta = evol manu 'temps' mes_t 'mesures delta t' mes_del;

In order to read the contents of the le, we rst set the opti acquerir to the lename. Then we initialize, using the prog[ramer] command, four lists which will containt the values of each column The values are then read line by line using the acquerir command which is inserted in a repe[ter] loop.mylop is only the name of the loop and permits to x the beginning and end of the loop. One can further remark that the type of each word is set to flottant (fr. real number) and that the lists are appended with the new read value by a simple use of et. After the reading is complete we can structure the lists into evolution objects which can be displayed using dess[iner].


The @excel1 procedure, writing to a le

The @excel1 procedure is a user dened subroutine which permits to save an evolution object in a standard E XCEL format. The subroutine was written by Christian Laborderie in 1994 and gratiously give to the castem community. We shall briey analyse the procedure, which can than be used as an inspirational model for creating other similar output programs.
The complete gibiane structure of the subroutine can be printed on the standard output using the list command. The the beginning and the end of subroutine are marked by the debproc and endproc commands. The input variables are ev1 an evolution object and the name of the output le ficout given as a string (fr. mot). First the two list of the ev1 are extracted using extr[aire] and the two options absc[isse] and ordo[nee] which denote the list on the two coordinate axes, respectively. Second, the standard output is dened by the value of the impr[imer] option which is recovered for further use in ii using vale[ur]. The opti[on] of the standard output is then dened to be the ficout le. Next, the procedure denes a loop in which the values of the two lists are printed on the standard output, now dened as the ficout le using the mess[age] command. Finally the standard output is redened to its initial value ii.

list @excel1; Liste de la PROCEDURE ********************* 1 * @EXCEL1 PROCEDUR AM 94/01/20 21:15:10 1033 2 *----------------------------------------------------------3 ****** PROCEDURE @EXCEL1 ****** 4 *----------------------------------------------------------5 * 6 * CETTE PROCEDURE A ETE MISE GRACIEUSEMENT 7 * A DISPOSITION DE LA COMMUNAUTE CASTEM2000 8 * PAR Ch. LABORDERIE (LMT - ENS Cachan ) 9 * 10 *----------------------------------------------------------11 DEBPROC @EXCEL1 EV1*EVOLUTION FICOUT*MOT; 12 PROG1=EXTR EV1 ABSC; 13 PROG2=EXTR EV1 ORDO; 14 NB=DIME PROG1; 15 I=0; 16 ii=vale impr; 17 OPTI IMPR 10 IMPR FICOUT; 18 REPETER BOU1 NB; 19 I=I+1; 20 X1=EXTR PROG1 I; 21 Y1=EXTR PROG2 I; 22 MESSAGE X1 ';' Y1 ; 23 FIN BOU1; 24 OPTI IMPR II; 25 FINPROC;

6.6 util: reading subroutines

In the preceeding section we have been analysing an example of a procedure, i.e. a subroutine or a function when refered in classical programming languages. For programming convenience one can group a series of subroutines in an external le. If the le is correctly uploaded using the util[sateur] procedure (maning user in french) the subroutine will appear in the following runs of the program as already complemented castem commands. 44

The le containing the procedures should be organized as follows:

The le containting the procedures is actaully a simple list of the programming lines, were before each subroutine a ligne should be added containg the strings $$$$ followed by the name of the subroutine. The last line of the le should contain only the $$$$ string.

$$$$ MYFIRST debproc MYFIRST ...; * * finproc; $$$$ MYSECOND debproc MYSECOND ... ; finproc; $$$$

Once created one can include the procedure using the following commands:

The le containing the procedures was denoted in this example my_procedure_file.dgibi. The ending of the le, denoting usually a le type is of no special importance in this instance. In order to load the commands in the castem environnement one has to make a special run, using only the util command and nishing directly afterwards. The util command will load the procedure in the UTILPROC le in the working directory and will make it available for the next runs of castem.

util proc 'my_procedure_file.dgibi'; fin;


Meshes and le format exchange

The import and export of meshes from and towards Cast3M is of importance for a series of practical applications. This topic is discussed in chapter 6. This can be performed using the standard castem commands lire, sortir (see example of the next chapter) or by using for example a series perl scripts kindly proposed by Laurent Champaney [1]. The tools permit exchanges between mesh formats of the following nite element programms, pre- or postprocessors Abaqus, Cast3m, GMSH, Nastran, SAMCEF, etc. 45

Next we present a series of standard Cast3m commands for mesh export and import.
The command opti sort[ir] sets the le mon_fichier as the standard write output le and sort[ir] (getting out) writes the data structure of the mesh dom (coordinates of the nodes and connectivity) as well as the displacement eld U on the le. 'AVS' is a key word which denes only the standard output format. To recover the data from the le mon_fichier one has to dene the le reading le. Then lire (read) recoveres the data in the table tab. The indexes lemailla and lechpoin indicate the position of the mesh (le maillage) and of the nodal eld (le champs par points) respectively. The precision of the operation can be controled by plotting both the mesh and one of the compoenents of the displacement eld.

opti sort 'mon_fichier'; sort 'AVS' dom u;

opti lect 'mon_fichier'; tab = lire 'AVS'; trace (tab . lemailla) ; trace (tab . lemailla) (exco 'UX' (tab . lechpoin));



How to and other questions

How to save a standard display


[1] L. Champaney. Outils personnels (exchange tools for nite elemnt programs).

[2] P. Fichoux. Presentation et utilisation de castem 2000. Technical report, ENSTA, 1998.


do, end repe[ter], 43 do, start repe[ter], 43

acqu[erir] (getting data from le), 42 and et, 12 axial symetry axis, 19 axis (axial symetry), 19 bsig[ma], nodal force , 22 buckling flam[bage], 9

dedo[ubler], 14 defo[rmation] plan[e] (plane strain), 18 dess[iner] (draw), 9 dess[iner], save graphics, 41 do repe[ter], 9 draw dess[iner], 9 droi[te] (line), 9 droit[e] (line), 12

editors (editeurs, outils) , 7 elem[ent] (select elements), 15 calling an exterior program, see exte[ieur], 42 elim[iner], 14 capacite, 27 elim[iner], 14 cer[le] (circle), 9 else sinon, 9 cerc[le] (circle), 12 chan[ger] 'CHPO' (change eld into nodal values), end fin, 9 endif finsi, 9 23 chang[er] (change, from nodal to element eld), 26 entier (integer), 8 change eld into nodal values chan[ger] 'CHPO', 23 enve[loppe], boundary surface of a volume, 15 epsi[lon], strain , 22 change from nodal to element eld chpo, 26 et (and), 12 change from nodal to element eld mchml, 26 evol[ution] change order inve[rser], 12 'CHPO', along path on nodal eld, 23 change, from nodal to element eld chang[er], 26 'MANU', from lists , 39 characteristic function masq[er], 24 exte[ieur], calling an exterior program, 42 chpo (change from nodal to element eld), 26 extr[aire] extract, chpoint (nodal eld), 8 'COMP', components , 39 circle cer[le], 9 chpoint, eld on elements , 39 circle cerc[le], 12 chpoint, nodal eld , 39 conductivite, 27 extr[aire] evolution, 43 cont[our], boundary line of a surface, 13 convection, boundary condition, 27 face of a volume, 15 creates elds and other objects manu[el], 26 fin (end), 9 dall[er] (tilling 2D), 12 finp[roc] (subroutine; end), 9 dall[er] (tilling), 9 finsi (endif), 9 debp[procedure] (subroutine le, util[isateur]), 44 flam[bage] (buckling), 9 debp[procedure] (subroutine, end), 43 flottant (real number), 8 debp[procedure] (subroutine, start), 43 getting data from le acqu[erir], 42 debpr[ocedure] (subroutine; start), 9 49

heat, 27 if si, 9 integer entier, 8 inve[rser] (change order), 12

lect[ure], 8 line droi[te], 9 line droit[e], 12 lire (read), 44 listenti[er], list of integers, 8 listmots, list of strings, 8 listreel, list of real numbers, 8 logical value logique, 8 logique (logical value), 8 loop, end repe[ter], 43 loop, start repe[ter], 43

read lire, 44 real number flottant, 8 recover data from le rest[ituer], 40 repe[ter] , 39 repe[ter] (do, end), 43 repe[ter] (do, start), 43 repe[ter] (do), 9 repe[ter] (loop, end), 43 repe[ter] (loop, start), 43 reso[ut] (solve), 9, 20, 27 rest[ituer] (recover data from le), 40 rigi[dite] (stiffness), 20 rigidite (stiffness), 9

sauv[er] (saving data in le), 40 save graphics, 41 saving data in le sauv[er], 40 select elements elem[ent], 15 maillage (mesh), 8 select points or nodes poin[t], 15 manu[el] (creates elds and other objects), 26 settings opti[on], 11 mask, characteristic function masq[uer], 9 si (if), 9 masq[er] (characteristic function), 24 sigm[a], stress , 22 masq[uer] (mask, characteristic function), 9 sinon (else), 9 material mat[riaux], 20 mat[riaux] (material), 20 solve reso[ut], 9, 20, 27 mchml (change from nodal to element eld), 26 sortir (write), 44 mesh maillage, 8 step-by-step, incremental problem pasapas, 9 mess[age], 43 stiffness rigi[dite], 20 mesu[rer], mesures length, areas and volumes, 16 stiffness rigidite, 9 Mises stress norm (von Mises) vmis[es], 23 strain, epsi[lon] , 22 mode[le] (model), 20 stress, sigm[a] , 22 model mode[le], 20 stress, von Mises, vmis[es] , 23 mots, 8 string , list of strings8 subroutine le, util[isateur] debp[procedure], 44 nbel[ements], computes the number of elements, 16 subroutine, end debp[procedure], 43 nbno[euds], computes the number of nodes, 16 subroutine, start debp[procedure], 43 nodal eld chpoint, 8 subroutine; end finp[roc], 9 nodal force , bsig[ma], 22 subroutine; start debpr[ocedure], 9 surf[ace] (surface), 9 opti[on] (settings), 11 surf[ace], meshes a closed line, 13 pasapas (step-by-step, incremental problem), 9 surface surf[ace], 9 plane strain defo[rmation] plan[e], 18 thermique, 27 plot trac[er], 9 tilling 2D dall[er], 12 plus, new mesh by a adding a displacement, 15 tilling dall[er], 9 plus, 9 trac[er] (plot), 9 poin[t] (select points or nodes), 15 trac[er], graylevels, 41 prog[ramer], 8

trac[er], save graphics, 41 util[isateur], 44 vibr[ation], 9 vmis[es] (Mises stress norm (von Mises)), 23
write sortir, 44