Top Banner
A introduction to finite elements based on examples with ANDREI C ONSTANTINESCU Laboratoire de Mécanique des Solides CNRS UMR 7649 Département de Mécanique, Ecole Polytechnique 91120 Palaiseau, France 1
54

CASTEM FINITE ELEMENT MODELLING

Oct 26, 2015

Download

Documents

FINITE ELEMENTS
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CASTEM FINITE ELEMENT MODELLING

A introduction to finite elementsbased on examples with Cast3m

ANDREI CONSTANTINESCU

[email protected]

Laboratoire de Mécanique des SolidesCNRS UMR 7649

Département de Mécanique, Ecole Polytechnique91120 Palaiseau, France

http://www.lms.polytechnique.fr

1

Page 2: CASTEM FINITE ELEMENT MODELLING

Contents

1 Introduction 41.1 Historical remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.2 Linux Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.3 Windows Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51.4 Running castem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.5 Structure of the program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

2 Meshing 12Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12

2.1 General settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122.2 Examples of 2D mesh creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132.3 Example of a 3D mesh creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.4 Deformation of meshes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.5 Import and export of meshes, format exchange . . . . . . . . . . . . . . . . . . . . . . . . . . 172.6 Numbers and mesures for meshes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

3 Elliptic problems: elasticity and heat transfer 19Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19

3.1 Variational formulation of the elastic equilibrium . . . . . . . . . . . . . . . . . . . . . . . . 193.2 General settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.3 Elasticity - castem problem setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

3.3.1 Boundary conditions and solution method . . . . . . . . . . . . . . . . . . . . . . . . 203.3.2 Other applied forces: pressure, weight, . . . . . . . . . . . . . . . . . . . . . . . . . . 243.3.3 Other constraints for displacements . . . . . . . . . . . . . . . . . . . . . . . . . . . 253.3.4 Surface traction and applied pressure . . . . . . . . . . . . . . . . . . . . . . . . . . 263.3.5 Body forces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273.3.6 Thermal expansion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273.3.7 Spatially varying material coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . 28

3.4 Thermal equilibrium - castem problem setting . . . . . . . . . . . . . . . . . . . . . . . . . 303.5 Exercices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

Exercices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313.6 Material coefficients varying with temperature . . . . . . . . . . . . . . . . . . . . . . . . . . 31

4 Parabolic problems: transient heat transfer 324.1 Exemple en analyse dynamique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

2

Page 3: CASTEM FINITE ELEMENT MODELLING

5 Elastoplasticity 36Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

5.1 Plasticity - programming of a incremental algorithm . . . . . . . . . . . . . . . . . . . . . . . 365.2 Plasticity - computation using pasapas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

6 Input and output 43Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

6.1 Cast3m objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 436.2 Graphics and plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 446.3 exte[ieur] calling an exterior program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466.4 chau[ssette] dynamic link with another program, server . . . . . . . . . . . . . . . . . . . 466.5 Reading and writing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466.6 util: reading subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476.7 Meshes and file format exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48

Exercices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

7 How to and other questions 50

3

Page 4: CASTEM FINITE ELEMENT MODELLING

1 Introduction

1.1 Historical remarks

