In this article, I will tackle the 10 most basic commands to know about in Onscale Analyst mode
What is Onscale Analyst Mode?
Here’s a short video which shows you the 3 modes you can use to perform an analysis:
There are 3 modes available in Onscale:
- The Designer mode allows to create a simulation model using the Onscale graphical interface (GUI) in a simple way
- The Analyst mode allows to handle all the most complex analysis with “Symbol script”
- The Post-processing mode is here to display the results
How to write a simple 40 lines Analyst mode script of sound wave propagation?
An OnScale Analysis can be set up with less than 40 lines of script
For example, in the following video, I’ll show you how to make a wave propagation in a square steel plate using just a few lines of code:
As you saw in the video, there are only a few basic commands to know and you will be ready to go!
Those commands are:
grid, geom, matr, site, grph, func, bou, calc, prcs, exec, data and term
Here is the script I am using in the video:
grid 400 400 geom xcrd 0 0.1 1 400 ycrd 0 0.1 matr prop steel 7700. 160.e9 80.e9 site regn steel grph type standard line on plot matr end term func wvlt 1.e6 1. boun side ymin vel func 0. 1. calc pres acoustic /* calculate acoustic pressure max aprs none apmx /* calculate min/max acoustic pressure end prcs exec 400 data file out '2D_Wave_3.flxdato' out modl out apmx end grph set imag png plot yvel imag term
Let’s analyze together how each of those functions work
1- The Grid command
This command is used to define the number of nodes in the computational grid, the number of dimensions for the model, and the appropriate constraint relations.
The Syntax is:
grid igrid (jgrid) (kgrid) constraint
the constraint parameter can be used for 1D and 2D models and defined as:
- AXIL = axial wave propagation (1D model)
- SH = shear wave propagation (1D model – elastic only)
- PSTN = plane strain (2D model)
- AXIX = Axisymmetric about x-axis (2D model)
- AXIY = Axisymmetric about y-axis (2D model)
- SH = SH-wave model (2D model – elastic only)
grid 50 /* 1d model, axial wave propagation with 50 nodes grid 100 40 axix /* 2d axisymmetric model, radius is y-axis grid 30 60 /* 2d plane strain model, 30 x 60 grid nodes grid 400 200 100 /* 3d model, 400 x 200 x 100 = 8,000,000 nodes
2- The Geom command
This command is used to define all the nodal coordinates for the model.
It has several subcommands like xcrd, ycrd, zcrd or keypnt which are used to actually create the nodes
The general syntax is like that:
geom xcrd 0 0.1 1 400 ycrd 0 0.1 1 400
This example is a way to attach a rectangular region of size 0.1 x 0.1 to the 400 x 400 grid of nodes defined with the “grid” command
3- What are Keypoints?
4- The Site command
This command is used to specify the material properties for a rectangular region of the computational grid in the IJK space.
If you use site followed by the command “regn” (for region) and the name of the material property, then you will assign this material to the whole grid
site regn steel
You can also add the index of some specific nodes to define a region of the grid delimited by those nodes
site regn aln $i1 $i2 $j1 $j2
The site command can be used with many other commands than the “regn” command to create various kind of shapes.
For example, blok can be used to defined a rectangular sub-shape, cyln can be used to create a cylinder
Check the documentation for the full list of commands
5- The matr command
The matr command is used to define material properties for each continuum material in the model.
A simple to define an elastic material for example is to use the command:
matr prop steel 7700. 160.e9 80.e9
the properties following the “matr prop” command are respectively the following:
matr prop matname density bulk shear hourglas damplinear dampquad
Hourglas is used to suppress hourglass modes. Here is a good presentation explaining the phenomena here: http://ftp.lstc.com/anonymous/outgoing/jday/hourglass.pdf
damplinear and dampquad are used to introduce artificial viscosity to the material used in shock wave propagation problems.
Those options aren’t needed for simple wave propagation.
6- The grph command
This command provides interactive graphics display of time history results and functions. It can also be used to generate images and screen captures of your model and results.
For example, if you wanted to print out your model from script with just the materials associated to each part, you would write it like that:
grph type standard line on plot matr end
Let’s talk about the subcommands and options we have here:
The sub-command type is used to define if the type of graphics used is standard or runtime.
By default, you should use STANDARD if you run a script from the console and RUNTIME if you run it from another mode such as the designer mode.
The sub-command line with the option on specifies that you want to see the mesh elements.
finally, the The sub-command plot is used to plot curves or more general types of data
(here we choose to plot the material to the whole area defined by geom)
The syntax of graph plot is the following:
plot data1 rangeoption minvalue maxvalue
The data1 refers to the name of a data array stored within the Data Manager. If the array is in a directory, the path name should be given.
The rangeoption and min maxvalue are used to set up the range of the values we want for the displayed data in the legend
7- The func command
The FUNC command allows you to define the characteristics of a special purpose function. Currently available are 7 functions e.g. Ricker Wavelet and Sinusodial Pulse. There is also the option to load in a user defined time function from some external data. Here we are using a Ricker Wavelet function centred at a frequency of 1MHz with an amplitude value of 1.
8- The calc command
This command is used to specify secondary field variables and energy quantities to be computed and stored during execution. Secondary field variables are nodal and elemental quantities that the computational algorithm does not require to be stored during the computation.
calc pres acoustic /* calculate acoustic pressure max aprs none apmx /* calculate min/max acoustic pressure end
If snapshots or time histories of secondary field variables are desired for any stations in the grid, these variables must be specified with a CALC command. They are computed and stored in memory for all stations in the grid.
Computing secondary field variables requires relatively little cpu time, but large amounts of memory may be required to store the requested data.
9- The bou command
This allows you to assign boundary conditions to the grid boundary surfaces. The Ricker Wavelet input function defined can be called and used throught the script by simply calling ‘func’. So here what we are doing when we are using the BOUN command is applying our time function to that side and loading the model on ymin. Normally the BOUN command is used to define boundary conditions such as symmetrical, absorbing, fixed or free. Onscale has a wide range of boundary conditions and they can be freely defined to a region of the model within our Analyst and Designer modes.
10- The prcs command
The PRCS command is required in every model. It checks that your code is correctly set up, initializes the arrays that will hold all the data calculated during execution and most importantly it calculates the timestep required to run the job based on your mesh and materials. Without it, you cannot run the model. The EXEC command would use the time-step determined by PRCS so it will return an error if there was no PRCS command.
11- The exec command
EXEC is used to compute the response of the model. Normally you would know how long you want to run your model or you could calculate this yourself. Normally you would want to set up a plotting loop after the PRCS step to visualize how your model is affected by the input. This Analyst Tutorial shows to properly set up a plotting loop.
12- The data command
This command is used to provide the user with direct access to data manager arrays (calculated results for example)
It should be used at the appropriate place in the input stream to read in or write out the data of interest.
Here’s an example:
data file out '2D_Wave_3.flxdato' out modl out apmx end
This short code creates an output result file called “2D_Wave_3.flxdato” and writes the arrays modl and apmx into it.
Here’s an useful tips:
This command can be used to print data into paraview format with a code like this
read f1 example2.flxdato data form out prvu out f1/ /* required for pointing the grid location out f1/1/pres
13- The term command
This is used to pause the run process, without this the plot will just flash up quickly and close this holds the graphics open until the process is continued. To continue a process once a term has been reached click Run Local again or input ‘t’ into the console.