100% found this document useful (1 vote)
450 views

A Introduction To Finite Elements Based On Examples With Cast3m

This document provides an introduction to finite element analysis using the Cast3M software. It discusses the software's history, installation, structure and commands. It also covers mesh generation, solving elliptic problems involving elasticity and heat transfer, input/output, and more advanced topics like elastoplasticity. The document aims to equip readers with the basics of using Cast3M through examples and exercises.

Uploaded by

pemulung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
450 views

A Introduction To Finite Elements Based On Examples With Cast3m

This document provides an introduction to finite element analysis using the Cast3M software. It discusses the software's history, installation, structure and commands. It also covers mesh generation, solving elliptic problems involving elasticity and heat transfer, input/output, and more advanced topics like elastoplasticity. The document aims to equip readers with the basics of using Cast3M through examples and exercises.

Uploaded by

pemulung
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 51

A introduction to finite elements

based on examples with Cast3m

A NDREI C ONSTANTINESCU
[email protected]

Laboratoire de Mécanique des Solides


CNRS UMR 7649
Département de Mécanique, Ecole Polytechnique
91120 Palaiseau, France
http://www.lms.polytechnique.fr

1
Contents

1 Introduction 4
1.1 Historical remarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Linux Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Windows Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Running castem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.5 Structure of the program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

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

3 Elliptic problems: elasticity and heat transfer 19


Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.1 Variational formulation of the elastic equilibrium . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2 General settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.3 Elasticity - castem problem setting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.3.1 Boundary conditions and solution method . . . . . . . . . . . . . . . . . . . . . . . . 20
3.3.2 Other applied forces: pressure, weight, . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.3.3 Surface traction and applied pressure . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.3.4 Body forces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3.5 Spatially varying material coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.4 Thermal equilibrium - castem problem setting . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.5 Exercices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Exercices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.6 Material coefficients varying with temperature . . . . . . . . . . . . . . . . . . . . . . . . . . 29

4 Parabolic problems: transient heat transfer 30


4.1 Exemple en analyse dynamique . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31

5 Elastoplasticity 34
Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
5.1 Plasticity - programming of a incremental algorithm . . . . . . . . . . . . . . . . . . . . . . . 34
5.2 Plasticity - computation using pasapas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

2
6 Input and output 41
Outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.1 Cast3m objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
6.2 Graphics and plots . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
6.3 exte[ieur] calling an exterior program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
6.4 chau[ssette] dynamic link with another program, server . . . . . . . . . . . . . . . . . . . 43
6.5 Reading and writing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
6.6 util: reading subroutines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
6.7 Meshes and file format exchange . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Exercices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46

7 How to and other questions 47

3
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 toolbox
for 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-plasticity
material 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 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 oper-
ations acting on the given objects. ogether they form specific programming language called gibiane:. The
code itself is written in an extended Fortran called esope which permit a direct handling of the specific data
structure.
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 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 official 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: 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 the
subdirectories 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 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 help files in english
cast3m_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 example
files 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 structured
list 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 help
information can equally been found using a search engine.

Help and example files


cast3m_dir/dgibi example files
cast3m_dir/doc/html/doc-ang.html help files in english
cast3m_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 french
http://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 relies
only in the definitions of paths in Windows versus Linux, where
becomes /.
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 the
C:\Program Files\cast3m directory the variable should become: CASTEM=C:\Progra˜1\cast3m

5
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- [andrei@rhea Test] $ castem -m XL


gram on the shell command line initi- Le fichier de debordement se trouve dans :
ated by the $ character, and creates a /local/tmp
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 $ FIN DE FICHIER SUR L'UNITE 3
. As in the definition of the paramter a. LES DONNEES SONT MAINTENANT LUES SUR LE CLAVIER
The -m XL option defines the size of the $
static memory allocated by the computer *
to the program and one should under- $ a = 3;
* a = 3;
stand that castem will afterwards dy-
$
namically place its structure is this mem-
ory space.

If a swap space will be needed the swap


file (fichier de debordement) will be de-
fined in the /local/tmp directory.
The comment regarding the logic unit
UNITE 3 corresponds to the case ex-
plained in the following example.

6
This command launches castem and ex- [andrei@rhea Test] $ castem -m XL myfile.dgibi
ecutes in a first step the commands found Le fichier de debordement se trouve dans :
in the file pressure.dgibi. /local/tmp
Technically the program copies the
file myfile.dgibi into fort.3 (called ..............
logic unit UNITE 3) and reads this file. &&&&&&&&&&&&&&&&&&&&&&&&&&
In a second step the program waits for $ * * myfiles content
the commands to be types in the castem- $ * is read here
shell as in the example before. $ *
Technically the program will copy the ........
commands typied in the shell into the $ * end of myfile;
fort.98 (called logic unit UNITE 98) $
*
and reads this file line by line.
$

It is important to remember this infor-


mation for the case of a program crash,
as the fort.98 will keep a track of all
typed commands. The file will keep the
information up to the next program start
when all its contents is removed and the
file is iniatialized as blank.
Both fort.3 and fort.98 are to be
found in the working directory, there-
fore one should avoid to launch simu-
latneously two castem processes in the
same 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 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 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 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 specific 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 ";" 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 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 file reading.
• Files containing commands in the gibiane language are simple ASCII text files 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 configuration files for enableling the syntax highlightning
of 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

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

8
Objects are numerical or logical values organised in different data structures describing mathematical and
physical 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 integers
prog lists of reals
mots 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 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 élément" (fields defined on elements) is a scalar, vector or tensor field defined
on a domain described by its values at specific points of each element of the mesh. Specific points are
fore example the Gauss integration points, where the values of stresses, strains or temperature gradients
are definied in finite 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 fields defined at the nodal
points, 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 type
object and a geometry type object;

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

• vibr[ation] solves the eigenvalue problem KX − λM X = 0, with K, M simetric positive definite


matrix 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 elements
mchaml 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,F ORTRAN ,. . . ;

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

• debpr[ocedure] (debut procédure) and finp[roc] (fin procedure) define a the "procédure" 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 fields defined 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 as-
sumption 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 finite 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.

11
2 Meshing

Outline

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.

2.1 General settings

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

This command defines a two dimen- opti dime 2 elem QUA4;


