Difference between revisions of "Contrib:Claws/Code Aster/10 x cases/torque"

From CAELinuxWiki
Jump to: navigation, search
m (Defining the list of time steps)
m (Defining the list of time steps)
Line 161: Line 161:
:*INTERVALLE: Interval ranging from 0 to 10 ('''T1=10'''), number of steps in this interval: NOMBRE='''NBT''' which is 10. Next interval continues from 10 to '''T2=20''' and this interval is also divided into 10 steps. And so on.
:*INTERVALLE: Interval ranging from 0 to 10 ('''T1=10'''), number of steps in this interval: NOMBRE='''NBT''' which is 10. Next interval continues from 10 to '''T2=20''' and this interval is also divided into 10 steps. And so on.
An interval of JUSQU_A=40 with NOMBRE=40 would be just the same, but without the option of de- or increasing the number of time steps within each of the 4 intervals.
A single statement with an interval of JUSQU_A=40 with NOMBRE=40 would be just the same, but without the option of increasing (or decreasing) the number of time steps within each of the 4 intervals.
===Assigning materials===
===Assigning materials===

Revision as of 15:37, 22 July 2010

<-Link: Back to Contrib:Claws/Code_Aster/10_1_x_cases


Introduction and theory

This is the result of we'll be working towards in this study

Claws result.gif

Applying Torque

Code_Aster does not (yet anyway) have a straight forward way of applying torque to a structure. Only nodes have the option of having moment (FORCE_NODALE-> MX,MY and MZ) applied to them. What this means is, that you, in order to apply torque to an object, have to connect a single node to the object and and thereby transfer the moment into torque.

There are several ways of achieving this, but I will only describe one of the ways here. In terms of what happens inside Code_Aster, this method places a single node adjacent to the surface you want to apply torque to, creates a rigid link between the single node and the surface and finally applies the moment and thereby torque.

  1. Surface you want to apply torque to
  2. Create adjacent single node
  3. Code_Aster creates rigid links between the node and the surface
  4. Apply moment to single node

Claws applying torgue.png

Note: If applying force (FORCE_NODALE - FX,FY and FZ) to the single node, the force is distributed equally to each node, thus in this case each node would receive 1/5 of the applied force.

Creating the groups in Salomé

(You should be familiar with creating a geometry and meshing it already)

Not much to explain here since it is described well in the image below.

Mesh your object and create a single node centre and normal to the surface you want to apply torque to. In this case it makes sense to create it with an offset normal to the surface so it's easier to select the single node. Assign a 'node group' to the single node

The surface you want to apply torque to, must be assigned to a 'node group' and not a 'surface group' (important). Include the single node you just created (important).

Finally, assign a surface group (or which ever you prefer) to the surface that will prevent the object from moving. Here the bottom of the object.

Claws Twister group edit.png


Using parameters in Code_Aster is as useful as in any situation; it lets you change many variables at once and can let you control an entire calculation by changing only one parameter.

In this case one parameter is used to do just that: T1

  • T1=10
  • T2=(2*T1)
  • T3=(3*T1)
  • T4=(4*T1)
  • NBT=T1 (or any of the Tx)
  • T_END= Any of the Tx

By changing the value of T1 you change the number of steps (resolution) in the calculation and the length of the calculation.

By using a value of 10 for T1, 10 steps is calculated for each interval, and with 4 intervals 40 calculations is done. Using T1=100 increases the resolution and length by an order of 10.

The parameter NBT determines the number of steps for each interval so with NBT=T1 the number of steps becomes 10

The parameter T_END determines for how many steps the entire calculation should run for. In other words; it determines how many intervals are calculated, e.g. T_END=T1 means 10 steps are calculated and outputted and with T_END=T4, 40 steps are calculated and outputted.

I've tried to visualize the influence of the parameters in this diagram (click to view full image)

Claws Parameters.png

The load multiplier is also connected to T1 and thus follows the number of steps you increase or decrease (but not the magnitude of the load) The parameter ANGLMAX is used to determine the maximum magnitude of the load (angle of twist) in the object.

In the following diagram, the function for the load and the intervals of the calculation is visualized.

Claws Load function.png

<br\> <br\>

Applying the theory to Code_Aster

This section will go through the command file describing each relevant step.

