B2000++ Applications
This chapter describes how to launch executable programs and scripts. All programs and scripts must be launched from a shell, such as the bash shell.
Application |
Description |
|---|---|
Executes the B2000++ solver. |
|
Executes the B2000++ input processor solver. |
|
Add 6th DOF to MITC shell element nodes. |
|
Creates shell-to-solid coupling elements (SSC) and adds them to the B2000++ model database. |
|
Computes volume, mass, and center of gravity (cog) of model. |
Application |
Description |
|---|---|
Converts a subset of Nastran® bulk data deck (BDF) commands to a MDL input file. |
Application |
Description |
|---|---|
MemCom data set browser. |
|
Execute B2000++ tests. |
|
B2000++ FE model browser. |
|
Delete B2000++ FE model database(s). |
Solvers
b2000++
b2000++ launches the B2000++ solver. If NAME is a B2000++ model database, b2000++ launches the solver. If NAME is a MDL text file, b2000++ launches the input processor b2ip++ followed by the solver.
Synopsis
b2000++ [OPTIONS] NAME
Options
NAMEMDL input file name or B2000++ model database name. If
NAMEis a B2000++ model database with the extension.b2m, b2000++ launches the solver without processing the input file. IfNAMEis a MDL text file with the extension.mdl, b2000++ launches the input processor b2ip++ followed by the solver. Note that the solver will delete an existing B2000++ database if NAME is a MDL text file with extension.mdl.
Options
-adir <key>=<value>Adds or override an analysis directive by assigning a value to a key.
-define <var>=<value>Sets the MDL variable <var> to <value>. This option can be specified multiple times. It overrides default values defined in the MDL file if the assignment operator ?= has been applied in the MDL file.
-h | -helpPrints short help message and stops.
-l <log>Prints the execution log events.
-max-cpuLimits the maximum allowed CPU time, in seconds (float). When time limit has been reached, the program aborts. By default, no limit on the CPU time is imposed.
-max-memLimits the maximum allowed size of allocated virtual memory, counted in MB (int). When the allocated memory has reached or exceeded this limit, the program aborts. By default, no limit on the virtual memory size is imposed.
-versionPrints the version number and stops.
Options (Debugging)
-backtraceWrites the stack back-trace to the console (standard error) if an unexpected termination occurs (C++-exception not handled or signal to terminate the process). This option must be the first in the argument list.
-fexpEnables traps of the floating-point exceptions FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW. These traps will trigger a C++ exception.
-gdbStarts b2000++ in the gdb debugger and stops at the start of the main function. This option must be the first in the argument list.
-list-loggersPrints the list of all encountered log names to the console at the end of the program’s execution. Note that this list is problem-dependent, i.e. it depends on what elements, materials, solvers, constraints, etc. are invoked.
-list-typesPrints the list of all registered C++ objects (solvers, elements, boundary conditions, etc.) and stops.
-nocatchDo not catch any C++ program exception nor any signal in the main function.
-valgrind <options>Starts b2000++ with valgrind (if installed). This option must be the first in the argument list. If
optionsare specified they comma-split into multiple valgrind options. Example:valgrind,--db-attach=yespasses the option
--db-attach=yesto valgrind.-timer-maxrankControl the MPI ranks which should write their timing measurements to disk (one file per rank). Only MPI processes with a lower rank than the given number will write this information. Default is 1, which means only the root process is to write this timing information
Event Logging
By default, b2000++ stores only a small number of event messages,
these are written to the file DBNAME/log.txt. Example: Typing
$ b2000++ demo.mdl
produces the log file demo.b2m/log.txt:
INFO:all:16:54:12.886: Start
INFO:solver.linearised_prebuckling:16:54:12.887: Start the linearised prebuckling solver for the case 1.
INFO:domain:16:54:12.887: Total number of DOfs: 105.
INFO:solver.linearised_prebuckling:16:54:12.887: Assemble the linear problem.
INFO:solver.linearised_prebuckling:16:54:12.888: Element matrix assembly
INFO:solver.linearised_prebuckling:16:54:12.888: Resolve the linear problem
INFO:solver.linearised_prebuckling:16:54:12.889: Compute gradients and reaction forces
INFO:solver.linearised_prebuckling:16:54:12.890: Assemble the stability matrix.
INFO:solver.linearised_prebuckling:16:54:12.891: Eigenvalue problem resolution
INFO:solver.linearised_prebuckling:16:54:12.894: End of linearised prebuckling solver
INFO:all:16:54:12.894: End of execution
Event logging is controlled with the command-line option -l. The most common use is to display the progress of an analysis to the terminal, which is the same as what is written to the log file by default.
The Syntax of the -l option is:
-l "<LEVEL> [of <NAME> [in <DESTINATIONS>]]"
The quote characters can be omitted if only <LEVEL> is specified.
A level of importance is associated to each log message:
critical | error | warning | info | data | debug
<LEVEL> is, in increasing order, debug, data, info, warning,
error, critical.
If the level is set to info, all messages of importance info plus all messages of higher importance (warning, error, and critical) are logged. All other messages are suppressed.
In addition to the level of importance, to each message, a comma-separated list of names (strings) is associated. The most important logger names are:
allAll logging events (default).
elementsLogging events created by element objects.
linear_algebraLogging events created by sparse-matrix (linear algebra) solvers. In conjunction with the debug` level, this will print an extensive report including the time spent for the matrix factorization and an error analysis on the linearized system of equations.
solver
Logging events created by (linear and nonlinear) Finite-Element
solvers.
The comma-separated list DESTINATIONS indicates where the log message is output. The most common is cout (default), meaning that color-highlighted log messages will be printed to the terminal.
errThe standard shell error output stream with color highlighting.
coutThe standard output stream with color highlighting (default).
outThe standard output stream without color highlighting.
fileThe text file
DBNAME/log.txt.dbThe MemCom database
DBNAME/log.mc. Can only be used in conjunction withdata. Useful for debugging purposes.raiseRaises a C++-Exceptio when a log message is generated. Useful for debugging purposes.
Examples
Print all messages from the sparse matrix solver and from the analysis solver to the terminal. The content of the log messages depends on the type of sparse matrix solver but typically includes the condition number of the global stiffness matrix, the number of floating-point operations and the time that was needed for factorization.
b2000++ -l 'debug of linear_algebra' demo.mdl
Print all element-specific messages of level data or higher of all
names starting with elements to the terminal:
b2000++ -l 'data of elements' demo.mdl
Specify multiple logging directives that write element-specific and
solver-specific data log messages to the logging database. The logging
database demo.b2m/log.mc contains the per-element stiffness
matrices, the global stiffness matrix, and other data.
b2000++ -l 'data of elements,solver in db' demo.mdl
Defining MDL Variables on the Command-line
Parametric MDL files can be steered from the command-line by means of the -define command-line option. It sets the variable to the specified value. This can be used to set variables that are not set in the MDL file, or that are set with the operator ?=. The values that can be assigned to MDL variables with the -define command-line option are restricted to constants of the following types:
A string.
The bool values
trueandfalse.An integer number.
A floating-point number.
The following specifies a different element type eltype and a
finer mesh (mr) for the demo.mdl example:
b2000++ -define eltype="T3.S.MITC" -define mr=4 demo.mdl
Note that the quote characters around the string value
T3.S.MITC could be omitted since it contains neither spaces nor
any other special characters such as \* or ? that would be
expanded by the shell.
Command-line Analysis Directives
One or several analysis directives can be specified on the command line; they override what was specified in the MDL file.
Example: Compute the free-vibration modes instead of the buckling
modes initially specified in the case 1 block of the MDL imput
file:
b2000++ -adir case1.analysis=free_vibration demo.mdl
The syntax is as follows: The -adir option is followed by a string of the form [case*x*.]*key*=value* where case*x* specifies the analysis case, i.e. case1 indicates the analysis case 1. If the case is omitted, the settings in the adir section will be overridden instead. key is a string and value is one of the following:
A string. For example -adir case1.analysis=linear will insert for the analysis case 1 the MDL command analysis linear.
An integer number.
A floating-point number.
An array of integer numbers, enclosed by quotes
".An array of floating-point numbers.
Solver Error Messages
B2000++ prints error messages as a string
ERROR:category:hh:mm:ss.ms: Error message
Some common error messages related to inconsistencies in the MDL file which are not detected by the input processor, but which are detected by the b2000++ solver instead are listed below:
Incompatible essential boundary condition
Incompatible essential boundary condition for set EBC.*.0.0.x entry ???, expected value is y but given value is z
Multiple essential boundary conditions have been defined at specific DOF’s of specific nodes. Check the definition of essential boundary conditions of ebc set
xand their possible interference with the MDL join and linc commands.DBError: The number of DOF’s of node is less than…:
DBError: The number of DOF's of node is less than the DOF number specified in the database (has node a type?). Dataset: ...
A boundary condition has been applied to a node which is not connected, i.e. it has not been assigned to an element.
Timing information
Within the b2000++ source code timers can be used to measure
the time of some of relevant code segments.
Each MPI process will write the information on its timers
in CSV format into a file within the *.b2m directory named
timing_<date_time>_p<rank>.
With the -timer-maxrank command line option the maximal
number of ranks that write such a file can be limited.
By default only the root process will write its timers to
disk.
b2ip++
b2ip++ launches the B2000++ input
processor. b2ip++, reads a MDL file (a text file with the
extension .mdl) and transforms it to a new B2000++ database (a
binary file with the extension .b2m). b2ip++ deletes an
existing B2000++ database NAME.
Note
Since the b2000++ solver can execute b2ip++, an explicit invocation of the b2ip++ program by the user is in general not necessary; however it may be useful if the generated model should be examined before carrying out the analysis.
Synopsis
b2ip++ [OPTIONS] NAME
Options
NAMEB2000++ input file name. Note that b2ip++ deletes an existing model database with the same name but with the extension
.b2m.
Options
-define <var>=<name>Pass MDL variables to the application.
<var>=<name>`sets the MDL variable<var>to<value>. This option can be specified multiple times. In conjunction with the conditional MDL assignment operator?=, default values can be set in the MDL file that can be overridden with the -define option on the command-line.-hPrints short help message and stops.
-iponlyDo not execute any additional programs required by the b2000++ solver, such as the program which adds 6 degrees-of-freedom nodes for MITC shell elements or the shell-to-solid coupling program.
-iponlyis used in situations where the additional programs are being executed explicitly after the b2ip++ program.-versionPrints the version number and stops.
-backtraceWrites the stack back-trace to the console (standard error) if an unexpected termination occurs (C++-exception not handled or signal to terminate the process). This option must be the first in the argument list.
-valgrindStarts b2000++ with valgrind (if installed). This option must be the first in the argument list. If VALGRIND_OPTION is present, it is comma-split into multiple valgrind options. Example:
valgrind,--db-attach=yes
passes the option
--db-attach=yesto the program valgrind.
b2mass
b2mass launches the B2000++ mass processor, which computes the volume, the mass, and the center of gravity (cog).
Synopsis
b2mass [OPTIONS] DBNAME
Options
DBNAMEName of the B2000++ model database. DBNAME must contain the suffix
.b2m.
Options
-hPrint command summary and stops.
-verbosePrints computed masses.
-versionPrints the version number and stops.
Additional Information
The numerical integration of the quantities involves structural and non-structural mass element integration rules and considering laminate stacking sequences and beam cross-sectional properties. The quantities are calculated for all elements (total), as well as for any combinations of element sets and element lists defined in the model.
All quantities are saved to the database DBNAME in the
dataset MASS_AND_COG. By default, no output is printed to the
terminal.
Note
b2mass is not required for running b2000++, because b2000++ computes all relevant mass information internally. b2mass is only required if the user wants to check generated masses and volumes (this is done with the b2mcbrowser database browser or with the b2browser model browser.
b2add_6dof
b2add_6dof modifies node types of nodes connected to MITC shell elements such that certain nodes become 6 DOF nodes by adding the drill rotation DOF. One of the criteria for modifying the node types is the intersection angle between MITC shell elements. Other criteria are related to essential boundary conditions and to linear constraint equations.
b2add_6dof is automatically launched by the b2ip++ input processor if MITC 5/6 DOF shell elements are present in the model.
Synopsis
b2add_6dof [OPTIONS] DBNAME
Options
DBNAMEName of the B2000++ model database. DBNAME must contain the suffix “.b2m”.
Options
-hPrint command summary and stops (-help is a synonym).
-noexecDo not execute modifications. Used together with -verbose to get the list of modifications.
-shell-intersection-angle <angle>Angle in degrees for detecting 6 DOF nodes (float). If elements attached to a node under an angle greater than
<angle>the node becomes a 6 DOF node.-verbosePrints computed masses.
-versionPrints the version number and stops.
b2add_ssc_elements
b2add_ssc_elements creates shell-to-solid coupling elements (SSC) and adds them to the B2000++ model database DBNAME. Alternatively, the MDL element definitions generated by b2add_ssc_elements can be printed.
This program is automatically executed by b2ip++
if the add_ssc directive is set in adir.
Synopsis
b2add_ssc_elements [OPTIONS] DBNAME
Options
DBNAMEName of the B2000++ model database. DBNAME must contain the suffix
.b2m.
Options
-hPrint command summary and stops.
-mdlWrite the generated MDL language elements to the console. The database is not modified.
-only-tfCreate
.TFelements everywhere. Default is to create.TFelements at nodes which are not coincident with the shell reference surface.-start-eid BRANCH.EIDStart numbering SSC elements for branch BRANCH (int) with the identifier EID (int).
-tolerance <tol>Tolerance for the matching criterion (float). Default is 1e-3.
-verbosePrints computed masses.
-weight <w>Defines the penalty weight (float). Default is 1e8. Only used for non-MITC elements.
-without-tfDo not create any
.TFelements. Default is to create.TFelements.
Data Converters
This chapter describes all available data converters. All programs must be launched from a shell, such as the bash shell.
b2convert_from_nas
b2convert_from_nas converts a subset of Nastran® bulk data deck (BDF) entries and converts it to a MDL input file. Any unknown entry is listed as a comment at the top of the MDL file. Any other problems encountered during the conversion process will also be reported in the form of comments at the top of the MDL file.
Note
b2convert_from_nas is not supported by SMR and may be used AS IS.
Synopsis
b2convert_from_nas [OPTIONS] <bdfname> <mdlname>
Options
<bdfname>Nastran® bulk data deck file to be read by b2convert_from_nas.
<mdlname>- MDL input file name of input file to be generated. If
<mdlname>already exists, it will be overwritten.
Options
-bdf-units UNITSSpecifies the unit system of the BDF file. UNITS is one of
lb-in(pound force inch),SI(SI units),mm-t-s(millimeters tons seconds). This option is not recommended!
-hPrint command summary and stops.
-mdl-units UNITSSpecifies the unit system of the MDL file. UNITS is one of
lb-in(pound-force inch),SI(SI units),mm-t-s(millimeters tons seconds). The scaling factors for the different quantities are determined automatically. This option is not recommended!-permuteSpecifies permutation for the x-, y-, and z-axes (see Axes Permutation below).
-scale-forceScale forces of BDF data (e.g. BDF FORCE1 and FORCE2 cards).
-scale-lengthScale lengths of BDF data (and derived quantities such as areas, volumes, and area moments).
-scale-massScale BDF masses.
-scale-modulusScale BDF elastic and shear moduli.
-scale-momentScale BDF moments/torques.
-scale-densityScale BDF densities.
-stabilize-beam-propertiesStabilization factor for beam cross-section properties with zero area moments, torsion moments, etc., to avoid singularities. Default is 1e-6.
-no-shear-panelsReplace CSHEAR/PSHEAR Nastran elements by B2000++ CSHELL/PSHELL elements.
-ignore-wtmasDo not take into account the WTMASS parameter if specified in the BDF file.
-verbosePrints scaling factors and other information.
-versionPrints the version number and stops.
The command -permute=[ABC] specifies permutation for the x-, y-, and z-axes. A indicates which direction is mapped onto the x-axis. B indicates which direction is mapped onto the y-axis. C indicates which direction is mapped onto the z-axis. A lowercase characters indicates a negative direction, while an uppercase character indicates a positive direction. A, B, and C take the values
X|x|Y|y|Z|z
A lowercase character indicates a negative direction, while an uppercase character indicates a positive direction.
Thus, -permute=XYZ means no permutation. To swap y- and z-axes, specify -permute=XZY. To rotate around the x-axis by -90 degrees, specify -permute=XZY.
Utility Programs
This chapter describes utility programs and scripts of the B2000++ package. All programs and scripts must be launched from a shell, such as the bash shell.
b2mcbrowser
b2mcbrowser is a GUI based application for inspecting the B2000++ model database with the mcbrowser. It opens the MemCom database associated to the B2000++ model database DBNAME and displays a list with all datasets. By clicking on a dataset name the dataset is displayed in a separate window. Datasets cannot be modified with b2mcbrowser. To modify the database, run Python with the module pymemcom.
Synopsis
b2mcbrowser DBNAME
Options
DBNAMEName of the B2000++ model database.
DBNAMEmust contain the suffix “.b2m”.
b2testrunner
The b2testrunner application runs through all or selected unit test cases, see B2000++ examples and verification unit test cases.
Synopsis
b2testrunner [OPTIONS] DIRECTORY
Options
DIRECTORYPath to the top-level directory containing the tests to be executed. All test cases found in this directory and in its sub-directories will be run (if the -n option is not used).
Options
-fIncludes tests that are known to fail. Default: Run only tests that are not marked as known-to-fail.
-hDisplays this message and stops.
-j <np>Runs jobs test cases in parallel. The number of processes <np> (int) should be less or equal to the number of CPU cores.
-l <level>
Test cases are marked according to the size of the problem. the l option will execute test cases up to the specified size
<level>.<level>takes the valuessmall,medium,big,all. By default, all test cases are executes. Setting<level>tosmallwill run the most basic tests, but not the more time-consuming test cases. Thus, this option is useful for quick testing during development.
-n <name>
Runs only those test cases where the name of the test function matches the string
<name>.
-t <resultdir>By default, b2testrunner creates atemporary tracing directory for each test case in the current directory which is removed after the execution of the test. If -t is specified, the directory
<resultdir>is created and will contain a copy of the test case directory hierarchy, which includes the MDL files involved in the test, the B2000++ databases, the logs, etc.-v <level>Sets the level of verbosity
<level>(int). Default is 2.
Additional Information
b2testrunner prints the name and and short description of
each test case, together with the test result (OK, FAIL, and
ERROR). ERROR means that the test could not be terminated
successfully, while FAIL means that execution was successful, but
the computed values were found to be incorrect. After all tests have
been executed, the b2testrunner program prints a summary of
all test cases that did not succeed, except those marked as known to
fail in their respective __init__.py files.
b2testrunner creates several temporary directories in the
directories from where it is launched. Although these directories are
removed b2testrunner has terminated, some files may hang
around if b2testrunner had crashed for some reason. It is
therefore advisable to copy the complete
<prefix>/share/b2000pp_data tree to a directory of your choice,
such as /tmp, and to run it from there.
Example run
Execute all test cases contained in directory $B2EXAMPLES. Run
tests from directory /tmp:
cd /tmp
b2testrunner -j 16 $B2EXAMPLES
examples/dynamic/simple_beam.py: ... ok
...
examples/buckling/panel_3stringers.py: ... ok
Ran 25 tests in 11.154s
OK
The amount of information printed by the b2testrunner
program can be large. In the following example, the output is written
to both the terminal and the file out.txt, which can be inspected
with an editor (note that the redirection syntax is proper to
sh and bash shells):
cd /tmp
b2testrunner -j 16 $B2EXAMPLES 2>&1 | tee out.txt
See also
b2rmdb
Removes one or more B2000++ model databases and all
related directories. b2rmdb will only remove directories
with the suffix .b2m and which are valid B2000++ model databases. If
DBNAME is omitted, all databases in the current working directory are removed.
usage: b2rmdb.py [-h] [-f] [-r] [-v] DBNAME [DBNAME ...]
Positional Arguments
- DBNAME
Name(s) of database(s) to be removed. Names must contain suffix
.b2m
Named Arguments
- -f
Remove without prompting for permission and without messages. If the model database does not exist, do not display a diagnostic message or modify the exit status to reflect an error.
Default:
False- -r, -R
Remove databases recursively in the file hierarchy rooted in each file argument. Any other files anddirectories are left intact.
Default:
False- -v
Verbose mode
Default:
False
Examples
Remove the B2000++ model database demo.b2m:
b2rmdb demo.b2m
remove demo.b2m? y
Remove the B2000++ model database demo.b2m without prompting for
confirmation:
b2rmdb -f demo.b2m
Remove all B2000++ model databases in the current directory:
b2rmdb *
remove demo1.b2m? y
remove demo2.b2m? y
Remove all B2000++ model databases in the directory examples, but leave files and other sub-directories intact:
b2rmdb -r examples
remove examples/solid_mechanics/plate_buckling/buckling.b2m? y
remove examples/solid_mechanics/scordelis_lo_roof/scordelis_lo_roof.b2m? y
remove examples/solid_mechanics/cable_stayed_bridge_vibrations/zaltbommel.b2m? y
remove examples/solid_mechanics/soil_freezing/soil.b2m? y
remove examples/solid_mechanics/cook_membrane/cook_membrane.b2m? y
remove examples/solid_mechanics/euler_beam_buckling/beam.b2m? y
remove examples/solid_mechanics/simple_beam_dynamic/beam.b2m? y
remove examples/solid_mechanics/strip_with_circular_hole/he20.b2m? y
remove examples/solid_mechanics/composite_panel_buckling/shell.b2m? y
remove examples/solid_mechanics/composite_panel_buckling/solid.b2m? y
Remove all B2000++ model databases in the directory examples without prompting for confirmation:
b2rmdb -rf examples