Difference between revisions of "Contrib:JMB/XMGrace"

From CAELinuxWiki
Jump to: navigation, search
(Initial page content)
 
m (Topics under construction)
 
Line 1: Line 1:
= Topics under construction =
+
= Topic under construction =
  
 
== 3 Clicks and a Graph!==
 
== 3 Clicks and a Graph!==

Latest revision as of 03:19, 17 August 2010

Topic under construction

3 Clicks and a Graph!

Aster commands for using XMGrace

The standard CodeAster package comes with its own built in plotting ability. The commands for creating the output when embedded into the *.comm file, will create the output. We just need to tell ASTK to assign the results to a logical unit (LU=29) and a suitable output file name assigned with 'R' (i.e. Result). I normally use the extension <*.agr> for this output file. Any name and extension should work, I think.

This tutorial shows how to set up the comm file. Let us use the very nicely written tutorial by Kees Wouters as a base [1]. That tutorial shows you how to conduct a modal and a forced dynamic response of a simple cylinder. The resulting plots of that tutorial were perhaps created using a spreadsheet or another such plotting tool.

Why XMGrace ?

Why do I recommend XMGrace? Because it is easy to get plots once the command file has been set up. Thereafter it requires just 3 clicks in the ASTK window. One on the file name '*.agr', the second on 'Tools' and the third on 'Grace'. The immense benefit is, one can see very quickly graphically, if the results are what you expected.

Of course a speadsheet, octave, gnuplot, etc. has features that far exceed the plotting capabilities of XMGrace, I believe. But there's nothing to beat the handiness of plotting with 3 clicks! Especially when one is making several runs or a parametric study.

The commands

All we need to add to the comm file just before the "FIN();" command is:

Dz=RECU_FONCTION(TABLE=TB_nodf,
                   PARA_X='INST',
                   PARA_Y='DZ',);

The explanation of this command is:

  1. Load into function Dz the nodal displacement values from table TB_nodf, values from column: DZ (Displacement Z) for each INST (Time step). Resulting in tuples where
  2. X values = Time Step instant
  3. Z values = the corresponding displacement in Z direction


T=RECU_FONCTION(TABLE=TB_nodf,
                  PARA_X='INST',
                  PARA_Y='INST',);
                
  1. Load into function T the time step values from table TB_nodf, values from column: INST. Resulting in tuples where
  2. X values = Time step instant
  3. T values = Time step Instant

(This second step may seem redundant, and if somebody has a more elegant way please let us know here. Essentially we are creating two arrays T & Dz which contain the time instants and corresponding displacements of the top node in the Z direction.)

Then output T versus Dz for plotting with XMGrace

IMPR_FONCTION(FORMAT='XMGRACE',
                UNITE=29,
                COURBE=_F(FONC_X=T,
                          FONC_Y=Dz,),
                TITRE='Displacement Dz of the top node',
                LEGENDE_X='Time [s]',
                LEGENDE_Y='Displacement [mm]',);

In ASTK define a 'dat' type output file named 'dynload.agr' with unit number 29 with (R)

The graph!

Then 3 clicks later (as described earlier) you should see a graphical plot!

XMGrace.png