The CEA - Commisariat à l’énérgie atomique, Saclay, France (http://www.cea.fr) is a french government-funded technological research organisation, which has developped in the past twenty years a dedicated toolboxfor finite element computations Cast3M. The toolbox contains the essential elements in order to perform a fi-nite element computation. Its main application area is mechanics including elasticity, elasto-visco-plasticitymaterial behaviour and analysis adapted for equilibrium, buckling, vibration or dynamics problems. Other ap-plication areas include thermak, hydraulic or elactromagnetic analysis. Its modular character permits programnew application in an easy and confortable manner, which make the tool adapted for coupled multiphysicsproblems.

Cast3M is based on family of objets, i.e. data structures and a lexicon of operators, i.e. elementary oper-ations acting on the given objects. ogether they form specific programming language called gibiane:. Thecode itself is written in an extended Fortran called esope which permit a direct handling of the specific datastructure.

The website: http://www-cast3m.cea.fr/ contains a general presentation of the code, example files,online and downloadable documentations. Downloadable versions for Linux and Windows of the computercode are available for a non-commercial usage of the program. The source code can also be recovered after aprevious acceptance by the CEA.

For Mac OS users there is no official release. However Pierre Alain Boucard from the LMT laboratory atENS-Cachan has complied a version with the adapted libraries and provides kindly dowloadable versions onhis website: http://www.lmt.ens-cachan.fr/temp/CAST3M06-OSX.zip (G4/G5)

http://www.lmt.ens-cachan.fr/temp/CAST3M06_OSX_Intel.zip (Intel et 10.4)

http://www.lmt.ens-cachan.fr/temp/CAST3M07_OSX_Intel.zip.

1.2 Linux Installation

We start from the assumption that the code is already installed in the directory cast3m_dir. Some of thesubdirectories are:

• bin - containing the binary files and the bash-script: castem launching the binaries.

• data - contains a series of files which will be linked with the binary at each execution. They containinformations 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 favoritewebbrowser to the pages containing the lists of operators:

4

Page 5: CASTEM FINITE ELEMENT MODELLING

cast3m_dir/doc/html/doc-ang.html help files in englishcast3m_dir/doc/html/doc-fra.html help files in french

• docs/pdf In this directory we can retrieve a series of explanatory documents written about the examplefiles or as short introductory lectures. Let us point the introduction to Cast3m written in english by Fi-choux [2]: cast3m_dir/doc/pdf/beginning.pdf are interesting documents are the structuredlist of operators, the annotated examples files, etc.

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

Help and example files

cast3m_dir/dgibi example filescast3m_dir/doc/html/doc-ang.html help files in englishcast3m_dir/doc/html/doc-fra.html help files in french

Help commands

noti gibi; prints general help in the shell(in french)

info operator_name; prints the help-file in the shell(in french)

Documents

cast3m_dir/doc/pdf document files in english and frenchhttp://www-cast3m.cea.fr/ documents and technical reports

1.3 Windows Installation

The file structure of the Windows installation is equivalent with the Linux installation, the difference reliesonly in the definitions of paths in Windows versus Linux, wherebecomes /.

When installing the program, its is important to pay attention to several details specified in the README (resp.LISEZMOI) files:

• 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 theC:\Program Files\cast3m directory the variable should become: CASTEM=C:\Progra˜1\cast3m

5

Page 6: CASTEM FINITE ELEMENT MODELLING

1.4 Running castem

Linux

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

The castem command launches the pro-gram on the shell command line initi-ated by the $ character, and creates anew shell environment where again eachline initiates with the $ character. Theprogram will send its information in theshell directly or within lines starting with. As in the definition of the paramter a.The -m XL option defines the size of thestatic memory allocated by the computerto the program and one should under-stand that castem will afterwards dy-namically place its structure is this mem-ory 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 swapfile (fichier de debordement) will be de-fined in the /local/tmp directory.The comment regarding the logic unitUNITE 3 corresponds to the case ex-plained in the following example.

6

Page 7: CASTEM FINITE ELEMENT MODELLING

This command launches castem and ex-ecutes in a first step the commands foundin the file pressure.dgibi.Technically the program copies thefile myfile.dgibi into fort.3 (calledlogic unit UNITE 3) and reads this file.In a second step the program waits forthe commands to be types in the castem-shell as in the example before.Technically the program will copy thecommands typied in the shell into thefort.98 (called logic unit UNITE 98)and reads this file 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 infor-mation for the case of a program crash,as the fort.98 will keep a track of alltyped commands. The file will keep theinformation up to the next program startwhen all its contents is removed and thefile is iniatialized as blank.Both fort.3 and fort.98 are to befound in the working directory, there-fore one should avoid to launch simu-latneously two castem processes in thesame directory, as they would be con-fused in using these files.

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 userin the castem-shell.

• typing the command opti donn 3; in the castem-shell returns the hand from the user to the readingunit 3, i.e. the myfile.dgibi file.

1.5 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 thelanguage of the creators of Cast3M. As explained earlier its just a derivation of the classical FORTRAN

language enriched with operations for the manipulation of specific objects (creation, copy, removal, . . . ofdata structure).

7

Page 8: CASTEM FINITE ELEMENT MODELLING

• a high level interpreted language : gibiane:, formed by a lexicon of operation which permits an easyusage 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 ";" defines 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 defining some basic syntax rules of gibiane::

• name of operators are defined by their first 4 characters. As a consequence vibr defines 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 first 4characters 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 thecode can accept that a command is typed on up to 9 consecutive lines. No special character is needed toannounce the continuation of a command on the next line.

• Brackets (,) can be used, for example they permit to insert one command into another without creatingat each step an additional object. They should be used within algebraic operations. castem does notautomatically 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 notethat vibr is equivalent to Vibr or VIBR.

• Tabbing spaces TAB and special invisible charcters in editors should be avoided as they might create errorin the file reading.

• Files containing commands in the gibiane language are simple ASCII text files as created by most of thecommon editors like: nedit, xemacs, . . . under the Linux operating system or notepad under Windows.

Downloading and installation instructions for configuration files for enableling the syntax highlightningof the editors for crimson (Windows) or emacs, nedit (Linux) are found at the follwoing webpage:

http://www-cast3m.cea.fr/cast3m/xmlpage.do?name=utilitaires

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

8

Page 9: CASTEM FINITE ELEMENT MODELLING

Objects are numerical or logical values organised in different data structures describing mathematical andphysical fields.

We find classical objects defining 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 list’s:

• 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 lists of integersprog lists of realsmots lists of strings

Another class of objects are typical for describing a finite element computation, for example :

• the maillage (mesh) is described by an element type SEG2, TRI3, QUA4, ..., a list of nodes (geo-metrical points) and their connectivity;

• a chpoint, i.e. "champ par point" (field defined on points) is a scalar, vector or tensor field defined on adomain described by its values at the nodal points of a mesh. Typical examples are the temperature, thedisplacement, . . . ;

• le mchaml, i.e. "champs par élément" (fields defined on elements) is a scalar, vector or tensor field definedon a domain described by its values at specific points of each element of the mesh. Specific points arefore example the Gauss integration points, where the values of stresses, strains or temperature gradientsare definied in finite elements proframs.

9

Page 10: CASTEM FINITE ELEMENT MODELLING

• 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 fields defined at the nodalpoints, the chpoint, or the spefic points of the elements the mchaml;

• droi[te],cerc[le] surf[ace], dall[er], i.e. ligne, cercle, surface and tilling respectively con-struct 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 typeobject and a geometry type object;

• reso[ut] (solve) solves the algebraic equation KX = Y , with K a simetric positive definite matrix ofthe rigidité (stiffness) type and X et Y fields defined at the nodes (chpoint).

• vibr[ation] solves the eigenvalue problem KX − λMX = 0, with K, M simetric positive definitematrix of the rigidité (stiffness) type representing the stiffness and the mass matrixes.

• masq[uer] performs a selection of the values of a field defined on nodes, chpoint, or on the elementsmchaml with respect to user defined criterion.

Other operators are purely algorythmic :

• si, sino[n], finsi (if, else, endif) define the classical control statements and are completely equiv-alent to the if, else, endif operators in the classical programming languages as C,FORTRAN,. . . ;

• repe[ter], fin (repeat, end) define a loop and correspond to the do, enddo statements of C,FORTRAN,. . . ;

• debpr[ocedure] (debut procédure) and finp[roc] (fin procedure) define a the "procédure" in gibianewhich is the equivalemnt of subroutine end or function end in classical C,FORTRAN,. . . ;

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 fields defined on a mesh.

A series of the existing operators are complex manipulations of the existing data structure and are themselveswriten in gibiane. For example:

• pasapas (step-by-step) solves incrementally nonlinear problems under the small and large strain as-sumption like contact, elastoplasticity, etc. .

• The buckling problem is the eigenvalue problem KX − λKGX = 0 with K and KG the stiffnessand the geometrical stiffness matrixes. The flambage (buckling) operator is only a gibiane subroutinewhich passes the needed information to the basic vibr[ation] operator which solves the eigenvalueproblem.

10

Page 11: CASTEM FINITE ELEMENT MODELLING

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

11

Page 12: CASTEM FINITE ELEMENT MODELLING

2 Meshing

Outline

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

2.1 General settings

The first setting defines the dimensions of the working space and the coordinate system. These generalsettings are defined through the opti operator.

This command defines a two dimen-sional working space and quadrangularelements as the basic bricks for the mesh.However simpler elements like points,segments or triangular will also be cre-ated by the called operators.

opti dime 2 elem QUA4;

The finite element theory uses fields defining their values at nodal at specific points of elements. Elementsare simple geometrical figures, i.e. triangles, quadrangles, . . . , cubes, pyramides, . . . . The set of elements willrepresent the continous body and the associated data structures are given by the (i) nodal coordinates and (ii)the list of connectivities defining the set of nodes for each element.

Depending on the type of the object we can define different types of associated meshes: points, lines,surfaces or volumes.

Mesh Options

opti ...; command for defining general settingsdime dimension of the working spaceelem basic element type for the mesh

12

Page 13: CASTEM FINITE ELEMENT MODELLING

2.2 Examples of 2D mesh creation

Quadrangular plate with a hole

The operator opti does not creat ob-jets, but definies the general settingsof the computation by using a seriesof key-words. Here we define a twodime[nsion]-al space and by default aplane strain situation. The basic elementis chosen by elem QUA4 to be the linearisoparametric quadrangle.The corners of the mesh are defined us-ing their coordinates values as functionsof the size ldom of the domain and of theradius r of the hole (see figure ??)

opti dime 2 echo 1 elem QUA4;

ldom = 1.; r = 0.1;

p1 = 0. 0.;

p2 = ldom 0.;

p3 = ldom ldom;

p4 = 0. ldom;

a2 = r 0.;

a4 = 0. r;

a3 = (r/1.4142) (r/1.4142);

Les opérateurs droit[e] et cerc[le]permettent de construire les segmentsdes droite du contour du maillage. Lenombre d’élements sur différents seg-ments et donné par les paramètres nel

et nel_bis ainsi que la dimension duprémier et du dernier élément préciséaprès le mots clefs dini et dfin.Le maillage dom et construit en util-isant l’opérateur dall[er] initialementen deux parties qui vont être regroupésen utilisant et ensuite. L’utilisationd’inve[rser] change le ordre de par-cours des noeuds dans le contour pourobtenir le maillage correct.Et finalment le maillage et visualisé enutilisant 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;

13

Page 14: CASTEM FINITE ELEMENT MODELLING

Operators for 2D mesh creation

droi[te] creates a straight linecerc[le] creates circle defined by the center and two of its pointscer3 creates circle defined by three of its pointspara[bolic] creates a parablic arccubp, cubt create cubic

dall[er] 2D tilling of a curved quadrangularpav[er] 3D tilling a curved cubic enveloppesurf[ace] creates a surface by filling its closed boundarytran[slation] creates a surface by translation

of a ligne along a given vectorrota[tion] creates a surface by rotation

of a ligne around a point or a line

In order to illustrate another techniqueto construct a surface. We first recoverthe boundary of the domain using thecont[our] operator and we then pro-ceed by refilling the closed boundary us-ing the surf[ace] command.One can remark the that new domainis irregular and that triangles have beenused in its creation in spite of the QUA4

element setting at the beginning of thefile.

domcon = contour dom;

dombis = surf domcon;

trace dombis;

A domain can also be created by tran-lation of a line along a vector. The ex-ample translates the arc arc23 along the(0. r) vector. The vector is not onlyused to define a direction but also thelength of the translation.The four sides of the new domain canbe recovered applying the face (side)command on the domain. Clickingthe Qualification button in the trace-window we can remark that the namearc23b is already associated with thecorresponding side.

dom23 = arc23 tran nel (0. r);

arc23b = dom23 face 3;

trace dom23;

14

Page 15: CASTEM FINITE ELEMENT MODELLING

GIBI FECIT

P1

P4

A2P2

P3

A4

Figure 2.1: Le quart d’une plaque trouée en traction

Operators for 2D mesh creation

cont[our] recovers the boundary of a domainsyme[trique] creates the symetric of a given meshtour[ner] creates a new rotated mesh from of a given oneplus creates a new mesh by adding a displacement to a given meshelim[iner] eliminates nodes with close coordinatesdedo[ublement] doubles existing nodes (the opposite of elim[iner])poin[t] selects a set nodes of a given meshelem[ent] selects elements of a given meshface selects the n-th face of a mesh in 2D or 3D

The complete geometry of the quadran-gular plate with the hole in the cen-ter can simply be created by completingthe geometry through symetry (operatorsyme[trie]).A series of geometrical points arenow represented through different nodes,which can be shrinked into one uniquenode using the elim[iner] operator.The real number at the end of the lastcommand is the tolerance, defining theneighborhood for which nodes are re-duced to one single node.It is worth noticing that an inversecommand equally exists dedo[ubler]

which creates additional nodes (doubles)for existing nodes. An example of appli-cation 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;

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

15

Page 16: CASTEM FINITE ELEMENT MODELLING

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 thepoints of the contour of the plate, contplate, lying within 0.001 of the line(fr. 'DROITE' ) defined by the points(0., −ldom) and (−1., −ldom).Next in a similar way, the elem[ent]

command will select the elements ofcontour of the plate, cont plate, ly-ing (fr. 'APPUYE' ) strictly (fr.'STRICTEMENT' ) on the set pointspoi_line.The result is finally plotted usingtrac[er]. One can remark that thecolour of the points has been changedinto 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));