'Creating' the single node inside C_A

In order to apply any kind of load or displacement to anything in C_A, a model and material must be assigned to it. This also applies to the single node we're going to use to impose load or displacement in this case.


(Document U4.23.02 details the use of CREA_MAILLAGE)

  • LIRE_MAILLAGE: Read the original mesh file and assign it the name 'mesh1'
  • CREA_MAILLAGE: Create a new mesh from the original mesh
    • CREA_POI1: Create a mesh containing a single node from the node group 'load' - This is necessary in order to assign a model and material to the node later on.
    • NOM_GROUP_MA: Name of the new mesh group 'load' - will now have the same name as the node group 'load' we created in Salomé

Defining the parameters

T1 = 10;

T2 = (2 * T1);

T3 = (3 * T1);

T4 = (4 * T1);

#NBT = Number of timesteps
NBT = T1;

ANGLMAX = 0.03;

#T_END = endtime
T_END = T4;

Defining the load function

  • DEFI_FONCTION: Define a function
    • NAM_PARA=INST: Define a function based on points and dependent on time (See the image above on the load function)
    • VALE: Values (points) in a Cartesian coordinate system - x1,y1 , x2,y2 , x3,y3 to form a domain.
    • PROL_DROITE and PROL_GAUCHE = extend_right and extend_left. Defines the type of extension to the right (or left) the domain of the variable:
      • 'CONSTANT' For an extension with the last (or first) value of the function,
      • 'LINEAR' For an extension along the first segment defined (PROL_GAUCHE) or the last segment defined (PROL_DROITE)
      • 'EXCLUDED' The domain starts and ends with the values given. In the case a calculation requires a value of the function outside the domain of definition, the code stops with fatal error.

Claws defi fonction extend.png

Doc U4.31.02 - 3.8 Operands PROL_DROITE and PROL_GAUCHE

Defining the list of time steps


4 intervals each containing 10 time steps

  • LINST=DEFI_LIST_REEL: Create a list called LINST consisting of real numbers. Start the list at 0 (DEBUT=0)
  • INTERVALLE: Interval ranging from 0 to 10 (T1=10), number of steps in this interval: NOMBRE=NBT which is 10. Next interval continues from 10 to T2=20 and this interval is also divided into 10 steps. And so on.

A single statement with an interval of JUSQU_A=40 with NOMBRE=40 would be just the same, but without the option of increasing (or decreasing) the number of time steps within each of the 4 intervals.

Assigning materials



