3. Simples Applications
Simples applications are programs for processing B2000++ models, based on the Simples library.
Most applications produce formatted text output. However, if CSV
format is specified (--to=csv
option), CSV text output is
generated, which can be piped in a spreadsheet program.
3.1. b2browser
b2browser is a GUI based program for examining the content of one or more B2000++ model databases and for displaying log files of B2000++ runs associated to a database. If no model database is specified on the command line, model databases can be opened with the FILE menu.
The b2browser list meshes (nodes, elements, node and element lists), materials. boundary conditions, case information, solutions found, as well as other data. In addition, the B2000++ Log file can be displayed during run time or a posteriori.
b2browser formats database information in a comprehensible way for the user. To read a B2000++ database in a raw way, i.e. dataset by dataset, without any interpretation, please make use of the b2mcbrowser application.
Synopsis
b2browser.py [-h] [--version] [--verbose] [--debug] DBNAMES
positional arguments:
DBNAMES B2000++ model database name
optional arguments:
-h, --help show this help message and exit
--version Print version and stop.
--verbose Verbose output (test).
--debug Debug mode, prints traceback and optional app dependent
printout.
If no model database is specified on the command line, model databases can be opened with the FILE menu.
Files
The b2browser creates or updates the preferences file under
$HOME/.config/B2000++/b2browser.json
.
Example Session
Startg the b2browser from the shell (scordelis_lo_roof
example
of the*B2000++* example cases):
If the b2browser is launched from the desktop, such as Gnome, any model database or report file must be opened with the File menu.
The following b2browser keys for extracting and displaying of data are active during a session:
Left Mouse Key: Selects an entry and displays text.
<shift> Left Mouse Key: Selects an entry and displays a graph (if applicable [1] and graphics software installed).
- <ctrl> Left Mouse Key: Selects an entry and exports data in a CSV
(comma separated value) file (if applicable ).
The b2browser is GUI based and its operation is mostly self-explanatory. When starting the b2browser with a B2000++ database the main page pops up:
All entries are selected by clicking the left mouse button.
The top row of the main page contains the File and Help menus, as well as additional global menus and buttons. The File menu allows for opening B2000++ databases and the report file.
The actual browser area contains tabs (A), each tab holding a B2000++ database. A list with all elements that can be browsed is presented in B and the content of an element is presented in C and D, C being the ‘column header’. Finally, G displays messages.
The list with all elements that can be browsed (B) starts with the B2000++ Log entry, which displays the B2000++ log file (if available). All other entries pertain to the B2000++ model. If an entry is preceded by the > symbol, clicking on > will unfold the entry. In the example above, the displacements of Case 1 are selected and displayed (E).
The report capability copies the data displayed in C to a text
file, adding the data to the report file. The R+ button (F)
performs this operation. The default file name is report.txt
,
and the file is located in the same directory as the B2000++
database.
Preferences can be set with the Preferences entry of the File Menu.
3.2. b2print_nodes
Print mesh nodes (coordinates, etc). By default all nodes are printed. If neither –sets or –nodes is specified all nodes are extracted.
Synopsis
b2print_nodes.py [-h] [--sets SETS] [--items NODES] [--to TO] [--version]
[--verbose] [--debug] [--fmt FMT]
DBNAMES
positional arguments:
DBNAMES B2000++ model database name
optional arguments:
-h, --help show this help message and exit
--sets SETS Extracts all nodes of node sets. List of values must be
enclosed in quotes.
--items NODES Extracts items (nodes) by identifier (int). Default: None.
--to TO Output format: "string" specifies printable format (default),
"csv" specifies CSV format.
--floatf FMT Specifies float format. FMT='.<x>f' or '.<x>g', where <x>
is the number of digits of mantissa. Default is '.4g'.
--version Print version and stop.
--verbose Verbose output (test).
--debug Debug mode, prints traceback and optional app dependent printout.
Example: Print all nodes of model demo.b2m
:
b2print_nodes demo.b2m
Example: Print all nodes of node set``column1`` of model
demo.b2m
:
b2print_nodes --sets=column1 demo.b2m/
3.3. b2print_elements
Print mesh elements. By default all elements are printed. If neither
--sets
or --elements
or --eltypes
node is specified all
elements are extracted.
Synopsis
b2print_elements.py [-h] [--sets SETS] [--items ELEMENTS] [--eltypes ELTYPES]
[--to TO] [--fmt FMT] [--version] [--verbose] [--debug]
DBNAMES
positional arguments:
DBNAMES B2000++ model database name
optional arguments:
-h, --help show this help message and exit
--sets SETS Extracts all elements of element set(s). List of values must be
enclosed in quotes.
--items ELEMENTS Extracts and prints items (elements). int or list of int.
. --items=* extracts all elements.
Default: None. List of values must be enclosed in quotes.
--eltypes ELTYPES Extracts all elements of specific element type(s). Default: None.
List of values must be enclosed in quotes.
--to TO Output format: "string" specifies printable format (default), "csv"
specifies CSV format.
--floatf FMT Specifies float format. FMT='.<x>f' or '.<x>g', where <x>
is the number of digits of mantissa. Default is '.4g'.
--version Print version and stop.
--verbose Verbose output (test).
--debug Debug mode, prints traceback and optional app dependent printout.
Example: Print all elements (by element type!) of model
mixed.b2m
:
b2print_elements mixed.b2m
FE Mesh Elements "R2.S" (ityp=64), All elements of type R2.S
IID EID MID PID Node_1 Node_2
16 17 1 0 1 6
17 18 1 0 1 7
FE Mesh Elements "Q4.S.MITC" (ityp=71), All elements of type Q4.S.MITC
IID EID MID PID Node_1 Node_2 Node_3 Node_4
18 19 1 0 5 21 41 35
19 20 1 0 21 22 42 41
...
FE Mesh Elements "B2.S.RS" (ityp=151), All elements of type B2.S.RS
IID EID MID PID Node_1 Node_2
0 1 0 1 1 9
1 2 0 1 9 10
...
Example: Print elements 1 and 11 (by element type!) of model
mixed.b2m
:
b2print_elements --items='1,11' mixed.b2m
FE Mesh Elements "B2.S.RS" (ityp=151), Selected elements, element type B2.S.RS
IID EID MID PID Node_1 Node_2
0 1 0 1 1 9
10 11 0 1 16 17
3.4. b2print_solutions
Extracts and prints a specific solution FIELD, such as the DOF solution (DISPLACEMENTS, TEMPERATURES) or gradient solution(s).
Synopsis
usage: b2print_solutions.py [-h] [--case CASE] [--cycles CYCLES]
[--subcycle SUBCYCLE] [--mode MODE]
[--subcase SUBCASE] [--items ITEMS] [-p POINT]
[-f FIELDS] [--to TO] [--floatf FMT] [--version]
[--verbose] [--debug]
DBNAMES
Print solutions.
positional arguments:
DBNAMES B2000++ model database name
optional arguments:
-h, --help show this help message and exit
--case CASE Specifies solution case. Default is 1.
--cycles CYCLES Specifies solution cycle(s). Default is 0 (linear
solution). "*" selects all cycles. List of values must
be enclosed in quotes.
--subcycle SUBCYCLE Specifies solution subcycle. Default is None
(unspecified).
--mode MODE Specifies solution mode. Default is None (unspecified).
--subcase SUBCASE Specifies solution subcase. Default is None
(unspecified).
--items ITEMS Selects node(s)/element(s) defined by identifier (int)
or set name (str). Default '*' (all items found). List
of values must be enclosed in quotes.
List of values must be enclosed in quotes.
-f FIELDS, --field FIELDS
Specifies solution field. Valid are "dof" (DOF field,
default) | "grad" (all gradient fields) | "strains" |
"stresses" | "nbc" | "reactions" | "residuals" | |
"eforces" (element forces) | "emoments" (element
moments). Multiple specifications of "-f" accumulates fields.
--to TO Output format: "string" (printable format, default),
"csv" (CSV format).
--floatf FMT Specifies float format. FMT='.<x>f' or '.<x>g', where <x>
is the number of digits of mantissa. Default is '.4g'.
--version Print version and stop.
--verbose Verbose output (test).
--debug Debug mode, prints traceback and optional app
dependent printout.
Example: Extract and print the (default) DOF solution (here:
displacements and rotations of shell elements) of (default)
case 1. From example case
$B2EXAMPLES/static/scordelis_lo_roof
.
b2print_solutions scordelis_lo_roof.b2m
Extract and print stresses of all elements. From example case
$B2EXAMPLES/static/scordelis_lo_roof
.
b2print_solutions -f stresses scordelis_lo_roof.b2m
Extract displacements of all nodes of model test.b2m
and pipe into
a spreadsheet (libreoffice):
f=`mktemp`; b2print_solutions --to=csv test.b2m >$f; libreoffice --calc $f
3.5. b2print_buckling_loads
b2print_buckling_loads extracts and prints the buckling loads (critical loads) of all computed buckling modes of a case.
Synopsis
b2print_buckling_loads.py [-h] [--case CASE] [--version] [--verbose] [--debug] DBNAMES
Prints the buckling loads (critical loads) of all computed buckling modes of a case.
positional arguments:
DBNAMES B2000++ model database name
optional arguments:
-h, --help show this help message and exit
--case CASE Specifies solution case. Default is 1.
--version Print version and stop.
--verbose Verbose output (test).
--debug Debug mode, prints traceback and optional app dependent printout.
Example
Extract and print buckling loads from buckling analysis of example
$B2EXAMPLES/buckling/plate
.
b2print_buckling_loads --case=1 plate.b2m/
Eigenvalues and buckling loads, case 1
Contributing EBC identifiers: 2
Total reaction force F=(-1.586e+05, 2.183e-11, 1.01e-14, amplitude Famp=1.586e+05
Mode Lambda Crit. load
1 0.01718 2725 *
2 0.03948 6262 *
3 0.05028 7973 *
4 0.06912 1.096e+04 *
5 0.08614 1.366e+04 *
6 0.1099 1.743e+04 *
7 0.1128 1.789e+04 *
8 0.1335 2.117e+04 *
9 0.1628 2.582e+04 *
10 0.1632 2.588e+04 *
Lambda (eigenvalue): if > 1 no buckling, < 1 buckling, marked by *
Critical load: F * Lambda (if F != 0)
Reaction force: Sum of reactions due to EBC and NBC
3.6. b2print_eigenfrequencies
b2print_eigenfrequencies extracts and prints the eigenfrequencies of all computed vibration modes of a case.
Synopsis
b2print_eigenfrequencies.py [-h] [--case CASE] [--cycle CYCLE] [--version] [--verbose]
[--debug]
DBNAMES
positional arguments:
DBNAMES B2000++ model database name
optional arguments:
-h, --help show this help message and exit
--case CASE Specifies solution case. Default is 1.
--cycles CYCLES Specifies solution cycle(s). Default is 0 (linear solution).
"*" selects all cycles. List of values must be enclosed in quotes.
--version Print version and stop.
--verbose Verbose output (test).
--debug Debug mode, prints traceback and optional app dependent
printout.
Example
Extract and print free vibration frequencies from dynamic analysis of example
$B2EXAMPLES/dynamic/bridge
.
b2print_eigenfrequencies zaltbommel.b2m
Free vibration eigenfrequencies, case=1, cycle=0
Spectral shift=0, where="SM (around the shift value)", Termination=NORMAL
Mode lambda Omega Frequency Modal_K Modal_M
1 7.21633 2.68632 0.427542 1.77484e+06 1.28078e+07
2 7.63433 2.76303 0.43975 6.12208e+06 4.6738e+07
3 16.2045 4.02548 0.640675 1.84677e+06 2.99261e+07
4 19.129 4.37367 0.696092 1.23167e+06 2.35607e+07
5 19.3982 4.40434 0.700973 1.21437e+06 2.35565e+07
6 27.5139 5.24537 0.834826 1.50558e+06 4.14243e+07
7 36.2259 6.01879 0.957921 1.17015e+06 4.23897e+07
8 53.1086 7.28756 1.15985 2.01029e+06 1.06764e+08
9 58.4746 7.64687 1.21704 1.17419e+06 6.866e+07
10 60.9985 7.81015 1.24302 2.70139e+06 1.64781e+08
3.7. b2print_steps
b2print_steps prints load/time steps information, i.e time, delta-time, stage time, stage_number, and stage identifier of the solution cycles of a given case.
Synopsis
usage: b2print_steps [-h] DBNAME CASE
positional arguments:
DBNAME B2000++ model database name (required).
CASE Case identifier (required).
optional arguments:
-h, --help show this help message and exit
3.8. b2modal
b2modal performs a modal analysis, solving the equations of motion in structural analysis, for a given B2000++ database containing free vibration modes, initial boundary conditions dof_init, dofdot_init and dof_init, dofdot_init, and loads (nbc) from a previous b2000++ run.
Synopsis
b2modal.py [-h] [--modes MODES] -d DCASE -v VCASE [-f FCASE] [--zeta ZETA]
[--hfunc HFUNC] [--T TIME1] [--nsteps NSTEPS] [--dof_init_id DOFINIT]
[--dofdot_init_id DOFDINIT] [--dofinc DOFINC] [--version] [--verbose]
[--debug]
DBNAMES
positional arguments:
DBNAMES B2000++ model database name
optional arguments:
-h, --help show this help message and exit
--modes MODES Vibration mode identifiers to be processed. Default: 1, i.e free
vibration mode 1. List of values must be enclosed in quotes.
-d DCASE, --dynamic_case DCASE
Identifier of transient load case to be created by b2modal (no
default).
-v VCASE, --free_vibration_case VCASE
Identifier of case containing free vibration mode identifiers (no
default).
-f FCASE, --force_case FCASE
Identifier of case defining the transient analysis force vector
("right-hand side"). Default: 0 (no forces).
--zeta ZETA Modal damping value(s). Default damping. List of values must be
enclosed in quotes.
--hfunc HFUNC Name of Python module file containing time history function
"def hfunc(t):" Default: Function returning 1.0 for all t
--T TIME1 Integration time period. Default: 1.0
--nsteps NSTEPS Number of integration steps (100).
--dof_init_id DOFINIT
Identifier of initial condition DOF ("displacements"). Default: 0, i.e
no initial displacements
--dofdot_init_id DOFDINIT
Identifier of initial condition DOF-dot id ("velocities"). Default: 0,
i.e no initial velocities
--dofinc DOFINC Compute DOFs ("displacements") for each dofinc-th time step. Default:
1, i.e compute for each time step. This can be time-consuming for large
models and many time steps.
--version Print version and stop.
--verbose Verbose output (test).
--debug Debug mode, prints traceback and optional app dependent printout.
Example
See example case Linear Transient Analysis of Beam
3.9. Read CSV Files and Plot Curves
b2plot_csv reads CSV files produced by ref:classes.graphs and plots the grphs with matplotplib in one diagram.
Synopsis
b2plot_csv.py [-h] [-o ONAME] [--legend LEGEND] [--lfontsize LFONTSIZE] [--title TITLE]
[--lx LABELX] [--ly LABELY] [--xscale SCALEX] [--yscale SCALEY]
[--linew LINEW] [--width WIDTH] [--height HEIGHT] [--fontsize FONTSIZE]
[--marker MARKER] [--show] [--colors COLORS] [--version] [--verbose]
[--debug]
[FILE [FILE ...]]
positional arguments:
FILE CSV x-y values file name.
optional arguments:
-h, --help show this help message and exit
-o ONAME, --output ONAME
Plot file name. Default: output.svg
--legend LEGEND Plot legend at position (matplotlib): 'best', 'upper right', 'upper
left', 'lower left', 'lower right', 'right', 'center left', 'center
right', 'lower center', 'upper center', 'center'. Default: 'best'.
--lfontsize LFONTSIZE
Legend font size in pt.
--title TITLE Graph title.
--lx LABELX X-axis label.
--ly LABELY Y-axis label.
--xscale SCALEX X axis values scale factor (1.0).
--yscale SCALEY Y axis values scale factor (1.0).
--linew LINEW Curve line width in mm (0.5). 0.0 draws no solid line.
--width WIDTH Graph width in mm (150.).
--height HEIGHT Graph height in mm (100.).
--fontsize FONTSIZE Font size in pt (12).
--marker MARKER Curve marker (matplotlib sysmbols). Default is no marker.
--show Display figure on screen.
--colors COLORS Color names (strings must be enclosed by '' and separated by comma).
Default: colors="'k','r','g','b','c','m','y','brown'".
--version Print version and stop.
--verbose Verbose output (test).
--debug Debug mode, prints traceback and optional app dependent printout.
3.10. Plot Stress Stack
Plot or print the stress or strain or failure values through a
laminate stack. The plot is generated in a file
WHAT-ELID-POINT.svg
. The default field is stresses
.
Synopsis
b2plot_stress_stack.py [-h] [--case CASE] [--cycles CYCLES] [-e ELIDS] [-p POINT]
[-f FIELD] [--scale SCALE] [--tol TOL] [--xunits XUNITS]
[--yunits YUNITS] [--print] [--show] [--version] [--verbose]
[--debug]
DBNAMES
positional arguments:
DBNAMES B2000++ model database name
optional arguments:
-h, --help show this help message and exit
--case CASE Specifies solution case. Default is 1.
--cycles CYCLES Specifies solution cycle(s). Default is 0 (linear solution). "*"
selects all cycles. List of values must be enclosed in quotes.
-e ELIDS, --elements ELIDS
Selects element(s) or element group name(s). Default is element 1. List
of values must be enclosed in quotes.
-p POINT, --point POINT
Specifies Gauss point <ip> (idents start at 1). Default: 1.
-f FIELD, --field FIELD
Specifies field ("stresses").
--scale SCALE Stress scale factor. Default: 1.0.
--tol TOL Threshold for displaying values. Values below are cut off. Default:
1.0e-10)
--xunits XUNITS X-axis units to be displayed. Default: None.
--yunits YUNITS Y-axis units to be displayed. Default: None.
--print Print table instead of creating plot file.
--show Show plot on display.
--version Print version and stop.
--verbose Verbose output (test).
--debug Debug mode, prints traceback and optional app dependent printout.