2.3 Example of a 3D mesh creation

Most of the commands presented in the preceding section will equally fonction in a three dimanesionalenvironment, creating the embedded points, lines or surfaces. We shall briefly illustrate one of the constructioncommands.

The passage from two to three dimensioncan be done in the middle of a program,if so the third coordinate of all existingobjects will automatically be set to 0..This can readily be observed by plottingthe 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 recoversthe boundary of the mesh exactly ascont[our] in the two dimensional case.Parts the extremal sections of the ex-truded volume can be recoved as the 1and 2 face of the cube, while the cylin-drical surface of the extrusion will formthe 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);

16

Page 17: CASTEM FINITE ELEMENT MODELLING

2.4 Deformation of meshes

A mesh can be deformed to create a new mesh just by adding a desired displacement field as illustrated inthe next example.

We first extract the three coordinatefields of the plate, and create the field:uuz = x2+y2. The field will be labelledas the z component of an displaceentfield after changing the name of its com-ponent from 'SCAL' to 'UZ'.The new mesh is simply creating byadding the displacement to the initialmesh using the plus command.Finally results are plotted using trace

after the colouring of the new mesh inred (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));

2.5 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 appli-cations. This topic is discussed in chapter 6.

2.6 Numbers and mesures for meshes

The number of nodes and the numberof elements of a mesh are simply re-covered by applying the nbno[euds]

nbel[ements] operators.noeud permit to recover the geometri-cal point corresponding to the node of amesh.

The area of the created meshes is com-puted by the mesu[rer] operator andthe surf[ace] option. Other option,long[eur] (fr. length) and volu[me]

enable the computation of a length anda volume for one and respectively threedimensional objects.

list (nbno pshell);

list (nbel pshell);

pp = pshell noeud 347;

list (mesu pshell 'SURF');

17

Page 18: CASTEM FINITE ELEMENT MODELLING

Other operators for mesh manipulation

nbel[ements] computes the number of elemnts of a meshnb[noeuds] computes the number of nodes of a meshnoeu[d] defines a point using its nodal number

mesu[rer] mesures the length, surface or volume of a mesh

Summary

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

Exercices

1. Hyperbolic paraboloid

The hyperbolic parabolid is a ruled surface (fr. surface reglée) generated by a line thqt pertains to twocircles. This type of structures is used as a refrigaration tower for eletricity generating plants.

Hint use the regl[er] operator

18

Page 19: CASTEM FINITE ELEMENT MODELLING

3 Elliptic problems: elasticity andheat transfer

Outline

3.1 Variational formulation of the elastic equilibrium

3.2 General settings

The construction of the finite elemnt solutions start with the definition of the main assumptions of themodeling: dimension of the space, coordinate systems, plane strain or plane stress, Fourier representation ofthe functions, etc.

The dimension of the working spaceand the fundamental assumptions ofthe computations are choosen using theopti command. The two option illus-trated here correspond to plane strain,i.e. defo[rmation] plan[e] in carte-sian coordinates and axial symetry i.e.axis in cylindrical coordinates.

opti mode defo plan;

opti mode axis;

The chosen spatial configuration will then automatically assign the standard names of the components ofdifferent fields, we have for example:

• plane strain (defo[rmation] plan[e]). We recall that displacement fields are defined in a cartesiancoordinate 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 fields are defined in the following way:field component namedisplacement UX,UY

forces FX,FY

strain EPXX, EPXY, EPYY

stress SMXX, SMXY, SMYY, SMZZ

• axial symetry (axis). We recall that displacement fields are defined in a cylindrical coordinate system(r, θ, z) under the following:

u(r, θ, z) = ur(r, z)er + uz(r, z)ez

19

Page 20: CASTEM FINITE ELEMENT MODELLING

In a similar way to plane strain, the names of the compoenents of the fields are defined in the following

way:

field component namedisplacement UR,UZ

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] dime n space dimension n = 1,2,3opti[on] plan defo cartesian coordinates, plain strainopti[on] plan cont cartesian coordinates, plain stressopti[on] axis cylindrtical coordinates, axisymetricopti[on] four[ier] n cylindrtical coordinates, Fourier series expansion up to n harmonicsopti[on] trid[imensional] cartesian coordinates, tridimensional

3.3 Elasticity - castem problem setting

3.3.1 Boundary conditions and solution method

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

ici eq 3.29 p. 53 (3.1)

Applying the On rappelle que cette méthode conduit à la résolution du système linéaire suivant:

ici eq 3.29 p. 53 (3.2)

dans lequel la matrice de rigidité [K] est définie par rapport à tous les déplacements nodaux sans distinctionentre les valeurs imposées ou non par les conditions limites. Les déplacements imposés apparaissent ici enutilisant le matrice de projection [A] et les valeurs imposées [UD]. Les conditions aux limites en traction ainsi

20

Page 21: CASTEM FINITE ELEMENT MODELLING

que les forces volumiques définissent le vecteur [F].

The mode[le] operator associates to agiven mesh a finite element, i.e. aspecific form function in the variationalprinciple (here linear functions by de-fault, the QUA4 elements) and a mechan-ical problem setting mecanique and anlinear isotropic elastic constitutive law.

Other problem settings are fluid, ther-mal, etc. The definition of the mate-rial behaviour will define the number andnames of the parameters to be definednext using the mate[riaux] operator, aswell as the structure of the internal vari-ables of the model in consideration.The stiffness matrix [K], is computed us-ing rigi[dité] from the elasticity in-formation provided before.

mod = dom mode mecanique

elastique isotrope;

mat = mod mate

'YOUN' 2.e11 'NU' 0.3;

KK = rigi mod mat;

In order to construct the projection ma-trixes [A] which reduce the displacementvector to the sole part of the bound-ary where the [UD] displacement is ap-plied we use the bloq[uer] opertaor.The correspond force is then constructedfrom [A] and [UD] using depi (fr. dé-placement imposé).It is important to notice that the operatorsbloq[uer] and depi are not only con-structing the matrix [A] and the vector[UD], but will equally creat new degreesof freedom corresponding to the La-grange multipliers of the system. Froma mechanical point of view the Lagrangemultipliers will equal the tractions [T]on this boundary part, which are un-known before the resolution of the sys-tem. These informations can be obtainedby listing the objects [A], for example:list Ad34; .The system is finally solved by callingthe reso[lution] operator. As one canremark only non zero components of theright hand side of the system have to bespecified, here only ud34.

Ad12 = bloq uy d12;

Ad41 = bloq ux d41;

Ad34 = bloq uy d34;

ud34 = depi Ad34 0.1;

AA = Ad12 et Ad41 et Ad34;

The system is finally solved by callingthe reso[lution] operator. As one canremark only non zero components of theright hand side of the system have to bespecified, here only ud34.

u = reso (KK et AA) ud34;

21

Page 22: CASTEM FINITE ELEMENT MODELLING

Listing the components of the displacement field

list (extraire u 'COMP');

shows that we obtain the attended components of the displacement filed UX and UY, and as well a new componentLX, 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; .

Plots

trac[er] plots different objectstrac[er] model field plots a field defined on elementstrac[er] geometry field plots a field defined at nodestrac[er] geometry plots a mesh

dess[iner] evolution plots the graph of a functionevolution graph of a function defined by lists of numbersevol[ution] 'CHPO' ... extracts the evolution of a field along a path

22

Page 23: CASTEM FINITE ELEMENT MODELLING

The results can be postprocessed in a series of different forms as shown in the next examples.

For plotting the norm of the displace-ment vector:

||u|| =√

u2x + u2

y

we extract the components using exco

(fr. extraire composante), the algebraicoperations and trace for the plot. As thedisplacements fields are defined by theirnodal values, we equally specify the un-derlying mesh for the plot.

uux = exco 'UX' u 'SCAL';

uuy = exco 'UY' u 'SCAL';

trace ux dom;

trace (((ux*ux) + (uy*uy))**0.5) dom;

Strains and stresses are computed usingepsi[lon] and sigma and the opera-tions correspond to the following matrixcomputations:

ε = [B][U] (3.3)σ = [A][B][U] (3.4)

The name of their components fieldscan be extracted suing the extr[aire]

command.

eps = epsi mod u:

sig = sigma mod mat u;

list (extraire eps 'COMP');

list (extraire sig 'COMP');