sional working space and quadrangular
elements as the basic bricks for the mesh.
However simpler elements like points,
segments or triangular will also be cre-
ated by the called operators.

The finite element theory uses fields defining their values at nodal at specific points of elements. Elements
are simple geometrical figures, 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 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 settings
dime dimension of the working space
elem basic element type for the mesh

12
2.2 Examples of 2D mesh creation

Quadrangular plate with a hole

The operator opti does not creat ob- opti dime 2 echo 1 elem QUA4;
jets, but definies the general settings
of the computation by using a series ldom = 1.; r = 0.1;
of key-words. Here we define a two
dime[nsion]-al space and by default a p1 = 0. 0.;
plane strain situation. The basic element p2 = ldom 0.;
is chosen by elem QUA4 to be the linear p3 = ldom ldom;
isoparametric quadrangle. p4 = 0. ldom;
The corners of the mesh are defined us-
ing their coordinates values as functions a2 = r 0.;
of the size ldom of the domain and of the a4 = 0. r;
radius r of the hole (see figure ??) a3 = (r/1.4142) (r/1.4142);

Les opérateurs droit[e] et cerc[le] nel = 10; nel_bis = -20;


permettent de construire les segments
des droite du contour du maillage. Le d12 = droite nel_bis a2 p2
nombre d’élements sur différents seg- dini 0.002 dfin 0.15 ;
ments et donné par les paramètres nel d23 = droite nelem p2 p3;
et nel_bis ainsi que la dimension du d34 = droite nelem p3 p4;
prémier et du dernier élément précisé d41 = droite nel_bis p4 a4
après le mots clefs dini et dfin. dini 0.15 dfin 0.002 ;
Le maillage dom et construit en util- bis = droite nel_bis a3 p3
isant l’opérateur dall[er] initialement dini 0.003 dfin 0.22 ;
en deux parties qui vont être regroupés arc23 = cerc nelem a2 p1 a3;
en utilisant et ensuite. L’utilisation arc34 = cerc nelem a3 p1 a4;
d’inve[rser] change le ordre de par-
cours des noeuds dans le contour pour dom1 = dall
obtenir le maillage correct. d12 d23 (inve bis) (inve arc23);
Et finalment le maillage et visualisé en dom2 = dall (inve d41) (inve d34)
utilisant la commande trac[er] (inve bis) arc34;
dom = dom1 et dom2;

trac dom;

13
Operators for 2D mesh creation
droi[te] creates a straight line
cerc[le] creates circle defined by the center and two of its points
cer3 creates circle defined by three of its points
para[bolic] creates a parablic arc
cubp, cubt create cubic
dall[er] 2D tilling of a curved quadrangular
pav[er] 3D tilling a curved cubic enveloppe
surf[ace] creates a surface by filling its closed boundary
tran[slation] creates a surface by translation
of a ligne along a given vector
rota[tion] 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 first recover domcon = contour dom;
the boundary of the domain using the dombis = surf domcon;
cont[our] operator and we then pro-
ceed by refilling the closed boundary us- trace dombis;
ing 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
file.

A domain can also be created by tran-


lation of a line along a vector. The ex- dom23 = arc23 tran nel (0. r);
ample translates the arc arc23 along the arc23b = dom23 face 3;
(0. r) vector. The vector is not only
used to define a direction but also the trace dom23;
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 trace-
window we can remark that the name
arc23b is already associated with the
corresponding side.

14
P4 P3

A4

P1 A P2
2
GIBI FECIT

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

Operators for 2D mesh creation


cont[our] recovers the boundary of a domain
syme[trique] creates the symetric of a given mesh
tour[ner] creates a new rotated mesh from of a given one
plus creates a new mesh by adding a displacement to a given mesh
elim[iner] eliminates nodes with close coordinates
dedo[ublement] doubles existing nodes (the opposite of elim[iner])
poin[t] selects a set nodes of a given mesh
elem[ent] selects elements of a given mesh
face 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- quart2 = dom syme 'DROIT' p1 p4;
ter can simply be created by completing half = (dom et quart2) syme 'DROIT' p1 p2;
the geometry through symetry (operator
syme[trie]). plate = elim (dom et quart1 et half) 0.001;
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, defining the
neighborhood for which nodes are re-
duced 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 appli-
cation is the creation of cracks.
A difficulty 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
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 poi_line = (cont plate) poin 'DROITE'
plate, lying within 0.001 of the line (0. (-1. * l_dom)) (1. (-1. * l_dom)) 0.001;
(fr. 'DROITE' ) defined by the points
(0., −ldom) and (−1., −ldom). ele_line = (cont plate) elem 'APPUYE' 'STRICTEMENT' poi_line;
Next in a similar way, the elem[ent]
command will select the elements of trace (( cont plate) et (poi_line coul vert));
contour of the plate, cont plate, ly-
ing (fr. 'APPUYE' ) strictly (fr.
'STRICTEMENT' ) on the set points
poi_line.
The result is finally plotted using
trac[er]. One can remark that the
colour of the points has been changed
into green (fr. vert) for a better display.

2.3 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 briefly illustrate one of the construction
commands.

The passage from two to three dimension


can be done in the middle of a program, opti dime 3 elem cub8;
if so the third coordinate of all existing
objects will automatically be set to 0.. trace plate (plate coor 3);
This can readily be observed by plotting
the third coordinate of the plate. cube = plate volu tran nelem (0. 0. ldom);
The two dimensional surface: plate,
can be extruded using the volu[me] trace cach cube;
command into a three dimensional cube.
The enve[loppe] command recovers trace cach (enve cube);
the boundary of the mesh exactly as
cont[our] in the two dimensional case. trace cach (cube face 1);
Parts the extremal sections of the ex- trace cach (cube face 2);
truded volume can be recoved as the 1 trace cach (cube face 3);
and 2 face of the cube, while the cylin-
drical surface of the extrusion will form
the 3 face.

16
2.4 Deformation of meshes

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

We first extract the three coordinate


fields of the plate, and create the field: xx yy zz = coor plate;
uuz = x2 +y 2 . The field will be labelled
as the z component of an displaceent uuz = (xx * xx) + (yy * yy);
field after changing the name of its com- uuz = exco uuz 'SCAL' 'UZ';
ponent from 'SCAL' to 'UZ'.
The new mesh is simply creating by pshell = plate plus uuz;
adding the displacement to the initial
mesh using the plus command. trace cach (plate et (pshell coul rouge));
Finally results are plotted using trace
after the colouring of the new mesh in
red (fr. rouge) using coul[eur]

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 number


