Use when running Ansys LS-DYNA explicit/implicit FEA simulations — .k keyword file creation (hand-written or via PyDyna SDK), lsdyna batch execution, d3plot result verification, DPF post-processing
| Field | Value |
|---|---|
| Solver | Ansys LS-DYNA (explicit/implicit nonlinear FEA) |
| Execution | One-shot subprocess: lsdyna_sp.exe i=<file.k> |
| Session | Yes (supports_session = True) — Python namespace persists across sim exec (Deck builder + DPF Model). Solver itself remains one-shot inside the session. |
| SDK | ansys-dyna-core (PyDyna): keywords module for .k generation, run module for solver launch |
| Script language | LS-DYNA keyword format (.k / .key / .dyn), or Python via PyDyna |
| Post-processing | ansys-dpf-core (Python, recommended), or LS-PrePost (GUI) |
.k keyword files, building decks
via PyDyna keywords API, keyword file validation, convergence verification,
output parsing (d3hsp, glstat, messag), explicit and implicit dynamics, DPF
post-processing*KEYWORD must be the first line: Every .k file must begin with
*KEYWORD. Files without this marker are rejected.*END must terminate the file: Missing *END causes unpredictable
parsing behavior..k): LS-DYNA uses 8-character
or 10-character fixed-width fields. Misaligned data is silently misread.
Use the PyDyna keywords API to avoid this entire class of bugs.exit_code == 0 does not mean success: LS-DYNA returns exit code 0
even on error termination. Always check for N o r m a l t e r m i n a t i o n
in output (spaced characters).libiomp5md.dll) from the ANSYS tp/IntelCompiler/ tree. The sim
driver handles this automatically via PATH augmentation; PyDyna's
run_dyna() assumes a properly set up ANSYS environment.d3plot
(binary), d3hsp (text log), glstat (global stats), messag (log).
Stdout contains only progress and termination status..k vs PyDyna SDKThis skill supports two interchangeable input paths. Choose based on the task:
| Path | When to use | Pros | Cons |
|---|---|---|---|
Hand-written .k | Editing legacy decks, mesh files from ANSA/Workbench, quick smoke tests | Direct control, works without Python deps | KI-004 card alignment bugs, no IDE help |
PyDyna keywords API | New deck construction, parametric studies, anything > 50 keywords | Type-safe, IDE autocomplete, automatic formatting, DataFrame-based bulk ops | Requires pip install ansys-dyna-core |
Default recommendation: For any new deck the agent builds from scratch,
use the PyDyna SDK path. For existing .k files the user provides, modify
in place (or load via Deck.import_file() and patch with PyDyna).
See:
base/reference/pydyna_keywords_api.md for the full API referencebase/reference/pydyna_run_api.md for run_dyna() usagebase/workflows/pydyna_taylor_bar/ for the canonical end-to-end exampleThe driver supports both one-shot and persistent session modes:
sim run file.k --solver ls_dynalsdyna_sp.exe i=file.k.sim/runs/.k files, CI smoke tests, batch processingsim connect --solver ls_dyna then sim exec / sim inspectdeck, kwd, run_dyna,
workdir, model, dpf, etc.run_dyna(...)) is still a one-shot subprocess inside,
but the deck-building and DPF post-processing wrap around it interactively.sim exec that produces a d3plot, the runtime auto-loads it
into a dpf.Model so sim inspect results.summary works immediately.See base/reference/session_workflow.md for the full session protocol,
inspect targets, and patterns.
sim check ls_dyna
For PyDyna-path workflows, also verify:
python -c "from ansys.dyna.core import Deck, keywords; from ansys.dyna.core.run import run_dyna"
.k file), materials,
boundary conditions, loads, acceptance criteria, termination timePath A (hand-written .k):
sim lint <file.k>
Checks: *KEYWORD present, *END present, *NODE/*ELEMENT sections
exist, *CONTROL_TERMINATION defined.
Path B (PyDyna SDK):
from ansys.dyna.core import Deck, keywords as kwd
deck = Deck()
deck.title = "..."
# ... add keywords ...
deck.export_file("input.k")
PyDyna validates types and field constraints at attribute-set time.
Path A (sim CLI):
sim run <file.k> --solver ls_dyna
Path B (PyDyna run_dyna):
from ansys.dyna.core.run import run_dyna
run_dyna("input.k", working_directory=wd)
Check for in the output:
N o r m a l t e r m i n a t i o n (spaced characters — mandatory)*CONTROL_TERMINATION endtime*** Error or *** Fatal messagesd3plot, d3hsp, glstatFor explicit dynamics:
glstat (total energy should be approximately
conserved)DTMINDT2MS is setFor implicit:
d3hspimport ansys.dpf.core as dpf
ds = dpf.DataSources()
ds.set_result_file_path("d3plot", "d3plot")
model = dpf.Model(ds)
# Global kinetic energy time series
gke_op = dpf.operators.result.global_kinetic_energy()
gke_op.inputs.data_sources.connect(ds)
ke = gke_op.eval().get_field(0).data
# Time axis
time = model.metadata.time_freq_support.time_frequencies.data_as_list
DPF can extract any field result without requiring LS-PrePost. See the Taylor bar example for a full plot workflow.
*KEYWORD
*TITLE
Description of the model
$
$ Comments start with $
$ Fixed-width cards: 8 characters per field (standard)
$
*CONTROL_TERMINATION
$ ENDTIM ENDCYC DTMIN ENDENG ENDMAS
1.0e-3 0 0.0 0.0 0.0
*MAT_ELASTIC
$ MID RO E PR
1 7.85e-09 210000 0.3
*NODE
$ NID X Y Z
1 0.000000 0.000000 0.000000
*ELEMENT_SOLID
$ EID PID N1 N2 N3 N4 N5 N6 N7 N8
1 1 1 2 3 4 5 6 7 8
*END
* in column 1$ for comment lines*INCLUDE references external files.k references| Path | What | When to read |
|---|---|---|
base/reference/keyword_format.md | Keyword file format and card layout | Writing or modifying .k files by hand |
base/reference/material_models.md | Common material model keywords | Choosing material models |
base/reference/control_cards.md | Control card reference | Setting solver parameters |
base/reference/output_files.md | Output file types and contents | Understanding solver results |
| Path | What | When to read |
|---|---|---|
base/reference/pydyna_install.md | PyDyna installation, path config | Setting up a new project |
base/reference/pydyna_keywords_api.md | keywords module — building .k programmatically | Building decks in Python (preferred) |
base/reference/pydyna_run_api.md | run_dyna() solver launch | Running LS-DYNA from Python |
base/reference/pydyna_agent_integration.md | PyDyna's bundled AI agent docs | Agent setup --env claude --copy |
base/reference/session_workflow.md | Session mode protocol — connect/exec/inspect targets, patterns | Using sim connect --solver ls_dyna |
| Path | What | When to read |
|---|---|---|
base/snippets/01_single_hex_tension.k | Hand-written single hex element | Quickest reference for explicit dynamics |
base/workflows/single_hex_tension/ | E2E test of the hand-written snippet | Verify driver pipeline |
base/workflows/pydyna_taylor_bar/ | 🌟 PyDyna end-to-end template (impact + DPF) | Building any single-part impact problem |
base/workflows/pydyna_pendulum/ | Multi-rigid-body dynamics | Mechanism / linkage problems |
base/workflows/pydyna_pipe/ | Shell + self-contact | Thin-walled structures |
base/workflows/pydyna_buckling_beer_can/ | Nonlinear buckling | Imperfection-sensitive problems |
base/workflows/pydyna_optimization/ | Parametric sweep template | DOE / optimization studies |
base/workflows/pydyna_jupyter_plotting/ | Geometry preview in Jupyter | Notebook-based workflows |
| Path | What | When to read |
|---|---|---|
base/known_issues.md | Known issues and workarounds | Debugging failures |
solver/14.0/notes.md | LS-DYNA R14.0 (Ansys 2024 R1) notes | Version-specific behavior |