OpenGeoRock
5.2

Command-line interface

Describes OGR Slip2D 0.1.235

ogr-slip2d-cli runs OGR Slip2D without its window. It summarises a project, computes it as the project describes and writes the results to HDF5, lists the methods and strength models, and writes the demo slope to a file. compute goes through the same analysis code as Analysis → Compute, so a run without options gives the numbers the window gives. The last section covers the options of the graphical program's launcher.

5.2.1Running it#

The command is installed with the package (Section 1.1); python -m ogr_cli is the same program. Every command accepts --help.

Table 5.2.1 Commands of ogr-slip2d-cli.
CommandWhat it does
info PROJECTShows a summary of a .ogr project.
compute PROJECT [options]Runs the analysis the project describes, prints the critical value of each method and saves the results to HDF5.
methodsLists the limit-equilibrium methods with the equilibrium each satisfies.
strength-modelsLists the strength models with their parameters and units.
new-demo OUTPUTWrites the demo slope as a .ogr file.

Besides --help, the command takes the two options of its command-line library, --install-completion and --show-completion, for shell completion.

5.2.2info#

ogr-slip2d-cli info slope.ogr

Prints a table with the path, the author and company of the project summary, the number of boundaries, materials, supports, distributed loads and line loads, whether the pseudo-static seismic load is on, and the bounding box (xmin, ymin, xmax, ymax, in m). A second table lists each material with its strength model, its unit weight γ, its saturated unit weight γsat (shown only when the material uses it below the water surface) and its colour. A file that does not exist ends with exit code 1.

5.2.3compute#

ogr-slip2d-cli compute PROJECT [--method M] [--slices N] [--nx N] [--ny N]
                               [--dr N] [--search S] [--samples N] [--output FILE]

Every option defaults to the value stored in the project; an option given overrides only that setting, and only for this run. The overrides are applied to the copy loaded in memory, so a calculation does not modify the .ogr file.

Table 5.2.2 Options of compute and the project setting each one overrides.
OptionValueOverridesNotes
--methodtextmethods.enabled_methodsOne method id or alias (Table 5.2.3). Without it, the methods enabled in the project, or Bishop simplified if none is enabled. An unknown name ends with exit code 2.
--slicesintegermethods.num_slicesNumber of slices per surface.
--nxintegersearch.grid_nxGrid of centres: number of intervals along x (centres = nx + 1).
--nyintegersearch.grid_nyThe same along y.
--drnumbersearch.radius_incrementRadius increment as a number of intervals (radii per centre = dr + 1); the grid search rounds it to a whole number.
--searchtextsearch.search_methodgrid, slope, auto_refine, block, path, simulated_annealing or particle_swarm.
--samplesintegersearch.num_surfaces, search.block_num_surfaces, search.path_num_surfacesNumber of surfaces of the Slope, Block and Path searches.
--outputpath—HDF5 results file; by default the project path with the extension .h5 (see Output files).
--search is not checked

The help text of --search lists six values; particle_swarm, the seventh search, is accepted too. A value that is not one of the seven is not rejected: the engine runs a Grid Search for any id it does not know, and no note says so. Spell the search exactly, or set it in the project.

Table 5.2.3 Names accepted by --method. Case is ignored, and hyphens and spaces count as underscores.
Method idAlso accepted
bishop_simplifiedbishop
janbu_simplifiedjanbu
janbu_corrected—
ordinary_felleniusordinary, fellenius
spencer—
gle_morgenstern_pricegle, morgenstern_price
lowe_karafiathlowe
corps_engineers_1corps1, coe1, modified_swedish
corps_engineers_2corps2, coe2

What compute does#

  1. Loads the project and applies the overrides in memory.
  2. Checks that the project can be analysed as configured. If it cannot, it prints every reason after Cannot compute: and ends with exit code 3, instead of reporting a number computed from settings it would have to drop. Examples: materials that take their pore pressure from a finite-element field that has not been computed (the run would report u=0u = 0 everywhere, which looks like a dry slope), a rapid-drawdown setup that cannot apply, a Block Search without the objects it needs, seismic coefficients out of range, a strength model with invalid parameters, or a setting name that has been retired.
  3. Runs the analysis through the same analysis runner as the window: the design-standard partial factors applied to a copy, rapid drawdown, the project's search with its filters, slope limits and focus objects, the convergence settings, the random seed and the admissibility checks (Section 5.3).
  4. Prints the notes of the run (lines starting Note:), then one table row per method: the critical value, the numbers of valid, invalid and attempted surfaces, the surfaces removed by focus objects (a column shown only when a focus object removed some) and whether the critical surface converged.
  5. Writes the results to HDF5 (see Output files).
Table 5.2.4 What the value column of compute holds.
Column headingWhenValue
Critical FoSno design standard, no seismic Ky modefactor of safety of the critical surface
Over-design factora design standard is activethe factor obtained with factored inputs; it must exceed 1. A line Design standard applied: … says so and lists the notes of the standard.
Critical KyCompute Ky onthe lowest critical seismic coefficient of the surfaces searched
Newmark disp. (cm)Newmark analysis onpermanent displacement of the critical surface, in centimetres
Known defect

With a design standard and a seismic Ky or Newmark mode both on, the column is headed Over-design factor while the values printed are the critical seismic coefficients (or the displacements). The window and the operations layer caption them by the seismic quantity. The program's code declares this as a defect of the command line and leaves it unchanged in v0.1.235.

A run on the demo slope (Section 5.2.6), whose project enables Bishop simplified and Janbu simplified:

ogr-slip2d-cli new-demo demo
ogr-slip2d-cli compute demo.ogr