As said before, everything must have a material assigned to it, even the single node used for applying load/displacement:

  • DEFI_MATERIAU: Define material, assign the name 'Steel' to it.
    • ELAS: We only deal with a regular elastic material here, with an elasticity module (Young's module) of 210 GPA and a Poisson's ratio of 0.3
  • AFFE_MATERIAU: Assign the material 'Steel' to everything (TOUT=all, OUI=yes)

Assigning models


Here we assign models to the components of the object:

  • AFFE_MODELE: Assign model, conveniently called 'Model' here
    • MAILLAGE: Assign to the mesh called 'mesh'
    • AFFE_1: Assign a 3D mechanical model to everything
    • AFFE_2: Assign a discreet model to the single node 'load'
      • MODELISATION=DIS_TR: A DIScret model with the capabilities of Translation and Rotation is assigned.

Assigning loads

Loads meaning boundary conditions actually.

  • AFFE_CHAR_MECA: Assign a mechanical load. Use the previously assigned model (MODELE=Model)
    • DDL_IMPO: Impose a boundary condition.
      • GROUP_MA='hold'
        • LIAISON=ENCASTRE: The group 'hold' is assigned 'ENCASTRE', which is just an easy way to block movements in all directions instead of assigning DX=0, DY=0, DZ=0 to the group.
      • GROUP_MA=load
        • DRZ=1.0: The single node 'load' is assigned a rotation around the Z axis: DRZ=1
    • LIAISON_SOLIDE: This is where the magic happens
      • GROUP_NO='twister': The node group 'twister' is now told to have a completely rigid connection (LIAISON SOLIDE) - if the node 'load' moves, so does the rest of the nodes in the group.

Defining the characteristics of the single node

Again, the single node must have some characteristics in order to work within the calculation, and since it's 0D and not 3D we must describe it. It doesn't make as much sense here as it does when you describe the characteristics of a 1D beam (POUTRE), but it has to be done.

  • AFFE_CARA_ELEM: Assign the characteristics of the element using the MODELE=Model
    • DISCRET=Discreet
      • CARA=K_TR_D_N:
        • K: Stands for the type of the discrete element : K (stiffness), M (mass) or A (damping)
        • TR: It can translate and rotate
        • D: It's a Diagonal matrix - the other setting is to omit this letter (you then have to input the whole matrix)
        • N: It's a node (L for seg2 element)

Since the node 'load' is only used to induce loads in the structure and nothing else, everything is assigned the value 1

See U4.42.01 section 13.3.3 for further information on using AFFE_CARA_ELEM and what the values mean

Defining the non-linear calculation

  • STAT_NON_LINE: Create a non-linear calculation (Solution if you will) called 'SOLNL', use the MODELE='Model'.
    • CHAM_MATER=CHMAT: Use the material CHMAT to calculate the material 'field' (CHAMP=field)
    • CARA_ELEM=CARA: Include the characteristics CARA we previously defined for the single node 'load'
    • EXCIT= Excitation of the calculation (in lack of a better word)
      • CHARGE=CHME: use the loads assigned in CHME
      • FONC_MULT: Function multiplier; This uses the function 'ROTA' we defined previously (see image in 'Introduction'). At time step 0 the loads are multiplied by 0 and at time step T1=10 the loads are multiplied by 1 (DRZ=1 for the single node and ANGLMAX=0.03)
    • COMP_INCR= RELATION='ELAS': Incremental behaviour (COMPORTEMENT=behaviour) relationship. This determines the incremental behaviour of the material under certain conditions, e.g. how a material deals with increasing stress/strain or increasing temperature. Since we're only dealing with elastic behaviour here and not elasto-plastic, assign this to 'ELAS'
    • INCREMENT= How the calculation increments based on the previously defined list LIST_INST='LINST' and ending when it reaches INST_FIN=T_END

Calculating and writing the results

Nothing new here; calculate the elements and nodes, write the displacement and equivalent nodal stress to a .med file.




Generating an animated GIF file from the results

Outputting the images from Salomé

Use Salomé's post-processing modules to open the resulting .med file, right-click the SOLNL_DEPL field and select 'Successive Animation':

Claws gif 1.png

Click 'Setup Animation'.

In the lower right corner select 'Deformed shape and Scalar map'. Click 'Properties' and set scaling to 10 and the field to SOLNL_SIGM, click OK, click OK again to return to the animation tab.

Claws gif 2.png

Press 'Generate frames' and tick 'Save pictures to directory'. Select the format of the pictures to be outputted (I prefer PNG) and select which directory the files should be saved to. Now press the Play button and the let animation run once.

Claws gif 3.png

Generating the gif from the output

(You must have Imagemagick installed on your system to follow this step)

Open a terminal and navigate to the directory where you saved the series of images.

Launch the following command:

convert -loop 0 -quality 100 -resize %50 -antialias -bordercolor white -border 5 -blur 0.5x0.5 *.png giffer.gif

'convert' is a program that is a part of Imagemagick and can be used to do a myriad of things to a batch of files. Here we tell it to let the resulting animation loop indefinitely (-loop 0) keep the compression quality at 100, resize the images to 50%, antialias the image to get rid of some noise, give it a white border with the width of 5 pixels and blur the image slightly to remove even more noise. Finally all the PNG files are processed (*.png) and the resulting animated GIF file is called 'giffer.gif'

Change any of the values to suit your need, this is just an example I used to create the animation in the beginning of the page.


I've decided to include everything I used to create this little tutorial, even the [Dia] files. It's a great little program. Learn it. Now.



  • Dia files. Diagram files used for the images in the introduction.
  • Mesh files. Mesh before and after calculation
  • .comm, .astk and .hdf
  • .mess, .export and .resu files from the calculation.
  • Images used here.

The End

AND THERE YOU HAVE IT! Post any questions or corrections in the forum or create a login here and correct it (or write hateful messages in the 'Talk' page) :)

--Claws 01:20, 28 January 2010 (CET)