of elements of a mesh are simply re- list (nbno pshell);
covered by applying the nbno[euds] list (nbel pshell);
nbel[ements] operators.
noeud permit to recover the geometri- pp = pshell noeud 347;
cal point corresponding to the node of a
mesh. list (mesu pshell 'SURF');

The area of the created meshes is com-


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

17
Other operators for mesh manipulation
nbel[ements] computes the number of elemnts of a mesh
nb[noeuds] computes the number of nodes of a mesh
noeu[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 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.

Exercices

1. Hyperbolic paraboloid
The hyperbolic parabolid is a ruled surface (fr. surface reglée) 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

18
3 Elliptic problems: elasticity and
heat 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 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 opti mode defo plan;


and the fundamental assumptions of
the computations are choosen using the opti mode axis;
opti 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.
The chosen spatial configuration will then automatically assign the standard names of the components of
different fields, we have for example:

• plane strain (defo[rmation] plan[e]). We recall that displacement fields are defined 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 fields are defined in the following way:
field component name
displacement 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
In a similar way to plane strain, the names of the compoenents of the fields are defined in the following
field component name
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] dime n space dimension n = 1,2,3
opti[on] plan defo cartesian coordinates, plain strain
opti[on] plan cont cartesian coordinates, plain stress
opti[on] axis cylindrtical coordinates, axisymetric
opti[on] four[ier] n cylindrtical coordinates, Fourier series expansion up to n harmonics
opti[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 in
displacements as explained for example in [?]. The variational principal of the preceding section transforms
into:

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 distinction
entre les valeurs imposées ou non par les conditions limites. Les déplacements imposés apparaissent ici en
utilisant le matrice de projection [A] et les valeurs imposées [UD ]. Les conditions aux limites en traction ainsi

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

The mode[le] operator associates to a mod = dom mode mecanique


given mesh a finite element, i.e. a elastique isotrope;
specific form function in the variational
principle (here linear functions by de- mat = mod mate
fault, the QUA4 elements) and a mechan- 'YOUN' 2.e11 'NU' 0.3;
ical problem setting mecanique and an
linear isotropic elastic constitutive law.
Other problem settings are fluid, ther-
mal, etc. The definition of the mate- KK = rigi mod mat;
rial behaviour will define the number and
names of the parameters to be defined
next using the mate[riaux] operator, as
well 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.

In order to construct the projection ma- Ad12 = bloq uy d12;


trixes [A] which reduce the displacement Ad41 = bloq ux d41;
vector to the sole part of the bound-
ary where the [UD ] displacement is ap- Ad34 = bloq uy d34;
plied we use the bloq[uer] opertaor. ud34 = depi Ad34 0.1;
The correspond force is then constructed
from [A] and [UD ] using depi (fr. dé- AA = Ad12 et Ad41 et Ad34;
placement imposé).
It is important to notice that the operators
bloq[uer] and depi are not only con-
structing the matrix [A] and the vector
[UD ], but will equally creat new degrees
of freedom corresponding to the La-
grange multipliers of the system. From
a mechanical point of view the Lagrange
multipliers will equal the tractions [T]
on this boundary part, which are un-
known before the resolution of the sys-
tem. These informations can be obtained
by listing the objects [A], for example:
list Ad34; .
The system is finally 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
specified, here only ud34.

The system is finally solved by calling u = reso (KK et AA) ud34;


the reso[lution] operator. As one can
remark only non zero components of the
right hand side of the system have to be
specified, here only ud34.

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

Plots
trac[er] plots different objects
trac[er] model field plots a field defined on elements
trac[er] geometry field plots a field defined at nodes
trac[er] geometry plots a mesh
dess[iner] evolution plots the graph of a function
evolution graph of a function defined by lists of numbers
evol[ution] 'CHPO' ... extracts the evolution of a field 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 displace-


ment vector: uux = exco 'UX' u 'SCAL';
q uuy = exco 'UY' u 'SCAL';
||u|| = u2x + u2y
trace ux dom;
we extract the components using exco
(fr. extraire composante), the algebraic trace (((ux*ux) + (uy*uy))**0.5) dom;
operations and trace for the plot. As the
displacements fields are defined by their
nodal values, we equally specify the un-
derlying mesh for the plot.
Strains and stresses are computed using
epsi[lon] and sigma and the opera- eps = epsi mod u:
tions correspond to the following matrix
computations: sig = sigma mod mat u;

ε = [B][U] (3.3) list (extraire eps 'COMP');


σ = [A][B][U] (3.4) list (extraire sig 'COMP');

The name of their components fields


can be extracted suing the extr[aire]
command.
Another command, corresponds to [BT ]
and enables the computation of the nodal f = bsigma mod sig;
forces from a given stress field:
trace dom (exco fx f);
[F] = [BT ]σ = [A][B][U] (3.5) 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] computes the strain tensor
sigm[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 tensor
vmis[es] computes
rthe von Mises norm of the stress tensor:
3
vmis = devσ : devσ
2
prin[cipales] computes the principal values of stress tensor
@plotpri[ncipales] plots the principal values of stress tensor (user defined subroutine)

23
To plot the components of the strain or
the stress tensor, we directly apply the trace mod sig;
trac[e] and adjoin the model in or-
der to specify the position of the Gauss
points, where the values or defined.

Different additional values related to


stress tensor can easily be computed: the sigvm = vmises sig mod;
Tresca and the von Mises norm using sigtr = tresca sig mod;
tres[ca] and respectively vmis[es]; sigpr = prin sig mod;
or the principal values and the their di-
rections using prin[cipales].
@plotpri is a user defined subroutine @plotpri sig mod;
which permits to plot interactively the
principal stresses.

It is equally interesting to display the


evolution of the stress components along list (extr sig comp);
a given path. In the present computation
we chose to display σyy along the border sigyy = changer 'CHPO' mod (exco sig 'SMYY');
of the circular hole. dess (evol 'CHPO' sigyy (arc23 et arc34));
We start by listing the components of
the stress field. Then interpolate the
σyy component, denoted as 'SMYY' in
Cast3m, 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.

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

The load of the previous example was only defined 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] equally distrutes a given force on a set of nodes
pres[sion] computes the nodal force distribution for a given pressure distribution
coor[donnees] computes the coordinate fields of a given mesh
mass[e] computes the mass matrix
manu 'CHPO' constructs a nodal field