Another command, corresponds to [BT ]and enables the computation of the nodalforces from a given stress field:

[F] = [BT ]σ = [A][B][U] (3.5)

which corresponds to the computation ofdivσ in a continuum formulation.As a consequence we can for exampleeasily verify that the nodal forces vanishwith the exception of the reactions at theboundary.

f = bsigma mod sig;

trace dom (exco fx f);

trace dom (exco fy f);

Strains and stresse

epsi[lon] computes the strain tensorsigm[a] computes the stress tensor

bsigm[a] computes the nodal foirces correspnding to a stress tensor

tres[ca] computes the Tresca norm of the stress tensorvmis[es] computes the von Mises norm of the stress tensor:

vmis =

√32

devσ : devσ

prin[cipales] computes the principal values of stress tensor

@plotpri[ncipales] plots the principal values of stress tensor (user defined subroutine)

23

Page 24: CASTEM FINITE ELEMENT MODELLING

To plot the components of the strain orthe stress tensor, we directly apply thetrac[e] and adjoin the model in or-der to specify the position of the Gausspoints, where the values or defined.

trace mod sig;

Different additional values related tostress tensor can easily be computed: theTresca and the von Mises norm usingtres[ca] and respectively vmis[es];or the principal values and the their di-rections using prin[cipales].@plotpri is a user defined subroutinewhich permits to plot interactively theprincipal stresses.

sigvm = vmises sig mod;

sigtr = tresca sig mod;

sigpr = prin sig mod;

@plotpri sig mod;

It is equally interesting to display theevolution of the stress components alonga given path. In the present computationwe chose to display σyy along the borderof the circular hole.We start by listing the components ofthe stress field. Then interpolate theσyy component, denoted as 'SMYY' inCast3m, from Gauss points to nodes us-ing the chan[ger] operation with the'CHPO' option. Finally evol[ution]

with the 'CHPO' option extracts the val-ues over the path (arc23 et arc34)

and dess[iner] performs the plot.

list (extr sig comp);

sigyy = changer 'CHPO' mod (exco sig 'SMYY');

dess (evol 'CHPO' sigyy (arc23 et arc34));

3.3.2 Other applied forces: pressure, weight, . . .

The load of the previous example was only defined by an imposed displacement, as a consequence theexterieur 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] equally distrutes a given force on a set of nodespres[sion] computes the nodal force distribution for a given pressure distribution

coor[donnees] computes the coordinate fields of a given meshmass[e] computes the mass matrixmanu 'CHPO' constructs a nodal field

24

Page 25: CASTEM FINITE ELEMENT MODELLING

Creation of ’stiffness matrixes’

rigi[dite] creates stiffness matrixmass[e] creates mass matrixcond[uctivite] creates conductivity matrixcapa[cite] creates capacity matrixconv[ection] creates stiffness coresponding to convection boundary condition

3.3.3 Other constraints for displacements

Another way of imposing a constant displament field on o line, part of the boundary is to impose that alldisplacement components of the points of the line ` should be equal between them:

u(x) = constant ∀x ∈ ` ⊂ ∂Ω (3.6)

The constant rest for the moment arbitrarly defined. Its value is imposed next for example by imposing thevalue of the displacement in a particular point of the line, as presented in the next example.

The operator rela[tion] in its optionense[mble] creates a stiffness matrix,expressed mathematically as a lagrangemultiplier, which imposes that the UY

component of the displacement field ofthe line d34 should be all be equal.In order to define the value of the un-known constant, we impose here the dis-placement in the point p3. The computa-tion of the final solution is done in a sim-ilar way to the example discussed before,i.e. assembly of all the stiffness matrixesand final resolution using reso[udre].

Ad34 = rela 'ENSE' 'UY' d34;

Ap3 = bloq 'UY' p3;

up3 = depi Ap3 0.3;

AA = Ad12 et Ad41 et Ad34 et Ap3;

u = reso (KK et AA) up3;

The operator rela[tion] permits to impose other type of equality or inequality contraints see the help forother examples.

Conditions on displacements

rela[tion] stiffness matrix corresponding to different constraints on displacementsrela[tion] ense[emble] stiffness matrix corresponding to rigid movement

25

Page 26: CASTEM FINITE ELEMENT MODELLING

3.3.4 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 agiven mesh the fields of coordinates. Inthe example presented here we recoverthe coordinates x and y in each point ofthe line d23.The operator press computes nodalforce field corresponding to the pressuredistribution defined by: p(x, y) = 3x2.The model mod is necessary for this op-eration as the computation takes into ac-count the form function of the underly-ing element (oir [?]).Finally we can change the orientationof the normal pressure fnor distribu-tion into a tangential traction distributionftan, only be exchanging the compo-nents of the vector field.

xx yy = coor d23;

fnor = pres mass mod (3* (xx * xx));

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

If one wants to impose

a Hertzian pressure distribution, for example defined as a parabola centered around the origin:

p(x) =

pmax(a2p − x2) if ||x|| < ap

0 if ||x|| ≥ ap

we proceed as defined before.

Let us only remark the differences.manu[el] constructs constant nodalfield which enable the computation ofthe formula of the pressure distribution.masq[uer] constructs the characteristicfunction defined by the condition ||x|| <ap. The final nodal distribution corre-spondig to the pressure is assembled af-ter multiplication of the two precedingfields.

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);

26

Page 27: CASTEM FINITE ELEMENT MODELLING

3.3.5 Body forces

In order to construct a body force, whichwill take into account the distribution ofdensity of the body: RHO we adjoin thisinformation to the model mod and com-pute the mass matrix of the body by us-ing mass[e]. If the gravitational accel-eration is defined as g, the simple mul-tiplication of the mass matrix and of theacceleration will provide the body forcefvol.

mat = 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;

3.3.6 Thermal expansion

The thermal expansion due to heating of the body under investigation can equally taken into account. Let usfirst remark that is directly related to the thermoelatic constitutive:

σ = C :(ε− aθ

)(3.7)

where C and a are the forth order tensor of elastic moduli and the second order tensor of thermal dilatation. θis the field of temperature difference between the initial and actual configuration. It plays the role of a loadingcondition and is considered to be known in the elastic problem setting.

In the case of material isotropy the preceding equation simplifies to:

σ = λtr(ε− αIθ)I + 2µ(ε− αIθ) (3.8)

The balance equation in absence of body forces is given by the application of the div operator and the corre-sponding boundary conditions. In the body Ω this becomes:

div σ = div[C :

(ε− aθ

)](3.9)

or equivalently:

div[C :

(ε)− div

(aθ

)]= 0 (3.10)

So the temperature difference will create a thermal expansion field which acts like a distributed body force dueto the incompatibility of the thermal expansion.

27

Page 28: CASTEM FINITE ELEMENT MODELLING

These steps can be found in the gibiane programming as illustrated next: Let us mention beforehand that the ther-mal expansion coefficients should be de-clared in the material data. In theisotropic elastic cas the name of the com-ponent for the mate[rial] operator isalpha.In this example, the temperature fieldθ is denoted in the computation asdelta_th. The operator theta com-putes using the material data and thetemperature field the therma stress field:

sig_th = αIθ

The equivalent body forces are obtainedusing the bsigma operator. Its function-ing has been described in a precedingparagraph of the chapter.The solis finally computed using thestandard reso[udre] procedure fromthe stifness matrix of the system KK

the stifness matrixes coresponding to theconstraints imposed on the displcamentfields AA with the field of body forcesf_th.

mod = dom mode mecanique elastique isotrope;

mat = mod mate 'YOUN' 2.e11 'NU' 0.3 'ALPHA' 1.e-5;

....

delta\_th = manu chpo dom 1 'T' 1000.;

sig\_th = theta mod mat delta\_th;

f\_th = bsigma mod sig\_th;

u = reso (KK et AA) f\_th;

3.3.7 Spatially varying material coefficients

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

28

Page 29: CASTEM FINITE ELEMENT MODELLING

tion.

The first command defines the modelmod which is associated with the meshplaq.We then define the coordinates of thelower-left and the upper-right cornerof the square inclusion, X_min, Y_min

and X_max, Y_max respectively.The nodal fields xx,yy will now help todefine the characteristic field of the in-clusion: D_CAR, which takes the value1 inside the square and 0 outside, andthe complemenatry field: M_CAR, whichtakes the value 0 inside the square and 1outside.The unit field over the mesh was manu-ally defined by the command manu[al].The distribution of Young modulus andof the Poisson ratio are now created fromthe D_CAR and M_CAR fields using thevalues of the two materials of the matrixand the inclusion.The next step is to interpolate the val-ues from the nodes to the Gauss points ofthe elments, where materials parametersfields are practically defined within finiteelement computations. This is reachedusing the chan[ger] command withthe keywords 'CHAM', from the frenchchamps meaning field and 'RIGIDITE'

