How to efficiently output the results of a simulation

Often there's the need to create plots showing how a variable changes its value in a specific location of the model. For example, one could be interested in plotting the variation of the stress in a node of the model with respect to time. Code_Aster allows to do that directly inside its command file through two specific commands. As a result, you can write the variation of one or more variables in one or more positions in the mesh in a text file (table format) or you can plot it directly: the resulting graph will be saved in a graphical file (e.g. postscript, PNG, JPEG, SVG, PDF...).

In the following part of this article, it will be shown how to do that by means of a simple example.

A simple example

Let's take a 2D plate (plane stress condition) subjected to a traction load.

plate.png

The load changes linearly in time, starting from 0 and increasing to a maximum value. The material is elastic.

Setting up the FE model

All the files (comm file, mesh and results) of the FE simulation are attached. Let's go through the interesting parts only.

We define first the time interval on which we want to calculate the solution. We suppose that this interval goes from 0 to 1 second and we use only two points in this interval (one at 0.5 sec and the other one at 1 sec):

TimeStep =DEFI_LIST_REEL(DEBUT=0,
INTERVALLE=_F(JUSQU_A=1,
NOMBRE=2,),);

We then define the load at its maximum value (here -1E6):

force=AFFE_CHAR_MECA(MODELE=modele,
PRES_REP=_F(GROUP_MA=('FaceUp','FaceDown',),
PRES=-1E6,),);

In order to impose a linear variation to the force with respect to time, we define a linear function of time going from 0 to 1:

LoadFunc =DEFI_FONCTION(NOM_PARA='INST',
VALE=(0.0,0.0,1.0,1.0))

Then we solve the model. The load is multiplied by the time function we have just defined:

Res=STAT_NON_LINE(MODELE=modele,
CHAM_MATER=champ_ma,
EXCIT=(_F(CHARGE=force,FONC_MULT=LoadFunc),
_F(CHARGE=vinc,),),
SOLVEUR=_F(RENUM='MD',),
COMP_ELAS=_F(RELATION='ELAS',),
INCREMENT=_F(LIST_INST=TimeStep,),);

The object Res contains the solution at the instant of time defined in TimeStep .

Formatting the output

In order to monitor the displacement of point P, we first define a function built starting from the results contained in the object Res:

Uy = RECU_FONCTION(RESULTAT=Res,
NOM_CHAM='DEPL',
NOM_CMP='DY',
GROUP_NO='NodeUp',)

The node of the mesh coincident with point P is included in the group "NodeUp". We are saying that we want to build this function based on the component DY (vertical displacement) of the field "DEPL" (displacements) contained in the result Res for the nodes in the group "NodeUp".

Once this object of kind "function" has been built, we can print it in table format:

IMPR_FONCTION(UNITE=8,
TITRE='Displacement of the upper-left node of the plate',
COURBE=(_F(FONCTION=Uy)),)

Here's the result written in a text file:

## Displacement of the upper-left node of the plate
##
## Courbe 0
## Uy
INST DY_0
5.00000E-01 3.64078E-05
1.00000E+00 7.28155E-05

We can also ask to create a plot of these values directly in the comm file:

IMPR_FONCTION(FORMAT='XMGRACE',
UNITE=29,
PILOTE='POSTSCRIPT',
LEGENDE_X='Time (INST)',
LEGENDE_Y='DY',
TITRE='Displacement of the upper-left node of the plate',
COURBE=(_F(FONCTION=Uy)),)

Here we have asked for a PostScript file but other formats are available as well (PNG, PDF, SVG...). Here's the result:

displacement.png

Documentation

The two commands RECU_FONCTION and IMPR_FONCTION have several options and are really powerful. Check the documentation for further information. Enjoy!

RECU_FONCTION: document U4.32.03

IMPR_FONCTION: document U4.33.01

FE model files

  • Plate2D.tar.bz2: Files of the FE model of the example (command, mesh and result files)

Current Tags:
create new tag
, view all tags
Topic attachments
I Attachment Action Size Date Who Comment
elsebz2 Plate2D.tar.bz2 manage 123.0 K 2010-10-19 - 13:46 DanieleColombo Files of the FE model of the example (command, mesh and result files)
pngpng displacement.png manage 42.5 K 2010-10-19 - 13:31 DanieleColombo  
pngpng plate.png manage 8.7 K 2010-10-19 - 13:08 DanieleColombo  
Topic revision: r1 - 2010-10-19 - 13:47:21 - DanieleColombo
Aster Web
15 Dec 2017
Links
Home
Download
FAQ
News
Test Cases
Developments
Publications

tip Saturne Tip of the Day
Create multiple cases
You can create multiple cases with a single command, just add as many cases as you want in your cree ... Read on Read more

 

Code_Aster collaborative website
@ the University of Manchester
Copyright & by the contributing authors. Unless noted otherwise, all material on this web site is the property of the contributing authors.