24
Creation of ’stiffness matrixes’
rigi[dite] creates stiffness matrix
mass[e] creates mass matrix
cond[uctivite] creates conductivity matrix
capa[cite] creates capacity matrix
conv[ection] creates stiffness coresponding to convection boundary condition

3.3.3 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 If one wants to impose


given mesh the fields of coordinates. In xx yy = coor d23;
the example presented here we recover
the coordinates x and y in each point of fnor = pres mass mod (3* (xx * xx));
the line d23.
The operator press computes nodal ftan = (exco 'FY' fnorm 'FX') et (-1. * (exco 'FX' fnorm 'FY')) ;
force field corresponding to the pressure
distribution 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 orientation
of the normal pressure fnor distribu-
tion into a tangential traction distribution
ftan, only be exchanging the compo-
nents of the vector field.
a Hertzian pressure distribution, for example defined as a parabola centered around the origin:

pmax (a2p − x2 )

if ||x|| < ap
p(x) =
0 if ||x|| ≥ ap

we proceed as defined before.

Let us only remark the differences.


manu[el] constructs constant nodal xx = coor 1 d34;
field which enable the computation of
the formula of the pressure distribution. ap = ldom / 3.;
masq[uer] constructs the characteristic pmax = 1.e8;
function defined by the condition ||x|| <
ap . The final nodal distribution corre- one = manu 'CHPO' d34 1 'SCAL' 1.;
spondig to the pressure is assembled af- px = pmax * ((( ap * one) ** 2) - (xx ** 2));
ter multiplication of the two preceding ppx = exco (xx masq inferieur ap) 'SCAL' 'FY';
fields.
fp = press mass mod px;
fp = ((exco fp 'FY') * ppx) et ((exco fp 'FY') * ppx);

25
3.3.4 Body forces

In order to construct a body force, which


will take into account the distribution of mat = mod mate 'YOUN' 2.e11 'NU' 0.3 'RHO' 2000.;
density of the body: RHO we adjoin this
information to the model mod and com- MM = mass mod mat;
pute the mass matrix of the body by us-
ing mass[e]. If the gravitational accel- g = manu chpo dom 1 'UY' -9.81;
eration is defined as g, the simple mul-
tiplication of the mass matrix and of the fvol = MM * g;
acceleration will provide the body force
fvol.

3.3.5 Spatially varying material coefficients

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

26
tion.

The first command defines the model


mod which is associated with the mesh mod = mode plaq mecanique elastique isotrope;
plaq.
We then define the coordinates of the X_min = 0.2; X_max = 0.8;
lower-left and the upper-right corner Y_min = 0.2; Y_max = 0.8;
of the square inclusion, X_min, Y_min
and X_max, Y_max respectively. xx yy = coor plaq;
The nodal fields xx,yy will now help to
define the characteristic field of the in- D_CAR = xx masq 'SUPERIEUR' X_min;
clusion: D_CAR, which takes the value D_CAR = D_CAR * (xx masq 'INFERIEUR' X_max);
1 inside the square and 0 outside, and D_CAR = D_CAR * (yy masq 'SUPERIEUR' Y_min);
the complemenatry field: M_CAR, which D_CAR = D_CAR * (yy masq 'INFERIEUR' Y_max);
takes the value 0 inside the square and 1
outside. M_CAR = (manu 'CHPO' plaq 1 scal 1.) - D_CAR;
The unit field over the mesh was manu-
ally defined by the command manu[al]. * material coefficients - Aluminium and Copper
The distribution of Young modulus and
of the Poisson ratio are now created from YG_al = 33.e9; NU_al = 0.32;
the D_CAR and M_CAR fields using the
values of the two materials of the matrix YG_co = 33.e9; NU_co = 0.32;
and the inclusion.
The next step is to interpolate the val- YG_reel = (YG_co * M_CAR) + (YG_al * D_CAR);
ues from the nodes to the Gauss points of NU_reel = (NU_co * M_CAR) + (NU_al * D_CAR);
the elments, where materials parameters
fields are practically defined within finite yg_comp = changer 'CHAM' (nomc 'YOUNG' YG_reel) mod 'RIGIDITE';
element computations. This is reached nu_comp = changer 'CHAM' (nomc 'NU' NU_reel) mod 'RIGIDITE';
using the chan[ger] command with
the keywords 'CHAM', from the french trace mod yg_comp;
champs meaning field and 'RIGIDITE'
meaning stiffness. The words will define mat = mate mod young yg_comp nu nu_comp;
the usage and the header of the new field. rig = rigi mod mat;
On can remark that the name of the com-
ponent of the field 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 com-
mand settings.

Manipulation of fields
chan[ger] changes field type by interpolation
manu[el] creates new objects
nomc changes name of component

27
3.4 Thermal equilibrium - castem problem setting

The finite element model and the mate-