meaning stiffness. The words will definethe usage and the header of the new field.On can remark that the name of the com-ponent of the field was changed in theprocess from SCAL[AIRE], i.e. scalarto 'YOUNG' respectively 'NU' using thenomc operator.The material and stiffness matrix arethen created using the standard com-mand settings.

mod = mode plaq mecanique elastique isotrope;

X_min = 0.2; X_max = 0.8;

Y_min = 0.2; Y_max = 0.8;

xx yy = coor plaq;

D_CAR = xx masq 'SUPERIEUR' X_min;

D_CAR = D_CAR * (xx masq 'INFERIEUR' X_max);

D_CAR = D_CAR * (yy masq 'SUPERIEUR' Y_min);

D_CAR = D_CAR * (yy masq 'INFERIEUR' Y_max);

M_CAR = (manu 'CHPO' plaq 1 scal 1.) - D_CAR;

* material coefficients - Aluminium and Copper

YG_al = 33.e9; NU_al = 0.32;

YG_co = 33.e9; 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 fields

chan[ger] changes field type by interpolationmanu[el] creates new objectsnomc changes name of component

29

Page 30: CASTEM FINITE ELEMENT MODELLING

3.4 Thermal equilibrium - castem problem setting

The finite element model and the mate-rial properties are declared in a similarway as in the elastic equilibrium usingthe mode[le] and mate[riaux] com-mands. The resolution of the thermalequilibrium problem (??) depands onlyof the conductivity K of the material.However if thermal capacity and densityRHO and C are equally given, then we cancompute both the conductivity matrix KK

and the capacity matrix CC, which aresimilar to the stiffness and the mass ma-trix in elasticity.thermique, heat conduction heat con-duction, thermiqueconductivite, conductivity matrixcapacite, capacity matrix

mod = dom mode thermique isotrope;

mat = mod mate 'RHO' 1. 'K' 1. 'C' 1.;

KK = conductivite mod mat;

CC = capacite mod mat;

An imposed temperture on the bound-ary is realised using the same Lan-grange multiplier technique as in elastic-ity. Therefore we create the projectionmatrix Ad34 using the bloq[uer] com-mand. The name of the degree of free-dom is 'T' definig equally the compo-nent of the temperature field. Afterwardsdepi will create the force vector associ-ated to the imposed temperature value onthe boundary under consideration.

Ad23 = bloq 'T' d23;

AA = Ad23;

Fd23 = depi Ad23 4.;

The nodal forces, equivalent to a bound-ary heat flux are obtained by applying theflux operator. The model mod is neces-sary as the underlying finite element areneeded to compute the distribution overthe nodes and elements.

Fd34 = flux mod 2. d34;

The convection boundary condition:

∂θ

∂n= h(θ − θ∞)

is of a special mathematical type. There-fore it will introduce a new conductivitymatrix KK_hole defined by the materialparameter h and a corresponding nodalforce Fhole defined by the same h andthe environmental temperature h.Forced convection conditions of thetype:

∂θ

∂n= h(θ − θ∞)4

are nonlinear and can not be solved inthis problem setting. A first approxima-tion can be obtained by a applying tem-perature varying exchange coeffiencient:h = h(θ).

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. ;

For creating the nodal forces correspond-ing a distributed heat source density onehas to specify its value, the domain ofapplication and the model to the opera-tor sour[ce].

Fsource = source mod 100. dom;

The temperature field solution ofthe problem is obtained by solvingthe assembled linear equation usingreso[lution]. Its is important toremark that both the conductivity matrixKK of the domain and the convectivitymatrix corresponding to the boundarycondition KK_hole appear in th stiffnessterm.

TT = reso (KK et KK_hole AA) (Fd23 et Fd34 et Fhole et Fsource);

trace TT dom;

30

Page 31: CASTEM FINITE ELEMENT MODELLING

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

3.5 Exercices

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 appliedsurface pressure and tangential traction

• compute the solution applying a given linear momentum (resultant force) on the upper face of theplate using both forc[e] and the pres[sion] operators. Explain the difference !

See file traction_trou.dgibi

2. Elastic and thermal analysis example files

Run the elasticity example files for an elastic analysis: elas*.dgibi and for the thermal analysisther*.dgibi from castem_dir/dgibi directory and read the notes incastem_dir/dgibi/annotated_testing_files_98.pdf

3.6 Material coefficients varying with temperature

Suppose now that we dispose of a law correlating a material property P with temperature θ (for exampleconsider the young modulus E(θ) or the dilation coefficient α(θ)).

The question we would like to answer next is: how to compute the spatial distrubution of of P in thepresence of an inhomogenous temperature distribution θ(x), i.e.

P (x) = P (θ(x))

31

Page 32: CASTEM FINITE ELEMENT MODELLING

4 Parabolic problems: transient heattransfer

Dans cette section on reprend les équations de la conduction thermique en régime instationnare discutés enchapitre ?? et on va étudier un exemple d’échauffement de la plaqué trouée.

Ce type de problème peut être résolu numériquement en utilisant l’opérateur pasapas de Cast3M commeprésenté dans les fichiers exemple du code. Dans la suite on va partir de la formulation discritisée en espace enen temps (voir ??) et montrer les pas de programmation de l’algorithme en utlisant le langage GIBIANE.

On rappele que la famille d’algorithmes présentée précedement repose sur l’équation:

eq. 8.31 p. 159 (4.1)

32

Page 33: CASTEM FINITE ELEMENT MODELLING

qui permet de déterminer Tn+1 connaissant Tn+1. θ ∈ [0, 1] est un paramètre.

Avant de demarrer on défini le pas detemps.

dt = 0.1;

Le choix θ = 1 est justifié par un algo-rithm implicit et donc stable.

theta = 1.;

Dans une première étape on contruit lesmatrices de conductivité et de capacité,qui sont des objets de type matrice derigidité.

KK = conductivite mod mat;

MM = capacite mod mat;

Ensuite on calcule les matrices inter-venant dans l’algorithme, i.e. dansl’équation (??).

Matnpun = ((1./dt) * MM) et (theta * KK);

Matn = ((-1./dt) * MM) et ((1 - theta) * KK);

La matrice A correspondant à la temper-ature imposé sur la frontière exterieureet la temprature exterieure maximale estimposé.

Td = 1.;

Ad23 = bloq 'T' d23;

AA = Ad23;

On initialise la table des champs detemperature et des temperatures im-posées.

T = table;

T . 0 = manu chpo dom 1 'T' 0.;

F = table;

F . 0 = depi Ad23 0.;

Le calcule consiste maintenant en la ré-solution de l’équation pour chaque pasde temps.

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;

4.1 Exemple en analyse dynamique

Comme example d’analyse dynamique, on reprend ici les équations de l’élasticité linéaire en régime dy-namique et on va présenter la programmation de l’algorithme de Newmark (voir ??) en langage GIBIANE.

Comme pour le problème thermique instationnaire, ce type de problème peut être résolu numériquement enutilisant l’opérateur pasapas de Cast3M. Une variante qui utilise un algorithme fondé sur une projection duchamp des déplacements sur une base modale est également disponible avec l’opérateur dyne.

33

Page 34: CASTEM FINITE ELEMENT MODELLING

On rappele que la famille d’algorithmes présentée précedement repose sur l’équation:

eq. 8.31 p. 159 (4.2)

34

Page 35: CASTEM FINITE ELEMENT MODELLING

qui permet de déterminer Tn+1 connaissant Tn+1. θ ∈ [0, 1] est un paramètre.

La construction d’une barre de longeurldom et de largeur hdom se fait en par-tant de la droite definissant la frontièregauche dgauche et générant le maillageavec l’opérateur 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;

Ensuite on crée le modèle et le matériau. mod = dom mode mecanique elastique isotrope;

mat = mod mate 'RHO' 1. 'YOUNG' 1. 'NU' 0.3;

Les paramètre du calcul: pas de tempsdt et les paramètres de l’algoritme β et γ

sont choisies pour assurer la convergenceet la stabilité du calcul ??.

ndt = 200;

dt = 1.;

beta = 0.25;

gamma = 0.5;

On défini les conditions aux limites:

• extremité gauche: barre encastré

• extremité droite: un créneau tem-porel de force pendant quelquesinstants

AA = bloq depla dgauche;

F = table;

F . 0 = force ddroite (0. 0.);

F . 1 = force ddroite (-1. 0.);

F . 2 = force ddroite (-1. 0.);

On assemble les matrice de rigidité [K]et de masse [K] et on calcule la matrice[S] la seule qui va être inverse pendantl’algorithme. et de masse