Note: The Failure Direction is set to Right to Left, which puts the crest on the right,
but the ground surface is higher on the left (y = 25 at the left end against y = 15 at
the right end). Tension-crack water thrust, support force direction and the Path Search
starting face all read this setting.
                              grid — 2 method(s)
┌───────────────────┬──────────────┬───────┬─────────┬───────────┬───────────┐
│ Method            │ Critical FoS │ Valid │ Invalid │ Attempted │ Converged │
├───────────────────┼──────────────┼───────┼─────────┼───────────┼───────────┤
│ bishop_simplified │ 1.0914       │ 1366  │ 493     │ 1859      │ True      │
│ janbu_simplified  │ 1.0434       │ 1379  │ 480     │ 1859      │ True      │
└───────────────────┴──────────────┴───────┴─────────┴───────────┴───────────┘
Results saved: demo_bishop_simplified.h5
Results saved: demo_janbu_simplified.h5

The grid of the demo has 12 × 12 intervals and a radius increment of 10, so 13 × 13 × 11 = 1859 circles are attempted per method. The note about the failure direction appears because the demo is saved with the program's default direction (right to left) although its slope falls to the right; as the note says, that setting matters for tension-crack water, supports and the Path Search, none of which this run uses.

Output files#

  • One method: the file given with --output, or the project path with the extension .h5 (slope.ogr → slope.h5).
  • Several methods: one file per method, named after the base file with the method id appended: slope_bishop_simplified.h5, slope_spencer.h5… With --output results/run.h5 the names are results/run_<method_id>.h5.
  • A missing folder is created and an existing file of the same name is overwritten.

Each file holds one search: every surface analysed with its slices, and summary arrays. The layout is described in Section 5.4.5. When the window computes a project that has a file (opened or saved), it writes the first method's result to the same <project>.h5 name.

Exit codes#

Table 5.2.5 Exit codes of ogr-slip2d-cli.
CodeMeaning
0Success. A method that found no valid surface is reported as no valid surface in its row and still exits with 0.
1The project file does not exist (info, compute).
2Unknown method name in --method; also any usage error reported by the command-line library (a missing argument, an unknown option).
3The project cannot be analysed as configured; the reasons are printed.
4The run produced no result for any method.

5.2.4methods#

Lists the nine registered methods with their id, display name and whether they satisfy force and moment equilibrium; the ids are those accepted by --method and by the operations layer (Section 3.2).

ogr-slip2d-cli methods

                           Registered LEM methods
┌───────────────────────┬─────────────────────────┬───────────┬────────────┐
│ ID                    │ Display Name            │ Force eq. │ Moment eq. │
├───────────────────────┼─────────────────────────┼───────────┼────────────┤
│ bishop_simplified     │ Bishop Simplified       │ —         │ ✓          │
│ gle_morgenstern_price │ GLE / Morgenstern-Price │ ✓         │ ✓          │
│ janbu_simplified      │ Janbu Simplified        │ ✓         │ —          │
│ janbu_corrected       │ Janbu Corrected         │ ✓         │ —          │
│ corps_engineers_1     │ Corps of Engineers #1   │ ✓         │ —          │
│ corps_engineers_2     │ Corps of Engineers #2   │ ✓         │ —          │
│ lowe_karafiath        │ Lowe-Karafiath          │ ✓         │ —          │
│ ordinary_fellenius    │ Ordinary / Fellenius    │ —         │ ✓          │
│ spencer               │ Spencer                 │ ✓         │ ✓          │
└───────────────────────┴─────────────────────────┴───────────┴────────────┘

5.2.5strength-models#

Lists the 22 registered strength models with their id, display name and parameters with units, for example mohr_coulomb (cohesion in kPa, friction angle in degrees), hoek_brown (sigci in kPa, mb, s, a) or barton_bandis (phi_r, JRC, JCS, max_total_friction). Models defined by a table or by other materials, such as shear_normal_function or generalized_anisotropic, show no parameters. The models are described in Section 3.5.

ogr-slip2d-cli strength-models

5.2.6new-demo#

ogr-slip2d-cli new-demo demo          # writes demo.ogr

Writes the demo slope, the same model as File → Load Demo Slope in the window and project_new(template="demo") for an agent: a homogeneous slope 10 m high at 1V:1H, external boundary (0, 0)–(50, 0)–(50, 15)–(35, 15)–(25, 25)–(0, 25), one Mohr–Coulomb material "Silty clay" (c′=10c' = 10 kPa, ϕ′=25∘\phi' = 25^\circ, γ=19\gamma = 19 kN/m³) and a horizontal water table at y = 8 m assigned to it. The extension .ogr is added when the name does not end with it, replacing any other extension.

5.2.7The graphical launcher#

The desktop program starts with ogr-slip2d or, equivalently, python -m ogr_gui. The launcher has one option of its own:

Table 5.2.6 Options of the graphical launcher.
OptionMeaning
--no-agent-bridgeStart without the agent bridge, so that no MCP server can work on this window (Section 5.1.6). It can still be switched on later in Tools → Agent bridge (MCP).
ogr-slip2d
python -m ogr_gui --no-agent-bridge

Any other argument is handed to the Qt application object. The launcher does not open a project given on the command line: the window starts with an empty project, and a file is opened with File → Open Project….

In OGR Slip2D

The command line, the window and the operations layer call one analysis runner, which is the single place where methods and searches are built from a project. It exists because, before v0.1.77, the command line read nothing from the project's settings and silently skipped rapid drawdown, the partial factors and most searches.

Source: ogr_cli/__main__.py · ogr_slip2d/analysis_runner.py · ogr_gui/__main__.py