rial properties are declared in a similar mod = dom mode thermique isotrope;
way as in the elastic equilibrium using mat = mod mate 'RHO' 1. 'K' 1. 'C' 1.;
the mode[le] and mate[riaux] com-
mands. The resolution of the thermal KK = conductivite mod mat;
equilibrium problem (??) depands only CC = capacite mod mat;
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 ma-
trix in elasticity.
thermique, heat conduction heat con-
duction, thermique
conductivite, conductivity matrix
capacite, capacity matrix
An imposed temperture on the bound-
ary is realised using the same Lan-
grange multiplier technique as in elastic- Ad23 = bloq 'T' d23;
ity. Therefore we create the projection AA = Ad23;
matrix Ad34 using the bloq[uer] com-
mand. The name of the degree of free- Fd23 = depi Ad23 4.;
dom is 'T' definig equally the compo-
nent of the temperature field. Afterwards
depi will create the force vector associ-
ated to the imposed temperature value on
the boundary under consideration.
The nodal forces, equivalent to a bound-
ary heat flux are obtained by applying the Fd34 = flux mod 2. d34;
flux operator. The model mod is neces-
sary as the underlying finite element are
needed to compute the distribution over
the nodes and elements.
The convection boundary condition:
mod_hole = mode (arc23 et arc34) convection;
∂θ mat_hole = mod_hole mate 'H' 1.;
= h(θ − θ∞ )
∂n
is of a special mathematical type. There- KK_hole = conductivite mat_hole mod_hole;
fore it will introduce a new conductivity
matrix KK_hole defined by the material Fhole = convection mod_hole mat_hole 'T' 200. ;
parameter h and a corresponding nodal
force Fhole defined by the same h and
the environmental temperature h.
Forced convection conditions of the
type:
∂θ
= h(θ − θ∞ )4
∂n
28
are nonlinear and can not be solved in
this problem setting. A first approxima-
tion can be obtained by a applying tem-
perature varying exchange coeffiencient:
h = h(θ).
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 reader
as 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 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 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 analysis
ther*.dgibi from castem_dir/dgibi directory and read the notes in
castem_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 example
consider 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 the
presence of an inhomogenous temperature distribution θ(x), i.e.

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

29
4 Parabolic problems: transient heat
transfer

Dans cette section on reprend les équations de la conduction thermique en régime instationnare discutés en
chapitre ?? 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 comme
présenté dans les fichiers exemple du code. Dans la suite on va partir de la formulation discritisée en espace en
en 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)

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

Avant de demarrer on défini le pas de dt = 0.1;


temps.

Le choix θ = 1 est justifié par un algo- theta = 1.;


rithm implicit et donc stable.

Dans une première étape on contruit les KK = conductivite mod mat;


matrices de conductivité et de capacité, MM = capacite mod mat;
qui sont des objets de type matrice de
rigidité.

Ensuite on calcule les matrices inter- Matnpun = ((1./dt) * MM) et (theta * KK);
venant dans l’algorithme, i.e. dans Matn = ((-1./dt) * MM) et ((1 - theta) * KK);
l’équation (??).

La matrice A correspondant à la temper- Td = 1.;


ature imposé sur la frontière exterieure Ad23 = bloq 'T' d23;
et la temprature exterieure maximale est AA = Ad23;
imposé.

On initialise la table des champs de T = table;


temperature et des temperatures im- T . 0 = manu chpo dom 1 'T' 0.;
posées.
F = table;
F . 0 = depi Ad23 0.;

Le calcule consiste maintenant en la ré- ndt = 20;


solution de l’équation pour chaque pas
de temps. 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 en
utilisant l’opérateur pasapas de Cast3M. Une variante qui utilise un algorithme fondé sur une projection du
champ des déplacements sur une base modale est également disponible avec l’opérateur dyne.

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

eq. 8.31 p. 159 (4.2)

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

La construction d’une barre de longeur ldom = 50.; hdom = 1.;


ldom et de largeur hdom se fait en par- p1 = 0. 0.; p2 = 0. hdom;
tant de la droite definissant la frontière nlelem = 100; nhelem = 2;
gauche dgauche et générant le maillage
dgauche = droite nhelem p1 p2;
avec l’opérateur tran[slation].
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 temps ndt = 200;
dt et les paramètres de l’algoritme β et γ dt = 1.;
sont choisies pour assurer la convergence
et la stabilité du calcul ??. beta = 0.25;
gamma = 0.5;
On défini les conditions aux limites: AA = bloq depla dgauche;
• extremité gauche: barre encastré
F = table;
• extremité droite: un créneau tem- F . 0 = force ddroite (0. 0.);
porel de force pendant quelques F . 1 = force ddroite (-1. 0.);
instants F . 2 = force ddroite (-1. 0.);
On assemble les matrice de rigidité [K] KK = rigi mod mat;
et de masse [K] et on calcule la matrice MM = mass mod mat;
[S] la seule qui va être inverse pendant
l’algorithme. et de masse SS = MM et (( beta * (dt ** 2.)) * KK );

On initialisé les déplacements [U] les U = table;


vitesses [U̇] et les acceleration [Ü]. 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 boucle repeter boucle ndt;


d’incrémentation temporelle formée des n = &boucle - 1;
trois étapes:
* ** prediction
• (a) prédiction
• (b) calcul de l’accéleration Upred = (U . n) + ( dt * (dU . n)) +
((0.5 * dt * dt * (1 - (2*beta))) * (ddU . n));
• (c) correction et actualisation
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)));
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 de
rigidité constante avec similaire à l’algorithme de la section ??. Dans cette version on utilise l’opérateur
ecou[lement] pour le calcul de l’incrémént des contraintes et des variables internes. Pour l’instant on ne

34
calcule donc pas explicement en langage gibiane le retour radial.

On demarre d’un domain dom carre sur dom = dall d12 d23 d34 d41;
lesquel on défini le chargement suivant:
u1 = 0.; u2 = 0.01; ndt = 8;
• déplacement imposé:

uy |d34 = tu1 ux |d12 = tu2 AA1 = (bloq uy d34 ); AA2 = (bloq ux d23);
AA3 = (bloq uy d12) et (bloq ux d41);
• conditions de symétrie sur ...
AA = AA1 et AA2 et AA3;