KK = rigi mod mat;

MM = mass mod mat;

SS = MM et (( beta * (dt ** 2.)) * KK );

On initialisé les déplacements [U] lesvitesses [U] et les acceleration [U].

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 enfin on calcule la boucled’incrémentation temporelle formée destrois étapes:

• (a) prédiction

• (b) calcul de l’accéleration

• (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));

* ** correction et actualisation

U . (n + 1) = Upred + ((dt * dt * beta) * (ddU . (n + 1)));

dU . (n + 1) = dUpred + ((dt * gamma) * (ddU . (n + 1)));

fin boucle;

35

Page 36: CASTEM FINITE ELEMENT MODELLING

5 Elastoplasticity

Outline

5.1 Plasticity - programming of a incremental algorithm

L’exemple présenté ensuite se restreint volontièrement à un calcul élastoplastqiue avec une matrice derigidité constante avec similaire à l’algorithme de la section ??. Dans cette version on utilise l’opérateurecou[lement] pour le calcul de l’incrémént des contraintes et des variables internes. Pour l’instant on ne

36

Page 37: CASTEM FINITE ELEMENT MODELLING

calcule donc pas explicement en langage gibiane le retour radial.

On demarre d’un domain dom carre surlesquel on défini le chargement suivant:

• déplacement imposé:

uy|d34 = tu1 ux|d12 = tu2

• conditions de symétrie sur ...

• surfaces libres ailleurs

t ∈ [0, 1] désigne le parametre du tempsfictif. Le chargement est imposé en ndt

pas de longeurs égales.Les matrices de rigidité associées auxblocages sont AA1, AA2, AA3 et AA etles forces imposées sont stockées pourchaque pas de temps n dans un vecteurforce FF . n appartenant à la table FF.

dom = 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;

On défini premièrement les paramètresdu comportement:

• le module de Young EE et le coef-ficient de Poisson nu

• la limite élastique sigy et le mod-ule d’écrouissage H

Et ensuite on va associé un com-portement élastoplastique cinématiqueà écrouissage isotrope par l’opréateurmode au maillage dom. Les paramètresdu modèle sont associés aux modèle modpar l’intermédiare de l’opérateur mate.La rigidité KK associé à la partie élas-tique du comportement est calculé enutilisant l’opérateur rigi comme dans lecas élastique, donc associé à EE et nu.

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 tolérance accépté pourl’équation d’équilibre et est actuellemntle seul paramètre du calcul.Les tables des déformations plastiquesdes variables internes des déplacementsont intialisées en uitilisant les opéra-teurs table pour la structure de listegénéralisée et par zero pour la valeurinitiale à t = 0.

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';

La boucle qui calcule les incréments duchargement est nommé it_char et de-marre avec l’initialisation des valeur deschamps à l’itération n avec la valeur cal-culé à l’itération précedente n− 1.

repeter it_char ndt;

n = &it_char; mess 'increment charge ' n;

UU . n = UU . (n - 1); epsp . n = epsp . (n - 1);

sig . n = 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;

37

Page 38: CASTEM FINITE ELEMENT MODELLING

A l’intérieur de la boucle it_char

des incréments du chargement on con-struit une nouvelle boucle it_equi.A l’intérieur de celle-ci on trouve lecalcul dce l’incrémént des variablesinternes si nécessaire, ceci est réal-isé par l’intermédiaire de l’opérateurecou[lement] et puis la vérification del’équilibre.

repeter it_equi max_ip;

nsig nalpha ndepsp =

ECOU mod (sig . n) (alpha . n) deps mat;

sig . n = nsig; alpha . n = nalpha;

epsp . n = ndepsp;

La vérification de l’équilibre démarreavec le calcul du résidu RR, défini commedifférence entre les efforts extérieuresimposées FF . n et la "divergence" descontraintes, i.e. les forces nodales:[BT ]σ, calculée en utilisant l’opérateurbsigma. Le dernière terme permetd’enlever la contribution des déplace-ments imposées dans les forces nodales.Entre si et findi on teste si la normemax du résidu des forces nodales est pluspetite que la tolérance et alors on vaquit[ter] la boucle it_equi.Si la condition n’est pas vérifiée alorson calcule un nouveau incrémént des dé-placements du pour équilibrer le résiduet on revien au commencement deit_equi pour une nouvelle itération:mis à jour des variables internes et descontraintes, etc.

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;

Les deux commandes ferment la bouclede vérification de l’équilibre it_equi

et celle des incréments de chargementit_char.

fin it_equi;

fin it_char;

Les commandes debp[rocedure] etfinp[rocedure] marquent le com-mencement et la fin de la procéduren_force. Par extraction des com-posantes fx,fy du champs des forces ffet des opération algébriques on calcule lanorme définie comme le champ:

||f || =√

f2x + f2

y où f = fxex+fyey

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;

38

Page 39: CASTEM FINITE ELEMENT MODELLING

5.2 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 thatof an elastoplastic problem. In the example we shall refer to the already defined geometry of the plate with acircular hole (see chapter ?? and ?? ) and will directly start with the definition of the material, the boundaryconditions.

Model and laoding history

The mode[l] and the mate[riaux] op-erators are used as in the elastic case todefine the material behaviour and its pa-rameters. In this case the model is aelastoplastic model with kinematic hard-ening.

mod_p = mode dom mecanique elastique isotrope

plastique cinematique;

mat_p = matr mod_p 'YOUN' 2.e11 'NU' 0.3

'SIGY' 200.e6 'H' 2.e9;

As in the first version of the elastic computation in chapter ??, we shall define an imposed displacementon the line d34 of the plate. However if the value of the displacement was fixed in the elastic case, we shalldefine here a varying amplitude. The introduction of the imposed displacements will again be performed usinga 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 defined in the elastic case and will not vary intime. We shall just have to introduce the displacement amplitude in the program a(t).