• surfaces libres ailleurs FF1 = depi AA1 u1; FF2 = depi AA2 u2;
t ∈ [0, 1] désigne le parametre du temps
fictif. Le chargement est imposé en ndt
FF = table;
pas de longeurs égales.
repeter boucle (ndt + 1);
Les matrices de rigidité associées aux
n = &boucle - 1;
blocages sont AA1, AA2, AA3 et AA et FF . n = ((flot n) / ndt ) * (FF1 et FF2);
les forces imposées sont stockées pour fin boucle;
chaque pas de temps n dans un vecteur
force FF . n appartenant à la table FF.
On défini premièrement les paramètres
du comportement: EE = 2.e11; nu = 0.3;
sigy = 600.e6;
• le module de Young EE et le coef-
H = 2000.e6;
ficient de Poisson nu
• la limite élastique sigy et le mod- mod = mode dom mecanique elastique
ule d’écrouissage H plastique cinematique;
mat = mate mod'YOUNG' EE 'NU' nu 'H' H 'SIGY' sigy;
Et ensuite on va associé un com-
portement élastoplastique cinématique
KK = rigi mod mat;
à écrouissage isotrope par l’opréateur
mode au maillage dom. Les paramètres
du modèle sont associés aux modèle mod
par l’intermédiare de l’opérateur mate.
La rigidité KK associé à la partie élas-
tique du comportement est calculé en
utilisant l’opérateur rigi comme dans le
cas élastique, donc associé à EE et nu.
tol_res est la tolérance accépté pour
l’équation d’équilibre et est actuellemnt tol_res = 1.e-3;
le seul paramètre du calcul.
Les tables des déformations plastiques UU = table; sig = table;
des variables internes des déplacement epsp = table; alpha = table;
sont intialisées en uitilisant les opéra-
UU . 0 = manu chpo dom 2 ux 0. uy 0.;
teurs table pour la structure de liste
epsp . 0 = zero mod 'DEFINELA';
généralisée et par zero pour la valeur alpha . 0 = zero mod 'VARINTER';
initiale à t = 0. sig . 0 = zero mod 'CONTRAIN';

La boucle qui calcule les incréments du repeter it_char ndt;


chargement est nommé it_char et de- n = &it_char; mess 'increment charge ' n;
marre avec l’initialisation des valeur des
champs à l’itération n avec la valeur cal- UU . n = UU . (n - 1); epsp . n = epsp . (n - 1);
sig . n =35
sig . (n - 1); alpha . n = alpha . (n - 1);
culé à l’itération précedente n − 1.
du = reso (KK et AA) (FF . n - FF . (n - 1 ));

UU . n = UU . n + du;
deps = epsi mod du;
A l’intérieur de la boucle it_char
des incréments du chargement on con- repeter it_equi max_ip;
struit une nouvelle boucle it_equi.
A l’intérieur de celle-ci on trouve le nsig nalpha ndepsp =
ECOU mod (sig . n) (alpha . n) deps mat;
calcul dce l’incrémént des variables
internes si nécessaire, ceci est réal- sig . n = nsig; alpha . n = nalpha;
isé par l’intermédiaire de l’opérateur epsp . n = ndepsp;
ecou[lement] et puis la vérification de
l’équilibre.

La vérification de l’équilibre démarre


avec le calcul du résidu RR, défini comme RR = ((FF . n) - (bsigma mod sig . n) - (AA * (uu . n)) );
différence entre les efforts extérieures
imposées FF . n et la "divergence" des no_res = n_force RR;
contraintes, i.e. les forces nodales: no_for = n_force ((FF . n) + (reac AA uu . n));
[BT ]σ, calculée en utilisant l’opérateur
bsigma. Le dernière terme permet si ((maxi no_res) < (tol_res * (maxi no_for)));
d’enlever la contribution des déplace- quit it_equi;
ments imposées dans les forces nodales. finsi;
Entre si et findi on teste si la norme
max du résidu des forces nodales est plus du = reso (KK et AA) RR;
petite que la tolérance et alors on va
quit[ter] la boucle it_equi. UU . n = UU . n + du; deps = epsi mod du;
Si la condition n’est pas vérifiée alors
on calcule un nouveau incrémént des dé-
placements du pour équilibrer le résidu
et on revien au commencement de
it_equi pour une nouvelle itération:
mis à jour des variables internes et des
contraintes, etc.

Les deux commandes ferment la boucle fin it_equi;


de vérification de l’équilibre it_equi
et celle des incréments de chargement fin it_char;
it_char.

Les commandes debp[rocedure] et


finp[rocedure] marquent le com- debproc n_force ff*chpoint;
mencement et la fin de la procédure
n_force. Par extraction des com- lanorme =
posantes fx,fy du champs des forces ff (((exco fx ff scal)*(exco fx ff scal)) +
et des opération algébriques on calcule la ((exco fy ff scal)*(exco fy ff scal)) )**0.5;
norme définie comme le champ:
q finproc lanorme;
||f || = fx2 + fy2 où f = fx ex +fy ey

36
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 that
of an elastoplastic problem. In the example we shall refer to the already defined geometry of the plate with a
circular hole (see chapter ?? and ?? ) and will directly start with the definition of the material, the boundary
conditions.
Model and laoding history

The mode[l] and the mate[riaux] op-


erators are used as in the elastic case to mod_p = mode dom mecanique elastique isotrope
define the material behaviour and its pa- plastique cinematique;
rameters. In this case the model is a mat_p = matr mod_p 'YOUN' 2.e11 'NU' 0.3
'SIGY' 200.e6 'H' 2.e9;
elastoplastic model with kinematic hard-
ening.
As in the first version of the elastic computation in chapter ??, we shall define an imposed displacement
on the line d34 of the plate. However if the value of the displacement was fixed in the elastic case, we shall
define 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 defined 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 defing the projection


matrixes and assembles them into only Ad12 = bloq uy d12;
one element: [A]. Ad41 = bloq ux d41;
Next we define the associated nodal
force vector [UD0 ] of the imposed dis- Ad34 = bloq uy d34;
placement distribution u0 , denoted as ud34 = depi Ad34 0.001;
ud34 in the program.
The amplitude a(t) is defined by its AA = Ad12 et Ad41 et Ad34;
graph. In castem this corresponds to a
evolution object assembled from the tt = prog 0. 5. 10. 15. 20.;
list of time instants tt and the core- a_ud34 = prog 0. 1. 0. -1. 0.;
sponding amplitudes a_ud34.
The association of the amplitude ev_ud34 = evol manu 'TEMPS' tt 'DIMP' a_ud34;
ev_ud34 with the correspoding nodal dess ev_ud34;
force vector ud34 is done using the
char[gement] (fr. laoding) operator. ch_ud34 = char 'DIMP' ud34 ev_ud34;
The string 'DIMP' annonces that the
loading is an imposed displacement.
The keywords for different loading
types is specified in the help of the
char[gement] and the pasapas
operators.

37
The computation using pasapas

The nonlinear computation is performed


using the pasapas operator. Its input tabexp = table;
variables are oragnized in a large table,
that means a generalized list, where the tabexp . 'MODELE' = mod_p;
different indexes specify the objects: tabexp . 'CARACTERISTIQUES' = mat_p;
• 'MODELE' - the model
tabexp . 'BLOCAGES_MECANIQUES' = AA;
• 'CARACTERISTIQUES' - the ma- tabexp . 'CHARGEMENT' = ch_ud34;
terial parameters
tabexp . 'TEMPS_CALCULES' = prog 0. pas 1. 20.;
• 'BLOCAGES_MECANIQUES' - the
projection matrixes for imposed
pasapas tabexp;
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
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 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 : 1 Indice d evolution : 3.0000


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

38
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 -------------------

39
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 list tabexp;
of the table, ranging from computational
options and settings to the fields of the list tabexp . deplacements ;
solution. Some of the important entries list tabexp . contraintes ;
are: list tabexp . variables_internes ;
• deplacements - the displace-
list tabexp . temps ;
ment fields
• contraintes - the stress fields trace mod tabexp . contraintes . 15 ;
trace dom tabexp . deplacements . 4 ;
• variables_internes - the
fields of the internal variables
list (extr tabexp . variables_internes . 5 'COMP' ) ;
of the constitutive model, its
component fields are described in
the manuel pages of mode[le]
and mate[riaux], as well as in
documents like [?]
• deformations_inelastiques
- the fields of the inelastic strains
All these entries are themselfs tables in-
dexed 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 field is not saved in the
procedure, but can easily been computed
with epsi[lon].
The computed fields can be displayed
using trac[er], in the usual way, that
means appending the mesh for the nodal
fields, chpoint, and the model for the
fields on elements (chamelem, defined
for examplet at the Gauss points).
If one wants to track the history of a field
at a certain point, one can easily con- thetime = prog;
struct the coresponding evolution ob- uuy = prog;
ject. sigyy = prog;
The prog[amer] command initiates and sigxy = prog;
then constructs by appending the list of
values for the time and field evolutions. repeter loop (dime tabexp . deplacements);
The repe[ter], fin command per- ii = &loop - 1;
mits to construct the loop over all time
steps. The user defined string loop thetime = thetime et (prog tabexp . temps . ii);
is only a flag indicating the start and
the end of the loop. This functionnal- uuy = uuy et (prog (extr tabexp . deplacements . ii 'UX' a3));
ity is of importance for intricate loops.
&loop is the iterator of the loop loop sigyy = sigyy et
and varies from 1 to (dime tabexp . (prog
40 (extr tabexp . contraintes . ii 'SMYY' 1 30 2));
deplacements). However as the lists sigxy = sigxy et
in tabexp start with the initial step set at (prog (extr tabexp . contraintes . ii 'SMXY' 1 30 2));
0 we insert the new iterator ii.
The use of dime[ension] permits to ex- fin loop;
tract automatically the number of time
6 Input and output

Outline

6.1 Cast3m objects

Saving in an exterieur file castem


objects can be realized through the $ * opti sauv 'my_file.dat';
sauv[er] (fr. save) command. $ * sauv plate u;
The option defines first the output file
my_file.dat in the working directory. LA PILE NUMERO 1 CONTIENT 19 OBJET(S) MAILLAGE
The string format ensures, defined by IL Y A 10 OBJET(S) NOMME(S) :
the , ensures that lower and upperscale
letters are respected and the filename is LA PILE NUMERO 2 CONTIENT 1 OBJET(S) CHPOINT
therefore correctly defined. A directory IL Y A 1 OBJET(S) NOMME(S) :
path can also be given here.
The sauv command is followed by LA PILE NUMERO 27 CONTIENT 1 OBJET(S) MOT
e number of objects which should be IL Y A 1 OBJET(S) NOMME(S) :
savec, the mesh plate and the displace-
ment u in the current example. The LA PILE NUMERO 32 CONTIENT 494 OBJET(S) POINT
output information gives a detailed list IL Y A 6 OBJET(S) NOMME(S) :
of the saved objects. The program will
equall save the underlying objects form- LA PILE NUMERO 33 CONTIENT 1 OBJET(S) CONFIGUR
ing the objects to be saved. Fin normale de la sauvegarde
$ *
The data saved with the sauv[er]
procedure can be recovered uisng the $ * opti rest 'my_file.dat';
rest[ituer] command. The option set $ * rest;
the filename to be recovered, and the sec-
ond command imports the complete con-
tents of the file, and the castem output NIVEAU DU FICHIER 16
keeps a track of the operation. All ob-
jects will be imported with their previous
names. 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

41
The presented version of the sauv[er] command realises an export file 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 file of the
sauv[er] command.

6.2 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 file. 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 file temporary file in the working directory called
fort.24. This file will be copied after the end of the castem 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

How to read P OSTSCRIPT files


Saved displayed files, 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 de-
scription 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 files using standard text editors. In the header we can
find a series of settings and definitions. In the case of the castem generated graphics the commands for the
graylevel definitions look as displayed next.

The graylevels are defined by their /eA { 1.0000 setgray } def


names /eA, /eB, ... and the as- /eB { 0.9841 setgray } def
sociated graylevel value 1.0000, ...
0.9841, ... respectively. def stands /e& { 0.0159 setgray } def
/e@ { 0.0 setgray } def
for the end of the definition.
In order to change the graylevel scales in a graphic it is therefore necessary to change the values in the
definitions, 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 file


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

Let us first present the strucure of the