We start again by defing the projectionmatrixes and assembles them into onlyone element: [A].Next we define the associated nodalforce vector [UD

0 ] of the imposed dis-placement distribution u0, denoted asud34 in the program.The amplitude a(t) is defined by itsgraph. In castem this corresponds to aevolution object assembled from thelist of time instants tt and the core-sponding amplitudes a_ud34.The association of the amplitudeev_ud34 with the correspoding nodalforce vector ud34 is done using thechar[gement] (fr. laoding) operator.The string 'DIMP' annonces that theloading is an imposed displacement.The keywords for different loadingtypes is specified in the help of thechar[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;

39

Page 40: CASTEM FINITE ELEMENT MODELLING

The computation using pasapas

The nonlinear computation is performedusing the pasapas operator. Its inputvariables are oragnized in a large table,that means a generalized list, where thedifferent indexes specify the objects:

• 'MODELE' - the model

• 'CARACTERISTIQUES' - the ma-terial parameters

• 'BLOCAGES_MECANIQUES' - theprojection matrixes for imposeddisplacement or temperature

• 'CHARGEMENT' - the loads,expressed as histories of nodalforces, constructed with thechar[gement] operator

• 'TEMPS_CALCULES' - the list

of time instant where equilibriumhas to be checked

tabexp = table;

tabexp . 'MODELE' = mod_p;

tabexp . 'CARACTERISTIQUES' = mat_p;

tabexp . 'BLOCAGES_MECANIQUES' = AA;

tabexp . 'CHARGEMENT' = ch_ud34;

tabexp . 'TEMPS_CALCULES' = prog 0. pas 1. 20.;

pasapas tabexp;

If the information proivided for pasapas is consistent then the computation starts and during the perfor-mance a series of parameters are displayed for its monitoring. The output of the example will be discussednext.

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 andglobal equilibrium:

• Nplas

• Critere

• Deps.max

• Eps.max

• Crit.flex

------------------ DEBUT DE LA PROCEDURE PASAPAS ------------------

Calcul MECANIQUE

*** PLASTICITE ***

*** CONVERGENCE FORCEE ***

Numero du pas : 1 Indice d evolution : 3.0000

Iter Nplas Critere Deps.max Eps.max Crit.flex

40

Page 41: CASTEM FINITE ELEMENT MODELLING

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

Iter Nplas Critere Deps.max Eps.max Crit.flex

1 248 0.11013 5.67786E-04 2.72116E-03 0.11013

2 255 1.42363E-03 7.69312E-04 2.92268E-03 1.42363E-03

3 253 9.79151E-04 9.04782E-04 3.05815E-03 9.79151E-04

act3 : reduction at 3 dimensions

4 250 1.22652E-03 1.18403E-03 3.33740E-03 1.22652E-03

5 251 2.00070E-04 1.21039E-03 3.36376E-03 2.00070E-04

6 243 2.03488E-04 1.28299E-03 3.43636E-03 2.03488E-04

7 240 9.73268E-05 1.29365E-03 3.44703E-03 9.73268E-05

****** CONVERGENCE A L ITERATION 7

....

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

41

Page 42: CASTEM FINITE ELEMENT MODELLING

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 entriesof the table, ranging from computationaloptions and settings to the fields of thesolution. Some of the important entriesare:

• deplacements - the displace-ment fields

• contraintes - the stress fields

• variables_internes - thefields of the internal variablesof the constitutive model, itscomponent fields are described inthe manuel pages of mode[le]

and mate[riaux], as well as indocuments like [?]

• deformations_inelastiques

- the fields of the inelastic strains

All these entries are themselfs tables in-dexed after the number the computedstep. The correspondence between stepsan time instants can easily be recoredby listing the table of time tabexp .

temps.The global strain field is not saved in theprocedure, but can easily been computedwith epsi[lon].The computed fields can be displayedusing trac[er], in the usual way, thatmeans appending the mesh for the nodalfields, chpoint, and the model for thefields on elements (chamelem, definedfor examplet at the Gauss points).

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' ) ;

If one wants to track the history of a fieldat a certain point, one can easily con-struct the coresponding evolution ob-ject.The prog[amer] command initiates andthen constructs by appending the list ofvalues for the time and field evolutions.The repe[ter], fin command per-mits to construct the loop over all timesteps. The user defined string loop

is only a flag indicating the start andthe end of the loop. This functionnal-ity 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 listsin tabexp start with the initial step set at0 we insert the new iterator ii.The use of dime[ension] permits to ex-tract automatically the number of timeinstants.Final let us note the usage ofextr[aire]:

• for nodal fields, chpoint’s , likethe displacement or the temper-ature field, one needs to indi-cate the component and the nodalpoint of extraction, here 'UX' anda3 respectively.

• for fields defined on elements,chamelem’s , like the stress or thestrain field, one needs to indicatethe component and the numbersof the zone, the element and ofthe Gauss point of extraction, here'SMXY' and 1 30 2 respectively.In different cases the models areautomaically partitioned in zonesthat indicate for example differenttypes of elements or material be-haviour.

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

(prog (extr tabexp . contraintes . ii 'SMYY' 1 30 2));

sigxy = sigxy et

(prog (extr tabexp . contraintes . ii 'SMXY' 1 30 2));

fin loop;

After ending the loop we have retrievedthe lists of time and of ux, σxy , σyy in thecorresponding points. The list can nowthe combined into evolution’s whichcan be plotted using the dess[iner]

command.

ev_uy = evol rouge manu 'time' thetime 'uy' uuy;

ev_sigyy = evol jaune manu 'time' thetime 'stress_yy' sigyy;

ev_sigxy = evol vert manu 'time' thetime 'stress_xy' sigxy;

dess ev_uy;

dess (ev_sigyy et ev_sigxy);

42

Page 43: CASTEM FINITE ELEMENT MODELLING

6 Input and output

Outline

6.1 Cast3m objects

Saving in an exterieur file castem

objects can be realized through thesauv[er] (fr. save) command.The option defines first the output filemy_file.dat in the working directory.The string format ensures, defined bythe , ensures that lower and upperscaleletters are respected and the filename istherefore correctly defined. A directorypath can also be given here.The sauv command is followed bye number of objects which should besavec, the mesh plate and the displace-ment u in the current example. Theoutput information gives a detailed listof the saved objects. The program willequall save the underlying objects form-ing the objects to be saved.

$ * opti sauv 'my_file.dat';

$ * sauv plate u;

LA PILE NUMERO 1 CONTIENT 19 OBJET(S) MAILLAGE

IL Y A 10 OBJET(S) NOMME(S) :

LA PILE NUMERO 2 CONTIENT 1 OBJET(S) CHPOINT

IL Y A 1 OBJET(S) NOMME(S) :

LA PILE NUMERO 27 CONTIENT 1 OBJET(S) MOT

IL Y A 1 OBJET(S) NOMME(S) :

LA PILE NUMERO 32 CONTIENT 494 OBJET(S) POINT

IL Y A 6 OBJET(S) NOMME(S) :

LA PILE NUMERO 33 CONTIENT 1 OBJET(S) CONFIGUR

Fin normale de la sauvegarde

$ *

The data saved with the sauv[er]

procedure can be recovered uisng therest[ituer] command. The option setthe filename to be recovered, and the sec-ond command imports the complete con-tents of the file, and the castem outputkeeps a track of the operation. All ob-jects will be imported with their previousnames.

$ * opti rest 'my_file.dat';

$ * rest;

NIVEAU DU FICHIER 16

NIVEAU D'ERREUR 0 DIMENSION 2 DENSITE 0.00000E+00

LECTURE DE 19 OBJETS MAILLAGE

LECTURE DE 1 OBJETS CHPOINT

LECTURE DE 1 OBJETS MOT

LECTURE DE 494 OBJETS POINT

LECTURE DE 1 OBJETS CONFIGUR

FIN DE LECTURE DU LABEL :

LABEL AUTOMATIQUE : 1

Fin normale de la restitution

43

Page 44: CASTEM FINITE ELEMENT MODELLING

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

6.2 Graphics and plots

Graphics created with the trac[er] or the dess[iner] command can be saved in a POSTSCRIPT formatin an external file. The steps are the following:

• click succesively the following quadrangles in the castem graphics window:(i)Softcopy (ii) choose oneof the formats Framemaker, Postscript couleur (colour), Postscript NB (black and white).

• all succesive graphic outputs saved after a mouse-click in the graphical window, will be saved in a singlefile temporary file in the working directory called fort.24. This file will be copied after the end of thecastem run in one of the following files:

– .ps if the run command is: castem

– my_file.ps if the run command is: castem my_file.dgibi

• all succesive graphic outputs, without a mouse-click or display in the graphical window will be saved ina single file, provided the opti[on] command is set in the following way:

opti 'TRAC' 'PSC' ;

trace dom (coor 1 dom);

output is to be found in

– .ps if the run command is: castem

– my_file.ps if the run command is: castem my_file.dgibi

The graphic types of the output file:

– 'PS' - graylevel postscript file

– 'PSC' - color postscript file

– . . .

are given in the instruction manual of the opti command.

How to read POSTSCRIPT files

Saved displayed files, are written in Postscipt. We recall that Postscript is a programming languagespecialised in displaying graphical information, created by ADOBE. It is based on a vectorial command de-scription and and the objects are constructed from base objects. There are several programs for reading thisformat:

44

Page 45: CASTEM FINITE ELEMENT MODELLING

• the classical drawing and image processing softwares like: ADOBE PHOTOSHOP, ADOBE ILLUSTRA-TOR, COREL DRAW, GIMP (free), IMAGEMAGICK (free), etc.

• the free software family of ghostscript programs

How to change the gray level in the saved

The POSTSCRIPT commands can be read from the files using standard text editors. In the header we canfind a series of settings and definitions. In the case of the castem generated graphics the commands for thegraylevel definitions look as displayed next.

The graylevels are defined by theirnames /eA, /eB, ... and the as-sociated graylevel value 1.0000,

0.9841, ... respectively. def standsfor the end of the definition.

/eA 1.0000 setgray def

/eB 0.9841 setgray def

...

/e& 0.0159 setgray def

/e@ 0.0 setgray def

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

45

Page 46: CASTEM FINITE ELEMENT MODELLING

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 file

The standard operator used to get data from a file is acqu[erir] (fr. to get), we shall simply illustrate itsfunctioning on an example.

Let us first present the strucure of thefile mesure.dat, which we would liketo import in castem

The file contains measurements orga-nized in four columns of real numbersover 786 lines.Under the Linux operating system itsstructure can be displayed using thehead command. wc will count lines,words and characters in the file.

[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

[

In order to read the contents of thefile, we first set the opti acquerir tothe filename. Then we initialize, usingthe prog[ramer] command, four listswhich will containt the values of eachcolumnThe values are then read line by line us-ing the acquerir command which isinserted in a repe[ter] loop.mylop isonly the name of the loop and permitsto fix the beginning and end of the loop.One can further remark that the type ofeach word is set to flottant (fr. realnumber) and that the lists are appendedwith the new read value by a simple useof et.After the reading is complete we canstructure the lists into evolution ob-jects which can be displayed usingdess[iner].

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;

46

Page 47: CASTEM FINITE ELEMENT MODELLING

The @excel1 procedure, writing to a file

The @excel1 procedure is a user defined subroutine which permits to save an evolution object in a stan-dard EXCEL format. The subroutine was written by Christian Laborderie in 1994 and gratiously give to thecastem community.

We shall briefly analyse the procedure, which can than be used as an inspirational model for creating othersimilar output programs.

The complete gibiane structure of thesubroutine can be printed on the standardoutput using the list command.The the beginning and the end of sub-routine are marked by the debproc andendproc commands. The input vari-ables are ev1 an evolution object andthe name of the output file ficout givenas a string (fr. mot).First the two list of the ev1 are extractedusing extr[aire] and the two optionsabsc[isse] and ordo[nee] which de-note the list on the two coordinate axes,respectively.Second, the standard output is definedby the value of the impr[imer] optionwhich is recovered for further use in ii

using vale[ur]. The opti[on] of thestandard output is then defined to be theficout file.Next, the procedure defines a loop inwhich the values of the two lists areprinted on the standard output, nowdefined as the ficout file using themess[age] command.Finally the standard output is redefinedto 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 functionwhen refered in classical programming languages. For programming convenience one can group a series ofsubroutines in an external file. If the file is correctly uploaded using the util[sateur] procedure (maning userin french) the subroutine will appear in the following runs of the program as already complemented castem

commands.

47

Page 48: CASTEM FINITE ELEMENT MODELLING

The file containing the procedures should be organized as follows:

The file containting the procedures isactaully a simple list of the program-ming lines, were before each subrou-tine a ligne should be added containg thestrings $$$$ followed by the name of thesubroutine.

The last line of the file should containonly the $$$$ string.

$$$$ MYFIRST

debproc MYFIRST ...;

*

*

finproc;

$$$$ MYSECOND

debproc MYSECOND ... ;

finproc;

$$$$

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

The file containing the procedures

was denoted in this examplemy_procedure_file.dgibi. Theending of the file, denoting usually a filetype is of no special importance in thisinstance.In order to load the commands in thecastem environnement one has to makea special run, using only the util com-mand and finishing directly afterwards.The util command will load the proce-dure in the UTILPROC file in the workingdirectory and will make it available forthe next runs of castem.

util proc 'my_procedure_file.dgibi';

fin;

6.7 Meshes and file format exchange

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

This can be performed using the standard castem commands lire, sortir (see example of the nextchapter) or by using for example a series perl scripts kindly proposed by Laurent Champaney [1]. The toolspermit exchanges between mesh formats of the following finite element programms, pre- or postprocessorsAbaqus, Cast3m, GMSH, Nastran, SAMCEF, etc.

48

Page 49: CASTEM FINITE ELEMENT MODELLING

Next we present a series of standard Cast3m commands for mesh export and import.

The command opti sort[ir] sets thefile mon_fichier as the standard writeoutput file and sort[ir] (getting out)writes the data structure of the mesh dom

(coordinates of the nodes and connectiv-ity) as well as the displacement field U

on the file. 'AVS' is a key word whichdefines only the standard output format.

opti sort 'mon_fichier';

sort 'AVS' dom u;

To recover the data from the filemon_fichier one has to define the filereading file. Then lire (read) recoveresthe data in the table tab. The indexeslemailla and lechpoin indicate theposition of the mesh (le maillage) and ofthe nodal field (le champs par points) re-spectively.The precision of the operation can becontroled by plotting both the mesh andone of the compoenents of the displace-ment field.

opti lect 'mon_fichier';

tab = lire 'AVS';

trace (tab . lemailla) ;

trace (tab . lemailla)

(exco 'UX' (tab . lechpoin));

Exercices

49

Page 50: CASTEM FINITE ELEMENT MODELLING

7 How to and other questions

How to save a standard display

50

Page 51: CASTEM FINITE ELEMENT MODELLING

Bibliography

[1] L. Champaney. Outils personnels (exchange tools for finite elemnt programs).http://laurent.champaney.free.fr/perso/outils.html.

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

51

Page 52: CASTEM FINITE ELEMENT MODELLING

Index

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

acqu[erir] (getting data from file), 45and et, 13axial symetry axis, 20axis (axial symetry), 20

bsig[ma], nodal force , 23, 27buckling flam[bage], 10

calling an exterior program, see exte[ieur], 45capacite, 30cer[le] (circle), 10cerc[le] (circle), 13chan[ger] 'CHPO' (change field into nodal values),

24chang[er] (change, from nodal to element field), 29change field into nodal values chan[ger] 'CHPO', 24change from nodal to element field chpo, 29change from nodal to element field mchml, 29change order inve[rser], 13change, from nodal to element field chang[er], 29characteristic function masqu[er], 26chpo (change from nodal to element field), 29chpoint (nodal field), 9circle cer[le], 10circle cerc[le], 13conductivite, 30constraint, rela[tion] , 25constraint on the displacement field rela[tion], 25cont[our], boundary line of a surface, 14convection, boundary condition, 30creates fields and other objects manu[el], 29

dall[er] (tilling 2D), 13dall[er] (tilling), 10debp[procedure] (subroutine file, util[isateur]), 47debp[procedure] (subroutine, end), 46

debp[procedure] (subroutine, start), 46debpr[ocedure] (subroutine; start), 10dedo[ubler], 15defo[rmation] plan[e] (plane strain), 19dess[iner] (draw), 10dess[iner], save graphics, 44do repe[ter], 10draw dess[iner], 10droi[te] (line), 10droit[e] (line), 13

editors (editeurs, outils) , 8elem[ent] (select elements), 16elim[iner], 15elim[iner], 15else sinon, 10end fin, 10endif finsi, 10entier (integer), 9enve[loppe], boundary surface of a volume, 16epsi[lon], strain , 23et (and), 13evol[ution]

'CHPO', along path on nodal field, 24'MANU', from lists , 42

exte[ieur], calling an exterior program, 45extr[aire] extract,

'COMP', components , 42chpoint, field on elements , 42chpoint, nodal field , 42

extr[aire] evolution, 46

face of a volume, 16fin (end), 10finp[roc] (subroutine; end), 10finsi (endif), 10flam[bage] (buckling), 10flottant (real number), 9

52

Page 53: CASTEM FINITE ELEMENT MODELLING

getting data from file acqu[erir], 45

heat, 30

if si, 10integer entier, 9inve[rser] (change order), 13

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

maillage (mesh), 9manu[el] (creates fields and other objects), 29mask, characteristic function masq[uer], 10masq[uer] (mask, characteristic function), 10masqu[er] (characteristic function), 26material, spatially variable28material maté[riaux], 21maté[riaux] (material), 21mchml (change from nodal to element field), 29mesh maillage, 9mess[age], 46mesu[rer], mesures length, areas and volumes, 17Mises stress norm (von Mises) vmis[es], 24mode[le] (model), 21model mode[le], 21mots, 9

nbel[ements], computes the number of elements, 17nbno[euds], computes the number of nodes, 17nodal field chpoint, 9nodal force , bsig[ma], 23, 27

opti[on] (settings), 12

parameters, spatially variable 28pasapas (step-by-step, incremental problem), 10plane strain defo[rmation] plan[e], 19plot trac[er], 10

plus, new mesh by a adding a displacement, 16plus, 10poin[t] (select points or nodes), 16prog[ramer], 9

read lire, 47real number flottant, 9recover data from file rest[ituer], 43rela[tion] (constraint on the displacement field), 25repe[ter] , 42repe[ter] (do, end), 46repe[ter] (do, start), 46repe[ter] (do), 10repe[ter] (loop, end), 46repe[ter] (loop, start), 46reso[ut] (solve), 10, 21, 30rest[ituer] (recover data from file), 43rigi[dite] (stiffness), 21rigidite (stiffness), 10

sauv[er] (saving data in file), 43save graphics, 44saving data in file sauv[er], 43select elements elem[ent], 16select points or nodes poin[t], 16settings opti[on], 12si (if), 10sigm[a], stress , 23sinon (else), 10solve reso[ut], 10, 21, 30sortir (write), 47step-by-step, incremental problem pasapas, 10stiffness rigi[dite], 21stiffness rigidite, 10strain, epsi[lon] , 23stress, sigm[a] , 23stress, von Mises, vmis[es] , 24string , list of strings9subroutine file, util[isateur] debp[procedure], 47subroutine, end debp[procedure], 46subroutine, start debp[procedure], 46subroutine; end finp[roc], 10subroutine; start debpr[ocedure], 10surf[ace] (surface), 10surf[ace], meshes a closed line, 14surface surf[ace], 10

53

Page 54: CASTEM FINITE ELEMENT MODELLING

stress thermal, theta, 27thermique, 30theta, thermal stress field , 27tilling 2D dall[er], 13tilling dall[er], 10trac[er] (plot), 10trac[er], graylevels, 44trac[er], save graphics, 44

util[isateur], 47

vibr[ation], 10vmis[es] (Mises stress norm (von Mises)), 24

write sortir, 47

54