file mesure.dat, which we would like [constant@rhea-lms]$ head mesures.dat
to import in castem 0. 25.58 24.8297 0.7503
The file contains measurements orga- 0.1 42.4199 24.9874 17.4325
nized in four columns of real numbers 0.2 125.599 24.998 100.601
over 786 lines. 0.3 247.493 25.0107 222.4823
Under the Linux operating system its 0.4 368.41 25.0788 343.3312
structure can be displayed using the 0.5 479.224 25.1354 454.0886
head command. wc will count lines, ...
words and characters in the file.
[constant@rhea-lms EssaisEMP]$ wc mesures.dat
786 3136 27653 mesures.dat
[
In order to read the contents of the
file, we first set the opti acquerir to opti acquerir 'mesure.dat';
the filename. Then we initialize, using
the prog[ramer] command, four lists mes_t = prog;
which will containt the values of each mes_text = prog;
column mes_tint = prog;
The values are then read line by line us- mes_del = prog;
ing the acquerir command which is
inserted in a repe[ter] loop.mylop is repeter myloop 780;
only the name of the loop and permits
to fix the beginning and end of the loop. acquerir t*flottant text*flottant tint*flottant
One can further remark that the type of delta*flottant;
each word is set to flottant (fr. real
number) and that the lists are appended mes_t = mes_t et (prog t);
with the new read value by a simple use mes_text = mes_text et (prog text);
of et. mes_tint = mes_tint et (prog tint);
After the reading is complete we can mes_del = mes_del et (prog delta);
structure the lists into evolution ob-
jects which can be displayed using fin myloop;
dess[iner].
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;

43
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 E XCEL format. The subroutine was written by Christian Laborderie in 1994 and gratiously give to the
castem community.
We shall briefly 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 list @excel1;
output using the list command.
The the beginning and the end of sub- Liste de la PROCEDURE
routine are marked by the debproc and *********************
endproc commands. The input vari- 1 * @EXCEL1 PROCEDUR AM 94/01/20 21:15:10 1033
ables are ev1 an evolution object and 2 *-----------------------------------------------------------
the name of the output file ficout given 3 ****** PROCEDURE @EXCEL1 ******
as a string (fr. mot). 4 *-----------------------------------------------------------
First the two list of the ev1 are extracted 5 *
using extr[aire] and the two options 6 * CETTE PROCEDURE A ETE MISE GRACIEUSEMENT
absc[isse] and ordo[nee] which de- 7 * A DISPOSITION DE LA COMMUNAUTE CASTEM2000
note the list on the two coordinate axes, 8 * PAR Ch. LABORDERIE (LMT - ENS Cachan )
respectively. 9 *
Second, the standard output is defined 10 *-----------------------------------------------------------
by the value of the impr[imer] option 11 DEBPROC @EXCEL1 EV1*EVOLUTION FICOUT*MOT;
which is recovered for further use in ii 12 PROG1=EXTR EV1 ABSC;
using vale[ur]. The opti[on] of the 13 PROG2=EXTR EV1 ORDO;
standard output is then defined to be the 14 NB=DIME PROG1;
ficout file. 15 I=0;
Next, the procedure defines a loop in 16 ii=vale impr;
which the values of the two lists are 17 OPTI IMPR 10 IMPR FICOUT;
printed on the standard output, now 18 REPETER BOU1 NB;
defined as the ficout file using the 19 I=I+1;
mess[age] command. 20 X1=EXTR PROG1 I;
Finally the standard output is redefined 21 Y1=EXTR PROG2 I;
to its initial value ii. 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 file. If the file 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 file containing the procedures should be organized as follows:

The file containting the procedures is $$$$ MYFIRST


actaully a simple list of the program- debproc MYFIRST ...;
ming lines, were before each subrou- *
tine a ligne should be added containg the *
strings $$$$ followed by the name of the
subroutine. finproc;
$$$$ MYSECOND
The last line of the file should contain debproc MYSECOND ... ;
only the $$$$ string.
finproc;
$$$$

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

The file containing the procedures util proc 'my_procedure_file.dgibi';


was denoted in this example
my_procedure_file.dgibi. The fin;
ending of the file, denoting usually a file
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 com-
mand and finishing directly afterwards.
The util command will load the proce-
dure in the UTILPROC file in the working
directory and will make it available for
the next runs of castem.

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 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 finite 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 opti sort 'mon_fichier';


file mon_fichier as the standard write
output file and sort[ir] (getting out) sort 'AVS' dom u;
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 which
defines only the standard output format.
To recover the data from the file
mon_fichier one has to define the file opti lect 'mon_fichier';
reading file. Then lire (read) recoveres
the data in the table tab. The indexes tab = lire 'AVS';
lemailla and lechpoin indicate the
position of the mesh (le maillage) and of trace (tab . lemailla) ;
the nodal field (le champs par points) re- trace (tab . lemailla)
spectively. (exco 'UX' (tab . lechpoin));
The precision of the operation can be
controled by plotting both the mesh and
one of the compoenents of the displace-
ment field.

Exercices

46
7 How to and other questions

How to save a standard display

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

48
Index

do, end repe[ter], 43 dedo[ubler], 14


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

49
heat, 27 read lire, 44
real number flottant, 8
if si, 9 recover data from file rest[ituer], 40
integer entier, 8 repe[ter] , 39
inve[rser] (change order), 12 repe[ter] (do, end), 43
lect[ure], 8 repe[ter] (do, start), 43
line droi[te], 9 repe[ter] (do), 9
line droit[e], 12 repe[ter] (loop, end), 43
lire (read), 44 repe[ter] (loop, start), 43
listenti[er], list of integers, 8 reso[ut] (solve), 9, 20, 27
listmots, list of strings, 8 rest[ituer] (recover data from file), 40
listreel, list of real numbers, 8 rigi[dite] (stiffness), 20
logical value logique, 8 rigidite (stiffness), 9
logique (logical value), 8
loop, end repe[ter], 43 sauv[er] (saving data in file), 40
loop, start repe[ter], 43 save graphics, 41
saving data in file sauv[er], 40
maillage (mesh), 8 select elements elem[ent], 15
manu[el] (creates fields and other objects), 26 select points or nodes poin[t], 15
mask, characteristic function masq[uer], 9 settings opti[on], 11
masq[er] (characteristic function), 24 si (if), 9
masq[uer] (mask, characteristic function), 9 sigm[a], stress , 22
material maté[riaux], 20 sinon (else), 9
maté[riaux] (material), 20 solve reso[ut], 9, 20, 27
mchml (change from nodal to element field), 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 file, 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 field chpoint, 8
subroutine; end finp[roc], 9
nodal force , bsig[ma], 22
subroutine; start debpr[ocedure], 9
opti[on] (settings), 11 surf[ace] (surface), 9
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
plot trac[er], 9 thermique, 27
plus, new mesh by a adding a displacement, 15 tilling 2D dall[er], 12
plus, 9 tilling dall[er], 9
poin[t] (select points or nodes), 15 trac[er] (plot), 9
prog[ramer], 8 trac[er], graylevels, 41

50
trac[er], save graphics, 41

util[isateur], 44

vibr[ation], 9
vmis[es] (Mises stress norm (von Mises)), 23

write sortir, 44

51

You might also like